makecoder 2.0.71 → 2.0.75

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.
@@ -991,7 +991,7 @@ ${s}
991
991
 
992
992
  ... [${u.toLocaleString()} characters omitted] ...
993
993
 
994
- ${c}`}var kEr="tool-outputs";async function s3(t,e,r,n,o){let s=Cp(e).toLowerCase(),c=Cp(r.toString()).toLowerCase(),u=c.startsWith(s)?`${c}.txt`:`${s}_${c}.txt`,d=qu.join(n,kEr);if(o){let a=Cp(o);d=qu.join(d,`session-${a}`)}let l=qu.join(d,u);return await g2.mkdir(d,{recursive:!0}),await g2.writeFile(l,t),{outputFile:l}}var mh=["run_shell_command","ShellTool"];async function oZe(t){if(Zge.isAbsolute(t))try{return await Tq.promises.access(t,Tq.constants.X_OK),t}catch{return}let e=(process.env.PATH||"").split(Zge.delimiter),r=tZe.platform()==="win32"?[".exe",".cmd",".bat",""]:[""];for(let n of e)for(let o of r){let s=Zge.join(n,t+o);try{return await Tq.promises.access(s,Tq.constants.X_OK),s}catch{continue}}}var qv=null,wq=null,y2=null,Cq=class extends Error{constructor(e){super(`Failed to initialize bash parser: ${e.message}`,{cause:e}),this.name="ShellParserInitializationError"}};function LEr(t){return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("Unknown tree-sitter initialization error",{cause:t})}async function MEr(){try{y2=null;let[t,e]=await Promise.all([Jge(()=>import("./tree-sitter-CZHFXNZB.js"),"web-tree-sitter/tree-sitter.wasm"),Jge(()=>import("./tree-sitter-bash-RYGED55L.js"),"tree-sitter-bash/tree-sitter-bash.wasm")]);await Hge.init({wasmBinary:t}),qv=await $ge.load(e)}catch(t){qv=null;let e=LEr(t),r=e instanceof Cq?e:new Cq(e);throw y2=r,r}}async function yh(){wq||(wq=MEr().catch(t=>{wq=null,U.debug("Failed to initialize shell parsers:",t)})),await wq}var sZe="__GCLI_POWERSHELL_COMMAND__",BEr=1e3*1e3,UEr=Buffer.from(`
994
+ ${c}`}var kEr="tool-outputs";async function s3(t,e,r,n,o){let s=Cp(e).toLowerCase(),c=Cp(r.toString()).toLowerCase(),u=c.startsWith(s)?`${c}.txt`:`${s}_${c}.txt`,d=qu.join(n,kEr);if(o){let a=Cp(o);d=qu.join(d,`session-${a}`)}let l=qu.join(d,u);return await g2.mkdir(d,{recursive:!0}),await g2.writeFile(l,t),{outputFile:l}}var mh=["run_shell_command","ShellTool"];async function oZe(t){if(Zge.isAbsolute(t))try{return await Tq.promises.access(t,Tq.constants.X_OK),t}catch{return}let e=(process.env.PATH||"").split(Zge.delimiter),r=tZe.platform()==="win32"?[".exe",".cmd",".bat",""]:[""];for(let n of e)for(let o of r){let s=Zge.join(n,t+o);try{return await Tq.promises.access(s,Tq.constants.X_OK),s}catch{continue}}}var qv=null,wq=null,y2=null,Cq=class extends Error{constructor(e){super(`Failed to initialize bash parser: ${e.message}`,{cause:e}),this.name="ShellParserInitializationError"}};function LEr(t){return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("Unknown tree-sitter initialization error",{cause:t})}async function MEr(){try{y2=null;let[t,e]=await Promise.all([Jge(()=>import("./tree-sitter-JHZH2GQM.js"),"web-tree-sitter/tree-sitter.wasm"),Jge(()=>import("./tree-sitter-bash-KH6DKFBJ.js"),"tree-sitter-bash/tree-sitter-bash.wasm")]);await Hge.init({wasmBinary:t}),qv=await $ge.load(e)}catch(t){qv=null;let e=LEr(t),r=e instanceof Cq?e:new Cq(e);throw y2=r,r}}async function yh(){wq||(wq=MEr().catch(t=>{wq=null,U.debug("Failed to initialize shell parsers:",t)})),await wq}var sZe="__GCLI_POWERSHELL_COMMAND__",BEr=1e3*1e3,UEr=Buffer.from(`
995
995
  $ErrorActionPreference = 'Stop'
996
996
  $commandText = $env:${sZe}
