import{Kb as iX,Lb as zZ,Mb as rX,Nb as VQ,Ob as RQ,Pb as GQ}from"./cli-0.5.4-xger6tkr.mjs";import{Qb as NZ,Rb as lq}from"./cli-0.5.4-qedmz234.mjs";import"./cli-0.5.4-86mx3dyr.mjs";import"./cli-0.5.4-rfkjv3qd.mjs";import{Yb as gQ,Zb as cq}from"./cli-0.5.4-xhnepnvd.mjs";import{Ef as zX,Ff as a0,Gf as VX}from"./cli-0.5.4-2fkwj5bs.mjs";import{$l as Q0,$r as bJ,AN as Sq,Au as $Z,BK as pq,Fj as WX,Gj as nQ,HD as v0,Hj as hX,ID as qX,Ll as eJ,Lw as OX,MG as _Z,Ml as Mq,Mw as CJ,Nw as pX,OG as ZY,Ow as hQ,Pl as cQ,Pu as jJ,Pw as hq,Ql as mq,Qu as nZ,Qx as uJ,RM as sJ,Rx as oZ,SM as Oq,UM as jQ,Uk as AQ,Ux as cJ,Vk as Aq,Vt as e0,Vx as sZ,Wt as o0,XJ as nJ,Xl as n,YJ as Yq,Yl as w0,Yt as NX,Zl as a,_i as yQ,_l as N0,am as z0,as as SX,bj as yq,bs as kJ,cs as tJ,dm as C0,ds as _X,dx as mJ,eA as xJ,em as lX,ex as fX,fA as aZ,fx as TX,hs as kZ,iG as dJ,ix as PJ,jG as tZ,jJ as cX,js as iq,kF as xQ,ks as $0,kx as xZ,lF as uq,ls as dX,mG as iJ,ms as LX,nG as Xq,ns as XQ,os as UX,ps as n0,rJ as Zq,rN as mQ,sK as _Q,ss as PZ,su as pJ,ts as EZ,tu as lZ,uK as _q,vG as lJ,vJ as $J,wA as gJ,wG as Jq,wJ as qq,xA as eZ,xD as j0,xG as rJ,xu as TJ,yD as vX,yG as Qq,yK as pQ,ys as QX,yu as rZ,zu as SJ}from"./cli-0.5.4-k5fz4zd3.mjs";import"./cli-0.5.4-wbqf44ym.mjs";import"./cli-0.5.4-9ewg9gfs.mjs";import"./cli-0.5.4-we3mspgg.mjs";import"./cli-0.5.4-jzhazry0.mjs";import"./cli-0.5.4-82sw3hrw.mjs";import"./cli-0.5.4-31v143kt.mjs";import"./cli-0.5.4-1cy7wd6s.mjs";import"./cli-0.5.4-5e0pk96f.mjs";import"./cli-0.5.4-z154a7bp.mjs";import"./cli-0.5.4-ng5p0zjs.mjs";import"./cli-0.5.4-5hp7ks3t.mjs";import"./cli-0.5.4-8hdwp78f.mjs";import"./cli-0.5.4-mr9aznxx.mjs";import"./cli-0.5.4-jevfk5q7.mjs";import"./cli-0.5.4-27dzbzdy.mjs";import"./cli-0.5.4-a5bkdqqb.mjs";import{AT as RX,zT as h0}from"./cli-0.5.4-j2hnw539.mjs";import"./cli-0.5.4-9w59nnw4.mjs";import"./cli-0.5.4-z5d3q8kh.mjs";import"./cli-0.5.4-c0r12dqp.mjs";import"./cli-0.5.4-kqh172jk.mjs";import{NU as t,PU as b0,VU as u0,WU as uX}from"./cli-0.5.4-vv4jbgkc.mjs";import{KW as f,MW as U,eX as wZ,pX as R0,rV as L0}from"./cli-0.5.4-s7k1f0wc.mjs";import"./cli-0.5.4-0h0yz2k5.mjs";import"./cli-0.5.4-942dm5q1.mjs";import"./cli-0.5.4-rcmp5h4y.mjs";import"./cli-0.5.4-xdcww3x8.mjs";import"./cli-0.5.4-fq32ny1h.mjs";import"./cli-0.5.4-h1m67ngp.mjs";import"./cli-0.5.4-49erze3e.mjs";import"./cli-0.5.4-jytjks37.mjs";import{OY as G0,PY as Q,QY as F,RY as p}from"./cli-0.5.4-mn22gk7g.mjs";import{SY as k0}from"./cli-0.5.4-5t3jj85n.mjs";import"./cli-0.5.4-5shjmmkz.mjs";import"./cli-0.5.4-zb412kkm.mjs";import"./cli-0.5.4-prfn3sxd.mjs";import"./cli-0.5.4-6xmgebmk.mjs";import"./cli-0.5.4-vjgejcrz.mjs";import"./cli-0.5.4-jqt00ywx.mjs";import"./cli-0.5.4-9e7rkd8e.mjs";import{X3 as T0,Y3 as gX}from"./cli-0.5.4-jp4wtw87.mjs";import"./cli-0.5.4-hambpq58.mjs";import"./cli-0.5.4-syvgmg9g.mjs";import"./cli-0.5.4-w8ttefr5.mjs";import"./cli-0.5.4-j7kkqxv6.mjs";import"./cli-0.5.4-qrwczx7j.mjs";import"./cli-0.5.4-v2z6p9td.mjs";import{$$ as BX,B6 as wX,Eaa as MZ,G_ as mX,J6 as gq,K6 as Y0,L6 as ZX,M_ as iZ,U$ as S0,Y_ as BJ,Z_ as _J,_aa as dq,a9 as aJ,f$ as IJ,i9 as fq,m9 as LJ,o9 as SZ,r8 as i0,t8 as AJ}from"./cli-0.5.4-cbq01zg3.mjs";import"./cli-0.5.4-37v5fhf1.mjs";import{$ca as vZ,Sca as JJ,fda as PQ}from"./cli-0.5.4-7grzwf6q.mjs";import"./cli-0.5.4-9qmek5dq.mjs";import{Ada as hJ,xda as YX}from"./cli-0.5.4-9c6r1fjg.mjs";import"./cli-0.5.4-2dw33ms6.mjs";import{Zda as JX,_da as RJ}from"./cli-0.5.4-x1fzfxmm.mjs";import"./cli-0.5.4-e822fzaq.mjs";import{Nea as IX,Pea as BQ}from"./cli-0.5.4-09dvrzcr.mjs";import{tfa as QJ,xfa as wq}from"./cli-0.5.4-end8wj9r.mjs";import"./cli-0.5.4-4x206j04.mjs";import{$fa as VJ,mga as TZ}from"./cli-0.5.4-yd3rd9qt.mjs";import{Fga as fZ,Hga as AX,Nga as GJ,oga as uQ,vga as jq}from"./cli-0.5.4-sgcaw17t.mjs";import"./cli-0.5.4-jmc3bzbn.mjs";import"./cli-0.5.4-959vxhhb.mjs";import{Vma as o,Zma as $}from"./cli-0.5.4-aacw1src.mjs";var A0;var YJ=$(()=>{A0={FOLDER_NAME:".claudio",AGENTS_DIR:"agents"}});import{mkdir as jZ,open as mZ,unlink as uZ}from"fs/promises";import{join as _0}from"path";function UJ(J,X,q,Y,V,Z,R){let L=X.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\\\n"),W=q===void 0||q.length===1&&q[0]==="*"?"":`
tools: ${q.join(", ")}`,O=R!==void 0?`
effort: ${R}`:"",K=V?`
color: ${V}`:"",G=Z?`
memory: ${Z}`:"";return`---
name: ${J}
description: "${L}"${W}${O}${K}${G}
---

${Y}
`}function FX(J){switch(J){case"flagSettings":throw Error(`Cannot get directory path for ${J} agents`);case"userSettings":return _0(VJ(),A0.AGENTS_DIR);case"projectSettings":return _0(JX(),A0.FOLDER_NAME,A0.AGENTS_DIR);case"policySettings":return _0(LJ(),A0.FOLDER_NAME,A0.AGENTS_DIR);case"localSettings":return _0(JX(),A0.FOLDER_NAME,A0.AGENTS_DIR)}}function FJ(J){switch(J){case"projectSettings":return _0(".",A0.FOLDER_NAME,A0.AGENTS_DIR);default:return FX(J)}}function KX(J){let X=FX(J.source);return _0(X,`${J.agentType}.md`)}function HX(J){if(J.source==="built-in")return"Built-in";if(J.source==="plugin")throw Error("Cannot get file path for plugin agents");let X=FX(J.source),q=J.filename||J.agentType;return _0(X,`${q}.md`)}function KJ(J){if(J.source==="built-in")return"Built-in";let X=FJ(J.source);return _0(X,`${J.agentType}.md`)}function HJ(J){if(LX(J))return"Built-in";if(UX(J))return`Plugin: ${J.plugin||"Unknown"}`;if(J.source==="flagSettings")return"CLI argument";let X=FJ(J.source),q=J.filename||J.agentType;return _0(X,`${q}.md`)}async function cZ(J){let X=FX(J);return await jZ(X,{recursive:!0}),X}async function WJ(J,X,q,Y,V,Z=!0,R,L,H){if(J==="built-in")throw Error("Cannot save built-in agents");await cZ(J);let W=KX({source:J,agentType:X}),O=UJ(X,q,Y,V,R,L,H);try{await MJ(W,O,Z?"wx":"w")}catch(K){if(AX(K)==="EEXIST")throw Error(`Agent file already exists: ${W}`);throw K}}async function OJ(J,X,q,Y,V,Z,R){if(J.source==="built-in")throw Error("Cannot update built-in agents");let L=HX(J),H=UJ(J.agentType,X,q,Y,V,Z,R);await MJ(L,H)}async function fJ(J){if(J.source==="built-in")throw Error("Cannot delete built-in agents");let X=HX(J);try{await uZ(X)}catch(q){if(AX(q)!=="ENOENT")throw q}}async function MJ(J,X,q="w"){let Y=await mZ(J,q);try{await Y.writeFile(X,{encoding:"utf-8"}),await Y.datasync()}finally{await Y.close()}}var x0=$(()=>{SZ();QX();RJ();TZ();GJ();YJ()});function NJ(J){let X=EJ.c(48),{agent:q,tools:Y,onBack:V}=J,Z=fX(q,Y,!1),R;if(X[0]!==q)R=HJ(q),X[0]=q,X[1]=R;else R=X[1];let L=R,H;if(X[2]!==q.agentType)H=kJ(q.agentType),X[2]=q.agentType,X[3]=H;else H=X[3];let W=H,O;if(X[4]===Symbol.for("react.memo_cache_sentinel"))O={context:"Confirmation"},X[4]=O;else O=X[4];t("confirm:no",V,O);let K;if(X[5]!==V)K=(C)=>{if(C.key==="return")C.preventDefault(),V()},X[5]=V,X[6]=K;else K=X[6];let G=K,N=function(){if(Z.hasWildcard)return Q(U,{children:"All tools"});if(!q.tools||q.tools.length===0)return Q(U,{children:"None"});return F(G0,{children:[Z.validTools.length>0&&Q(U,{children:Z.validTools.join(", ")}),Z.invalidTools.length>0&&F(U,{color:"warning",children:[Y0.warning," Unrecognized:"," ",Z.invalidTools.join(", ")]})]})},k=f,w="column",y=1,z=0,D=!0,M;if(X[7]!==L)M=Q(U,{dimColor:!0,children:L}),X[7]=L,X[8]=M;else M=X[8];let B;if(X[9]===Symbol.for("react.memo_cache_sentinel"))B=F(U,{children:[Q(U,{bold:!0,children:"Description"})," (tells Claude when to use this agent):"]}),X[9]=B;else B=X[9];let v;if(X[10]!==q.whenToUse)v=F(f,{flexDirection:"column",children:[B,Q(f,{marginLeft:2,children:Q(U,{children:q.whenToUse})})]}),X[10]=q.whenToUse,X[11]=v;else v=X[11];let T=f,P;if(X[12]===Symbol.for("react.memo_cache_sentinel"))P=F(U,{children:[Q(U,{bold:!0,children:"Tools"}),":"," "]}),X[12]=P;else P=X[12];let g=N(),A;if(X[13]!==T||X[14]!==P||X[15]!==g)A=F(T,{children:[P,g]}),X[13]=T,X[14]=P,X[15]=g,X[16]=A;else A=X[16];let d;if(X[17]===Symbol.for("react.memo_cache_sentinel"))d=Q(U,{bold:!0,children:"Model"}),X[17]=d;else d=X[17];let i;if(X[18]!==q.model)i=OX(q.model),X[18]=q.model,X[19]=i;else i=X[19];let r;if(X[20]!==i)r=F(U,{children:[d,": ",i]}),X[20]=i,X[21]=r;else r=X[21];let x;if(X[22]!==q.permissionMode)x=q.permissionMode&&F(U,{children:[Q(U,{bold:!0,children:"Permission mode"}),": ",q.permissionMode]}),X[22]=q.permissionMode,X[23]=x;else x=X[23];let E;if(X[24]!==q.memory)E=q.memory&&F(U,{children:[Q(U,{bold:!0,children:"Memory"}),": ",WX(q.memory)]}),X[24]=q.memory,X[25]=E;else E=X[25];let S;if(X[26]!==q.hooks)S=q.hooks&&Object.keys(q.hooks).length>0&&F(U,{children:[Q(U,{bold:!0,children:"Hooks"}),": ",Object.keys(q.hooks).join(", ")]}),X[26]=q.hooks,X[27]=S;else S=X[27];let I;if(X[28]!==q.skills)I=q.skills&&q.skills.length>0&&F(U,{children:[Q(U,{bold:!0,children:"Skills"}),":"," ",q.skills.length>10?`${q.skills.length} skills`:q.skills.join(", ")]}),X[28]=q.skills,X[29]=I;else I=X[29];let b;if(X[30]!==q.agentType||X[31]!==W)b=W&&Q(f,{children:F(U,{children:[Q(U,{bold:!0,children:"Color"}),":"," ",F(U,{backgroundColor:W,color:"inverseText",children:[" ",q.agentType," "]})]})}),X[30]=q.agentType,X[31]=W,X[32]=b;else b=X[32];let c;if(X[33]!==q)c=!LX(q)&&F(G0,{children:[Q(f,{children:F(U,{children:[Q(U,{bold:!0,children:"System prompt"}),":"]})}),Q(f,{marginLeft:2,marginRight:2,children:Q(PJ,{children:q.getSystemPrompt()})})]}),X[33]=q,X[34]=c;else c=X[34];let j;if(X[35]!==k||X[36]!==G||X[37]!==v||X[38]!==A||X[39]!==r||X[40]!==x||X[41]!==E||X[42]!==S||X[43]!==I||X[44]!==b||X[45]!==c||X[46]!==M)j=F(k,{flexDirection:w,gap:y,tabIndex:z,autoFocus:D,onKeyDown:G,children:[M,v,A,r,x,E,S,I,b,c]}),X[35]=k,X[36]=G,X[37]=v,X[38]=A,X[39]=r,X[40]=x,X[41]=E,X[42]=S,X[43]=I,X[44]=b,X[45]=c,X[46]=M,X[47]=j;else j=X[47];return j}var EJ;var zJ=$(()=>{ZX();R0();b0();_X();hX();TX();QX();pX();xZ();x0();p();EJ=o(L0(),1)});function MX(J){let X=vJ.c(17),{agentName:q,currentColor:Y,onConfirm:V}=J,Z=Y===void 0?"automatic":Y,R;if(X[0]!==Z)R=g0.findIndex((z)=>z===Z),X[0]=Z,X[1]=R;else R=X[1];let[L,H]=DJ.useState(Math.max(0,R)),W;if(X[2]!==V||X[3]!==L)W=(z)=>{if(z.key==="up")z.preventDefault(),H(dZ);else if(z.key==="down")z.preventDefault(),H(gZ);else if(z.key==="return"){z.preventDefault();let D=g0[L];V(D==="automatic"?void 0:D)}},X[2]=V,X[3]=L,X[4]=W;else W=X[4];let O=W,K=g0[L],G;if(X[5]!==L)G=g0.map((z,D)=>{let M=D===L;return F(f,{flexDirection:"row",gap:1,children:[Q(U,{color:M?"suggestion":void 0,children:M?Y0.pointer:" "}),z==="automatic"?Q(U,{bold:M,children:"Automatic color"}):F(f,{gap:1,children:[Q(U,{backgroundColor:SX[z],color:"inverseText",children:" "}),Q(U,{bold:M,children:BJ(z)})]})]},z)}),X[5]=L,X[6]=G;else G=X[6];let N;if(X[7]!==G)N=Q(f,{flexDirection:"column",children:G}),X[7]=G,X[8]=N;else N=X[8];let k;if(X[9]===Symbol.for("react.memo_cache_sentinel"))k=Q(U,{children:"Preview: "}),X[9]=k;else k=X[9];let w;if(X[10]!==q||X[11]!==K)w=F(f,{marginTop:1,children:[k,K===void 0||K==="automatic"?F(U,{inverse:!0,bold:!0,children:[" ","@",q," "]}):F(U,{backgroundColor:SX[K],color:"inverseText",bold:!0,children:[" ","@",q," "]})]}),X[10]=q,X[11]=K,X[12]=w;else w=X[12];let y;if(X[13]!==O||X[14]!==N||X[15]!==w)y=F(f,{flexDirection:"column",gap:1,tabIndex:0,autoFocus:!0,onKeyDown:O,children:[N,w]}),X[13]=O,X[14]=N,X[15]=w,X[16]=y;else y=X[16];return y}function gZ(J){return J<g0.length-1?J+1:0}function dZ(J){return J>0?J-1:g0.length-1}var vJ,DJ,g0;var jX=$(()=>{ZX();R0();_X();IJ();p();vJ=o(L0(),1),DJ=o(k0(),1),g0=["automatic",...bJ]});function d0(J){let X=wJ.c(11),{initialModel:q,onComplete:Y,onCancel:V}=J,Z;if(X[0]!==q){X:{let K=CJ();if(q&&!K.some((G)=>G.value===q)){Z=[{value:q,label:q,description:"Current model (custom ID)"},...K];break X}Z=K}X[0]=q,X[1]=Z}else Z=X[1];let R=Z,L=q??"inherit",H;if(X[2]===Symbol.for("react.memo_cache_sentinel"))H=Q(f,{marginBottom:1,children:Q(U,{dimColor:!0,children:"Model determines the agent's reasoning capabilities and speed."})}),X[2]=H;else H=X[2];let W;if(X[3]!==V||X[4]!==Y)W=()=>V?V():Y(void 0),X[3]=V,X[4]=Y,X[5]=W;else W=X[5];let O;if(X[6]!==L||X[7]!==R||X[8]!==Y||X[9]!==W)O=F(f,{flexDirection:"column",children:[H,Q(v0,{options:R,defaultValue:L,onChange:Y,onCancel:W})]}),X[6]=L,X[7]=R,X[8]=Y,X[9]=W,X[10]=O;else O=X[10];return O}var wJ;var kX=$(()=>{R0();pX();qX();p();wJ=o(L0(),1)});function yJ(){return{READ_ONLY:{name:"Read-only tools",toolNames:new Set([SJ.name,TJ.name,sJ.name,gJ.name,dJ.name,jJ.name,rJ.name,iJ.name,lJ.name,$J.name,nJ.name])},EDIT:{name:"Edit tools",toolNames:new Set([uJ.name,pJ.name,cJ.name])},EXECUTION:{name:"Execution tools",toolNames:new Set([xJ.name])},MCP:{name:"MCP tools",toolNames:new Set,isMcp:!0},OTHER:{name:"Other tools",toolNames:new Set}}}function Vq(J){let X=new Map;return J.forEach((q)=>{if(cX(q)){let Y=mX(q.name);if(Y?.serverName){let V=X.get(Y.serverName)||[];V.push(q),X.set(Y.serverName,V)}}}),Array.from(X.entries()).map(([q,Y])=>({serverName:q,tools:Y})).sort((q,Y)=>q.serverName.localeCompare(Y.serverName))}function PX(J){let X=oJ.c(69),{tools:q,initialTools:Y,onComplete:V,onCancel:Z}=J,R;if(X[0]!==q)R=mJ({tools:q,isBuiltIn:!1,isAsync:!1}),X[0]=q,X[1]=R;else R=X[1];let L=R,H;if(X[2]!==L||X[3]!==Y)H=!Y||Y.includes("*")?L.map(Wq):Y,X[2]=L,X[3]=Y,X[4]=H;else H=X[4];let W=H,[O,K]=l0.useState(W),[G,N]=l0.useState(0),[k,w]=l0.useState(!1),y;if(X[5]!==L)y=new Set(L.map(Hq)),X[5]=L,X[6]=y;else y=X[6];let z=y,D;if(X[7]!==O||X[8]!==z){let u;if(X[10]!==z)u=(h)=>z.has(h),X[10]=z,X[11]=u;else u=X[11];D=O.filter(u),X[7]=O,X[8]=z,X[9]=D}else D=X[9];let M=D,B;if(X[12]!==M)B=new Set(M),X[12]=M,X[13]=B;else B=X[13];let v=B,T=M.length===L.length&&L.length>0,P;if(X[14]===Symbol.for("react.memo_cache_sentinel"))P=(u)=>{if(!u)return;K((h)=>h.includes(u)?h.filter((q0)=>q0!==u):[...h,u])},X[14]=P;else P=X[14];let g=P,A;if(X[15]===Symbol.for("react.memo_cache_sentinel"))A=(u,h)=>{K((q0)=>{if(h){let J0=u.filter((B0)=>!q0.includes(B0));return[...q0,...J0]}else return q0.filter((J0)=>!u.includes(J0))})},X[15]=A;else A=X[15];let d=A,i;if(X[16]!==L||X[17]!==V||X[18]!==M)i=()=>{let u=L.map(Kq),q0=M.length===u.length&&u.every((J0)=>M.includes(J0))?void 0:M;V(q0)},X[16]=L,X[17]=V,X[18]=M,X[19]=i;else i=X[19];let r=i,x;if(X[20]!==L){let u=yJ();x={readOnly:[],edit:[],execution:[],mcp:[],other:[]},L.forEach((h)=>{if(cX(h))x.mcp.push(h);else if(u.READ_ONLY.toolNames.has(h.name))x.readOnly.push(h);else if(u.EDIT.toolNames.has(h.name))x.edit.push(h);else if(u.EXECUTION.toolNames.has(h.name))x.execution.push(h);else if(h.name!==YX)x.other.push(h)}),X[20]=L,X[21]=x}else x=X[21];let E=x,S;if(X[22]!==v)S=(u)=>{let q0=i0(u,(J0)=>v.has(J0.name))<u.length;return()=>{let J0=u.map(Fq);d(J0,q0)}},X[22]=v,X[23]=S;else S=X[23];let I=S,b;if(X[24]!==I||X[25]!==L||X[26]!==G||X[27]!==r||X[28]!==T||X[29]!==v||X[30]!==k||X[31]!==E.edit||X[32]!==E.execution||X[33]!==E.mcp||X[34]!==E.other||X[35]!==E.readOnly){b=[],b.push({id:"continue",label:"Continue",action:r,isContinue:!0});let u;if(X[37]!==L||X[38]!==T)u=()=>{let M0=L.map(Uq);d(M0,!T)},X[37]=L,X[38]=T,X[39]=u;else u=X[39];b.push({id:"bucket-all",label:`${T?Y0.checkboxOn:Y0.checkboxOff} All tools`,action:u});let h=yJ();[{id:"bucket-readonly",name:h.READ_ONLY.name,tools:E.readOnly},{id:"bucket-edit",name:h.EDIT.name,tools:E.edit},{id:"bucket-execution",name:h.EXECUTION.name,tools:E.execution},{id:"bucket-mcp",name:h.MCP.name,tools:E.mcp},{id:"bucket-other",name:h.OTHER.name,tools:E.other}].forEach((M0)=>{let{id:m0,name:I0,tools:t0}=M0;if(t0.length===0)return;let XX=i0(t0,(pZ)=>v.has(pZ.name))===t0.length;b.push({id:m0,label:`${XX?Y0.checkboxOn:Y0.checkboxOff} ${I0}`,action:I(t0)})});let J0=b.length,B0;if(X[40]!==G||X[41]!==k||X[42]!==J0)B0=()=>{if(w(!k),k&&G>J0)N(J0)},X[40]=G,X[41]=k,X[42]=J0,X[43]=B0;else B0=X[43];b.push({id:"toggle-individual",label:k?"Hide advanced options":"Show advanced options",action:B0,isToggle:!0});let qJ=Vq(L);if(k){if(qJ.length>0)b.push({id:"mcp-servers-header",label:"MCP Servers:",action:Lq,isHeader:!0}),qJ.forEach((M0)=>{let{serverName:m0,tools:I0}=M0,yX=i0(I0,(XX)=>v.has(XX.name))===I0.length;b.push({id:`mcp-server-${m0}`,label:`${yX?Y0.checkboxOn:Y0.checkboxOff} ${m0} (${I0.length} ${_J(I0.length,"tool")})`,action:()=>{let XX=I0.map(Gq);d(XX,!yX)}})}),b.push({id:"tools-header",label:"Individual Tools:",action:Rq,isHeader:!0});L.forEach((M0)=>{let m0=M0.name;if(M0.name.startsWith("mcp__")){let I0=mX(M0.name);m0=I0?`${I0.toolName} (${I0.serverName})`:M0.name}b.push({id:`tool-${M0.name}`,label:`${v.has(M0.name)?Y0.checkboxOn:Y0.checkboxOff} ${m0}`,action:()=>g(M0.name)})})}X[24]=I,X[25]=L,X[26]=G,X[27]=r,X[28]=T,X[29]=v,X[30]=k,X[31]=E.edit,X[32]=E.execution,X[33]=E.mcp,X[34]=E.other,X[35]=E.readOnly,X[36]=b}else b=X[36];let c;if(X[44]!==Y||X[45]!==Z||X[46]!==V)c=()=>{if(Z)Z();else V(Y)},X[44]=Y,X[45]=Z,X[46]=V,X[47]=c;else c=X[47];let j=c,C;if(X[48]===Symbol.for("react.memo_cache_sentinel"))C={context:"Confirmation"},X[48]=C;else C=X[48];t("confirm:no",j,C);let m;if(X[49]!==G||X[50]!==b)m=(u)=>{if(u.key==="return"){u.preventDefault();let h=b[G];if(h&&!h.isHeader)h.action()}else if(u.key==="up"){u.preventDefault();let h=G-1;while(h>0&&b[h]?.isHeader)h--;N(Math.max(0,h))}else if(u.key==="down"){u.preventDefault();let h=G+1;while(h<b.length-1&&b[h]?.isHeader)h++;N(Math.min(b.length-1,h))}},X[49]=G,X[50]=b,X[51]=m;else m=X[51];let _=m,l=G===0?"suggestion":void 0,s=G===0,X0=G===0?`${Y0.pointer} `:"  ",V0;if(X[52]!==l||X[53]!==s||X[54]!==X0)V0=F(U,{color:l,bold:s,children:[X0,"[ Continue ]"]}),X[52]=l,X[53]=s,X[54]=X0,X[55]=V0;else V0=X[55];let f0;if(X[56]===Symbol.for("react.memo_cache_sentinel"))f0=Q(u0,{width:40}),X[56]=f0;else f0=X[56];let U0;if(X[57]!==b)U0=b.slice(1),X[57]=b,X[58]=U0;else U0=X[58];let H0;if(X[59]!==G||X[60]!==U0)H0=U0.map((u,h)=>{let q0=h+1===G,J0=u.isToggle,B0=u.isHeader;return F(l0.default.Fragment,{children:[J0&&Q(u0,{width:40}),B0&&h>0&&Q(f,{marginTop:1}),F(U,{color:B0?void 0:q0?"suggestion":void 0,dimColor:B0,bold:J0&&q0,children:[B0?"":q0?`${Y0.pointer} `:"  ",J0?`[ ${u.label} ]`:u.label]})]},u.id)}),X[59]=G,X[60]=U0,X[61]=H0;else H0=X[61];let W0=T?"All tools selected":`${v.size} of ${L.length} tools selected`,F0;if(X[62]!==W0)F0=Q(f,{marginTop:1,flexDirection:"column",children:Q(U,{dimColor:!0,children:W0})}),X[62]=W0,X[63]=F0;else F0=X[63];let K0;if(X[64]!==_||X[65]!==V0||X[66]!==H0||X[67]!==F0)K0=F(f,{flexDirection:"column",marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:_,children:[V0,f0,H0,F0]}),X[64]=_,X[65]=V0,X[66]=H0,X[67]=F0,X[68]=K0;else K0=X[68];return K0}function Rq(){}function Gq(J){return J.name}function Lq(){}function Uq(J){return J.name}function Fq(J){return J.name}function Kq(J){return J.name}function Hq(J){return J.name}function Wq(J){return J.name}var oJ,l0;var xX=$(()=>{ZX();iZ();Zq();TX();hJ();aZ();Oq();oZ();eZ();lZ();$Z();rZ();qq();sZ();Yq();Jq();Xq();nZ();tZ();Qq();R0();b0();AJ();IJ();uX();p();oJ=o(L0(),1),l0=o(k0(),1)});function r0(J){if(J==="all")return"Agents";if(J==="built-in")return"Built-in agents";if(J==="plugin")return"Plugin agents";return eJ(aJ(J))}var EX=$(()=>{Mq();fq()});function JQ({agent:J,tools:X,onSaved:q,onBack:Y}){let V=o0(),[Z,R]=E0.useState("menu"),[L,H]=E0.useState(0),[W,O]=E0.useState(null),[K,G]=E0.useState(J.color),N=E0.useCallback(async()=>{let M=HX(J),B=await zX(M);if(B.error)O(B.error);else q(`Opened ${J.agentType} in editor. If you made edits, restart to load the latest version.`)},[J,q]),k=E0.useCallback(async(M={})=>{let{tools:B,color:v,model:T}=M,P=v??K,g=B!==void 0,A=T!==void 0,d=P!==J.color;if(!g&&!A&&!d)return!1;try{if(!XQ(J)&&!UX(J))return!1;if(g||d)await OJ(J,J.whenToUse,B??J.tools,J.getSystemPrompt(),P);if(A&&J.baseDir)await $0(J.baseDir,J.agentType,T);if(d&&P)tJ(J.agentType,P);return V((i)=>{let r=i.agentDefinitions.allAgents.map((x)=>x.agentType===J.agentType?{...x,tools:B??x.tools,color:P,model:T??x.model}:x);return{...i,agentDefinitions:{...i.agentDefinitions,activeAgents:n0(r),allAgents:r}}}),q(`Updated agent: ${T0.bold(J.agentType)}`),!0}catch(i){return O(i instanceof Error?i.message:"Failed to save agent"),!1}},[J,K,q,V]),w=E0.useMemo(()=>[{label:"Open in editor",action:N},{label:"Edit tools",action:()=>R("edit-tools")},{label:"Edit model",action:()=>R("edit-model")},{label:"Edit color",action:()=>R("edit-color")}],[N]),y=E0.useCallback(()=>{if(O(null),Z==="menu")Y();else R("menu")},[Z,Y]),z=E0.useCallback((M)=>{if(M.key==="up")M.preventDefault(),H((B)=>Math.max(0,B-1));else if(M.key==="down")M.preventDefault(),H((B)=>Math.min(w.length-1,B+1));else if(M.key==="return"){M.preventDefault();let B=w[L];if(B)B.action()}},[w,L]);t("confirm:no",y,{context:"Confirmation"});let D=()=>F(f,{flexDirection:"column",tabIndex:0,autoFocus:!0,onKeyDown:z,children:[F(U,{dimColor:!0,children:["Source: ",r0(J.source)]}),Q(f,{marginTop:1,flexDirection:"column",children:w.map((M,B)=>F(U,{color:B===L?"suggestion":void 0,children:[B===L?`${Y0.pointer} `:"  ",M.label]},M.label))}),W&&Q(f,{marginTop:1,children:Q(U,{color:"error",children:W})})]});switch(Z){case"menu":return D();case"edit-tools":return Q(PX,{tools:X,initialTools:J.tools,onComplete:async(M)=>{R("menu"),await k({tools:M})}});case"edit-color":return Q(MX,{agentName:J.agentType,currentColor:K||J.color||"automatic",onConfirm:async(M)=>{G(M),R("menu"),await k({color:M})}});case"edit-model":return Q(d0,{initialModel:J.model,onComplete:async(M)=>{R("menu"),await k({model:M})}});default:return null}}var E0;var QQ=$(()=>{gX();ZX();NX();R0();b0();_X();QX();VX();dX();x0();jX();kX();xX();EX();p();E0=o(k0(),1)});function c0(J){let X=ZQ.c(2),{instructions:q}=J,Y=q===void 0?"Press ↑↓ to navigate · Enter to select · Esc to go back":q,V=h0(),Z=V.pending?`Press ${V.keyName} again to exit`:Y,R;if(X[0]!==Z)R=Q(f,{marginLeft:2,children:Q(U,{dimColor:!0,children:Z})}),X[0]=Z,X[1]=R;else R=X[1];return R}var ZQ;var qQ=$(()=>{RX();R0();p();ZQ=o(L0(),1)});function YQ(J,X){if(J.length<=X)return J;if(X<=1)return J.slice(0,X);return`${J.slice(0,X-1)}…`}function LQ(J){return{isOverridden:!!J.overriddenBy,overriddenBy:J.overriddenBy||null}}function Eq(J){let X=kq,q=Pq;for(let Y of J){if(Y.agentType.length>X)X=Y.agentType.length;let V=rX(Y);if(V&&V.length>q)q=V.length}return{name:Math.min(X,32),model:Math.min(q,28)}}function Nq({agent:J,isSelected:X,dimmed:q,widths:Y,selectable:V}){let{isOverridden:Z,overriddenBy:R}=LQ(J),L=q&&!X,H=V&&X?"suggestion":void 0,W=rX(J)??"",O=V?X?`${Y0.pointer} `:"  ":"";return F(f,{flexDirection:"row",children:[Q(f,{width:Y.name+(V?2:0),flexShrink:0,children:F(U,{dimColor:L,color:H,children:[O,YQ(J.agentType,Y.name)]})}),Q(f,{width:Y.model+2,flexShrink:0,children:Q(U,{dimColor:!0,color:H,children:YQ(W,Y.model)})}),R&&Q(f,{flexShrink:0,children:F(U,{dimColor:!X,color:X?"warning":void 0,children:[Y0.warning," shadowed by ",VQ(R)]})})]},`${J.agentType}-${J.source}`)}function GX({widths:J,selectable:X}){return F(f,{flexDirection:"row",children:[Q(f,{width:J.name+(X?2:0),flexShrink:0,children:Q(U,{dimColor:!0,children:X?"  Name":"Name"})}),Q(f,{width:J.model+2,flexShrink:0,children:Q(U,{dimColor:!0,children:"Model"})})]})}function UQ({source:J,agents:X,onBack:q,onSelect:Y,onCreateNew:V,changes:Z}){let[R,L]=D0.useState(null),[H,W]=D0.useState(!0),O=D0.useMemo(()=>[...X].sort(RQ),[X]),K=D0.useMemo(()=>Eq(O),[O]),G=D0.useMemo(()=>{if(J==="all")return iX.flatMap(({source:A})=>O.filter((d)=>d.source===A));if(J==="built-in")return O.filter((A)=>A.source==="built-in");let P=O.filter((A)=>A.source!=="built-in"),g=O.filter((A)=>A.source==="built-in");return[...P,...g]},[O,J]);D0.useEffect(()=>{if(!R&&!H&&G.length>0)if(V)W(!0);else L(G[0]||null)},[G,R,H,V]);let N=(P)=>{if(P.key==="return"){if(P.preventDefault(),H&&V)V();else if(R)Y(R);return}if(P.key!=="up"&&P.key!=="down")return;P.preventDefault();let g=!!V,A=G.length+(g?1:0);if(A===0)return;let d=0;if(!H&&R){let r=G.findIndex((x)=>x.agentType===R.agentType&&x.source===R.source);if(r>=0)d=g?r+1:r}let i=P.key==="up"?d===0?A-1:d-1:d===A-1?0:d+1;if(g&&i===0)W(!0),L(null);else{let r=g?i-1:i,x=G[r];if(x)W(!1),L(x)}},k=()=>F(f,{children:[Q(U,{color:H?"suggestion":void 0,children:H?`${Y0.pointer} `:"  "}),Q(U,{color:H?"suggestion":void 0,children:"Create new agent"})]}),w=(P)=>{let g=!H&&R?.agentType===P.agentType&&R?.source===P.source,{isOverridden:A}=LQ(P);return Q(Nq,{agent:P,isSelected:!!g,dimmed:A,widths:K,selectable:!0},`${P.agentType}-${P.source}`)},y=(P="Built-in (always available):")=>{let g=O.filter((A)=>A.source==="built-in");if(g.length===0)return null;return F(f,{flexDirection:"column",marginBottom:1,paddingLeft:2,children:[Q(U,{bold:!0,dimColor:!0,children:P}),Q(GX,{widths:K,selectable:!0}),g.map(w)]})},z=(P,g)=>{if(!g.length)return null;let A=g[0]?.baseDir;return F(f,{flexDirection:"column",marginBottom:1,children:[F(f,{paddingLeft:2,children:[Q(U,{bold:!0,dimColor:!0,children:P}),A&&F(U,{dimColor:!0,children:[" (",A,")"]})]}),Q(f,{paddingLeft:2,children:Q(GX,{widths:K,selectable:!0})}),g.map(w)]})},D=r0(J),M=O.filter((P)=>P.source==="built-in");if(!O.length||J!=="built-in"&&!O.some((P)=>P.source!=="built-in"))return Q(C0,{title:D,subtitle:"No agents found",onCancel:q,hideInputGuide:!0,children:F(f,{flexDirection:"column",gap:1,tabIndex:0,autoFocus:!0,onKeyDown:N,children:[V&&Q(f,{children:k()}),Q(U,{dimColor:!0,children:"No agents found. Create specialized subagents that Claude can delegate to."}),Q(U,{dimColor:!0,children:"Each subagent has its own context window, custom system prompt, and specific tools."}),Q(U,{dimColor:!0,children:"Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer."}),J!=="built-in"&&O.some((P)=>P.source==="built-in")&&y()]})});let v=i0(O,(P)=>!P.overriddenBy),T;if(J==="all")T=F(G0,{children:[iX.filter((P)=>P.source!=="built-in").map(({label:P,source:g})=>Q(D0.Fragment,{children:z(P,O.filter((A)=>A.source===g))},g)),M.length>0&&F(f,{flexDirection:"column",marginBottom:1,paddingLeft:2,children:[F(U,{dimColor:!0,children:[Q(U,{bold:!0,children:"Built-in agents"})," (always available)"]}),Q(GX,{widths:K,selectable:!0}),M.map(w)]})]});else if(J==="built-in")T=F(G0,{children:[Q(U,{dimColor:!0,italic:!0,children:"Select a built-in agent and press Enter to change its model."}),F(f,{marginTop:1,flexDirection:"column",children:[Q(GX,{widths:K,selectable:!0}),O.map(w)]})]});else T=F(G0,{children:[F(f,{flexDirection:"column",children:[Q(GX,{widths:K,selectable:!0}),O.filter((P)=>P.source!=="built-in").map(w)]}),O.some((P)=>P.source==="built-in")&&F(G0,{children:[Q(u0,{}),y()]})]});return F(C0,{title:D,subtitle:`${v} agents`,onCancel:q,hideInputGuide:!0,children:[Z&&Z.length>0&&Q(f,{marginTop:1,children:Q(U,{dimColor:!0,children:Z[Z.length-1]})}),F(f,{flexDirection:"column",tabIndex:0,autoFocus:!0,onKeyDown:N,children:[V&&Q(f,{marginBottom:1,children:k()}),T]})]})}var D0,kq=20,Pq=12;var FQ=$(()=>{ZX();R0();GQ();AJ();lX();uX();EX();p();D0=o(k0(),1)});function nX(J){let X=KQ.c(38),{steps:q,initialData:Y,onComplete:V,onCancel:Z,children:R,title:L,showStepCounter:H}=J,W;if(X[0]!==Y)W=Y===void 0?{}:Y,X[0]=Y,X[1]=W;else W=X[1];let O=W,K=H===void 0?!0:H,[G,N]=p0.useState(0),[k,w]=p0.useState(O),[y,z]=p0.useState(!1),D;if(X[2]===Symbol.for("react.memo_cache_sentinel"))D=[],X[2]=D;else D=X[2];let[M,B]=p0.useState(D);h0();let v,T;if(X[3]!==y||X[4]!==V||X[5]!==k)v=()=>{if(y)B([]),V(k)},T=[y,k,V],X[3]=y,X[4]=V,X[5]=k,X[6]=v,X[7]=T;else v=X[6],T=X[7];p0.useEffect(v,T);let P;if(X[8]!==G||X[9]!==M||X[10]!==q.length)P=()=>{if(G<q.length-1){if(M.length>0)B((_)=>[..._,G]);N(Iq)}else z(!0)},X[8]=G,X[9]=M,X[10]=q.length,X[11]=P;else P=X[11];let g=P,A;if(X[12]!==G||X[13]!==M||X[14]!==Z)A=()=>{if(M.length>0){let _=M[M.length-1];if(_!==void 0)B(Bq),N(_)}else if(G>0)N(zq);else if(Z)Z()},X[12]=G,X[13]=M,X[14]=Z,X[15]=A;else A=X[15];let d=A,i;if(X[16]!==G||X[17]!==q.length)i=(_)=>{if(_>=0&&_<q.length)B((l)=>[...l,G]),N(_)},X[16]=G,X[17]=q.length,X[18]=i;else i=X[18];let r=i,x;if(X[19]!==Z)x=()=>{if(B([]),Z)Z()},X[19]=Z,X[20]=x;else x=X[20];let E=x,S;if(X[21]===Symbol.for("react.memo_cache_sentinel"))S=(_)=>{w((l)=>({...l,..._}))},X[21]=S;else S=X[21];let I=S,b;if(X[22]!==E||X[23]!==G||X[24]!==d||X[25]!==g||X[26]!==r||X[27]!==K||X[28]!==q.length||X[29]!==L||X[30]!==k)b={currentStepIndex:G,totalSteps:q.length,wizardData:k,setWizardData:w,updateWizardData:I,goNext:g,goBack:d,goToStep:r,cancel:E,title:L,showStepCounter:K},X[22]=E,X[23]=G,X[24]=d,X[25]=g,X[26]=r,X[27]=K,X[28]=q.length,X[29]=L,X[30]=k,X[31]=b;else b=X[31];let c=b,j=q[G];if(!j||y)return null;let C;if(X[32]!==j||X[33]!==R)C=R||Q(j,{}),X[32]=j,X[33]=R,X[34]=C;else C=X[34];let m;if(X[35]!==c||X[36]!==C)m=Q($X.Provider,{value:c,children:C}),X[35]=c,X[36]=C,X[37]=m;else m=X[37];return m}function zq(J){return J-1}function Bq(J){return J.slice(0,-1)}function Iq(J){return J+1}var KQ,p0,$X;var oX=$(()=>{RX();p();KQ=o(L0(),1),p0=o(k0(),1),$X=p0.createContext(null)});function e(){let J=HQ.useContext($X);if(!J)throw Error("useWizard must be used within a WizardProvider");return J}var HQ;var sX=$(()=>{oX();HQ=o(k0(),1)});function aX({instructions:J=F(Q0,{children:[Q(n,{shortcut:"↑↓",action:"navigate"}),Q(n,{shortcut:"Enter",action:"select"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"go back"})]})}){let X=h0();return Q(f,{marginLeft:3,marginTop:1,children:Q(U,{dimColor:!0,children:X.pending?`Press ${X.keyName} again to exit`:J})})}var eX=$(()=>{RX();R0();N0();z0();w0();p()});function Z0(J){let X=WQ.c(11),{title:q,color:Y,children:V,subtitle:Z,footerText:R}=J,L=Y===void 0?"suggestion":Y,{currentStepIndex:H,totalSteps:W,title:O,showStepCounter:K,goBack:G}=e(),N=q||O||"Wizard",k=K!==!1?` (${H+1}/${W})`:"",w=`${N}${k}`,y;if(X[0]!==V||X[1]!==L||X[2]!==G||X[3]!==Z||X[4]!==w)y=Q(C0,{title:w,subtitle:Z,onCancel:G,color:L,hideInputGuide:!0,isCancelActive:!1,children:V}),X[0]=V,X[1]=L,X[2]=G,X[3]=Z,X[4]=w,X[5]=y;else y=X[5];let z;if(X[6]!==R)z=Q(aX,{instructions:R}),X[6]=R,X[7]=z;else z=X[7];let D;if(X[8]!==y||X[9]!==z)D=F(G0,{children:[y,z]}),X[8]=y,X[9]=z,X[10]=D;else D=X[10];return D}var WQ;var P0=$(()=>{lX();sX();eX();p();WQ=o(L0(),1)});var O0=$(()=>{sX();P0();eX();oX()});function fQ(){let J=OQ.c(14),{goNext:X,goBack:q,updateWizardData:Y,wizardData:V}=e(),Z;if(J[0]===Symbol.for("react.memo_cache_sentinel"))Z={context:"Confirmation"},J[0]=Z;else Z=J[0];t("confirm:no",q,Z);let R;if(J[1]!==X||J[2]!==Y||J[3]!==V.agentType||J[4]!==V.location||J[5]!==V.selectedModel||J[6]!==V.selectedTools||J[7]!==V.systemPrompt||J[8]!==V.whenToUse)R=(K)=>{Y({selectedColor:K,finalAgent:{agentType:V.agentType,whenToUse:V.whenToUse,getSystemPrompt:()=>V.systemPrompt,tools:V.selectedTools,...V.selectedModel?{model:V.selectedModel}:{},...K?{color:K}:{},source:V.location}}),X()},J[1]=X,J[2]=Y,J[3]=V.agentType,J[4]=V.location,J[5]=V.selectedModel,J[6]=V.selectedTools,J[7]=V.systemPrompt,J[8]=V.whenToUse,J[9]=R;else R=J[9];let L=R,H;if(J[10]===Symbol.for("react.memo_cache_sentinel"))H=F(Q0,{children:[Q(n,{shortcut:"↑↓",action:"navigate"}),Q(n,{shortcut:"Enter",action:"select"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"go back"})]}),J[10]=H;else H=J[10];let W=V.agentType||"agent",O;if(J[11]!==L||J[12]!==W)O=Q(Z0,{subtitle:"Choose background color",footerText:H,children:Q(f,{children:Q(MX,{agentName:W,currentColor:"automatic",onConfirm:L})})}),J[11]=L,J[12]=W,J[13]=O;else O=J[13];return O}var OQ;var MQ=$(()=>{R0();b0();N0();z0();w0();O0();P0();jX();p();OQ=o(L0(),1)});function tX(J){if(!J)return"Agent type is required";if(!/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(J))return"Agent type must start and end with alphanumeric characters and contain only letters, numbers, and hyphens";if(J.length<3)return"Agent type must be at least 3 characters long";if(J.length>50)return"Agent type must be less than 50 characters";return null}function kQ(J,X,q){let Y=[],V=[];if(!J.agentType)Y.push("Agent type is required");else{let R=tX(J.agentType);if(R)Y.push(R);let L=q.find((H)=>H.agentType===J.agentType&&H.source!==J.source);if(L)Y.push(`Agent type "${J.agentType}" already exists in ${r0(L.source)}`)}if(!J.whenToUse)Y.push("Description (description) is required");else if(J.whenToUse.length<10)V.push("Description should be more descriptive (at least 10 characters)");else if(J.whenToUse.length>5000)V.push("Description is very long (over 5000 characters)");if(J.tools!==void 0&&!Array.isArray(J.tools))Y.push("Tools must be an array");else{if(J.tools===void 0)V.push("Agent has access to all tools");else if(J.tools.length===0)V.push("No tools selected - agent will have very limited capabilities");let R=fX(J,X,!1);if(R.invalidTools.length>0)Y.push(`Invalid tools: ${R.invalidTools.join(", ")}`)}let Z=J.getSystemPrompt();if(!Z)Y.push("System prompt is required");else if(Z.length<20)Y.push("System prompt is too short (minimum 20 characters)");else if(Z.length>1e4)V.push("System prompt is very long (over 10,000 characters)");return{isValid:Y.length===0,errors:Y,warnings:V}}var XJ=$(()=>{TX();EX()});function NQ(J){let X=EQ.c(88),{tools:q,existingAgents:Y,onSave:V,onSaveAndEdit:Z,error:R}=J,{goBack:L,wizardData:H}=e(),W;if(X[0]===Symbol.for("react.memo_cache_sentinel"))W={context:"Confirmation"},X[0]=W;else W=X[0];t("confirm:no",L,W);let O;if(X[1]!==V||X[2]!==Z)O=(_)=>{if(_.key==="s"||_.key==="return")_.preventDefault(),V();else if(_.key==="e")_.preventDefault(),Z()},X[1]=V,X[2]=Z,X[3]=O;else O=X[3];let K=O,G=H.finalAgent,N,k,w,y,z,D,M,B,v,T,P,g,A,d,i,r,x,E,S;if(X[4]!==G||X[5]!==Y||X[6]!==K||X[7]!==q||X[8]!==H.location){let _=kQ(G,q,Y),l;if(X[28]!==G)l=JJ(G.getSystemPrompt(),240),X[28]=G,X[29]=l;else l=X[29];let s=l,X0;if(X[30]!==G.whenToUse)X0=JJ(G.whenToUse,240),X[30]=G.whenToUse,X[31]=X0;else X0=X[31];let V0=X0,f0=Dq,U0;if(X[32]!==G.memory)U0=S0()?F(U,{children:[Q(U,{bold:!0,children:"Memory"}),": ",WX(G.memory)]}):null,X[32]=G.memory,X[33]=U0;else U0=X[33];let H0=U0;if(k=Z0,P="Confirm and save",X[34]===Symbol.for("react.memo_cache_sentinel"))g=F(Q0,{children:[Q(n,{shortcut:"s/Enter",action:"save"}),Q(n,{shortcut:"e",action:"edit in your editor"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"})]}),X[34]=g;else g=X[34];N=f,A="column",d=0,i=!0,r=K;let W0;if(X[35]===Symbol.for("react.memo_cache_sentinel"))W0=Q(U,{bold:!0,children:"Name"}),X[35]=W0;else W0=X[35];if(X[36]!==G.agentType)x=F(U,{children:[W0,": ",G.agentType]}),X[36]=G.agentType,X[37]=x;else x=X[37];let F0;if(X[38]===Symbol.for("react.memo_cache_sentinel"))F0=Q(U,{bold:!0,children:"Location"}),X[38]=F0;else F0=X[38];let K0;if(X[39]!==G.agentType||X[40]!==H.location)K0=KJ({source:H.location,agentType:G.agentType}),X[39]=G.agentType,X[40]=H.location,X[41]=K0;else K0=X[41];if(X[42]!==K0)E=F(U,{children:[F0,":"," ",K0]}),X[42]=K0,X[43]=E;else E=X[43];let u;if(X[44]===Symbol.for("react.memo_cache_sentinel"))u=Q(U,{bold:!0,children:"Tools"}),X[44]=u;else u=X[44];let h;if(X[45]!==G.tools)h=f0(G.tools),X[45]=G.tools,X[46]=h;else h=X[46];if(X[47]!==h)S=F(U,{children:[u,": ",h]}),X[47]=h,X[48]=S;else S=X[48];let q0;if(X[49]===Symbol.for("react.memo_cache_sentinel"))q0=Q(U,{bold:!0,children:"Model"}),X[49]=q0;else q0=X[49];let J0;if(X[50]!==G.model)J0=OX(G.model),X[50]=G.model,X[51]=J0;else J0=X[51];if(X[52]!==J0)w=F(U,{children:[q0,": ",J0]}),X[52]=J0,X[53]=w;else w=X[53];if(y=H0,X[54]===Symbol.for("react.memo_cache_sentinel"))z=Q(f,{marginTop:1,children:F(U,{children:[Q(U,{bold:!0,children:"Description"})," (tells Claude when to use this agent):"]})}),X[54]=z;else z=X[54];if(X[55]!==V0)D=Q(f,{marginLeft:2,marginTop:1,children:Q(U,{children:V0})}),X[55]=V0,X[56]=D;else D=X[56];if(X[57]===Symbol.for("react.memo_cache_sentinel"))M=Q(f,{marginTop:1,children:F(U,{children:[Q(U,{bold:!0,children:"System prompt"}),":"]})}),X[57]=M;else M=X[57];if(X[58]!==s)B=Q(f,{marginLeft:2,marginTop:1,children:Q(U,{children:s})}),X[58]=s,X[59]=B;else B=X[59];v=_.warnings.length>0&&F(f,{marginTop:1,flexDirection:"column",children:[Q(U,{color:"warning",children:"Warnings:"}),_.warnings.map(vq)]}),T=_.errors.length>0&&F(f,{marginTop:1,flexDirection:"column",children:[Q(U,{color:"error",children:"Errors:"}),_.errors.map(bq)]}),X[4]=G,X[5]=Y,X[6]=K,X[7]=q,X[8]=H.location,X[9]=N,X[10]=k,X[11]=w,X[12]=y,X[13]=z,X[14]=D,X[15]=M,X[16]=B,X[17]=v,X[18]=T,X[19]=P,X[20]=g,X[21]=A,X[22]=d,X[23]=i,X[24]=r,X[25]=x,X[26]=E,X[27]=S}else N=X[9],k=X[10],w=X[11],y=X[12],z=X[13],D=X[14],M=X[15],B=X[16],v=X[17],T=X[18],P=X[19],g=X[20],A=X[21],d=X[22],i=X[23],r=X[24],x=X[25],E=X[26],S=X[27];let I;if(X[60]!==R)I=R&&Q(f,{marginTop:1,children:Q(U,{color:"error",children:R})}),X[60]=R,X[61]=I;else I=X[61];let b;if(X[62]===Symbol.for("react.memo_cache_sentinel"))b=Q(U,{bold:!0,children:"s"}),X[62]=b;else b=X[62];let c;if(X[63]===Symbol.for("react.memo_cache_sentinel"))c=Q(U,{bold:!0,children:"Enter"}),X[63]=c;else c=X[63];let j;if(X[64]===Symbol.for("react.memo_cache_sentinel"))j=Q(f,{marginTop:2,children:F(U,{color:"success",children:["Press ",b," or ",c," to save,"," ",Q(U,{bold:!0,children:"e"})," to save and edit"]})}),X[64]=j;else j=X[64];let C;if(X[65]!==N||X[66]!==w||X[67]!==y||X[68]!==z||X[69]!==D||X[70]!==M||X[71]!==B||X[72]!==v||X[73]!==T||X[74]!==I||X[75]!==A||X[76]!==d||X[77]!==i||X[78]!==r||X[79]!==x||X[80]!==E||X[81]!==S)C=F(N,{flexDirection:A,tabIndex:d,autoFocus:i,onKeyDown:r,children:[x,E,S,w,y,z,D,M,B,v,T,I,j]}),X[65]=N,X[66]=w,X[67]=y,X[68]=z,X[69]=D,X[70]=M,X[71]=B,X[72]=v,X[73]=T,X[74]=I,X[75]=A,X[76]=d,X[77]=i,X[78]=r,X[79]=x,X[80]=E,X[81]=S,X[82]=C;else C=X[82];let m;if(X[83]!==k||X[84]!==P||X[85]!==g||X[86]!==C)m=Q(k,{subtitle:P,footerText:g,children:C}),X[83]=k,X[84]=P,X[85]=g,X[86]=C,X[87]=m;else m=X[87];return m}function bq(J,X){return F(U,{color:"error",children:[" ","• ",J]},X)}function vq(J,X){return F(U,{dimColor:!0,children:[" ","• ",J]},X)}function Dq(J){if(J===void 0)return"All tools";if(J.length===0)return"None";if(J.length===1)return J[0]||"None";if(J.length===2)return J.join(" and ");return`${J.slice(0,-1).join(", ")}, and ${J[J.length-1]}`}var EQ;var zQ=$(()=>{R0();b0();BX();hX();PQ();pX();N0();z0();w0();O0();P0();x0();XJ();p();EQ=o(L0(),1)});import{dirname as Cq}from"path";function IQ({tools:J,existingAgents:X,onComplete:q}){let{wizardData:Y}=e(),[V,Z]=s0.useState(null),R=o0(),L=s0.useCallback(async(O)=>{if(!Y?.finalAgent)return;try{if(await WJ(Y.location,Y.finalAgent.agentType,Y.finalAgent.whenToUse,Y.finalAgent.tools,Y.finalAgent.getSystemPrompt(),!0,Y.finalAgent.color,Y.finalAgent.memory),Y.finalAgent.model){let G=KX({source:Y.location,agentType:Y.finalAgent.agentType}),N=Cq(G);await $0(N,Y.finalAgent.agentType,Y.finalAgent.model)}if(R((G)=>{if(!Y.finalAgent)return G;let N=G.agentDefinitions.allAgents.concat(Y.finalAgent);return{...G,agentDefinitions:{...G.agentDefinitions,activeAgents:n0(N),allAgents:N}}}),O){let G=KX({source:Y.location,agentType:Y.finalAgent.agentType});await zX(G)}IX("tengu_agent_created",{agent_type:Y.finalAgent.agentType,generation_method:Y.wasGenerated?"generated":"manual",source:Y.location,tool_count:Y.finalAgent.tools?.length??"all",has_custom_model:!!Y.finalAgent.model,has_custom_color:!!Y.finalAgent.color,has_memory:!!Y.finalAgent.memory,memory_scope:Y.finalAgent.memory??"none",...O?{opened_in_editor:!0}:{}});let K=O?`Created agent: ${T0.bold(Y.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${T0.bold(Y.finalAgent.agentType)}`;q(K)}catch(K){Z(K instanceof Error?K.message:"Failed to save agent")}},[Y,q,R]),H=s0.useCallback(()=>L(!1),[L]),W=s0.useCallback(()=>L(!0),[L]);return Q(NQ,{tools:J,existingAgents:X,onSave:H,onSaveAndEdit:W,error:V})}var s0;var bQ=$(()=>{gX();BQ();NX();QX();dX();VX();O0();x0();zQ();p();s0=o(k0(),1)});function DQ(){let J=vQ.c(18),{goNext:X,goBack:q,updateWizardData:Y,wizardData:V}=e(),[Z,R]=bX.useState(V.whenToUse||""),[L,H]=bX.useState(Z.length),[W,O]=bX.useState(null),K;if(J[0]===Symbol.for("react.memo_cache_sentinel"))K={context:"Settings"},J[0]=K;else K=J[0];t("confirm:no",q,K);let G;if(J[1]!==Z)G=async()=>{let T=await a0(Z);if(T.content!==null)R(T.content),H(T.content.length)},J[1]=Z,J[2]=G;else G=J[2];let N=G,k;if(J[3]===Symbol.for("react.memo_cache_sentinel"))k={context:"Chat"},J[3]=k;else k=J[3];t("chat:externalEditor",N,k);let w;if(J[4]!==X||J[5]!==Y)w=(T)=>{let P=T.trim();if(!P){O("Description is required");return}O(null),Y({whenToUse:P}),X()},J[4]=X,J[5]=Y,J[6]=w;else w=J[6];let y=w,z;if(J[7]===Symbol.for("react.memo_cache_sentinel"))z=F(Q0,{children:[Q(n,{shortcut:"Type",action:"enter text"}),Q(n,{shortcut:"Enter",action:"continue"}),Q(a,{action:"chat:externalEditor",context:"Chat",fallback:"ctrl+g",description:"open in editor"}),Q(a,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"go back"})]}),J[7]=z;else z=J[7];let D;if(J[8]===Symbol.for("react.memo_cache_sentinel"))D=Q(U,{children:"When should Claude use this agent?"}),J[8]=D;else D=J[8];let M;if(J[9]!==L||J[10]!==y||J[11]!==Z)M=Q(f,{marginTop:1,children:Q(j0,{value:Z,onChange:R,onSubmit:y,placeholder:"e.g., use this agent after you're done writing code...",columns:80,cursorOffset:L,onChangeCursorOffset:H,focus:!0,showCursor:!0})}),J[9]=L,J[10]=y,J[11]=Z,J[12]=M;else M=J[12];let B;if(J[13]!==W)B=W&&Q(f,{marginTop:1,children:Q(U,{color:"error",children:W})}),J[13]=W,J[14]=B;else B=J[14];let v;if(J[15]!==M||J[16]!==B)v=Q(Z0,{subtitle:"Description (tell Claude when to use this agent)",footerText:z,children:F(f,{flexDirection:"column",children:[D,M,B]})}),J[15]=M,J[16]=B,J[17]=v;else v=J[17];return v}var vQ,bX;var CQ=$(()=>{R0();b0();VX();N0();z0();w0();vX();O0();P0();p();vQ=o(L0(),1),bX=o(k0(),1)});async function TQ(J,X,q,Y){let V=q.length>0?`

IMPORTANT: The following identifiers already exist and must NOT be used: ${q.join(", ")}`:"",Z=`Create an agent configuration based on this request: "${J}".${V}
  Return ONLY the JSON object, no other text.`,R=jQ({content:Z}),L=await AQ(),H=_Q([R],L),W=S0()?wQ+Tq:wQ,G=(await pQ({messages:mQ(H),systemPrompt:hQ([W]),thinkingConfig:{type:"disabled"},tools:[],signal:Y,options:{getToolPermissionContext:async()=>yQ(),model:X,toolChoice:void 0,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,querySource:"agent_creation",mcpTools:[]}})).message.content.filter((k)=>k.type==="text").map((k)=>k.text).join(`
`),N;try{N=QJ(G.trim())}catch{let k=G.match(/\{[\s\S]*\}/);if(!k)throw Error("No JSON object found in response");N=QJ(k[0])}if(!N.identifier||!N.whenToUse||!N.systemPrompt)throw Error("Invalid agent configuration generated");return IX("tengu_agent_definition_generated",{agent_identifier:N.identifier}),{identifier:N.identifier,whenToUse:N.whenToUse,systemPrompt:N.systemPrompt}}var wQ,Tq=`

7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.

   Add a section like this to the systemPrompt, tailored to the agent's specific domain:

   "**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.

   Examples of what to record:
   - [domain-specific item 1]
   - [domain-specific item 2]
   - [domain-specific item 3]"

   Examples of domain-specific memory instructions:
   - For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
   - For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
   - For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
   - For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."

   The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
`;var SQ=$(()=>{Aq();pq();yq();hJ();_q();Sq();BX();BQ();wq();hq();wQ=`You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.

**Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.

When a user describes what they want an agent to do, you will:

1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.

2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.

3. **Architect Comprehensive Instructions**: Develop a system prompt that:
   - Establishes clear behavioral boundaries and operational parameters
   - Provides specific methodologies and best practices for task execution
   - Anticipates edge cases and provides guidance for handling them
   - Incorporates any specific requirements or preferences mentioned by the user
   - Defines output format expectations when relevant
   - Aligns with project-specific coding standards and patterns from CLAUDE.md

4. **Optimize for Performance**: Include:
   - Decision-making frameworks appropriate to the domain
   - Quality control mechanisms and self-verification steps
   - Efficient workflow patterns
   - Clear escalation or fallback strategies

5. **Create Identifier**: Design a concise, descriptive identifier that:
   - Uses lowercase letters, numbers, and hyphens only
   - Is typically 2-4 words joined by hyphens
   - Clearly indicates the agent's primary function
   - Is memorable and easy to type
   - Avoids generic terms like "helper" or "assistant"

6 **Example agent descriptions**:
  - in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
  - examples should be of the form:
    - <example>
      Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
      user: "Please write a function that checks if a number is prime"
      assistant: "Here is the relevant function: "
      <function call omitted for brevity only for this example>
      <commentary>
      Since a significant piece of code was written, use the ${YX} tool to launch the test-runner agent to run the tests.
      </commentary>
      assistant: "Now let me use the test-runner agent to run the tests"
    </example>
    - <example>
      Context: User is creating an agent for Claude Code product questions.
      user: "How do I configure Claude Code hooks?"
      assistant: "I'm going to use the ${YX} tool to launch the claudio-guide agent to answer the question"
      <commentary>
      Since the user is asking how to use Claude Code, use the claudio-guide agent.
      </commentary>
    </example>
  - If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
- NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.

Your output must be a valid JSON object with exactly these fields:
{
  "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
  "whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
  "systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
}

Key principles for your system prompts:
- Be specific rather than generic - avoid vague instructions
- Include concrete examples when they would clarify behavior
- Balance comprehensiveness with clarity - every instruction should add value
- Ensure the agent has enough context to handle variations of the core task
- Make the agent proactive in seeking clarification when needed
- Build in quality assurance and self-correction mechanisms

Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
`});function dQ(){let{updateWizardData:J,goBack:X,goToStep:q,wizardData:Y}=e(),[V,Z]=y0.useState(Y.generationPrompt||""),[R,L]=y0.useState(!1),[H,W]=y0.useState(null),[O,K]=y0.useState(V.length),G=gQ(),N=y0.useRef(null),k=y0.useCallback(()=>{if(N.current)N.current.abort(),N.current=null,L(!1),W("Generation cancelled")},[]);t("confirm:no",k,{context:"Settings",isActive:R});let w=y0.useCallback(async()=>{let M=await a0(V);if(M.content!==null)Z(M.content),K(M.content.length)},[V]);t("chat:externalEditor",w,{context:"Chat",isActive:!R});let y=y0.useCallback(()=>{J({generationPrompt:"",agentType:"",systemPrompt:"",whenToUse:"",generatedAgent:void 0,wasGenerated:!1}),Z(""),W(null),X()},[J,X]);t("confirm:no",y,{context:"Settings",isActive:!R});let z=async()=>{let M=V.trim();if(!M){W("Please describe what the agent should do");return}W(null),L(!0),J({generationPrompt:M,isGenerating:!0});let B=cQ();N.current=B;try{let v=await TQ(M,G,[],B.signal);J({agentType:v.identifier,whenToUse:v.whenToUse,systemPrompt:v.systemPrompt,generatedAgent:v,isGenerating:!1,wasGenerated:!0}),q(6)}catch(v){if(v instanceof uQ);else if(v instanceof Error&&!v.message.includes("No assistant message found"))W(v.message||"Failed to generate agent");J({isGenerating:!1})}finally{L(!1),N.current=null}},D="Describe what this agent should do and when it should be used (be comprehensive for best results)";if(R)return Q(Z0,{subtitle:D,footerText:Q(a,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"}),children:F(f,{flexDirection:"row",alignItems:"center",children:[Q(xQ,{}),Q(U,{color:"suggestion",children:" Generating agent from description..."})]})});return Q(Z0,{subtitle:D,footerText:F(Q0,{children:[Q(a,{action:"confirm:yes",context:"Confirmation",fallback:"Enter",description:"submit"}),Q(a,{action:"chat:externalEditor",context:"Chat",fallback:"ctrl+g",description:"open in editor"}),Q(a,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"go back"})]}),children:F(f,{flexDirection:"column",children:[H&&Q(f,{marginBottom:1,children:Q(U,{color:"error",children:H})}),Q(j0,{value:V,onChange:Z,onSubmit:z,placeholder:"e.g., Help me write unit tests for my code...",columns:80,cursorOffset:O,onChangeCursorOffset:K,focus:!0,showCursor:!0})]})})}var y0;var iQ=$(()=>{jq();cq();R0();b0();mq();VX();N0();z0();uq();vX();O0();P0();SQ();p();y0=o(k0(),1)});function rQ(){let J=lQ.c(11),{goNext:X,updateWizardData:q,cancel:Y}=e(),V;if(J[0]===Symbol.for("react.memo_cache_sentinel"))V={label:"Project (.claudio/agents/)",value:"projectSettings"},J[0]=V;else V=J[0];let Z;if(J[1]===Symbol.for("react.memo_cache_sentinel"))Z=[V,{label:"Personal (~/.claudio/agents/)",value:"userSettings"}],J[1]=Z;else Z=J[1];let R=Z,L;if(J[2]===Symbol.for("react.memo_cache_sentinel"))L=F(Q0,{children:[Q(n,{shortcut:"↑↓",action:"navigate"}),Q(n,{shortcut:"Enter",action:"select"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"})]}),J[2]=L;else L=J[2];let H;if(J[3]!==X||J[4]!==q)H=(K)=>{q({location:K}),X()},J[3]=X,J[4]=q,J[5]=H;else H=J[5];let W;if(J[6]!==Y)W=()=>Y(),J[6]=Y,J[7]=W;else W=J[7];let O;if(J[8]!==H||J[9]!==W)O=Q(Z0,{subtitle:"Choose location",footerText:L,children:Q(f,{children:Q(v0,{options:R,onChange:H,onCancel:W},"location-select")})}),J[8]=H,J[9]=W,J[10]=O;else O=J[10];return O}var lQ;var $Q=$(()=>{R0();N0();qX();z0();w0();O0();P0();p();lQ=o(L0(),1)});function sQ(){let J=oQ.c(13),{goNext:X,goBack:q,updateWizardData:Y,wizardData:V}=e(),Z;if(J[0]===Symbol.for("react.memo_cache_sentinel"))Z={context:"Confirmation"},J[0]=Z;else Z=J[0];t("confirm:no",q,Z);let R=V.location==="userSettings",L;if(J[1]!==R)L=R?[{label:"User scope (~/.claudio/agent-memory/) (Recommended)",value:"user"},{label:"None (no persistent memory)",value:"none"},{label:"Project scope (.claudio/agent-memory/)",value:"project"},{label:"Local scope (.claudio/agent-memory-local/)",value:"local"}]:[{label:"Project scope (.claudio/agent-memory/) (Recommended)",value:"project"},{label:"None (no persistent memory)",value:"none"},{label:"User scope (~/.claudio/agent-memory/)",value:"user"},{label:"Local scope (.claudio/agent-memory-local/)",value:"local"}],J[1]=R,J[2]=L;else L=J[2];let H=L,W;if(J[3]!==X||J[4]!==Y||J[5]!==V.finalAgent||J[6]!==V.systemPrompt)W=(N)=>{let k=N==="none"?void 0:N,w=V.finalAgent?.agentType;Y({selectedMemory:k,finalAgent:V.finalAgent?{...V.finalAgent,memory:k,getSystemPrompt:S0()&&k&&w?()=>V.systemPrompt+`

`+nQ(w,k):()=>V.systemPrompt}:void 0}),X()},J[3]=X,J[4]=Y,J[5]=V.finalAgent,J[6]=V.systemPrompt,J[7]=W;else W=J[7];let O=W,K;if(J[8]===Symbol.for("react.memo_cache_sentinel"))K=F(Q0,{children:[Q(n,{shortcut:"↑↓",action:"navigate"}),Q(n,{shortcut:"Enter",action:"select"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"go back"})]}),J[8]=K;else K=J[8];let G;if(J[9]!==q||J[10]!==O||J[11]!==H)G=Q(Z0,{subtitle:"Configure agent memory",footerText:K,children:Q(f,{children:Q(v0,{options:H,onChange:O,onCancel:q},"memory-select")})}),J[9]=q,J[10]=O,J[11]=H,J[12]=G;else G=J[12];return G}var oQ;var aQ=$(()=>{R0();b0();BX();hX();N0();qX();z0();w0();O0();P0();p();oQ=o(L0(),1)});function tQ(){let J=eQ.c(11),{goNext:X,goBack:q,updateWizardData:Y,goToStep:V}=e(),Z;if(J[0]===Symbol.for("react.memo_cache_sentinel"))Z=[{label:"Generate with Claude (recommended)",value:"generate"},{label:"Manual configuration",value:"manual"}],J[0]=Z;else Z=J[0];let R=Z,L;if(J[1]===Symbol.for("react.memo_cache_sentinel"))L=F(Q0,{children:[Q(n,{shortcut:"↑↓",action:"navigate"}),Q(n,{shortcut:"Enter",action:"select"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"go back"})]}),J[1]=L;else L=J[1];let H;if(J[2]!==X||J[3]!==V||J[4]!==Y)H=(K)=>{let G=K;if(Y({method:G,wasGenerated:G==="generate"}),G==="generate")X();else V(3)},J[2]=X,J[3]=V,J[4]=Y,J[5]=H;else H=J[5];let W;if(J[6]!==q)W=()=>q(),J[6]=q,J[7]=W;else W=J[7];let O;if(J[8]!==H||J[9]!==W)O=Q(Z0,{subtitle:"Creation method",footerText:L,children:Q(f,{children:Q(v0,{options:R,onChange:H,onCancel:W},"method-select")})}),J[8]=H,J[9]=W,J[10]=O;else O=J[10];return O}var eQ;var XZ=$(()=>{R0();N0();qX();z0();w0();O0();P0();p();eQ=o(L0(),1)});function QZ(){let J=JZ.c(8),{goNext:X,goBack:q,updateWizardData:Y,wizardData:V}=e(),Z;if(J[0]!==X||J[1]!==Y)Z=(W)=>{Y({selectedModel:W}),X()},J[0]=X,J[1]=Y,J[2]=Z;else Z=J[2];let R=Z,L;if(J[3]===Symbol.for("react.memo_cache_sentinel"))L=F(Q0,{children:[Q(n,{shortcut:"↑↓",action:"navigate"}),Q(n,{shortcut:"Enter",action:"select"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"go back"})]}),J[3]=L;else L=J[3];let H;if(J[4]!==q||J[5]!==R||J[6]!==V.selectedModel)H=Q(Z0,{subtitle:"Select model",footerText:L,children:Q(d0,{initialModel:V.selectedModel,onComplete:R,onCancel:q})}),J[4]=q,J[5]=R,J[6]=V.selectedModel,J[7]=H;else H=J[7];return H}var JZ;var ZZ=$(()=>{N0();z0();w0();O0();P0();kX();p();JZ=o(L0(),1)});function YZ(){let J=qZ.c(20),{goNext:X,goBack:q,updateWizardData:Y,wizardData:V}=e(),[Z,R]=DX.useState(V.systemPrompt||""),[L,H]=DX.useState(Z.length),[W,O]=DX.useState(null),K;if(J[0]===Symbol.for("react.memo_cache_sentinel"))K={context:"Settings"},J[0]=K;else K=J[0];t("confirm:no",q,K);let G;if(J[1]!==Z)G=async()=>{let P=await a0(Z);if(P.content!==null)R(P.content),H(P.content.length)},J[1]=Z,J[2]=G;else G=J[2];let N=G,k;if(J[3]===Symbol.for("react.memo_cache_sentinel"))k={context:"Chat"},J[3]=k;else k=J[3];t("chat:externalEditor",N,k);let w;if(J[4]!==X||J[5]!==Z||J[6]!==Y)w=()=>{let P=Z.trim();if(!P){O("System prompt is required");return}O(null),Y({systemPrompt:P}),X()},J[4]=X,J[5]=Z,J[6]=Y,J[7]=w;else w=J[7];let y=w,z;if(J[8]===Symbol.for("react.memo_cache_sentinel"))z=F(Q0,{children:[Q(n,{shortcut:"Type",action:"enter text"}),Q(n,{shortcut:"Enter",action:"continue"}),Q(a,{action:"chat:externalEditor",context:"Chat",fallback:"ctrl+g",description:"open in editor"}),Q(a,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"go back"})]}),J[8]=z;else z=J[8];let D,M;if(J[9]===Symbol.for("react.memo_cache_sentinel"))D=Q(U,{children:"Enter the system prompt for your agent:"}),M=Q(U,{dimColor:!0,children:"Be comprehensive for best results"}),J[9]=D,J[10]=M;else D=J[9],M=J[10];let B;if(J[11]!==L||J[12]!==y||J[13]!==Z)B=Q(f,{marginTop:1,children:Q(j0,{value:Z,onChange:R,onSubmit:y,placeholder:"You are a helpful code reviewer who...",columns:80,cursorOffset:L,onChangeCursorOffset:H,focus:!0,showCursor:!0})}),J[11]=L,J[12]=y,J[13]=Z,J[14]=B;else B=J[14];let v;if(J[15]!==W)v=W&&Q(f,{marginTop:1,children:Q(U,{color:"error",children:W})}),J[15]=W,J[16]=v;else v=J[16];let T;if(J[17]!==B||J[18]!==v)T=Q(Z0,{subtitle:"System prompt",footerText:z,children:F(f,{flexDirection:"column",children:[D,M,B,v]})}),J[17]=B,J[18]=v,J[19]=T;else T=J[19];return T}var qZ,DX;var VZ=$(()=>{R0();b0();VX();N0();z0();w0();vX();O0();P0();p();qZ=o(L0(),1),DX=o(k0(),1)});function GZ(J){let X=RZ.c(9),{tools:q}=J,{goNext:Y,goBack:V,updateWizardData:Z,wizardData:R}=e(),L;if(X[0]!==Y||X[1]!==Z)L=(G)=>{Z({selectedTools:G}),Y()},X[0]=Y,X[1]=Z,X[2]=L;else L=X[2];let H=L,W=R.selectedTools,O;if(X[3]===Symbol.for("react.memo_cache_sentinel"))O=F(Q0,{children:[Q(n,{shortcut:"Enter",action:"toggle selection"}),Q(n,{shortcut:"↑↓",action:"navigate"}),Q(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"go back"})]}),X[3]=O;else O=X[3];let K;if(X[4]!==V||X[5]!==H||X[6]!==W||X[7]!==q)K=Q(Z0,{subtitle:"Select tools",footerText:O,children:Q(PX,{tools:q,initialTools:W,onComplete:H,onCancel:V})}),X[4]=V,X[5]=H,X[6]=W,X[7]=q,X[8]=K;else K=X[8];return K}var RZ;var LZ=$(()=>{N0();z0();w0();O0();P0();xX();p();RZ=o(L0(),1)});function FZ(J){let X=UZ.c(15),{goNext:q,goBack:Y,updateWizardData:V,wizardData:Z}=e(),[R,L]=CX.useState(Z.agentType||""),[H,W]=CX.useState(null),[O,K]=CX.useState(R.length),G;if(X[0]===Symbol.for("react.memo_cache_sentinel"))G={context:"Settings"},X[0]=G;else G=X[0];t("confirm:no",Y,G);let N;if(X[1]!==q||X[2]!==V)N=(B)=>{let v=B.trim(),T=tX(v);if(T){W(T);return}W(null),V({agentType:v}),q()},X[1]=q,X[2]=V,X[3]=N;else N=X[3];let k=N,w;if(X[4]===Symbol.for("react.memo_cache_sentinel"))w=F(Q0,{children:[Q(n,{shortcut:"Type",action:"enter text"}),Q(n,{shortcut:"Enter",action:"continue"}),Q(a,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"go back"})]}),X[4]=w;else w=X[4];let y;if(X[5]===Symbol.for("react.memo_cache_sentinel"))y=Q(U,{children:"Enter a unique identifier for your agent:"}),X[5]=y;else y=X[5];let z;if(X[6]!==R||X[7]!==O||X[8]!==k)z=Q(f,{marginTop:1,children:Q(j0,{value:R,onChange:L,onSubmit:k,placeholder:"e.g., test-runner, tech-lead, etc",columns:60,cursorOffset:O,onChangeCursorOffset:K,focus:!0,showCursor:!0})}),X[6]=R,X[7]=O,X[8]=k,X[9]=z;else z=X[9];let D;if(X[10]!==H)D=H&&Q(f,{marginTop:1,children:Q(U,{color:"error",children:H})}),X[10]=H,X[11]=D;else D=X[11];let M;if(X[12]!==z||X[13]!==D)M=Q(Z0,{subtitle:"Agent type (identifier)",footerText:w,children:F(f,{flexDirection:"column",children:[y,z,D]})}),X[12]=z,X[13]=D,X[14]=M;else M=X[14];return M}var UZ,CX;var KZ=$(()=>{R0();b0();N0();z0();w0();vX();O0();P0();XJ();p();UZ=o(L0(),1),CX=o(k0(),1)});function WZ(J){let X=HZ.c(17),{tools:q,existingAgents:Y,onComplete:V,onCancel:Z}=J,R;if(X[0]!==Y)R=()=>Q(FZ,{existingAgents:Y}),X[0]=Y,X[1]=R;else R=X[1];let L;if(X[2]!==q)L=()=>Q(GZ,{tools:q}),X[2]=q,X[3]=L;else L=X[3];let H;if(X[4]===Symbol.for("react.memo_cache_sentinel"))H=S0()?[sQ]:[],X[4]=H;else H=X[4];let W;if(X[5]!==Y||X[6]!==V||X[7]!==q)W=()=>Q(IQ,{tools:q,existingAgents:Y,onComplete:V}),X[5]=Y,X[6]=V,X[7]=q,X[8]=W;else W=X[8];let O;if(X[9]!==R||X[10]!==L||X[11]!==W)O=[rQ,tQ,dQ,R,YZ,DQ,L,QZ,fQ,...H,W],X[9]=R,X[10]=L,X[11]=W,X[12]=O;else O=X[12];let K=O,G;if(X[13]===Symbol.for("react.memo_cache_sentinel"))G={},X[13]=G;else G=X[13];let N;if(X[14]!==Z||X[15]!==K)N=Q(nX,{steps:K,initialData:G,onComplete:xq,onCancel:Z,title:"Create new agent",showStepCounter:!1}),X[14]=Z,X[15]=K,X[16]=N;else N=X[16];return N}function xq(){}var HZ;var OZ=$(()=>{BX();O0();MQ();bQ();CQ();iQ();$Q();aQ();XZ();ZZ();VZ();LZ();KZ();p();HZ=o(L0(),1)});function IZ(J){let X=BZ.c(157),{tools:q,onExit:Y}=J,V;if(X[0]===Symbol.for("react.memo_cache_sentinel"))V={mode:"list-agents",source:"all"},X[0]=V;else V=X[0];let[Z,R]=ZJ.useState(V),L=e0(JY),H=e0(XY),W=e0(tq),O=o0(),{allAgents:K,activeAgents:G}=L,N;if(X[1]===Symbol.for("react.memo_cache_sentinel"))N=[],X[1]=N;else N=X[1];let[k,w]=ZJ.useState(N),y=NZ(q,H,W);h0();let z;if(X[2]!==K)z=K.filter(eq),X[2]=K,X[3]=z;else z=X[3];let D;if(X[4]!==K)D=K.filter(aq),X[4]=K,X[5]=D;else D=X[5];let M;if(X[6]!==K)M=K.filter(sq),X[6]=K,X[7]=M;else M=X[7];let B;if(X[8]!==K)B=K.filter(oq),X[8]=K,X[9]=B;else B=X[9];let v;if(X[10]!==K)v=K.filter(nq),X[10]=K,X[11]=v;else v=X[11];let T;if(X[12]!==K)T=K.filter($q),X[12]=K,X[13]=T;else T=X[13];let P;if(X[14]!==K)P=K.filter(rq),X[14]=K,X[15]=P;else P=X[15];let g;if(X[16]!==K||X[17]!==z||X[18]!==D||X[19]!==M||X[20]!==B||X[21]!==v||X[22]!==T||X[23]!==P)g={"built-in":z,userSettings:D,projectSettings:M,policySettings:B,localSettings:v,flagSettings:T,plugin:P,all:K},X[16]=K,X[17]=z,X[18]=D,X[19]=M,X[20]=B,X[21]=v,X[22]=T,X[23]=P,X[24]=g;else g=X[24];let A=g,d;if(X[25]===Symbol.for("react.memo_cache_sentinel"))d=(E)=>{w((S)=>[...S,E]),R({mode:"list-agents",source:"all"})},X[25]=d;else d=X[25];let i=d,r;if(X[26]!==O)r=async(E)=>{try{await fJ(E),O((S)=>{let I=S.agentDefinitions.allAgents.filter((b)=>!(b.agentType===E.agentType&&b.source===E.source));return{...S,agentDefinitions:{...S.agentDefinitions,allAgents:I,activeAgents:n0(I)}}}),w((S)=>[...S,`Deleted agent: ${T0.bold(E.agentType)}`]),R({mode:"list-agents",source:"all"})}catch(S){wX(fZ(S))}},X[26]=O,X[27]=r;else r=X[27];let x=r;switch(Z.mode){case"list-agents":{let E;if(X[28]!==A||X[29]!==Z.source)E=Z.source==="all"?[...A["built-in"],...A.userSettings,...A.projectSettings,...A.localSettings,...A.policySettings,...A.flagSettings,...A.plugin]:A[Z.source],X[28]=A,X[29]=Z.source,X[30]=E;else E=X[30];let S=E,I;if(X[31]!==G||X[32]!==S)I=zZ(S,G),X[31]=G,X[32]=S,X[33]=I;else I=X[33];let c=I,j;if(X[34]!==k||X[35]!==Y)j=()=>{let X0=k.length>0?`Agent changes:
${k.join(`
`)}`:void 0;Y(X0??"Agents dialog dismissed",{display:k.length===0?"system":void 0})},X[34]=k,X[35]=Y,X[36]=j;else j=X[36];let C;if(X[37]!==Z)C=(X0)=>R({mode:"agent-menu",agent:X0,previousMode:Z}),X[37]=Z,X[38]=C;else C=X[38];let m;if(X[39]===Symbol.for("react.memo_cache_sentinel"))m=()=>R({mode:"create-agent"}),X[39]=m;else m=X[39];let _;if(X[40]!==k||X[41]!==Z.source||X[42]!==c||X[43]!==j||X[44]!==C)_=Q(UQ,{source:Z.source,agents:c,onBack:j,onSelect:C,onCreateNew:m,changes:k}),X[40]=k,X[41]=Z.source,X[42]=c,X[43]=j,X[44]=C,X[45]=_;else _=X[45];let l;if(X[46]===Symbol.for("react.memo_cache_sentinel"))l=Q(c0,{}),X[46]=l;else l=X[46];let s;if(X[47]!==_)s=F(G0,{children:[_,l]}),X[47]=_,X[48]=s;else s=X[48];return s}case"create-agent":{let E;if(X[49]===Symbol.for("react.memo_cache_sentinel"))E=()=>R({mode:"list-agents",source:"all"}),X[49]=E;else E=X[49];let S;if(X[50]!==G||X[51]!==y)S=Q(WZ,{tools:y,existingAgents:G,onComplete:i,onCancel:E}),X[50]=G,X[51]=y,X[52]=S;else S=X[52];return S}case"agent-menu":{let E;if(X[53]!==K||X[54]!==Z.agent.agentType||X[55]!==Z.agent.source){let h;if(X[57]!==Z.agent.agentType||X[58]!==Z.agent.source)h=(q0)=>q0.agentType===Z.agent.agentType&&q0.source===Z.agent.source,X[57]=Z.agent.agentType,X[58]=Z.agent.source,X[59]=h;else h=X[59];E=K.find(h),X[53]=K,X[54]=Z.agent.agentType,X[55]=Z.agent.source,X[56]=E}else E=X[56];let I=E||Z.agent,b=I.source!=="built-in"&&I.source!=="plugin"&&I.source!=="flagSettings",c=I.source==="built-in",j;if(X[60]===Symbol.for("react.memo_cache_sentinel"))j={label:"View agent",value:"view"},X[60]=j;else j=X[60];let C;if(b)C=[{label:"Edit agent",value:"edit"},{label:"Change model",value:"change-model"},{label:"Delete agent",value:"delete"}];else if(c)C=[{label:"Change model",value:"change-model"}];else C=[];let m;if(X[63]===Symbol.for("react.memo_cache_sentinel"))m={label:"Back",value:"back"},X[63]=m;else m=X[63];let _;if(X[64]!==C)_=[j,...C,m],X[64]=C,X[65]=_;else _=X[65];let l=_,s;if(X[66]!==I||X[67]!==Z)s=(h)=>{X:switch(h){case"view":{R({mode:"view-agent",agent:I,previousMode:Z.previousMode});break X}case"edit":{R({mode:"edit-agent",agent:I,previousMode:Z});break X}case"delete":{R({mode:"delete-confirm",agent:I,previousMode:Z});break X}case"change-model":{R({mode:"edit-builtin-model",agent:I,previousMode:Z});break X}case"back":R(Z.previousMode)}},X[66]=I,X[67]=Z,X[68]=s;else s=X[68];let X0=s,V0;if(X[69]!==Z.previousMode)V0=()=>R(Z.previousMode),X[69]=Z.previousMode,X[70]=V0;else V0=X[70];let f0;if(X[71]!==Z.previousMode)f0=()=>R(Z.previousMode),X[71]=Z.previousMode,X[72]=f0;else f0=X[72];let U0;if(X[73]!==X0||X[74]!==l||X[75]!==f0)U0=Q(v0,{options:l,onChange:X0,onCancel:f0}),X[73]=X0,X[74]=l,X[75]=f0,X[76]=U0;else U0=X[76];let H0;if(X[77]!==k)H0=k.length>0&&Q(f,{marginTop:1,children:Q(U,{dimColor:!0,children:k[k.length-1]})}),X[77]=k,X[78]=H0;else H0=X[78];let W0;if(X[79]!==U0||X[80]!==H0)W0=F(f,{flexDirection:"column",children:[U0,H0]}),X[79]=U0,X[80]=H0,X[81]=W0;else W0=X[81];let F0;if(X[82]!==Z.agent.agentType||X[83]!==V0||X[84]!==W0)F0=Q(C0,{title:Z.agent.agentType,onCancel:V0,hideInputGuide:!0,children:W0}),X[82]=Z.agent.agentType,X[83]=V0,X[84]=W0,X[85]=F0;else F0=X[85];let K0;if(X[86]===Symbol.for("react.memo_cache_sentinel"))K0=Q(c0,{}),X[86]=K0;else K0=X[86];let u;if(X[87]!==F0)u=F(G0,{children:[F0,K0]}),X[87]=F0,X[88]=u;else u=X[88];return u}case"view-agent":{let E;if(X[89]!==K||X[90]!==Z.agent){let l;if(X[92]!==Z.agent)l=(s)=>s.agentType===Z.agent.agentType&&s.source===Z.agent.source,X[92]=Z.agent,X[93]=l;else l=X[93];E=K.find(l),X[89]=K,X[90]=Z.agent,X[91]=E}else E=X[91];let I=E||Z.agent,b;if(X[94]!==I||X[95]!==Z.previousMode)b=()=>R({mode:"agent-menu",agent:I,previousMode:Z.previousMode}),X[94]=I,X[95]=Z.previousMode,X[96]=b;else b=X[96];let c;if(X[97]!==I||X[98]!==Z.previousMode)c=()=>R({mode:"agent-menu",agent:I,previousMode:Z.previousMode}),X[97]=I,X[98]=Z.previousMode,X[99]=c;else c=X[99];let j;if(X[100]!==I||X[101]!==K||X[102]!==y||X[103]!==c)j=Q(NJ,{agent:I,tools:y,allAgents:K,onBack:c}),X[100]=I,X[101]=K,X[102]=y,X[103]=c,X[104]=j;else j=X[104];let C;if(X[105]!==I.agentType||X[106]!==b||X[107]!==j)C=Q(C0,{title:I.agentType,onCancel:b,hideInputGuide:!0,children:j}),X[105]=I.agentType,X[106]=b,X[107]=j,X[108]=C;else C=X[108];let m;if(X[109]===Symbol.for("react.memo_cache_sentinel"))m=Q(c0,{instructions:"Press Enter or Esc to go back"}),X[109]=m;else m=X[109];let _;if(X[110]!==C)_=F(G0,{children:[C,m]}),X[110]=C,X[111]=_;else _=X[111];return _}case"delete-confirm":{let E;if(X[112]===Symbol.for("react.memo_cache_sentinel"))E=[{label:"Yes, delete",value:"yes"},{label:"No, cancel",value:"no"}],X[112]=E;else E=X[112];let S=E,I;if(X[113]!==Z)I=()=>{if("previousMode"in Z)R(Z.previousMode)},X[113]=Z,X[114]=I;else I=X[114];let b;if(X[115]!==Z.agent.agentType)b=F(U,{children:["Are you sure you want to delete the agent"," ",Q(U,{bold:!0,children:Z.agent.agentType}),"?"]}),X[115]=Z.agent.agentType,X[116]=b;else b=X[116];let c;if(X[117]!==Z.agent.source)c=Q(f,{marginTop:1,children:F(U,{dimColor:!0,children:["Source: ",Z.agent.source]})}),X[117]=Z.agent.source,X[118]=c;else c=X[118];let j;if(X[119]!==x||X[120]!==Z)j=(X0)=>{if(X0==="yes")x(Z.agent);else if("previousMode"in Z)R(Z.previousMode)},X[119]=x,X[120]=Z,X[121]=j;else j=X[121];let C;if(X[122]!==Z)C=()=>{if("previousMode"in Z)R(Z.previousMode)},X[122]=Z,X[123]=C;else C=X[123];let m;if(X[124]!==j||X[125]!==C)m=Q(f,{marginTop:1,children:Q(v0,{options:S,onChange:j,onCancel:C})}),X[124]=j,X[125]=C,X[126]=m;else m=X[126];let _;if(X[127]!==I||X[128]!==b||X[129]!==c||X[130]!==m)_=F(C0,{title:"Delete agent",onCancel:I,color:"error",children:[b,c,m]}),X[127]=I,X[128]=b,X[129]=c,X[130]=m,X[131]=_;else _=X[131];let l;if(X[132]===Symbol.for("react.memo_cache_sentinel"))l=Q(c0,{instructions:"Press ↑↓ to navigate, Enter to select, Esc to cancel"}),X[132]=l;else l=X[132];let s;if(X[133]!==_)s=F(G0,{children:[_,l]}),X[133]=_,X[134]=s;else s=X[134];return s}case"edit-agent":{let E;if(X[135]!==K||X[136]!==Z.agent){let X0;if(X[138]!==Z.agent)X0=(V0)=>V0.agentType===Z.agent.agentType&&V0.source===Z.agent.source,X[138]=Z.agent,X[139]=X0;else X0=X[139];E=K.find(X0),X[135]=K,X[136]=Z.agent,X[137]=E}else E=X[137];let I=E||Z.agent,b=`Edit agent: ${I.agentType}`,c;if(X[140]!==Z.previousMode)c=()=>R(Z.previousMode),X[140]=Z.previousMode,X[141]=c;else c=X[141];let j,C;if(X[142]!==Z.previousMode)j=(X0)=>{i(X0),R(Z.previousMode)},C=()=>R(Z.previousMode),X[142]=Z.previousMode,X[143]=j,X[144]=C;else j=X[143],C=X[144];let m;if(X[145]!==I||X[146]!==y||X[147]!==j||X[148]!==C)m=Q(JQ,{agent:I,tools:y,onSaved:j,onBack:C}),X[145]=I,X[146]=y,X[147]=j,X[148]=C,X[149]=m;else m=X[149];let _;if(X[150]!==b||X[151]!==c||X[152]!==m)_=Q(C0,{title:b,onCancel:c,hideInputGuide:!0,children:m}),X[150]=b,X[151]=c,X[152]=m,X[153]=_;else _=X[153];let l;if(X[154]===Symbol.for("react.memo_cache_sentinel"))l=Q(c0,{}),X[154]=l;else l=X[154];let s;if(X[155]!==_)s=F(G0,{children:[_,l]}),X[155]=_,X[156]=s;else s=X[156];return s}case"edit-builtin-model":{let{agent:E,previousMode:S}=Z,I=async(c)=>{let j=c??"inherit";try{if(E.source==="built-in")MZ((m)=>({...m,agentModelOverrides:{...m.agentModelOverrides??{},[kZ(E.agentType)]:j}}));else if(E.baseDir)$0(E.baseDir,E.agentType,j);else{wX(Error(`Cannot save model override for ${E.agentType}: missing baseDir`)),R(S);return}EZ();let C=await PZ(JX());O((m)=>({...m,agentDefinitions:{...m.agentDefinitions,allAgents:C.allAgents,activeAgents:C.activeAgents}})),w((m)=>[...m,`Set model for ${T0.bold(E.agentType)} → ${j}`])}catch(C){wX(C)}R(S)},b=()=>R(S);return F(G0,{children:[Q(C0,{title:`Change model: ${E.agentType}`,onCancel:b,hideInputGuide:!0,children:Q(d0,{initialModel:E.model??"inherit",onComplete:I,onCancel:b})}),Q(c0,{})]})}default:return null}}function rq(J){return J.source==="plugin"}function $q(J){return J.source==="flagSettings"}function nq(J){return J.source==="localSettings"}function oq(J){return J.source==="policySettings"}function sq(J){return J.source==="projectSettings"}function aq(J){return J.source==="userSettings"}function eq(J){return J.source==="built-in"}function tq(J){return J.toolPermissionContext}function XY(J){return J.mcp.tools}function JY(J){return J.agentDefinitions}var BZ,ZJ;var bZ=$(()=>{gX();RX();lq();R0();NX();GQ();QX();iq();dX();dq();GJ();gq();qX();lX();zJ();QQ();qQ();FQ();kX();x0();RJ();OZ();p();BZ=o(L0(),1),ZJ=o(k0(),1)});function DZ(){let J=e0((q)=>q.tasks),X=Object.values(J).filter((q)=>q.type==="local_agent"&&q.agentType!=="main-session"&&(q.status==="running"||q.status==="pending"));return F(f,{flexDirection:"column",paddingTop:1,children:[Q(u0,{color:"permission"}),Q(f,{flexDirection:"column",paddingX:2,children:X.length===0?Q(f,{marginTop:1,children:Q(U,{dimColor:!0,children:"No subagents are currently running."})}):Q(f,{flexDirection:"column",marginTop:1,gap:1,children:X.map((q)=>{let Y=q.progress?.tokenCount??0,V=q.progress?.toolUseCount??0,Z=q.model??"inherit",R=q.progress?.lastActivity;return F(f,{flexDirection:"column",children:[F(f,{flexDirection:"row",gap:1,children:[Q(U,{bold:!0,children:q.agentType}),Q(U,{dimColor:!0,children:"·"}),Q(U,{dimColor:!0,children:Z}),Q(U,{dimColor:!0,children:"·"}),F(U,{dimColor:!0,children:[vZ(Y)," tokens"]}),V>0&&F(G0,{children:[Q(U,{dimColor:!0,children:"·"}),F(U,{dimColor:!0,children:[V," tool",V!==1?"s":""]})]})]}),R&&Q(f,{paddingLeft:2,children:Q(U,{dimColor:!0,italic:!0,children:R.activityDescription??R.toolName})})]},q.id)})})})]})}var CZ=$(()=>{R0();NX();PQ();uX();p()});function QY({onExit:J}){let X=h0();t("confirm:no",J,{context:"Confirmation",isActive:!0});let q=X.pending?`Press ${X.keyName} again to exit`:"←/→ switch tabs · ↑↓ navigate · Enter select · Esc close";return Q(f,{marginLeft:2,marginTop:1,children:Q(U,{dimColor:!0,children:q})})}function AZ({tools:J,onExit:X}){let[q,Y]=yZ.useState("library");wZ((Z,R)=>{if(R.leftArrow)Y("running");if(R.rightArrow)Y("library")},{isActive:!0});let V=F(f,{flexDirection:"row",gap:1,marginBottom:0,children:[Q(U,{bold:!0,color:"permission",children:"Agents"}),F(U,{bold:q==="running",inverse:q==="running",children:[" ","Running"," "]}),F(U,{bold:q==="library",inverse:q==="library",children:[" ","Library"," "]})]});if(q==="running")return F(f,{flexDirection:"column",children:[V,Q(DZ,{}),Q(QY,{onExit:()=>X("Agents dialog dismissed",{display:"system"})})]});return F(f,{flexDirection:"column",children:[V,Q(IZ,{tools:J,onExit:X})]})}var yZ;var hZ=$(()=>{R0();RX();b0();bZ();CZ();p();yZ=o(k0(),1)});async function LF(J,X){let Y=X.getAppState().toolPermissionContext,V=_Z(Y);return Q(AZ,{tools:V,onExit:J})}var qY=$(()=>{hZ();ZY();p()});qY();export{LF as call};
