vskill 0.5.48 → 0.5.49

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.
@@ -36,7 +36,7 @@ export function verdictExplanation(verdict, rawScore, rubric) {
36
36
  explanation: `${verdict} (score ${score.toFixed(2)}): evaluation met expectations.${metList}`,
37
37
  };
38
38
  }
39
- if ((verdict === "FAIL" || verdict === "DEGRADING") && score < 0.7) {
39
+ if (verdict === "FAIL" || verdict === "DEGRADING") {
40
40
  const failedList = failed.length > 0
41
41
  ? ` Failed criteria: ${failed.map((r) => r.criterion).join(", ")}.`
42
42
  : "";
@@ -52,15 +52,28 @@ export function verdictExplanation(verdict, rawScore, rubric) {
52
52
  recommendations,
53
53
  };
54
54
  }
55
- if (verdict === "INEFFECTIVE" && score < 0.2) {
56
- const suggestions = [
55
+ if (verdict === "INEFFECTIVE") {
56
+ if (score < 0.2) {
57
+ const suggestions = [
58
+ ...failed.map((r) => `Rework "${r.criterion}" — currently at ${r.score.toFixed(2)}`),
59
+ "Consider adding examples to your system prompt",
60
+ "Review the rubric criteria for achievability",
61
+ ];
62
+ return {
63
+ explanation: `${verdict} (score ${score.toFixed(2)}): evaluation is significantly below expectations.`,
64
+ recommendations: suggestions,
65
+ };
66
+ }
67
+ const recommendations = [
57
68
  ...failed.map((r) => `Rework "${r.criterion}" — currently at ${r.score.toFixed(2)}`),
58
- "Consider adding examples to your system prompt",
59
- "Review the rubric criteria for achievability",
69
+ ...weak.map((r) => `Strengthen "${r.criterion}" (score: ${r.score.toFixed(2)})`),
60
70
  ];
71
+ if (recommendations.length === 0) {
72
+ recommendations.push("Consider restructuring your prompt approach");
73
+ }
61
74
  return {
62
- explanation: `${verdict} (score ${score.toFixed(2)}): evaluation is significantly below expectations.`,
63
- recommendations: suggestions,
75
+ explanation: `${verdict} (score ${score.toFixed(2)}): below expectations but showing some capability.`,
76
+ recommendations,
64
77
  };
65
78
  }
66
79
  if (verdict === "MARGINAL") {
@@ -69,7 +82,9 @@ export function verdictExplanation(verdict, rawScore, rubric) {
69
82
  ...failed.map((r) => `Improve "${r.criterion}" (score: ${r.score.toFixed(2)})`),
70
83
  ];
71
84
  if (recommendations.length === 0) {
72
- recommendations.push("Review prompt instructions for areas of improvement");
85
+ recommendations.push(passed.length > 0
86
+ ? "Assertion pass rate is below target despite strong rubric scores — review test case alignment"
87
+ : "Review prompt instructions for areas of improvement");
73
88
  }
74
89
  return {
75
90
  explanation: `${verdict} (score ${score.toFixed(2)}): moderate improvement detected.`,
@@ -82,27 +97,16 @@ export function verdictExplanation(verdict, rawScore, rubric) {
82
97
  ...weak.map((r) => `Strengthen "${r.criterion}" (score: ${r.score.toFixed(2)})`),
83
98
  ];
84
99
  if (recommendations.length === 0) {
85
- recommendations.push("Add more specific guidance to your prompt instructions");
100
+ recommendations.push(passed.length > 0
101
+ ? "Assertion pass rate is below target despite strong rubric scores — review test case alignment"
102
+ : "Add more specific guidance to your prompt instructions");
86
103
  }
87
104
  return {
88
105
  explanation: `${verdict} (score ${score.toFixed(2)}): early promise — focus on weak areas to improve.`,
89
106
  recommendations,
90
107
  };
91
108
  }
92
- if (verdict === "INEFFECTIVE" && score >= 0.2) {
93
- const recommendations = [
94
- ...failed.map((r) => `Rework "${r.criterion}" — currently at ${r.score.toFixed(2)}`),
95
- ...weak.map((r) => `Strengthen "${r.criterion}" (score: ${r.score.toFixed(2)})`),
96
- ];
97
- if (recommendations.length === 0) {
98
- recommendations.push("Consider restructuring your prompt approach");
99
- }
100
- return {
101
- explanation: `${verdict} (score ${score.toFixed(2)}): below expectations but showing some capability.`,
102
- recommendations,
103
- };
104
- }
105
- // Default/boundary case (e.g., unmatched verdict or PASS/EFFECTIVE with low score)
109
+ // Default/boundary case (e.g., PASS/EFFECTIVE with low score)
106
110
  const metNote = passed.length > 0
107
111
  ? ` Passing: ${passed.map((r) => r.criterion).join(", ")}.`
108
112
  : "";
@@ -1 +1 @@
1
- {"version":3,"file":"verdict.js","sourceRoot":"","sources":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C,QAAQ,EAAE,eAAe;IACzB,WAAW,EAAE,YAAY;IACzB,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,SAAS,aAAa,CAAC,CAAS;IAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAoB;IAC/C,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,OAAO,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,QAAQ,CAAC;QAClB,KAAK,aAAa;YAChB,OAAO,QAAQ,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,MAAM,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -59,7 +59,7 @@ Error generating stack: `+n.message+`
59
59
  `);if(c.length>1e3||u.length>1e3)return[...c.map(j=>({type:"unchanged",content:j}))];const x=c.length,v=u.length,p=Array.from({length:x+1},()=>new Array(v+1).fill(0));for(let j=1;j<=x;j++)for(let y=1;y<=v;y++)c[j-1]===u[y-1]?p[j][y]=p[j-1][y-1]+1:p[j][y]=Math.max(p[j-1][y],p[j][y-1]);const b=[];let g=x,f=v;for(;g>0||f>0;)g>0&&f>0&&c[g-1]===u[f-1]?(b.push({type:"unchanged",content:c[g-1]}),g--,f--):f>0&&(g===0||p[g][f-1]>=p[g-1][f])?(b.push({type:"added",content:u[f-1]}),f--):(b.push({type:"removed",content:c[g-1]}),g--);return b.reverse()}function Sv(s,o){if(o&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(s))return a.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const u=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return a.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:u.has(s)?"var(--accent)":"var(--green)"}})}function fs({entries:s,isRunning:o}){const[c,u]=m.useState(!1),x=m.useRef(null);return m.useEffect(()=>{x.current&&!c&&(x.current.scrollTop=x.current.scrollHeight)},[s,c]),s.length===0&&!o?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>u(!c),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)"},children:[a.jsxs("span",{className:"flex items-center gap-2",children:[o&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",s.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:c?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!c&&a.jsx("div",{ref:x,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:s.map((v,p)=>{const b=p===s.length-1&&o,g=p===0?"0s":`+${((v.timestamp-s[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:b?1:.7},children:[Sv(v.phase,b),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:g}),a.jsx("span",{style:{color:b?"var(--text-primary)":"var(--text-secondary)"},children:v.message}),v.current!=null&&v.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",v.current,"/",v.total,"]"]})]},p)})})]})}function Nv({plugin:s,skill:o,skillContent:c,onApplied:u}){const[x,v]=m.useState("closed"),{config:p}=ia(),[b,g]=m.useState("claude-cli"),[f,j]=m.useState("opus"),[y,k]=m.useState([]),[R,U]=m.useState(""),[L,Y]=m.useState(""),[O,Z]=m.useState(null),[W,F]=m.useState(null),[ae,re]=m.useState([]),[q,I]=m.useState(!1),G=m.useRef(null);m.useEffect(()=>{if(!p)return;p.providers.find(w=>w.id==="claude-cli"&&w.available)&&(g("claude-cli"),j("opus"))},[p]),m.useEffect(()=>()=>{var N;(N=G.current)==null||N.abort()},[]);function X(){return p==null?void 0:p.providers.find(N=>N.id===b&&N.available)}const ne=m.useCallback(()=>{var N;(N=G.current)==null||N.abort(),v("open")},[]);async function te(){v("loading"),Z(null),F(null),re([]);const N=new AbortController;G.current=N;try{const w=await fetch(`/api/skills/${encodeURIComponent(s)}/${encodeURIComponent(o)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,model:f}),signal:N.signal});if(!w.ok||!w.body){let D=`HTTP ${w.status}`;try{const P=await w.json();P.error&&(D=P.error)}catch{}throw new Error(D)}const ee=w.body.getReader(),B=new TextDecoder;let ue="",S="";for(;;){const{done:D,value:P}=await ee.read();if(D)break;ue+=B.decode(P,{stream:!0});const le=ue.split(`
60
60
  `);ue=le.pop()||"";for(const ce of le)if(ce.startsWith("event: "))S=ce.slice(7).trim();else if(ce.startsWith("data: ")){try{const de=JSON.parse(ce.slice(6));S==="progress"?re(me=>[...me,{phase:de.phase,message:de.message,timestamp:Date.now()}]):S==="done"||S==="complete"?(U(de.improved),Y(de.reasoning||""),k(Dr(de.original||c,de.improved)),v("diff_shown")):S==="error"&&(Z(de.message||de.description||"Unknown error"),de.category&&F(de),v("open"))}catch{}S=""}}}catch(w){w.name!=="AbortError"&&(Z(w.message),v("open"))}finally{G.current=null}}async function be(){I(!0);try{await ge.applyImprovement(s,o,R),u(R),v("closed")}catch(N){Z(N.message)}finally{I(!1)}}function he(){v("closed"),k([]),U(""),Y(""),Z(null)}if(x==="closed")return a.jsxs("button",{onClick:()=>v("open"),className:"btn btn-secondary mb-5",disabled:!c,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const T=X();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.jsx("button",{onClick:he,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface-3)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:N=>{g(N.target.value);const w=p==null?void 0:p.providers.find(ee=>ee.id===N.target.value);w!=null&&w.models[0]&&j(w.models[0].id)},disabled:x==="loading",children:p==null?void 0:p.providers.filter(N=>N.available).map(N=>a.jsx("option",{value:N.id,children:N.label},N.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:f,onChange:N=>j(N.target.value),disabled:x==="loading",children:T==null?void 0:T.models.map(N=>a.jsx("option",{value:N.id,children:N.label},N.id))})]}),x==="loading"?a.jsx("button",{onClick:ne,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:te,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),x==="loading"&&ae.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(fs,{entries:ae,isRunning:!0})})]}),O&&a.jsx("div",{className:"mb-4",children:W?a.jsx(ds,{error:W,onRetry:te,onDismiss:()=>{Z(null),F(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:O})}),x==="diff_shown"&&a.jsxs(a.Fragment,{children:[L&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),L]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:y.map((N,w)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:N.type==="added"?"rgba(34,197,94,0.1)":N.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:N.type==="added"?"var(--green)":N.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:N.type==="added"?"3px solid var(--green)":N.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:N.type==="added"?"+":N.type==="removed"?"-":" "}),N.content]},w))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:be,disabled:q,className:"btn btn-primary",children:q?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:he,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const zx={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},Ev={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function kv({change:s,index:o,selected:c,onToggle:u,originalEval:x}){var y;const[v,p]=m.useState(!1),b=zx[s.action]??zx.add,g=Ev[s.action]??"var(--border-subtle)",f=s.action==="remove"?(x==null?void 0:x.name)??`Eval #${s.evalId}`:((y=s.eval)==null?void 0:y.name)??"Unnamed",j=m.useCallback(()=>u(o),[u,o]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:c?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:c,onChange:j,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:b.bg,color:b.color,padding:"1px 6px"},children:b.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:s.reason}),a.jsx("button",{onClick:()=>p(!v),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface-3)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),v&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.action==="add"&&s.eval&&a.jsx(Cv,{evalCase:s.eval}),s.action==="modify"&&s.eval&&x&&a.jsx(Tv,{original:x,proposed:s.eval}),s.action==="remove"&&x&&a.jsx(wv,{evalCase:x})]})]})}function Cv({evalCase:s}){var o;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(xc,{label:"Prompt",value:s.prompt}),a.jsx(xc,{label:"Expected",value:s.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(s.assertions??[]).map(c=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",c.text]},c.id))})]})]})}function Tv({original:s,proposed:o}){const c=[];s.name!==o.name&&c.push({label:"Name",old:s.name,new:o.name}),s.prompt!==o.prompt&&c.push({label:"Prompt",old:s.prompt,new:o.prompt}),s.expected_output!==o.expected_output&&c.push({label:"Expected",old:s.expected_output,new:o.expected_output});const u=s.assertions??[],x=o.assertions??[],v=new Set(u.map(f=>f.text)),p=new Set(x.map(f=>f.text)),b=x.filter(f=>!v.has(f.text)),g=u.filter(f=>!p.has(f.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[c.map(f=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:f.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",pc(f.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",pc(f.new,120)]})]})]},f.label)),(b.length>0||g.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",f.text]},f.id)),b.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",f.text]},f.id))]})]}),c.length===0&&b.length===0&&g.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function wv({evalCase:s}){var o;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(xc,{label:"Prompt",value:s.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(s.assertions??[]).map(c=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:c.text},c.id))})]})]})}function xc({label:s,value:o}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),a.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:pc(o,300)})]})}function pc(s,o){return s.length>o?s.slice(0,o)+"...":s}const Dx={remove:0,modify:1,add:2};function Av({changes:s,selections:o,currentEvals:c,onToggle:u,onSelectAll:x,onDeselectAll:v}){if(s.length===0)return null;const p=s.map((g,f)=>({change:g,originalIndex:f}));p.sort((g,f)=>(Dx[g.change.action]??2)-(Dx[f.change.action]??2));const b=Array.from(o.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b,"/",s.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:x,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),a.jsx("button",{onClick:v,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:p.map(({change:g,originalIndex:f})=>a.jsx(kv,{change:g,index:f,selected:o.get(f)??!1,onToggle:u,originalEval:g.evalId!=null?c.find(j=>j.id===g.evalId):void 0},f))})]})}function Rv(){var N;const{state:s,dispatch:o,submitAiEdit:c,applyAiEdit:u,discardAiEdit:x,cancelAiEdit:v,toggleEvalChange:p,selectAllEvalChanges:b,deselectAllEvalChanges:g,retryEvalsSave:f}=al(),{aiEditLoading:j,aiEditResult:y,aiEditError:k,aiEditClassifiedError:R,aiEditProgress:U,aiEditEvalChanges:L,aiEditEvalSelections:Y,aiEditEvalsRetry:O}=s,[Z,W]=m.useState(""),{config:F}=ia(),[ae,re]=m.useState("claude-cli"),[q,I]=m.useState("opus"),G=m.useRef(null);m.useEffect(()=>{var w;(w=G.current)==null||w.focus()},[]),m.useEffect(()=>{if(!F)return;F.providers.find(ee=>ee.id==="claude-cli"&&ee.available)&&(re("claude-cli"),I("opus"))},[F]);const X=F==null?void 0:F.providers.find(w=>w.id===ae&&w.available),ne=m.useCallback(()=>{const w=Z.trim();!w||j||c(w,ae,q)},[Z,j,c,ae,q]),te=m.useCallback(w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),ne()),w.key==="Escape"&&(w.preventDefault(),j?v():x())},[ne,j,v,x]),be=m.useCallback(()=>{o({type:"CLOSE_AI_EDIT"}),o({type:"OPEN_AI_EDIT"})},[o]),he=y?Dr(s.skillContent,y.improved):[],T=((N=s.evals)==null?void 0:N.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.jsx("button",{onClick:x,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:w=>{w.currentTarget.style.background="var(--surface-3)"},onMouseLeave:w=>{w.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!y&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-2.5",children:[a.jsx("div",{className:"flex-1",children:a.jsx("textarea",{ref:G,value:Z,onChange:w=>W(w.target.value),onKeyDown:te,placeholder:"e.g., Add an error handling section...",disabled:j,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:w=>{const ee=w.currentTarget;ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,96)+"px"}})}),a.jsxs("div",{style:{minWidth:100},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:ae,onChange:w=>{re(w.target.value);const ee=F==null?void 0:F.providers.find(B=>B.id===w.target.value);ee!=null&&ee.models[0]&&I(ee.models[0].id)},disabled:j,style:{width:"100%"},children:F==null?void 0:F.providers.filter(w=>w.available).map(w=>a.jsx("option",{value:w.id,children:w.label},w.id))})]}),a.jsxs("div",{style:{minWidth:80},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:q,onChange:w=>I(w.target.value),disabled:j,style:{width:"100%"},children:X==null?void 0:X.models.map(w=>a.jsx("option",{value:w.id,children:w.label},w.id))})]}),j?a.jsx("button",{onClick:v,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:ne,disabled:!Z.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),j&&U.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(fs,{entries:U,isRunning:!0})})]}),k&&a.jsx("div",{className:"mt-3",children:R?a.jsx(ds,{error:R,onRetry:be,onDismiss:x}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),y&&a.jsxs("div",{className:"animate-fade-in",children:[y.reasoning&&a.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),y.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:he.map((w,ee)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:w.type==="added"?"rgba(34,197,94,0.1)":w.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:w.type==="added"?"var(--green)":w.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:w.type==="added"?"3px solid var(--green)":w.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:w.type==="added"?"+":w.type==="removed"?"-":" "}),w.content]},ee))}),a.jsx(Av,{changes:L,selections:Y,currentEvals:T,onToggle:p,onSelectAll:b,onDeselectAll:g}),O&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:f,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:u,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:x,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:be,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function _v(s,o){const[c,u]=m.useState([]),[x,v]=m.useState("SKILL.md"),[p,b]=m.useState(null),[g,f]=m.useState(!1),[j,y]=m.useState(null),k=m.useCallback(async()=>{try{const L=await ge.getSkillFiles(s,o);u(L.files)}catch{u([])}},[s,o]);m.useEffect(()=>{v("SKILL.md"),b(null),y(null),k()},[s,o,k]);const R=m.useCallback(async L=>{if(v(L),L==="SKILL.md"){b(null),y(null);return}f(!0),y(null);try{const Y=await ge.getSkillFile(s,o,L);b(Y)}catch(Y){y(`Unable to open file: ${Y.message}`),b(null)}finally{f(!1)}},[s,o]),U=m.useCallback(()=>{k()},[k]);return{files:c,activeFile:x,secondaryContent:p,loading:g,error:j,selectFile:R,refresh:U,isSkillMd:x==="SKILL.md"}}function Mv(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Lv(s){const o=[],c=new Map;for(const u of s){const x=u.path.split("/"),p={name:x[x.length-1],path:u.path,type:u.type,size:u.size,children:[]};c.set(u.path,p)}for(const u of s){const x=u.path.split("/");if(x.length===1){const v=c.get(u.path);v&&o.push(v)}else{const v=x.slice(0,-1).join("/"),p=c.get(v),b=c.get(u.path);p&&b&&p.children.push(b)}}return o}function tp({expanded:s}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:s?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function lp(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 zv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Dv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function ap({node:s,depth:o,activeFile:c,onSelect:u}){const[x,v]=m.useState(!0),p=s.path===c;return s.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>v(!x),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[a.jsx(tp,{expanded:x}),a.jsx(lp,{}),a.jsxs("span",{children:[s.name,"/"]})]}),x&&s.children.map(b=>a.jsx(ap,{node:b,depth:o+1,activeFile:c,onSelect:u},b.path))]}):a.jsxs("button",{onClick:()=>u(s.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:p?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:p?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[a.jsx("span",{style:{width:10}}),a.jsx(zv,{}),a.jsx("span",{style:{flex:1},children:s.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Mv(s.size)})]})}function Ov({files:s,activeFile:o,onSelect:c,onRefresh:u}){const[x,v]=m.useState(!1),p=m.useMemo(()=>Lv(s),[s]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>v(!x),children:[a.jsx(tp,{expanded:x}),a.jsx(lp,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),a.jsx("button",{onClick:b=>{b.stopPropagation(),u()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:a.jsx(Dv,{})})]}),x&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:p.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):p.map(b=>a.jsx(ap,{node:b,depth:0,activeFile:o,onSelect:c},b.path))})]})}function kr(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Bv(s){try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}}function Hv(s){const o=s.toLowerCase();return o.endsWith(".json")?"json":o.endsWith(".md")?"md":"other"}function Ox({content:s}){return a.jsx("textarea",{readOnly:!0,value:s,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function Bx({content:s,fileType:o}){if(o==="json"){const c=Bv(s);return a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c})}return o==="md"?a.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:zr(s)}}):a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}function Hx(s){try{return JSON.stringify(JSON.parse(s),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,c=>`<span style="color:#6383ff">${c}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,c=>`<span style="color:#22c55e">${c.slice(0,2)}<span style="color:#22c55e">${c.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(c,u)=>`: <span style="color:#fb923c">${u}</span>`).replace(/:\s*(true|false|null)/g,(c,u)=>`: <span style="color:#a855f7">${u}</span>`)}catch{return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function Uv({file:s,loading:o,error:c,viewMode:u,plugin:x,skill:v,onSaved:p,onDirtyChange:b}){const[g,f]=m.useState(u),[j,y]=m.useState(!1),[k,R]=m.useState(""),[U,L]=m.useState(!1),[Y,O]=m.useState(null),Z=u!==g?u:g;m.useEffect(()=>{b==null||b(j)},[j,b]);const W=m.useCallback(()=>{(s==null?void 0:s.content)!=null&&(R(s.content),y(!0))},[s]),F=m.useCallback(()=>{y(!1)},[]),ae=m.useCallback(async()=>{if(!(!x||!v||!s)){L(!0);try{await ge.saveSkillFile(x,v,s.path,k),O("Saved"),y(!1),p==null||p(),setTimeout(()=>O(null),2e3)}catch(I){O(`Save failed: ${I.message}`),setTimeout(()=>O(null),3e3)}finally{L(!1)}}},[x,v,s,k,p]);if(m.useEffect(()=>{if(!j)return;const I=G=>{(G.ctrlKey||G.metaKey)&&G.key==="s"&&(G.preventDefault(),ae())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[j,ae]),o)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(c)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:c})]})});if(!s)return null;if(s.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",kr(s.size),") — cannot be displayed"]});const re=s.content??"",q=Hv(s.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[s.truncated&&a.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",kr(512*1024)," — ",kr(s.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(q==="md"||q==="json")&&["raw","split","preview"].map(I=>a.jsx("button",{onClick:()=>f(I),style:{padding:"2px 8px",fontSize:11,background:Z===I?"var(--accent-muted)":"none",color:Z===I?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:I},I)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[kr(s.size),x&&v&&!s.binary&&!j&&a.jsx("button",{onClick:W,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),j&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:ae,disabled:U,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:U?.6:1},children:U?"Saving...":"Save"}),a.jsx("button",{onClick:F,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),Y&&a.jsx("div",{style:{padding:"4px 12px",background:Y.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:Y.startsWith("Save failed")?"var(--red)":"var(--green)"},children:Y}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:j?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:k,onChange:I=>R(I.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),a.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:ae,disabled:U,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:U?.6:1},children:U?"Saving...":"Save"}),a.jsx("button",{onClick:F,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):Z==="split"&&q!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Ox,{content:re})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:q==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Hx(re)}}):a.jsx(Bx,{content:re,fileType:q})})]}):Z==="preview"&&q!=="other"?q==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Hx(re)}}):a.jsx(Bx,{content:re,fileType:q}):a.jsx(Ox,{content:re})})]})}function qv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function Vv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Gv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Yv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function ac({size:s=15}){return a.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function $v(){const{state:s,dispatch:o,saveContent:c,isReadOnly:u}=al(),{plugin:x,skill:v,skillContent:p,isDirty:b,improveTarget:g,aiEditOpen:f}=s,[j,y]=m.useState("split"),[k,R]=m.useState(!1),U=m.useRef(null),[L,Y]=m.useState(!1),[O,Z]=m.useState(""),[W,F]=m.useState(!1),[ae,re]=m.useState(null),[q,I]=m.useState([]),[G,X]=m.useState([]),[ne,te]=m.useState(null),be=m.useRef(null),{config:he}=ia(),{files:T,activeFile:N,secondaryContent:w,loading:ee,error:B,selectFile:ue,refresh:S,isSkillMd:D}=_v(x??"",v??""),[P,le]=m.useState(!1),ce=m.useCallback(K=>{P&&!window.confirm("You have unsaved changes. Discard?")||ue(K)},[P,ue]);m.useEffect(()=>()=>{var K;(K=be.current)==null||K.abort()},[]);const{metadata:de,body:me}=bv(p),Oe=de["allowed-tools"],Re=Array.isArray(Oe)?Oe:typeof Oe=="string"?[Oe]:[],pt=de.name,Dt=de.description,J=de.metadata,ie=typeof J=="object"&&!Array.isArray(J)?J:null,se=de.version||(ie==null?void 0:ie.version),xe=de.tags||(ie==null?void 0:ie.tags),ye=Array.isArray(xe)?xe:typeof xe=="string"?xe.split(",").map(K=>K.trim()).filter(Boolean):[],Ye=new Set(["name","description","metadata","allowed-tools","version","tags"]),ut=Object.entries(de).filter(([K])=>!Ye.has(K)),Qe=m.useCallback(async()=>{R(!0),await c(),R(!1)},[c]),Ot=m.useCallback(K=>{(K.ctrlKey||K.metaKey)&&K.key==="s"&&(K.preventDefault(),K.stopPropagation(),b&&Qe()),(K.ctrlKey||K.metaKey)&&K.key==="k"&&(K.preventDefault(),K.stopPropagation(),o({type:f?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[b,Qe,f,o]),mt=m.useCallback(async()=>{var Be,at;if(!O.trim())return;(Be=be.current)==null||Be.abort();const K=new AbortController;be.current=K,F(!0),te(null),X([]),re(null),I([]);try{const Je=(he==null?void 0:he.provider)||"claude-cli",Ml=(he==null?void 0:he.model)||"sonnet",Bt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:O,provider:Je,model:Ml}),signal:K.signal});if(!Bt.ok||!Bt.body){let et=`HTTP ${Bt.status}`;try{const sl=await Bt.json();sl.error&&(et=sl.error)}catch{}throw new Error(et)}const oa=Bt.body.getReader(),Ct=new TextDecoder;let Fe="",nt="";for(;;){const{done:et,value:sl}=await oa.read();if(et)break;Fe+=Ct.decode(sl,{stream:!0});const $e=Fe.split(`
61
61
  `);Fe=$e.pop()||"";for(const rl of $e)if(rl.startsWith("event: "))nt=rl.slice(7).trim();else if(rl.startsWith("data: ")){try{const st=JSON.parse(rl.slice(6));if(nt==="progress")X(Ve=>[...Ve,{phase:st.phase,message:st.message,timestamp:Date.now()}]);else if(nt==="done"||nt==="complete"){const Ve=["---"];st.name&&Ve.push(`name: ${st.name}`),st.description&&Ve.push(`description: "${st.description.replace(/"/g,'\\"')}"`),st.model&&Ve.push(`model: ${st.model}`),(at=st.allowedTools)!=null&&at.trim()&&Ve.push(`allowed-tools: ${st.allowedTools.trim()}`),Ve.push("---","",st.body||"");const Ll=Ve.join(`
62
- `);re(Ll),I(Dr(p,Ll)),F(!1)}else nt==="error"&&(te(st.message||st.description||"Generation failed"),F(!1))}catch{}nt=""}}}catch(Je){Je.name!=="AbortError"&&te(Je.message)}finally{F(!1),be.current=null}},[O,he,p]),nl=m.useCallback(()=>{ae&&o({type:"SET_CONTENT",content:ae}),Y(!1),re(null),I([]),Z(""),X([])},[ae,o]),Xt=m.useCallback(()=>{Y(!1),re(null),I([]),Z(""),X([]),te(null)},[]),We=m.useCallback(()=>{var K;L?((K=be.current)==null||K.abort(),Xt()):(f&&o({type:"CLOSE_AI_EDIT"}),Y(!0))},[L,f,o,Xt]),kt=[{mode:"raw",icon:a.jsx(qv,{}),label:"Editor"},{mode:"split",icon:a.jsx(Vv,{}),label:"Split"},{mode:"preview",icon:a.jsx(Gv,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Ot,tabIndex:-1,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:kt.map(({mode:K,icon:Be,label:at})=>a.jsxs("button",{onClick:()=>y(K),title:at,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:j===K?"var(--surface-4)":"transparent",color:j===K?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:j===K?600:400,border:"none",cursor:"pointer"},children:[Be,a.jsx("span",{style:{letterSpacing:"0.01em"},children:at})]},K))}),D?u?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{f?o({type:"CLOSE_AI_EDIT"}):(L&&Xt(),o({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:f?600:400,border:"none",cursor:"pointer",color:f?"#a855f7":"var(--text-tertiary)",background:f?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(Yv,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:We,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:L?600:400,border:"none",cursor:"pointer",color:L?"#a855f7":"var(--text-tertiary)",background:L?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(ac,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),b&&a.jsx("button",{onClick:()=>o({type:"SET_CONTENT",content:s.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:Qe,disabled:!b||k,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),x&&v&&a.jsx(Ov,{files:T,activeFile:N,onSelect:ce,onRefresh:S}),!D&&a.jsx(Uv,{file:w,loading:ee,error:B,viewMode:j,plugin:x??void 0,skill:v??void 0,onSaved:()=>{ue(N),S()},onDirtyChange:le}),D&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:j==="raw"||j==="preview"?"1fr":"1fr 1fr"},children:[j!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:j==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:U,value:p,onChange:K=>{u||o({type:"SET_CONTENT",content:K.target.value})},onKeyDown:Ot,spellCheck:!1,readOnly:u,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:u?.7:1}})}),j!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(pt||se||Dt)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[pt&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:pt}),se&&a.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",se]})]}),Dt&&a.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Dt})]}),ye.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.map(K=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:K},K))}),Re.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map(K=>a.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:K},K))]})}),ut.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:ut.map(([K,Be],at)=>{const Je=Array.isArray(Be)?Be.join(", "):typeof Be=="object"?Object.entries(Be).map(([Ml,Bt])=>`${Ml}: ${Array.isArray(Bt)?Bt.join(", "):Bt}`).join(" | "):Be;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:at>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:K}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Je})]},K)})}),(pt||Dt||ye.length>0||Re.length>0||ut.length>0)&&me&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),me&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:zr(me)}})]})})]}),D&&f&&a.jsx(Rv,{}),D&&L&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:O,onChange:K=>Z(K.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:W,className:"flex-1 px-3 py-2 rounded-lg text-[12px] resize-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none",opacity:W?.5:1},onKeyDown:K=>{K.key==="Enter"&&(K.ctrlKey||K.metaKey)&&O.trim()&&!W&&(K.preventDefault(),mt())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[W?a.jsx("button",{onClick:()=>{var K;(K=be.current)==null||K.abort(),F(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:mt,disabled:!O.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Xt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),W&&G.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(fs,{entries:G,isRunning:!0})}),ne&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[ne,a.jsx("button",{onClick:mt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:q.map((K,Be)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:K.type==="added"?"rgba(34,197,94,0.1)":K.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:K.type==="added"?"var(--green)":K.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:K.type==="added"?"3px solid var(--green)":K.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:K.type==="added"?"+":K.type==="removed"?"-":" "}),K.content]},Be))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:nl,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:Xt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),D&&g!==null&&x&&v&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Nv,{plugin:x,skill:v,skillContent:p,onApplied:K=>{o({type:"SET_CONTENT",content:K}),o({type:"CONTENT_SAVED"}),o({type:"CLOSE_IMPROVE"})}})})]})}function xn(s){return s.testType==="integration"?"integration":"unit"}function pn(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function np(s){const o=new Date(s);return o.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function sp(s){return s==null?"--":s>=1e3?`${(s/1e3).toFixed(1)}s`:`${s}ms`}const Qv=new Set(["benchmark","comparison","baseline"]);function Ux(s,o,c,u){return s.map(({rate:x,idx:v,total:p})=>{const b=u+v/(p-1)*(o-u*2),g=u+(c-u*2)-x*(c-u*2);return`${b},${g}`})}function rp({entries:s}){const o=s.filter(y=>Qv.has(y.type)).slice().reverse(),c=o.map((y,k,R)=>({rate:y.pass_rate,idx:k,total:R.length})).filter((y,k)=>{const R=o[k].type;return R==="benchmark"||R==="comparison"}),u=o.flatMap((y,k)=>y.type==="baseline"?[{rate:y.pass_rate,idx:k,total:o.length}]:y.type==="comparison"&&y.baselinePassRate!=null?[{rate:y.baselinePassRate,idx:k,total:o.length}]:[]);if(c.length<2&&u.length<2)return null;const x=80,v=24,p=2,b=c.length>=2?Ux(c,x,v,p):[],g=u.length>=2?Ux(u,x,v,p):[],f=b[b.length-1],j=g[g.length-1];return a.jsxs("svg",{width:x,height:v,style:{display:"block",flexShrink:0},children:[g.length>0&&a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),b.length>0&&a.jsx("polyline",{points:b.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),j&&a.jsx("circle",{cx:parseFloat(j.split(",")[0]),cy:parseFloat(j.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&a.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function ip(s,o,c){const u=isNaN(o)?0:o,x=[],v=[],p=[];if((s==="PASS"||s==="EFFECTIVE")&&u>=.7){const f=x.length>0?` Met criteria: ${x.map(j=>j.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): evaluation met expectations.${f}`}}if((s==="FAIL"||s==="DEGRADING")&&u<.7){const f=v.length>0?` Failed criteria: ${v.map(y=>y.criterion).join(", ")}.`:"",j=[...v.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...p.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return j.length===0&&j.push("Review prompt instructions and add more specific guidance"),{explanation:`${s} (score ${u.toFixed(2)}): evaluation did not meet expectations.${f}`,recommendations:j}}if(s==="INEFFECTIVE"&&u<.2){const f=[...v.map(j=>`Rework "${j.criterion}" — currently at ${j.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${s} (score ${u.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:f}}if(s==="MARGINAL"){const f=[...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`),...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push("Review prompt instructions for areas of improvement"),{explanation:`${s} (score ${u.toFixed(2)}): moderate improvement detected.`,recommendations:f}}if(s==="EMERGING"){const f=[...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`),...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push("Add more specific guidance to your prompt instructions"),{explanation:`${s} (score ${u.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:f}}if(s==="INEFFECTIVE"&&u>=.2){const f=[...v.map(j=>`Rework "${j.criterion}" — currently at ${j.score.toFixed(2)}`),...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push("Consider restructuring your prompt approach"),{explanation:`${s} (score ${u.toFixed(2)}): below expectations but showing some capability.`,recommendations:f}}const b=x.length>0?` Passing: ${x.map(f=>f.criterion).join(", ")}.`:"",g=p.length>0?` Needs improvement: ${p.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): mixed results.${b}${g}`}}const op={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function Xv(s){return Object.hasOwn(op,s)}function Kv(s){return Xv(s)?op[s]:s}function Zv(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=m.useState([]),[v,p]=m.useState([]),[b,g]=m.useState(!0),[f,j]=m.useState(null),[y,k]=m.useState(new Set),[R,U]=m.useState({}),[L,Y]=m.useState(null),[O,Z]=m.useState(""),[W,F]=m.useState(!1),[ae,re]=m.useState(""),[q,I]=m.useState(""),G=m.useCallback(async()=>{g(!0),j(null);try{const[T,N]=await Promise.all([ge.getCredentials(o,c),ge.getParams(o,c)]);x(T.credentials),p(N.params)}catch(T){j(T instanceof Error?T.message:"Failed to load parameters"),x([]),p([])}finally{g(!1)}},[o,c]);m.useEffect(()=>{G()},[G]);const X=m.useCallback(async(T,N)=>{F(!0),j(null);try{await ge.setCredential(o,c,T,N),Y(null),Z(""),await G()}catch(w){j(w instanceof Error?w.message:`Failed to save ${T}`)}finally{F(!1)}},[o,c,G]),ne=m.useCallback(async()=>{const T=ae.trim().toUpperCase(),N=q.trim();if(!(!T||!N)){F(!0),j(null);try{await ge.setCredential(o,c,T,N),re(""),I(""),await G()}catch(w){j(w instanceof Error?w.message:`Failed to add ${T}`)}finally{F(!1)}}},[o,c,ae,q,G]),te=m.useCallback(async T=>{if(y.has(T)){k(N=>{const w=new Set(N);return w.delete(T),w}),U(N=>{const w={...N};return delete w[T],w});return}try{const w=(await ge.getParamsRevealed(o,c,T)).params.find(ee=>ee.name===T);w!=null&&w.value&&(U(ee=>({...ee,[T]:w.value})),k(ee=>new Set(ee).add(T)))}catch{}},[o,c,y]),be=new Set(u.map(T=>T.name)),he=[...u.map(T=>{const N=v.find(w=>w.name===T.name);return{name:T.name,status:T.status,maskedValue:(N==null?void 0:N.maskedValue)??""}}),...v.filter(T=>!be.has(T.name)).map(T=>({name:T.name,status:T.status,maskedValue:T.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),f&&a.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"rgba(239,68,68,0.1)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.2)"},role:"alert",children:f}),b&&he.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!b&&he.length===0&&!f&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),he.map(T=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:T.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:T.status==="ready"?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.15)",color:T.status==="ready"?"#22c55e":"#ef4444"},children:T.status}),(T.maskedValue||T.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[y.has(T.name)?R[T.name]??T.maskedValue:T.maskedValue||"***",a.jsx("button",{onClick:()=>te(T.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${y.has(T.name)?"Hide":"Reveal"} value for ${T.name}`,children:y.has(T.name)?"hide":"show"})]}),L===T.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:O,onChange:N=>Z(N.target.value),onKeyDown:N=>{N.key==="Enter"&&O.trim()&&X(T.name,O)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${T.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>X(T.name,O),disabled:W||!O.trim(),className:"text-[10px] font-medium",style:{color:"#22c55e",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{Y(null),Z("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{Y(T.name),Z("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},T.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:ae,onChange:T=>re(T.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:q,onChange:T=>I(T.target.value),onKeyDown:T=>{T.key==="Enter"&&ae.trim()&&q.trim()&&ne()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:ne,disabled:W||!ae.trim()||!q.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:W?"not-allowed":"pointer"},children:"Add"})]})]})]})}function Jv(s,o,c){const[u,x]=m.useState(null),[v,p]=m.useState(!1),b=m.useRef("");m.useEffect(()=>{const f=`${s}/${o}/${c}`;b.current!==f&&(b.current=f,p(!0),ge.getCaseHistory(s,o,c).then(j=>x(j)).catch(()=>x([])).finally(()=>p(!1)))},[s,o,c]);const g=m.useCallback(()=>{p(!0),b.current="",ge.getCaseHistory(s,o,c).then(f=>x(f)).catch(()=>x([])).finally(()=>p(!1))},[s,o,c]);return{entries:u,loading:v,refetch:g}}function Wv(s,o,c){const u={flaky:!1,nonDiscriminating:!1,regression:!1};if(!c||c.length===0)return u;const v=c.slice(0,10).map(g=>g.assertions.find(f=>f.id===s)).filter(Boolean);if(v.length>=2){const f=v.filter(j=>j.pass).length/v.length;f>=.3&&f<=.7&&(u.flaky=!0)}const p=c.find(g=>g.type==="benchmark"),b=c.find(g=>g.type==="baseline");if(p&&b){const g=p.assertions.find(j=>j.id===s),f=b.assertions.find(j=>j.id===s);g!=null&&g.pass&&(f!=null&&f.pass)&&(u.nonDiscriminating=!0)}if(o&&!o.pass&&c.length>=1){const f=c[0].assertions.find(j=>j.id===s);f!=null&&f.pass&&(u.regression=!0)}return u}function Fv(){var ee;const{state:s,dispatch:o,saveEvals:c,runCase:u,runAll:x,cancelCase:v,cancelAll:p,generateEvals:b,isReadOnly:g}=al(),{evals:f,evalsError:j,selectedCaseId:y,inlineResults:k,caseRunStates:R,generateEvalsLoading:U,generateEvalsProgress:L,generateEvalsError:Y}=s,O=m.useMemo(()=>{for(const B of R.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[R]),[Z,W]=m.useState(!1),[F,ae]=m.useState("all"),re={skill_name:s.skill,evals:[]},q=f??re,I=q.evals,G=m.useMemo(()=>F==="all"?I:I.filter(B=>xn(B)===F),[F,I]),X=G.find(B=>B.id===y)??null;m.useEffect(()=>{y!==null&&!G.find(B=>B.id===y)&&o({type:"SELECT_CASE",caseId:G.length>0?G[0].id:null})},[G,y,o]);const[ne,te]=m.useState([]),be=m.useMemo(()=>I.some(B=>xn(B)==="integration"),[I]);m.useEffect(()=>{be&&ge.getCredentials(s.plugin,s.skill).then(B=>te(B.credentials)).catch(()=>te([]))},[s.plugin,s.skill,be]);const he=m.useMemo(()=>new Set(ne.filter(B=>B.status==="missing").map(B=>B.name)),[ne]),[T,N]=m.useState(!1),w=m.useCallback(B=>{N(!1),b(B?{testType:B}:void 0)},[b]);return!f||I.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:j?"var(--error-muted, #3f1a1a)":"var(--accent-muted)"},children:j?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--error, #f87171)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:j?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--error, #f87171)"},children:"Invalid evals.json"}),a.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:j}),a.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>W(!0),disabled:g,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>w("unit"),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:U?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>N(!T),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),T&&a.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:a.jsx("button",{onClick:()=>w("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),U&&L.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(fs,{entries:L,isRunning:!0})}),Y&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(ds,{error:Y,onRetry:()=>w()})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",G.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:O?a.jsx("button",{onClick:p,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel All"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>x("benchmark"),disabled:G.length===0||g,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>x("comparison"),disabled:G.length===0||g,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(B=>a.jsx("button",{onClick:()=>ae(B),style:{padding:"2px 8px",fontSize:10,fontWeight:F===B?600:400,background:F===B?"var(--accent-muted)":"transparent",color:F===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:B==="all"?`All (${I.length})`:B==="unit"?`Unit (${I.filter(ue=>xn(ue)==="unit").length})`:`Integration (${I.filter(ue=>xn(ue)==="integration").length})`},B))}),a.jsxs("div",{className:"py-1",children:[G.length===0&&I.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",F==="all"?"":F+" ","tests yet"]}),G.map(B=>{var P;const ue=k.get(B.id),S=y===B.id,D=xn(B);return a.jsxs("button",{onClick:()=>o({type:"SELECT_CASE",caseId:B.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:S?"var(--accent-muted)":"transparent",borderLeft:S?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:le=>{S||(le.currentTarget.style.background="var(--surface-2)")},onMouseLeave:le=>{S||(le.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:S?"var(--text-primary)":"var(--text-secondary)"},children:["#",B.id," ",B.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:D==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:D==="unit"?"#6383ff":"#fb923c",whiteSpace:"nowrap"},children:D==="unit"?"U":"I"}),D==="integration"&&((P=B.requiredCredentials)==null?void 0:P.some(le=>he.has(le)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(cp,{result:ue})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[B.assertions.length," assertion",B.assertions.length!==1?"s":"",(ue==null?void 0:ue.passRate)!=null&&a.jsx(ey,{passRate:ue.passRate})]})]},B.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!g&&a.jsx("button",{onClick:()=>W(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.borderColor="var(--accent)",B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-default)",B.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),be&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Zv,{})})]}),a.jsx("div",{className:"overflow-auto",children:X?a.jsx(Iv,{evalCase:X,result:k.get(X.id),evals:f,caseStatus:((ee=R.get(X.id))==null?void 0:ee.status)??"idle",onSaveEvals:c,onRun:B=>u(B,"benchmark"),onCompare:B=>u(B,"comparison"),onCancel:B=>v(B),onImprove:B=>o({type:"OPEN_IMPROVE",evalId:B})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]})}function Iv({evalCase:s,result:o,evals:c,caseStatus:u,onSaveEvals:x,onRun:v,onCompare:p,onCancel:b,onImprove:g}){const{state:f,isReadOnly:j}=al(),{plugin:y,skill:k}=f,{entries:R,loading:U}=Jv(y,k,s.id),[L,Y]=m.useState(!1),[O,Z]=m.useState(s.prompt),[W,F]=m.useState(!1),[ae,re]=m.useState(s.expected_output);m.useState(()=>{Z(s.prompt),re(s.expected_output)});const q=m.useCallback(B=>{x({...c,evals:c.evals.map(ue=>ue.id===B.id?B:ue)})},[c,x]),I=m.useCallback(()=>{q({...s,prompt:O}),Y(!1)},[s,O,q]),G=m.useCallback(()=>{q({...s,expected_output:ae}),F(!1)},[s,ae,q]),X=m.useCallback(()=>{q({...s,assertions:[...s.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[s,q]),ne=m.useCallback((B,ue)=>{q({...s,assertions:s.assertions.map(S=>S.id===B?{...S,text:ue}:S)})},[s,q]),te=m.useCallback(B=>{q({...s,assertions:s.assertions.filter(ue=>ue.id!==B)})},[s,q]),be=m.useCallback(()=>{confirm("Delete this test case?")&&x({...c,evals:c.evals.filter(B=>B.id!==s.id)})},[c,s.id,x]),he=o&&o.assertions.length>0&&o.assertions.every(B=>B.pass),T=o&&o.assertions.some(B=>!B.pass),N=xn(s),w=s.requiredCredentials??[],ee=N==="integration"&&w.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",s.id," ",s.name]}),j?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c"},children:N==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((N==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ue,requirements:S,cleanup:D,...P}=s;q({...P,testType:"unit"})}else q({...s,testType:"integration"})},title:`Click to switch to ${N==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c",border:"none",cursor:"pointer"},children:N==="unit"?"Unit":"Integration"}),a.jsx(cp,{result:o})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"||u==="queued"?a.jsxs("button",{onClick:()=>b(s.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>v(s.id),disabled:j,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>p(s.id),disabled:j,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),T&&!j&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:()=>g(s.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!j&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:be,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),j&&N==="integration"&&a.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid rgba(99,131,255,0.2)"},children:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),he&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid rgba(52, 211, 153, 0.2)"},children:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ee&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"rgba(251,146,60,0.1)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:w.map(B=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:B},B))})]}),!j&&N==="integration"&&a.jsx(ay,{evalCase:s,onUpdate:q}),a.jsx(Cr,{title:"Prompt",children:L?a.jsxs("div",{children:[a.jsx("textarea",{value:O,onChange:B=>Z(B.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:I,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{Z(s.prompt),Y(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||Y(!0)},onMouseEnter:B=>{j||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:j?"No prompt":"Click to edit prompt..."})})}),a.jsx(Cr,{title:"Expected Output",children:W?a.jsxs("div",{children:[a.jsx("textarea",{value:ae,onChange:B=>re(B.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:G,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{re(s.expected_output),F(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||F(!0)},onMouseEnter:B=>{j||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:j?"No expected output":"Click to edit expected output..."})})}),a.jsx(Cr,{title:`Assertions (${s.assertions.length})`,action:j?void 0:a.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:s.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:s.assertions.map(B=>{const ue=o==null?void 0:o.assertions.find(D=>D.assertion_id===B.id),S=Wv(B.id,ue,R);return a.jsx(Pv,{assertion:B,result:ue,badges:S,isReadOnly:j,onUpdate:D=>ne(B.id,D),onDelete:()=>te(B.id)},B.id)})})}),(o==null?void 0:o.output)&&a.jsx(ty,{output:o.output,durationMs:o.durationMs,tokens:o.tokens}),o&&o.passRate!=null&&o.passRate<.2&&(()=>{const B=ip("INEFFECTIVE",o.passRate);return B.recommendations&&B.recommendations.length>0?a.jsx(Cr,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(251,146,60,0.08)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:B.recommendations.map((ue,S)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"#fb923c",fontWeight:600,flexShrink:0},children:"•"}),ue]},S))})]})}):null})(),a.jsx(ly,{evalId:s.id,sharedEntries:R,sharedLoading:U})]},s.id)}function Pv({assertion:s,result:o,badges:c,isReadOnly:u,onUpdate:x,onDelete:v}){const[p,b]=m.useState(!1),[g,f]=m.useState(s.text),[j,y]=m.useState(!1),k=()=>{x(g),b(!1)};return a.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsxs("div",{className:"flex items-start gap-2",children:[o?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(c==null?void 0:c.regression)&&a.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:s.id}),(c==null?void 0:c.flaky)&&a.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"rgba(234, 179, 8, 0.15)",color:"#ca8a04",whiteSpace:"nowrap"},children:"Flaky"}),(c==null?void 0:c.nonDiscriminating)&&a.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),p?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:g,onChange:R=>f(R.target.value),onKeyDown:R=>{R.key==="Enter"&&k(),R.key==="Escape"&&b(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:k,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:u?"default":"pointer"},onClick:()=>{u||(f(s.text),b(!0))},children:s.text}),(o==null?void 0:o.reasoning)&&a.jsx("button",{onClick:()=>y(!j),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:j?"Hide reasoning":"Show reasoning"}),j&&(o==null?void 0:o.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:o.reasoning})]}),!u&&a.jsx("button",{onClick:v,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.color="var(--red)",R.currentTarget.style.opacity="1"},onMouseLeave:R=>{R.currentTarget.style.color="var(--text-tertiary)",R.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Cr({title:s,action:o,children:c}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),o]}),c]})}function cp({result:s}){const[o,c]=m.useState(!1);if(!s||s.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=s.status==="pass",x=s.passRate??0,p=ip(u?"PASS":"FAIL",x);return a.jsxs("span",{className:"pill text-[10px]",style:{background:u?"var(--green-muted)":"var(--red-muted)",color:u?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),"aria-describedby":o?"verdict-tooltip":void 0,children:[s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status,o&&a.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:p.explanation})]})}function ey({passRate:s}){const o=Math.round(s*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${o}%`,background:o>=80?"var(--green)":o>=50?"var(--yellow)":"var(--red)"}})})})}function ty({output:s,durationMs:o,tokens:c}){const[u,x]=m.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>x(!u),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:u?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",o!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(o/1e3).toFixed(1),"s)"]}),c!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",c," tokens)"]})]}),u&&a.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})]})}function nc(s){return s==="baseline"?"right":s==="comparison"?"full":"left"}function sc({entry:s}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:np(s.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:s.type==="benchmark"?"rgba(99,131,255,0.15)":s.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:s.type==="benchmark"?"#6383ff":s.type==="comparison"?"var(--purple)":"#fb923c"},children:s.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(s.pass_rate)},children:[Math.round(s.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[s.durationMs!=null&&a.jsx("span",{children:sp(s.durationMs)}),s.tokens!=null&&a.jsxs("span",{children:[s.tokens>=1e3?`${(s.tokens/1e3).toFixed(1)}k`:s.tokens," tok"]})]}),s.type==="comparison"&&s.baselinePassRate!=null&&(()=>{const o=s.pass_rate-s.baselinePassRate,c=o>.001?"skill":o<-.001?"baseline":"tie",u=o>0?"+":"",x=c==="skill"?"var(--green)":c==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:o>=0?"var(--green)":"var(--red)"},children:[u,(o*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"rgba(0,0,0,0.2)",color:x},children:c})]})})(),a.jsx("div",{className:"space-y-0.5",children:s.assertions.map(o=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:o.text})]},o.id))})]})}function ly({evalId:s,sharedEntries:o,sharedLoading:c}){const{state:u,dispatch:x}=al(),{plugin:v,skill:p}=u,[b,g]=m.useState(!0),f=o??null,j=c??!1,y=m.useCallback(()=>{g(L=>!L)},[]),k=f?f.slice(0,10):[],R=k.some(L=>{const Y=nc(L.type);return Y==="left"||Y==="full"}),U=k.some(L=>{const Y=nc(L.type);return Y==="right"||Y==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:y,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",f&&f.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),b&&a.jsx("div",{className:"animate-fade-in",children:j?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!f||f.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[k.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(rp,{entries:k})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!R&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!U&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),k.map((L,Y)=>{const O=nc(L.type);return O==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(sc,{entry:L})},Y):O==="left"?a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(sc,{entry:L})}),a.jsx("div",{style:{gridColumn:"2"}})]},Y):a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(sc,{entry:L})})]},Y)})]}),a.jsx("button",{onClick:()=>x({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:L=>{L.currentTarget.style.textDecoration="underline"},onMouseLeave:L=>{L.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function qx({evals:s,onSave:o,onCancel:c}){const[u,x]=m.useState(""),[v,p]=m.useState(""),[b,g]=m.useState(""),[f,j]=m.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[y,k]=m.useState("unit"),[R,U]=m.useState(""),[L,Y]=m.useState([]),[O,Z]=m.useState(""),[W,F]=m.useState(""),ae=Math.max(0,...s.evals.map(G=>G.id))+1,re=G=>{k(G),G==="unit"&&(Y([]),U(""),Z(""),F(""))},q=()=>{const G=R.trim().toUpperCase();G&&!L.includes(G)&&Y([...L,G]),U("")},I=()=>{if(!u.trim()||!v.trim())return;const G={id:ae,name:u.trim(),prompt:v.trim(),expected_output:b.trim(),files:[],assertions:f.filter(X=>X.text.trim()),...y==="integration"?{testType:"integration",...L.length>0?{requiredCredentials:L}:{},...O||W?{requirements:{...O?{platform:O}:{},...W?{chromeProfile:W}:{}}}:{}}:{}};o({...s,evals:[...s.evals,G]})};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:a.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(G=>a.jsx("button",{onClick:()=>re(G),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:y===G?G==="unit"?"rgba(99,131,255,0.2)":"rgba(251,146,60,0.2)":"transparent",color:y===G?G==="unit"?"#6383ff":"#fb923c":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:G},G))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:u,onChange:G=>x(G.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:v,onChange:G=>p(G.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:b,onChange:G=>g(G.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),f.map((G,X)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:G.text,onChange:ne=>j(f.map((te,be)=>be===X?{...te,text:ne.target.value}:te)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&a.jsx("button",{onClick:()=>j(f.filter((ne,te)=>te!==X)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G.id)),a.jsx("button",{onClick:()=>j([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),y==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:L.map(G=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[G,a.jsx("button",{onClick:()=>Y(L.filter(X=>X!==G)),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:R,onChange:G=>U(G.target.value),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),q())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:q,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:O,onChange:G=>Z(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:W,onChange:G=>F(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:c,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:I,disabled:!u.trim()||!v.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function ay({evalCase:s,onUpdate:o}){var p,b;const[c,u]=m.useState(""),x=()=>{const g=c.trim().toUpperCase();g&&!(s.requiredCredentials??[]).includes(g)&&o({...s,requiredCredentials:[...s.requiredCredentials??[],g]}),u("")},v=g=>{const f=(s.requiredCredentials??[]).filter(j=>j!==g);o({...s,requiredCredentials:f.length>0?f:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(s.requiredCredentials??[]).map(g=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[g,a.jsx("button",{onClick:()=>v(g),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:c,onChange:g=>u(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),x())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:x,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((p=s.requirements)==null?void 0:p.platform)??"",onChange:g=>o({...s,requirements:{...s.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((b=s.requirements)==null?void 0:b.chromeProfile)??"",onChange:g=>o({...s,requirements:{...s.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Qt(s,o){return o==="free"?"Free":o==="subscription"&&s==null?"Subscription":s==null?"N/A":s>=1?`$${s.toFixed(2)}`:s===0?"$0.00":s>=.001?`$${s.toFixed(4)}`:`$${s.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function up(s,o){return s==null||o==null?"N/A":`${s.toLocaleString("en-US")} in / ${o.toLocaleString("en-US")} out`}function ny(s){return s==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function sy(s,o){let c="";if(o){const x=new Date(o);isNaN(x.getTime())||(c=x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[s,c].filter(Boolean).join(" · ")}function ry(s,o,c){const u=c===1?"test case":"test cases";if(s===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const x=Math.round(Math.abs(s)*o);if(x===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const v=s>0?"more":"fewer";return`Your skill passes ${x} ${v} assertions across ${c} ${u}`}function Vx(s,o){const c=u=>{const x=u/5*100;return isNaN(x)?0:Math.round(Math.min(100,Math.max(0,x)))};return{skill:c(s),baseline:c(o)}}function iy(s){return s==="skill"?{text:"Skill wins",isSkill:!0}:s==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function oy(s,o){const c=s+o,u=c*10,x=c*25,v=p=>p>=60?`${Math.round(p/60)}m`:`${p}s`;return`${v(u)}–${v(x)}`}const cy={anthropic:.01,openrouter:.01,ollama:0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function uy(s,o){if(!s)return null;const c=cy[s];if(c==null||c===0)return null;const u=c*o*.5,x=c*o*2;return`${Qt(u)}–${Qt(x)}`}function dy(){const{state:s,runCase:o,runAll:c,cancelCase:u,cancelAll:x,isReadOnly:v}=al(),{evals:p,caseRunStates:b,bulkRunActive:g,latestBenchmark:f,inlineResults:j}=s,{config:y}=ia(),k=(p==null?void 0:p.evals)??[],R=m.useMemo(()=>{for(const q of b.values())if(q.status==="running"||q.status==="queued")return!0;return!1},[b]),U=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="complete"||I.status==="error"||I.status==="cancelled")}).length,L=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="running"||I.status==="queued")}).length,Y=m.useRef(null),[O,Z]=m.useState(0);m.useEffect(()=>{if(R&&!Y.current&&(Y.current=Date.now()),!R){Y.current=null,Z(0);return}const q=setInterval(()=>{Y.current&&Z(Math.round((Date.now()-Y.current)/1e3))},1e3);return()=>clearInterval(q)},[R]);const W=k.reduce((q,I)=>q+I.assertions.length,0),F=k.length+W,ae=m.useMemo(()=>oy(k.length,W),[k.length,W]),re=m.useMemo(()=>uy((y==null?void 0:y.provider)??null,F),[y==null?void 0:y.provider,F]);return a.jsxs("div",{className:"p-5",children:[v&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),R&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[L," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[R&&a.jsxs("button",{onClick:x,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||R||v,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),a.jsx("button",{onClick:()=>c("benchmark"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>c("baseline"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!R&&k.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",ae]}),re&&a.jsxs("span",{children:["Est. cost: ",re]}),!re&&(y==null?void 0:y.provider)&&(y.provider==="claude-cli"||y.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Subscription"}),!re&&(y==null?void 0:y.provider)&&(y.provider==="ollama"||y.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),R&&k.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",U,"/",k.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(U/k.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${U/k.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",O>=60?`${Math.floor(O/60)}m ${O%60}s`:`${O}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",ae]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:k.map(q=>{const I=j.get(q.id),G=b.get(q.id),X=(G==null?void 0:G.status)??"idle",ne=f==null?void 0:f.cases.find(te=>te.eval_id===q.id);return a.jsx(xy,{name:q.name,evalId:q.id,result:I,caseCost:ne==null?void 0:ne.cost,caseBillingMode:ne==null?void 0:ne.billingMode,caseInputTokens:ne==null?void 0:ne.inputTokens,caseOutputTokens:ne==null?void 0:ne.outputTokens,caseStatus:X,runMode:(G==null?void 0:G.mode)??null,comparisonDetail:ne==null?void 0:ne.comparisonDetail,isReadOnly:v,onRun:te=>o(te,"benchmark"),onBaseline:te=>o(te,"baseline"),onCompare:te=>o(te,"comparison"),onCancel:te=>u(te)},q.id)})}),!R&&f&&f.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:ny(f.type)}),a.jsx("span",{className:"text-[20px] font-bold",style:{color:(f.overall_pass_rate??0)>=.8?"var(--green)":(f.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:f.overall_pass_rate!=null?`${Math.round(f.overall_pass_rate*100)}%`:"--"})]}),f.totalDurationMs!=null&&a.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(f.totalDurationMs/1e3).toFixed(1),"s",f.model&&` | Model: ${f.model}`,f.totalInputTokens!=null&&f.totalOutputTokens!=null&&` | Tokens: ${up(f.totalInputTokens,f.totalOutputTokens)}`,f.totalCost!=null&&` | Cost: ${Qt(f.totalCost)}`]}),f.overall_pass_rate>=.9999&&!f.comparison&&a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||v,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green, #22c55e)",color:"#fff",border:"none",cursor:"pointer",opacity:k.length===0?.5:1},children:"Run Final A/B Comparison"})]}),f.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const q=sy(f.model,f.timestamp);return q?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:q}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Gx,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Gx,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:f.comparison.delta>0?"var(--green)":f.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",f.comparison.delta>0?"+":"",(f.comparison.delta*100).toFixed(1),"%",f.verdict&&` | ${Kv(f.verdict)}`]}),(()=>{const q=f.cases.reduce((G,X)=>G+X.assertions.length,0),I=ry(f.comparison.delta,q,f.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:I})})()]})]})]})}const fy={benchmark:{label:"Skill",bg:"var(--accent-muted)",color:"var(--accent)"},baseline:{label:"Baseline",bg:"var(--surface-3)",color:"var(--text-tertiary)"},comparison:{label:"Compare",bg:"rgba(168,85,247,0.12)",color:"rgb(168,85,247)"}};function xy({name:s,evalId:o,result:c,caseCost:u,caseBillingMode:x,caseInputTokens:v,caseOutputTokens:p,caseStatus:b,runMode:g,comparisonDetail:f,isReadOnly:j,onRun:y,onBaseline:k,onCompare:R,onCancel:U}){const[L,Y]=m.useState(!1),O=b==="running"||b==="queued",Z=b==="complete"||b==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:O?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:O?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[b==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),b==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",o," ",s]}),g&&(O||Z)&&(()=>{const W=fy[g];return W?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:W.bg,color:W.color,padding:"1px 6px"},children:W.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[O?a.jsx("button",{onClick:()=>U(o),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>R(o),disabled:j,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>y(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>k(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),c&&c.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:c.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.passRate!=null?`${Math.round(c.passRate*100)}%`:c.status}),v!=null&&p!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:up(v,p)}),u!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Qt(u,x)}),b==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),c&&c.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:c.assertions.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:W.pass?"var(--green)":"var(--red)"},children:W.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:W.text})]},W.assertion_id))}),c.output&&a.jsx("button",{onClick:()=>Y(!L),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:L?"Hide output":"Show output"}),L&&c.output&&a.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:c.output})]}),f&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const W=Vx(f.skillContentScore,f.baselineContentScore),F=Vx(f.skillStructureScore,f.baselineStructureScore),ae=iy(f.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",W.skill,"% / Baseline ",W.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",F.skill,"% / Baseline ",F.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:ae.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:ae.text})]})})()})})}),c&&c.errorMessage&&a.jsx(py,{errorMessage:c.errorMessage,classifiedError:c.classifiedError})]})}const rc={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function py({errorMessage:s,classifiedError:o}){const[c,u]=m.useState(!1),x=(o==null?void 0:o.title)??"Error",v=o==null?void 0:o.hint,p=o?rc[o.category]??rc.unknown:rc.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid rgba(239,68,68,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:p}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:x}),a.jsx("button",{onClick:()=>u(!c),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:c?"Hide details":"Details"})]}),v&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:v}),c&&a.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:s})]})})}function Gx({label:s,value:o,color:c}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:s}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c},children:[Math.round(o*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${o*100}%`,background:c}})})]})}const Yx={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"rgba(52,211,153,0.06)",text:"rgba(52,211,153,0.6)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"rgba(248,113,113,0.06)",text:"rgba(248,113,113,0.6)"}};function my(){const{state:s,dispatch:o,runActivationTest:c,cancelActivation:u,generateActivationPrompts:x}=al(),{plugin:v,skill:p,activationPrompts:b,activationResults:g,activationSummary:f,activationRunning:j,activationError:y,activationStartedAt:k,activationClassifyingStatus:R,generatingPrompts:U,generatingPromptsError:L,activationHistory:Y}=s,[O,Z]=m.useState(b),[W,F]=m.useState(null),[ae,re]=m.useState(!1);m.useEffect(()=>{b&&b!==O&&Z(b)},[b]),m.useEffect(()=>{o({type:"SET_ACTIVATION_PROMPTS",prompts:O})},[O,o]),m.useEffect(()=>{fetch(`/api/skills/${v}/${p}/description`).then(T=>T.json()).then(T=>F(T.rawContent||T.description||null)).catch(()=>F(null))},[v,p]);function q(){c(O)}function I(){x(8)}const G=O.trim().split(`
62
+ `);re(Ll),I(Dr(p,Ll)),F(!1)}else nt==="error"&&(te(st.message||st.description||"Generation failed"),F(!1))}catch{}nt=""}}}catch(Je){Je.name!=="AbortError"&&te(Je.message)}finally{F(!1),be.current=null}},[O,he,p]),nl=m.useCallback(()=>{ae&&o({type:"SET_CONTENT",content:ae}),Y(!1),re(null),I([]),Z(""),X([])},[ae,o]),Xt=m.useCallback(()=>{Y(!1),re(null),I([]),Z(""),X([]),te(null)},[]),We=m.useCallback(()=>{var K;L?((K=be.current)==null||K.abort(),Xt()):(f&&o({type:"CLOSE_AI_EDIT"}),Y(!0))},[L,f,o,Xt]),kt=[{mode:"raw",icon:a.jsx(qv,{}),label:"Editor"},{mode:"split",icon:a.jsx(Vv,{}),label:"Split"},{mode:"preview",icon:a.jsx(Gv,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Ot,tabIndex:-1,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:kt.map(({mode:K,icon:Be,label:at})=>a.jsxs("button",{onClick:()=>y(K),title:at,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:j===K?"var(--surface-4)":"transparent",color:j===K?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:j===K?600:400,border:"none",cursor:"pointer"},children:[Be,a.jsx("span",{style:{letterSpacing:"0.01em"},children:at})]},K))}),D?u?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{f?o({type:"CLOSE_AI_EDIT"}):(L&&Xt(),o({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:f?600:400,border:"none",cursor:"pointer",color:f?"#a855f7":"var(--text-tertiary)",background:f?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(Yv,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:We,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:L?600:400,border:"none",cursor:"pointer",color:L?"#a855f7":"var(--text-tertiary)",background:L?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(ac,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),b&&a.jsx("button",{onClick:()=>o({type:"SET_CONTENT",content:s.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:Qe,disabled:!b||k,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),x&&v&&a.jsx(Ov,{files:T,activeFile:N,onSelect:ce,onRefresh:S}),!D&&a.jsx(Uv,{file:w,loading:ee,error:B,viewMode:j,plugin:x??void 0,skill:v??void 0,onSaved:()=>{ue(N),S()},onDirtyChange:le}),D&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:j==="raw"||j==="preview"?"1fr":"1fr 1fr"},children:[j!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:j==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:U,value:p,onChange:K=>{u||o({type:"SET_CONTENT",content:K.target.value})},onKeyDown:Ot,spellCheck:!1,readOnly:u,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:u?.7:1}})}),j!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(pt||se||Dt)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[pt&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:pt}),se&&a.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",se]})]}),Dt&&a.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Dt})]}),ye.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.map(K=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:K},K))}),Re.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map(K=>a.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:K},K))]})}),ut.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:ut.map(([K,Be],at)=>{const Je=Array.isArray(Be)?Be.join(", "):typeof Be=="object"?Object.entries(Be).map(([Ml,Bt])=>`${Ml}: ${Array.isArray(Bt)?Bt.join(", "):Bt}`).join(" | "):Be;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:at>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:K}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Je})]},K)})}),(pt||Dt||ye.length>0||Re.length>0||ut.length>0)&&me&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),me&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:zr(me)}})]})})]}),D&&f&&a.jsx(Rv,{}),D&&L&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:O,onChange:K=>Z(K.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:W,className:"flex-1 px-3 py-2 rounded-lg text-[12px] resize-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none",opacity:W?.5:1},onKeyDown:K=>{K.key==="Enter"&&(K.ctrlKey||K.metaKey)&&O.trim()&&!W&&(K.preventDefault(),mt())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[W?a.jsx("button",{onClick:()=>{var K;(K=be.current)==null||K.abort(),F(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:mt,disabled:!O.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Xt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),W&&G.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(fs,{entries:G,isRunning:!0})}),ne&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[ne,a.jsx("button",{onClick:mt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:q.map((K,Be)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:K.type==="added"?"rgba(34,197,94,0.1)":K.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:K.type==="added"?"var(--green)":K.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:K.type==="added"?"3px solid var(--green)":K.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:K.type==="added"?"+":K.type==="removed"?"-":" "}),K.content]},Be))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:nl,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:Xt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),D&&g!==null&&x&&v&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Nv,{plugin:x,skill:v,skillContent:p,onApplied:K=>{o({type:"SET_CONTENT",content:K}),o({type:"CONTENT_SAVED"}),o({type:"CLOSE_IMPROVE"})}})})]})}function xn(s){return s.testType==="integration"?"integration":"unit"}function pn(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function np(s){const o=new Date(s);return o.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function sp(s){return s==null?"--":s>=1e3?`${(s/1e3).toFixed(1)}s`:`${s}ms`}const Qv=new Set(["benchmark","comparison","baseline"]);function Ux(s,o,c,u){return s.map(({rate:x,idx:v,total:p})=>{const b=u+v/(p-1)*(o-u*2),g=u+(c-u*2)-x*(c-u*2);return`${b},${g}`})}function rp({entries:s}){const o=s.filter(y=>Qv.has(y.type)).slice().reverse(),c=o.map((y,k,R)=>({rate:y.pass_rate,idx:k,total:R.length})).filter((y,k)=>{const R=o[k].type;return R==="benchmark"||R==="comparison"}),u=o.flatMap((y,k)=>y.type==="baseline"?[{rate:y.pass_rate,idx:k,total:o.length}]:y.type==="comparison"&&y.baselinePassRate!=null?[{rate:y.baselinePassRate,idx:k,total:o.length}]:[]);if(c.length<2&&u.length<2)return null;const x=80,v=24,p=2,b=c.length>=2?Ux(c,x,v,p):[],g=u.length>=2?Ux(u,x,v,p):[],f=b[b.length-1],j=g[g.length-1];return a.jsxs("svg",{width:x,height:v,style:{display:"block",flexShrink:0},children:[g.length>0&&a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),b.length>0&&a.jsx("polyline",{points:b.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),j&&a.jsx("circle",{cx:parseFloat(j.split(",")[0]),cy:parseFloat(j.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&a.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function ip(s,o,c){const u=isNaN(o)?0:o,x=[],v=[],p=[];if((s==="PASS"||s==="EFFECTIVE")&&u>=.7){const f=x.length>0?` Met criteria: ${x.map(j=>j.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): evaluation met expectations.${f}`}}if(s==="FAIL"||s==="DEGRADING"){const f=v.length>0?` Failed criteria: ${v.map(y=>y.criterion).join(", ")}.`:"",j=[...v.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...p.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return j.length===0&&j.push("Review prompt instructions and add more specific guidance"),{explanation:`${s} (score ${u.toFixed(2)}): evaluation did not meet expectations.${f}`,recommendations:j}}if(s==="INEFFECTIVE"){if(u<.2){const j=[...v.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${s} (score ${u.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:j}}const f=[...v.map(j=>`Rework "${j.criterion}" — currently at ${j.score.toFixed(2)}`),...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push("Consider restructuring your prompt approach"),{explanation:`${s} (score ${u.toFixed(2)}): below expectations but showing some capability.`,recommendations:f}}if(s==="MARGINAL"){const f=[...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`),...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push(x.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${s} (score ${u.toFixed(2)}): moderate improvement detected.`,recommendations:f}}if(s==="EMERGING"){const f=[...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`),...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push(x.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${s} (score ${u.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:f}}const b=x.length>0?` Passing: ${x.map(f=>f.criterion).join(", ")}.`:"",g=p.length>0?` Needs improvement: ${p.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): mixed results.${b}${g}`}}const op={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function Xv(s){return Object.hasOwn(op,s)}function Kv(s){return Xv(s)?op[s]:s}function Zv(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=m.useState([]),[v,p]=m.useState([]),[b,g]=m.useState(!0),[f,j]=m.useState(null),[y,k]=m.useState(new Set),[R,U]=m.useState({}),[L,Y]=m.useState(null),[O,Z]=m.useState(""),[W,F]=m.useState(!1),[ae,re]=m.useState(""),[q,I]=m.useState(""),G=m.useCallback(async()=>{g(!0),j(null);try{const[T,N]=await Promise.all([ge.getCredentials(o,c),ge.getParams(o,c)]);x(T.credentials),p(N.params)}catch(T){j(T instanceof Error?T.message:"Failed to load parameters"),x([]),p([])}finally{g(!1)}},[o,c]);m.useEffect(()=>{G()},[G]);const X=m.useCallback(async(T,N)=>{F(!0),j(null);try{await ge.setCredential(o,c,T,N),Y(null),Z(""),await G()}catch(w){j(w instanceof Error?w.message:`Failed to save ${T}`)}finally{F(!1)}},[o,c,G]),ne=m.useCallback(async()=>{const T=ae.trim().toUpperCase(),N=q.trim();if(!(!T||!N)){F(!0),j(null);try{await ge.setCredential(o,c,T,N),re(""),I(""),await G()}catch(w){j(w instanceof Error?w.message:`Failed to add ${T}`)}finally{F(!1)}}},[o,c,ae,q,G]),te=m.useCallback(async T=>{if(y.has(T)){k(N=>{const w=new Set(N);return w.delete(T),w}),U(N=>{const w={...N};return delete w[T],w});return}try{const w=(await ge.getParamsRevealed(o,c,T)).params.find(ee=>ee.name===T);w!=null&&w.value&&(U(ee=>({...ee,[T]:w.value})),k(ee=>new Set(ee).add(T)))}catch{}},[o,c,y]),be=new Set(u.map(T=>T.name)),he=[...u.map(T=>{const N=v.find(w=>w.name===T.name);return{name:T.name,status:T.status,maskedValue:(N==null?void 0:N.maskedValue)??""}}),...v.filter(T=>!be.has(T.name)).map(T=>({name:T.name,status:T.status,maskedValue:T.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),f&&a.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"rgba(239,68,68,0.1)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.2)"},role:"alert",children:f}),b&&he.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!b&&he.length===0&&!f&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),he.map(T=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:T.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:T.status==="ready"?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.15)",color:T.status==="ready"?"#22c55e":"#ef4444"},children:T.status}),(T.maskedValue||T.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[y.has(T.name)?R[T.name]??T.maskedValue:T.maskedValue||"***",a.jsx("button",{onClick:()=>te(T.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${y.has(T.name)?"Hide":"Reveal"} value for ${T.name}`,children:y.has(T.name)?"hide":"show"})]}),L===T.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:O,onChange:N=>Z(N.target.value),onKeyDown:N=>{N.key==="Enter"&&O.trim()&&X(T.name,O)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${T.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>X(T.name,O),disabled:W||!O.trim(),className:"text-[10px] font-medium",style:{color:"#22c55e",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{Y(null),Z("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{Y(T.name),Z("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},T.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:ae,onChange:T=>re(T.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:q,onChange:T=>I(T.target.value),onKeyDown:T=>{T.key==="Enter"&&ae.trim()&&q.trim()&&ne()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:ne,disabled:W||!ae.trim()||!q.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:W?"not-allowed":"pointer"},children:"Add"})]})]})]})}function Jv(s,o,c){const[u,x]=m.useState(null),[v,p]=m.useState(!1),b=m.useRef("");m.useEffect(()=>{const f=`${s}/${o}/${c}`;b.current!==f&&(b.current=f,p(!0),ge.getCaseHistory(s,o,c).then(j=>x(j)).catch(()=>x([])).finally(()=>p(!1)))},[s,o,c]);const g=m.useCallback(()=>{p(!0),b.current="",ge.getCaseHistory(s,o,c).then(f=>x(f)).catch(()=>x([])).finally(()=>p(!1))},[s,o,c]);return{entries:u,loading:v,refetch:g}}function Wv(s,o,c){const u={flaky:!1,nonDiscriminating:!1,regression:!1};if(!c||c.length===0)return u;const v=c.slice(0,10).map(g=>g.assertions.find(f=>f.id===s)).filter(Boolean);if(v.length>=2){const f=v.filter(j=>j.pass).length/v.length;f>=.3&&f<=.7&&(u.flaky=!0)}const p=c.find(g=>g.type==="benchmark"),b=c.find(g=>g.type==="baseline");if(p&&b){const g=p.assertions.find(j=>j.id===s),f=b.assertions.find(j=>j.id===s);g!=null&&g.pass&&(f!=null&&f.pass)&&(u.nonDiscriminating=!0)}if(o&&!o.pass&&c.length>=1){const f=c[0].assertions.find(j=>j.id===s);f!=null&&f.pass&&(u.regression=!0)}return u}function Fv(){var ee;const{state:s,dispatch:o,saveEvals:c,runCase:u,runAll:x,cancelCase:v,cancelAll:p,generateEvals:b,isReadOnly:g}=al(),{evals:f,evalsError:j,selectedCaseId:y,inlineResults:k,caseRunStates:R,generateEvalsLoading:U,generateEvalsProgress:L,generateEvalsError:Y}=s,O=m.useMemo(()=>{for(const B of R.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[R]),[Z,W]=m.useState(!1),[F,ae]=m.useState("all"),re={skill_name:s.skill,evals:[]},q=f??re,I=q.evals,G=m.useMemo(()=>F==="all"?I:I.filter(B=>xn(B)===F),[F,I]),X=G.find(B=>B.id===y)??null;m.useEffect(()=>{y!==null&&!G.find(B=>B.id===y)&&o({type:"SELECT_CASE",caseId:G.length>0?G[0].id:null})},[G,y,o]);const[ne,te]=m.useState([]),be=m.useMemo(()=>I.some(B=>xn(B)==="integration"),[I]);m.useEffect(()=>{be&&ge.getCredentials(s.plugin,s.skill).then(B=>te(B.credentials)).catch(()=>te([]))},[s.plugin,s.skill,be]);const he=m.useMemo(()=>new Set(ne.filter(B=>B.status==="missing").map(B=>B.name)),[ne]),[T,N]=m.useState(!1),w=m.useCallback(B=>{N(!1),b(B?{testType:B}:void 0)},[b]);return!f||I.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:j?"var(--error-muted, #3f1a1a)":"var(--accent-muted)"},children:j?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--error, #f87171)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:j?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--error, #f87171)"},children:"Invalid evals.json"}),a.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:j}),a.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>W(!0),disabled:g,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>w("unit"),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:U?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>N(!T),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),T&&a.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:a.jsx("button",{onClick:()=>w("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),U&&L.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(fs,{entries:L,isRunning:!0})}),Y&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(ds,{error:Y,onRetry:()=>w()})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",G.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:O?a.jsx("button",{onClick:p,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel All"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>x("benchmark"),disabled:G.length===0||g,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>x("comparison"),disabled:G.length===0||g,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(B=>a.jsx("button",{onClick:()=>ae(B),style:{padding:"2px 8px",fontSize:10,fontWeight:F===B?600:400,background:F===B?"var(--accent-muted)":"transparent",color:F===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:B==="all"?`All (${I.length})`:B==="unit"?`Unit (${I.filter(ue=>xn(ue)==="unit").length})`:`Integration (${I.filter(ue=>xn(ue)==="integration").length})`},B))}),a.jsxs("div",{className:"py-1",children:[G.length===0&&I.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",F==="all"?"":F+" ","tests yet"]}),G.map(B=>{var P;const ue=k.get(B.id),S=y===B.id,D=xn(B);return a.jsxs("button",{onClick:()=>o({type:"SELECT_CASE",caseId:B.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:S?"var(--accent-muted)":"transparent",borderLeft:S?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:le=>{S||(le.currentTarget.style.background="var(--surface-2)")},onMouseLeave:le=>{S||(le.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:S?"var(--text-primary)":"var(--text-secondary)"},children:["#",B.id," ",B.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:D==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:D==="unit"?"#6383ff":"#fb923c",whiteSpace:"nowrap"},children:D==="unit"?"U":"I"}),D==="integration"&&((P=B.requiredCredentials)==null?void 0:P.some(le=>he.has(le)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(cp,{result:ue})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[B.assertions.length," assertion",B.assertions.length!==1?"s":"",(ue==null?void 0:ue.passRate)!=null&&a.jsx(ey,{passRate:ue.passRate})]})]},B.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!g&&a.jsx("button",{onClick:()=>W(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.borderColor="var(--accent)",B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-default)",B.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),be&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Zv,{})})]}),a.jsx("div",{className:"overflow-auto",children:X?a.jsx(Iv,{evalCase:X,result:k.get(X.id),evals:f,caseStatus:((ee=R.get(X.id))==null?void 0:ee.status)??"idle",onSaveEvals:c,onRun:B=>u(B,"benchmark"),onCompare:B=>u(B,"comparison"),onCancel:B=>v(B),onImprove:B=>o({type:"OPEN_IMPROVE",evalId:B})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]})}function Iv({evalCase:s,result:o,evals:c,caseStatus:u,onSaveEvals:x,onRun:v,onCompare:p,onCancel:b,onImprove:g}){const{state:f,isReadOnly:j}=al(),{plugin:y,skill:k}=f,{entries:R,loading:U}=Jv(y,k,s.id),[L,Y]=m.useState(!1),[O,Z]=m.useState(s.prompt),[W,F]=m.useState(!1),[ae,re]=m.useState(s.expected_output);m.useState(()=>{Z(s.prompt),re(s.expected_output)});const q=m.useCallback(B=>{x({...c,evals:c.evals.map(ue=>ue.id===B.id?B:ue)})},[c,x]),I=m.useCallback(()=>{q({...s,prompt:O}),Y(!1)},[s,O,q]),G=m.useCallback(()=>{q({...s,expected_output:ae}),F(!1)},[s,ae,q]),X=m.useCallback(()=>{q({...s,assertions:[...s.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[s,q]),ne=m.useCallback((B,ue)=>{q({...s,assertions:s.assertions.map(S=>S.id===B?{...S,text:ue}:S)})},[s,q]),te=m.useCallback(B=>{q({...s,assertions:s.assertions.filter(ue=>ue.id!==B)})},[s,q]),be=m.useCallback(()=>{confirm("Delete this test case?")&&x({...c,evals:c.evals.filter(B=>B.id!==s.id)})},[c,s.id,x]),he=o&&o.assertions.length>0&&o.assertions.every(B=>B.pass),T=o&&o.assertions.some(B=>!B.pass),N=xn(s),w=s.requiredCredentials??[],ee=N==="integration"&&w.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",s.id," ",s.name]}),j?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c"},children:N==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((N==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ue,requirements:S,cleanup:D,...P}=s;q({...P,testType:"unit"})}else q({...s,testType:"integration"})},title:`Click to switch to ${N==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c",border:"none",cursor:"pointer"},children:N==="unit"?"Unit":"Integration"}),a.jsx(cp,{result:o})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"||u==="queued"?a.jsxs("button",{onClick:()=>b(s.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>v(s.id),disabled:j,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>p(s.id),disabled:j,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),T&&!j&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:()=>g(s.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!j&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:be,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),j&&N==="integration"&&a.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid rgba(99,131,255,0.2)"},children:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),he&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid rgba(52, 211, 153, 0.2)"},children:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ee&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"rgba(251,146,60,0.1)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:w.map(B=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:B},B))})]}),!j&&N==="integration"&&a.jsx(ay,{evalCase:s,onUpdate:q}),a.jsx(Cr,{title:"Prompt",children:L?a.jsxs("div",{children:[a.jsx("textarea",{value:O,onChange:B=>Z(B.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:I,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{Z(s.prompt),Y(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||Y(!0)},onMouseEnter:B=>{j||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:j?"No prompt":"Click to edit prompt..."})})}),a.jsx(Cr,{title:"Expected Output",children:W?a.jsxs("div",{children:[a.jsx("textarea",{value:ae,onChange:B=>re(B.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:G,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{re(s.expected_output),F(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||F(!0)},onMouseEnter:B=>{j||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:j?"No expected output":"Click to edit expected output..."})})}),a.jsx(Cr,{title:`Assertions (${s.assertions.length})`,action:j?void 0:a.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:s.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:s.assertions.map(B=>{const ue=o==null?void 0:o.assertions.find(D=>D.assertion_id===B.id),S=Wv(B.id,ue,R);return a.jsx(Pv,{assertion:B,result:ue,badges:S,isReadOnly:j,onUpdate:D=>ne(B.id,D),onDelete:()=>te(B.id)},B.id)})})}),(o==null?void 0:o.output)&&a.jsx(ty,{output:o.output,durationMs:o.durationMs,tokens:o.tokens}),o&&o.passRate!=null&&o.passRate<.2&&(()=>{const B=ip("INEFFECTIVE",o.passRate);return B.recommendations&&B.recommendations.length>0?a.jsx(Cr,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(251,146,60,0.08)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:B.recommendations.map((ue,S)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"#fb923c",fontWeight:600,flexShrink:0},children:"•"}),ue]},S))})]})}):null})(),a.jsx(ly,{evalId:s.id,sharedEntries:R,sharedLoading:U})]},s.id)}function Pv({assertion:s,result:o,badges:c,isReadOnly:u,onUpdate:x,onDelete:v}){const[p,b]=m.useState(!1),[g,f]=m.useState(s.text),[j,y]=m.useState(!1),k=()=>{x(g),b(!1)};return a.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsxs("div",{className:"flex items-start gap-2",children:[o?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(c==null?void 0:c.regression)&&a.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:s.id}),(c==null?void 0:c.flaky)&&a.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"rgba(234, 179, 8, 0.15)",color:"#ca8a04",whiteSpace:"nowrap"},children:"Flaky"}),(c==null?void 0:c.nonDiscriminating)&&a.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),p?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:g,onChange:R=>f(R.target.value),onKeyDown:R=>{R.key==="Enter"&&k(),R.key==="Escape"&&b(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:k,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:u?"default":"pointer"},onClick:()=>{u||(f(s.text),b(!0))},children:s.text}),(o==null?void 0:o.reasoning)&&a.jsx("button",{onClick:()=>y(!j),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:j?"Hide reasoning":"Show reasoning"}),j&&(o==null?void 0:o.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:o.reasoning})]}),!u&&a.jsx("button",{onClick:v,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.color="var(--red)",R.currentTarget.style.opacity="1"},onMouseLeave:R=>{R.currentTarget.style.color="var(--text-tertiary)",R.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Cr({title:s,action:o,children:c}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),o]}),c]})}function cp({result:s}){const[o,c]=m.useState(!1);if(!s||s.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=s.status==="pass",x=s.passRate??0,p=ip(u?"PASS":"FAIL",x);return a.jsxs("span",{className:"pill text-[10px]",style:{background:u?"var(--green-muted)":"var(--red-muted)",color:u?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),"aria-describedby":o?"verdict-tooltip":void 0,children:[s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status,o&&a.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:p.explanation})]})}function ey({passRate:s}){const o=Math.round(s*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${o}%`,background:o>=80?"var(--green)":o>=50?"var(--yellow)":"var(--red)"}})})})}function ty({output:s,durationMs:o,tokens:c}){const[u,x]=m.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>x(!u),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:u?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",o!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(o/1e3).toFixed(1),"s)"]}),c!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",c," tokens)"]})]}),u&&a.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})]})}function nc(s){return s==="baseline"?"right":s==="comparison"?"full":"left"}function sc({entry:s}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:np(s.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:s.type==="benchmark"?"rgba(99,131,255,0.15)":s.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:s.type==="benchmark"?"#6383ff":s.type==="comparison"?"var(--purple)":"#fb923c"},children:s.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(s.pass_rate)},children:[Math.round(s.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[s.durationMs!=null&&a.jsx("span",{children:sp(s.durationMs)}),s.tokens!=null&&a.jsxs("span",{children:[s.tokens>=1e3?`${(s.tokens/1e3).toFixed(1)}k`:s.tokens," tok"]})]}),s.type==="comparison"&&s.baselinePassRate!=null&&(()=>{const o=s.pass_rate-s.baselinePassRate,c=o>.001?"skill":o<-.001?"baseline":"tie",u=o>0?"+":"",x=c==="skill"?"var(--green)":c==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:o>=0?"var(--green)":"var(--red)"},children:[u,(o*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"rgba(0,0,0,0.2)",color:x},children:c})]})})(),a.jsx("div",{className:"space-y-0.5",children:s.assertions.map(o=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:o.text})]},o.id))})]})}function ly({evalId:s,sharedEntries:o,sharedLoading:c}){const{state:u,dispatch:x}=al(),{plugin:v,skill:p}=u,[b,g]=m.useState(!0),f=o??null,j=c??!1,y=m.useCallback(()=>{g(L=>!L)},[]),k=f?f.slice(0,10):[],R=k.some(L=>{const Y=nc(L.type);return Y==="left"||Y==="full"}),U=k.some(L=>{const Y=nc(L.type);return Y==="right"||Y==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:y,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",f&&f.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),b&&a.jsx("div",{className:"animate-fade-in",children:j?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!f||f.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[k.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(rp,{entries:k})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!R&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!U&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),k.map((L,Y)=>{const O=nc(L.type);return O==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(sc,{entry:L})},Y):O==="left"?a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(sc,{entry:L})}),a.jsx("div",{style:{gridColumn:"2"}})]},Y):a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(sc,{entry:L})})]},Y)})]}),a.jsx("button",{onClick:()=>x({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:L=>{L.currentTarget.style.textDecoration="underline"},onMouseLeave:L=>{L.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function qx({evals:s,onSave:o,onCancel:c}){const[u,x]=m.useState(""),[v,p]=m.useState(""),[b,g]=m.useState(""),[f,j]=m.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[y,k]=m.useState("unit"),[R,U]=m.useState(""),[L,Y]=m.useState([]),[O,Z]=m.useState(""),[W,F]=m.useState(""),ae=Math.max(0,...s.evals.map(G=>G.id))+1,re=G=>{k(G),G==="unit"&&(Y([]),U(""),Z(""),F(""))},q=()=>{const G=R.trim().toUpperCase();G&&!L.includes(G)&&Y([...L,G]),U("")},I=()=>{if(!u.trim()||!v.trim())return;const G={id:ae,name:u.trim(),prompt:v.trim(),expected_output:b.trim(),files:[],assertions:f.filter(X=>X.text.trim()),...y==="integration"?{testType:"integration",...L.length>0?{requiredCredentials:L}:{},...O||W?{requirements:{...O?{platform:O}:{},...W?{chromeProfile:W}:{}}}:{}}:{}};o({...s,evals:[...s.evals,G]})};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:a.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(G=>a.jsx("button",{onClick:()=>re(G),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:y===G?G==="unit"?"rgba(99,131,255,0.2)":"rgba(251,146,60,0.2)":"transparent",color:y===G?G==="unit"?"#6383ff":"#fb923c":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:G},G))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:u,onChange:G=>x(G.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:v,onChange:G=>p(G.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:b,onChange:G=>g(G.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),f.map((G,X)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:G.text,onChange:ne=>j(f.map((te,be)=>be===X?{...te,text:ne.target.value}:te)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&a.jsx("button",{onClick:()=>j(f.filter((ne,te)=>te!==X)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G.id)),a.jsx("button",{onClick:()=>j([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),y==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:L.map(G=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[G,a.jsx("button",{onClick:()=>Y(L.filter(X=>X!==G)),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:R,onChange:G=>U(G.target.value),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),q())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:q,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:O,onChange:G=>Z(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:W,onChange:G=>F(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:c,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:I,disabled:!u.trim()||!v.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function ay({evalCase:s,onUpdate:o}){var p,b;const[c,u]=m.useState(""),x=()=>{const g=c.trim().toUpperCase();g&&!(s.requiredCredentials??[]).includes(g)&&o({...s,requiredCredentials:[...s.requiredCredentials??[],g]}),u("")},v=g=>{const f=(s.requiredCredentials??[]).filter(j=>j!==g);o({...s,requiredCredentials:f.length>0?f:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(s.requiredCredentials??[]).map(g=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[g,a.jsx("button",{onClick:()=>v(g),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:c,onChange:g=>u(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),x())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:x,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((p=s.requirements)==null?void 0:p.platform)??"",onChange:g=>o({...s,requirements:{...s.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((b=s.requirements)==null?void 0:b.chromeProfile)??"",onChange:g=>o({...s,requirements:{...s.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Qt(s,o){return o==="free"?"Free":o==="subscription"&&s==null?"Subscription":s==null?"N/A":s>=1?`$${s.toFixed(2)}`:s===0?"$0.00":s>=.001?`$${s.toFixed(4)}`:`$${s.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function up(s,o){return s==null||o==null?"N/A":`${s.toLocaleString("en-US")} in / ${o.toLocaleString("en-US")} out`}function ny(s){return s==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function sy(s,o){let c="";if(o){const x=new Date(o);isNaN(x.getTime())||(c=x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[s,c].filter(Boolean).join(" · ")}function ry(s,o,c){const u=c===1?"test case":"test cases";if(s===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const x=Math.round(Math.abs(s)*o);if(x===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const v=s>0?"more":"fewer";return`Your skill passes ${x} ${v} assertions across ${c} ${u}`}function Vx(s,o){const c=u=>{const x=u/5*100;return isFinite(x)?Math.round(Math.min(100,Math.max(0,x))):0};return{skill:c(s),baseline:c(o)}}function iy(s){return s==="skill"?{text:"Skill wins",isSkill:!0}:s==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function oy(s,o){const c=s+o,u=c*10,x=c*25,v=p=>p>=60?`${Math.round(p/60)}m`:`${p}s`;return`${v(u)}–${v(x)}`}const cy={anthropic:.01,openrouter:.01,ollama:0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function uy(s,o){if(!s)return null;const c=cy[s];if(c==null||c===0)return null;const u=c*o*.5,x=c*o*2;return`${Qt(u)}–${Qt(x)}`}function dy(){const{state:s,runCase:o,runAll:c,cancelCase:u,cancelAll:x,isReadOnly:v}=al(),{evals:p,caseRunStates:b,bulkRunActive:g,latestBenchmark:f,inlineResults:j}=s,{config:y}=ia(),k=(p==null?void 0:p.evals)??[],R=m.useMemo(()=>{for(const q of b.values())if(q.status==="running"||q.status==="queued")return!0;return!1},[b]),U=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="complete"||I.status==="error"||I.status==="cancelled")}).length,L=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="running"||I.status==="queued")}).length,Y=m.useRef(null),[O,Z]=m.useState(0);m.useEffect(()=>{if(R&&!Y.current&&(Y.current=Date.now()),!R){Y.current=null,Z(0);return}const q=setInterval(()=>{Y.current&&Z(Math.round((Date.now()-Y.current)/1e3))},1e3);return()=>clearInterval(q)},[R]);const W=k.reduce((q,I)=>q+I.assertions.length,0),F=k.length+W,ae=m.useMemo(()=>oy(k.length,W),[k.length,W]),re=m.useMemo(()=>uy((y==null?void 0:y.provider)??null,F),[y==null?void 0:y.provider,F]);return a.jsxs("div",{className:"p-5",children:[v&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),R&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[L," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[R&&a.jsxs("button",{onClick:x,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||R||v,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),a.jsx("button",{onClick:()=>c("benchmark"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>c("baseline"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!R&&k.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",ae]}),re&&a.jsxs("span",{children:["Est. cost: ",re]}),!re&&(y==null?void 0:y.provider)&&(y.provider==="claude-cli"||y.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Subscription"}),!re&&(y==null?void 0:y.provider)&&(y.provider==="ollama"||y.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),R&&k.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",U,"/",k.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(U/k.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${U/k.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",O>=60?`${Math.floor(O/60)}m ${O%60}s`:`${O}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",ae]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:k.map(q=>{const I=j.get(q.id),G=b.get(q.id),X=(G==null?void 0:G.status)??"idle",ne=f==null?void 0:f.cases.find(te=>te.eval_id===q.id);return a.jsx(xy,{name:q.name,evalId:q.id,result:I,caseCost:ne==null?void 0:ne.cost,caseBillingMode:ne==null?void 0:ne.billingMode,caseInputTokens:ne==null?void 0:ne.inputTokens,caseOutputTokens:ne==null?void 0:ne.outputTokens,caseStatus:X,runMode:(G==null?void 0:G.mode)??null,comparisonDetail:ne==null?void 0:ne.comparisonDetail,isReadOnly:v,onRun:te=>o(te,"benchmark"),onBaseline:te=>o(te,"baseline"),onCompare:te=>o(te,"comparison"),onCancel:te=>u(te)},q.id)})}),!R&&f&&f.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:ny(f.type)}),a.jsx("span",{className:"text-[20px] font-bold",style:{color:(f.overall_pass_rate??0)>=.8?"var(--green)":(f.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:f.overall_pass_rate!=null?`${Math.round(f.overall_pass_rate*100)}%`:"--"})]}),f.totalDurationMs!=null&&a.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(f.totalDurationMs/1e3).toFixed(1),"s",f.model&&` | Model: ${f.model}`,f.totalInputTokens!=null&&f.totalOutputTokens!=null&&` | Tokens: ${up(f.totalInputTokens,f.totalOutputTokens)}`,f.totalCost!=null&&` | Cost: ${Qt(f.totalCost)}`]}),f.overall_pass_rate>=.9999&&!f.comparison&&a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||v,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green, #22c55e)",color:"#fff",border:"none",cursor:"pointer",opacity:k.length===0?.5:1},children:"Run Final A/B Comparison"})]}),f.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const q=sy(f.model,f.timestamp);return q?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:q}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Gx,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Gx,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:f.comparison.delta>0?"var(--green)":f.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",f.comparison.delta>0?"+":"",(f.comparison.delta*100).toFixed(1),"%",f.verdict&&` | ${Kv(f.verdict)}`]}),(()=>{const q=f.cases.reduce((G,X)=>G+X.assertions.length,0),I=ry(f.comparison.delta,q,f.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:I})})()]})]})]})}const fy={benchmark:{label:"Skill",bg:"var(--accent-muted)",color:"var(--accent)"},baseline:{label:"Baseline",bg:"var(--surface-3)",color:"var(--text-tertiary)"},comparison:{label:"Compare",bg:"rgba(168,85,247,0.12)",color:"rgb(168,85,247)"}};function xy({name:s,evalId:o,result:c,caseCost:u,caseBillingMode:x,caseInputTokens:v,caseOutputTokens:p,caseStatus:b,runMode:g,comparisonDetail:f,isReadOnly:j,onRun:y,onBaseline:k,onCompare:R,onCancel:U}){const[L,Y]=m.useState(!1),O=b==="running"||b==="queued",Z=b==="complete"||b==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:O?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:O?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[b==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),b==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",o," ",s]}),g&&(O||Z)&&(()=>{const W=fy[g];return W?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:W.bg,color:W.color,padding:"1px 6px"},children:W.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[O?a.jsx("button",{onClick:()=>U(o),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>R(o),disabled:j,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>y(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>k(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),c&&c.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:c.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.passRate!=null?`${Math.round(c.passRate*100)}%`:c.status}),v!=null&&p!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:up(v,p)}),u!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Qt(u,x)}),b==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),c&&c.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:c.assertions.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:W.pass?"var(--green)":"var(--red)"},children:W.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:W.text})]},W.assertion_id))}),c.output&&a.jsx("button",{onClick:()=>Y(!L),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:L?"Hide output":"Show output"}),L&&c.output&&a.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:c.output})]}),f&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const W=Vx(f.skillContentScore,f.baselineContentScore),F=Vx(f.skillStructureScore,f.baselineStructureScore),ae=iy(f.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",W.skill,"% / Baseline ",W.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",F.skill,"% / Baseline ",F.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:ae.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:ae.text})]})})()})})}),c&&c.errorMessage&&a.jsx(py,{errorMessage:c.errorMessage,classifiedError:c.classifiedError})]})}const rc={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function py({errorMessage:s,classifiedError:o}){const[c,u]=m.useState(!1),x=(o==null?void 0:o.title)??"Error",v=o==null?void 0:o.hint,p=o?rc[o.category]??rc.unknown:rc.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid rgba(239,68,68,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:p}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:x}),a.jsx("button",{onClick:()=>u(!c),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:c?"Hide details":"Details"})]}),v&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:v}),c&&a.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:s})]})})}function Gx({label:s,value:o,color:c}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:s}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c},children:[Math.round(o*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${o*100}%`,background:c}})})]})}const Yx={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"rgba(52,211,153,0.06)",text:"rgba(52,211,153,0.6)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"rgba(248,113,113,0.06)",text:"rgba(248,113,113,0.6)"}};function my(){const{state:s,dispatch:o,runActivationTest:c,cancelActivation:u,generateActivationPrompts:x}=al(),{plugin:v,skill:p,activationPrompts:b,activationResults:g,activationSummary:f,activationRunning:j,activationError:y,activationStartedAt:k,activationClassifyingStatus:R,generatingPrompts:U,generatingPromptsError:L,activationHistory:Y}=s,[O,Z]=m.useState(b),[W,F]=m.useState(null),[ae,re]=m.useState(!1);m.useEffect(()=>{b&&b!==O&&Z(b)},[b]),m.useEffect(()=>{o({type:"SET_ACTIVATION_PROMPTS",prompts:O})},[O,o]),m.useEffect(()=>{fetch(`/api/skills/${v}/${p}/description`).then(T=>T.json()).then(T=>F(T.rawContent||T.description||null)).catch(()=>F(null))},[v,p]);function q(){c(O)}function I(){x(8)}const G=O.trim().split(`
63
63
  `).filter(Boolean).length,X=g.filter(T=>T.classification==="TP"||T.classification==="TN"),ne=g.filter(T=>T.classification==="FP"||T.classification==="FN"),te=(W==null?void 0:W.replace(/^---[\s\S]*?---\s*/,"").trim())??null,be=O.trim().length>0,he=te?zr(te):"";return a.jsxs("div",{className:"p-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),a.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),a.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[a.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),a.jsx("div",{className:"flex gap-1.5",children:a.jsx("button",{onClick:I,disabled:U||!te||j,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:U?"var(--surface-3)":"var(--surface-2)",color:te?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:te?1:.5,cursor:te?"pointer":"not-allowed"},title:te?void 0:"No skill description available",onMouseEnter:T=>{te&&!U&&(T.currentTarget.style.background="var(--surface-3)")},onMouseLeave:T=>{U||(T.currentTarget.style.background="var(--surface-2)")},children:U?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),be?"Regenerate":"Generate"," Test Prompts"]})})})]}),!te&&!j&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),L&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:L}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:O,onChange:T=>Z(T.target.value),placeholder:`How do I write a unit test?
64
64
  What edge cases should I test?
65
65
  +Deploy this to production
@@ -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-DxX5UYZn.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-BjKaIypp.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CGNHEtf7.css">
9
9
  </head>
10
10
  <body>
@@ -8,17 +8,24 @@ const BASE_URL = "https://verified-skill.com";
8
8
  const VALID_STATUSES = new Set(["PASS", "FAIL", "PENDING", "TIMED_OUT"]);
9
9
  const VALID_VERDICTS = new Set(["PASS", "FAIL", "CONCERNS", "PENDING"]);
10
10
  const VALID_OVERALL = new Set(["PASS", "FAIL", "PENDING", "TIMED_OUT", "CERTIFIED"]);
11
+ function sanitizeLogValue(v) {
12
+ return String(v).replace(/[\x00-\x1f\x7f]/g, "").slice(0, 50);
13
+ }
11
14
  function validateEnum(value, allowed, fallback) {
12
15
  const upper = value.toUpperCase();
13
16
  if (allowed.has(upper))
14
17
  return upper;
15
- console.warn(`[platform-security] invalid enum value "${value}", using fallback "${fallback}"`);
18
+ console.warn(`[platform-security] invalid enum value "${sanitizeLogValue(value)}", using fallback "${fallback}"`);
16
19
  return fallback;
17
20
  }
18
21
  function safeNumber(value, fallback) {
22
+ if (value === "") {
23
+ console.warn(`[platform-security] empty string coerced to ${fallback}`);
24
+ return fallback;
25
+ }
19
26
  const n = Number(value ?? fallback);
20
27
  if (isNaN(n)) {
21
- console.warn(`[platform-security] non-numeric value coerced to ${fallback}:`, value);
28
+ console.warn(`[platform-security] non-numeric value coerced to ${fallback}: ${sanitizeLogValue(value)}`);
22
29
  return fallback;
23
30
  }
24
31
  return n;
@@ -32,7 +39,7 @@ export async function checkPlatformSecurity(skillName) {
32
39
  const url = `${BASE_URL}/api/v1/skills/${skillName.split("/").map(encodeURIComponent).join("/")}/security`;
33
40
  const res = await fetch(url, { signal: AbortSignal.timeout(10_000) });
34
41
  if (!res.ok) {
35
- console.warn(`[platform-security] HTTP ${res.status} for ${skillName}`);
42
+ console.warn(`[platform-security] HTTP ${res.status} for ${sanitizeLogValue(skillName)}`);
36
43
  return null;
37
44
  }
38
45
  const data = (await res.json());
@@ -55,7 +62,7 @@ export async function checkPlatformSecurity(skillName) {
55
62
  };
56
63
  }
57
64
  catch (err) {
58
- console.warn(`[platform-security] check failed for ${skillName}:`, err instanceof Error ? err.message : String(err));
65
+ console.warn(`[platform-security] check failed for ${sanitizeLogValue(skillName)}: ${err instanceof Error ? err.message : String(err)}`);
59
66
  return null;
60
67
  }
61
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"platform-security.js","sourceRoot":"","sources":["../../src/security/platform-security.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAE9E,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAgB9C,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E,MAAM,cAAc,GAA0C,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAChH,MAAM,cAAc,GAAwD,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;AAC7H,MAAM,aAAa,GAA0D,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAE5I,SAAS,YAAY,CAAmB,KAAa,EAAE,OAAuB,EAAE,QAAW;IACzF,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAU,CAAC;QAAE,OAAO,KAAU,CAAC;IAC/C,OAAO,CA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AC9F,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;SAC9C,CAAC,CAAC,CAAC;QAEJ,8EAA8E;QAC9E,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,KAAK,CAAC;YAC3C,CAAC,CAAC,SAAkB;YACpB,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,SAAS,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAErF,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAChC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,aAAa,GAAG,CAAC,CAClD,CAAC;QAEF,OAAO;YACL,WAAW;YACX,cAAc;YACd,SAAS;YACT,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;SACxC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,wCAAwC,gBAAgB,CAAC,SAAS,CAAC,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzI,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vskill",
3
- "version": "0.5.48",
3
+ "version": "0.5.49",
4
4
  "type": "module",
5
5
  "description": "Secure multi-platform AI skill installer — scan before you install",
6
6
  "bin": {