997
997
  if ([string]::IsNullOrEmpty($commandText)) {
@@ -2839,7 +2839,7 @@ When adding a memory, route it to the right store:
2839
2839
  # Insufficient context
2840
2840
  If you find that you have insufficient context to read or modify the memories as described,
2841
2841
  reply with what you need, and exit. Do not search the codebase for the missing context.
2842
- `.trim();return{kind:"local",name:"save_memory",displayName:"Memory Manager",description:"Writes and reads memory, preferences or facts across ALL future sessions. Use this for recurring instructions like coding styles or tool aliases.",inputConfig:{inputSchema:{type:"object",properties:{request:{type:"string",description:'The memory operation to perform. Examples: "Remember that I prefer tabs over spaces", "Clean up stale memories", "De-duplicate my memories", "Organize my memories".'}},required:["request"]}},outputConfig:{outputName:"result",description:"A summary of the memory operations performed.",schema:l_i},modelConfig:{model:s2},toolConfig:{tools:[ki,Hl,$l,l2,Vl,Ni,qo]},get promptConfig(){return{systemPrompt:n(),query:`${r()}\${request}`}},runConfig:{maxTimeMinutes:5,maxTurns:10}}};var Xf=class t{static MAX_AUTH_RETRIES=2;authRetryCount=0;async shouldRetryWithHeaders(e,r){if(r.status===401||r.status===403)return this.authRetryCount>=t.MAX_AUTH_RETRIES?void 0:(this.authRetryCount++,this.headers());this.authRetryCount=0}async initialize(){}};var tpr=6e4;async function Yb(t){if(t.startsWith("$$")||t.startsWith("!!"))return t.slice(1);if(t.startsWith("$")){let e=t.slice(1),r=process.env[e];if(r===void 0||r==="")throw new Error(`Environment variable '${e}' is not set or is empty. Please set it before using this agent.`);return U.debug(`[AuthValueResolver] Resolved env var: ${e}`),r}if(t.startsWith("!")){let e=t.slice(1).trim();if(!e)throw new Error("Empty command in auth value. Expected format: !command");U.debug("[AuthValueResolver] Executing command for auth value");let r=$A();try{let{stdout:n}=await xp(r.executable,[...r.argsPrefix,e],{signal:AbortSignal.timeout(tpr),windowsHide:!0}),o=n.trim();if(!o)throw new Error(`Command '${e}' returned empty output`);return o}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error(`Command '${e}' timed out after ${tpr/1e3} seconds`):n}}return t}function rpr(t){return t.startsWith("$")||t.startsWith("!")}var c_i="X-API-Key",Ode=class extends Xf{config;type="apiKey";resolvedKey;headerName;constructor(e){super(),this.config=e,this.headerName=e.name??c_i}async initialize(){rpr(this.config.key)?(this.resolvedKey=await Yb(this.config.key),U.debug(`[ApiKeyAuthProvider] Resolved API key from: ${this.config.key.startsWith("$")?"env var":"command"}`)):this.resolvedKey=this.config.key}async headers(){if(!this.resolvedKey)throw new Error("ApiKeyAuthProvider not initialized. Call initialize() first.");return{[this.headerName]:this.resolvedKey}}async shouldRetryWithHeaders(e,r){if(r.status!==401&&r.status!==403){this.authRetryCount=0;return}if(!(!this.config.key.startsWith("!")||this.config.key.startsWith("!!"))&&!(this.authRetryCount>=Xf.MAX_AUTH_RETRIES))return this.authRetryCount++,U.debug("[ApiKeyAuthProvider] Re-resolving API key after auth failure"),this.resolvedKey=await Yb(this.config.key),this.headers()}};var Ide=class extends Xf{config;type="http";resolvedToken;resolvedUsername;resolvedPassword;resolvedValue;constructor(e){super(),this.config=e}async initialize(){let e=this.config;"token"in e?this.resolvedToken=await Yb(e.token):"username"in e?(this.resolvedUsername=await Yb(e.username),this.resolvedPassword=await Yb(e.password)):this.resolvedValue=await Yb(e.value),U.debug(`[HttpAuthProvider] Initialized with scheme: ${this.config.scheme}`)}async headers(){let e=this.config;if("token"in e){if(!this.resolvedToken)throw new Error("HttpAuthProvider not initialized");return{Authorization:`Bearer ${this.resolvedToken}`}}if("username"in e){if(!this.resolvedUsername||!this.resolvedPassword)throw new Error("HttpAuthProvider not initialized");return{Authorization:`Basic ${Buffer.from(`${this.resolvedUsername}:${this.resolvedPassword}`).toString("base64")}`}}if(!this.resolvedValue)throw new Error("HttpAuthProvider not initialized");return{Authorization:`${e.scheme} ${this.resolvedValue}`}}async shouldRetryWithHeaders(e,r){if(r.status===401||r.status===403){if(this.authRetryCount>=Xf.MAX_AUTH_RETRIES)return;U.debug("[HttpAuthProvider] Re-resolving values after auth failure"),await this.initialize()}return super.shouldRetryWithHeaders(e,r)}};var npr=qe(ds(),1);var LC=class extends Error{constructor(e){super(e),this.name="ResourceMismatchError"}},Hk=5*60*1e3,Ls=class{static buildWellKnownUrls(e,r=!1){let n=new URL(e),o=`${n.protocol}//${n.host}`,s=r?"":n.pathname.replace(/\/$/,"");return{protectedResource:new URL(`/.well-known/oauth-protected-resource${s}`,o).toString(),authorizationServer:new URL(`/.well-known/oauth-authorization-server${s}`,o).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return U.debug(`Failed to fetch protected resource metadata from ${e}: ${Te(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return U.debug(`Failed to fetch authorization server metadata from ${e}: ${Te(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,issuer:e.issuer,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[],registrationUrl:e.registration_endpoint}}static async discoverAuthorizationServerMetadata(e){let r=new URL(e),n=`${r.protocol}//${r.host}`,o=[];r.pathname!=="/"&&(o.push(new URL(`/.well-known/oauth-authorization-server${r.pathname}`,n).toString()),o.push(new URL(`/.well-known/openid-configuration${r.pathname}`,n).toString()),o.push(new URL(`${r.pathname}/.well-known/openid-configuration`,n).toString())),o.push(new URL("/.well-known/oauth-authorization-server",n).toString()),o.push(new URL("/.well-known/openid-configuration",n).toString());for(let s of o){let c=await this.fetchAuthorizationServerMetadata(s);if(c)return c}return U.debug(`Metadata discovery failed for authorization server ${e}`),null}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(!n){let s=new URL(e);if(s.pathname&&s.pathname!=="/"){let c=this.buildWellKnownUrls(e,!0);n=await this.fetchProtectedResourceMetadata(c.protectedResource)}}if(n){let s=this.buildResourceParameter(e);if(!this.isEquivalentResourceIdentifier(n.resource,s))throw new LC(`Protected resource ${n.resource} does not match expected ${s}`)}if(n?.authorization_servers?.length){let s=n.authorization_servers[0],c=await this.discoverAuthorizationServerMetadata(s);if(c){let u=this.metadataToOAuthConfig(c);return c.registration_endpoint&&U.log("Dynamic client registration is supported at:",c.registration_endpoint),u}}U.debug(`Trying OAuth discovery fallback at ${e}`);let o=await this.discoverAuthorizationServerMetadata(e);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&U.log("Dynamic client registration is supported at:",o.registration_endpoint),s}return null}catch(r){if(r instanceof LC)throw r;return U.debug(`Failed to discover OAuth configuration: ${Te(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e,r){let n=this.parseWWWAuthenticateHeader(e);if(!n)return null;let o=await this.fetchProtectedResourceMetadata(n);if(o&&r){let u=this.buildResourceParameter(r);if(!this.isEquivalentResourceIdentifier(o.resource,u))throw new LC(`Protected resource ${o.resource} does not match expected ${u}`)}if(!o?.authorization_servers?.length)return null;let s=o.authorization_servers[0],c=await this.discoverAuthorizationServerMetadata(s);return c?this.metadataToOAuthConfig(c):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}${r.pathname}`}static isEquivalentResourceIdentifier(e,r){let n=o=>{try{return this.buildResourceParameter(o)}catch{return o}};return n(e)===n(r)}static parseTokenExpiry(e){try{let r=JSON.parse(Buffer.from(e.split(".")[1],"base64").toString());if(r&&typeof r.exp=="number")return r.exp*1e3}catch(r){U.error("Failed to parse ID token for expiry time with error:",r)}}};var ipr=/^(.*\.)?run\.app$/,u_i=[/^.+\.googleapis\.com$/,ipr],Rde=class extends Xf{config;type="google-credentials";auth;useIdToken=!1;audience;cachedToken;tokenExpiryTime;constructor(e,r){if(super(),this.config=e,!r)throw new Error("targetUrl must be provided to GoogleCredentialsAuthProvider to determine token audience.");let n=new URL(r).hostname;if(ipr.test(n)&&(this.useIdToken=!0),this.audience=n,!this.useIdToken&&!u_i.some(c=>c.test(n)))throw new Error(`Host "${n}" is not an allowed host for Google Credential provider.`);let s=this.config.scopes&&this.config.scopes.length>0?this.config.scopes:["https://www.googleapis.com/auth/cloud-platform"];this.auth=new npr.GoogleAuth({scopes:s})}async initialize(){}async headers(){if(this.cachedToken&&this.tokenExpiryTime&&Date.now()<this.tokenExpiryTime-Hk)return{Authorization:`Bearer ${this.cachedToken}`};if(this.cachedToken=void 0,this.tokenExpiryTime=void 0,this.useIdToken)try{let r=await(await this.auth.getIdTokenClient(this.audience)).idTokenProvider.fetchIdToken(this.audience),n=Ls.parseTokenExpiry(r);return n&&(this.tokenExpiryTime=n,this.cachedToken=r),{Authorization:`Bearer ${r}`}}catch(e){let r=`Failed to get ADC ID token: ${e instanceof Error?e.message:String(e)}`;throw U.error(r,e),new Error(r)}try{let e=await this.auth.getClient(),r=await e.getAccessToken();if(r.token){this.cachedToken=r.token;let n=e.credentials;return n.expiry_date&&(this.tokenExpiryTime=n.expiry_date),{Authorization:`Bearer ${r.token}`}}throw new Error("Failed to retrieve ADC access token.")}catch(e){let r=`Failed to get ADC access token: ${e instanceof Error?e.message:String(e)}`;throw U.error(r,e),new Error(r)}}async shouldRetryWithHeaders(e,r){if(r.status!==401&&r.status!==403){this.authRetryCount=0;return}if(!(this.authRetryCount>=Xf.MAX_AUTH_RETRIES))return this.authRetryCount++,U.debug("[GoogleCredentialsAuthProvider] Re-fetching token after auth failure"),this.cachedToken=void 0,this.tokenExpiryTime=void 0,this.headers()}};var Jb=class t{static async create(e){let{agentName:r,authConfig:n,agentCard:o}=e;if(!n)return o?.securitySchemes&&Object.keys(o.securitySchemes).length>0,void 0;switch(n.type){case"google-credentials":{let s=new Rde(n,e.targetUrl);return await s.initialize(),s}case"apiKey":{let s=new Ode(n);return await s.initialize(),s}case"http":{let s=new Ide(n);return await s.initialize(),s}case"oauth2":{let{OAuth2AuthProvider:s}=await import("./oauth2-provider-KNMGGRK6.js"),c=new s(n,e.agentName??"unknown",o,e.agentCardUrl);return await c.initialize(),c}case"openIdConnect":throw new Error("openIdConnect auth provider not yet implemented");default:{let s=n;throw new Error(`Unknown auth type: ${s.type}`)}}}static async createFromConfig(e,r){return await t.create({authConfig:e,agentName:r})}static validateAuthConfig(e,r){if(!r||Object.keys(r).length===0)return{valid:!0};let n=Object.keys(r);if(!e)return{valid:!1,diff:{requiredSchemes:n,configuredType:void 0,missingConfig:["Authentication is required but not configured"]}};let o=t.findMatchingScheme(e,r);return o.matched?{valid:!0}:{valid:!1,diff:{requiredSchemes:n,configuredType:e.type,missingConfig:o.missingConfig}}}static findMatchingScheme(e,r){let n=[];for(let[o,s]of Object.entries(r))switch(s.type){case"apiKey":if(e.type==="apiKey")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires apiKey authentication`);break;case"http":if(e.type==="http"){if(e.scheme.toLowerCase()===s.scheme.toLowerCase())return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires HTTP ${s.scheme} authentication, but ${e.scheme} was configured`)}else{if(e.type==="google-credentials"&&s.scheme.toLowerCase()==="bearer")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires HTTP ${s.scheme} authentication`)}break;case"oauth2":if(e.type==="oauth2")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires OAuth 2.0 authentication`);break;case"openIdConnect":if(e.type==="openIdConnect")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires OpenID Connect authentication`);break;case"mutualTLS":n.push(`Scheme '${o}' requires mTLS authentication (not yet supported)`);break;default:{let c=s;n.push(`Unknown security scheme type: ${c.type}`)}}return{matched:!1,missingConfig:n}}static describeRequiredAuth(e){let r=[];for(let[n,o]of Object.entries(e))switch(o.type){case"apiKey":r.push(`API Key (${n}): Send ${o.name} in ${o.in}`);break;case"http":r.push(`HTTP ${o.scheme} (${n})`);break;case"oauth2":r.push(`OAuth 2.0 (${n})`);break;case"openIdConnect":r.push(`OpenID Connect (${n})`);break;case"mutualTLS":r.push(`Mutual TLS (${n})`);break;default:{let s=o;r.push(`Unknown (${n}): ${s.type}`)}}return r.join(" OR ")}};var Qm=class extends Error{userMessage;agentName;constructor(e,r,n,o){super(r,o),this.name="A2AAgentError",this.agentName=e,this.userMessage=n}},KVe=class extends Qm{constructor(e,r){let n=`Agent card not found at ${r} (HTTP 404)`,o=`Agent card not found (404) at ${r}. Verify the agent_card_url in your agent definition.`;super(e,n,o),this.name="AgentCardNotFoundError"}},Pde=class extends Qm{statusCode;constructor(e,r,n){let o=n===401?"Unauthorized":"Forbidden",s=`Agent card request returned ${n} ${o} for ${r}`,c=`Authentication failed (${n} ${o}) at ${r}. Check the "auth" configuration in your agent definition.`;super(e,s,c),this.name="AgentCardAuthError",this.statusCode=n}},Nde=class extends Qm{requiredAuth;missingFields;constructor(e,r,n){let o=`Agent "${e}" requires authentication but none is configured`,s=`Agent requires ${r} but no auth is configured. Missing: ${n.join(", ")}`;super(e,o,s),this.name="AgentAuthConfigMissingError",this.requiredAuth=r,this.missingFields=n}},kde=class extends Qm{constructor(e,r,n){let o=n instanceof Error?n.message:String(n),s=`Failed to connect to agent "${e}" at ${r}: ${o}`,c=`Connection failed for ${r}: ${o}`;super(e,s,c,{cause:n}),this.name="AgentConnectionError"}};function d_i(t){return typeof t=="object"&&t!==null}function p_i(t){let e=[],r=t,n=0,o=10;for(;r&&n<o;){if(d_i(r)){let s=r;r instanceof Error?e.push(r.message):typeof s.message=="string"&&e.push(s.message),typeof s.code=="string"&&e.push(s.code),typeof s.status=="number"?e.push(String(s.status)):typeof s.statusCode=="number"&&e.push(String(s.statusCode)),r=s.cause}else if(typeof r=="string"){e.push(r);break}else{e.push(String(r));break}n++}return e.join(" ")}function opr(t,e,r){let n=p_i(r);return/\b(ECONNREFUSED|ENOTFOUND|EHOSTUNREACH|ETIMEDOUT)\b/i.test(n)?new kde(t,e,r):/\b404\b|\bnot[\s_-]?found\b/i.test(n)?new KVe(t,e):/\b401\b|unauthorized/i.test(n)?new Pde(t,e,401):/\b403\b|forbidden/i.test(n)?new Pde(t,e,403):new kde(t,e,r)}function XVe(t){return`${t.name}-config`}var Dde=class{config;agents=new Map;allDefinitions=new Map;builtInAgents=new Set;constructor(e){this.config=e}async initialize(){be.on(Nr.ModelChanged,this.onModelChanged),await this.loadAgents()}isBuiltIn(e){return this.builtInAgents.has(e)}onModelChanged=()=>{this.refreshAgents("local").catch(e=>{U.error("[AgentRegistry] Failed to refresh agents on model change:",e)})};async reload(){this.config.getA2AClientManager()?.clearCache(),await this.config.reloadAgents(),this.agents.clear(),this.allDefinitions.clear(),await this.loadAgents(),be.emitAgentsRefreshed()}async acknowledgeAgent(e){let r=this.config.getAcknowledgedAgentsService(),n=this.config.getProjectRoot();e.metadata?.hash&&(await r.acknowledge(n,e.name,e.metadata.hash),await this.registerAgent(e),be.emitAgentsRefreshed())}dispose(){be.off(Nr.ModelChanged,this.onModelChanged)}async loadAgents(){if(this.agents.clear(),this.allDefinitions.clear(),this.loadBuiltInAgents(),!this.config.isAgentsEnabled())return;let e=dr.getUserAgentsDir(),r=await WVe(e);for(let s of r.errors)U.warn(`[AgentRegistry] Error loading user agent: ${s.message}`),be.emitFeedback("error",`Agent loading error: ${s.message}`);await Promise.allSettled(r.agents.map(async s=>{try{await this.registerAgent(s)}catch(c){U.warn(`[AgentRegistry] Error registering user agent "${s.name}":`,c),be.emitFeedback("error",`Error registering user agent "${s.name}": ${c instanceof Error?c.message:String(c)}`)}}));let n=this.config.getFolderTrust(),o=this.config.isTrustedFolder();if(!n||o){let s=this.config.storage.getProjectAgentsDir(),c=await WVe(s);for(let p of c.errors)be.emitFeedback("error",`Agent loading error: ${p.message}`);let u=this.config.getAcknowledgedAgentsService(),d=this.config.getProjectRoot(),l=[],a=[];for(let p of c.agents){if(p.kind==="remote"&&(p.metadata||(p.metadata={}),p.metadata.hash=p.agentCardUrl??(p.agentCardJson?spr.createHash("sha256").update(p.agentCardJson).digest("hex"):void 0)),!p.metadata?.hash){a.push(p);continue}await u.isAcknowledged(d,p.name,p.metadata.hash)?a.push(p):l.push(p)}l.length>0&&be.emitAgentsDiscovered(l),await Promise.allSettled(a.map(async p=>{try{await this.registerAgent(p)}catch(f){U.warn(`[AgentRegistry] Error registering project agent "${p.name}":`,f),be.emitFeedback("error",`Error registering project agent "${p.name}": ${f instanceof Error?f.message:String(f)}`)}}))}else be.emitFeedback("info","Skipping project agents due to untrusted folder. To enable, ensure that the project root is trusted.");for(let s of this.config.getExtensions())s.isActive&&s.agents&&await Promise.allSettled(s.agents.map(async c=>{try{await this.registerAgent(c)}catch(u){U.warn(`[AgentRegistry] Error registering extension agent "${c.name}":`,u),be.emitFeedback("error",`Error registering extension agent "${c.name}": ${u instanceof Error?u.message:String(u)}`)}}));this.config.getDebugMode()&&U.log(`[AgentRegistry] Loaded with ${this.agents.size} agents.`)}loadBuiltInAgents(){let e=iue(this.config);this.builtInAgents.add(e.name),this.registerLocalAgent(e);let r=Xdr(this.config);this.builtInAgents.add(r.name),this.registerLocalAgent(r);let n=Zdr(this.config);if(this.builtInAgents.add(n.name),this.registerLocalAgent(n),this.config.getBrowserAgentConfig().enabled){let s=xde(this.config);this.builtInAgents.add(s.name),this.registerLocalAgent(s)}if(this.config.isMemoryManagerEnabled()){this.registerLocalAgent(epr(this.config));try{let s=dr.getGlobalGeminiDir();this.config.getWorkspaceContext().addDirectory(s)}catch(s){U.warn("[AgentRegistry] Could not add global .gemini directory to workspace:",s)}}}async refreshAgents(e="all"){this.loadBuiltInAgents(),await Promise.allSettled(Array.from(this.agents.values()).map(async r=>{(e==="all"||r.kind===e)&&await this.registerAgent(r)}))}async registerAgent(e){e.kind==="local"?this.registerLocalAgent(e):e.kind==="remote"&&await this.registerRemoteAgent(e)}registerLocalAgent(e){if(e.kind!=="local")return;if(!e.name||!e.description){U.warn("[AgentRegistry] Skipping invalid agent definition. Missing name or description.");return}this.allDefinitions.set(e.name,e);let r=this.config.getAgentsSettings().overrides?.[e.name];if(!this.isAgentEnabled(e,r)){this.config.getDebugMode()&&U.log(`[AgentRegistry] Skipping disabled agent '${e.name}'`);return}this.agents.has(e.name)&&this.config.getDebugMode()&&U.log(`[AgentRegistry] Overriding agent '${e.name}'`);let n=this.applyOverrides(e,r);this.agents.set(n.name,n),this.registerModelConfigs(n),this.addAgentPolicy(n)}addAgentPolicy(e){let r=this.config.getPolicyEngine();if(r){if(r.hasRuleForTool(e.name,!0)){this.config.getDebugMode()&&U.log(`[AgentRegistry] User policy exists for '${e.name}', skipping dynamic registration.`);return}r.removeRulesForTool(e.name,"AgentRegistry (Dynamic)"),r.addRule({toolName:e.name,decision:e.kind==="local"?ot.ALLOW:ot.ASK_USER,priority:NQ,source:"AgentRegistry (Dynamic)"})}}isAgentEnabled(e,r){let o=!(e.experimental===!0);return r&&r.enabled!==void 0&&(o=r.enabled),o}async registerRemoteAgent(e){if(e.kind!=="remote")return;if(!e.name){U.warn("[AgentRegistry] Skipping invalid agent definition. Missing name.");return}this.allDefinitions.set(e.name,e);let r=this.config.getAgentsSettings().overrides?.[e.name];if(!this.isAgentEnabled(e,r)){this.config.getDebugMode()&&U.log(`[AgentRegistry] Skipping disabled remote agent '${e.name}'`);return}this.agents.has(e.name)&&this.config.getDebugMode()&&U.log(`[AgentRegistry] Overriding agent '${e.name}'`);let n=e;n.originalDescription===void 0&&(n.originalDescription=n.description);try{let o=this.config.getA2AClientManager();if(!o){U.warn(`[AgentRegistry] Skipping remote agent '${e.name}': A2AClientManager is not available.`);return}let s=yde(n),c;if(e.auth){let p=await Jb.create({authConfig:e.auth,agentName:e.name,targetUrl:s,agentCardUrl:n.agentCardUrl});if(!p)throw new Error(`Failed to create auth provider for agent '${e.name}'`);c=p}let u=await o.loadAgent(n.name,mde(n),c);if(u.securitySchemes){let p=Jb.validateAuthConfig(e.auth,u.securitySchemes);if(!p.valid&&p.diff){let f=Jb.describeRequiredAuth(u.securitySchemes),g=new Nde(e.name,f,p.diff.missingConfig);be.emitFeedback("warning",`[${e.name}] Agent requires authentication: ${f}`),U.warn(`[AgentRegistry] ${g.message}`)}}let d=n.originalDescription,l=u.description,a=[];if(d?.trim()&&a.push(`User Description: ${d.trim()}`),l?.trim()&&a.push(`Agent Description: ${l.trim()}`),u.skills&&u.skills.length>0){let p=u.skills.map(f=>`${f.name}: ${f.description||"No description provided"}`).join(`
2842
+ `.trim();return{kind:"local",name:"save_memory",displayName:"Memory Manager",description:"Writes and reads memory, preferences or facts across ALL future sessions. Use this for recurring instructions like coding styles or tool aliases.",inputConfig:{inputSchema:{type:"object",properties:{request:{type:"string",description:'The memory operation to perform. Examples: "Remember that I prefer tabs over spaces", "Clean up stale memories", "De-duplicate my memories", "Organize my memories".'}},required:["request"]}},outputConfig:{outputName:"result",description:"A summary of the memory operations performed.",schema:l_i},modelConfig:{model:s2},toolConfig:{tools:[ki,Hl,$l,l2,Vl,Ni,qo]},get promptConfig(){return{systemPrompt:n(),query:`${r()}\${request}`}},runConfig:{maxTimeMinutes:5,maxTurns:10}}};var Xf=class t{static MAX_AUTH_RETRIES=2;authRetryCount=0;async shouldRetryWithHeaders(e,r){if(r.status===401||r.status===403)return this.authRetryCount>=t.MAX_AUTH_RETRIES?void 0:(this.authRetryCount++,this.headers());this.authRetryCount=0}async initialize(){}};var tpr=6e4;async function Yb(t){if(t.startsWith("$$")||t.startsWith("!!"))return t.slice(1);if(t.startsWith("$")){let e=t.slice(1),r=process.env[e];if(r===void 0||r==="")throw new Error(`Environment variable '${e}' is not set or is empty. Please set it before using this agent.`);return U.debug(`[AuthValueResolver] Resolved env var: ${e}`),r}if(t.startsWith("!")){let e=t.slice(1).trim();if(!e)throw new Error("Empty command in auth value. Expected format: !command");U.debug("[AuthValueResolver] Executing command for auth value");let r=$A();try{let{stdout:n}=await xp(r.executable,[...r.argsPrefix,e],{signal:AbortSignal.timeout(tpr),windowsHide:!0}),o=n.trim();if(!o)throw new Error(`Command '${e}' returned empty output`);return o}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error(`Command '${e}' timed out after ${tpr/1e3} seconds`):n}}return t}function rpr(t){return t.startsWith("$")||t.startsWith("!")}var c_i="X-API-Key",Ode=class extends Xf{config;type="apiKey";resolvedKey;headerName;constructor(e){super(),this.config=e,this.headerName=e.name??c_i}async initialize(){rpr(this.config.key)?(this.resolvedKey=await Yb(this.config.key),U.debug(`[ApiKeyAuthProvider] Resolved API key from: ${this.config.key.startsWith("$")?"env var":"command"}`)):this.resolvedKey=this.config.key}async headers(){if(!this.resolvedKey)throw new Error("ApiKeyAuthProvider not initialized. Call initialize() first.");return{[this.headerName]:this.resolvedKey}}async shouldRetryWithHeaders(e,r){if(r.status!==401&&r.status!==403){this.authRetryCount=0;return}if(!(!this.config.key.startsWith("!")||this.config.key.startsWith("!!"))&&!(this.authRetryCount>=Xf.MAX_AUTH_RETRIES))return this.authRetryCount++,U.debug("[ApiKeyAuthProvider] Re-resolving API key after auth failure"),this.resolvedKey=await Yb(this.config.key),this.headers()}};var Ide=class extends Xf{config;type="http";resolvedToken;resolvedUsername;resolvedPassword;resolvedValue;constructor(e){super(),this.config=e}async initialize(){let e=this.config;"token"in e?this.resolvedToken=await Yb(e.token):"username"in e?(this.resolvedUsername=await Yb(e.username),this.resolvedPassword=await Yb(e.password)):this.resolvedValue=await Yb(e.value),U.debug(`[HttpAuthProvider] Initialized with scheme: ${this.config.scheme}`)}async headers(){let e=this.config;if("token"in e){if(!this.resolvedToken)throw new Error("HttpAuthProvider not initialized");return{Authorization:`Bearer ${this.resolvedToken}`}}if("username"in e){if(!this.resolvedUsername||!this.resolvedPassword)throw new Error("HttpAuthProvider not initialized");return{Authorization:`Basic ${Buffer.from(`${this.resolvedUsername}:${this.resolvedPassword}`).toString("base64")}`}}if(!this.resolvedValue)throw new Error("HttpAuthProvider not initialized");return{Authorization:`${e.scheme} ${this.resolvedValue}`}}async shouldRetryWithHeaders(e,r){if(r.status===401||r.status===403){if(this.authRetryCount>=Xf.MAX_AUTH_RETRIES)return;U.debug("[HttpAuthProvider] Re-resolving values after auth failure"),await this.initialize()}return super.shouldRetryWithHeaders(e,r)}};var npr=qe(ds(),1);var LC=class extends Error{constructor(e){super(e),this.name="ResourceMismatchError"}},Hk=5*60*1e3,Ls=class{static buildWellKnownUrls(e,r=!1){let n=new URL(e),o=`${n.protocol}//${n.host}`,s=r?"":n.pathname.replace(/\/$/,"");return{protectedResource:new URL(`/.well-known/oauth-protected-resource${s}`,o).toString(),authorizationServer:new URL(`/.well-known/oauth-authorization-server${s}`,o).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return U.debug(`Failed to fetch protected resource metadata from ${e}: ${Te(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return U.debug(`Failed to fetch authorization server metadata from ${e}: ${Te(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,issuer:e.issuer,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[],registrationUrl:e.registration_endpoint}}static async discoverAuthorizationServerMetadata(e){let r=new URL(e),n=`${r.protocol}//${r.host}`,o=[];r.pathname!=="/"&&(o.push(new URL(`/.well-known/oauth-authorization-server${r.pathname}`,n).toString()),o.push(new URL(`/.well-known/openid-configuration${r.pathname}`,n).toString()),o.push(new URL(`${r.pathname}/.well-known/openid-configuration`,n).toString())),o.push(new URL("/.well-known/oauth-authorization-server",n).toString()),o.push(new URL("/.well-known/openid-configuration",n).toString());for(let s of o){let c=await this.fetchAuthorizationServerMetadata(s);if(c)return c}return U.debug(`Metadata discovery failed for authorization server ${e}`),null}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(!n){let s=new URL(e);if(s.pathname&&s.pathname!=="/"){let c=this.buildWellKnownUrls(e,!0);n=await this.fetchProtectedResourceMetadata(c.protectedResource)}}if(n){let s=this.buildResourceParameter(e);if(!this.isEquivalentResourceIdentifier(n.resource,s))throw new LC(`Protected resource ${n.resource} does not match expected ${s}`)}if(n?.authorization_servers?.length){let s=n.authorization_servers[0],c=await this.discoverAuthorizationServerMetadata(s);if(c){let u=this.metadataToOAuthConfig(c);return c.registration_endpoint&&U.log("Dynamic client registration is supported at:",c.registration_endpoint),u}}U.debug(`Trying OAuth discovery fallback at ${e}`);let o=await this.discoverAuthorizationServerMetadata(e);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&U.log("Dynamic client registration is supported at:",o.registration_endpoint),s}return null}catch(r){if(r instanceof LC)throw r;return U.debug(`Failed to discover OAuth configuration: ${Te(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e,r){let n=this.parseWWWAuthenticateHeader(e);if(!n)return null;let o=await this.fetchProtectedResourceMetadata(n);if(o&&r){let u=this.buildResourceParameter(r);if(!this.isEquivalentResourceIdentifier(o.resource,u))throw new LC(`Protected resource ${o.resource} does not match expected ${u}`)}if(!o?.authorization_servers?.length)return null;let s=o.authorization_servers[0],c=await this.discoverAuthorizationServerMetadata(s);return c?this.metadataToOAuthConfig(c):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}${r.pathname}`}static isEquivalentResourceIdentifier(e,r){let n=o=>{try{return this.buildResourceParameter(o)}catch{return o}};return n(e)===n(r)}static parseTokenExpiry(e){try{let r=JSON.parse(Buffer.from(e.split(".")[1],"base64").toString());if(r&&typeof r.exp=="number")return r.exp*1e3}catch(r){U.error("Failed to parse ID token for expiry time with error:",r)}}};var ipr=/^(.*\.)?run\.app$/,u_i=[/^.+\.googleapis\.com$/,ipr],Rde=class extends Xf{config;type="google-credentials";auth;useIdToken=!1;audience;cachedToken;tokenExpiryTime;constructor(e,r){if(super(),this.config=e,!r)throw new Error("targetUrl must be provided to GoogleCredentialsAuthProvider to determine token audience.");let n=new URL(r).hostname;if(ipr.test(n)&&(this.useIdToken=!0),this.audience=n,!this.useIdToken&&!u_i.some(c=>c.test(n)))throw new Error(`Host "${n}" is not an allowed host for Google Credential provider.`);let s=this.config.scopes&&this.config.scopes.length>0?this.config.scopes:["https://www.googleapis.com/auth/cloud-platform"];this.auth=new npr.GoogleAuth({scopes:s})}async initialize(){}async headers(){if(this.cachedToken&&this.tokenExpiryTime&&Date.now()<this.tokenExpiryTime-Hk)return{Authorization:`Bearer ${this.cachedToken}`};if(this.cachedToken=void 0,this.tokenExpiryTime=void 0,this.useIdToken)try{let r=await(await this.auth.getIdTokenClient(this.audience)).idTokenProvider.fetchIdToken(this.audience),n=Ls.parseTokenExpiry(r);return n&&(this.tokenExpiryTime=n,this.cachedToken=r),{Authorization:`Bearer ${r}`}}catch(e){let r=`Failed to get ADC ID token: ${e instanceof Error?e.message:String(e)}`;throw U.error(r,e),new Error(r)}try{let e=await this.auth.getClient(),r=await e.getAccessToken();if(r.token){this.cachedToken=r.token;let n=e.credentials;return n.expiry_date&&(this.tokenExpiryTime=n.expiry_date),{Authorization:`Bearer ${r.token}`}}throw new Error("Failed to retrieve ADC access token.")}catch(e){let r=`Failed to get ADC access token: ${e instanceof Error?e.message:String(e)}`;throw U.error(r,e),new Error(r)}}async shouldRetryWithHeaders(e,r){if(r.status!==401&&r.status!==403){this.authRetryCount=0;return}if(!(this.authRetryCount>=Xf.MAX_AUTH_RETRIES))return this.authRetryCount++,U.debug("[GoogleCredentialsAuthProvider] Re-fetching token after auth failure"),this.cachedToken=void 0,this.tokenExpiryTime=void 0,this.headers()}};var Jb=class t{static async create(e){let{agentName:r,authConfig:n,agentCard:o}=e;if(!n)return o?.securitySchemes&&Object.keys(o.securitySchemes).length>0,void 0;switch(n.type){case"google-credentials":{let s=new Rde(n,e.targetUrl);return await s.initialize(),s}case"apiKey":{let s=new Ode(n);return await s.initialize(),s}case"http":{let s=new Ide(n);return await s.initialize(),s}case"oauth2":{let{OAuth2AuthProvider:s}=await import("./oauth2-provider-224QQNUV.js"),c=new s(n,e.agentName??"unknown",o,e.agentCardUrl);return await c.initialize(),c}case"openIdConnect":throw new Error("openIdConnect auth provider not yet implemented");default:{let s=n;throw new Error(`Unknown auth type: ${s.type}`)}}}static async createFromConfig(e,r){return await t.create({authConfig:e,agentName:r})}static validateAuthConfig(e,r){if(!r||Object.keys(r).length===0)return{valid:!0};let n=Object.keys(r);if(!e)return{valid:!1,diff:{requiredSchemes:n,configuredType:void 0,missingConfig:["Authentication is required but not configured"]}};let o=t.findMatchingScheme(e,r);return o.matched?{valid:!0}:{valid:!1,diff:{requiredSchemes:n,configuredType:e.type,missingConfig:o.missingConfig}}}static findMatchingScheme(e,r){let n=[];for(let[o,s]of Object.entries(r))switch(s.type){case"apiKey":if(e.type==="apiKey")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires apiKey authentication`);break;case"http":if(e.type==="http"){if(e.scheme.toLowerCase()===s.scheme.toLowerCase())return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires HTTP ${s.scheme} authentication, but ${e.scheme} was configured`)}else{if(e.type==="google-credentials"&&s.scheme.toLowerCase()==="bearer")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires HTTP ${s.scheme} authentication`)}break;case"oauth2":if(e.type==="oauth2")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires OAuth 2.0 authentication`);break;case"openIdConnect":if(e.type==="openIdConnect")return{matched:!0,missingConfig:[]};n.push(`Scheme '${o}' requires OpenID Connect authentication`);break;case"mutualTLS":n.push(`Scheme '${o}' requires mTLS authentication (not yet supported)`);break;default:{let c=s;n.push(`Unknown security scheme type: ${c.type}`)}}return{matched:!1,missingConfig:n}}static describeRequiredAuth(e){let r=[];for(let[n,o]of Object.entries(e))switch(o.type){case"apiKey":r.push(`API Key (${n}): Send ${o.name} in ${o.in}`);break;case"http":r.push(`HTTP ${o.scheme} (${n})`);break;case"oauth2":r.push(`OAuth 2.0 (${n})`);break;case"openIdConnect":r.push(`OpenID Connect (${n})`);break;case"mutualTLS":r.push(`Mutual TLS (${n})`);break;default:{let s=o;r.push(`Unknown (${n}): ${s.type}`)}}return r.join(" OR ")}};var Qm=class extends Error{userMessage;agentName;constructor(e,r,n,o){super(r,o),this.name="A2AAgentError",this.agentName=e,this.userMessage=n}},KVe=class extends Qm{constructor(e,r){let n=`Agent card not found at ${r} (HTTP 404)`,o=`Agent card not found (404) at ${r}. Verify the agent_card_url in your agent definition.`;super(e,n,o),this.name="AgentCardNotFoundError"}},Pde=class extends Qm{statusCode;constructor(e,r,n){let o=n===401?"Unauthorized":"Forbidden",s=`Agent card request returned ${n} ${o} for ${r}`,c=`Authentication failed (${n} ${o}) at ${r}. Check the "auth" configuration in your agent definition.`;super(e,s,c),this.name="AgentCardAuthError",this.statusCode=n}},Nde=class extends Qm{requiredAuth;missingFields;constructor(e,r,n){let o=`Agent "${e}" requires authentication but none is configured`,s=`Agent requires ${r} but no auth is configured. Missing: ${n.join(", ")}`;super(e,o,s),this.name="AgentAuthConfigMissingError",this.requiredAuth=r,this.missingFields=n}},kde=class extends Qm{constructor(e,r,n){let o=n instanceof Error?n.message:String(n),s=`Failed to connect to agent "${e}" at ${r}: ${o}`,c=`Connection failed for ${r}: ${o}`;super(e,s,c,{cause:n}),this.name="AgentConnectionError"}};function d_i(t){return typeof t=="object"&&t!==null}function p_i(t){let e=[],r=t,n=0,o=10;for(;r&&n<o;){if(d_i(r)){let s=r;r instanceof Error?e.push(r.message):typeof s.message=="string"&&e.push(s.message),typeof s.code=="string"&&e.push(s.code),typeof s.status=="number"?e.push(String(s.status)):typeof s.statusCode=="number"&&e.push(String(s.statusCode)),r=s.cause}else if(typeof r=="string"){e.push(r);break}else{e.push(String(r));break}n++}return e.join(" ")}function opr(t,e,r){let n=p_i(r);return/\b(ECONNREFUSED|ENOTFOUND|EHOSTUNREACH|ETIMEDOUT)\b/i.test(n)?new kde(t,e,r):/\b404\b|\bnot[\s_-]?found\b/i.test(n)?new KVe(t,e):/\b401\b|unauthorized/i.test(n)?new Pde(t,e,401):/\b403\b|forbidden/i.test(n)?new Pde(t,e,403):new kde(t,e,r)}function XVe(t){return`${t.name}-config`}var Dde=class{config;agents=new Map;allDefinitions=new Map;builtInAgents=new Set;constructor(e){this.config=e}async initialize(){be.on(Nr.ModelChanged,this.onModelChanged),await this.loadAgents()}isBuiltIn(e){return this.builtInAgents.has(e)}onModelChanged=()=>{this.refreshAgents("local").catch(e=>{U.error("[AgentRegistry] Failed to refresh agents on model change:",e)})};async reload(){this.config.getA2AClientManager()?.clearCache(),await this.config.reloadAgents(),this.agents.clear(),this.allDefinitions.clear(),await this.loadAgents(),be.emitAgentsRefreshed()}async acknowledgeAgent(e){let r=this.config.getAcknowledgedAgentsService(),n=this.config.getProjectRoot();e.metadata?.hash&&(await r.acknowledge(n,e.name,e.metadata.hash),await this.registerAgent(e),be.emitAgentsRefreshed())}dispose(){be.off(Nr.ModelChanged,this.onModelChanged)}async loadAgents(){if(this.agents.clear(),this.allDefinitions.clear(),this.loadBuiltInAgents(),!this.config.isAgentsEnabled())return;let e=dr.getUserAgentsDir(),r=await WVe(e);for(let s of r.errors)U.warn(`[AgentRegistry] Error loading user agent: ${s.message}`),be.emitFeedback("error",`Agent loading error: ${s.message}`);await Promise.allSettled(r.agents.map(async s=>{try{await this.registerAgent(s)}catch(c){U.warn(`[AgentRegistry] Error registering user agent "${s.name}":`,c),be.emitFeedback("error",`Error registering user agent "${s.name}": ${c instanceof Error?c.message:String(c)}`)}}));let n=this.config.getFolderTrust(),o=this.config.isTrustedFolder();if(!n||o){let s=this.config.storage.getProjectAgentsDir(),c=await WVe(s);for(let p of c.errors)be.emitFeedback("error",`Agent loading error: ${p.message}`);let u=this.config.getAcknowledgedAgentsService(),d=this.config.getProjectRoot(),l=[],a=[];for(let p of c.agents){if(p.kind==="remote"&&(p.metadata||(p.metadata={}),p.metadata.hash=p.agentCardUrl??(p.agentCardJson?spr.createHash("sha256").update(p.agentCardJson).digest("hex"):void 0)),!p.metadata?.hash){a.push(p);continue}await u.isAcknowledged(d,p.name,p.metadata.hash)?a.push(p):l.push(p)}l.length>0&&be.emitAgentsDiscovered(l),await Promise.allSettled(a.map(async p=>{try{await this.registerAgent(p)}catch(f){U.warn(`[AgentRegistry] Error registering project agent "${p.name}":`,f),be.emitFeedback("error",`Error registering project agent "${p.name}": ${f instanceof Error?f.message:String(f)}`)}}))}else be.emitFeedback("info","Skipping project agents due to untrusted folder. To enable, ensure that the project root is trusted.");for(let s of this.config.getExtensions())s.isActive&&s.agents&&await Promise.allSettled(s.agents.map(async c=>{try{await this.registerAgent(c)}catch(u){U.warn(`[AgentRegistry] Error registering extension agent "${c.name}":`,u),be.emitFeedback("error",`Error registering extension agent "${c.name}": ${u instanceof Error?u.message:String(u)}`)}}));this.config.getDebugMode()&&U.log(`[AgentRegistry] Loaded with ${this.agents.size} agents.`)}loadBuiltInAgents(){let e=iue(this.config);this.builtInAgents.add(e.name),this.registerLocalAgent(e);let r=Xdr(this.config);this.builtInAgents.add(r.name),this.registerLocalAgent(r);let n=Zdr(this.config);if(this.builtInAgents.add(n.name),this.registerLocalAgent(n),this.config.getBrowserAgentConfig().enabled){let s=xde(this.config);this.builtInAgents.add(s.name),this.registerLocalAgent(s)}if(this.config.isMemoryManagerEnabled()){this.registerLocalAgent(epr(this.config));try{let s=dr.getGlobalGeminiDir();this.config.getWorkspaceContext().addDirectory(s)}catch(s){U.warn("[AgentRegistry] Could not add global .gemini directory to workspace:",s)}}}async refreshAgents(e="all"){this.loadBuiltInAgents(),await Promise.allSettled(Array.from(this.agents.values()).map(async r=>{(e==="all"||r.kind===e)&&await this.registerAgent(r)}))}async registerAgent(e){e.kind==="local"?this.registerLocalAgent(e):e.kind==="remote"&&await this.registerRemoteAgent(e)}registerLocalAgent(e){if(e.kind!=="local")return;if(!e.name||!e.description){U.warn("[AgentRegistry] Skipping invalid agent definition. Missing name or description.");return}this.allDefinitions.set(e.name,e);let r=this.config.getAgentsSettings().overrides?.[e.name];if(!this.isAgentEnabled(e,r)){this.config.getDebugMode()&&U.log(`[AgentRegistry] Skipping disabled agent '${e.name}'`);return}this.agents.has(e.name)&&this.config.getDebugMode()&&U.log(`[AgentRegistry] Overriding agent '${e.name}'`);let n=this.applyOverrides(e,r);this.agents.set(n.name,n),this.registerModelConfigs(n),this.addAgentPolicy(n)}addAgentPolicy(e){let r=this.config.getPolicyEngine();if(r){if(r.hasRuleForTool(e.name,!0)){this.config.getDebugMode()&&U.log(`[AgentRegistry] User policy exists for '${e.name}', skipping dynamic registration.`);return}r.removeRulesForTool(e.name,"AgentRegistry (Dynamic)"),r.addRule({toolName:e.name,decision:e.kind==="local"?ot.ALLOW:ot.ASK_USER,priority:NQ,source:"AgentRegistry (Dynamic)"})}}isAgentEnabled(e,r){let o=!(e.experimental===!0);return r&&r.enabled!==void 0&&(o=r.enabled),o}async registerRemoteAgent(e){if(e.kind!=="remote")return;if(!e.name){U.warn("[AgentRegistry] Skipping invalid agent definition. Missing name.");return}this.allDefinitions.set(e.name,e);let r=this.config.getAgentsSettings().overrides?.[e.name];if(!this.isAgentEnabled(e,r)){this.config.getDebugMode()&&U.log(`[AgentRegistry] Skipping disabled remote agent '${e.name}'`);return}this.agents.has(e.name)&&this.config.getDebugMode()&&U.log(`[AgentRegistry] Overriding agent '${e.name}'`);let n=e;n.originalDescription===void 0&&(n.originalDescription=n.description);try{let o=this.config.getA2AClientManager();if(!o){U.warn(`[AgentRegistry] Skipping remote agent '${e.name}': A2AClientManager is not available.`);return}let s=yde(n),c;if(e.auth){let p=await Jb.create({authConfig:e.auth,agentName:e.name,targetUrl:s,agentCardUrl:n.agentCardUrl});if(!p)throw new Error(`Failed to create auth provider for agent '${e.name}'`);c=p}let u=await o.loadAgent(n.name,mde(n),c);if(u.securitySchemes){let p=Jb.validateAuthConfig(e.auth,u.securitySchemes);if(!p.valid&&p.diff){let f=Jb.describeRequiredAuth(u.securitySchemes),g=new Nde(e.name,f,p.diff.missingConfig);be.emitFeedback("warning",`[${e.name}] Agent requires authentication: ${f}`),U.warn(`[AgentRegistry] ${g.message}`)}}let d=n.originalDescription,l=u.description,a=[];if(d?.trim()&&a.push(`User Description: ${d.trim()}`),l?.trim()&&a.push(`Agent Description: ${l.trim()}`),u.skills&&u.skills.length>0){let p=u.skills.map(f=>`${f.name}: ${f.description||"No description provided"}`).join(`
2843
2843
  `);a.push(`Skills:
2844
2844
  ${p}`)}a.length>0&&(e.description=a.join(`
2845
2845
  `)),this.config.getDebugMode()&&U.log(`[AgentRegistry] Registered remote agent '${e.name}' with card: ${e.agentCardUrl??"inline JSON"}`),this.agents.set(e.name,e),this.addAgentPolicy(e)}catch(o){o instanceof Qm?be.emitFeedback("error",`[${e.name}] ${o.userMessage}`):be.emitFeedback("error",`[${e.name}] Failed to load remote agent: ${o instanceof Error?o.message:String(o)}`),U.warn(`[AgentRegistry] Error loading A2A agent "${e.name}":`,o)}}applyOverrides(e,r){if(e.kind!=="local"||!r)return e;let n={get kind(){return e.kind},get name(){return e.name},get displayName(){return e.displayName},get description(){return e.description},get experimental(){return e.experimental},get metadata(){return e.metadata},get inputConfig(){return e.inputConfig},get outputConfig(){return e.outputConfig},get promptConfig(){return e.promptConfig},get toolConfig(){return e.toolConfig},get processOutput(){return e.processOutput},get runConfig(){return r.runConfig?{...e.runConfig,...r.runConfig}:e.runConfig},get modelConfig(){return r.modelConfig?Bk.merge(e.modelConfig,r.modelConfig):e.modelConfig}};return r.tools&&(n.toolConfig={tools:r.tools}),r.mcpServers&&(n.mcpServers={...e.mcpServers,...r.mcpServers}),n}registerModelConfigs(e){let r=e.modelConfig,n=r.model;n==="inherit"&&(n=this.config.getModel());let o={...r,model:n};this.config.modelConfigService.registerRuntimeModelConfig(XVe(e),{modelConfig:o}),o.model&&qs(o.model)&&this.config.modelConfigService.registerRuntimeModelOverride({match:{overrideScope:e.name},modelConfig:{generateContentConfig:o.generateContentConfig}})}getDefinition(e){return this.agents.get(e)}getAllDefinitions(){return Array.from(this.agents.values())}getAllAgentNames(){return Array.from(this.agents.keys())}getAllDiscoveredAgentNames(){return Array.from(this.allDefinitions.keys())}getDiscoveredDefinition(e){return this.allDefinitions.get(e)}};import*as zk from"node:fs/promises";import*as apr from"node:path";var Lde=class{acknowledgedAgents={};loaded=!1;async load(){if(this.loaded)return;let e=dr.getAcknowledgedAgentsPath();try{let r=await zk.readFile(e,"utf-8");this.acknowledgedAgents=JSON.parse(r)}catch(r){(!er(r)||r.code!=="ENOENT")&&U.error("Failed to load acknowledged agents:",Te(r)),this.acknowledgedAgents={}}this.loaded=!0}async save(){let e=dr.getAcknowledgedAgentsPath();try{let r=apr.dirname(e);await zk.mkdir(r,{recursive:!0}),await zk.writeFile(e,JSON.stringify(this.acknowledgedAgents,null,2),"utf-8")}catch(r){U.error("Failed to save acknowledged agents:",Te(r))}}async isAcknowledged(e,r,n){await this.load();let o=this.acknowledgedAgents[e];return o?o[r]===n:!1}async acknowledge(e,r,n){await this.load(),this.acknowledgedAgents[e]||(this.acknowledgedAgents[e]={}),this.acknowledgedAgents[e][r]=n,await this.save()}};function Mde(t,e){let r=/\$\{(\w+)\}/g,n=new Set(Array.from(t.matchAll(r),c=>c[1])),o=new Set(Object.keys(e)),s=Array.from(n).filter(c=>!o.has(c));if(s.length>0)throw new Error(`Template validation failed: Missing required input parameters: ${s.join(", ")}. Available inputs: ${Object.keys(e).join(", ")}`);return t.replace(r,(c,u)=>String(e[u]))}import{AsyncLocalStorage as f_i}from"node:async_hooks";var lpr=new f_i;function ZVe(t,e){return lpr.run(t,e)}function Bde(){return lpr.getStore()}var cpr=qe(mse(),1);function ij(t){return typeof t=="object"&&t!==null&&"callId"in t&&"responseParts"in t}function E6o(t){let{displayName:e,status:r,approvalMode:n,hasResultDisplay:o,parentCallId:s}=t;if(s)return!0;switch(e){case KD:switch(r){case Ue.Scheduled:case Ue.Validating:case Ue.Executing:case Ue.AwaitingApproval:return!0;case Ue.Error:return!o;default:return!1}case nq:case iq:return n===ar.PLAN;default:return!1}}function oj(t,e,r=3){let n=e.map(c=>({name:c,distance:cpr.default.get(t,c)}));n.sort((c,u)=>c.distance-u.distance);let o=n.slice(0,r);if(o.length===0)return"";let s=o.map(c=>`"${c.name}"`).join(", ");return o.length>1?` Did you mean one of: ${s}?`:` Did you mean ${s}?`}function b6o(t,e,r){let n;DQ(t)?n=[t.name,t.constructor.name]:n=[t],n.some(o=>mh.includes(o))&&(n=[...new Set([...n,...mh])]);for(let o of r){let s=o.indexOf("(");if(s===-1){if(n.includes(o))return!0;continue}let c=o.substring(0,s);if(!n.includes(c)||!o.endsWith(")"))continue;let u=o.substring(s+1,o.length-1),d;if(typeof e=="string")d=e;else{if(!("command"in e.params))continue;d=String(e.params.command)}if(n.some(l=>mh.includes(l))&&(d===u||d.startsWith(u+" ")))return!0}return!1}var Ude=class{messageBus;schedulerId;onTerminalCall;activeCalls=new Map;queue=[];_completedBatch=[];constructor(e,r=Prt,n){this.messageBus=e,this.schedulerId=r,this.onTerminalCall=n}addToolCalls(e){this.enqueue(e)}getToolCall(e){return this.activeCalls.get(e)||this.queue.find(r=>r.request.callId===e)||this._completedBatch.find(r=>r.request.callId===e)}enqueue(e){this.queue.push(...e),this.emitUpdate()}dequeue(){let e=this.queue.shift();return e&&(this.activeCalls.set(e.request.callId,e),this.emitUpdate()),e}peekQueue(){return this.queue[0]}get isActive(){return this.activeCalls.size>0}get allActiveCalls(){return Array.from(this.activeCalls.values())}get activeCallCount(){return this.activeCalls.size}get queueLength(){return this.queue.length}get firstActiveCall(){return this.activeCalls.values().next().value}updateStatus(e,r,n){let o=this.activeCalls.get(e);if(!o)return;let s=this.transitionCall(o,r,n);this.activeCalls.set(e,s),this.emitUpdate()}finalizeCall(e){let r=this.activeCalls.get(e);r&&this.isTerminalCall(r)&&(this._completedBatch.push(r),this.activeCalls.delete(e),this.onTerminalCall?.(r),this.emitUpdate())}updateArgs(e,r,n){let o=this.activeCalls.get(e);!o||o.status===Ue.Error||(this.activeCalls.set(e,this.patchCall(o,{request:{...o.request,args:r},invocation:n})),this.emitUpdate())}setOutcome(e,r){let n=this.activeCalls.get(e);n&&(this.activeCalls.set(e,this.patchCall(n,{outcome:r})),this.emitUpdate())}replaceActiveCallWithTailCall(e,r){this.activeCalls.has(e)&&(this.activeCalls.delete(e),this.queue.unshift(r),this.emitUpdate())}cancelAllQueued(e){if(this.queue.length!==0){for(;this.queue.length>0;){let r=this.queue.shift();if(r.status===Ue.Error){this._completedBatch.push(r),this.onTerminalCall?.(r);continue}let n=this.toCancelled(r,e);this._completedBatch.push(n),this.onTerminalCall?.(n)}this.emitUpdate()}}getSnapshot(){return[...this._completedBatch,...Array.from(this.activeCalls.values()),...this.queue]}clearBatch(){this._completedBatch.length!==0&&(this._completedBatch=[],this.emitUpdate())}get completedBatch(){return[...this._completedBatch]}emitUpdate(){let e=this.getSnapshot();this.messageBus.publish({type:Ki.TOOL_CALLS_UPDATE,toolCalls:e,schedulerId:this.schedulerId})}isTerminalCall(e){let{status:r}=e;return r===Ue.Success||r===Ue.Error||r===Ue.Cancelled}transitionCall(e,r,n){switch(r){case Ue.Success:{if(!ij(n))throw new Error(`Invalid data for 'success' transition (callId: ${e.request.callId})`);return this.toSuccess(e,n)}case Ue.Error:{if(!ij(n))throw new Error(`Invalid data for 'error' transition (callId: ${e.request.callId})`);return this.toError(e,n)}case Ue.AwaitingApproval:{if(!n)throw new Error(`Missing data for 'awaiting_approval' transition (callId: ${e.request.callId})`);return this.toAwaitingApproval(e,n)}case Ue.Scheduled:return this.toScheduled(e);case Ue.Cancelled:{if(typeof n!="string"&&!ij(n))throw new Error(`Invalid reason (string) or response for 'cancelled' transition (callId: ${e.request.callId})`);return this.toCancelled(e,n)}case Ue.Validating:return this.toValidating(e);case Ue.Executing:{if(n!==void 0&&!this.isExecutingToolCallPatch(n))throw new Error(`Invalid patch for 'executing' transition (callId: ${e.request.callId})`);return this.toExecuting(e,n)}default:return r}}isExecutingToolCallPatch(e){return typeof e=="object"&&e!==null}validateHasToolAndInvocation(e,r){if(!("tool"in e&&e.tool&&"invocation"in e&&e.invocation))throw new Error(`Invalid state transition: cannot transition to ${r} without tool/invocation (callId: ${e.request.callId})`)}toSuccess(e,r){this.validateHasToolAndInvocation(e,Ue.Success);let n="startTime"in e?e.startTime:void 0;return{request:e.request,tool:e.tool,invocation:e.invocation,status:Ue.Success,response:r,durationMs:n?Date.now()-n:void 0,outcome:e.outcome,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}toError(e,r){let n="startTime"in e?e.startTime:void 0;return{request:e.request,status:Ue.Error,tool:"tool"in e?e.tool:void 0,response:r,durationMs:n?Date.now()-n:void 0,outcome:e.outcome,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}toAwaitingApproval(e,r){this.validateHasToolAndInvocation(e,Ue.AwaitingApproval);let n,o;return this.isEventDrivenApprovalData(r)?(o=r.correlationId,n=r.confirmationDetails):n=r,{request:e.request,tool:e.tool,status:Ue.AwaitingApproval,correlationId:o,confirmationDetails:n,startTime:"startTime"in e?e.startTime:void 0,outcome:e.outcome,invocation:e.invocation,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}isEventDrivenApprovalData(e){return typeof e=="object"&&e!==null&&"correlationId"in e&&"confirmationDetails"in e}toScheduled(e){return this.validateHasToolAndInvocation(e,Ue.Scheduled),{request:e.request,tool:e.tool,status:Ue.Scheduled,startTime:"startTime"in e?e.startTime:void 0,outcome:e.outcome,invocation:e.invocation,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}toCancelled(e,r){this.validateHasToolAndInvocation(e,Ue.Cancelled);let n="startTime"in e?e.startTime:void 0,o;if(this.isWaitingToolCall(e)){let u=e.confirmationDetails;u.type==="edit"&&"fileDiff"in u&&"fileName"in u&&"filePath"in u&&"originalContent"in u&&"newContent"in u&&(o={fileDiff:u.fileDiff,fileName:u.fileName,filePath:u.filePath,originalContent:u.originalContent,newContent:u.newContent,diffStat:u.diffStat??FJe(u.fileDiff)})}let s;if(e.status===Ue.Executing&&e.liveOutput&&(s=e.liveOutput),ij(r)){let u={...r};return u.resultDisplay||(u.resultDisplay=o??s),{request:e.request,tool:e.tool,invocation:e.invocation,status:Ue.Cancelled,response:u,durationMs:n?Date.now()-n:void 0,outcome:e.outcome,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}let c=`[Operation Cancelled] Reason: ${r}`;return{request:e.request,tool:e.tool,invocation:e.invocation,status:Ue.Cancelled,response:{callId:e.request.callId,responseParts:[{functionResponse:{id:e.request.callId,name:e.request.name,response:{error:c}}}],resultDisplay:o??s,error:void 0,errorType:void 0,contentLength:c.length},durationMs:n?Date.now()-n:void 0,outcome:e.outcome,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}isWaitingToolCall(e){return e.status===Ue.AwaitingApproval}patchCall(e,r){return{...e,...r}}toValidating(e){return this.validateHasToolAndInvocation(e,Ue.Validating),{request:e.request,tool:e.tool,status:Ue.Validating,startTime:"startTime"in e?e.startTime:void 0,outcome:e.outcome,invocation:e.invocation,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}toExecuting(e,r){this.validateHasToolAndInvocation(e,Ue.Executing);let n=r,o=n?.liveOutput??("liveOutput"in e?e.liveOutput:void 0),s=n?.pid??("pid"in e?e.pid:void 0),c=n?.progressMessage??("progressMessage"in e?e.progressMessage:void 0),u=n?.progressPercent??("progressPercent"in e?e.progressPercent:void 0),d=n?.progress??("progress"in e?e.progress:void 0),l=n?.progressTotal??("progressTotal"in e?e.progressTotal:void 0);return{request:e.request,tool:e.tool,status:Ue.Executing,startTime:"startTime"in e?e.startTime:void 0,outcome:e.outcome,invocation:e.invocation,liveOutput:o,pid:s,progressMessage:c,progressPercent:u,progress:d,progressTotal:l,schedulerId:e.schedulerId,approvalMode:e.approvalMode}}};import{on as h_i}from"node:events";import{randomUUID as g_i}from"node:crypto";async function m_i(t,e,r){if(r.aborted)throw new Error("Operation cancelled");try{for await(let[n]of h_i(t,Ki.TOOL_CONFIRMATION_RESPONSE,{signal:r})){let o=n;if(o.correlationId===e)return{outcome:o.outcome??(o.confirmed?Ht.ProceedOnce:Ht.Cancel),payload:o.payload}}}catch(n){throw r.aborted||n.name==="AbortError"?new Error("Operation cancelled"):n}throw new Error("Operation cancelled")}async function e$e(t,e,r){let{state:n,onWaitingForConfirmation:o}=r,s=t.request.callId,c=Ht.ModifyWithEditor,u;for(;c===Ht.ModifyWithEditor;){if(e.aborted)throw new Error("Operation cancelled by user");let d=n.getToolCall(s);if(!d||!("invocation"in d))throw new Error(`Tool call ${s} lost during confirmation loop`);let a=await d.invocation.shouldConfirmExecute(e,r.forcedDecision);if(!a){c=Ht.ProceedOnce;break}r.systemMessage&&(a.systemMessage=r.systemMessage),await y_i(r,a);let p=g_i(),f=a;u=f;let g="ideConfirmation"in a?a.ideConfirmation:void 0;n.updateStatus(s,Ue.AwaitingApproval,{confirmationDetails:f,correlationId:p}),o?.(!0);let y=await E_i(r.messageBus,p,e,g);if(o?.(!1),c=y.outcome,"onConfirm"in a&&typeof a.onConfirm=="function"&&await a.onConfirm(c,y.payload),c===Ht.ModifyWithEditor){let _=await A_i(r,t,e);_.error&&be.emitFeedback("error",_.error)}else y.payload&&"newContent"in y.payload&&(await __i(r,t,y.payload,e),c=Ht.ProceedOnce)}return{outcome:c,lastDetails:u}}async function y_i(t,e){t.config.getHookSystem()&&await t.config.getHookSystem()?.fireToolNotificationEvent({...e,onConfirm:async()=>{}})}async function A_i(t,e,r){let{state:n,modifier:o,getPreferredEditor:s}=t,c=s(),u=await o6t(c,r);if(!u)return{error:e6t};let d=await o.handleModifyWithEditor(n.firstActiveCall,u,r);if(d){let l=e.tool.build(d.updatedParams);n.updateArgs(e.request.callId,d.updatedParams,l)}return{}}async function __i(t,e,r,n){let{state:o,modifier:s}=t,c=await s.applyInlineModify(o.firstActiveCall,r,n);if(c){let u=e.tool.build(c.updatedParams);o.updateArgs(e.request.callId,c.updatedParams,u)}}async function E_i(t,e,r,n){let o=new AbortController,s=o.signal,c=()=>o.abort();r.aborted?o.abort():r.addEventListener("abort",c);try{let u=m_i(t,e,s);if(!n)return await u;let d=n.then(l=>({outcome:l.status==="accepted"?Ht.ProceedOnce:Ht.Cancel,payload:l.content?{newContent:l.content}:void 0})).catch(l=>(U.warn("Error waiting for confirmation via IDE",l),new Promise(()=>{})));return await Promise.race([u,d])}finally{r.removeEventListener("abort",c),o.abort()}}function upr(t,e){return{errorMessage:`Tool execution denied by policy.${e?.denyMessage?` ${e.denyMessage}`:""}`,errorType:Be.POLICY_VIOLATION}}async function dpr(t,e,r){let n=t.tool instanceof ci?t.tool.serverName:void 0,o=t.tool.toolAnnotations,s=await e.getPolicyEngine().check({name:t.request.name,args:t.request.args},n,o,r),{decision:c}=s;if(c===ot.ASK_USER&&t.request.isClientInitiated&&!t.request.args?.additional_permissions)return{decision:ot.ALLOW,rule:s.rule};if(c===ot.ASK_USER&&!e.isInteractive())throw new Error(`Tool execution for "${t.tool.displayName||t.tool.name}" requires user confirmation, which is not supported in non-interactive mode.`);return{decision:c,rule:s.rule}}async function ppr(t,e,r,n,o,s){if(b_i(t,e)){n.config.setApprovalMode(ar.AUTO_EDIT);return}let c;if(e===Ht.ProceedAlwaysAndSave&&(n.config&&n.config.isTrustedFolder()&&n.config.getWorkspacePoliciesDir()!==void 0?c="workspace":c="user"),r?.type==="mcp"){await S_i(t,e,r,o,c);return}await v_i(t,e,r,o,c,s,n.config)}function b_i(t,e){return e===Ht.ProceedAlways&&JD.has(t.name)}async function v_i(t,e,r,n,o,s,c){if(e===Ht.ProceedAlways||e===Ht.ProceedAlwaysAndSave){let u=s?.getPolicyUpdateOptions?.(e)||{};if(!u.commandPrefix&&r?.type==="exec")u.commandPrefix=r.rootCommands;else if(!u.argsPattern&&r?.type==="edit"){let d=c?Qo(r.filePath,c.getTargetDir()):r.filePath;u.argsPattern=T1(d)}await n.publish({type:Ki.UPDATE_POLICY,toolName:t.name,persist:e===Ht.ProceedAlwaysAndSave,persistScope:o,...u})}}async function S_i(t,e,r,n,o){if(!(e===Ht.ProceedAlways||e===Ht.ProceedAlwaysTool||e===Ht.ProceedAlwaysServer||e===Ht.ProceedAlwaysAndSave))return;let c=t.name,u=e===Ht.ProceedAlwaysAndSave;e===Ht.ProceedAlwaysServer&&(c=Rv(r.serverName,"*")),await n.publish({type:Ki.UPDATE_POLICY,toolName:c,mcpName:r.serverName,persist:u,persistScope:o})}function t$e(t,e){if(!(t instanceof nKe))return;let n=(e.getMcpClientManager()?.getMcpServers()??e.getMcpServers()??{})[t.serverName];if(n)return{server_name:t.serverName,tool_name:t.serverToolName,command:n.command,args:n.args,cwd:n.cwd,url:n.url??n.httpUrl,tcp:n.tcp}}async function fpr(t,e,r,n,o,s,c,u,d){let l=t.params||{},a=!1,p=[],f=c?t$e(t,c):void 0,g=c?.getHookSystem();if(g&&!d){let _=await g.fireBeforeToolEvent(e,l,f,u);if(_?.shouldStopExecution()){let b=_.getEffectiveReason();return{llmContent:`Agent execution stopped by hook: ${b}`,returnDisplay:`Agent execution stopped by hook: ${b}`,error:{type:Be.STOP_EXECUTION,message:b}}}let E=_?.getBlockingError();if(E?.blocked)return{llmContent:`Tool execution blocked: ${E.reason}`,returnDisplay:`Tool execution blocked: ${E.reason}`,error:{type:Be.EXECUTION_FAILED,message:E.reason}};if(_ instanceof uA){let b=_.getModifiedToolInput();if(b){Object.assign(t.params,b),U.debug(`Tool input modified by hook for ${e}`),a=!0,p=Object.keys(b);try{t=n.build(t.params)}catch(v){return{llmContent:`Tool parameter modification by hook failed validation: ${v instanceof Error?v.message:String(v)}`,returnDisplay:"Tool parameter modification by hook failed validation.",error:{type:Be.INVALID_TOOL_PARAMS,message:String(v)}}}}}}let y=await t.execute(r,o,s);if(a){let _=`
@@ -1,5 +1,5 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
- import{$d as WU,$f as Ure,$g as sv,$l as i3,Ae as tH,Af as IR,B as zD,Bb as RU,Cl as KH,Db as WD,Eb as JD,El as BR,Fi as NH,Fk as PA,Gk as HH,Gl as VH,H as vU,Hb as pR,Ig as hd,Im as h3,J as xU,Jb as QU,Jh as QH,Kb as gR,Ki as MH,Lb as _U,Lc as PU,Mb as FU,Me as nH,Nb as NU,Ne as rH,Ol as WH,P as Xo,Pd as qU,Pl as JH,Qc as CR,Qj as GA,Ql as av,Rc as Lg,Rh as _H,Rl as XH,Sc as jU,Se as iH,Sg as gH,Tc as zU,Td as ZD,Tl as $H,Ui as kH,Ul as ZH,Vh as FH,Vi as OH,Vj as UH,Wb as XD,Wg as yH,X as Ore,Xd as YU,Xf as dH,Xl as e3,Y as BU,Yf as fH,Yg as Ji,Yi as DR,Yl as t3,Z as Og,Zd as KU,Ze as oH,Zf as nv,Zg as ov,Zl as n3,_ as YD,_d as VU,_f as hH,_g as EH,_j as vR,_l as r3,a as Mre,aa as si,ag as ca,ah as CH,al as GH,am as o3,bc as yR,bg as rv,bh as SH,cc as MU,cf as Ug,cg as Hre,ch as bH,cn as A3,dc as kU,dg as Gre,dh as IH,dl as PH,dm as Pg,ec as OU,eh as B0,fc as LU,fd as v0,fh as w0,fm as s3,gc as UU,gh as DH,hc as HU,hh as vH,hi as ua,hl as jH,hm as wR,id as $D,ie as JU,ig as AH,ih as xH,il as zH,im as a3,je as ev,jh as BH,jm as l3,kh as Hg,ki as Hf,kl as xR,lg as iv,lh as wH,li as Gg,mb as KD,mh as TH,nb as mR,nc as ER,ne as XU,nf as Lre,ob as VD,oe as SR,of as sH,ol as qH,om as c3,pb as TU,pe as $U,pf as aH,pm as lv,q as SU,qe as bR,qf as $c,ql as YH,qm as u3,re as ZU,rf as ll,rg as mH,rj as HA,s as bU,se as eH,sf as lH,sg as pH,t as jD,tc as GU,tf as cH,uh as RH,um as d3,vh as oc,vm as f3,x as IU,xe as x0,y as DU,yf as uH,z as AR,ze as tv}from"./chunk-APAUY2EN.js";import{$ as Fi,C as dR,E as fd,Fd as D0,Na as EU,Qc as CU,Qd as wU,Sd as ic,Ud as gt,Z as Uf,a as vt,b as Ee,ba as fR,ca as mU,ea as hR,fa as UD,ia as pU,ja as HD,je as LH,la as kre,lc as GD,mc as PD,na as fr,pa as gU,qa as yU,xd as qD,zd as _t}from"./chunk-SX66NO2U.js";import{a as $n,c as Ae,d as Nre,e as Ce}from"./chunk-YUXORC52.js";var v3=Ae(Vt=>{"use strict";var QR=Symbol.for("react.transitional.element"),Pre=Symbol.for("react.portal"),jre=Symbol.for("react.fragment"),zre=Symbol.for("react.strict_mode"),qre=Symbol.for("react.profiler"),Yre=Symbol.for("react.consumer"),Kre=Symbol.for("react.context"),Vre=Symbol.for("react.forward_ref"),Wre=Symbol.for("react.suspense"),Jre=Symbol.for("react.memo"),E3=Symbol.for("react.lazy"),Xre=Symbol.for("react.activity"),m3=Symbol.iterator;function $re(e){return e===null||typeof e!="object"?null:(e=m3&&e[m3]||e["@@iterator"],typeof e=="function"?e:null)}var C3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S3=Object.assign,b3={};function zg(e,t,n){this.props=e,this.context=t,this.refs=b3,this.updater=n||C3}zg.prototype.isReactComponent={};zg.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};zg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function I3(){}I3.prototype=zg.prototype;function _R(e,t,n){this.props=e,this.context=t,this.refs=b3,this.updater=n||C3}var FR=_R.prototype=new I3;FR.constructor=_R;S3(FR,zg.prototype);FR.isPureReactComponent=!0;var p3=Array.isArray;function RR(){}var wr={H:null,A:null,T:null,S:null},D3=Object.prototype.hasOwnProperty;function NR(e,t,n){var r=n.ref;return{$$typeof:QR,type:e,key:t,ref:r!==void 0?r:null,props:n}}function Zre(e,t){return NR(e.type,t,e.props)}function MR(e){return typeof e=="object"&&e!==null&&e.$$typeof===QR}function eie(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var g3=/\/+/g;function TR(e,t){return typeof e=="object"&&e!==null&&e.key!=null?eie(""+e.key):t.toString(36)}function tie(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(RR,RR):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function jg(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case QR:case Pre:a=!0;break;case E3:return a=e._init,jg(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+TR(e,0):r,p3(i)?(n="",a!=null&&(n=a.replace(g3,"$&/")+"/"),jg(i,t,n,"",function(A){return A})):i!=null&&(MR(i)&&(i=Zre(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(g3,"$&/")+"/")+a)),t.push(i)),1;a=0;var c=r===""?".":r+":";if(p3(e))for(var f=0;f<e.length;f++)r=e[f],s=c+TR(r,f),a+=jg(r,t,n,s,i);else if(f=$re(e),typeof f=="function")for(e=f.call(e),f=0;!(r=e.next()).done;)r=r.value,s=c+TR(r,f++),a+=jg(r,t,n,s,i);else if(s==="object"){if(typeof e.then=="function")return jg(tie(e),t,n,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function cv(e,t,n){if(e==null)return e;var r=[],i=0;return jg(e,r,"","",function(s){return t.call(n,s,i++)}),r}function nie(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var y3=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},rie={map:cv,forEach:function(e,t,n){cv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return cv(e,function(){t++}),t},toArray:function(e){return cv(e,function(t){return t})||[]},only:function(e){if(!MR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Vt.Activity=Xre;Vt.Children=rie;Vt.Component=zg;Vt.Fragment=jre;Vt.Profiler=qre;Vt.PureComponent=_R;Vt.StrictMode=zre;Vt.Suspense=Wre;Vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wr;Vt.__COMPILER_RUNTIME={__proto__:null,c:function(e){return wr.H.useMemoCache(e)}};Vt.cache=function(e){return function(){return e.apply(null,arguments)}};Vt.cacheSignal=function(){return null};Vt.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=S3({},e.props),i=e.key;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)!D3.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(r[s]=t[s]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var a=Array(s),c=0;c<s;c++)a[c]=arguments[c+2];r.children=a}return NR(e.type,i,r)};Vt.createContext=function(e){return e={$$typeof:Kre,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Yre,_context:e},e};Vt.createElement=function(e,t,n){var r,i={},s=null;if(t!=null)for(r in t.key!==void 0&&(s=""+t.key),t)D3.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var c=Array(a),f=0;f<a;f++)c[f]=arguments[f+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return NR(e,s,i)};Vt.createRef=function(){return{current:null}};Vt.forwardRef=function(e){return{$$typeof:Vre,render:e}};Vt.isValidElement=MR;Vt.lazy=function(e){return{$$typeof:E3,_payload:{_status:-1,_result:e},_init:nie}};Vt.memo=function(e,t){return{$$typeof:Jre,type:e,compare:t===void 0?null:t}};Vt.startTransition=function(e){var t=wr.T,n={};wr.T=n;try{var r=e(),i=wr.S;i!==null&&i(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(RR,y3)}catch(s){y3(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),wr.T=t}};Vt.unstable_useCacheRefresh=function(){return wr.H.useCacheRefresh()};Vt.use=function(e){return wr.H.use(e)};Vt.useActionState=function(e,t,n){return wr.H.useActionState(e,t,n)};Vt.useCallback=function(e,t){return wr.H.useCallback(e,t)};Vt.useContext=function(e){return wr.H.useContext(e)};Vt.useDebugValue=function(){};Vt.useDeferredValue=function(e,t){return wr.H.useDeferredValue(e,t)};Vt.useEffect=function(e,t){return wr.H.useEffect(e,t)};Vt.useEffectEvent=function(e){return wr.H.useEffectEvent(e)};Vt.useId=function(){return wr.H.useId()};Vt.useImperativeHandle=function(e,t,n){return wr.H.useImperativeHandle(e,t,n)};Vt.useInsertionEffect=function(e,t){return wr.H.useInsertionEffect(e,t)};Vt.useLayoutEffect=function(e,t){return wr.H.useLayoutEffect(e,t)};Vt.useMemo=function(e,t){return wr.H.useMemo(e,t)};Vt.useOptimistic=function(e,t){return wr.H.useOptimistic(e,t)};Vt.useReducer=function(e,t,n){return wr.H.useReducer(e,t,n)};Vt.useRef=function(e){return wr.H.useRef(e)};Vt.useState=function(e){return wr.H.useState(e)};Vt.useSyncExternalStore=function(e,t,n){return wr.H.useSyncExternalStore(e,t,n)};Vt.useTransition=function(){return wr.H.useTransition()};Vt.version="19.2.4"});var x3=Ae((Pt,uv)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){function e(M,ae){Object.defineProperty(r.prototype,M,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",ae[0],ae[1])}})}function t(M){return M===null||typeof M!="object"?null:(M=Ve&&M[Ve]||M["@@iterator"],typeof M=="function"?M:null)}function n(M,ae){M=(M=M.constructor)&&(M.displayName||M.name)||"ReactClass";var Le=M+"."+ae;Re[Le]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",ae,M),Re[Le]=!0)}function r(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function i(){}function s(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function a(){}function c(M){return""+M}function f(M){try{c(M);var ae=!1}catch{ae=!0}if(ae){ae=console;var Le=ae.error,Je=typeof Symbol=="function"&&Symbol.toStringTag&&M[Symbol.toStringTag]||M.constructor.name||"Object";return Le.call(ae,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Je),c(M)}}function A(M){if(M==null)return null;if(typeof M=="function")return M.$$typeof===Gn?null:M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case ft:return"Fragment";case te:return"Profiler";case Ne:return"StrictMode";case St:return"Suspense";case j:return"SuspenseList";case me:return"Activity"}if(typeof M=="object")switch(typeof M.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),M.$$typeof){case Me:return"Portal";case Oe:return M.displayName||"Context";case _e:return(M._context.displayName||"Context")+".Consumer";case nt:var ae=M.render;return M=M.displayName,M||(M=ae.displayName||ae.name||"",M=M!==""?"ForwardRef("+M+")":"ForwardRef"),M;case q:return ae=M.displayName||null,ae!==null?ae:A(M.type)||"Memo";case Y:ae=M._payload,M=M._init;try{return A(M(ae))}catch{}}return null}function m(M){if(M===ft)return"<>";if(typeof M=="object"&&M!==null&&M.$$typeof===Y)return"<...>";try{var ae=A(M);return ae?"<"+ae+">":"<...>"}catch{return"<...>"}}function y(){var M=pt.A;return M===null?null:M.getOwner()}function C(){return Error("react-stack-top-frame")}function p(M){if(Si.call(M,"key")){var ae=Object.getOwnPropertyDescriptor(M,"key").get;if(ae&&ae.isReactWarning)return!1}return M.key!==void 0}function g(M,ae){function Le(){Jn||(Jn=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",ae))}Le.isReactWarning=!0,Object.defineProperty(M,"key",{get:Le,configurable:!0})}function b(){var M=A(this.type);return to[M]||(to[M]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),M=this.props.ref,M!==void 0?M:null}function v(M,ae,Le,Je,Z,se){var Se=Le.ref;return M={$$typeof:De,type:M,key:ae,props:Le,_owner:Je},(Se!==void 0?Se:null)!==null?Object.defineProperty(M,"ref",{enumerable:!1,get:b}):Object.defineProperty(M,"ref",{enumerable:!1,value:null}),M._store={},Object.defineProperty(M._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(M,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(M,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.defineProperty(M,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(M.props),Object.freeze(M)),M}function w(M,ae){return ae=v(M.type,ae,M.props,M._owner,M._debugStack,M._debugTask),M._store&&(ae._store.validated=M._store.validated),ae}function T(M){_(M)?M._store&&(M._store.validated=1):typeof M=="object"&&M!==null&&M.$$typeof===Y&&(M._payload.status==="fulfilled"?_(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function _(M){return typeof M=="object"&&M!==null&&M.$$typeof===De}function k(M){var ae={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Le){return ae[Le]})}function O(M,ae){return typeof M=="object"&&M!==null&&M.key!=null?(f(M.key),k(""+M.key)):ae.toString(36)}function G(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(a,a):(M.status="pending",M.then(function(ae){M.status==="pending"&&(M.status="fulfilled",M.value=ae)},function(ae){M.status==="pending"&&(M.status="rejected",M.reason=ae)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function W(M,ae,Le,Je,Z){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var Se=!1;if(M===null)Se=!0;else switch(se){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(M.$$typeof){case De:case Me:Se=!0;break;case Y:return Se=M._init,W(Se(M._payload),ae,Le,Je,Z)}}if(Se){Se=M,Z=Z(Se);var Ze=Je===""?"."+O(Se,0):Je;return Fr(Z)?(Le="",Ze!=null&&(Le=Ze.replace(Oi,"$&/")+"/"),W(Z,ae,Le,"",function(mr){return mr})):Z!=null&&(_(Z)&&(Z.key!=null&&(Se&&Se.key===Z.key||f(Z.key)),Le=w(Z,Le+(Z.key==null||Se&&Se.key===Z.key?"":(""+Z.key).replace(Oi,"$&/")+"/")+Ze),Je!==""&&Se!=null&&_(Se)&&Se.key==null&&Se._store&&!Se._store.validated&&(Le._store.validated=2),Z=Le),ae.push(Z)),1}if(Se=0,Ze=Je===""?".":Je+":",Fr(M))for(var Et=0;Et<M.length;Et++)Je=M[Et],se=Ze+O(Je,Et),Se+=W(Je,ae,Le,se,Z);else if(Et=t(M),typeof Et=="function")for(Et===M.entries&&(Nr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Nr=!0),M=Et.call(M),Et=0;!(Je=M.next()).done;)Je=Je.value,se=Ze+O(Je,Et++),Se+=W(Je,ae,Le,se,Z);else if(se==="object"){if(typeof M.then=="function")return W(G(M),ae,Le,Je,Z);throw ae=String(M),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Se}function z(M,ae,Le){if(M==null)return M;var Je=[],Z=0;return W(M,Je,"","",function(se){return ae.call(Le,se,Z++)}),Je}function P(M){if(M._status===-1){var ae=M._ioInfo;ae!=null&&(ae.start=ae.end=performance.now()),ae=M._result;var Le=ae();if(Le.then(function(Z){if(M._status===0||M._status===-1){M._status=1,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="fulfilled",Le.value=Z)}},function(Z){if(M._status===0||M._status===-1){M._status=2,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="rejected",Le.reason=Z)}}),ae=M._ioInfo,ae!=null){ae.value=Le;var Je=Le.displayName;typeof Je=="string"&&(ae.name=Je)}M._status===-1&&(M._status=0,M._result=Le)}if(M._status===1)return ae=M._result,ae===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
2
+ import{$d as WU,$f as Ure,$g as sv,$l as i3,Ae as tH,Af as IR,B as zD,Bb as RU,Cl as KH,Db as WD,Eb as JD,El as BR,Fi as NH,Fk as PA,Gk as HH,Gl as VH,H as vU,Hb as pR,Ig as hd,Im as h3,J as xU,Jb as QU,Jh as QH,Kb as gR,Ki as MH,Lb as _U,Lc as PU,Mb as FU,Me as nH,Nb as NU,Ne as rH,Ol as WH,P as Xo,Pd as qU,Pl as JH,Qc as CR,Qj as GA,Ql as av,Rc as Lg,Rh as _H,Rl as XH,Sc as jU,Se as iH,Sg as gH,Tc as zU,Td as ZD,Tl as $H,Ui as kH,Ul as ZH,Vh as FH,Vi as OH,Vj as UH,Wb as XD,Wg as yH,X as Ore,Xd as YU,Xf as dH,Xl as e3,Y as BU,Yf as fH,Yg as Ji,Yi as DR,Yl as t3,Z as Og,Zd as KU,Ze as oH,Zf as nv,Zg as ov,Zl as n3,_ as YD,_d as VU,_f as hH,_g as EH,_j as vR,_l as r3,a as Mre,aa as si,ag as ca,ah as CH,al as GH,am as o3,bc as yR,bg as rv,bh as SH,cc as MU,cf as Ug,cg as Hre,ch as bH,cn as A3,dc as kU,dg as Gre,dh as IH,dl as PH,dm as Pg,ec as OU,eh as B0,fc as LU,fd as v0,fh as w0,fm as s3,gc as UU,gh as DH,hc as HU,hh as vH,hi as ua,hl as jH,hm as wR,id as $D,ie as JU,ig as AH,ih as xH,il as zH,im as a3,je as ev,jh as BH,jm as l3,kh as Hg,ki as Hf,kl as xR,lg as iv,lh as wH,li as Gg,mb as KD,mh as TH,nb as mR,nc as ER,ne as XU,nf as Lre,ob as VD,oe as SR,of as sH,ol as qH,om as c3,pb as TU,pe as $U,pf as aH,pm as lv,q as SU,qe as bR,qf as $c,ql as YH,qm as u3,re as ZU,rf as ll,rg as mH,rj as HA,s as bU,se as eH,sf as lH,sg as pH,t as jD,tc as GU,tf as cH,uh as RH,um as d3,vh as oc,vm as f3,x as IU,xe as x0,y as DU,yf as uH,z as AR,ze as tv}from"./chunk-5NLMIA5F.js";import{$ as Fi,C as dR,E as fd,Fd as D0,Na as EU,Qc as CU,Qd as wU,Sd as ic,Ud as gt,Z as Uf,a as vt,b as Ee,ba as fR,ca as mU,ea as hR,fa as UD,ia as pU,ja as HD,je as LH,la as kre,lc as GD,mc as PD,na as fr,pa as gU,qa as yU,xd as qD,zd as _t}from"./chunk-SX66NO2U.js";import{a as $n,c as Ae,d as Nre,e as Ce}from"./chunk-YUXORC52.js";var v3=Ae(Vt=>{"use strict";var QR=Symbol.for("react.transitional.element"),Pre=Symbol.for("react.portal"),jre=Symbol.for("react.fragment"),zre=Symbol.for("react.strict_mode"),qre=Symbol.for("react.profiler"),Yre=Symbol.for("react.consumer"),Kre=Symbol.for("react.context"),Vre=Symbol.for("react.forward_ref"),Wre=Symbol.for("react.suspense"),Jre=Symbol.for("react.memo"),E3=Symbol.for("react.lazy"),Xre=Symbol.for("react.activity"),m3=Symbol.iterator;function $re(e){return e===null||typeof e!="object"?null:(e=m3&&e[m3]||e["@@iterator"],typeof e=="function"?e:null)}var C3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S3=Object.assign,b3={};function zg(e,t,n){this.props=e,this.context=t,this.refs=b3,this.updater=n||C3}zg.prototype.isReactComponent={};zg.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};zg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function I3(){}I3.prototype=zg.prototype;function _R(e,t,n){this.props=e,this.context=t,this.refs=b3,this.updater=n||C3}var FR=_R.prototype=new I3;FR.constructor=_R;S3(FR,zg.prototype);FR.isPureReactComponent=!0;var p3=Array.isArray;function RR(){}var wr={H:null,A:null,T:null,S:null},D3=Object.prototype.hasOwnProperty;function NR(e,t,n){var r=n.ref;return{$$typeof:QR,type:e,key:t,ref:r!==void 0?r:null,props:n}}function Zre(e,t){return NR(e.type,t,e.props)}function MR(e){return typeof e=="object"&&e!==null&&e.$$typeof===QR}function eie(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var g3=/\/+/g;function TR(e,t){return typeof e=="object"&&e!==null&&e.key!=null?eie(""+e.key):t.toString(36)}function tie(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(RR,RR):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function jg(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case QR:case Pre:a=!0;break;case E3:return a=e._init,jg(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+TR(e,0):r,p3(i)?(n="",a!=null&&(n=a.replace(g3,"$&/")+"/"),jg(i,t,n,"",function(A){return A})):i!=null&&(MR(i)&&(i=Zre(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(g3,"$&/")+"/")+a)),t.push(i)),1;a=0;var c=r===""?".":r+":";if(p3(e))for(var f=0;f<e.length;f++)r=e[f],s=c+TR(r,f),a+=jg(r,t,n,s,i);else if(f=$re(e),typeof f=="function")for(e=f.call(e),f=0;!(r=e.next()).done;)r=r.value,s=c+TR(r,f++),a+=jg(r,t,n,s,i);else if(s==="object"){if(typeof e.then=="function")return jg(tie(e),t,n,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function cv(e,t,n){if(e==null)return e;var r=[],i=0;return jg(e,r,"","",function(s){return t.call(n,s,i++)}),r}function nie(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var y3=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},rie={map:cv,forEach:function(e,t,n){cv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return cv(e,function(){t++}),t},toArray:function(e){return cv(e,function(t){return t})||[]},only:function(e){if(!MR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Vt.Activity=Xre;Vt.Children=rie;Vt.Component=zg;Vt.Fragment=jre;Vt.Profiler=qre;Vt.PureComponent=_R;Vt.StrictMode=zre;Vt.Suspense=Wre;Vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wr;Vt.__COMPILER_RUNTIME={__proto__:null,c:function(e){return wr.H.useMemoCache(e)}};Vt.cache=function(e){return function(){return e.apply(null,arguments)}};Vt.cacheSignal=function(){return null};Vt.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=S3({},e.props),i=e.key;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)!D3.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(r[s]=t[s]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var a=Array(s),c=0;c<s;c++)a[c]=arguments[c+2];r.children=a}return NR(e.type,i,r)};Vt.createContext=function(e){return e={$$typeof:Kre,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Yre,_context:e},e};Vt.createElement=function(e,t,n){var r,i={},s=null;if(t!=null)for(r in t.key!==void 0&&(s=""+t.key),t)D3.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var c=Array(a),f=0;f<a;f++)c[f]=arguments[f+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return NR(e,s,i)};Vt.createRef=function(){return{current:null}};Vt.forwardRef=function(e){return{$$typeof:Vre,render:e}};Vt.isValidElement=MR;Vt.lazy=function(e){return{$$typeof:E3,_payload:{_status:-1,_result:e},_init:nie}};Vt.memo=function(e,t){return{$$typeof:Jre,type:e,compare:t===void 0?null:t}};Vt.startTransition=function(e){var t=wr.T,n={};wr.T=n;try{var r=e(),i=wr.S;i!==null&&i(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(RR,y3)}catch(s){y3(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),wr.T=t}};Vt.unstable_useCacheRefresh=function(){return wr.H.useCacheRefresh()};Vt.use=function(e){return wr.H.use(e)};Vt.useActionState=function(e,t,n){return wr.H.useActionState(e,t,n)};Vt.useCallback=function(e,t){return wr.H.useCallback(e,t)};Vt.useContext=function(e){return wr.H.useContext(e)};Vt.useDebugValue=function(){};Vt.useDeferredValue=function(e,t){return wr.H.useDeferredValue(e,t)};Vt.useEffect=function(e,t){return wr.H.useEffect(e,t)};Vt.useEffectEvent=function(e){return wr.H.useEffectEvent(e)};Vt.useId=function(){return wr.H.useId()};Vt.useImperativeHandle=function(e,t,n){return wr.H.useImperativeHandle(e,t,n)};Vt.useInsertionEffect=function(e,t){return wr.H.useInsertionEffect(e,t)};Vt.useLayoutEffect=function(e,t){return wr.H.useLayoutEffect(e,t)};Vt.useMemo=function(e,t){return wr.H.useMemo(e,t)};Vt.useOptimistic=function(e,t){return wr.H.useOptimistic(e,t)};Vt.useReducer=function(e,t,n){return wr.H.useReducer(e,t,n)};Vt.useRef=function(e){return wr.H.useRef(e)};Vt.useState=function(e){return wr.H.useState(e)};Vt.useSyncExternalStore=function(e,t,n){return wr.H.useSyncExternalStore(e,t,n)};Vt.useTransition=function(){return wr.H.useTransition()};Vt.version="19.2.4"});var x3=Ae((Pt,uv)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){function e(M,ae){Object.defineProperty(r.prototype,M,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",ae[0],ae[1])}})}function t(M){return M===null||typeof M!="object"?null:(M=Ve&&M[Ve]||M["@@iterator"],typeof M=="function"?M:null)}function n(M,ae){M=(M=M.constructor)&&(M.displayName||M.name)||"ReactClass";var Le=M+"."+ae;Re[Le]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",ae,M),Re[Le]=!0)}function r(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function i(){}function s(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function a(){}function c(M){return""+M}function f(M){try{c(M);var ae=!1}catch{ae=!0}if(ae){ae=console;var Le=ae.error,Je=typeof Symbol=="function"&&Symbol.toStringTag&&M[Symbol.toStringTag]||M.constructor.name||"Object";return Le.call(ae,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Je),c(M)}}function A(M){if(M==null)return null;if(typeof M=="function")return M.$$typeof===Gn?null:M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case ft:return"Fragment";case te:return"Profiler";case Ne:return"StrictMode";case St:return"Suspense";case j:return"SuspenseList";case me:return"Activity"}if(typeof M=="object")switch(typeof M.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),M.$$typeof){case Me:return"Portal";case Oe:return M.displayName||"Context";case _e:return(M._context.displayName||"Context")+".Consumer";case nt:var ae=M.render;return M=M.displayName,M||(M=ae.displayName||ae.name||"",M=M!==""?"ForwardRef("+M+")":"ForwardRef"),M;case q:return ae=M.displayName||null,ae!==null?ae:A(M.type)||"Memo";case Y:ae=M._payload,M=M._init;try{return A(M(ae))}catch{}}return null}function m(M){if(M===ft)return"<>";if(typeof M=="object"&&M!==null&&M.$$typeof===Y)return"<...>";try{var ae=A(M);return ae?"<"+ae+">":"<...>"}catch{return"<...>"}}function y(){var M=pt.A;return M===null?null:M.getOwner()}function C(){return Error("react-stack-top-frame")}function p(M){if(Si.call(M,"key")){var ae=Object.getOwnPropertyDescriptor(M,"key").get;if(ae&&ae.isReactWarning)return!1}return M.key!==void 0}function g(M,ae){function Le(){Jn||(Jn=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",ae))}Le.isReactWarning=!0,Object.defineProperty(M,"key",{get:Le,configurable:!0})}function b(){var M=A(this.type);return to[M]||(to[M]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),M=this.props.ref,M!==void 0?M:null}function v(M,ae,Le,Je,Z,se){var Se=Le.ref;return M={$$typeof:De,type:M,key:ae,props:Le,_owner:Je},(Se!==void 0?Se:null)!==null?Object.defineProperty(M,"ref",{enumerable:!1,get:b}):Object.defineProperty(M,"ref",{enumerable:!1,value:null}),M._store={},Object.defineProperty(M._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(M,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(M,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.defineProperty(M,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(M.props),Object.freeze(M)),M}function w(M,ae){return ae=v(M.type,ae,M.props,M._owner,M._debugStack,M._debugTask),M._store&&(ae._store.validated=M._store.validated),ae}function T(M){_(M)?M._store&&(M._store.validated=1):typeof M=="object"&&M!==null&&M.$$typeof===Y&&(M._payload.status==="fulfilled"?_(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function _(M){return typeof M=="object"&&M!==null&&M.$$typeof===De}function k(M){var ae={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Le){return ae[Le]})}function O(M,ae){return typeof M=="object"&&M!==null&&M.key!=null?(f(M.key),k(""+M.key)):ae.toString(36)}function G(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(a,a):(M.status="pending",M.then(function(ae){M.status==="pending"&&(M.status="fulfilled",M.value=ae)},function(ae){M.status==="pending"&&(M.status="rejected",M.reason=ae)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function W(M,ae,Le,Je,Z){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var Se=!1;if(M===null)Se=!0;else switch(se){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(M.$$typeof){case De:case Me:Se=!0;break;case Y:return Se=M._init,W(Se(M._payload),ae,Le,Je,Z)}}if(Se){Se=M,Z=Z(Se);var Ze=Je===""?"."+O(Se,0):Je;return Fr(Z)?(Le="",Ze!=null&&(Le=Ze.replace(Oi,"$&/")+"/"),W(Z,ae,Le,"",function(mr){return mr})):Z!=null&&(_(Z)&&(Z.key!=null&&(Se&&Se.key===Z.key||f(Z.key)),Le=w(Z,Le+(Z.key==null||Se&&Se.key===Z.key?"":(""+Z.key).replace(Oi,"$&/")+"/")+Ze),Je!==""&&Se!=null&&_(Se)&&Se.key==null&&Se._store&&!Se._store.validated&&(Le._store.validated=2),Z=Le),ae.push(Z)),1}if(Se=0,Ze=Je===""?".":Je+":",Fr(M))for(var Et=0;Et<M.length;Et++)Je=M[Et],se=Ze+O(Je,Et),Se+=W(Je,ae,Le,se,Z);else if(Et=t(M),typeof Et=="function")for(Et===M.entries&&(Nr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Nr=!0),M=Et.call(M),Et=0;!(Je=M.next()).done;)Je=Je.value,se=Ze+O(Je,Et++),Se+=W(Je,ae,Le,se,Z);else if(se==="object"){if(typeof M.then=="function")return W(G(M),ae,Le,Je,Z);throw ae=String(M),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Se}function z(M,ae,Le){if(M==null)return M;var Je=[],Z=0;return W(M,Je,"","",function(se){return ae.call(Le,se,Z++)}),Je}function P(M){if(M._status===-1){var ae=M._ioInfo;ae!=null&&(ae.start=ae.end=performance.now()),ae=M._result;var Le=ae();if(Le.then(function(Z){if(M._status===0||M._status===-1){M._status=1,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="fulfilled",Le.value=Z)}},function(Z){if(M._status===0||M._status===-1){M._status=2,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="rejected",Le.reason=Z)}}),ae=M._ioInfo,ae!=null){ae.value=Le;var Je=Le.displayName;typeof Je=="string"&&(ae.name=Je)}M._status===-1&&(M._status=0,M._result=Le)}if(M._status===1)return ae=M._result,ae===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
3
3
 
4
4
  Your code should look like:
5
5
  const MyComponent = lazy(() => import('./MyComponent'))
@@ -729,7 +729,7 @@ ${e.map(i=>{let s=$T.basename(i.path),a=(t.get(s)||0)>1,c=$T.basename($T.dirname
729
729
  ${m.map(y=>` - ${y}`).join(`
730
730
  `)}
731
731
 
732
- Use /mcp auth <server-name> to authenticate.`}}let a=s[n];if(!a)return{type:"message",messageType:"error",content:`MCP server '${n}' not found.`};let c=f=>{e.ui.addItem({type:"info",text:f})};gt.on(ic.OauthDisplayMessage,c);try{e.ui.addItem({type:"info",text:`Starting OAuth authentication for MCP server '${n}'...`});let{MCPOAuthProvider:f}=await import("./dist-S65OG37M.js"),A=a.oauth;A||(A={enabled:!1});let m=a.httpUrl||a.url;await new f(new vR).authenticate(n,A,m),e.ui.addItem({type:"info",text:`\u2705 Successfully authenticated with MCP server '${n}'!`});let C=i.getMcpClientManager();C&&(e.ui.addItem({type:"info",text:`Restarting MCP server '${n}'...`}),await C.restartServer(n));let p=e.services.agentContext?.geminiClient;return p?.isInitialized()&&await p.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:`Successfully authenticated and reloaded tools for '${n}'`}}catch(f){return{type:"message",messageType:"error",content:`Failed to authenticate with MCP server '${n}': ${_t(f)}`}}finally{gt.removeListener(ic.OauthDisplayMessage,c)}},completion:async(e,t)=>{let r=e.services.agentContext?.config;if(!r)return[];let i=r.getMcpClientManager()?.getMcpServers()||{};return Object.keys(i).filter(s=>s.startsWith(t))}},e1=async(e,t=!1,n=!1)=>{let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=r.toolRegistry;if(!s)return{type:"message",messageType:"error",content:"Could not retrieve tool registry."};let a=i.getMcpClientManager()?.getMcpServers()||{},c=Object.keys(a),f=i.getMcpClientManager()?.getBlockedMcpServers()||[],A=c.filter(z=>qH(z)===jH.CONNECTING),y=YH()===zH.IN_PROGRESS||A.length>0,p=s.getAllTools().filter(z=>z instanceof CU),b=i.getPromptRegistry().getAllPrompts().filter(z=>"serverName"in z&&c.includes(z.serverName)),w=i.getResourceRegistry().getAllResources().filter(z=>c.includes(z.serverName)),T={},_=new vR;for(let z of c)if(a[z].oauth?.enabled||xR.has(z)){let V=await _.getCredentials(z);V?V.token.expiresAt&&V.token.expiresAt<Date.now()?T[z]="expired":T[z]="authenticated":T[z]="unauthenticated"}else T[z]="not-configured";let k=wh.getInstance(),O={};for(let z of c)O[z]=await k.getDisplayState(z);let G={};for(let z of c){let P=i.getMcpClientManager()?.getLastError(z);P&&(G[z]=P)}let W={type:"mcp_status",servers:a,tools:p.map(z=>({serverName:z.serverName,name:z.name,description:z.description,schema:z.schema})),prompts:b.map(z=>({serverName:z.serverName,name:z.name,description:z.description})),resources:w.map(z=>({serverName:z.serverName,name:z.name,uri:z.uri,mimeType:z.mimeType,description:z.description})),authStatus:T,enablementState:O,errors:G,blockedServers:f.map(z=>({name:z.name,extensionName:z.extensionName})),discoveryInProgress:y,connectingServers:A,showDescriptions:!!t,showSchema:!!n};e.ui.addItem(W)},hne={name:"list",altNames:["ls","nodesc","nodescription"],description:"List configured MCP servers and tools",kind:"built-in",autoExecute:!0,action:e=>e1(e)},pTe={name:"desc",altNames:["description"],description:"List configured MCP servers and tools with descriptions",kind:"built-in",autoExecute:!0,action:e=>e1(e,!0)},gTe={name:"schema",description:"List configured MCP servers and tools with descriptions and schemas",kind:"built-in",autoExecute:!0,action:e=>e1(e,!0,!0)},yTe={name:"reload",altNames:["refresh"],description:"Reloads MCP servers",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext,n=t?.config;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let r=n.getMcpClientManager();if(!r)return{type:"message",messageType:"error",content:"Could not retrieve mcp client manager."};e.ui.addItem({type:"info",text:"Reloading MCP servers..."}),await r.restart();let i=t.geminiClient;return i?.isInitialized()&&await i.setTools(),e.ui.reloadCommands(),hne.action(e,"")}};async function Ane(e,t,n){let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=t.trim().split(/\s+/),a=s.includes("--session"),c=s.filter(b=>b!=="--session")[0],f=n?"enable":"disable";if(!c)return{type:"message",messageType:"error",content:`Server name required. Usage: /mcp ${f} <server-name> [--session]`};let A=Ea(c),m=i.getMcpClientManager()?.getMcpServers()||{};if(!Object.keys(m).map(Ea).includes(A))return{type:"message",messageType:"error",content:`Server '${c}' not found. Use /mcp list to see available servers.`};let C=wh.getInstance();if(n){let b=Dy(),v=await wee(A,{adminMcpEnabled:b.merged.admin?.mcp?.enabled??!0,allowedList:b.merged.mcp?.allowed,excludedList:b.merged.mcp?.excluded});if(!v.allowed&&(v.blockType==="allowlist"||v.blockType==="excludelist"))return{type:"message",messageType:"error",content:v.reason??"Blocked by settings."};a?C.clearSessionDisable(A):await C.enable(A),v.blockType==="admin"&&e.ui.addItem({type:"warning",text:"MCP disabled by admin. Will load when enabled."},Date.now())}else a?C.disableForSession(A):await C.disable(A);let p=`MCP server '${A}' ${n?"enabled":"disabled"}${a?" for this session":""}.`,g=i.getMcpClientManager();return g&&(e.ui.addItem({type:"info",text:"Reloading MCP servers..."},Date.now()),await g.restart()),r.geminiClient?.isInitialized()&&await r.geminiClient.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:p}}async function mne(e,t,n){let i=e.services.agentContext?.config;if(!i)return[];let s=Object.keys(i.getMcpClientManager()?.getMcpServers()||{}),a=wh.getInstance(),c=[];for(let f of s)(await a.getDisplayState(f)).enabled===n&&f.startsWith(t)&&c.push(f);return c}var ETe={name:"enable",description:"Enable a disabled MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>Ane(e,t,!0),completion:(e,t)=>mne(e,t,!1)},CTe={name:"disable",description:"Disable an MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>Ane(e,t,!1),completion:(e,t)=>mne(e,t,!0)},pne={name:"mcp",description:"Manage configured Model Context Protocol (MCP) servers",kind:"built-in",autoExecute:!1,subCommands:[hne,pTe,gTe,mTe,yTe,ETe,CTe],action:async e=>e1(e)};var gne={name:"memory",description:"Commands for interacting with memory",kind:"built-in",autoExecute:!1,subCommands:[{name:"show",description:"Show the current memory contents",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=n3(t);e.ui.addItem({type:"info",text:n.content},Date.now())}},{name:"add",description:"Add content to the memory",kind:"built-in",autoExecute:!1,action:(e,t)=>{let n=r3(t);return n.type==="message"||e.ui.addItem({type:"info",text:`Attempting to save to memory: "${t.trim()}"`},Date.now()),n}},{name:"reload",altNames:["refresh"],description:"Reload the memory from the source",kind:"built-in",autoExecute:!0,action:async e=>{e.ui.addItem({type:"info",text:"Reloading memory from source files..."},Date.now());try{let t=e.services.agentContext?.config;if(t){let n=await i3(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}catch(t){e.ui.addItem({type:"error",text:`Error reloading memory: ${t.message}`},Date.now())}}},{name:"list",description:"Lists the paths of the GEMINI.md files in use",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=o3(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}]};var STe={name:"set",description:"Set the model to use. Usage: /model set <model-name> [--persist]",kind:"built-in",autoExecute:!1,action:async(e,t)=>{let n=t.trim().split(/\s+/).filter(Boolean);if(n.length===0){e.ui.addItem({type:"error",text:"Usage: /model set <model-name> [--persist]"});return}let r=n[0],i=n.includes("--persist");if(e.services.agentContext?.config){e.services.agentContext.config.setModel(r,!i);let s=new FU(r);XU(e.services.agentContext.config,s),e.ui.addItem({type:"info",text:`Model set to ${r}${i?" (persisted)":""}`})}}},yne={name:"manage",description:"Opens a dialog to configure the model",kind:"built-in",autoExecute:!0,action:async e=>(e.services.agentContext?.config&&await e.services.agentContext.config.refreshUserQuota(),{type:"dialog",dialog:"model"})},Ene={name:"model",description:"Manage model configuration",kind:"built-in",autoExecute:!1,subCommands:[yne,STe],action:async(e,t)=>yne.action(e,t)};var eo=Ce(ut(),1);var it=Ce(It(),1);var LO=6,UO=20,t1=25,Jm=5,Cne=10,uI=e=>!e||!e.reactionGroups?0:e.reactionGroups.reduce((t,n)=>t+n.users.totalCount,0),bTe=(e,t)=>t?.toLowerCase()==="duplicate"?"magenta":e==="OPEN"?"green":"red",Sne=({config:e,onExit:t,initialLimit:n=50})=>{let r=Ei(),[i,s]=(0,eo.useState)({status:"loading",issues:[],currentIndex:0,analysisCache:new Map,analyzingIds:new Set,message:"Fetching issues..."}),[a,c]=(0,eo.useState)("target"),[f,A]=(0,eo.useState)(0),[m,y]=(0,eo.useState)(!1),[C,p]=(0,eo.useState)(0),[g,b]=(0,eo.useState)(0),[v,w]=(0,eo.useState)(""),[T,_]=(0,eo.useState)([]),[k,O]=(0,eo.useState)(!1),[G,W]=(0,eo.useState)(0);(0,eo.useEffect)(()=>{f<G?W(f):f>=G+Jm&&W(f-Jm+1)},[f,G]);let z=async Ne=>{try{let{stdout:te}=await Xo("gh",["issue","view",String(Ne),"--json","number,title,body,state,stateReason,labels,url,comments,author,reactionGroups"]);return JSON.parse(te)}catch(te){return Ee.error(`Failed to fetch details for candidate #${Ne}`,te),null}},P=(0,eo.useCallback)(async Ne=>{let te=Ne.comments.find(Re=>Re.body.includes("Found possible duplicate issues:"));if(!te)return null;let _e=te.body.split(`
732
+ Use /mcp auth <server-name> to authenticate.`}}let a=s[n];if(!a)return{type:"message",messageType:"error",content:`MCP server '${n}' not found.`};let c=f=>{e.ui.addItem({type:"info",text:f})};gt.on(ic.OauthDisplayMessage,c);try{e.ui.addItem({type:"info",text:`Starting OAuth authentication for MCP server '${n}'...`});let{MCPOAuthProvider:f}=await import("./dist-RUT7TWHF.js"),A=a.oauth;A||(A={enabled:!1});let m=a.httpUrl||a.url;await new f(new vR).authenticate(n,A,m),e.ui.addItem({type:"info",text:`\u2705 Successfully authenticated with MCP server '${n}'!`});let C=i.getMcpClientManager();C&&(e.ui.addItem({type:"info",text:`Restarting MCP server '${n}'...`}),await C.restartServer(n));let p=e.services.agentContext?.geminiClient;return p?.isInitialized()&&await p.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:`Successfully authenticated and reloaded tools for '${n}'`}}catch(f){return{type:"message",messageType:"error",content:`Failed to authenticate with MCP server '${n}': ${_t(f)}`}}finally{gt.removeListener(ic.OauthDisplayMessage,c)}},completion:async(e,t)=>{let r=e.services.agentContext?.config;if(!r)return[];let i=r.getMcpClientManager()?.getMcpServers()||{};return Object.keys(i).filter(s=>s.startsWith(t))}},e1=async(e,t=!1,n=!1)=>{let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=r.toolRegistry;if(!s)return{type:"message",messageType:"error",content:"Could not retrieve tool registry."};let a=i.getMcpClientManager()?.getMcpServers()||{},c=Object.keys(a),f=i.getMcpClientManager()?.getBlockedMcpServers()||[],A=c.filter(z=>qH(z)===jH.CONNECTING),y=YH()===zH.IN_PROGRESS||A.length>0,p=s.getAllTools().filter(z=>z instanceof CU),b=i.getPromptRegistry().getAllPrompts().filter(z=>"serverName"in z&&c.includes(z.serverName)),w=i.getResourceRegistry().getAllResources().filter(z=>c.includes(z.serverName)),T={},_=new vR;for(let z of c)if(a[z].oauth?.enabled||xR.has(z)){let V=await _.getCredentials(z);V?V.token.expiresAt&&V.token.expiresAt<Date.now()?T[z]="expired":T[z]="authenticated":T[z]="unauthenticated"}else T[z]="not-configured";let k=wh.getInstance(),O={};for(let z of c)O[z]=await k.getDisplayState(z);let G={};for(let z of c){let P=i.getMcpClientManager()?.getLastError(z);P&&(G[z]=P)}let W={type:"mcp_status",servers:a,tools:p.map(z=>({serverName:z.serverName,name:z.name,description:z.description,schema:z.schema})),prompts:b.map(z=>({serverName:z.serverName,name:z.name,description:z.description})),resources:w.map(z=>({serverName:z.serverName,name:z.name,uri:z.uri,mimeType:z.mimeType,description:z.description})),authStatus:T,enablementState:O,errors:G,blockedServers:f.map(z=>({name:z.name,extensionName:z.extensionName})),discoveryInProgress:y,connectingServers:A,showDescriptions:!!t,showSchema:!!n};e.ui.addItem(W)},hne={name:"list",altNames:["ls","nodesc","nodescription"],description:"List configured MCP servers and tools",kind:"built-in",autoExecute:!0,action:e=>e1(e)},pTe={name:"desc",altNames:["description"],description:"List configured MCP servers and tools with descriptions",kind:"built-in",autoExecute:!0,action:e=>e1(e,!0)},gTe={name:"schema",description:"List configured MCP servers and tools with descriptions and schemas",kind:"built-in",autoExecute:!0,action:e=>e1(e,!0,!0)},yTe={name:"reload",altNames:["refresh"],description:"Reloads MCP servers",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext,n=t?.config;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let r=n.getMcpClientManager();if(!r)return{type:"message",messageType:"error",content:"Could not retrieve mcp client manager."};e.ui.addItem({type:"info",text:"Reloading MCP servers..."}),await r.restart();let i=t.geminiClient;return i?.isInitialized()&&await i.setTools(),e.ui.reloadCommands(),hne.action(e,"")}};async function Ane(e,t,n){let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=t.trim().split(/\s+/),a=s.includes("--session"),c=s.filter(b=>b!=="--session")[0],f=n?"enable":"disable";if(!c)return{type:"message",messageType:"error",content:`Server name required. Usage: /mcp ${f} <server-name> [--session]`};let A=Ea(c),m=i.getMcpClientManager()?.getMcpServers()||{};if(!Object.keys(m).map(Ea).includes(A))return{type:"message",messageType:"error",content:`Server '${c}' not found. Use /mcp list to see available servers.`};let C=wh.getInstance();if(n){let b=Dy(),v=await wee(A,{adminMcpEnabled:b.merged.admin?.mcp?.enabled??!0,allowedList:b.merged.mcp?.allowed,excludedList:b.merged.mcp?.excluded});if(!v.allowed&&(v.blockType==="allowlist"||v.blockType==="excludelist"))return{type:"message",messageType:"error",content:v.reason??"Blocked by settings."};a?C.clearSessionDisable(A):await C.enable(A),v.blockType==="admin"&&e.ui.addItem({type:"warning",text:"MCP disabled by admin. Will load when enabled."},Date.now())}else a?C.disableForSession(A):await C.disable(A);let p=`MCP server '${A}' ${n?"enabled":"disabled"}${a?" for this session":""}.`,g=i.getMcpClientManager();return g&&(e.ui.addItem({type:"info",text:"Reloading MCP servers..."},Date.now()),await g.restart()),r.geminiClient?.isInitialized()&&await r.geminiClient.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:p}}async function mne(e,t,n){let i=e.services.agentContext?.config;if(!i)return[];let s=Object.keys(i.getMcpClientManager()?.getMcpServers()||{}),a=wh.getInstance(),c=[];for(let f of s)(await a.getDisplayState(f)).enabled===n&&f.startsWith(t)&&c.push(f);return c}var ETe={name:"enable",description:"Enable a disabled MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>Ane(e,t,!0),completion:(e,t)=>mne(e,t,!1)},CTe={name:"disable",description:"Disable an MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>Ane(e,t,!1),completion:(e,t)=>mne(e,t,!0)},pne={name:"mcp",description:"Manage configured Model Context Protocol (MCP) servers",kind:"built-in",autoExecute:!1,subCommands:[hne,pTe,gTe,mTe,yTe,ETe,CTe],action:async e=>e1(e)};var gne={name:"memory",description:"Commands for interacting with memory",kind:"built-in",autoExecute:!1,subCommands:[{name:"show",description:"Show the current memory contents",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=n3(t);e.ui.addItem({type:"info",text:n.content},Date.now())}},{name:"add",description:"Add content to the memory",kind:"built-in",autoExecute:!1,action:(e,t)=>{let n=r3(t);return n.type==="message"||e.ui.addItem({type:"info",text:`Attempting to save to memory: "${t.trim()}"`},Date.now()),n}},{name:"reload",altNames:["refresh"],description:"Reload the memory from the source",kind:"built-in",autoExecute:!0,action:async e=>{e.ui.addItem({type:"info",text:"Reloading memory from source files..."},Date.now());try{let t=e.services.agentContext?.config;if(t){let n=await i3(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}catch(t){e.ui.addItem({type:"error",text:`Error reloading memory: ${t.message}`},Date.now())}}},{name:"list",description:"Lists the paths of the GEMINI.md files in use",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=o3(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}]};var STe={name:"set",description:"Set the model to use. Usage: /model set <model-name> [--persist]",kind:"built-in",autoExecute:!1,action:async(e,t)=>{let n=t.trim().split(/\s+/).filter(Boolean);if(n.length===0){e.ui.addItem({type:"error",text:"Usage: /model set <model-name> [--persist]"});return}let r=n[0],i=n.includes("--persist");if(e.services.agentContext?.config){e.services.agentContext.config.setModel(r,!i);let s=new FU(r);XU(e.services.agentContext.config,s),e.ui.addItem({type:"info",text:`Model set to ${r}${i?" (persisted)":""}`})}}},yne={name:"manage",description:"Opens a dialog to configure the model",kind:"built-in",autoExecute:!0,action:async e=>(e.services.agentContext?.config&&await e.services.agentContext.config.refreshUserQuota(),{type:"dialog",dialog:"model"})},Ene={name:"model",description:"Manage model configuration",kind:"built-in",autoExecute:!1,subCommands:[yne,STe],action:async(e,t)=>yne.action(e,t)};var eo=Ce(ut(),1);var it=Ce(It(),1);var LO=6,UO=20,t1=25,Jm=5,Cne=10,uI=e=>!e||!e.reactionGroups?0:e.reactionGroups.reduce((t,n)=>t+n.users.totalCount,0),bTe=(e,t)=>t?.toLowerCase()==="duplicate"?"magenta":e==="OPEN"?"green":"red",Sne=({config:e,onExit:t,initialLimit:n=50})=>{let r=Ei(),[i,s]=(0,eo.useState)({status:"loading",issues:[],currentIndex:0,analysisCache:new Map,analyzingIds:new Set,message:"Fetching issues..."}),[a,c]=(0,eo.useState)("target"),[f,A]=(0,eo.useState)(0),[m,y]=(0,eo.useState)(!1),[C,p]=(0,eo.useState)(0),[g,b]=(0,eo.useState)(0),[v,w]=(0,eo.useState)(""),[T,_]=(0,eo.useState)([]),[k,O]=(0,eo.useState)(!1),[G,W]=(0,eo.useState)(0);(0,eo.useEffect)(()=>{f<G?W(f):f>=G+Jm&&W(f-Jm+1)},[f,G]);let z=async Ne=>{try{let{stdout:te}=await Xo("gh",["issue","view",String(Ne),"--json","number,title,body,state,stateReason,labels,url,comments,author,reactionGroups"]);return JSON.parse(te)}catch(te){return Ee.error(`Failed to fetch details for candidate #${Ne}`,te),null}},P=(0,eo.useCallback)(async Ne=>{let te=Ne.comments.find(Re=>Re.body.includes("Found possible duplicate issues:"));if(!te)return null;let _e=te.body.split(`
733
733
  `),Oe=[];for(let Re of _e){let bt=Re.match(/#(\d+)/);if(bt){let kt=parseInt(bt[1],10);kt!==Ne.number&&Oe.push(kt)}}if(Oe.length===0)return null;let nt=[];for(let Re of Oe){let bt=await z(Re);bt&&nt.push(bt)}let St=e.getBaseLlmClient(),j=`
734
734
  I am triaging a GitHub issue labeled as 'possible-duplicate'. I need to decide if it should be marked as a duplicate of another issue, or if one of the other issues should be marked as a duplicate of this one.
735
735
 
@@ -1,5 +1,5 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
- import{$d as zU,$f as Tre,$g as ev,$l as KH,Ae as JU,Af as gR,B as HD,Bb as vU,Cl as OH,Eb as zD,El as SR,Fi as TH,Fk as OA,Gk as _H,Gl as LH,H as CU,Hb as uR,Im as n3,J as SU,Jb as xU,Jh as xH,Kb as dR,Lb as BU,Lc as OU,Mb as wU,Me as XU,Nb as TU,Ne as $U,P as Jo,Pd as HU,Pl as UH,Qc as AR,Qj as kA,Ql as tv,Rc as Ng,Rh as BH,Rl as HH,Sc as LU,Se as ZU,Sg as fH,Tc as UU,Td as KD,Tl as GH,Ul as PH,Vh as wH,Vj as QH,Wb as qD,Wg as hH,X as Bre,Xd as GU,Xf as sH,Xl as jH,Y as bU,Yf as aH,Yg as Wi,Yi as yR,Yl as zH,Z as _g,Zd as PU,Ze as eH,Zf as JD,Zg as ZD,Zl as qH,_ as PD,_d as jU,_f as lH,_g as AH,_j as ER,_l as YH,a as vre,ag as la,ah as mH,al as FH,am as VH,bc as fR,bg as XD,bh as pH,cc as RU,cf as Mg,cg as Rre,ch as gH,cn as r3,dc as QU,dg as Qre,dh as yH,dl as NH,dm as Lg,ec as _U,eh as I0,fc as FU,fd as S0,fh as D0,fm as WH,gc as NU,gh as EH,hc as MU,hh as CH,hi as ca,hm as bR,id as YD,ie as qU,ig as cH,ih as SH,im as JH,je as VD,jh as bH,jm as XH,kh as kg,ki as Mf,kl as CR,lg as $D,lh as IH,li as Og,mb as jD,mh as DH,nb as cR,nc as hR,ne as YU,nf as wre,oe as mR,of as tH,ol as MH,om as $H,pb as DU,pe as KU,pf as nH,pm as nv,q as pU,qe as pR,ql as kH,qm as ZH,re as VU,rf as al,rg as uH,rj as MA,s as gU,se as WU,sf as rH,sg as dH,t as UD,tc as kU,tf as iH,uh as vH,um as e3,vh as rc,vm as t3,x as yU,xe as b0,y as EU,yf as oH,z as lR,ze as WD}from"./chunk-LDCK4LC4.js";import{$ as _i,E as oR,Fd as C0,Na as AU,Qc as mU,Qd as IU,Sd as Fg,Ud as gt,Z as Nf,a as vt,b as Ee,ba as sR,ca as uU,ea as aR,fa as MD,ia as dU,ja as kD,je as RH,la as xre,lc as OD,mc as LD,na as fr,pa as fU,qa as hU,xd as GD,zd as _t}from"./chunk-ALYGAQ7G.js";import{a as $n,c as Ae,d as Dre,e as Ce}from"./chunk-YUXORC52.js";var A3=Ae(Vt=>{"use strict";var vR=Symbol.for("react.transitional.element"),_re=Symbol.for("react.portal"),Fre=Symbol.for("react.fragment"),Nre=Symbol.for("react.strict_mode"),Mre=Symbol.for("react.profiler"),kre=Symbol.for("react.consumer"),Ore=Symbol.for("react.context"),Lre=Symbol.for("react.forward_ref"),Ure=Symbol.for("react.suspense"),Hre=Symbol.for("react.memo"),l3=Symbol.for("react.lazy"),Gre=Symbol.for("react.activity"),i3=Symbol.iterator;function Pre(e){return e===null||typeof e!="object"?null:(e=i3&&e[i3]||e["@@iterator"],typeof e=="function"?e:null)}var c3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},u3=Object.assign,d3={};function Hg(e,t,n){this.props=e,this.context=t,this.refs=d3,this.updater=n||c3}Hg.prototype.isReactComponent={};Hg.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Hg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function f3(){}f3.prototype=Hg.prototype;function xR(e,t,n){this.props=e,this.context=t,this.refs=d3,this.updater=n||c3}var BR=xR.prototype=new f3;BR.constructor=xR;u3(BR,Hg.prototype);BR.isPureReactComponent=!0;var o3=Array.isArray;function DR(){}var wr={H:null,A:null,T:null,S:null},h3=Object.prototype.hasOwnProperty;function wR(e,t,n){var r=n.ref;return{$$typeof:vR,type:e,key:t,ref:r!==void 0?r:null,props:n}}function jre(e,t){return wR(e.type,t,e.props)}function TR(e){return typeof e=="object"&&e!==null&&e.$$typeof===vR}function zre(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var s3=/\/+/g;function IR(e,t){return typeof e=="object"&&e!==null&&e.key!=null?zre(""+e.key):t.toString(36)}function qre(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(DR,DR):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Ug(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case vR:case _re:a=!0;break;case l3:return a=e._init,Ug(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+IR(e,0):r,o3(i)?(n="",a!=null&&(n=a.replace(s3,"$&/")+"/"),Ug(i,t,n,"",function(A){return A})):i!=null&&(TR(i)&&(i=jre(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(s3,"$&/")+"/")+a)),t.push(i)),1;a=0;var c=r===""?".":r+":";if(o3(e))for(var f=0;f<e.length;f++)r=e[f],s=c+IR(r,f),a+=Ug(r,t,n,s,i);else if(f=Pre(e),typeof f=="function")for(e=f.call(e),f=0;!(r=e.next()).done;)r=r.value,s=c+IR(r,f++),a+=Ug(r,t,n,s,i);else if(s==="object"){if(typeof e.then=="function")return Ug(qre(e),t,n,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function rv(e,t,n){if(e==null)return e;var r=[],i=0;return Ug(e,r,"","",function(s){return t.call(n,s,i++)}),r}function Yre(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var a3=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Kre={map:rv,forEach:function(e,t,n){rv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return rv(e,function(){t++}),t},toArray:function(e){return rv(e,function(t){return t})||[]},only:function(e){if(!TR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Vt.Activity=Gre;Vt.Children=Kre;Vt.Component=Hg;Vt.Fragment=Fre;Vt.Profiler=Mre;Vt.PureComponent=xR;Vt.StrictMode=Nre;Vt.Suspense=Ure;Vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wr;Vt.__COMPILER_RUNTIME={__proto__:null,c:function(e){return wr.H.useMemoCache(e)}};Vt.cache=function(e){return function(){return e.apply(null,arguments)}};Vt.cacheSignal=function(){return null};Vt.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=u3({},e.props),i=e.key;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)!h3.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(r[s]=t[s]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var a=Array(s),c=0;c<s;c++)a[c]=arguments[c+2];r.children=a}return wR(e.type,i,r)};Vt.createContext=function(e){return e={$$typeof:Ore,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:kre,_context:e},e};Vt.createElement=function(e,t,n){var r,i={},s=null;if(t!=null)for(r in t.key!==void 0&&(s=""+t.key),t)h3.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var c=Array(a),f=0;f<a;f++)c[f]=arguments[f+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return wR(e,s,i)};Vt.createRef=function(){return{current:null}};Vt.forwardRef=function(e){return{$$typeof:Lre,render:e}};Vt.isValidElement=TR;Vt.lazy=function(e){return{$$typeof:l3,_payload:{_status:-1,_result:e},_init:Yre}};Vt.memo=function(e,t){return{$$typeof:Hre,type:e,compare:t===void 0?null:t}};Vt.startTransition=function(e){var t=wr.T,n={};wr.T=n;try{var r=e(),i=wr.S;i!==null&&i(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(DR,a3)}catch(s){a3(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),wr.T=t}};Vt.unstable_useCacheRefresh=function(){return wr.H.useCacheRefresh()};Vt.use=function(e){return wr.H.use(e)};Vt.useActionState=function(e,t,n){return wr.H.useActionState(e,t,n)};Vt.useCallback=function(e,t){return wr.H.useCallback(e,t)};Vt.useContext=function(e){return wr.H.useContext(e)};Vt.useDebugValue=function(){};Vt.useDeferredValue=function(e,t){return wr.H.useDeferredValue(e,t)};Vt.useEffect=function(e,t){return wr.H.useEffect(e,t)};Vt.useEffectEvent=function(e){return wr.H.useEffectEvent(e)};Vt.useId=function(){return wr.H.useId()};Vt.useImperativeHandle=function(e,t,n){return wr.H.useImperativeHandle(e,t,n)};Vt.useInsertionEffect=function(e,t){return wr.H.useInsertionEffect(e,t)};Vt.useLayoutEffect=function(e,t){return wr.H.useLayoutEffect(e,t)};Vt.useMemo=function(e,t){return wr.H.useMemo(e,t)};Vt.useOptimistic=function(e,t){return wr.H.useOptimistic(e,t)};Vt.useReducer=function(e,t,n){return wr.H.useReducer(e,t,n)};Vt.useRef=function(e){return wr.H.useRef(e)};Vt.useState=function(e){return wr.H.useState(e)};Vt.useSyncExternalStore=function(e,t,n){return wr.H.useSyncExternalStore(e,t,n)};Vt.useTransition=function(){return wr.H.useTransition()};Vt.version="19.2.4"});var m3=Ae((Pt,iv)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){function e(M,ae){Object.defineProperty(r.prototype,M,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",ae[0],ae[1])}})}function t(M){return M===null||typeof M!="object"?null:(M=Ve&&M[Ve]||M["@@iterator"],typeof M=="function"?M:null)}function n(M,ae){M=(M=M.constructor)&&(M.displayName||M.name)||"ReactClass";var Le=M+"."+ae;Re[Le]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",ae,M),Re[Le]=!0)}function r(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function i(){}function s(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function a(){}function c(M){return""+M}function f(M){try{c(M);var ae=!1}catch{ae=!0}if(ae){ae=console;var Le=ae.error,Je=typeof Symbol=="function"&&Symbol.toStringTag&&M[Symbol.toStringTag]||M.constructor.name||"Object";return Le.call(ae,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Je),c(M)}}function A(M){if(M==null)return null;if(typeof M=="function")return M.$$typeof===Gn?null:M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case ft:return"Fragment";case te:return"Profiler";case Ne:return"StrictMode";case St:return"Suspense";case j:return"SuspenseList";case me:return"Activity"}if(typeof M=="object")switch(typeof M.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),M.$$typeof){case Me:return"Portal";case Oe:return M.displayName||"Context";case _e:return(M._context.displayName||"Context")+".Consumer";case nt:var ae=M.render;return M=M.displayName,M||(M=ae.displayName||ae.name||"",M=M!==""?"ForwardRef("+M+")":"ForwardRef"),M;case q:return ae=M.displayName||null,ae!==null?ae:A(M.type)||"Memo";case Y:ae=M._payload,M=M._init;try{return A(M(ae))}catch{}}return null}function m(M){if(M===ft)return"<>";if(typeof M=="object"&&M!==null&&M.$$typeof===Y)return"<...>";try{var ae=A(M);return ae?"<"+ae+">":"<...>"}catch{return"<...>"}}function y(){var M=pt.A;return M===null?null:M.getOwner()}function C(){return Error("react-stack-top-frame")}function p(M){if(Ci.call(M,"key")){var ae=Object.getOwnPropertyDescriptor(M,"key").get;if(ae&&ae.isReactWarning)return!1}return M.key!==void 0}function g(M,ae){function Le(){Jn||(Jn=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",ae))}Le.isReactWarning=!0,Object.defineProperty(M,"key",{get:Le,configurable:!0})}function b(){var M=A(this.type);return eo[M]||(eo[M]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),M=this.props.ref,M!==void 0?M:null}function v(M,ae,Le,Je,Z,se){var Se=Le.ref;return M={$$typeof:De,type:M,key:ae,props:Le,_owner:Je},(Se!==void 0?Se:null)!==null?Object.defineProperty(M,"ref",{enumerable:!1,get:b}):Object.defineProperty(M,"ref",{enumerable:!1,value:null}),M._store={},Object.defineProperty(M._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(M,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(M,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.defineProperty(M,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(M.props),Object.freeze(M)),M}function w(M,ae){return ae=v(M.type,ae,M.props,M._owner,M._debugStack,M._debugTask),M._store&&(ae._store.validated=M._store.validated),ae}function T(M){_(M)?M._store&&(M._store.validated=1):typeof M=="object"&&M!==null&&M.$$typeof===Y&&(M._payload.status==="fulfilled"?_(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function _(M){return typeof M=="object"&&M!==null&&M.$$typeof===De}function k(M){var ae={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Le){return ae[Le]})}function O(M,ae){return typeof M=="object"&&M!==null&&M.key!=null?(f(M.key),k(""+M.key)):ae.toString(36)}function G(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(a,a):(M.status="pending",M.then(function(ae){M.status==="pending"&&(M.status="fulfilled",M.value=ae)},function(ae){M.status==="pending"&&(M.status="rejected",M.reason=ae)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function W(M,ae,Le,Je,Z){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var Se=!1;if(M===null)Se=!0;else switch(se){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(M.$$typeof){case De:case Me:Se=!0;break;case Y:return Se=M._init,W(Se(M._payload),ae,Le,Je,Z)}}if(Se){Se=M,Z=Z(Se);var Ze=Je===""?"."+O(Se,0):Je;return Fr(Z)?(Le="",Ze!=null&&(Le=Ze.replace(ki,"$&/")+"/"),W(Z,ae,Le,"",function(mr){return mr})):Z!=null&&(_(Z)&&(Z.key!=null&&(Se&&Se.key===Z.key||f(Z.key)),Le=w(Z,Le+(Z.key==null||Se&&Se.key===Z.key?"":(""+Z.key).replace(ki,"$&/")+"/")+Ze),Je!==""&&Se!=null&&_(Se)&&Se.key==null&&Se._store&&!Se._store.validated&&(Le._store.validated=2),Z=Le),ae.push(Z)),1}if(Se=0,Ze=Je===""?".":Je+":",Fr(M))for(var Et=0;Et<M.length;Et++)Je=M[Et],se=Ze+O(Je,Et),Se+=W(Je,ae,Le,se,Z);else if(Et=t(M),typeof Et=="function")for(Et===M.entries&&(Nr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Nr=!0),M=Et.call(M),Et=0;!(Je=M.next()).done;)Je=Je.value,se=Ze+O(Je,Et++),Se+=W(Je,ae,Le,se,Z);else if(se==="object"){if(typeof M.then=="function")return W(G(M),ae,Le,Je,Z);throw ae=String(M),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Se}function z(M,ae,Le){if(M==null)return M;var Je=[],Z=0;return W(M,Je,"","",function(se){return ae.call(Le,se,Z++)}),Je}function P(M){if(M._status===-1){var ae=M._ioInfo;ae!=null&&(ae.start=ae.end=performance.now()),ae=M._result;var Le=ae();if(Le.then(function(Z){if(M._status===0||M._status===-1){M._status=1,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="fulfilled",Le.value=Z)}},function(Z){if(M._status===0||M._status===-1){M._status=2,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="rejected",Le.reason=Z)}}),ae=M._ioInfo,ae!=null){ae.value=Le;var Je=Le.displayName;typeof Je=="string"&&(ae.name=Je)}M._status===-1&&(M._status=0,M._result=Le)}if(M._status===1)return ae=M._result,ae===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
2
+ import{$d as zU,$f as Tre,$g as ev,$l as KH,Ae as JU,Af as gR,B as HD,Bb as vU,Cl as OH,Eb as zD,El as SR,Fi as TH,Fk as OA,Gk as _H,Gl as LH,H as CU,Hb as uR,Im as n3,J as SU,Jb as xU,Jh as xH,Kb as dR,Lb as BU,Lc as OU,Mb as wU,Me as XU,Nb as TU,Ne as $U,P as Jo,Pd as HU,Pl as UH,Qc as AR,Qj as kA,Ql as tv,Rc as Ng,Rh as BH,Rl as HH,Sc as LU,Se as ZU,Sg as fH,Tc as UU,Td as KD,Tl as GH,Ul as PH,Vh as wH,Vj as QH,Wb as qD,Wg as hH,X as Bre,Xd as GU,Xf as sH,Xl as jH,Y as bU,Yf as aH,Yg as Wi,Yi as yR,Yl as zH,Z as _g,Zd as PU,Ze as eH,Zf as JD,Zg as ZD,Zl as qH,_ as PD,_d as jU,_f as lH,_g as AH,_j as ER,_l as YH,a as vre,ag as la,ah as mH,al as FH,am as VH,bc as fR,bg as XD,bh as pH,cc as RU,cf as Mg,cg as Rre,ch as gH,cn as r3,dc as QU,dg as Qre,dh as yH,dl as NH,dm as Lg,ec as _U,eh as I0,fc as FU,fd as S0,fh as D0,fm as WH,gc as NU,gh as EH,hc as MU,hh as CH,hi as ca,hm as bR,id as YD,ie as qU,ig as cH,ih as SH,im as JH,je as VD,jh as bH,jm as XH,kh as kg,ki as Mf,kl as CR,lg as $D,lh as IH,li as Og,mb as jD,mh as DH,nb as cR,nc as hR,ne as YU,nf as wre,oe as mR,of as tH,ol as MH,om as $H,pb as DU,pe as KU,pf as nH,pm as nv,q as pU,qe as pR,ql as kH,qm as ZH,re as VU,rf as al,rg as uH,rj as MA,s as gU,se as WU,sf as rH,sg as dH,t as UD,tc as kU,tf as iH,uh as vH,um as e3,vh as rc,vm as t3,x as yU,xe as b0,y as EU,yf as oH,z as lR,ze as WD}from"./chunk-YYIHO5TB.js";import{$ as _i,E as oR,Fd as C0,Na as AU,Qc as mU,Qd as IU,Sd as Fg,Ud as gt,Z as Nf,a as vt,b as Ee,ba as sR,ca as uU,ea as aR,fa as MD,ia as dU,ja as kD,je as RH,la as xre,lc as OD,mc as LD,na as fr,pa as fU,qa as hU,xd as GD,zd as _t}from"./chunk-ALYGAQ7G.js";import{a as $n,c as Ae,d as Dre,e as Ce}from"./chunk-YUXORC52.js";var A3=Ae(Vt=>{"use strict";var vR=Symbol.for("react.transitional.element"),_re=Symbol.for("react.portal"),Fre=Symbol.for("react.fragment"),Nre=Symbol.for("react.strict_mode"),Mre=Symbol.for("react.profiler"),kre=Symbol.for("react.consumer"),Ore=Symbol.for("react.context"),Lre=Symbol.for("react.forward_ref"),Ure=Symbol.for("react.suspense"),Hre=Symbol.for("react.memo"),l3=Symbol.for("react.lazy"),Gre=Symbol.for("react.activity"),i3=Symbol.iterator;function Pre(e){return e===null||typeof e!="object"?null:(e=i3&&e[i3]||e["@@iterator"],typeof e=="function"?e:null)}var c3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},u3=Object.assign,d3={};function Hg(e,t,n){this.props=e,this.context=t,this.refs=d3,this.updater=n||c3}Hg.prototype.isReactComponent={};Hg.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Hg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function f3(){}f3.prototype=Hg.prototype;function xR(e,t,n){this.props=e,this.context=t,this.refs=d3,this.updater=n||c3}var BR=xR.prototype=new f3;BR.constructor=xR;u3(BR,Hg.prototype);BR.isPureReactComponent=!0;var o3=Array.isArray;function DR(){}var wr={H:null,A:null,T:null,S:null},h3=Object.prototype.hasOwnProperty;function wR(e,t,n){var r=n.ref;return{$$typeof:vR,type:e,key:t,ref:r!==void 0?r:null,props:n}}function jre(e,t){return wR(e.type,t,e.props)}function TR(e){return typeof e=="object"&&e!==null&&e.$$typeof===vR}function zre(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var s3=/\/+/g;function IR(e,t){return typeof e=="object"&&e!==null&&e.key!=null?zre(""+e.key):t.toString(36)}function qre(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(DR,DR):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Ug(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case vR:case _re:a=!0;break;case l3:return a=e._init,Ug(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+IR(e,0):r,o3(i)?(n="",a!=null&&(n=a.replace(s3,"$&/")+"/"),Ug(i,t,n,"",function(A){return A})):i!=null&&(TR(i)&&(i=jre(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(s3,"$&/")+"/")+a)),t.push(i)),1;a=0;var c=r===""?".":r+":";if(o3(e))for(var f=0;f<e.length;f++)r=e[f],s=c+IR(r,f),a+=Ug(r,t,n,s,i);else if(f=Pre(e),typeof f=="function")for(e=f.call(e),f=0;!(r=e.next()).done;)r=r.value,s=c+IR(r,f++),a+=Ug(r,t,n,s,i);else if(s==="object"){if(typeof e.then=="function")return Ug(qre(e),t,n,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function rv(e,t,n){if(e==null)return e;var r=[],i=0;return Ug(e,r,"","",function(s){return t.call(n,s,i++)}),r}function Yre(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var a3=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Kre={map:rv,forEach:function(e,t,n){rv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return rv(e,function(){t++}),t},toArray:function(e){return rv(e,function(t){return t})||[]},only:function(e){if(!TR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Vt.Activity=Gre;Vt.Children=Kre;Vt.Component=Hg;Vt.Fragment=Fre;Vt.Profiler=Mre;Vt.PureComponent=xR;Vt.StrictMode=Nre;Vt.Suspense=Ure;Vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wr;Vt.__COMPILER_RUNTIME={__proto__:null,c:function(e){return wr.H.useMemoCache(e)}};Vt.cache=function(e){return function(){return e.apply(null,arguments)}};Vt.cacheSignal=function(){return null};Vt.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=u3({},e.props),i=e.key;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)!h3.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(r[s]=t[s]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var a=Array(s),c=0;c<s;c++)a[c]=arguments[c+2];r.children=a}return wR(e.type,i,r)};Vt.createContext=function(e){return e={$$typeof:Ore,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:kre,_context:e},e};Vt.createElement=function(e,t,n){var r,i={},s=null;if(t!=null)for(r in t.key!==void 0&&(s=""+t.key),t)h3.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var c=Array(a),f=0;f<a;f++)c[f]=arguments[f+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return wR(e,s,i)};Vt.createRef=function(){return{current:null}};Vt.forwardRef=function(e){return{$$typeof:Lre,render:e}};Vt.isValidElement=TR;Vt.lazy=function(e){return{$$typeof:l3,_payload:{_status:-1,_result:e},_init:Yre}};Vt.memo=function(e,t){return{$$typeof:Hre,type:e,compare:t===void 0?null:t}};Vt.startTransition=function(e){var t=wr.T,n={};wr.T=n;try{var r=e(),i=wr.S;i!==null&&i(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(DR,a3)}catch(s){a3(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),wr.T=t}};Vt.unstable_useCacheRefresh=function(){return wr.H.useCacheRefresh()};Vt.use=function(e){return wr.H.use(e)};Vt.useActionState=function(e,t,n){return wr.H.useActionState(e,t,n)};Vt.useCallback=function(e,t){return wr.H.useCallback(e,t)};Vt.useContext=function(e){return wr.H.useContext(e)};Vt.useDebugValue=function(){};Vt.useDeferredValue=function(e,t){return wr.H.useDeferredValue(e,t)};Vt.useEffect=function(e,t){return wr.H.useEffect(e,t)};Vt.useEffectEvent=function(e){return wr.H.useEffectEvent(e)};Vt.useId=function(){return wr.H.useId()};Vt.useImperativeHandle=function(e,t,n){return wr.H.useImperativeHandle(e,t,n)};Vt.useInsertionEffect=function(e,t){return wr.H.useInsertionEffect(e,t)};Vt.useLayoutEffect=function(e,t){return wr.H.useLayoutEffect(e,t)};Vt.useMemo=function(e,t){return wr.H.useMemo(e,t)};Vt.useOptimistic=function(e,t){return wr.H.useOptimistic(e,t)};Vt.useReducer=function(e,t,n){return wr.H.useReducer(e,t,n)};Vt.useRef=function(e){return wr.H.useRef(e)};Vt.useState=function(e){return wr.H.useState(e)};Vt.useSyncExternalStore=function(e,t,n){return wr.H.useSyncExternalStore(e,t,n)};Vt.useTransition=function(){return wr.H.useTransition()};Vt.version="19.2.4"});var m3=Ae((Pt,iv)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){function e(M,ae){Object.defineProperty(r.prototype,M,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",ae[0],ae[1])}})}function t(M){return M===null||typeof M!="object"?null:(M=Ve&&M[Ve]||M["@@iterator"],typeof M=="function"?M:null)}function n(M,ae){M=(M=M.constructor)&&(M.displayName||M.name)||"ReactClass";var Le=M+"."+ae;Re[Le]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",ae,M),Re[Le]=!0)}function r(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function i(){}function s(M,ae,Le){this.props=M,this.context=ae,this.refs=yt,this.updater=Le||bt}function a(){}function c(M){return""+M}function f(M){try{c(M);var ae=!1}catch{ae=!0}if(ae){ae=console;var Le=ae.error,Je=typeof Symbol=="function"&&Symbol.toStringTag&&M[Symbol.toStringTag]||M.constructor.name||"Object";return Le.call(ae,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Je),c(M)}}function A(M){if(M==null)return null;if(typeof M=="function")return M.$$typeof===Gn?null:M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case ft:return"Fragment";case te:return"Profiler";case Ne:return"StrictMode";case St:return"Suspense";case j:return"SuspenseList";case me:return"Activity"}if(typeof M=="object")switch(typeof M.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),M.$$typeof){case Me:return"Portal";case Oe:return M.displayName||"Context";case _e:return(M._context.displayName||"Context")+".Consumer";case nt:var ae=M.render;return M=M.displayName,M||(M=ae.displayName||ae.name||"",M=M!==""?"ForwardRef("+M+")":"ForwardRef"),M;case q:return ae=M.displayName||null,ae!==null?ae:A(M.type)||"Memo";case Y:ae=M._payload,M=M._init;try{return A(M(ae))}catch{}}return null}function m(M){if(M===ft)return"<>";if(typeof M=="object"&&M!==null&&M.$$typeof===Y)return"<...>";try{var ae=A(M);return ae?"<"+ae+">":"<...>"}catch{return"<...>"}}function y(){var M=pt.A;return M===null?null:M.getOwner()}function C(){return Error("react-stack-top-frame")}function p(M){if(Ci.call(M,"key")){var ae=Object.getOwnPropertyDescriptor(M,"key").get;if(ae&&ae.isReactWarning)return!1}return M.key!==void 0}function g(M,ae){function Le(){Jn||(Jn=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",ae))}Le.isReactWarning=!0,Object.defineProperty(M,"key",{get:Le,configurable:!0})}function b(){var M=A(this.type);return eo[M]||(eo[M]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),M=this.props.ref,M!==void 0?M:null}function v(M,ae,Le,Je,Z,se){var Se=Le.ref;return M={$$typeof:De,type:M,key:ae,props:Le,_owner:Je},(Se!==void 0?Se:null)!==null?Object.defineProperty(M,"ref",{enumerable:!1,get:b}):Object.defineProperty(M,"ref",{enumerable:!1,value:null}),M._store={},Object.defineProperty(M._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(M,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(M,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.defineProperty(M,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(M.props),Object.freeze(M)),M}function w(M,ae){return ae=v(M.type,ae,M.props,M._owner,M._debugStack,M._debugTask),M._store&&(ae._store.validated=M._store.validated),ae}function T(M){_(M)?M._store&&(M._store.validated=1):typeof M=="object"&&M!==null&&M.$$typeof===Y&&(M._payload.status==="fulfilled"?_(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function _(M){return typeof M=="object"&&M!==null&&M.$$typeof===De}function k(M){var ae={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Le){return ae[Le]})}function O(M,ae){return typeof M=="object"&&M!==null&&M.key!=null?(f(M.key),k(""+M.key)):ae.toString(36)}function G(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(a,a):(M.status="pending",M.then(function(ae){M.status==="pending"&&(M.status="fulfilled",M.value=ae)},function(ae){M.status==="pending"&&(M.status="rejected",M.reason=ae)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function W(M,ae,Le,Je,Z){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var Se=!1;if(M===null)Se=!0;else switch(se){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(M.$$typeof){case De:case Me:Se=!0;break;case Y:return Se=M._init,W(Se(M._payload),ae,Le,Je,Z)}}if(Se){Se=M,Z=Z(Se);var Ze=Je===""?"."+O(Se,0):Je;return Fr(Z)?(Le="",Ze!=null&&(Le=Ze.replace(ki,"$&/")+"/"),W(Z,ae,Le,"",function(mr){return mr})):Z!=null&&(_(Z)&&(Z.key!=null&&(Se&&Se.key===Z.key||f(Z.key)),Le=w(Z,Le+(Z.key==null||Se&&Se.key===Z.key?"":(""+Z.key).replace(ki,"$&/")+"/")+Ze),Je!==""&&Se!=null&&_(Se)&&Se.key==null&&Se._store&&!Se._store.validated&&(Le._store.validated=2),Z=Le),ae.push(Z)),1}if(Se=0,Ze=Je===""?".":Je+":",Fr(M))for(var Et=0;Et<M.length;Et++)Je=M[Et],se=Ze+O(Je,Et),Se+=W(Je,ae,Le,se,Z);else if(Et=t(M),typeof Et=="function")for(Et===M.entries&&(Nr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Nr=!0),M=Et.call(M),Et=0;!(Je=M.next()).done;)Je=Je.value,se=Ze+O(Je,Et++),Se+=W(Je,ae,Le,se,Z);else if(se==="object"){if(typeof M.then=="function")return W(G(M),ae,Le,Je,Z);throw ae=String(M),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Se}function z(M,ae,Le){if(M==null)return M;var Je=[],Z=0;return W(M,Je,"","",function(se){return ae.call(Le,se,Z++)}),Je}function P(M){if(M._status===-1){var ae=M._ioInfo;ae!=null&&(ae.start=ae.end=performance.now()),ae=M._result;var Le=ae();if(Le.then(function(Z){if(M._status===0||M._status===-1){M._status=1,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="fulfilled",Le.value=Z)}},function(Z){if(M._status===0||M._status===-1){M._status=2,M._result=Z;var se=M._ioInfo;se!=null&&(se.end=performance.now()),Le.status===void 0&&(Le.status="rejected",Le.reason=Z)}}),ae=M._ioInfo,ae!=null){ae.value=Le;var Je=Le.displayName;typeof Je=="string"&&(ae.name=Je)}M._status===-1&&(M._status=0,M._result=Le)}if(M._status===1)return ae=M._result,ae===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
3
3
 
4
4
  Your code should look like:
5
5
  const MyComponent = lazy(() => import('./MyComponent'))
@@ -729,7 +729,7 @@ ${e.map(i=>{let s=YT.basename(i.path),a=(t.get(s)||0)>1,c=YT.basename(YT.dirname
729
729
  ${m.map(y=>` - ${y}`).join(`
730
730
  `)}
731
731
 
732
- Use /mcp auth <server-name> to authenticate.`}}let a=s[n];if(!a)return{type:"message",messageType:"error",content:`MCP server '${n}' not found.`};let c=f=>{e.ui.addItem({type:"info",text:f})};gt.on("oauth-display-message",c);try{e.ui.addItem({type:"info",text:`Starting OAuth authentication for MCP server '${n}'...`});let{MCPOAuthProvider:f}=await import("./core-WBV2NJVB.js"),A=a.oauth;A||(A={enabled:!1});let m=a.httpUrl||a.url;await new f(new ER).authenticate(n,A,m),e.ui.addItem({type:"info",text:`\u2705 Successfully authenticated with MCP server '${n}'!`});let C=i.getMcpClientManager();C&&(e.ui.addItem({type:"info",text:`Restarting MCP server '${n}'...`}),await C.restartServer(n));let p=e.services.agentContext?.geminiClient;return p?.isInitialized()&&await p.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:`Successfully authenticated and reloaded tools for '${n}'`}}catch(f){return{type:"message",messageType:"error",content:`Failed to authenticate with MCP server '${n}': ${_t(f)}`}}finally{gt.removeListener("oauth-display-message",c)}},completion:async(e,t)=>{let r=e.services.agentContext?.config;if(!r)return[];let i=r.getMcpClientManager()?.getMcpServers()||{};return Object.keys(i).filter(s=>s.startsWith(t))}},VT=async(e,t=!1,n=!1)=>{let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=r.toolRegistry;if(!s)return{type:"message",messageType:"error",content:"Could not retrieve tool registry."};let a=i.getMcpClientManager()?.getMcpServers()||{},c=Object.keys(a),f=i.getMcpClientManager()?.getBlockedMcpServers()||[],A=c.filter(z=>MH(z)==="connecting"),y=kH()==="in_progress"||A.length>0,p=s.getAllTools().filter(z=>z instanceof mU),b=i.getPromptRegistry().getAllPrompts().filter(z=>"serverName"in z&&c.includes(z.serverName)),w=i.getResourceRegistry().getAllResources().filter(z=>c.includes(z.serverName)),T={},_=new ER;for(let z of c)if(a[z].oauth?.enabled||CR.has(z)){let V=await _.getCredentials(z);V?V.token.expiresAt&&V.token.expiresAt<Date.now()?T[z]="expired":T[z]="authenticated":T[z]="unauthenticated"}else T[z]="not-configured";let k=Ih.getInstance(),O={};for(let z of c)O[z]=await k.getDisplayState(z);let G={};for(let z of c){let P=i.getMcpClientManager()?.getLastError(z);P&&(G[z]=P)}let W={type:"mcp_status",servers:a,tools:p.map(z=>({serverName:z.serverName,name:z.name,description:z.description,schema:z.schema})),prompts:b.map(z=>({serverName:z.serverName,name:z.name,description:z.description})),resources:w.map(z=>({serverName:z.serverName,name:z.name,uri:z.uri,mimeType:z.mimeType,description:z.description})),authStatus:T,enablementState:O,errors:G,blockedServers:f.map(z=>({name:z.name,extensionName:z.extensionName})),discoveryInProgress:y,connectingServers:A,showDescriptions:!!t,showSchema:!!n};e.ui.addItem(W)},rne={name:"list",altNames:["ls","nodesc","nodescription"],description:"List configured MCP servers and tools",kind:"built-in",autoExecute:!0,action:e=>VT(e)},lTe={name:"desc",altNames:["description"],description:"List configured MCP servers and tools with descriptions",kind:"built-in",autoExecute:!0,action:e=>VT(e,!0)},cTe={name:"schema",description:"List configured MCP servers and tools with descriptions and schemas",kind:"built-in",autoExecute:!0,action:e=>VT(e,!0,!0)},uTe={name:"reload",altNames:["refresh"],description:"Reloads MCP servers",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext,n=t?.config;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let r=n.getMcpClientManager();if(!r)return{type:"message",messageType:"error",content:"Could not retrieve mcp client manager."};e.ui.addItem({type:"info",text:"Reloading MCP servers..."}),await r.restart();let i=t.geminiClient;return i?.isInitialized()&&await i.setTools(),e.ui.reloadCommands(),rne.action(e,"")}};async function ine(e,t,n){let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=t.trim().split(/\s+/),a=s.includes("--session"),c=s.filter(b=>b!=="--session")[0],f=n?"enable":"disable";if(!c)return{type:"message",messageType:"error",content:`Server name required. Usage: /mcp ${f} <server-name> [--session]`};let A=ya(c),m=i.getMcpClientManager()?.getMcpServers()||{};if(!Object.keys(m).map(ya).includes(A))return{type:"message",messageType:"error",content:`Server '${c}' not found. Use /mcp list to see available servers.`};let C=Ih.getInstance();if(n){let b=Cy(),v=await yee(A,{adminMcpEnabled:b.merged.admin?.mcp?.enabled??!0,allowedList:b.merged.mcp?.allowed,excludedList:b.merged.mcp?.excluded});if(!v.allowed&&(v.blockType==="allowlist"||v.blockType==="excludelist"))return{type:"message",messageType:"error",content:v.reason??"Blocked by settings."};a?C.clearSessionDisable(A):await C.enable(A),v.blockType==="admin"&&e.ui.addItem({type:"warning",text:"MCP disabled by admin. Will load when enabled."},Date.now())}else a?C.disableForSession(A):await C.disable(A);let p=`MCP server '${A}' ${n?"enabled":"disabled"}${a?" for this session":""}.`,g=i.getMcpClientManager();return g&&(e.ui.addItem({type:"info",text:"Reloading MCP servers..."},Date.now()),await g.restart()),r.geminiClient?.isInitialized()&&await r.geminiClient.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:p}}async function one(e,t,n){let i=e.services.agentContext?.config;if(!i)return[];let s=Object.keys(i.getMcpClientManager()?.getMcpServers()||{}),a=Ih.getInstance(),c=[];for(let f of s)(await a.getDisplayState(f)).enabled===n&&f.startsWith(t)&&c.push(f);return c}var dTe={name:"enable",description:"Enable a disabled MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>ine(e,t,!0),completion:(e,t)=>one(e,t,!1)},fTe={name:"disable",description:"Disable an MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>ine(e,t,!1),completion:(e,t)=>one(e,t,!0)},sne={name:"mcp",description:"Manage configured Model Context Protocol (MCP) servers",kind:"built-in",autoExecute:!1,subCommands:[rne,lTe,cTe,aTe,uTe,dTe,fTe],action:async e=>VT(e)};var ane={name:"memory",description:"Commands for interacting with memory",kind:"built-in",autoExecute:!1,subCommands:[{name:"show",description:"Show the current memory contents",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=qH(t);e.ui.addItem({type:"info",text:n.content},Date.now())}},{name:"add",description:"Add content to the memory",kind:"built-in",autoExecute:!1,action:(e,t)=>{let n=YH(t);return n.type==="message"||e.ui.addItem({type:"info",text:`Attempting to save to memory: "${t.trim()}"`},Date.now()),n}},{name:"reload",altNames:["refresh"],description:"Reload the memory from the source",kind:"built-in",autoExecute:!0,action:async e=>{e.ui.addItem({type:"info",text:"Reloading memory from source files..."},Date.now());try{let t=e.services.agentContext?.config;if(t){let n=await KH(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}catch(t){e.ui.addItem({type:"error",text:`Error reloading memory: ${t.message}`},Date.now())}}},{name:"list",description:"Lists the paths of the GEMINI.md files in use",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=VH(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}]};var hTe={name:"set",description:"Set the model to use. Usage: /model set <model-name> [--persist]",kind:"built-in",autoExecute:!1,action:async(e,t)=>{let n=t.trim().split(/\s+/).filter(Boolean);if(n.length===0){e.ui.addItem({type:"error",text:"Usage: /model set <model-name> [--persist]"});return}let r=n[0],i=n.includes("--persist");if(e.services.agentContext?.config){e.services.agentContext.config.setModel(r,!i);let s=new wU(r);YU(e.services.agentContext.config,s),e.ui.addItem({type:"info",text:`Model set to ${r}${i?" (persisted)":""}`})}}},lne={name:"manage",description:"Opens a dialog to configure the model",kind:"built-in",autoExecute:!0,action:async e=>(e.services.agentContext?.config&&await e.services.agentContext.config.refreshUserQuota(),{type:"dialog",dialog:"model"})},cne={name:"model",description:"Manage model configuration",kind:"built-in",autoExecute:!1,subCommands:[lne,hTe],action:async(e,t)=>lne.action(e,t)};var Zi=Ce(ut(),1);var it=Ce(It(),1);var FO=6,NO=20,WT=25,qm=5,une=10,sI=e=>!e||!e.reactionGroups?0:e.reactionGroups.reduce((t,n)=>t+n.users.totalCount,0),mTe=(e,t)=>t?.toLowerCase()==="duplicate"?"magenta":e==="OPEN"?"green":"red",dne=({config:e,onExit:t,initialLimit:n=50})=>{let r=yi(),[i,s]=(0,Zi.useState)({status:"loading",issues:[],currentIndex:0,analysisCache:new Map,analyzingIds:new Set,message:"Fetching issues..."}),[a,c]=(0,Zi.useState)("target"),[f,A]=(0,Zi.useState)(0),[m,y]=(0,Zi.useState)(!1),[C,p]=(0,Zi.useState)(0),[g,b]=(0,Zi.useState)(0),[v,w]=(0,Zi.useState)(""),[T,_]=(0,Zi.useState)([]),[k,O]=(0,Zi.useState)(!1),[G,W]=(0,Zi.useState)(0);(0,Zi.useEffect)(()=>{f<G?W(f):f>=G+qm&&W(f-qm+1)},[f,G]);let z=async Ne=>{try{let{stdout:te}=await Jo("gh",["issue","view",String(Ne),"--json","number,title,body,state,stateReason,labels,url,comments,author,reactionGroups"]);return JSON.parse(te)}catch(te){return Ee.error(`Failed to fetch details for candidate #${Ne}`,te),null}},P=(0,Zi.useCallback)(async Ne=>{let te=Ne.comments.find(Re=>Re.body.includes("Found possible duplicate issues:"));if(!te)return null;let _e=te.body.split(`
732
+ Use /mcp auth <server-name> to authenticate.`}}let a=s[n];if(!a)return{type:"message",messageType:"error",content:`MCP server '${n}' not found.`};let c=f=>{e.ui.addItem({type:"info",text:f})};gt.on("oauth-display-message",c);try{e.ui.addItem({type:"info",text:`Starting OAuth authentication for MCP server '${n}'...`});let{MCPOAuthProvider:f}=await import("./core-QJQCNUBM.js"),A=a.oauth;A||(A={enabled:!1});let m=a.httpUrl||a.url;await new f(new ER).authenticate(n,A,m),e.ui.addItem({type:"info",text:`\u2705 Successfully authenticated with MCP server '${n}'!`});let C=i.getMcpClientManager();C&&(e.ui.addItem({type:"info",text:`Restarting MCP server '${n}'...`}),await C.restartServer(n));let p=e.services.agentContext?.geminiClient;return p?.isInitialized()&&await p.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:`Successfully authenticated and reloaded tools for '${n}'`}}catch(f){return{type:"message",messageType:"error",content:`Failed to authenticate with MCP server '${n}': ${_t(f)}`}}finally{gt.removeListener("oauth-display-message",c)}},completion:async(e,t)=>{let r=e.services.agentContext?.config;if(!r)return[];let i=r.getMcpClientManager()?.getMcpServers()||{};return Object.keys(i).filter(s=>s.startsWith(t))}},VT=async(e,t=!1,n=!1)=>{let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=r.toolRegistry;if(!s)return{type:"message",messageType:"error",content:"Could not retrieve tool registry."};let a=i.getMcpClientManager()?.getMcpServers()||{},c=Object.keys(a),f=i.getMcpClientManager()?.getBlockedMcpServers()||[],A=c.filter(z=>MH(z)==="connecting"),y=kH()==="in_progress"||A.length>0,p=s.getAllTools().filter(z=>z instanceof mU),b=i.getPromptRegistry().getAllPrompts().filter(z=>"serverName"in z&&c.includes(z.serverName)),w=i.getResourceRegistry().getAllResources().filter(z=>c.includes(z.serverName)),T={},_=new ER;for(let z of c)if(a[z].oauth?.enabled||CR.has(z)){let V=await _.getCredentials(z);V?V.token.expiresAt&&V.token.expiresAt<Date.now()?T[z]="expired":T[z]="authenticated":T[z]="unauthenticated"}else T[z]="not-configured";let k=Ih.getInstance(),O={};for(let z of c)O[z]=await k.getDisplayState(z);let G={};for(let z of c){let P=i.getMcpClientManager()?.getLastError(z);P&&(G[z]=P)}let W={type:"mcp_status",servers:a,tools:p.map(z=>({serverName:z.serverName,name:z.name,description:z.description,schema:z.schema})),prompts:b.map(z=>({serverName:z.serverName,name:z.name,description:z.description})),resources:w.map(z=>({serverName:z.serverName,name:z.name,uri:z.uri,mimeType:z.mimeType,description:z.description})),authStatus:T,enablementState:O,errors:G,blockedServers:f.map(z=>({name:z.name,extensionName:z.extensionName})),discoveryInProgress:y,connectingServers:A,showDescriptions:!!t,showSchema:!!n};e.ui.addItem(W)},rne={name:"list",altNames:["ls","nodesc","nodescription"],description:"List configured MCP servers and tools",kind:"built-in",autoExecute:!0,action:e=>VT(e)},lTe={name:"desc",altNames:["description"],description:"List configured MCP servers and tools with descriptions",kind:"built-in",autoExecute:!0,action:e=>VT(e,!0)},cTe={name:"schema",description:"List configured MCP servers and tools with descriptions and schemas",kind:"built-in",autoExecute:!0,action:e=>VT(e,!0,!0)},uTe={name:"reload",altNames:["refresh"],description:"Reloads MCP servers",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext,n=t?.config;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let r=n.getMcpClientManager();if(!r)return{type:"message",messageType:"error",content:"Could not retrieve mcp client manager."};e.ui.addItem({type:"info",text:"Reloading MCP servers..."}),await r.restart();let i=t.geminiClient;return i?.isInitialized()&&await i.setTools(),e.ui.reloadCommands(),rne.action(e,"")}};async function ine(e,t,n){let r=e.services.agentContext,i=r?.config;if(!i)return{type:"message",messageType:"error",content:"Config not loaded."};i.setUserInteractedWithMcp();let s=t.trim().split(/\s+/),a=s.includes("--session"),c=s.filter(b=>b!=="--session")[0],f=n?"enable":"disable";if(!c)return{type:"message",messageType:"error",content:`Server name required. Usage: /mcp ${f} <server-name> [--session]`};let A=ya(c),m=i.getMcpClientManager()?.getMcpServers()||{};if(!Object.keys(m).map(ya).includes(A))return{type:"message",messageType:"error",content:`Server '${c}' not found. Use /mcp list to see available servers.`};let C=Ih.getInstance();if(n){let b=Cy(),v=await yee(A,{adminMcpEnabled:b.merged.admin?.mcp?.enabled??!0,allowedList:b.merged.mcp?.allowed,excludedList:b.merged.mcp?.excluded});if(!v.allowed&&(v.blockType==="allowlist"||v.blockType==="excludelist"))return{type:"message",messageType:"error",content:v.reason??"Blocked by settings."};a?C.clearSessionDisable(A):await C.enable(A),v.blockType==="admin"&&e.ui.addItem({type:"warning",text:"MCP disabled by admin. Will load when enabled."},Date.now())}else a?C.disableForSession(A):await C.disable(A);let p=`MCP server '${A}' ${n?"enabled":"disabled"}${a?" for this session":""}.`,g=i.getMcpClientManager();return g&&(e.ui.addItem({type:"info",text:"Reloading MCP servers..."},Date.now()),await g.restart()),r.geminiClient?.isInitialized()&&await r.geminiClient.setTools(),e.ui.reloadCommands(),{type:"message",messageType:"info",content:p}}async function one(e,t,n){let i=e.services.agentContext?.config;if(!i)return[];let s=Object.keys(i.getMcpClientManager()?.getMcpServers()||{}),a=Ih.getInstance(),c=[];for(let f of s)(await a.getDisplayState(f)).enabled===n&&f.startsWith(t)&&c.push(f);return c}var dTe={name:"enable",description:"Enable a disabled MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>ine(e,t,!0),completion:(e,t)=>one(e,t,!1)},fTe={name:"disable",description:"Disable an MCP server",kind:"built-in",autoExecute:!0,action:(e,t)=>ine(e,t,!1),completion:(e,t)=>one(e,t,!0)},sne={name:"mcp",description:"Manage configured Model Context Protocol (MCP) servers",kind:"built-in",autoExecute:!1,subCommands:[rne,lTe,cTe,aTe,uTe,dTe,fTe],action:async e=>VT(e)};var ane={name:"memory",description:"Commands for interacting with memory",kind:"built-in",autoExecute:!1,subCommands:[{name:"show",description:"Show the current memory contents",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=qH(t);e.ui.addItem({type:"info",text:n.content},Date.now())}},{name:"add",description:"Add content to the memory",kind:"built-in",autoExecute:!1,action:(e,t)=>{let n=YH(t);return n.type==="message"||e.ui.addItem({type:"info",text:`Attempting to save to memory: "${t.trim()}"`},Date.now()),n}},{name:"reload",altNames:["refresh"],description:"Reload the memory from the source",kind:"built-in",autoExecute:!0,action:async e=>{e.ui.addItem({type:"info",text:"Reloading memory from source files..."},Date.now());try{let t=e.services.agentContext?.config;if(t){let n=await KH(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}catch(t){e.ui.addItem({type:"error",text:`Error reloading memory: ${t.message}`},Date.now())}}},{name:"list",description:"Lists the paths of the GEMINI.md files in use",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return;let n=VH(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}]};var hTe={name:"set",description:"Set the model to use. Usage: /model set <model-name> [--persist]",kind:"built-in",autoExecute:!1,action:async(e,t)=>{let n=t.trim().split(/\s+/).filter(Boolean);if(n.length===0){e.ui.addItem({type:"error",text:"Usage: /model set <model-name> [--persist]"});return}let r=n[0],i=n.includes("--persist");if(e.services.agentContext?.config){e.services.agentContext.config.setModel(r,!i);let s=new wU(r);YU(e.services.agentContext.config,s),e.ui.addItem({type:"info",text:`Model set to ${r}${i?" (persisted)":""}`})}}},lne={name:"manage",description:"Opens a dialog to configure the model",kind:"built-in",autoExecute:!0,action:async e=>(e.services.agentContext?.config&&await e.services.agentContext.config.refreshUserQuota(),{type:"dialog",dialog:"model"})},cne={name:"model",description:"Manage model configuration",kind:"built-in",autoExecute:!1,subCommands:[lne,hTe],action:async(e,t)=>lne.action(e,t)};var Zi=Ce(ut(),1);var it=Ce(It(),1);var FO=6,NO=20,WT=25,qm=5,une=10,sI=e=>!e||!e.reactionGroups?0:e.reactionGroups.reduce((t,n)=>t+n.users.totalCount,0),mTe=(e,t)=>t?.toLowerCase()==="duplicate"?"magenta":e==="OPEN"?"green":"red",dne=({config:e,onExit:t,initialLimit:n=50})=>{let r=yi(),[i,s]=(0,Zi.useState)({status:"loading",issues:[],currentIndex:0,analysisCache:new Map,analyzingIds:new Set,message:"Fetching issues..."}),[a,c]=(0,Zi.useState)("target"),[f,A]=(0,Zi.useState)(0),[m,y]=(0,Zi.useState)(!1),[C,p]=(0,Zi.useState)(0),[g,b]=(0,Zi.useState)(0),[v,w]=(0,Zi.useState)(""),[T,_]=(0,Zi.useState)([]),[k,O]=(0,Zi.useState)(!1),[G,W]=(0,Zi.useState)(0);(0,Zi.useEffect)(()=>{f<G?W(f):f>=G+qm&&W(f-qm+1)},[f,G]);let z=async Ne=>{try{let{stdout:te}=await Jo("gh",["issue","view",String(Ne),"--json","number,title,body,state,stateReason,labels,url,comments,author,reactionGroups"]);return JSON.parse(te)}catch(te){return Ee.error(`Failed to fetch details for candidate #${Ne}`,te),null}},P=(0,Zi.useCallback)(async Ne=>{let te=Ne.comments.find(Re=>Re.body.includes("Found possible duplicate issues:"));if(!te)return null;let _e=te.body.split(`
733
733
  `),Oe=[];for(let Re of _e){let bt=Re.match(/#(\d+)/);if(bt){let kt=parseInt(bt[1],10);kt!==Ne.number&&Oe.push(kt)}}if(Oe.length===0)return null;let nt=[];for(let Re of Oe){let bt=await z(Re);bt&&nt.push(bt)}let St=e.getBaseLlmClient(),j=`
734
734
  I am triaging a GitHub issue labeled as 'possible-duplicate'. I need to decide if it should be marked as a duplicate of another issue, or if one of the other issues should be marked as a duplicate of this one.
735
735