vskill 0.5.0 → 0.5.1
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.
|
@@ -65,8 +65,8 @@ ${G.join(`
|
|
|
65
65
|
What edge cases should I test?
|
|
66
66
|
+Deploy this to production
|
|
67
67
|
!What's the weather like today?
|
|
68
|
-
!Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(vr,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(vr,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(vr,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(vr,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[V," prompt",V!==1?"s":""]})]}),n.jsx("button",{onClick:B,disabled:y||!E.trim(),className:"btn btn-primary self-start",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:ae?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:br(ae)}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),f&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:f}),y&&p.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),p.length>0&&n.jsxs("div",{className:"space-y-5",children:[F.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",F.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:F.map((G,W)=>n.jsx(Ax,{result:G},`incorrect-${W}`))})]}),J.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",J.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:J.map((G,W)=>n.jsx(Ax,{result:G},`correct-${W}`))})]})]}),b&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),b.autoClassifiedCount!=null&&b.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[b.autoClassifiedCount," of ",b.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(Kc,{label:"Precision",value:b.precision,description:"Of all activations, how many were correct?",detail:`${b.tp} true / ${b.tp+b.fp} total activations`}),n.jsx(Kc,{label:"Recall",value:b.recall,description:"Of expected activations, how many fired?",detail:`${b.tp} activated / ${b.tp+b.fn} expected`}),n.jsx(Kc,{label:"Reliability",value:b.reliability,description:"Overall correct classification rate",detail:`${b.tp+b.tn} correct / ${b.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(yr,{label:"True Positive",abbr:"TP",count:b.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(yr,{label:"False Positive",abbr:"FP",count:b.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(yr,{label:"False Negative",abbr:"FN",count:b.fn,bg:"rgba(248,113,113,0.06)",color:"rgba(248,113,113,0.6)",description:"Missed activation"}),n.jsx(yr,{label:"True Negative",abbr:"TN",count:b.tn,bg:"rgba(52,211,153,0.06)",color:"rgba(52,211,153,0.6)",description:"Correctly silent"})]})]})]})]})}function vr(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Ax({result:i}){const o=Cx[i.classification]||Cx.FN,c=i.classification==="TP"||i.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:o.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${o.text} 20%, transparent)`},children:c?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:i.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:o.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:i.classification}),n.jsx("span",{style:{color:i.activate?"var(--green)":"var(--text-tertiary)"},children:i.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",i.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[i.confidence," confidence"]}),i.autoClassified&&n.jsx("span",{className:"pill",style:{background:"rgba(139,92,246,0.1)",color:"rgba(139,92,246,0.8)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),i.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:i.reasoning})]})]})}function Kc({label:i,value:o,description:c,detail:d}){const m=Math.round(o*100),h=m>=80?"var(--green)":m>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:h},children:[m,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:c}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:d})]})}function yr({abbr:i,count:o,bg:c,color:d,description:m}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:c},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:d},children:o}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:d},children:i}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:m})]})}const Jc={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},wx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},to=600,lo=180,ht=40,$c=to-ht*2,Kl=lo-ht*2,Rv=[25,50,75,100];function _x(i){return new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Mv({entries:i}){const[o,c]=v.useState(null);if(i.length<2)return null;const d=i.length,m=i.map((b,y)=>{const f=ht+y/(d-1)*$c,E=b.passRate*100,g=ht+Kl-E/100*Kl;return{x:f,y:g,pct:E,entry:b}}),h=m.map(b=>`${b.x},${b.y}`).join(" "),p=Array.from(new Set(i.map(b=>b.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative"},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:p.map(b=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Jc[b]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:wx[b]??b})]},b))}),n.jsxs("svg",{width:to,height:lo,viewBox:`0 0 ${to} ${lo}`,style:{display:"block",overflow:"visible"},children:[Rv.map(b=>{const y=ht+Kl-b/100*Kl;return n.jsxs("g",{children:[n.jsx("line",{x1:ht,y1:y,x2:ht+$c,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:ht-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[b,"%"]})]},b)}),n.jsx("line",{x1:ht,y1:ht+Kl,x2:ht+$c,y2:ht+Kl,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:ht-8,y:ht+Kl+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),m.map((b,y)=>n.jsx("circle",{cx:b.x,cy:b.y,r:5,fill:Jc[b.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:f=>{f.currentTarget.setAttribute("r","7"),c({x:b.x,y:b.y,entry:b.entry})},onMouseLeave:f=>{f.currentTarget.setAttribute("r","5"),c(null)}},y)),zv(d).map(b=>n.jsx("text",{x:m[b].x,y:ht+Kl+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:_x(i[b].timestamp)},b))]}),o&&n.jsxs("div",{style:{position:"absolute",left:o.x,top:o.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:_x(o.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:o.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Jc[o.entry.type]??"var(--text-tertiary)",color:"#fff"},children:wx[o.entry.type]??o.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(o.entry.passRate*100),"%"]})]})]})]})}function zv(i){return i<=3?Array.from({length:i},(o,c)=>c):i<=6?[0,Math.floor(i/2),i-1]:[0,Math.floor(i/3),Math.floor(2*i/3),i-1]}function gr(i){return i>=.8?"var(--green)":i>=.5?"var(--yellow)":"var(--red)"}function Lv(i){return i>=1e3?`${(i/1e3).toFixed(1)}s`:`${Math.round(i)}ms`}function Ov({rate:i,label:o}){const c=Math.round(i*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:o}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:gr(i)},children:[c,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c}%`,background:gr(i)}})})]})})}function Dv({points:i}){if(i.length<2)return null;const o=200,c=48,d=4,m=i.length,h=i.map((y,f)=>{const E=d+f/(m-1)*(o-d*2),g=d+(c-d*2)-y.passRate*(c-d*2);return{x:E,y:g}}),p=`M ${h[0].x},${c-d} `+h.map(y=>`L ${y.x},${y.y}`).join(" ")+` L ${h[h.length-1].x},${c-d} Z`,b=h.map((y,f)=>`${f===0?"M":"L"} ${y.x},${y.y}`).join(" ");return n.jsxs("svg",{width:o,height:c,style:{display:"block"},children:[n.jsx("path",{d:p,fill:"var(--accent-muted)"}),n.jsx("path",{d:b,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:h[h.length-1].x,cy:h[h.length-1].y,r:3,fill:"var(--accent)"})]})}function Bv({plugin:i,skill:o}){const[c,d]=v.useState(null),[m,h]=v.useState(!0);if(v.useEffect(()=>{h(!0),ke.getStats(i,o).then(d).catch(()=>d(null)).finally(()=>h(!1))},[i,o]),m)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!c||c.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const p=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,b=c.trendPoints.length>0?c.trendPoints[0].passRate:0,y=p-b,f=c.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:gr(p)},children:[Math.round(p*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:y>=0?"var(--green)":"var(--red)"},children:[y>=0?"+":"",Math.round(y*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]})]}),c.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(Dv,{points:c.trendPoints})]}),c.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"})]})}),n.jsx("tbody",{children:c.modelStats.map(E=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:E.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:E.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:gr(E.avgPassRate)},children:[Math.round(E.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:Lv(E.avgDurationMs)})]},E.model))})]})]}),f.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:f.map(E=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-2)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",E.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:E.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[E.totalRuns," runs"]})]}),n.jsx(Ov,{rate:E.passRate,label:E.text})]},`${E.evalId}:${E.id}`))})]})]})}function Uv({plugin:i,skill:o}){const[c,d]=v.useState(null),[m,h]=v.useState(null),[p,b]=v.useState({}),[y,f]=v.useState({});v.useEffect(()=>{ke.getEvals(i,o).then(d).catch(()=>d(null))},[i,o]);async function E(g){if(m===g){h(null);return}if(h(g),!p[g]){f(T=>({...T,[g]:!0}));try{const T=await ke.getCaseHistory(i,o,g);b(z=>({...z,[g]:T}))}catch{b(T=>({...T,[g]:[]}))}finally{f(T=>({...T,[g]:!1}))}}}return c?n.jsx("div",{className:"space-y-2 stagger-children",children:c.evals.map(g=>{const T=p[g.id]||[],z=m===g.id,B=y[g.id],q=T.length>0?T[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>E(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:z?"var(--surface-2)":"transparent"},onMouseEnter:V=>{z||(V.currentTarget.style.background="var(--surface-2)")},onMouseLeave:V=>{z||(V.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:z?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),T.length>=2&&n.jsx(Vx,{entries:T}),q!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:eo(q)},children:[Math.round(q*100),"%"]}),T.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[T.length," runs"]})]}),z&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:B?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):T.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:T.map((V,J)=>n.jsxs("div",{className:"p-4",style:{background:J===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Gx(V.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:V.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:V.type==="benchmark"?"rgba(99,131,255,0.15)":V.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:V.type==="benchmark"?"#6383ff":V.type==="comparison"?"var(--purple)":"#fb923c"},children:V.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:eo(V.pass_rate)},children:[Math.round(V.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[V.durationMs!=null&&n.jsx("span",{children:Yx(V.durationMs)}),V.tokens!=null&&n.jsxs("span",{children:[V.tokens>=1e3?`${(V.tokens/1e3).toFixed(1)}k`:V.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:V.assertions.map(F=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:F.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:F.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:F.text}),F.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:F.reasoning})]})]},F.id))})]},J))})})]},g.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function Hv(){const{state:i,dispatch:o}=ll(),{plugin:c,skill:d}=i,[m,h]=v.useState("timeline"),[p,b]=v.useState([]),[y,f]=v.useState(!0),[E,g]=v.useState(""),[T,z]=v.useState(""),[B,q]=v.useState(!1),[V,J]=v.useState([]),[F,ae]=v.useState(null),[G,W]=v.useState(!1),[te,$]=v.useState(null),[le,ge]=v.useState(!1);v.useEffect(()=>{f(!0),ke.getHistory(c,d,{model:E||void 0,type:T||void 0}).then(Z=>{b(Z),Z.length>=2&&ke.compareRuns(c,d,Z[0].timestamp,Z[1].timestamp).then(ie=>{const ve=ie.regressions.filter(N=>N.change==="regression");o({type:"SET_REGRESSIONS",regressions:ve})}).catch(()=>{})}).catch(()=>{}).finally(()=>f(!1))},[c,d,E,T]);const se=v.useCallback(async Z=>{if(B){J(ie=>ie.includes(Z)?ie.filter(ve=>ve!==Z):ie.length>=2?[ie[1],Z]:[...ie,Z]);return}ge(!0);try{const ie=await ke.getHistoryEntry(c,d,Z);$(ie)}catch{}finally{ge(!1)}},[c,d,B]),Te=v.useCallback(async()=>{if(V.length===2){W(!0);try{const Z=await ke.compareRuns(c,d,V[0],V[1]);ae(Z)}catch{}finally{W(!1)}}},[c,d,V]),pe=[...new Set(p.map(Z=>Z.model))];return y?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(Z=>n.jsx("button",{onClick:()=>h(Z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:m===Z?"var(--accent-muted)":"transparent",color:m===Z?"var(--accent)":"var(--text-tertiary)"},children:Z==="timeline"?"Timeline":Z==="per-eval"?"Per Eval":"Statistics"},Z))}),m==="timeline"&&n.jsxs("div",{children:[p.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(Mv,{entries:p})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:E,onChange:Z=>g(Z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),pe.map(Z=>n.jsx("option",{value:Z,children:Z},Z))]}),n.jsxs("select",{value:T,onChange:Z=>z(Z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{q(!B),J([]),ae(null)},className:`btn text-[12px] ${B?"btn-primary":"btn-secondary"}`,children:B?"Exit Compare":"Compare Runs"}),B&&V.length===2&&n.jsx("button",{onClick:Te,disabled:G,className:"btn btn-primary text-[12px]",children:G?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:p.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):p.map(Z=>{const ie=V.includes(Z.timestamp);return n.jsx("button",{onClick:()=>se(Z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:ie?"var(--accent-muted)":"var(--surface-1)",border:ie?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ve=>{ie||(ve.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ve=>{ie||(ve.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[B&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:ie?"var(--accent)":"var(--border-default)",background:ie?"var(--accent)":"transparent"},children:ie&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(Z.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:Z.type==="comparison"?"var(--purple-muted)":Z.type==="baseline"?"var(--surface-3)":Z.type==="model-compare"?"rgba(56,189,248,0.15)":Z.type==="improve"||Z.type==="instruct"?"rgba(168,85,247,0.15)":Z.type==="ai-generate"?"rgba(34,197,94,0.15)":Z.type==="eval-generate"?"rgba(251,146,60,0.15)":"var(--accent-muted)",color:Z.type==="comparison"?"var(--purple)":Z.type==="baseline"?"var(--text-tertiary)":Z.type==="model-compare"?"#38bdf8":Z.type==="improve"||Z.type==="instruct"?"#a855f7":Z.type==="ai-generate"?"#22c55e":Z.type==="eval-generate"?"#fb923c":"var(--accent)"},children:Z.type==="model-compare"?"model compare":Z.type==="improve"?"ai improve":Z.type==="instruct"?"ai edit":Z.type==="ai-generate"?"ai generate":Z.type==="eval-generate"?"eval generate":Z.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:Z.model}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:Z.passRate>=.8?"var(--green)":Z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(Z.passRate*100),"%"]})]})]})},Z.timestamp)})}),F&&n.jsx(qv,{result:F}),te&&!B&&n.jsx(Gv,{run:te,onClose:()=>$(null)})]}),m==="per-eval"&&n.jsx(Uv,{plugin:c,skill:d}),m==="statistics"&&n.jsx(Bv,{plugin:c,skill:d})]})}function qv({result:i}){const o=i.regressions.filter(d=>d.change==="regression"),c=i.regressions.filter(d=>d.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(i.runA.timestamp).toLocaleDateString()," vs ",new Date(i.runB.timestamp).toLocaleDateString()]}),o.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",o.length,")"]}),o.map(d=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",d.evalId," ",d.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:d.assertionId})," (was passing, now failing)"]},`${d.evalId}-${d.assertionId}`))]}),c.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",c.length,")"]}),c.map(d=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",d.evalId," ",d.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:d.assertionId})," (was failing, now passing)"]},`${d.evalId}-${d.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:i.caseDiffs.map(d=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",d.eval_id," ",d.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:d.passRateA!=null?d.passRateA>=.8?"var(--green)":d.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:d.passRateA!=null?`${Math.round(d.passRateA*100)}%`:d.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:d.passRateB!=null?d.passRateB>=.8?"var(--green)":d.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:d.passRateB!=null?`${Math.round(d.passRateB*100)}%`:d.statusB})]},d.eval_id))})]})})]})}function Gv({run:i,onClose:o}){return(i.type==="improve"||i.type==="instruct")&&i.improve?n.jsx(Yv,{run:i,onClose:o}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(i.timestamp).toLocaleString()]}),n.jsx("button",{onClick:o,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",i.model," | Cases: ",i.cases.length," | Pass Rate: ",i.overall_pass_rate!=null?`${Math.round(i.overall_pass_rate*100)}%`:"--"]}),n.jsx("div",{className:"space-y-2",children:i.cases.map(c=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",c.eval_id," ",c.eval_name]}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.pass_rate!=null?`${Math.round(c.pass_rate*100)}%`:c.status})]})},c.eval_id))})]})}function Yv({run:i,onClose:o}){var h;const c=v.useMemo(()=>i.improve?jr(i.improve.original,i.improve.improved):[],[i.improve]),d=v.useMemo(()=>{const p=c.filter(y=>y.type==="added").length,b=c.filter(y=>y.type==="removed").length;return{added:p,removed:b}},[c]),m=v.useMemo(()=>{let p=0,b=0;return c.map(y=>y.type==="removed"?(p++,{...y,origNum:p,newNum:null}):y.type==="added"?(b++,{...y,origNum:null,newNum:b}):(p++,b++,{...y,origNum:p,newNum:b}))},[c]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(i.timestamp).toLocaleString()," · ",i.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",d.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",d.removed]})]}),n.jsx("button",{onClick:o,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--surface-3)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((h=i.improve)==null?void 0:h.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.06)",border:"1px solid rgba(168,85,247,0.15)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),i.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:m.map((p,b)=>n.jsxs("tr",{style:{background:p.type==="added"?"rgba(34,197,94,0.08)":p.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:p.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:p.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"transparent",borderRight:p.type==="added"?"2px solid var(--green)":p.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:p.type==="added"?"+":p.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"var(--text-secondary)"},children:p.content||""})]},b))})})})]})}function Vv({plugin:i,skill:o}){const[c,d]=v.useState([]),[m,h]=v.useState([]),[p,b]=v.useState(!0),[y,f]=v.useState(null);v.useEffect(()=>{ke.getDependencies(i,o).then(g=>{d(g.mcpDependencies),h(g.skillDependencies)}).catch(()=>{}).finally(()=>b(!1))},[i,o]);async function E(g,T){try{await navigator.clipboard.writeText(T),f(g),setTimeout(()=>f(null),2e3)}catch{}}return p?null:c.length===0&&m.length===0?n.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:c.length+m.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[c.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),c.map(g=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),n.jsx("button",{onClick:()=>E(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:y===g.server?"var(--green)":"var(--accent)"},children:y===g.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(T=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:T},T))})]},g.server))]}),m.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:m.map(g=>n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function Qv(){const{state:i}=ll(),{plugin:o,skill:c}=i,[d,m]=v.useState(null),[h,p]=v.useState(!0);return v.useEffect(()=>{ke.getDependencies(o,c).then(m).catch(()=>{}).finally(()=>p(!1))},[o,c]),h?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):d?n.jsx("div",{className:"p-5 max-w-3xl",children:n.jsx(Vv,{plugin:o,skill:c})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"No dependency information available"})}const Xv=["editor","tests","run","activation","history","deps"];function Zv(i){return i!=null&&Xv.includes(i)}function Kv(){const{state:i,dispatch:o,saveContent:c,isReadOnly:d}=ll(),{refreshSkills:m,clearSelection:h}=$l(),p=v.useCallback(async()=>{try{await ke.deleteSkill(i.plugin,i.skill),m(),h()}catch(f){const E=f instanceof Error?f.message:String(f);o({type:"SET_ERROR",error:`Failed to delete skill: ${E}`})}},[i.plugin,i.skill,m,h,o]);v.useEffect(()=>{const E=new URLSearchParams(window.location.search).get("panel");Zv(E)&&E!==i.activePanel&&o({type:"SET_PANEL",panel:E})},[]),v.useEffect(()=>{const f=new URLSearchParams(window.location.search);f.set("panel",i.activePanel);const E=`${window.location.pathname}?${f.toString()}${window.location.hash}`;history.replaceState(null,"",E)},[i.activePanel]);const b=v.useCallback(f=>{const E=f.ctrlKey||f.metaKey;if(E&&f.key>="1"&&f.key<="6"){f.preventDefault(),o({type:"SET_PANEL",panel:["editor","tests","run","activation","history","deps"][parseInt(f.key)-1]});return}if(E&&f.key==="s"&&!f.shiftKey){f.preventDefault(),i.isDirty&&c();return}},[i.isDirty,c,o]);if(v.useEffect(()=>(window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)),[b]),i.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(i.caseRunStates.values()).some(f=>f.status==="running"||f.status==="queued");return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[n.jsx(Hh,{state:i,isReadOnly:d,onDelete:d?void 0:p}),i.error&&n.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"flex-1",children:i.error}),n.jsx("button",{onClick:()=>o({type:"SET_ERROR",error:null}),style:{background:"none",border:"none",cursor:"pointer",color:"var(--red)",padding:2},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsx(Qh,{activePanel:i.activePanel,onPanelChange:f=>o({type:"SET_PANEL",panel:f}),isDirty:i.isDirty,isRunning:y,hasRegressions:i.regressions.length>0,isActivationRunning:i.activationRunning}),n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[i.activePanel==="editor"&&n.jsx(mv,{}),i.activePanel==="tests"&&n.jsx(yv,{}),i.activePanel==="run"&&n.jsx(kv,{}),i.activePanel==="activation"&&n.jsx(_v,{}),i.activePanel==="history"&&n.jsx(Hv,{}),i.activePanel==="deps"&&n.jsx(Qv,{})]},i.activePanel)})]})}function ao(i,o=!0){let c=i.toLowerCase().replace(/[^a-z0-9]+/g,"-");return o&&(c=c.replace(/^-+|-+$/g,"")),c}function Jv(i,o,c,d){const h=`.../${i.split("/").slice(-2).join("/")}`;switch(o){case 1:return`${h}/${c}/skills/${d}/SKILL.md`;case 2:return`${h}/plugins/${c}/skills/${d}/SKILL.md`;case 3:return`${h}/skills/${d}/SKILL.md`}}function $v({onCreated:i,resolveAiConfigOverride:o}){const[c,d]=v.useState("manual"),[m,h]=v.useState(null),[p,b]=v.useState(!0),{config:y}=ln(),[f,E]=v.useState(""),[g,T]=v.useState(3),[z,B]=v.useState(""),[q,V]=v.useState(""),[J,F]=v.useState(""),[ae,G]=v.useState(""),[W,te]=v.useState(""),[$,le]=v.useState(""),[ge,se]=v.useState("write"),[Te,pe]=v.useState(!1),[Z,ie]=v.useState(null),[ve,N]=v.useState(""),[A,K]=v.useState(!1),[ce,ye]=v.useState(!1),[S,O]=v.useState(null),[X,R]=v.useState(null),[Y,Q]=v.useState([]),P=v.useRef(null),ue=v.useRef(null),he=v.useRef(null),[tt,nt]=v.useState(!1),[$t,Wt]=v.useState(!1);v.useEffect(()=>{ke.getProjectLayout().then(xe=>{h(xe),T(xe.suggestedLayout);const He=xe.detectedLayouts.find(yt=>yt.layout===xe.suggestedLayout);He!=null&&He.existingPlugins.length&&B(He.existingPlugins[0])}).catch(()=>{}).finally(()=>b(!1))},[]),v.useEffect(()=>{var xe;c==="ai"&&((xe=P.current)==null||xe.focus())},[c]),v.useEffect(()=>()=>{var xe;(xe=ue.current)==null||xe.abort()},[]);const Qt=v.useMemo(()=>{var xe;return m?((xe=m.detectedLayouts.find(He=>He.layout===g))==null?void 0:xe.existingPlugins)||[]:[]},[m,g]),dt=z==="__new__"?q:z,al=m?Jv(m.root,g,dt||"{plugin}",f||"{skill}"):"",pa=v.useMemo(()=>m?m.detectedLayouts.filter(xe=>xe.layout!==4):[],[m]),vt=v.useMemo(()=>{if(!m)return null;const xe=m.detectedLayouts.find(Re=>Re.layout===2&&Re.existingPlugins.length>0),He=m.detectedLayouts.find(Re=>Re.layout===1&&Re.existingPlugins.length>0),yt=xe||He;return yt?{layout:yt.layout,plugins:yt.existingPlugins}:null},[m]),Ft=v.useCallback(()=>{if(o)return o();if(!y)return{provider:"claude-cli",model:"sonnet"};const xe=y.provider||"claude-cli";let He=y.model||"sonnet";return xe==="claude-cli"&&He.startsWith("claude-")&&(He=He.replace("claude-","")),{provider:xe,model:He}},[y,o]),Xt=v.useCallback(()=>{var xe;(xe=ue.current)==null||xe.abort(),K(!1)},[]),Wl=v.useCallback(()=>{O(null),R(null)},[]),an=v.useCallback(async()=>{if(O(null),R(null),Q([]),he.current=null,!ve.trim()){O("Describe what your skill should do");return}K(!0);const xe=new AbortController;ue.current=xe;const{provider:He,model:yt}=Ft();try{const Re=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:ve.trim(),provider:He,model:yt}),signal:xe.signal});if(!Re.ok||!Re.body){let xt=`HTTP ${Re.status}`;try{const Qe=await Re.json();Qe.error&&(xt=Qe.error)}catch{}throw new Error(xt)}const nn=Re.body.getReader(),ha=new TextDecoder;let nl="",ft="";for(;;){const{done:xt,value:Qe}=await nn.read();if(xt)break;nl+=ha.decode(Qe,{stream:!0});const gt=nl.split(`
|
|
69
|
-
`);nl=gt.pop()||"";for(const Xe of gt)if(Xe.startsWith("event: "))ft=Xe.slice(7).trim();else if(Xe.startsWith("data: ")){try{const Ce=JSON.parse(Xe.slice(6));if(ft==="progress")Q(mt=>[...mt,{phase:Ce.phase,message:Ce.message,timestamp:Date.now()}]);else if(ft==="done"||ft==="complete"){const mt={prompt:ve.trim(),provider:Ft().provider,model:Ft().model,reasoning:Ce.reasoning||""};E(Ce.name),F(Ce.description),G(Ce.model||""),te(Ce.allowedTools||""),le(Ce.body),ye(!0),he.current=mt,d("manual"),g===3&&vt&&Wt(!0);const va={name:Ce.name,plugin:dt||"",layout:g,description:Ce.description,model:Ce.model||void 0,allowedTools:Ce.allowedTools||void 0,body:Ce.body,aiMeta:mt};ke.saveDraft(va).then(()=>{nt(!0)}).catch(()=>{})}else ft==="error"&&(O(Ce.message||Ce.description||"Unknown error"),Ce.category&&R(Ce))}catch{}ft=""}}}catch(Re){Re.name!=="AbortError"&&O(Re.message)}finally{K(!1),ue.current=null}},[ve,Ft,g,vt,dt]),I=v.useCallback(async()=>{if(ie(null),!f.trim()){ie("Skill name is required");return}if(!J.trim()){ie("Description is required");return}if(g!==3&&!dt.trim()){ie("Plugin name is required");return}pe(!0);try{const xe=await ke.createSkill({name:ao(f),plugin:dt||"",layout:g,description:J,model:ae||void 0,allowedTools:W||void 0,body:$,aiMeta:he.current||void 0});i(xe.plugin,xe.skill)}catch(xe){ie(xe.message)}finally{pe(!1)}},[f,J,g,dt,ae,W,$,i]),Le=v.useCallback(()=>{vt&&(T(vt.layout),B(vt.plugins[0]),Wt(!1))},[vt]);return{mode:c,setMode:d,layout:m,layoutLoading:p,selectedLayout:g,setSelectedLayout:T,creatableLayouts:pa,availablePlugins:Qt,pathPreview:al,plugin:z,setPlugin:B,newPlugin:q,setNewPlugin:V,effectivePlugin:dt,name:f,setName:E,description:J,setDescription:F,model:ae,setModel:G,allowedTools:W,setAllowedTools:te,body:$,setBody:le,bodyViewMode:ge,setBodyViewMode:se,aiPrompt:ve,setAiPrompt:N,generating:A,aiGenerated:ce,aiError:S,aiClassifiedError:X,aiProgress:Y,promptRef:P,handleGenerate:an,handleCancelGenerate:Xt,clearAiError:Wl,draftSaved:tt,showPluginRecommendation:$t,setShowPluginRecommendation:Wt,pluginLayoutInfo:vt,applyPluginRecommendation:Le,creating:Te,error:Z,handleCreate:I}}function Xx(){return n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Wv(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Zx({node:i,depth:o=0}){var c;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${o*16}px`,color:i.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[i.type==="dir"?n.jsx(Xx,{}):n.jsx(Wv,{}),n.jsxs("span",{children:[i.name,i.type==="dir"?"/":""]})]}),(c=i.children)==null?void 0:c.map(d=>n.jsx(Zx,{node:d,depth:o+1},d.name))]})}function Fv(i,o,c){const d=[];o&&d.push({name:"evals.json",type:"file"}),d.push({name:"history",type:"dir"});const m=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:d}];return c&&m.push({name:"draft.json",type:"file"}),{name:i||"{skill}",type:"dir",children:m}}function Iv({skillName:i,hasEvals:o,isDraft:c}){const d=Fv(i,o,c);return n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsx(Xx,{})}),"Skill Structure"]}),n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:n.jsx(Zx,{node:d})})]})}const Jl={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Wc({size:i=14,color:o="currentColor"}){return n.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Pv({onCreated:i,onCancel:o}){const c=$v({onCreated:i});return n.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[n.jsxs("div",{className:"mb-5",children:[n.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),n.jsx("div",{className:"flex items-center justify-between mt-2",children:n.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("button",{onClick:()=>c.setMode("
|
|
68
|
+
!Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(vr,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(vr,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(vr,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(vr,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[V," prompt",V!==1?"s":""]})]}),n.jsx("button",{onClick:B,disabled:y||!E.trim(),className:"btn btn-primary self-start",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:ae?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:br(ae)}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),f&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:f}),y&&p.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),p.length>0&&n.jsxs("div",{className:"space-y-5",children:[F.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",F.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:F.map((G,W)=>n.jsx(Ax,{result:G},`incorrect-${W}`))})]}),J.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",J.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:J.map((G,W)=>n.jsx(Ax,{result:G},`correct-${W}`))})]})]}),b&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),b.autoClassifiedCount!=null&&b.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[b.autoClassifiedCount," of ",b.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(Kc,{label:"Precision",value:b.precision,description:"Of all activations, how many were correct?",detail:`${b.tp} true / ${b.tp+b.fp} total activations`}),n.jsx(Kc,{label:"Recall",value:b.recall,description:"Of expected activations, how many fired?",detail:`${b.tp} activated / ${b.tp+b.fn} expected`}),n.jsx(Kc,{label:"Reliability",value:b.reliability,description:"Overall correct classification rate",detail:`${b.tp+b.tn} correct / ${b.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(yr,{label:"True Positive",abbr:"TP",count:b.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(yr,{label:"False Positive",abbr:"FP",count:b.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(yr,{label:"False Negative",abbr:"FN",count:b.fn,bg:"rgba(248,113,113,0.06)",color:"rgba(248,113,113,0.6)",description:"Missed activation"}),n.jsx(yr,{label:"True Negative",abbr:"TN",count:b.tn,bg:"rgba(52,211,153,0.06)",color:"rgba(52,211,153,0.6)",description:"Correctly silent"})]})]})]})]})}function vr(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Ax({result:i}){const o=Cx[i.classification]||Cx.FN,c=i.classification==="TP"||i.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:o.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${o.text} 20%, transparent)`},children:c?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:i.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:o.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:i.classification}),n.jsx("span",{style:{color:i.activate?"var(--green)":"var(--text-tertiary)"},children:i.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",i.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[i.confidence," confidence"]}),i.autoClassified&&n.jsx("span",{className:"pill",style:{background:"rgba(139,92,246,0.1)",color:"rgba(139,92,246,0.8)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),i.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:i.reasoning})]})]})}function Kc({label:i,value:o,description:c,detail:d}){const m=Math.round(o*100),h=m>=80?"var(--green)":m>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:h},children:[m,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:c}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:d})]})}function yr({abbr:i,count:o,bg:c,color:d,description:m}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:c},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:d},children:o}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:d},children:i}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:m})]})}const Jc={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},wx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},to=600,lo=180,ht=40,$c=to-ht*2,Kl=lo-ht*2,Rv=[25,50,75,100];function _x(i){return new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Mv({entries:i}){const[o,c]=v.useState(null);if(i.length<2)return null;const d=i.length,m=i.map((b,y)=>{const f=ht+y/(d-1)*$c,E=b.passRate*100,g=ht+Kl-E/100*Kl;return{x:f,y:g,pct:E,entry:b}}),h=m.map(b=>`${b.x},${b.y}`).join(" "),p=Array.from(new Set(i.map(b=>b.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative"},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:p.map(b=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Jc[b]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:wx[b]??b})]},b))}),n.jsxs("svg",{width:to,height:lo,viewBox:`0 0 ${to} ${lo}`,style:{display:"block",overflow:"visible"},children:[Rv.map(b=>{const y=ht+Kl-b/100*Kl;return n.jsxs("g",{children:[n.jsx("line",{x1:ht,y1:y,x2:ht+$c,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:ht-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[b,"%"]})]},b)}),n.jsx("line",{x1:ht,y1:ht+Kl,x2:ht+$c,y2:ht+Kl,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:ht-8,y:ht+Kl+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),m.map((b,y)=>n.jsx("circle",{cx:b.x,cy:b.y,r:5,fill:Jc[b.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:f=>{f.currentTarget.setAttribute("r","7"),c({x:b.x,y:b.y,entry:b.entry})},onMouseLeave:f=>{f.currentTarget.setAttribute("r","5"),c(null)}},y)),zv(d).map(b=>n.jsx("text",{x:m[b].x,y:ht+Kl+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:_x(i[b].timestamp)},b))]}),o&&n.jsxs("div",{style:{position:"absolute",left:o.x,top:o.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:_x(o.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:o.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Jc[o.entry.type]??"var(--text-tertiary)",color:"#fff"},children:wx[o.entry.type]??o.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(o.entry.passRate*100),"%"]})]})]})]})}function zv(i){return i<=3?Array.from({length:i},(o,c)=>c):i<=6?[0,Math.floor(i/2),i-1]:[0,Math.floor(i/3),Math.floor(2*i/3),i-1]}function gr(i){return i>=.8?"var(--green)":i>=.5?"var(--yellow)":"var(--red)"}function Lv(i){return i>=1e3?`${(i/1e3).toFixed(1)}s`:`${Math.round(i)}ms`}function Ov({rate:i,label:o}){const c=Math.round(i*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:o}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:gr(i)},children:[c,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c}%`,background:gr(i)}})})]})})}function Dv({points:i}){if(i.length<2)return null;const o=200,c=48,d=4,m=i.length,h=i.map((y,f)=>{const E=d+f/(m-1)*(o-d*2),g=d+(c-d*2)-y.passRate*(c-d*2);return{x:E,y:g}}),p=`M ${h[0].x},${c-d} `+h.map(y=>`L ${y.x},${y.y}`).join(" ")+` L ${h[h.length-1].x},${c-d} Z`,b=h.map((y,f)=>`${f===0?"M":"L"} ${y.x},${y.y}`).join(" ");return n.jsxs("svg",{width:o,height:c,style:{display:"block"},children:[n.jsx("path",{d:p,fill:"var(--accent-muted)"}),n.jsx("path",{d:b,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:h[h.length-1].x,cy:h[h.length-1].y,r:3,fill:"var(--accent)"})]})}function Bv({plugin:i,skill:o}){const[c,d]=v.useState(null),[m,h]=v.useState(!0);if(v.useEffect(()=>{h(!0),ke.getStats(i,o).then(d).catch(()=>d(null)).finally(()=>h(!1))},[i,o]),m)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!c||c.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const p=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,b=c.trendPoints.length>0?c.trendPoints[0].passRate:0,y=p-b,f=c.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:gr(p)},children:[Math.round(p*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:y>=0?"var(--green)":"var(--red)"},children:[y>=0?"+":"",Math.round(y*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]})]}),c.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(Dv,{points:c.trendPoints})]}),c.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"})]})}),n.jsx("tbody",{children:c.modelStats.map(E=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:E.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:E.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:gr(E.avgPassRate)},children:[Math.round(E.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:Lv(E.avgDurationMs)})]},E.model))})]})]}),f.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:f.map(E=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-2)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",E.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:E.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[E.totalRuns," runs"]})]}),n.jsx(Ov,{rate:E.passRate,label:E.text})]},`${E.evalId}:${E.id}`))})]})]})}function Uv({plugin:i,skill:o}){const[c,d]=v.useState(null),[m,h]=v.useState(null),[p,b]=v.useState({}),[y,f]=v.useState({});v.useEffect(()=>{ke.getEvals(i,o).then(d).catch(()=>d(null))},[i,o]);async function E(g){if(m===g){h(null);return}if(h(g),!p[g]){f(T=>({...T,[g]:!0}));try{const T=await ke.getCaseHistory(i,o,g);b(z=>({...z,[g]:T}))}catch{b(T=>({...T,[g]:[]}))}finally{f(T=>({...T,[g]:!1}))}}}return c?n.jsx("div",{className:"space-y-2 stagger-children",children:c.evals.map(g=>{const T=p[g.id]||[],z=m===g.id,B=y[g.id],q=T.length>0?T[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>E(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:z?"var(--surface-2)":"transparent"},onMouseEnter:V=>{z||(V.currentTarget.style.background="var(--surface-2)")},onMouseLeave:V=>{z||(V.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:z?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",g.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),T.length>=2&&n.jsx(Vx,{entries:T}),q!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:eo(q)},children:[Math.round(q*100),"%"]}),T.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[T.length," runs"]})]}),z&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:B?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):T.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:T.map((V,J)=>n.jsxs("div",{className:"p-4",style:{background:J===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Gx(V.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:V.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:V.type==="benchmark"?"rgba(99,131,255,0.15)":V.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:V.type==="benchmark"?"#6383ff":V.type==="comparison"?"var(--purple)":"#fb923c"},children:V.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:eo(V.pass_rate)},children:[Math.round(V.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[V.durationMs!=null&&n.jsx("span",{children:Yx(V.durationMs)}),V.tokens!=null&&n.jsxs("span",{children:[V.tokens>=1e3?`${(V.tokens/1e3).toFixed(1)}k`:V.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:V.assertions.map(F=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:F.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:F.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:F.text}),F.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:F.reasoning})]})]},F.id))})]},J))})})]},g.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function Hv(){const{state:i,dispatch:o}=ll(),{plugin:c,skill:d}=i,[m,h]=v.useState("timeline"),[p,b]=v.useState([]),[y,f]=v.useState(!0),[E,g]=v.useState(""),[T,z]=v.useState(""),[B,q]=v.useState(!1),[V,J]=v.useState([]),[F,ae]=v.useState(null),[G,W]=v.useState(!1),[te,$]=v.useState(null),[le,ge]=v.useState(!1);v.useEffect(()=>{f(!0),ke.getHistory(c,d,{model:E||void 0,type:T||void 0}).then(Z=>{b(Z),Z.length>=2&&ke.compareRuns(c,d,Z[0].timestamp,Z[1].timestamp).then(ie=>{const ve=ie.regressions.filter(N=>N.change==="regression");o({type:"SET_REGRESSIONS",regressions:ve})}).catch(()=>{})}).catch(()=>{}).finally(()=>f(!1))},[c,d,E,T]);const se=v.useCallback(async Z=>{if(B){J(ie=>ie.includes(Z)?ie.filter(ve=>ve!==Z):ie.length>=2?[ie[1],Z]:[...ie,Z]);return}ge(!0);try{const ie=await ke.getHistoryEntry(c,d,Z);$(ie)}catch{}finally{ge(!1)}},[c,d,B]),Te=v.useCallback(async()=>{if(V.length===2){W(!0);try{const Z=await ke.compareRuns(c,d,V[0],V[1]);ae(Z)}catch{}finally{W(!1)}}},[c,d,V]),pe=[...new Set(p.map(Z=>Z.model))];return y?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(Z=>n.jsx("button",{onClick:()=>h(Z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:m===Z?"var(--accent-muted)":"transparent",color:m===Z?"var(--accent)":"var(--text-tertiary)"},children:Z==="timeline"?"Timeline":Z==="per-eval"?"Per Eval":"Statistics"},Z))}),m==="timeline"&&n.jsxs("div",{children:[p.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(Mv,{entries:p})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:E,onChange:Z=>g(Z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),pe.map(Z=>n.jsx("option",{value:Z,children:Z},Z))]}),n.jsxs("select",{value:T,onChange:Z=>z(Z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{q(!B),J([]),ae(null)},className:`btn text-[12px] ${B?"btn-primary":"btn-secondary"}`,children:B?"Exit Compare":"Compare Runs"}),B&&V.length===2&&n.jsx("button",{onClick:Te,disabled:G,className:"btn btn-primary text-[12px]",children:G?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:p.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):p.map(Z=>{const ie=V.includes(Z.timestamp);return n.jsx("button",{onClick:()=>se(Z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:ie?"var(--accent-muted)":"var(--surface-1)",border:ie?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ve=>{ie||(ve.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ve=>{ie||(ve.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[B&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:ie?"var(--accent)":"var(--border-default)",background:ie?"var(--accent)":"transparent"},children:ie&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(Z.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:Z.type==="comparison"?"var(--purple-muted)":Z.type==="baseline"?"var(--surface-3)":Z.type==="model-compare"?"rgba(56,189,248,0.15)":Z.type==="improve"||Z.type==="instruct"?"rgba(168,85,247,0.15)":Z.type==="ai-generate"?"rgba(34,197,94,0.15)":Z.type==="eval-generate"?"rgba(251,146,60,0.15)":"var(--accent-muted)",color:Z.type==="comparison"?"var(--purple)":Z.type==="baseline"?"var(--text-tertiary)":Z.type==="model-compare"?"#38bdf8":Z.type==="improve"||Z.type==="instruct"?"#a855f7":Z.type==="ai-generate"?"#22c55e":Z.type==="eval-generate"?"#fb923c":"var(--accent)"},children:Z.type==="model-compare"?"model compare":Z.type==="improve"?"ai improve":Z.type==="instruct"?"ai edit":Z.type==="ai-generate"?"ai generate":Z.type==="eval-generate"?"eval generate":Z.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:Z.model}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:Z.passRate>=.8?"var(--green)":Z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(Z.passRate*100),"%"]})]})]})},Z.timestamp)})}),F&&n.jsx(qv,{result:F}),te&&!B&&n.jsx(Gv,{run:te,onClose:()=>$(null)})]}),m==="per-eval"&&n.jsx(Uv,{plugin:c,skill:d}),m==="statistics"&&n.jsx(Bv,{plugin:c,skill:d})]})}function qv({result:i}){const o=i.regressions.filter(d=>d.change==="regression"),c=i.regressions.filter(d=>d.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(i.runA.timestamp).toLocaleDateString()," vs ",new Date(i.runB.timestamp).toLocaleDateString()]}),o.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",o.length,")"]}),o.map(d=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",d.evalId," ",d.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:d.assertionId})," (was passing, now failing)"]},`${d.evalId}-${d.assertionId}`))]}),c.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",c.length,")"]}),c.map(d=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",d.evalId," ",d.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:d.assertionId})," (was failing, now passing)"]},`${d.evalId}-${d.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:i.caseDiffs.map(d=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",d.eval_id," ",d.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:d.passRateA!=null?d.passRateA>=.8?"var(--green)":d.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:d.passRateA!=null?`${Math.round(d.passRateA*100)}%`:d.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:d.passRateB!=null?d.passRateB>=.8?"var(--green)":d.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:d.passRateB!=null?`${Math.round(d.passRateB*100)}%`:d.statusB})]},d.eval_id))})]})})]})}function Gv({run:i,onClose:o}){return(i.type==="improve"||i.type==="instruct")&&i.improve?n.jsx(Yv,{run:i,onClose:o}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(i.timestamp).toLocaleString()]}),n.jsx("button",{onClick:o,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",i.model," | Cases: ",i.cases.length," | Pass Rate: ",i.overall_pass_rate!=null?`${Math.round(i.overall_pass_rate*100)}%`:"--"]}),n.jsx("div",{className:"space-y-2",children:i.cases.map(c=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",c.eval_id," ",c.eval_name]}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.pass_rate!=null?`${Math.round(c.pass_rate*100)}%`:c.status})]})},c.eval_id))})]})}function Yv({run:i,onClose:o}){var h;const c=v.useMemo(()=>i.improve?jr(i.improve.original,i.improve.improved):[],[i.improve]),d=v.useMemo(()=>{const p=c.filter(y=>y.type==="added").length,b=c.filter(y=>y.type==="removed").length;return{added:p,removed:b}},[c]),m=v.useMemo(()=>{let p=0,b=0;return c.map(y=>y.type==="removed"?(p++,{...y,origNum:p,newNum:null}):y.type==="added"?(b++,{...y,origNum:null,newNum:b}):(p++,b++,{...y,origNum:p,newNum:b}))},[c]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(i.timestamp).toLocaleString()," · ",i.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",d.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",d.removed]})]}),n.jsx("button",{onClick:o,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--surface-3)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((h=i.improve)==null?void 0:h.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.06)",border:"1px solid rgba(168,85,247,0.15)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),i.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:m.map((p,b)=>n.jsxs("tr",{style:{background:p.type==="added"?"rgba(34,197,94,0.08)":p.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:p.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:p.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"transparent",borderRight:p.type==="added"?"2px solid var(--green)":p.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:p.type==="added"?"+":p.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"var(--text-secondary)"},children:p.content||""})]},b))})})})]})}function Vv({plugin:i,skill:o}){const[c,d]=v.useState([]),[m,h]=v.useState([]),[p,b]=v.useState(!0),[y,f]=v.useState(null);v.useEffect(()=>{ke.getDependencies(i,o).then(g=>{d(g.mcpDependencies),h(g.skillDependencies)}).catch(()=>{}).finally(()=>b(!1))},[i,o]);async function E(g,T){try{await navigator.clipboard.writeText(T),f(g),setTimeout(()=>f(null),2e3)}catch{}}return p?null:c.length===0&&m.length===0?n.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:c.length+m.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[c.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),c.map(g=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),n.jsx("button",{onClick:()=>E(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:y===g.server?"var(--green)":"var(--accent)"},children:y===g.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(T=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:T},T))})]},g.server))]}),m.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:m.map(g=>n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function Qv(){const{state:i}=ll(),{plugin:o,skill:c}=i,[d,m]=v.useState(null),[h,p]=v.useState(!0);return v.useEffect(()=>{ke.getDependencies(o,c).then(m).catch(()=>{}).finally(()=>p(!1))},[o,c]),h?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):d?n.jsx("div",{className:"p-5 max-w-3xl",children:n.jsx(Vv,{plugin:o,skill:c})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"No dependency information available"})}const Xv=["editor","tests","run","activation","history","deps"];function Zv(i){return i!=null&&Xv.includes(i)}function Kv(){const{state:i,dispatch:o,saveContent:c,isReadOnly:d}=ll(),{refreshSkills:m,clearSelection:h}=$l(),p=v.useCallback(async()=>{try{await ke.deleteSkill(i.plugin,i.skill),m(),h()}catch(f){const E=f instanceof Error?f.message:String(f);o({type:"SET_ERROR",error:`Failed to delete skill: ${E}`})}},[i.plugin,i.skill,m,h,o]);v.useEffect(()=>{const E=new URLSearchParams(window.location.search).get("panel");Zv(E)&&E!==i.activePanel&&o({type:"SET_PANEL",panel:E})},[]),v.useEffect(()=>{const f=new URLSearchParams(window.location.search);f.set("panel",i.activePanel);const E=`${window.location.pathname}?${f.toString()}${window.location.hash}`;history.replaceState(null,"",E)},[i.activePanel]);const b=v.useCallback(f=>{const E=f.ctrlKey||f.metaKey;if(E&&f.key>="1"&&f.key<="6"){f.preventDefault(),o({type:"SET_PANEL",panel:["editor","tests","run","activation","history","deps"][parseInt(f.key)-1]});return}if(E&&f.key==="s"&&!f.shiftKey){f.preventDefault(),i.isDirty&&c();return}},[i.isDirty,c,o]);if(v.useEffect(()=>(window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)),[b]),i.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(i.caseRunStates.values()).some(f=>f.status==="running"||f.status==="queued");return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[n.jsx(Hh,{state:i,isReadOnly:d,onDelete:d?void 0:p}),i.error&&n.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"flex-1",children:i.error}),n.jsx("button",{onClick:()=>o({type:"SET_ERROR",error:null}),style:{background:"none",border:"none",cursor:"pointer",color:"var(--red)",padding:2},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsx(Qh,{activePanel:i.activePanel,onPanelChange:f=>o({type:"SET_PANEL",panel:f}),isDirty:i.isDirty,isRunning:y,hasRegressions:i.regressions.length>0,isActivationRunning:i.activationRunning}),n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[i.activePanel==="editor"&&n.jsx(mv,{}),i.activePanel==="tests"&&n.jsx(yv,{}),i.activePanel==="run"&&n.jsx(kv,{}),i.activePanel==="activation"&&n.jsx(_v,{}),i.activePanel==="history"&&n.jsx(Hv,{}),i.activePanel==="deps"&&n.jsx(Qv,{})]},i.activePanel)})]})}function ao(i,o=!0){let c=i.toLowerCase().replace(/[^a-z0-9]+/g,"-");return o&&(c=c.replace(/^-+|-+$/g,"")),c}function Jv(i,o,c,d){const h=`.../${i.split("/").slice(-2).join("/")}`;switch(o){case 1:return`${h}/${c}/skills/${d}/SKILL.md`;case 2:return`${h}/plugins/${c}/skills/${d}/SKILL.md`;case 3:return`${h}/skills/${d}/SKILL.md`}}function $v({onCreated:i,resolveAiConfigOverride:o}){const[c,d]=v.useState("ai"),[m,h]=v.useState(null),[p,b]=v.useState(!0),{config:y}=ln(),[f,E]=v.useState(""),[g,T]=v.useState(3),[z,B]=v.useState(""),[q,V]=v.useState(""),[J,F]=v.useState(""),[ae,G]=v.useState(""),[W,te]=v.useState(""),[$,le]=v.useState(""),[ge,se]=v.useState("write"),[Te,pe]=v.useState(!1),[Z,ie]=v.useState(null),[ve,N]=v.useState(""),[A,K]=v.useState(!1),[ce,ye]=v.useState(!1),[S,O]=v.useState(null),[X,R]=v.useState(null),[Y,Q]=v.useState([]),P=v.useRef(null),ue=v.useRef(null),he=v.useRef(null),[tt,nt]=v.useState(!1),[$t,Wt]=v.useState(!1);v.useEffect(()=>{ke.getProjectLayout().then(xe=>{h(xe),T(xe.suggestedLayout);const He=xe.detectedLayouts.find(yt=>yt.layout===xe.suggestedLayout);He!=null&&He.existingPlugins.length&&B(He.existingPlugins[0])}).catch(()=>{}).finally(()=>b(!1))},[]),v.useEffect(()=>{var xe;c==="ai"&&((xe=P.current)==null||xe.focus())},[c]),v.useEffect(()=>()=>{var xe;(xe=ue.current)==null||xe.abort()},[]);const Qt=v.useMemo(()=>{var xe;return m?((xe=m.detectedLayouts.find(He=>He.layout===g))==null?void 0:xe.existingPlugins)||[]:[]},[m,g]),dt=z==="__new__"?q:z,al=m?Jv(m.root,g,dt||"{plugin}",f||"{skill}"):"",pa=v.useMemo(()=>m?m.detectedLayouts.filter(xe=>xe.layout!==4):[],[m]),vt=v.useMemo(()=>{if(!m)return null;const xe=m.detectedLayouts.find(Re=>Re.layout===2&&Re.existingPlugins.length>0),He=m.detectedLayouts.find(Re=>Re.layout===1&&Re.existingPlugins.length>0),yt=xe||He;return yt?{layout:yt.layout,plugins:yt.existingPlugins}:null},[m]),Ft=v.useCallback(()=>{if(o)return o();if(!y)return{provider:"claude-cli",model:"sonnet"};const xe=y.provider||"claude-cli";let He=y.model||"sonnet";return xe==="claude-cli"&&He.startsWith("claude-")&&(He=He.replace("claude-","")),{provider:xe,model:He}},[y,o]),Xt=v.useCallback(()=>{var xe;(xe=ue.current)==null||xe.abort(),K(!1)},[]),Wl=v.useCallback(()=>{O(null),R(null)},[]),an=v.useCallback(async()=>{if(O(null),R(null),Q([]),he.current=null,!ve.trim()){O("Describe what your skill should do");return}K(!0);const xe=new AbortController;ue.current=xe;const{provider:He,model:yt}=Ft();try{const Re=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:ve.trim(),provider:He,model:yt}),signal:xe.signal});if(!Re.ok||!Re.body){let xt=`HTTP ${Re.status}`;try{const Qe=await Re.json();Qe.error&&(xt=Qe.error)}catch{}throw new Error(xt)}const nn=Re.body.getReader(),ha=new TextDecoder;let nl="",ft="";for(;;){const{done:xt,value:Qe}=await nn.read();if(xt)break;nl+=ha.decode(Qe,{stream:!0});const gt=nl.split(`
|
|
69
|
+
`);nl=gt.pop()||"";for(const Xe of gt)if(Xe.startsWith("event: "))ft=Xe.slice(7).trim();else if(Xe.startsWith("data: ")){try{const Ce=JSON.parse(Xe.slice(6));if(ft==="progress")Q(mt=>[...mt,{phase:Ce.phase,message:Ce.message,timestamp:Date.now()}]);else if(ft==="done"||ft==="complete"){const mt={prompt:ve.trim(),provider:Ft().provider,model:Ft().model,reasoning:Ce.reasoning||""};E(Ce.name),F(Ce.description),G(Ce.model||""),te(Ce.allowedTools||""),le(Ce.body),ye(!0),he.current=mt,d("manual"),g===3&&vt&&Wt(!0);const va={name:Ce.name,plugin:dt||"",layout:g,description:Ce.description,model:Ce.model||void 0,allowedTools:Ce.allowedTools||void 0,body:Ce.body,aiMeta:mt};ke.saveDraft(va).then(()=>{nt(!0)}).catch(()=>{})}else ft==="error"&&(O(Ce.message||Ce.description||"Unknown error"),Ce.category&&R(Ce))}catch{}ft=""}}}catch(Re){Re.name!=="AbortError"&&O(Re.message)}finally{K(!1),ue.current=null}},[ve,Ft,g,vt,dt]),I=v.useCallback(async()=>{if(ie(null),!f.trim()){ie("Skill name is required");return}if(!J.trim()){ie("Description is required");return}if(g!==3&&!dt.trim()){ie("Plugin name is required");return}pe(!0);try{const xe=await ke.createSkill({name:ao(f),plugin:dt||"",layout:g,description:J,model:ae||void 0,allowedTools:W||void 0,body:$,aiMeta:he.current||void 0});i(xe.plugin,xe.skill)}catch(xe){ie(xe.message)}finally{pe(!1)}},[f,J,g,dt,ae,W,$,i]),Le=v.useCallback(()=>{vt&&(T(vt.layout),B(vt.plugins[0]),Wt(!1))},[vt]);return{mode:c,setMode:d,layout:m,layoutLoading:p,selectedLayout:g,setSelectedLayout:T,creatableLayouts:pa,availablePlugins:Qt,pathPreview:al,plugin:z,setPlugin:B,newPlugin:q,setNewPlugin:V,effectivePlugin:dt,name:f,setName:E,description:J,setDescription:F,model:ae,setModel:G,allowedTools:W,setAllowedTools:te,body:$,setBody:le,bodyViewMode:ge,setBodyViewMode:se,aiPrompt:ve,setAiPrompt:N,generating:A,aiGenerated:ce,aiError:S,aiClassifiedError:X,aiProgress:Y,promptRef:P,handleGenerate:an,handleCancelGenerate:Xt,clearAiError:Wl,draftSaved:tt,showPluginRecommendation:$t,setShowPluginRecommendation:Wt,pluginLayoutInfo:vt,applyPluginRecommendation:Le,creating:Te,error:Z,handleCreate:I}}function Xx(){return n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Wv(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Zx({node:i,depth:o=0}){var c;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${o*16}px`,color:i.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[i.type==="dir"?n.jsx(Xx,{}):n.jsx(Wv,{}),n.jsxs("span",{children:[i.name,i.type==="dir"?"/":""]})]}),(c=i.children)==null?void 0:c.map(d=>n.jsx(Zx,{node:d,depth:o+1},d.name))]})}function Fv(i,o,c){const d=[];o&&d.push({name:"evals.json",type:"file"}),d.push({name:"history",type:"dir"});const m=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:d}];return c&&m.push({name:"draft.json",type:"file"}),{name:i||"{skill}",type:"dir",children:m}}function Iv({skillName:i,hasEvals:o,isDraft:c}){const d=Fv(i,o,c);return n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsx(Xx,{})}),"Skill Structure"]}),n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:n.jsx(Zx,{node:d})})]})}const Jl={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Wc({size:i=14,color:o="currentColor"}){return n.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Pv({onCreated:i,onCancel:o}){const c=$v({onCreated:i});return n.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[n.jsxs("div",{className:"mb-5",children:[n.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),n.jsx("div",{className:"flex items-center justify-between mt-2",children:n.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("button",{onClick:()=>c.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:c.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:c.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Wc,{size:12}),"AI-Assisted"]})}),n.jsx("button",{onClick:()=>c.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:c.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:c.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),c.layoutLoading&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!c.layoutLoading&&c.layout&&c.mode==="ai"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsx(Wc,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:c.promptRef,value:c.aiPrompt,onChange:d=>c.setAiPrompt(d.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
70
70
|
|
|
71
71
|
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:c.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...Jl,minHeight:"120px"},onKeyDown:d=>{d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),c.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),c.generating&&c.aiProgress.length>0&&n.jsx(Pn,{entries:c.aiProgress,isRunning:!0}),c.aiError&&n.jsx("div",{children:c.aiClassifiedError?n.jsx(Sr,{error:c.aiClassifiedError,onRetry:c.handleGenerate,onDismiss:c.clearAiError}):n.jsxs("div",{children:[n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:c.aiError}),n.jsx("button",{onClick:c.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[c.generating?n.jsx("button",{onClick:c.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):n.jsxs("button",{onClick:c.handleGenerate,disabled:!c.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:c.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:c.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:c.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[n.jsx(Wc,{size:14}),"Generate"]}),n.jsx("button",{onClick:o,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!c.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>c.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!c.layoutLoading&&c.layout&&c.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),c.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:c.creatableLayouts.map(d=>n.jsx("button",{onClick:()=>{c.setSelectedLayout(d.layout),c.setPlugin(d.existingPlugins[0]||""),c.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:c.selectedLayout===d.layout?"var(--accent)":"var(--surface-3)",color:c.selectedLayout===d.layout?"#fff":"var(--text-secondary)",border:`1px solid ${c.selectedLayout===d.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:d.label},d.layout))})]}),c.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:c.plugin,onChange:d=>{c.setPlugin(d.target.value),c.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Jl,children:[c.availablePlugins.map(d=>n.jsx("option",{value:d,children:d},d)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),c.plugin==="__new__"&&n.jsx("input",{type:"text",value:c.newPlugin,onChange:d=>c.setNewPlugin(ao(d.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:Jl})]}),n.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:c.pathPreview})]}),c.showPluginRecommendation&&c.pluginLayoutInfo&&c.selectedLayout===3&&n.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:c.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:c.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>c.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:c.name,onChange:d=>c.setName(ao(d.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Jl})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:c.description,onChange:d=>c.setDescription(d.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...Jl,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:c.model,onChange:d=>c.setModel(d.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Jl,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:c.allowedTools,onChange:d=>c.setAllowedTools(d.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Jl})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(d=>n.jsxs("button",{onClick:()=>c.setBodyViewMode(d),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:c.bodyViewMode===d?"var(--surface-4)":"transparent",color:c.bodyViewMode===d?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:c.bodyViewMode===d?600:400,border:"none",cursor:"pointer"},children:[d==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:d==="write"?"Write":"Preview"})]},d))})]}),c.bodyViewMode==="write"?n.jsx("textarea",{value:c.body,onChange:d=>c.setBody(d.target.value),placeholder:`# /my-skill
|
|
72
72
|
|
package/dist/eval-ui/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Skill Studio</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-CxHCKEhf.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-D2UkOol1.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|