makecoder 2.0.87 → 2.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cc.mjs +4503 -4078
- package/dist/coder.js +11 -11
- package/dist/gemini/{chunk-A57O7UVO.js → chunk-27LZDLAX.js} +4 -4
- package/dist/gemini/{chunk-FEX45IWO.js → chunk-FMLNMYSS.js} +4 -4
- package/dist/gemini/{chunk-YE6OXWU4.js → chunk-NQYDZB3F.js} +4 -4
- package/dist/gemini/{chunk-6V5V2R7S.js → chunk-UNZWUZT5.js} +4 -4
- package/dist/gemini/{core-AFD3OUDK.js → core-U4UJ5U3G.js} +1 -1
- package/dist/gemini/{devtoolsService-DJTNWRMQ.js → devtoolsService-BBOQUUGQ.js} +2 -2
- package/dist/gemini/{devtoolsService-GYMIUIIB.js → devtoolsService-PN4R3RGP.js} +2 -2
- package/dist/gemini/{dist-NPRLGLEW.js → dist-6PSWV5BS.js} +1 -1
- package/dist/gemini/gemini.js +5 -5
- package/dist/gemini/{interactiveCli-7QLLCKC2.js → interactiveCli-6WSVWOAC.js} +3 -3
- package/dist/gemini/{interactiveCli-NM7PITEU.js → interactiveCli-EQRMKGTD.js} +3 -3
- package/dist/gemini/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/dist/gemini/{oauth2-provider-DLXP22T7.js → oauth2-provider-2QJJEEM6.js} +1 -1
- package/dist/gemini/{oauth2-provider-UJ5SOZ4D.js → oauth2-provider-4HGPOCXM.js} +1 -1
- package/package.json +4 -4
- /package/dist/gemini/{tree-sitter-SPJ4FOC6.js → tree-sitter-NXEUY244.js} +0 -0
- /package/dist/gemini/{tree-sitter-bash-NLKDXHN2.js → tree-sitter-bash-CUUXV34I.js} +0 -0
package/dist/coder.js
CHANGED
|
@@ -198,15 +198,15 @@ CONFIG:
|
|
|
198
198
|
Default configuration is stored in ~/.coder/config.json
|
|
199
199
|
Command line --agent overrides the default but doesn't modify the file.
|
|
200
200
|
Auth credentials can be stored in config file under "auth" section.
|
|
201
|
-
`)}};he.exports=H});var
|
|
201
|
+
`)}};he.exports=H});var N=p((Ws,ge)=>{function ls(h=process.argv.slice(2)){return h.includes("--print")||h.includes("-p")}ge.exports={isPrintMode:ls}});var B=p((Js,pe)=>{var{spawn:us}=require("child_process"),A=require("path"),I=require("fs"),fe=require("os"),{isPrintMode:me}=N(),K=class{constructor(e){this.config=e}resloveSettingFilePath(e){return A.join(e,this.config.configDir,"settings.json")}readModelFromSettingsFile(e){try{let s=this.resloveSettingFilePath(e);if(I.existsSync(s)){let t=I.readFileSync(s,"utf8"),o=JSON.parse(t);if(o&&o.model)return o.model}}catch(s){console.warn(e,s.message)}return null}getCurrentModel(e){let s=e.findIndex(o=>o==="--model");if(s!==-1&&s+1<e.length)return e[s+1];let t=this.readModelFromSettingsFile(process.cwd());return t||(t=this.readModelFromSettingsFile(fe.homedir()),t)?t:this.config.defaultModel}async ensureConfig(e=0){let s=A.join(fe.homedir(),this.config.configDir,this.config.configFile),t=A.dirname(s);if(!I.existsSync(s)){let o=this.config.defaultConfig||{};try{I.existsSync(t)||I.mkdirSync(t,{recursive:!0}),I.writeFileSync(s,JSON.stringify(o,null,2)),e>0&&await new Promise(n=>setTimeout(n,e))}catch(n){console.warn(`Failed to create ${this.config.configFile}: ${n.message}`)}}}findExecutablePath(){let e=A.dirname(require.main.filename);for(let s of this.config.executablePaths){let t=A.resolve(e,s);if(I.existsSync(t))return t}throw new Error(`Could not find executable in any of the configured paths: ${this.config.executablePaths.join(", ")}`)}handleChildMessages(e){process.env.CODEV_DEBUG&&console.log("Child process message handler initialized"),e.connected&&(e.on("message",s=>{this.onChildMessage(s)}),e.on("exit",async(s,t)=>{try{await this.handleChildProcessExit(s,t)}catch(o){console.error("Error in handleChildProcessExit:",o.message)}}),e.on("error",s=>{this.handleChildProcessError(s)}))}onChildMessage(e){process.env.CODEV_DEBUG&&console.log("Received IPC message from child:",e)}handleChildProcessExit(e,s){}handleChildProcessError(e){}async launch(e={}){let{remainingArgs:s=[],codevServer:t,auth_ak:o=null,auth_sk:n=null}=e;try{let i=this.getCurrentModel(s);me(s)||console.log(`model:\x1B[90m\x1B[3m ${i} (use /model to switch models) \x1B[0m`),await this.ensureConfig(1e3);let a=this.findExecutablePath();return process.env.CODEV_DEBUG&&console.log(`executablePath: ${a}`),new Promise((r,c)=>{let l={...process.env,...this.config.environmentVariables(t)};o&&(l.CODEV_AUTH_AK=o),n&&(l.CODEV_AUTH_SK=n);let u=["--no-warnings"];process.env.CODEV_INSPECT_BRK==="True"&&u.push("--inspect-brk"),u.push(a,...s);let d=us("node",u,{env:l,stdio:["inherit","inherit","inherit","ipc"]});this.handleChildMessages(d),d.on("error",f=>{console.error(`Failed to start: ${f.message}`),c(f)}),d.on("exit",async(f,F)=>{me(s)||F&&console.log(`terminated by signal: ${F}`)}),process.on("SIGINT",async()=>{console.log(`
|
|
202
202
|
Terminating ...`),d.kill("SIGTERM"),setTimeout(()=>{d.killed||d.kill("SIGKILL")},8e3)}),process.on("SIGTERM",async()=>{console.log(`
|
|
203
|
-
Terminating ...`),d.kill("SIGTERM"),setTimeout(()=>{d.killed||d.kill("SIGKILL")},8e3)})})}catch(i){throw i}}};pe.exports=K});var Se=p((Qs,ye)=>{var g=process.env.CODEV_DEBUG==="True",j=class{constructor(e={}){this.queue=[],this.processing=!1,this.shuttingDown=!1,this.shutdownTimeout=e.shutdownTimeout||5e3,this.maxRetries=e.maxRetries||3,this.retryDelay=e.retryDelay||1e3,this.onProcessMessage=e.onProcessMessage||null,this.shutdownPromise=null,this.currentlyProcessing=null}enqueue(e){if(this.shuttingDown)return g&&console.log("Queue is shutting down, skipping new messages"),null;let s={id:Date.now()+Math.random(),data:e,timestamp:Date.now(),retryCount:0,processing:!1};return this.queue.push(s),g&&console.log(`Message enqueued, queue length: ${this.queue.length}`),this.processQueue(),s.id}dequeue(){let e=this.queue.shift();return g&&e&&console.log(`Message dequeued, remaining queue length: ${this.queue.length}`),e}removeById(e){let s=this.queue.findIndex(t=>t.id===e);return s>-1?(this.queue.splice(s,1),g&&console.log(`Message ${e} removed from queue`),!0):!1}async processQueue(){if(!(this.processing||this.queue.length===0)){this.processing=!0;try{for(;this.queue.length>0&&!this.shuttingDown;){let e=this.queue[0];e.processing=!0;try{this.onProcessMessage&&await this.onProcessMessage(e),this.dequeue()}catch(s){if(g&&console.error(`Failed to process message: ${s.message}`),e.retryCount++,g&&console.log("Start Retry:",e.retryCount,"times..."),e.retryCount>=this.maxRetries)g&&console.error("Message exceeded max retries, removing from queue"),this.dequeue();else{e.processing=!1;let t=this.shuttingDown?100:this.retryDelay*e.retryCount;await new Promise(o=>setTimeout(o,t))}}}}finally{this.processing=!1}}}getQueueSize(){return this.queue.length}clear(){this.queue=[],g&&console.log("Message queue cleared")}setMessageProcessor(e){this.onProcessMessage=e}async waitForProcessingMessages(e=5e3){let s=this.queue.filter(o=>o.processing);if(s.length===0)return;g&&console.log(`Waiting for ${s.length} processing messages to complete (timeout: ${e}ms)`);let t=Date.now();for(;Date.now()-t<e;){if(this.queue.filter(n=>n.processing).length===0){g&&console.log(`All processing messages completed in ${Date.now()-t}ms`);return}await new Promise(n=>setTimeout(n,50))}if(g){let o=this.queue.filter(n=>n.processing);console.log(`Timeout waiting for processing messages. ${o.length} messages still processing`)}}async gracefulShutdown(e={}){if(this.shutdownPromise)return this.shutdownPromise;let{timeoutMs:s=this.shutdownTimeout,batchSize:t=10,fastMode:o=!1}=e;return this.shutdownPromise=new Promise(async n=>{this.shuttingDown=!0,await this.waitForProcessingMessages(Math.min(s*.3,3e3));let i=this.queue.filter(f=>!f.processing),a=i.length;g&&(console.log(`Starting graceful shutdown with ${a} pending messages (${this.queue.length-a} already processing)`),console.log(`Mode: ${o?"fast (parallel)":"sequential"}, timeout: ${s}ms`));let r=Date.now(),c=0,l=0;try{if(o){let f=await this.processAllParallel(s-(Date.now()-r),i);c=f.processed,l=f.failed}else{let f=await this.processInBatches(t,s-(Date.now()-r),i);c=f.processed,l=f.failed}}catch(f){g&&console.error("Error during shutdown processing:",f.message)}let u=Date.now()-r,d=this.queue.length;g&&(console.log(`Shutdown completed in ${u}ms:`),console.log(` - Total: ${a} messages`),console.log(` - Processed: ${c}`),console.log(` - Failed: ${l}`),console.log(` - Remaining: ${d}`)),n({totalMessages:a,processedMessages:c,failedMessages:l,remainingMessages:d,duration:u,allMessagesSent:d===0&&l===0})}),this.shutdownPromise}async processAllParallel(e){if(this.queue.length===0)return{processed:0,failed:0};g&&console.log(`Processing ${this.queue.length} messages in parallel...`);let s=[...this.queue];this.queue=[];let t=s.map(async r=>{try{return this.onProcessMessage&&await this.onProcessMessage(r),{success:!0,messageId:r.id}}catch(c){return g&&console.warn(`Message ${r.id} processing failed: ${c.message}`),{success:!1,messageId:r.id,error:c}}}),o=new Promise(r=>{setTimeout(()=>r({timedOut:!0}),e)}),n=await Promise.race([Promise.allSettled(t).then(r=>({results:r})),o]);if(n.timedOut)return g&&console.log(`Parallel processing timed out after ${e}ms`),{processed:0,failed:s.length};let i=n.results.filter(r=>r.status==="fulfilled"&&r.value?.success).length,a=s.length-i;return{processed:i,failed:a}}async processInBatches(e,s){if(this.queue.length===0)return{processed:0,failed:0};g&&console.log(`Processing ${this.queue.length} messages in batches of ${e}...`);let t=Date.now(),o=0,n=0;for(;this.queue.length>0&&Date.now()-t<s;){let i=this.queue.splice(0,e),a=i.map(async u=>{try{return this.onProcessMessage&&await this.onProcessMessage(u),{success:!0}}catch(d){return g&&console.warn(`Batch message processing failed: ${d.message}`),{success:!1,error:d}}}),c=(await Promise.allSettled(a)).filter(u=>u.status==="fulfilled"&&u.value?.success).length,l=i.length-c;o+=c,n+=l,g&&i.length>0&&console.log(`Batch completed: ${c}/${i.length} successful`),this.queue.length>0&&await new Promise(u=>setTimeout(u,10))}return this.queue.length>0&&(n+=this.queue.length,g&&console.log(`${this.queue.length} messages not processed due to timeout`),this.queue=[]),{processed:o,failed:n}}async forceFlushAndShutdown(e=2e3){this.shuttingDown=!0,await this.waitForProcessingMessages(Math.min(e*.4,1e3));let s=this.queue.filter(r=>!r.processing);g&&console.log(`Force flush: attempting to send ${s.length} pending messages within ${e}ms (${this.queue.length-s.length} already processing)`);let t=Date.now(),o=s.map(async r=>{try{return this.onProcessMessage&&Date.now()-t<e?(await this.onProcessMessage(r),{success:!0,messageId:r.id}):{success:!1,messageId:r.id,reason:"timeout"}}catch(c){return{success:!1,messageId:r.id,error:c.message}}}),n=e-(Date.now()-t),i=new Promise(r=>{setTimeout(()=>r({timedOut:!0}),Math.max(100,n))}),a=await Promise.race([Promise.allSettled(o).then(r=>({results:r})),i]);if(s.forEach(r=>{let c=this.queue.findIndex(l=>l.id===r.id);c>-1&&this.queue.splice(c,1)}),this.processing=!1,a.timedOut)return g&&console.log(`Force flush timed out after ${e}ms`),{success:!1,reason:"timeout",attemptedCount:s.length};{let r=a.results.filter(c=>c.status==="fulfilled"&&c.value.success).length;return g&&console.log(`Force flush completed: ${r}/${s.length} messages sent`),{success:r===s.length,successCount:r,totalCount:s.length,results:a.results}}}forceShutdown(){this.shuttingDown=!0,this.queue=[],this.processing=!1,g&&console.log("Force shutdown: Queue cleared")}};ye.exports=j});var B=p((Ys,hs)=>{hs.exports={name:"makecoder",version:"2.0.87",description:"MakeCoder: Unified AI agent CLI tool integrating Claude Code, Codex and Gemini CLI",main:"./dist/coder.js",bin:{coder:"./dist/coder.js"},scripts:{test:'echo "Error: no test specified" && exit 1',start:"node ./src/coder.js",build:"node scripts/build.js","build:clean":"node scripts/build.js --clean","build:dev":"node scripts/build.js --no-minify --sourcemap",postinstall:"node scripts/postinstall.js"},keywords:["cli","ai","claude","gemini","codex","agent"],author:"makecoder",license:"MIT",repository:{type:"git",url:"https://github.com/makecoderai/coder.git"},homepage:"https://github.com/makecoderai/coder",dependencies:{"node-fetch":"^3.3.2",open:"^10.1.0",zod:"^3.25.76"},optionalDependencies:{"makecoder-codex-linux-x64":"*","makecoder-codex-darwin-arm64":"*","makecoder-codex-win32-x64":"*"},engines:{node:">=20.0.0"},devDependencies:{chokidar:"^4.0.3"},files:["dist","claude","scripts/postinstall.js"]}});var ve=p((Xs,Ee)=>{var ds=require("http"),gs=require("https"),{URL:we}=require("url"),{version:fs}=B(),Ce=process.env.CODEV_DEBUG==="True",z=class{constructor(e={}){this.baseUrl=e.baseUrl||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json","User-Agent":`codev-cli/${fs}`,...e.headers}}setBaseUrl(e){this.baseUrl=e}setDefaultHeaders(e){this.defaultHeaders={...this.defaultHeaders,...e}}async post(e,s,t={}){let o=this.resolveUrl(e),n={...this.defaultHeaders,...t.headers};return new Promise((i,a)=>{this.validateRequest(o,s,a);let r=this.serializeData(s,a);if(!r)return;n["Content-Length"]=Buffer.byteLength(r);let c=this.buildRequestOptions(o,"POST",n),l=this.getHttpModule(o);Ce&&console.debug(`HTTP POST to ${o} with data length: ${r.length}`);let u=l.request(c,d=>{this.handleResponse(d,i,a)});this.attachErrorHandlers(u,o,a),u.setTimeout(this.timeout),u.write(r),u.end()})}resolveUrl(e){return e.startsWith("http")?e:`${this.baseUrl}${e.startsWith("/")?"":"/"}${e}`}validateRequest(e,s,t){return!e||typeof e!="string"?(t(new Error(`Invalid URL: ${e}`)),!1):s?!0:(t(new Error("No data provided for HTTP POST")),!1)}serializeData(e,s){try{return typeof e=="string"?e:JSON.stringify(e)}catch(t){return s(new Error(`Failed to serialize data: ${t.message}`)),null}}buildRequestOptions(e,s,t){let o=new we(e),n=o.protocol==="https:";return{hostname:o.hostname,port:o.port||(n?443:80),path:o.pathname+o.search,method:s,headers:t}}getHttpModule(e){return new we(e).protocol==="https:"?gs:ds}handleResponse(e,s,t){Ce&&console.debug(`HTTP response status: ${e.statusCode}`);let o="";e.on("data",n=>{o+=n}),e.on("end",()=>{e.statusCode>=200&&e.statusCode<300?s({statusCode:e.statusCode,data:o,headers:e.headers}):t(new Error(`HTTP request returned status ${e.statusCode}: ${o}`))})}attachErrorHandlers(e,s,t){e.on("error",o=>{t(new Error(`HTTP POST request failed: ${o.message}`))}),e.on("timeout",()=>{t(new Error(`HTTP POST request timed out for URL: ${s}`)),e.destroy()})}};Ee.exports=z});var xe=p((Zs,be)=>{var ms=require("crypto"),{URL:ps}=require("url"),W=class{static generateSignature(e,s,t,o){try{let n=new ps(e),i=Buffer.from(n.pathname),a=Buffer.from(i),r=s?typeof s=="string"?Buffer.from(s):Buffer.from(JSON.stringify(s)):Buffer.alloc(0),c=Buffer.concat([a,r,Buffer.from(o)]),l=ms.createHmac("sha256",t);return l.update(c),l.digest("hex")}catch(n){throw new Error(`Failed to generate signature: ${n.message}`)}}static validateSignature(e,s,t,o,n){return this.generateSignature(e,s,t,o)===n}static generateTimestamp(){return Date.now().toString()}};be.exports=W});var ke=p((et,$e)=>{var ys=xe(),J=class{constructor(e={}){this.accessKey=null,this.secretKey=null,this.validateCredentials=e.validateCredentials!==!1}setCredentials(e,s){if(this.validateCredentials&&(!e||!s))throw new Error("Both access key and secret key are required");this.accessKey=e,this.secretKey=s}hasCredentials(){return!!(this.accessKey&&this.secretKey)}generateAuthHeaders(e,s=null){if(!this.hasCredentials())return{};try{return{AUTHORIZATION:`Bearer ${this.accessKey}.${this.secretKey}`}}catch(t){throw new Error(`Failed to generate auth headers: ${t.message}`)}}validateAuthHeaders(e,s,t,o){if(!this.hasCredentials())throw new Error("No credentials available for validation");return ys.validateSignature(e,s,this.secretKey,t,o)}clearCredentials(){this.accessKey=null,this.secretKey=null}getCredentials(){return{accessKey:this.accessKey,hasCredentials:this.hasCredentials()}}};$e.exports=J});var Pe=p((st,Ie)=>{var O=process.env.CODEV_DEBUG==="True",Q=class{constructor(e={}){this.currentSessionId=null,this.previousSessionId=null,this.onSessionSwitch=e.onSessionSwitch||null,this.terminateSignal=e.terminateSignal||"CODEV_TERMINATE_SIGNAL"}handleSessionSwitch(e){if(!e)return O&&console.warn("Received empty session ID"),!1;let s=this.previousSessionId!==null&&this.previousSessionId!==e;return s&&(O&&console.log(`Session switch detected: ${this.previousSessionId} -> ${e}`),this.onSessionSwitch&&this.onSessionSwitch({type:this.terminateSignal,reason:"User switch session",agent:"claude",previousSessionId:this.previousSessionId,newSessionId:e})),this.previousSessionId=this.currentSessionId,this.currentSessionId=e,s}getCurrentSessionId(){return this.currentSessionId}getPreviousSessionId(){return this.previousSessionId}hasActiveSession(){return!!this.currentSessionId}terminateCurrentSession(e="Session terminated",s=null,t=null){if(!this.hasActiveSession())return O&&console.log("No active session to terminate"),null;let o={type:this.terminateSignal,reason:t?`terminated by signal: ${t}`:e,code:s,signal:t,timestamp:Date.now(),agent:"claude",sessionId:this.currentSessionId};return O&&console.log("Terminating session:",o),this.previousSessionId=null,this.currentSessionId=null,o}createErrorTermination(e){return this.hasActiveSession()?{type:this.terminateSignal,error:e.message,stack:e.stack,timestamp:Date.now(),agent:"claude",sessionId:this.currentSessionId}:null}reset(){O&&console.log("Resetting session manager"),this.currentSessionId=null,this.previousSessionId=null}setSessionSwitchCallback(e){this.onSessionSwitch=e}getSessionInfo(){return{currentSessionId:this.currentSessionId,previousSessionId:this.previousSessionId,hasActiveSession:this.hasActiveSession()}}};Ie.exports=Q});var _e=p((tt,De)=>{var P=require("fs"),_=require("path"),Ss=require("events"),ws=require("crypto"),S=process.env.CODEV_DEBUG==="True",Y=class extends Ss{constructor(e={}){super(),this.watchPaths=e.watchPaths||[],this.excludePatterns=e.excludePatterns||[/node_modules/,/\.git/,/\.DS_Store/,/\.tmp/,/\.log$/,/\.swp$/,/codev\.log/],this.includePatterns=e.includePatterns||[/\.(js|jsx|ts|tsx|py|java|c|cpp|h|hpp|go|rs|rb|php|html|css|scss|sass|less|json|xml|yaml|yml|md|txt)$/],this.watchers=new Map,this.isWatching=!1,this.debounceTimeout=e.debounceTimeout||300,this.pendingChanges=new Map,this.fileContentHashes=new Map,this.enableContentComparison=e.enableContentComparison!==!1,this.onFileChange=e.onFileChange||null}calculateFileHash(e){try{let s=P.readFileSync(e,"utf8");return ws.createHash("sha256").update(s).digest("hex")}catch{return null}}hasContentChanged(e){if(!this.enableContentComparison)return!0;let s=this.calculateFileHash(e),t=this.fileContentHashes.get(e);return s===null?t!==void 0?(this.fileContentHashes.delete(e),!0):!1:t===void 0||s!==t?(this.fileContentHashes.set(e,s),!0):!1}preloadFileHashes(e){if(!(!this.enableContentComparison||!P.existsSync(e)))try{let s=P.readdirSync(e,{withFileTypes:!0});for(let t of s){let o=_.join(e,t.name);t.isFile()&&this.shouldWatchFile(o)?(this.calculateFileHash(o),this.fileContentHashes.set(o,this.calculateFileHash(o))):t.isDirectory()&&!this.shouldExcludeDirectory(o)&&this.preloadFileHashes(o)}}catch(s){S&&console.warn(`Failed to preload hashes for ${e}:`,s.message)}}shouldExcludeDirectory(e){let s=e.replace(/\\/g,"/");for(let t of this.excludePatterns)if(t.test(s)||t.test(_.basename(e)))return!0;return!1}startWatching(e=null){if(this.isWatching){S&&console.log("FileWatchService is already watching");return}let s=e||this.watchPaths;if(s.length===0){S&&console.log("No watch paths specified");return}this.isWatching=!0;for(let t of s)this.enableContentComparison&&this.preloadFileHashes(t),this.watchDirectory(t);S&&(console.log(`FileWatchService started watching ${s.length} paths`),this.enableContentComparison&&console.log(`Preloaded hashes for ${this.fileContentHashes.size} files`))}stopWatching(){if(this.isWatching){this.isWatching=!1;for(let[e,s]of this.watchers)try{s.close(),S&&console.log(`Stopped watching: ${e}`)}catch(t){S&&console.error(`Error stopping watcher for ${e}:`,t.message)}this.watchers.clear(),this.pendingChanges.clear(),this.fileContentHashes.clear(),S&&console.log("FileWatchService stopped watching all paths")}}watchDirectory(e){if(!P.existsSync(e)){S&&console.warn(`Watch path does not exist: ${e}`);return}if(!P.statSync(e).isDirectory()){S&&console.warn(`Watch path is not a directory: ${e}`);return}try{let t=P.watch(e,{recursive:!0,persistent:!1},(o,n)=>{if(!n)return;let i=_.join(e,n);this.handleFileChange(o,i,e)});this.watchers.set(e,t),S&&console.log(`Started watching directory: ${e}`),t.on("error",o=>{S&&console.error(`Watcher error for ${e}:`,o.message),this.watchers.delete(e)})}catch(t){S&&console.error(`Failed to start watching ${e}:`,t.message)}}handleFileChange(e,s,t){if(!this.shouldWatchFile(s))return;let o=`${e}:${s}`;this.pendingChanges.has(o)&&clearTimeout(this.pendingChanges.get(o)),this.pendingChanges.set(o,setTimeout(()=>{this.pendingChanges.delete(o),this.processFileChange(e,s,t)},this.debounceTimeout))}processFileChange(e,s,t){if(!this.isWatching)return;let o="modified",n=!1;try{P.statSync(s),n=!0,e==="rename"?o="created":e==="change"&&(o="modified")}catch{e==="rename"&&(o="deleted")}if(n&&(o==="modified"||o==="created")&&!this.hasContentChanged(s)){S&&console.log(`Ignoring false change for: ${_.relative(t,s)}`);return}!n&&o==="deleted"&&this.fileContentHashes.delete(s);let i={type:"CODEV_FILE_CHANGE_DETECTTED",data:{eventType:e,changeType:o,filePath:s,relativePath:_.relative(t,s),watchPath:t,fileExists:n,timestamp:Date.now(),sessionId:process.env.SESSION_ID||"default"}};if(S&&console.log(`File ${o}: ${i.data.relativePath}`),this.emit("fileChange",i),this.onFileChange&&typeof this.onFileChange=="function")try{this.onFileChange(i)}catch(a){S&&console.error("Error in file change callback:",a.message)}}shouldWatchFile(e){let s=_.basename(e),t=e.replace(/\\/g,"/");for(let o of this.excludePatterns)if(o.test(t)||o.test(s))return!1;if(this.includePatterns.length===0)return!0;for(let o of this.includePatterns)if(o.test(t)||o.test(s))return!0;return!1}addWatchPath(e){this.watchPaths.includes(e)||(this.watchPaths.push(e),this.isWatching&&this.watchDirectory(e))}removeWatchPath(e){let s=this.watchPaths.indexOf(e);if(s>-1&&(this.watchPaths.splice(s,1),this.watchers.has(e)))try{this.watchers.get(e).close(),this.watchers.delete(e),S&&console.log(`Removed watch path: ${e}`)}catch(t){S&&console.error(`Error removing watch path ${e}:`,t.message)}}getStatus(){return{isWatching:this.isWatching,watchPaths:[...this.watchPaths],activeWatchers:this.watchers.size,pendingChanges:this.pendingChanges.size}}setFileChangeCallback(e){this.onFileChange=e}};De.exports=Y});var Oe=p((it,Ae)=>{var Cs=N(),Es=require("path"),ot=require("fs"),nt=require("os"),vs=Se(),bs=ve(),xs=ke(),$s=Pe(),ks=_e(),y=process.env.CODEV_DEBUG==="True",X=class extends Cs{constructor(){super({configDir:".",configFile:".claude.json",defaultModel:"Claude Sonnet 4.5",executablePaths:["cc.mjs","/tmp/claude-code/package/cc.mjs"],environmentVariables:e=>({ANTHROPIC_BASE_URL:`${e}/claude`,ANTHROPIC_API_KEY:"codev",DISABLE_TELEMETRY:!0,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:!0,DISABLE_COST_WARNINGS:!0,DISABLE_NON_ESSENTIAL_MODEL_CALLS:!0,CODEV_SERVER:e,CLAUDE_CODE_ATTRIBUTION_HEADER:"0"}),defaultConfig:{numStartups:1,installMethod:"unknown",autoUpdates:!1,theme:"Coder Dark",customApiKeyResponses:{approved:["codev"]},shiftEnterKeyBindingInstalled:!0,hasCompletedOnboarding:!0,subscriptionNoticeCount:0,hasAvailableSubscription:!0,projects:{}}}),this.fileWatchService=null,this.shutdownInProgress=!1,this.initializeServices()}initializeServices(){this.httpClient=new bs({timeout:1e4}),this.authService=new xs({validateCredentials:!1}),this.sessionManager=new $s({onSessionSwitch:e=>{this.sendTerminationMessage(e)}}),this.messageQueue=new vs({maxRetries:2,retryDelay:500,shutdownTimeout:3e3,onProcessMessage:e=>this.processMessage(e)}),this.initializeFileWatchService()}resloveSettingFilePath(e){return Es.join(e,this.config.configDir,".claude","settings.json")}initializeFileWatchService(){if(!process.env.SESSION_ID){y&&console.log("FileWatchService disabled: SESSION_ID environment variable not found");return}try{this.fileWatchService=new ks({watchPaths:this.getFileWatchPaths(),onFileChange:e=>this.handleFileChange(e),debounceTimeout:300}),y&&console.log("FileWatchService initialized with SESSION_ID:",process.env.SESSION_ID)}catch(e){y&&console.error("Failed to initialize FileWatchService:",e.message)}}getFileWatchPaths(){let e=[],s=process.cwd();e.push(s);let t=process.env.CODEV_WATCH_PATHS;if(t){let o=t.split(",").map(n=>n.trim());e.push(...o)}return e}handleFileChange(e){if(y&&console.log("File change detected:",e.data.relativePath),this.shutdownInProgress)return;let s={message:e,sessionId:e.data.sessionId||process.env.SESSION_ID};this.messageQueue.enqueue(s)}startFileWatching(){this.fileWatchService&&!this.fileWatchService.isWatching&&(this.fileWatchService.startWatching(),y&&console.log("File watching started"))}stopFileWatching(){this.fileWatchService&&this.fileWatchService.isWatching&&(this.fileWatchService.stopWatching(),y&&console.log("File watching stopped"))}onChildMessage(e){e&&e.type==="claude:send-msg"&&this.handleClaudeSendMessage(e.data),super.onChildMessage(e)}handleClaudeSendMessage(e){if(y&&console.log("Handling claude:send-msg message:",e),!e||typeof e!="object"){console.error(`handleClaudeSendMessage: Invalid message data. Expected object, got: ${typeof e}`);return}if(this.shutdownInProgress){y&&console.log("Shutdown in progress, ignoring new message");return}let s=e.sessionId||process.env.SESSION_ID;this.sessionManager.handleSessionSwitch(s),this.messageQueue.enqueue(e)}async processMessage(e){let s=e.data.message,t=e.data.sessionId||process.env.SESSION_ID;if(!t)throw new Error("No session ID available");let o;try{o=typeof s=="string"?JSON.parse(s):s}catch(a){throw new Error(`Failed to parse message data: ${a.message}`)}let n=`/conversations/${t}/@append?task_type=codev`,i=this.authService.hasCredentials()?this.authService.generateAuthHeaders(`${this.httpClient.baseUrl}${n}`,o):{};y&&(console.debug("Sending message to:",n),console.debug("Send Message: ",JSON.stringify(o))),e.type!=="CODEV_TERMINATE_SIGNAL"&&(this.sessionManager.currentSessionId=t)}sendTerminationMessage(e){let s={message:e,sessionId:e.sessionId||this.sessionManager.getCurrentSessionId()};this.messageQueue.enqueue(s)}async handleChildProcessExit(e,s){y&&console.log(`Child process exited with code: ${e}, signal: ${s}`),this.stopFileWatching();let t=this.messageQueue.getQueueSize(),o=this.sessionManager.terminateCurrentSession("process exited normally",e,s);if(o&&this.sendTerminationMessage(o),t>0||o){y&&console.log("Starting graceful shutdown of message queue...");try{let n=!s||s==="SIGTERM",i=this.messageQueue.getQueueSize(),a={timeoutMs:n?8e3:3e3,batchSize:Math.min(i,15),fastMode:!n||i>30};y&&console.log("Shutdown options:",a);let r=await this.messageQueue.gracefulShutdown(a);y&&console.log("Message queue shutdown completed:",r),r.failedMessages>0&&y&&console.warn(`Shutdown summary: ${r.processedMessages} sent, ${r.failedMessages} failed, ${r.remainingMessages} remaining`)}catch(n){y&&console.error("Error during message queue shutdown:",n.message)}}}handleChildProcessError(e){y&&console.error(`Child process error: ${e.message}`);let s=this.sessionManager.createErrorTermination(e);s&&this.sendTerminationMessage(s)}async forceFlushMessages(e=3e3){if(this.messageQueue.getQueueSize()===0)return{success:!0,message:"No messages to flush"};y&&console.log(`Force flushing ${this.messageQueue.getQueueSize()} messages...`);try{return await this.messageQueue.forceFlushAndShutdown(e)}catch(s){return y&&console.error("Force flush failed:",s.message),{success:!1,error:s.message}}}async launch(e={}){let{codevServer:s,auth_ak:t=null,auth_sk:o=null}=e;return this.httpClient.setBaseUrl(s),t&&o&&this.authService.setCredentials(t,o),this.startFileWatching(),super.launch(e)}};Ae.exports=X});var Me=p((at,Te)=>{var Is=N(),rt=require("path"),Z=class extends Is{constructor(){super({configDir:".gemini",configFile:"settings.json",defaultModel:"gemini-2.5-pro",executablePaths:["gemini/gemini.js","../dist/gemini/gemini.js"],environmentVariables:e=>({GOOGLE_GEMINI_BASE_URL:`${e}/gemini`,GEMINI_API_KEY:"coder",GOOGLE_API_KEY:"coder",GOOGLE_CLOUD_PROJECT:"coder",GOOGLE_CLOUD_LOCATION:"coder",DISABLE_TELEMETRY:!0,GEMINI_CODE_DISABLE_NONESSENTIAL_TRAFFIC:!0,DISABLE_COST_WARNINGS:!0,DISABLE_NON_ESSENTIAL_MODEL_CALLS:!0,USE_VERTEX:!0}),defaultConfig:{ide:{hasSeenNudge:!0},telemetry:{enabled:!1,logPrompts:!1},privacy:{usageStatisticsEnabled:!1},general:{disableUpdateNag:!0,preferredEditor:"vscode",previewFeatures:!0},ui:{hideBanner:!0,theme:"Default"},security:{auth:{selectedType:"vertex-ai"}}}})}};Te.exports=Z});var Fe=p((ct,qe)=>{var Ps=N(),T=require("path"),x=require("fs"),Ds=require("os"),{spawn:_s}=require("child_process"),L=process.env.CODEV_DEBUG==="True",ee=class extends Ps{constructor(){super({configDir:".codex",configFile:"config.toml",defaultModel:"o4-mini",executablePaths:["codex.mjs","../dist/codex.mjs"],environmentVariables:e=>({OPENAI_BASE_URL:`${e}/codex`,OPENAI_API_KEY:"codev-proxy-key",DEBUG:L?"true":"false",CODEX_QUIET_MODE:"0",OPENAI_DISABLE_TELEMETRY:"true",CODEX_DISABLE_PROJECT_DOC:"0",CODEV_SERVER:e}),defaultConfig:{model:"gpt-5-codex",approvalMode:"suggest",fullAutoErrorMode:"ask-user",notify:[],history:{maxSize:1e3,saveHistory:!0,sensitivePatterns:[],persistence:"save-all"}}})}checkCodexAvailability(){try{let e=this.findExecutablePath();return x.existsSync(e)}catch{return!1}}resloveSettingFilePath(e){return T.join(e,this.config.configDir,"config.toml")}async ensureConfig(e,s=0){let t=T.join(Ds.homedir(),this.config.configDir,this.config.configFile),o=T.dirname(t);try{x.existsSync(o)||x.mkdirSync(o,{recursive:!0});let n=`${e}/codex`;if(x.existsSync(t)){let i=x.readFileSync(t,"utf8"),a=`openai_base_url = "${n}"`;/^openai_base_url\s*=/m.test(i)?i=i.replace(/^openai_base_url\s*=.*/m,a):i=i.trimEnd()+`
|
|
203
|
+
Terminating ...`),d.kill("SIGTERM"),setTimeout(()=>{d.killed||d.kill("SIGKILL")},8e3)})})}catch(i){throw i}}};pe.exports=K});var Se=p((Qs,ye)=>{var g=process.env.CODEV_DEBUG==="True",j=class{constructor(e={}){this.queue=[],this.processing=!1,this.shuttingDown=!1,this.shutdownTimeout=e.shutdownTimeout||5e3,this.maxRetries=e.maxRetries||3,this.retryDelay=e.retryDelay||1e3,this.onProcessMessage=e.onProcessMessage||null,this.shutdownPromise=null,this.currentlyProcessing=null}enqueue(e){if(this.shuttingDown)return g&&console.log("Queue is shutting down, skipping new messages"),null;let s={id:Date.now()+Math.random(),data:e,timestamp:Date.now(),retryCount:0,processing:!1};return this.queue.push(s),g&&console.log(`Message enqueued, queue length: ${this.queue.length}`),this.processQueue(),s.id}dequeue(){let e=this.queue.shift();return g&&e&&console.log(`Message dequeued, remaining queue length: ${this.queue.length}`),e}removeById(e){let s=this.queue.findIndex(t=>t.id===e);return s>-1?(this.queue.splice(s,1),g&&console.log(`Message ${e} removed from queue`),!0):!1}async processQueue(){if(!(this.processing||this.queue.length===0)){this.processing=!0;try{for(;this.queue.length>0&&!this.shuttingDown;){let e=this.queue[0];e.processing=!0;try{this.onProcessMessage&&await this.onProcessMessage(e),this.dequeue()}catch(s){if(g&&console.error(`Failed to process message: ${s.message}`),e.retryCount++,g&&console.log("Start Retry:",e.retryCount,"times..."),e.retryCount>=this.maxRetries)g&&console.error("Message exceeded max retries, removing from queue"),this.dequeue();else{e.processing=!1;let t=this.shuttingDown?100:this.retryDelay*e.retryCount;await new Promise(o=>setTimeout(o,t))}}}}finally{this.processing=!1}}}getQueueSize(){return this.queue.length}clear(){this.queue=[],g&&console.log("Message queue cleared")}setMessageProcessor(e){this.onProcessMessage=e}async waitForProcessingMessages(e=5e3){let s=this.queue.filter(o=>o.processing);if(s.length===0)return;g&&console.log(`Waiting for ${s.length} processing messages to complete (timeout: ${e}ms)`);let t=Date.now();for(;Date.now()-t<e;){if(this.queue.filter(n=>n.processing).length===0){g&&console.log(`All processing messages completed in ${Date.now()-t}ms`);return}await new Promise(n=>setTimeout(n,50))}if(g){let o=this.queue.filter(n=>n.processing);console.log(`Timeout waiting for processing messages. ${o.length} messages still processing`)}}async gracefulShutdown(e={}){if(this.shutdownPromise)return this.shutdownPromise;let{timeoutMs:s=this.shutdownTimeout,batchSize:t=10,fastMode:o=!1}=e;return this.shutdownPromise=new Promise(async n=>{this.shuttingDown=!0,await this.waitForProcessingMessages(Math.min(s*.3,3e3));let i=this.queue.filter(f=>!f.processing),a=i.length;g&&(console.log(`Starting graceful shutdown with ${a} pending messages (${this.queue.length-a} already processing)`),console.log(`Mode: ${o?"fast (parallel)":"sequential"}, timeout: ${s}ms`));let r=Date.now(),c=0,l=0;try{if(o){let f=await this.processAllParallel(s-(Date.now()-r),i);c=f.processed,l=f.failed}else{let f=await this.processInBatches(t,s-(Date.now()-r),i);c=f.processed,l=f.failed}}catch(f){g&&console.error("Error during shutdown processing:",f.message)}let u=Date.now()-r,d=this.queue.length;g&&(console.log(`Shutdown completed in ${u}ms:`),console.log(` - Total: ${a} messages`),console.log(` - Processed: ${c}`),console.log(` - Failed: ${l}`),console.log(` - Remaining: ${d}`)),n({totalMessages:a,processedMessages:c,failedMessages:l,remainingMessages:d,duration:u,allMessagesSent:d===0&&l===0})}),this.shutdownPromise}async processAllParallel(e){if(this.queue.length===0)return{processed:0,failed:0};g&&console.log(`Processing ${this.queue.length} messages in parallel...`);let s=[...this.queue];this.queue=[];let t=s.map(async r=>{try{return this.onProcessMessage&&await this.onProcessMessage(r),{success:!0,messageId:r.id}}catch(c){return g&&console.warn(`Message ${r.id} processing failed: ${c.message}`),{success:!1,messageId:r.id,error:c}}}),o=new Promise(r=>{setTimeout(()=>r({timedOut:!0}),e)}),n=await Promise.race([Promise.allSettled(t).then(r=>({results:r})),o]);if(n.timedOut)return g&&console.log(`Parallel processing timed out after ${e}ms`),{processed:0,failed:s.length};let i=n.results.filter(r=>r.status==="fulfilled"&&r.value?.success).length,a=s.length-i;return{processed:i,failed:a}}async processInBatches(e,s){if(this.queue.length===0)return{processed:0,failed:0};g&&console.log(`Processing ${this.queue.length} messages in batches of ${e}...`);let t=Date.now(),o=0,n=0;for(;this.queue.length>0&&Date.now()-t<s;){let i=this.queue.splice(0,e),a=i.map(async u=>{try{return this.onProcessMessage&&await this.onProcessMessage(u),{success:!0}}catch(d){return g&&console.warn(`Batch message processing failed: ${d.message}`),{success:!1,error:d}}}),c=(await Promise.allSettled(a)).filter(u=>u.status==="fulfilled"&&u.value?.success).length,l=i.length-c;o+=c,n+=l,g&&i.length>0&&console.log(`Batch completed: ${c}/${i.length} successful`),this.queue.length>0&&await new Promise(u=>setTimeout(u,10))}return this.queue.length>0&&(n+=this.queue.length,g&&console.log(`${this.queue.length} messages not processed due to timeout`),this.queue=[]),{processed:o,failed:n}}async forceFlushAndShutdown(e=2e3){this.shuttingDown=!0,await this.waitForProcessingMessages(Math.min(e*.4,1e3));let s=this.queue.filter(r=>!r.processing);g&&console.log(`Force flush: attempting to send ${s.length} pending messages within ${e}ms (${this.queue.length-s.length} already processing)`);let t=Date.now(),o=s.map(async r=>{try{return this.onProcessMessage&&Date.now()-t<e?(await this.onProcessMessage(r),{success:!0,messageId:r.id}):{success:!1,messageId:r.id,reason:"timeout"}}catch(c){return{success:!1,messageId:r.id,error:c.message}}}),n=e-(Date.now()-t),i=new Promise(r=>{setTimeout(()=>r({timedOut:!0}),Math.max(100,n))}),a=await Promise.race([Promise.allSettled(o).then(r=>({results:r})),i]);if(s.forEach(r=>{let c=this.queue.findIndex(l=>l.id===r.id);c>-1&&this.queue.splice(c,1)}),this.processing=!1,a.timedOut)return g&&console.log(`Force flush timed out after ${e}ms`),{success:!1,reason:"timeout",attemptedCount:s.length};{let r=a.results.filter(c=>c.status==="fulfilled"&&c.value.success).length;return g&&console.log(`Force flush completed: ${r}/${s.length} messages sent`),{success:r===s.length,successCount:r,totalCount:s.length,results:a.results}}}forceShutdown(){this.shuttingDown=!0,this.queue=[],this.processing=!1,g&&console.log("Force shutdown: Queue cleared")}};ye.exports=j});var O=p((Ys,hs)=>{hs.exports={name:"makecoder",version:"2.0.89",description:"MakeCoder: Unified AI agent CLI tool integrating Claude Code, Codex and Gemini CLI",main:"./dist/coder.js",bin:{coder:"./dist/coder.js"},scripts:{test:'echo "Error: no test specified" && exit 1',start:"node ./src/coder.js",build:"node scripts/build.js","build:clean":"node scripts/build.js --clean","build:dev":"node scripts/build.js --no-minify --sourcemap",postinstall:"node scripts/postinstall.js"},keywords:["cli","ai","claude","gemini","codex","agent"],author:"makecoder",license:"MIT",repository:{type:"git",url:"https://github.com/makecoderai/coder.git"},homepage:"https://github.com/makecoderai/coder",dependencies:{"node-fetch":"^3.3.2",open:"^10.1.0",zod:"^3.25.76"},optionalDependencies:{"makecoder-codex-linux-x64":"*","makecoder-codex-darwin-arm64":"*","makecoder-codex-win32-x64":"*"},engines:{node:">=20.0.0"},devDependencies:{chokidar:"^4.0.3"},files:["dist","claude","scripts/postinstall.js"]}});var ve=p((Xs,Ee)=>{var ds=require("http"),gs=require("https"),{URL:we}=require("url"),{version:fs}=O(),Ce=process.env.CODEV_DEBUG==="True",z=class{constructor(e={}){this.baseUrl=e.baseUrl||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json","User-Agent":`codev-cli/${fs}`,...e.headers}}setBaseUrl(e){this.baseUrl=e}setDefaultHeaders(e){this.defaultHeaders={...this.defaultHeaders,...e}}async post(e,s,t={}){let o=this.resolveUrl(e),n={...this.defaultHeaders,...t.headers};return new Promise((i,a)=>{this.validateRequest(o,s,a);let r=this.serializeData(s,a);if(!r)return;n["Content-Length"]=Buffer.byteLength(r);let c=this.buildRequestOptions(o,"POST",n),l=this.getHttpModule(o);Ce&&console.debug(`HTTP POST to ${o} with data length: ${r.length}`);let u=l.request(c,d=>{this.handleResponse(d,i,a)});this.attachErrorHandlers(u,o,a),u.setTimeout(this.timeout),u.write(r),u.end()})}resolveUrl(e){return e.startsWith("http")?e:`${this.baseUrl}${e.startsWith("/")?"":"/"}${e}`}validateRequest(e,s,t){return!e||typeof e!="string"?(t(new Error(`Invalid URL: ${e}`)),!1):s?!0:(t(new Error("No data provided for HTTP POST")),!1)}serializeData(e,s){try{return typeof e=="string"?e:JSON.stringify(e)}catch(t){return s(new Error(`Failed to serialize data: ${t.message}`)),null}}buildRequestOptions(e,s,t){let o=new we(e),n=o.protocol==="https:";return{hostname:o.hostname,port:o.port||(n?443:80),path:o.pathname+o.search,method:s,headers:t}}getHttpModule(e){return new we(e).protocol==="https:"?gs:ds}handleResponse(e,s,t){Ce&&console.debug(`HTTP response status: ${e.statusCode}`);let o="";e.on("data",n=>{o+=n}),e.on("end",()=>{e.statusCode>=200&&e.statusCode<300?s({statusCode:e.statusCode,data:o,headers:e.headers}):t(new Error(`HTTP request returned status ${e.statusCode}: ${o}`))})}attachErrorHandlers(e,s,t){e.on("error",o=>{t(new Error(`HTTP POST request failed: ${o.message}`))}),e.on("timeout",()=>{t(new Error(`HTTP POST request timed out for URL: ${s}`)),e.destroy()})}};Ee.exports=z});var xe=p((Zs,be)=>{var ms=require("crypto"),{URL:ps}=require("url"),W=class{static generateSignature(e,s,t,o){try{let n=new ps(e),i=Buffer.from(n.pathname),a=Buffer.from(i),r=s?typeof s=="string"?Buffer.from(s):Buffer.from(JSON.stringify(s)):Buffer.alloc(0),c=Buffer.concat([a,r,Buffer.from(o)]),l=ms.createHmac("sha256",t);return l.update(c),l.digest("hex")}catch(n){throw new Error(`Failed to generate signature: ${n.message}`)}}static validateSignature(e,s,t,o,n){return this.generateSignature(e,s,t,o)===n}static generateTimestamp(){return Date.now().toString()}};be.exports=W});var ke=p((et,$e)=>{var ys=xe(),J=class{constructor(e={}){this.accessKey=null,this.secretKey=null,this.validateCredentials=e.validateCredentials!==!1}setCredentials(e,s){if(this.validateCredentials&&(!e||!s))throw new Error("Both access key and secret key are required");this.accessKey=e,this.secretKey=s}hasCredentials(){return!!(this.accessKey&&this.secretKey)}generateAuthHeaders(e,s=null){if(!this.hasCredentials())return{};try{return{AUTHORIZATION:`Bearer ${this.accessKey}.${this.secretKey}`}}catch(t){throw new Error(`Failed to generate auth headers: ${t.message}`)}}validateAuthHeaders(e,s,t,o){if(!this.hasCredentials())throw new Error("No credentials available for validation");return ys.validateSignature(e,s,this.secretKey,t,o)}clearCredentials(){this.accessKey=null,this.secretKey=null}getCredentials(){return{accessKey:this.accessKey,hasCredentials:this.hasCredentials()}}};$e.exports=J});var Pe=p((st,Ie)=>{var T=process.env.CODEV_DEBUG==="True",Q=class{constructor(e={}){this.currentSessionId=null,this.previousSessionId=null,this.onSessionSwitch=e.onSessionSwitch||null,this.terminateSignal=e.terminateSignal||"CODEV_TERMINATE_SIGNAL"}handleSessionSwitch(e){if(!e)return T&&console.warn("Received empty session ID"),!1;let s=this.previousSessionId!==null&&this.previousSessionId!==e;return s&&(T&&console.log(`Session switch detected: ${this.previousSessionId} -> ${e}`),this.onSessionSwitch&&this.onSessionSwitch({type:this.terminateSignal,reason:"User switch session",agent:"claude",previousSessionId:this.previousSessionId,newSessionId:e})),this.previousSessionId=this.currentSessionId,this.currentSessionId=e,s}getCurrentSessionId(){return this.currentSessionId}getPreviousSessionId(){return this.previousSessionId}hasActiveSession(){return!!this.currentSessionId}terminateCurrentSession(e="Session terminated",s=null,t=null){if(!this.hasActiveSession())return T&&console.log("No active session to terminate"),null;let o={type:this.terminateSignal,reason:t?`terminated by signal: ${t}`:e,code:s,signal:t,timestamp:Date.now(),agent:"claude",sessionId:this.currentSessionId};return T&&console.log("Terminating session:",o),this.previousSessionId=null,this.currentSessionId=null,o}createErrorTermination(e){return this.hasActiveSession()?{type:this.terminateSignal,error:e.message,stack:e.stack,timestamp:Date.now(),agent:"claude",sessionId:this.currentSessionId}:null}reset(){T&&console.log("Resetting session manager"),this.currentSessionId=null,this.previousSessionId=null}setSessionSwitchCallback(e){this.onSessionSwitch=e}getSessionInfo(){return{currentSessionId:this.currentSessionId,previousSessionId:this.previousSessionId,hasActiveSession:this.hasActiveSession()}}};Ie.exports=Q});var _e=p((tt,De)=>{var P=require("fs"),_=require("path"),Ss=require("events"),ws=require("crypto"),S=process.env.CODEV_DEBUG==="True",Y=class extends Ss{constructor(e={}){super(),this.watchPaths=e.watchPaths||[],this.excludePatterns=e.excludePatterns||[/node_modules/,/\.git/,/\.DS_Store/,/\.tmp/,/\.log$/,/\.swp$/,/codev\.log/],this.includePatterns=e.includePatterns||[/\.(js|jsx|ts|tsx|py|java|c|cpp|h|hpp|go|rs|rb|php|html|css|scss|sass|less|json|xml|yaml|yml|md|txt)$/],this.watchers=new Map,this.isWatching=!1,this.debounceTimeout=e.debounceTimeout||300,this.pendingChanges=new Map,this.fileContentHashes=new Map,this.enableContentComparison=e.enableContentComparison!==!1,this.onFileChange=e.onFileChange||null}calculateFileHash(e){try{let s=P.readFileSync(e,"utf8");return ws.createHash("sha256").update(s).digest("hex")}catch{return null}}hasContentChanged(e){if(!this.enableContentComparison)return!0;let s=this.calculateFileHash(e),t=this.fileContentHashes.get(e);return s===null?t!==void 0?(this.fileContentHashes.delete(e),!0):!1:t===void 0||s!==t?(this.fileContentHashes.set(e,s),!0):!1}preloadFileHashes(e){if(!(!this.enableContentComparison||!P.existsSync(e)))try{let s=P.readdirSync(e,{withFileTypes:!0});for(let t of s){let o=_.join(e,t.name);t.isFile()&&this.shouldWatchFile(o)?(this.calculateFileHash(o),this.fileContentHashes.set(o,this.calculateFileHash(o))):t.isDirectory()&&!this.shouldExcludeDirectory(o)&&this.preloadFileHashes(o)}}catch(s){S&&console.warn(`Failed to preload hashes for ${e}:`,s.message)}}shouldExcludeDirectory(e){let s=e.replace(/\\/g,"/");for(let t of this.excludePatterns)if(t.test(s)||t.test(_.basename(e)))return!0;return!1}startWatching(e=null){if(this.isWatching){S&&console.log("FileWatchService is already watching");return}let s=e||this.watchPaths;if(s.length===0){S&&console.log("No watch paths specified");return}this.isWatching=!0;for(let t of s)this.enableContentComparison&&this.preloadFileHashes(t),this.watchDirectory(t);S&&(console.log(`FileWatchService started watching ${s.length} paths`),this.enableContentComparison&&console.log(`Preloaded hashes for ${this.fileContentHashes.size} files`))}stopWatching(){if(this.isWatching){this.isWatching=!1;for(let[e,s]of this.watchers)try{s.close(),S&&console.log(`Stopped watching: ${e}`)}catch(t){S&&console.error(`Error stopping watcher for ${e}:`,t.message)}this.watchers.clear(),this.pendingChanges.clear(),this.fileContentHashes.clear(),S&&console.log("FileWatchService stopped watching all paths")}}watchDirectory(e){if(!P.existsSync(e)){S&&console.warn(`Watch path does not exist: ${e}`);return}if(!P.statSync(e).isDirectory()){S&&console.warn(`Watch path is not a directory: ${e}`);return}try{let t=P.watch(e,{recursive:!0,persistent:!1},(o,n)=>{if(!n)return;let i=_.join(e,n);this.handleFileChange(o,i,e)});this.watchers.set(e,t),S&&console.log(`Started watching directory: ${e}`),t.on("error",o=>{S&&console.error(`Watcher error for ${e}:`,o.message),this.watchers.delete(e)})}catch(t){S&&console.error(`Failed to start watching ${e}:`,t.message)}}handleFileChange(e,s,t){if(!this.shouldWatchFile(s))return;let o=`${e}:${s}`;this.pendingChanges.has(o)&&clearTimeout(this.pendingChanges.get(o)),this.pendingChanges.set(o,setTimeout(()=>{this.pendingChanges.delete(o),this.processFileChange(e,s,t)},this.debounceTimeout))}processFileChange(e,s,t){if(!this.isWatching)return;let o="modified",n=!1;try{P.statSync(s),n=!0,e==="rename"?o="created":e==="change"&&(o="modified")}catch{e==="rename"&&(o="deleted")}if(n&&(o==="modified"||o==="created")&&!this.hasContentChanged(s)){S&&console.log(`Ignoring false change for: ${_.relative(t,s)}`);return}!n&&o==="deleted"&&this.fileContentHashes.delete(s);let i={type:"CODEV_FILE_CHANGE_DETECTTED",data:{eventType:e,changeType:o,filePath:s,relativePath:_.relative(t,s),watchPath:t,fileExists:n,timestamp:Date.now(),sessionId:process.env.SESSION_ID||"default"}};if(S&&console.log(`File ${o}: ${i.data.relativePath}`),this.emit("fileChange",i),this.onFileChange&&typeof this.onFileChange=="function")try{this.onFileChange(i)}catch(a){S&&console.error("Error in file change callback:",a.message)}}shouldWatchFile(e){let s=_.basename(e),t=e.replace(/\\/g,"/");for(let o of this.excludePatterns)if(o.test(t)||o.test(s))return!1;if(this.includePatterns.length===0)return!0;for(let o of this.includePatterns)if(o.test(t)||o.test(s))return!0;return!1}addWatchPath(e){this.watchPaths.includes(e)||(this.watchPaths.push(e),this.isWatching&&this.watchDirectory(e))}removeWatchPath(e){let s=this.watchPaths.indexOf(e);if(s>-1&&(this.watchPaths.splice(s,1),this.watchers.has(e)))try{this.watchers.get(e).close(),this.watchers.delete(e),S&&console.log(`Removed watch path: ${e}`)}catch(t){S&&console.error(`Error removing watch path ${e}:`,t.message)}}getStatus(){return{isWatching:this.isWatching,watchPaths:[...this.watchPaths],activeWatchers:this.watchers.size,pendingChanges:this.pendingChanges.size}}setFileChangeCallback(e){this.onFileChange=e}};De.exports=Y});var Oe=p((it,Ae)=>{var Cs=B(),Es=require("path"),ot=require("fs"),nt=require("os"),vs=Se(),bs=ve(),xs=ke(),$s=Pe(),ks=_e(),y=process.env.CODEV_DEBUG==="True",X=class extends Cs{constructor(){super({configDir:".",configFile:".claude.json",defaultModel:"Claude Sonnet 4.5",executablePaths:["cc.mjs","/tmp/claude-code/package/cc.mjs"],environmentVariables:e=>({ANTHROPIC_BASE_URL:`${e}/claude`,ANTHROPIC_API_KEY:"codev",DISABLE_TELEMETRY:!0,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:!0,DISABLE_COST_WARNINGS:!0,DISABLE_NON_ESSENTIAL_MODEL_CALLS:!0,CODEV_SERVER:e,CLAUDE_CODE_ATTRIBUTION_HEADER:"0"}),defaultConfig:{numStartups:1,installMethod:"unknown",autoUpdates:!1,theme:"Coder Dark",customApiKeyResponses:{approved:["codev"]},shiftEnterKeyBindingInstalled:!0,hasCompletedOnboarding:!0,subscriptionNoticeCount:0,hasAvailableSubscription:!0,projects:{}}}),this.fileWatchService=null,this.shutdownInProgress=!1,this.initializeServices()}initializeServices(){this.httpClient=new bs({timeout:1e4}),this.authService=new xs({validateCredentials:!1}),this.sessionManager=new $s({onSessionSwitch:e=>{this.sendTerminationMessage(e)}}),this.messageQueue=new vs({maxRetries:2,retryDelay:500,shutdownTimeout:3e3,onProcessMessage:e=>this.processMessage(e)}),this.initializeFileWatchService()}resloveSettingFilePath(e){return Es.join(e,this.config.configDir,".claude","settings.json")}initializeFileWatchService(){if(!process.env.SESSION_ID){y&&console.log("FileWatchService disabled: SESSION_ID environment variable not found");return}try{this.fileWatchService=new ks({watchPaths:this.getFileWatchPaths(),onFileChange:e=>this.handleFileChange(e),debounceTimeout:300}),y&&console.log("FileWatchService initialized with SESSION_ID:",process.env.SESSION_ID)}catch(e){y&&console.error("Failed to initialize FileWatchService:",e.message)}}getFileWatchPaths(){let e=[],s=process.cwd();e.push(s);let t=process.env.CODEV_WATCH_PATHS;if(t){let o=t.split(",").map(n=>n.trim());e.push(...o)}return e}handleFileChange(e){if(y&&console.log("File change detected:",e.data.relativePath),this.shutdownInProgress)return;let s={message:e,sessionId:e.data.sessionId||process.env.SESSION_ID};this.messageQueue.enqueue(s)}startFileWatching(){this.fileWatchService&&!this.fileWatchService.isWatching&&(this.fileWatchService.startWatching(),y&&console.log("File watching started"))}stopFileWatching(){this.fileWatchService&&this.fileWatchService.isWatching&&(this.fileWatchService.stopWatching(),y&&console.log("File watching stopped"))}onChildMessage(e){e&&e.type==="claude:send-msg"&&this.handleClaudeSendMessage(e.data),super.onChildMessage(e)}handleClaudeSendMessage(e){if(y&&console.log("Handling claude:send-msg message:",e),!e||typeof e!="object"){console.error(`handleClaudeSendMessage: Invalid message data. Expected object, got: ${typeof e}`);return}if(this.shutdownInProgress){y&&console.log("Shutdown in progress, ignoring new message");return}let s=e.sessionId||process.env.SESSION_ID;this.sessionManager.handleSessionSwitch(s),this.messageQueue.enqueue(e)}async processMessage(e){let s=e.data.message,t=e.data.sessionId||process.env.SESSION_ID;if(!t)throw new Error("No session ID available");let o;try{o=typeof s=="string"?JSON.parse(s):s}catch(a){throw new Error(`Failed to parse message data: ${a.message}`)}let n=`/conversations/${t}/@append?task_type=codev`,i=this.authService.hasCredentials()?this.authService.generateAuthHeaders(`${this.httpClient.baseUrl}${n}`,o):{};y&&(console.debug("Sending message to:",n),console.debug("Send Message: ",JSON.stringify(o))),e.type!=="CODEV_TERMINATE_SIGNAL"&&(this.sessionManager.currentSessionId=t)}sendTerminationMessage(e){let s={message:e,sessionId:e.sessionId||this.sessionManager.getCurrentSessionId()};this.messageQueue.enqueue(s)}async handleChildProcessExit(e,s){y&&console.log(`Child process exited with code: ${e}, signal: ${s}`),this.stopFileWatching();let t=this.messageQueue.getQueueSize(),o=this.sessionManager.terminateCurrentSession("process exited normally",e,s);if(o&&this.sendTerminationMessage(o),t>0||o){y&&console.log("Starting graceful shutdown of message queue...");try{let n=!s||s==="SIGTERM",i=this.messageQueue.getQueueSize(),a={timeoutMs:n?8e3:3e3,batchSize:Math.min(i,15),fastMode:!n||i>30};y&&console.log("Shutdown options:",a);let r=await this.messageQueue.gracefulShutdown(a);y&&console.log("Message queue shutdown completed:",r),r.failedMessages>0&&y&&console.warn(`Shutdown summary: ${r.processedMessages} sent, ${r.failedMessages} failed, ${r.remainingMessages} remaining`)}catch(n){y&&console.error("Error during message queue shutdown:",n.message)}}}handleChildProcessError(e){y&&console.error(`Child process error: ${e.message}`);let s=this.sessionManager.createErrorTermination(e);s&&this.sendTerminationMessage(s)}async forceFlushMessages(e=3e3){if(this.messageQueue.getQueueSize()===0)return{success:!0,message:"No messages to flush"};y&&console.log(`Force flushing ${this.messageQueue.getQueueSize()} messages...`);try{return await this.messageQueue.forceFlushAndShutdown(e)}catch(s){return y&&console.error("Force flush failed:",s.message),{success:!1,error:s.message}}}async launch(e={}){let{codevServer:s,auth_ak:t=null,auth_sk:o=null}=e;return this.httpClient.setBaseUrl(s),t&&o&&this.authService.setCredentials(t,o),this.startFileWatching(),super.launch(e)}};Ae.exports=X});var Me=p((at,Te)=>{var Is=B(),rt=require("path"),Z=class extends Is{constructor(){super({configDir:".gemini",configFile:"settings.json",defaultModel:"gemini-2.5-pro",executablePaths:["gemini/gemini.js","../dist/gemini/gemini.js"],environmentVariables:e=>({GOOGLE_GEMINI_BASE_URL:`${e}/gemini`,GEMINI_API_KEY:"coder",GOOGLE_API_KEY:"coder",GOOGLE_CLOUD_PROJECT:"coder",GOOGLE_CLOUD_LOCATION:"coder",DISABLE_TELEMETRY:!0,GEMINI_CODE_DISABLE_NONESSENTIAL_TRAFFIC:!0,DISABLE_COST_WARNINGS:!0,DISABLE_NON_ESSENTIAL_MODEL_CALLS:!0,USE_VERTEX:!0}),defaultConfig:{ide:{hasSeenNudge:!0},telemetry:{enabled:!1,logPrompts:!1},privacy:{usageStatisticsEnabled:!1},general:{disableUpdateNag:!0,preferredEditor:"vscode",previewFeatures:!0},ui:{hideBanner:!0,theme:"Default"},security:{auth:{selectedType:"vertex-ai"}}}})}};Te.exports=Z});var Fe=p((ct,qe)=>{var Ps=B(),M=require("path"),x=require("fs"),Ds=require("os"),{spawn:_s}=require("child_process"),L=process.env.CODEV_DEBUG==="True",ee=class extends Ps{constructor(){super({configDir:".codex",configFile:"config.toml",defaultModel:"o4-mini",executablePaths:["codex.mjs","../dist/codex.mjs"],environmentVariables:e=>({OPENAI_BASE_URL:`${e}/codex`,OPENAI_API_KEY:"codev-proxy-key",DEBUG:L?"true":"false",CODEX_QUIET_MODE:"0",OPENAI_DISABLE_TELEMETRY:"true",CODEX_DISABLE_PROJECT_DOC:"0",CODEV_SERVER:e}),defaultConfig:{model:"gpt-5-codex",approvalMode:"suggest",fullAutoErrorMode:"ask-user",notify:[],history:{maxSize:1e3,saveHistory:!0,sensitivePatterns:[],persistence:"save-all"}}})}checkCodexAvailability(){try{let e=this.findExecutablePath();return x.existsSync(e)}catch{return!1}}resloveSettingFilePath(e){return M.join(e,this.config.configDir,"config.toml")}async ensureConfig(e,s=0){let t=M.join(Ds.homedir(),this.config.configDir,this.config.configFile),o=M.dirname(t);try{x.existsSync(o)||x.mkdirSync(o,{recursive:!0});let n=`${e}/codex`;if(x.existsSync(t)){let i=x.readFileSync(t,"utf8"),a=`openai_base_url = "${n}"`;/^openai_base_url\s*=/m.test(i)?i=i.replace(/^openai_base_url\s*=.*/m,a):i=i.trimEnd()+`
|
|
204
204
|
`+a+`
|
|
205
205
|
`,x.writeFileSync(t,i),L&&console.log(`Updated openai_base_url in ${t}`)}else{let i=this.config.defaultConfig||{},a=this.generateTOMLConfig(i,n);x.writeFileSync(t,a),L&&console.log(`Created Codex config file: ${t}`)}s>0&&await new Promise(i=>setTimeout(i,s))}catch(n){console.warn(`Failed to update ${this.config.configFile}: ${n.message}`)}}generateTOMLConfig(e,s){return`model = "${e.model||"gpt-5-codex"}"
|
|
206
206
|
openai_base_url = "${s}"
|
|
207
|
-
`}findExecutablePath(){let e=
|
|
207
|
+
`}findExecutablePath(){let e=M.dirname(require.main.filename);for(let s of this.config.executablePaths){let t=M.resolve(e,s);if(x.existsSync(t))return t}throw new Error(`Could not find Codex executable in any of the configured paths: ${this.config.executablePaths.join(", ")}`)}async launch(e={}){let{remainingArgs:s=[],codevServer:t,auth_ak:o=null,auth_sk:n=null}=e;try{if(!this.checkCodexAvailability())throw new Error("Codex executable not found. Please ensure makecoder is properly installed: npm install -g makecoder@latest");await this.ensureConfig(t,1e3);let i=this.findExecutablePath();return L&&console.log(`executablePath: ${i}`),new Promise((a,r)=>{let c={...process.env,...this.config.environmentVariables(t)};o&&(c.CODEV_AUTH_AK=o),n&&(c.CODEV_AUTH_SK=n);let l=["--no-warnings"];process.env.CODEV_INSPECT_BRK==="True"&&l.push("--inspect-brk"),l.push(i,...s);let u=_s("node",l,{env:c,stdio:["inherit","inherit","inherit","ipc"]});this.handleChildMessages(u),u.on("error",d=>{console.error(`Failed to start Codex: ${d.message}`),r(d)}),u.on("exit",async(d,f)=>{console.log(f?`terminated by signal: ${f}`:"Goodbye for now! Keep building great things!")}),process.on("SIGINT",async()=>{console.log(`
|
|
208
208
|
Terminating ...`),u.kill("SIGTERM"),setTimeout(()=>{u.killed||u.kill("SIGKILL")},8e3)}),process.on("SIGTERM",async()=>{console.log(`
|
|
209
|
-
Terminating ...`),u.kill("SIGTERM"),setTimeout(()=>{u.killed||u.kill("SIGKILL")},8e3)})})}catch(i){throw i}}};qe.exports=ee});var Le=p((lt,Be)=>{var
|
|
209
|
+
Terminating ...`),u.kill("SIGTERM"),setTimeout(()=>{u.killed||u.kill("SIGKILL")},8e3)})})}catch(i){throw i}}};qe.exports=ee});var Le=p((lt,Be)=>{var q=require("fs"),Ue=require("path"),{spawn:Ne}=require("child_process"),se=class{constructor(){this.extensionId="codev.codev-background";let e=require.main?Ue.dirname(require.main.filename):__dirname;this.extensionPath=Ue.resolve(e,"vendor/claude-code.vsix"),this._codeCommand=null}async resolveCodeCommand(){if(this._codeCommand)return this._codeCommand;if(process.env.IS_AISTUDIO==="True"){let e="/usr/lib/aistudio/lib/vscode/bin/remote-cli/aistudio";if(q.existsSync(e))try{return q.accessSync(e,q.constants.F_OK|q.constants.X_OK),this._codeCommand=e,process.env.CODEV_DEBUG&&console.log(`Using AI Studio VSCode path: ${e}`),this._codeCommand}catch(s){process.env.CODEV_DEBUG&&console.log(`AI Studio path exists but not executable: ${s.message}`)}else process.env.CODEV_DEBUG&&console.log(`AI Studio path not found: ${e}`)}try{let{spawn:e}=require("child_process");return new Promise(s=>{let t=e("which",["code"],{stdio:["ignore","pipe","ignore"]}),o="";t.stdout.on("data",n=>{o+=n.toString().trim()}),t.on("close",n=>{n===0&&o?(this._codeCommand=o,process.env.CODEV_DEBUG&&console.log(`Resolved code command path: ${o}`),s(this._codeCommand)):(this._codeCommand="code",s(this._codeCommand))}),t.on("error",()=>{this._codeCommand="code",s(this._codeCommand)}),setTimeout(()=>{t.kill(),this._codeCommand="code",s(this._codeCommand)},3e3)})}catch{return this._codeCommand="code",this._codeCommand}}async shouldInstallExtension(){try{return process.env.IS_AISTUDIO!=="True"?(process.env.CODEV_DEBUG&&console.log("Not in AI Studio environment (IS_AISTUDIO!=True), skipping extension installation"),!1):await this.isVSCodeAvailable()?await this.isExtensionInstalled()?(process.env.CODEV_DEBUG&&console.log(`Extension ${this.extensionId} already installed`),!1):!!q.existsSync(this.extensionPath):(process.env.CODEV_DEBUG&&console.log("VSCode not available, skipping extension installation"),!1)}catch(e){return process.env.CODEV_DEBUG&&console.error(`Error checking extension installation status: ${e.message}`),!1}}async installExtension(){try{return console.log("Installing Codev VSCode extension..."),await this.executeVSCodeCommand(["--install-extension",this.extensionPath])?(console.log("\u2705 Codev VSCode extension installed successfully"),!0):(console.warn("\u274C Failed to install Codev VSCode extension"),!1)}catch(e){return console.warn(`Error installing VSCode extension: ${e.message}`),!1}}async isVSCodeAvailable(){try{let e=process.env.IS_AISTUDIO==="True"?["--help"]:["--version"],s=await this.executeVSCodeCommand(e,{timeout:1e4});if(process.env.CODEV_DEBUG&&(console.log(`VSCode availability check (${e.join(" ")}): ${s?"available":"unavailable"}`),process.env.IS_AISTUDIO==="True")){let{spawn:t}=require("child_process");try{t("which",["code"],{stdio:["ignore","pipe","ignore"]}).stdout.on("data",n=>{console.log("which code:",n.toString().trim())})}catch(o){console.log("which command failed:",o.message)}}return s}catch(e){return process.env.CODEV_DEBUG&&console.error("VSCode availability check error:",e.message),!1}}async isExtensionInstalled(){let e=await this.resolveCodeCommand();try{return new Promise(s=>{try{let t={stdio:["ignore","pipe","ignore"],shell:!1,env:{...process.env,PATH:process.env.PATH,HOME:process.env.HOME,USER:process.env.USER}};process.env.CODEV_DEBUG&&console.log(`Spawning: ${e} --list-extensions`);let o=Ne(e,["--list-extensions"],t),n="";o.stdout.on("data",i=>{n+=i.toString()}),o.on("close",i=>{if(i===0){let a=n.split(`
|
|
210
210
|
`).map(r=>r.trim());s(a.includes(this.extensionId))}else s(!1)}),o.on("error",i=>{process.env.CODEV_DEBUG&&(console.error("VSCode list extensions error:",i.message),console.error("Error code:",i.code),console.error("Error errno:",i.errno),console.error("Error syscall:",i.syscall)),s(!1)}),setTimeout(()=>{try{o.kill()}catch{}s(!1)},1e4)}catch(t){process.env.CODEV_DEBUG&&console.error("Failed to spawn VSCode list extensions:",t.message),s(!1)}})}catch{return!1}}async executeVSCodeCommand(e,s={}){let t=await this.resolveCodeCommand();return new Promise(o=>{try{let n={stdio:"ignore",shell:!1,env:{...process.env,PATH:process.env.PATH,HOME:process.env.HOME,USER:process.env.USER}};process.env.CODEV_DEBUG&&console.log(`Spawning: ${t} ${e.join(" ")}`);let i=Ne(t,e,n);i.on("close",r=>{o(r===0)}),i.on("error",r=>{process.env.CODEV_DEBUG&&(console.error("VSCode command error:",r.message),console.error("Error code:",r.code),console.error("Error errno:",r.errno),console.error("Error syscall:",r.syscall)),o(!1)});let a=s.timeout||3e4;setTimeout(()=>{try{i.kill()}catch{}o(!1)},a)}catch(n){process.env.CODEV_DEBUG&&console.error("Failed to spawn VSCode command:",n.message),o(!1)}})}async ensureExtensionInstalled(){try{process.env.CODEV_DEBUG&&console.log("VSCode Extension Service: Checking extension status..."),await this.shouldInstallExtension()&&await this.installExtension()}catch(e){process.env.CODEV_DEBUG&&console.error("VSCode Extension Service Error:",e)}}};Be.exports=se});var Ge=p((ut,Ve)=>{var C=require("fs"),D=require("path"),As=require("readline"),{execSync:R}=require("child_process"),Re=require("os"),te=class{constructor(){this.serverUrl="https://makecoder.com/bigapis/codev/v1/coderpub"}getClaudeJsonlPath(e,s=!1){let t=e.replace(/[/_]/g,"-"),o=D.join(Re.homedir(),".claude","projects",t);if(s&&(console.log(`
|
|
211
211
|
\u{1F4C2} [allow-clone] \u67E5\u627E JSONL \u6587\u4EF6...`),console.log(` \u9879\u76EE\u76EE\u5F55: ${e}`),console.log(` Claude \u9879\u76EE\u540D: ${t}`),console.log(` Claude \u9879\u76EE\u76EE\u5F55: ${o}`)),!C.existsSync(o))return s&&console.log(" \u274C Claude \u9879\u76EE\u76EE\u5F55\u4E0D\u5B58\u5728"),null;s&&console.log(" \u2713 Claude \u9879\u76EE\u76EE\u5F55\u5B58\u5728");try{let n=C.readdirSync(o).filter(i=>i.endsWith(".jsonl")).map(i=>({name:i,path:D.join(o,i),mtime:C.statSync(D.join(o,i)).mtime,size:C.statSync(D.join(o,i)).size})).sort((i,a)=>a.mtime-i.mtime);return s&&(console.log(` \u627E\u5230 ${n.length} \u4E2A JSONL \u6587\u4EF6:`),n.forEach((i,a)=>{let r=(i.size/1024).toFixed(2),c=i.mtime.toLocaleString(),l=a===0?" <- \u6700\u65B0":"";console.log(` ${a+1}. ${i.name} (${r} KB, ${c})${l}`)})),n.length>0?(s&&console.log(` \u2713 \u9009\u62E9\u6700\u65B0\u6587\u4EF6: ${n[0].name}`),n[0].path):(s&&console.log(" \u274C \u76EE\u5F55\u4E2D\u6CA1\u6709 JSONL \u6587\u4EF6"),null)}catch(n){return s&&console.log(` \u274C \u8BFB\u53D6\u76EE\u5F55\u5931\u8D25: ${n.message}`),null}}async promptForName(){let e=As.createInterface({input:process.stdin,output:process.stdout});return new Promise((s,t)=>{e.question("\u8BF7\u8F93\u5165\u9879\u76EE\u540D\u79F0 (name): ",o=>{e.close();let n=o.trim();if(!n){t(new Error("\u9879\u76EE\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"));return}if(!/^[a-zA-Z0-9_-]+$/.test(n)){t(new Error("\u9879\u76EE\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u548C\u8FDE\u5B57\u7B26"));return}s(n)})})}async createZip(e,s={}){let{allowClone:t=!1}=s,o=Re.tmpdir(),n=`coder-pub-${Date.now()}.zip`,i=D.join(o,n);try{let a=!1;if(C.existsSync(D.join(e,".git")))try{R(`git archive -o "${i}" HEAD`,{cwd:e,stdio:"pipe"}),console.log("\u{1F4E6} \u4F7F\u7528 git archive \u521B\u5EFA\u538B\u7F29\u5305\uFF08\u5DF2\u6392\u9664 .gitignore \u4E2D\u7684\u6587\u4EF6\uFF09"),a=!0}catch{console.log("\u26A0\uFE0F git archive \u5931\u8D25\uFF0C\u4F7F\u7528\u666E\u901A zip \u547D\u4EE4")}if(!a){let c=[".git/*","node_modules/*",".env",".env.*","*.log",".DS_Store"].map(l=>`-x "${l}"`).join(" ");R(`zip -r "${i}" . ${c}`,{cwd:e,stdio:"pipe"}),console.log("\u{1F4E6} \u5DF2\u521B\u5EFA\u538B\u7F29\u5305")}if(t){console.log(`
|
|
212
212
|
\u{1F504} [allow-clone] \u5F00\u59CB\u5904\u7406 AI \u751F\u6210\u8BB0\u5F55...`);let r=this.getClaudeJsonlPath(e,!0);if(r){let c=D.join(o,"coder.pub.jsonl"),u=(C.statSync(r).size/1024).toFixed(2);console.log(`
|
|
@@ -218,8 +218,8 @@ Terminating ...`),u.kill("SIGTERM"),setTimeout(()=>{u.killed||u.kill("SIGKILL")}
|
|
|
218
218
|
\u2705 \u53D1\u5E03\u6210\u529F!`),console.log(`\u{1F4CC} \u7248\u672C: ${l.data.version}`),console.log(`\u{1F310} \u8BBF\u95EE\u5730\u5740: https://${i}.coder.pub/`),0):(console.error(`
|
|
219
219
|
\u274C \u53D1\u5E03\u5931\u8D25: ${l.message||l.reason}`),1)}catch(r){return console.error(`
|
|
220
220
|
\u274C ${r.message}`),1}finally{a&&this.cleanup(a)}}};Ve.exports=te});var je=p((ht,Ke)=>{var He=require("https"),E=require("fs"),v=require("path"),Os=require("os"),b="https://makecoder.com/skillhub",oe=class{getSkillDirs(){let e=Os.homedir();return[v.join(e,".claude","skills"),v.join(e,".codex","skills"),v.join(e,".gemini","skills"),v.join(e,".agents","skills")]}fetchWithAuth(e,s){return new Promise((t,o)=>{let n=new URL(e),i={hostname:n.hostname,port:n.port||443,path:n.pathname+n.search,method:"GET",headers:s?{Authorization:`Bearer ${s}`}:{}};He.get(i,a=>{if(a.statusCode>=300&&a.statusCode<400&&a.headers.location)return this.fetchWithAuth(a.headers.location,s).then(t).catch(o);let r="";a.on("data",c=>{r+=c}),a.on("end",()=>t({status:a.statusCode,body:r}))}).on("error",o)})}async handle({skillsSubcommand:e,skillsArg:s,skillsRemainingArgs:t,auth_ak:o,auth_sk:n}){let{execFileSync:i}=require("child_process");if(!e||e==="--help"||e==="-h")return this.showHelp(),0;if(e==="publish")return await this.publish(t||[],o,n);if(e==="unpublish")return await this.unpublish(s,o,n);if(e==="list")return await this.listMySkills(o,n);if(e==="namespaces")return await this.listNamespaces(o,n);if(s&&e!=="search"&&!/^[@a-zA-Z0-9_\-/.]+$/.test(s))return console.error("\u274C skill \u540D\u79F0\u5305\u542B\u975E\u6CD5\u5B57\u7B26"),1;if(e==="search")return s?await this.search(s):(console.error("\u274C \u8BF7\u6307\u5B9A\u641C\u7D22\u5173\u952E\u8BCD"),1);if(e==="remove")return s?this.remove(s):(console.error("\u274C \u8BF7\u6307\u5B9A skill \u540D\u79F0"),1);if((e==="add"||e==="update")&&s&&o&&n)return await this.install(s,`${o}.${n}`);try{let a;if(e==="add"){if(!s)return console.error("\u274C \u8BF7\u6307\u5B9A skill \u540D\u79F0"),1;a=["skills","add",b,"--skill",s,"-g"]}else if(e==="update")a=s?["skills","update","--skill",s,"-g"]:["skills","update","-g"];else return console.error(`\u274C \u672A\u77E5\u5B50\u547D\u4EE4: ${e}`),1;return i("npx",a,{stdio:"inherit"}),0}catch(a){return console.error(`\u274C \u6267\u884C\u5931\u8D25: ${a.message}`),1}}async install(e,s){let t=b.replace(/\/$/,"");console.log(`\u{1F50D} \u6B63\u5728\u4ECE ${b} \u67E5\u627E skill...`);let o;try{let c=await this.fetchWithAuth(`${t}/.well-known/agent-skills/index.json`,s);if(c.status!==200)return console.error(`\u274C \u65E0\u6CD5\u83B7\u53D6 skill \u5217\u8868 (HTTP ${c.status})`),1;o=JSON.parse(c.body)}catch(c){return console.error(`\u274C \u8BF7\u6C42\u5931\u8D25: ${c.message}`),1}let n=(o.skills||[]).find(c=>c.name.toLowerCase()===e.toLowerCase());if(!n){console.error(`\u274C \u672A\u627E\u5230 skill: ${e}`);for(let c of o.skills||[])console.log(` - ${c.name}`);return 1}let i=Array.from(new Set(["SKILL.md",...n.files||[]])),a=`${t}/.well-known/agent-skills/${n.name}`,r={};for(let c of i)try{let l=await this.fetchWithAuth(`${a}/${c}`,s);if(l.status!==200){console.warn(`\u26A0\uFE0F \u8DF3\u8FC7 ${c} (HTTP ${l.status})`);continue}r[c]=l.body}catch(l){console.warn(`\u26A0\uFE0F \u4E0B\u8F7D ${c} \u5931\u8D25: ${l.message}`)}console.log(`\u{1F4E6} \u6B63\u5728\u5B89\u88C5 ${n.name}...`);for(let c of this.getSkillDirs()){let l=v.join(c,n.name);E.mkdirSync(l,{recursive:!0});for(let[u,d]of Object.entries(r)){let f=v.join(l,u);E.mkdirSync(v.dirname(f),{recursive:!0}),E.writeFileSync(f,d,"utf8")}}return console.log(`\u2705 ${n.name} \u5B89\u88C5\u5B8C\u6210`),0}remove(e){let s=!1;for(let t of this.getSkillDirs()){let o=v.join(t,e);E.existsSync(o)&&(E.rmSync(o,{recursive:!0,force:!0}),console.log(` \u{1F5D1}\uFE0F ${o}`),s=!0)}return s?(console.log(`\u2705 ${e} \u5DF2\u5220\u9664`),0):(console.error(`\u274C \u672A\u627E\u5230\u5DF2\u5B89\u88C5\u7684 skill: ${e}`),1)}async search(e){let s=`${b}/api/web/skills?q=${encodeURIComponent(e)}&sort=relevance&page=0&size=12`;return new Promise(t=>{He.get(s,o=>{let n="";o.on("data",i=>{n+=i}),o.on("end",()=>{try{let i=JSON.parse(n);if(i.code!==0)return console.error(`\u274C \u67E5\u8BE2\u5931\u8D25: ${i.msg}`),t(1);let a=i.data.items;if(a.length===0)return console.log(`\u6CA1\u6709\u627E\u5230\u4E0E "${e}" \u76F8\u5173\u7684 skill`),t(0);console.log(`\u627E\u5230 ${i.data.total} \u4E2A\u7ED3\u679C:
|
|
221
|
-
`);for(let r of a)console.log(` ${r.slug.padEnd(20)} ${r.summary}`);t(0)}catch(i){console.error(`\u274C \u89E3\u6790\u54CD\u5E94\u5931\u8D25: ${i.message}`),t(1)}})}).on("error",o=>{console.error(`\u274C \u8BF7\u6C42\u5931\u8D25: ${o.message}`),t(1)})})}async publish(e,s,t){let{execSync:o}=require("child_process"),n=require("os"),i="global",a="PUBLIC",r=null,c=null,l=null;for(let m=0;m<e.length;m++)if(e[m]==="--namespace"||e[m]==="-n")i=e[++m];else if(e[m]==="--visibility"||e[m]==="-v")a=e[++m];else if(!e[m].startsWith("-")){let w=e[m];E.existsSync(w)&&E.statSync(w).isDirectory()?l=w:r=w}if(!s||!t)return console.error("\u274C \u7F3A\u5C11 API Key\uFF0C\u8BF7\u5148\u767B\u5F55: coder login"),1;let u=i.startsWith("@")?i.slice(1):i;u==="global"||(a="NAMESPACE_ONLY");let f=["PUBLIC","NAMESPACE_ONLY","PRIVATE"];if(!f.includes(a))return console.error(`\u274C visibility \u5FC5\u987B\u662F: ${f.join(", ")}`),1;if(r){if(!E.existsSync(r))return console.error(`\u274C \u6587\u4EF6\u4E0D\u5B58\u5728: ${r}`),1}else{let m=l?v.resolve(l):process.cwd();c=v.join(n.tmpdir(),`skill-pub-${Date.now()}.zip`),console.log(`\u{1F4E6} \u6B63\u5728\u6253\u5305 ${m}...`);try{E.existsSync(v.join(m,".git"))?(o(`git archive -o "${c}" HEAD`,{cwd:m,stdio:"pipe"}),console.log(" \u4F7F\u7528 git archive\uFF08\u5DF2\u6392\u9664 .gitignore \u6587\u4EF6\uFF09")):o(`zip -r "${c}" . -x ".git/*" -x "node_modules/*" -x ".env" -x "*.log"`,{cwd:m,stdio:"pipe"})}catch(w){return console.error(`\u274C \u6253\u5305\u5931\u8D25: ${w.message}`),1}r=c}let
|
|
222
|
-
\u2705 \u53D1\u5E03\u6210\u529F!`),console.log(` ${
|
|
221
|
+
`);for(let r of a)console.log(` ${r.slug.padEnd(20)} ${r.summary}`);t(0)}catch(i){console.error(`\u274C \u89E3\u6790\u54CD\u5E94\u5931\u8D25: ${i.message}`),t(1)}})}).on("error",o=>{console.error(`\u274C \u8BF7\u6C42\u5931\u8D25: ${o.message}`),t(1)})})}async publish(e,s,t){let{execSync:o}=require("child_process"),n=require("os"),i="global",a="PUBLIC",r=null,c=null,l=null;for(let m=0;m<e.length;m++)if(e[m]==="--namespace"||e[m]==="-n")i=e[++m];else if(e[m]==="--visibility"||e[m]==="-v")a=e[++m];else if(!e[m].startsWith("-")){let w=e[m];E.existsSync(w)&&E.statSync(w).isDirectory()?l=w:r=w}if(!s||!t)return console.error("\u274C \u7F3A\u5C11 API Key\uFF0C\u8BF7\u5148\u767B\u5F55: coder login"),1;let u=i.startsWith("@")?i.slice(1):i;u==="global"||(a="NAMESPACE_ONLY");let f=["PUBLIC","NAMESPACE_ONLY","PRIVATE"];if(!f.includes(a))return console.error(`\u274C visibility \u5FC5\u987B\u662F: ${f.join(", ")}`),1;if(r){if(!E.existsSync(r))return console.error(`\u274C \u6587\u4EF6\u4E0D\u5B58\u5728: ${r}`),1}else{let m=l?v.resolve(l):process.cwd();c=v.join(n.tmpdir(),`skill-pub-${Date.now()}.zip`),console.log(`\u{1F4E6} \u6B63\u5728\u6253\u5305 ${m}...`);try{E.existsSync(v.join(m,".git"))?(o(`git archive -o "${c}" HEAD`,{cwd:m,stdio:"pipe"}),console.log(" \u4F7F\u7528 git archive\uFF08\u5DF2\u6392\u9664 .gitignore \u6587\u4EF6\uFF09")):o(`zip -r "${c}" . -x ".git/*" -x "node_modules/*" -x ".env" -x "*.log"`,{cwd:m,stdio:"pipe"})}catch(w){return console.error(`\u274C \u6253\u5305\u5931\u8D25: ${w.message}`),1}r=c}let F=`${b}/api/v1/skills/${encodeURIComponent(u)}/publish?visibility=${encodeURIComponent(a)}`,Je=`${s}.${t}`;console.log(`\u{1F680} \u6B63\u5728\u53D1\u5E03\u5230 ${b}...`),console.log(` namespace: ${u}`),console.log(` visibility: ${a}`);try{let m=`curl -s -X POST "${F}" -H "Authorization: Bearer ${Je}" -F "file=@${r}"`,w=o(m,{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),$=JSON.parse(w);if($.code===0){let U=$.data;return console.log(`
|
|
222
|
+
\u2705 \u53D1\u5E03\u6210\u529F!`),console.log(` ${U.namespace}/${U.slug}@${U.version}`),U.status==="PUBLISHED"?console.log(" \u72B6\u6001: \u5DF2\u53D1\u5E03"):console.log(" \u72B6\u6001: \u5F85\u5BA1\u6838"),0}else return console.error(`
|
|
223
223
|
\u274C \u53D1\u5E03\u5931\u8D25: ${$.msg||JSON.stringify($)}`),1}catch(m){let w=m.stdout;if(w)try{let $=JSON.parse(w);return console.error(`
|
|
224
224
|
\u274C \u53D1\u5E03\u5931\u8D25: ${$.msg||w}`),1}catch{}return console.error(`\u274C \u8BF7\u6C42\u5931\u8D25: ${m.message}`),1}finally{c&&E.existsSync(c)&&E.unlinkSync(c)}}async unpublish(e,s,t){let{execSync:o}=require("child_process");if(!e)return console.error("\u274C \u8BF7\u6307\u5B9A skill: coder skills unpublish <namespace>/<slug>"),1;if(!s||!t)return console.error("\u274C \u7F3A\u5C11 API Key\uFF0C\u8BF7\u5148\u767B\u5F55: coder login"),1;let n=e.split("/");if(n.length!==2||!n[0]||!n[1])return console.error("\u274C \u683C\u5F0F\u9519\u8BEF\uFF0C\u5E94\u4E3A <namespace>/<slug>\uFF0C\u4F8B\u5982: global/my-skill"),1;let[i,a]=n,r=i.startsWith("@")?i.slice(1):i,c=`${b}/api/v1/skills/${encodeURIComponent(r)}/${encodeURIComponent(a)}`,l=`${s}.${t}`;console.log(`\u{1F5D1}\uFE0F \u6B63\u5728\u4E0B\u67B6 ${r}/${a}...`);try{let u=o(`curl -s -X DELETE "${c}" -H "Authorization: Bearer ${l}"`,{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),d=JSON.parse(u);return d.code===0?(console.log(`\u2705 \u5DF2\u4E0B\u67B6 ${r}/${a}`),0):(console.error(`\u274C \u4E0B\u67B6\u5931\u8D25: ${d.msg||JSON.stringify(d)}`),1)}catch(u){return console.error(`\u274C \u8BF7\u6C42\u5931\u8D25: ${u.message}`),1}}async listMySkills(e,s){let{execSync:t}=require("child_process");if(!e||!s)return console.error("\u274C \u7F3A\u5C11 API Key\uFF0C\u8BF7\u5148\u767B\u5F55: coder login"),1;let o=`${b}/api/v1/me/skills?size=50`,n=`${e}.${s}`;try{let i=t(`curl -s "${o}" -H "Authorization: Bearer ${n}"`,{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),a=JSON.parse(i);if(a.code!==0)return console.error(`\u274C \u83B7\u53D6\u5931\u8D25: ${a.msg}`),1;let r=a.data?.items||[],c=a.data?.total||0;if(r.length===0)return console.log("\u6682\u65E0\u5DF2\u53D1\u5E03\u7684 skill"),0;console.log(`\u5171 ${c} \u4E2A skill:
|
|
225
225
|
`);for(let l of r){let u=`${l.namespace}/${l.slug}`.padEnd(36),d=`\u2B50 ${l.starCount??0}`.padEnd(8),f=`\u2193 ${l.downloadCount??0}`.padEnd(10);console.log(` ${u} ${d} ${f} [${l.status}]`),l.displayName&&l.displayName!==l.slug&&console.log(` ${"".padEnd(36)} ${l.displayName}`)}return 0}catch(i){return console.error(`\u274C \u8BF7\u6C42\u5931\u8D25: ${i.message}`),1}}async listNamespaces(e,s){let{execSync:t}=require("child_process");if(!e||!s)return console.error("\u274C \u7F3A\u5C11 API Key\uFF0C\u8BF7\u5148\u767B\u5F55: coder login"),1;let o=`${b}/api/v1/me/namespaces`,n=`${e}.${s}`;try{let i=t(`curl -s "${o}" -H "Authorization: Bearer ${n}"`,{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),a=JSON.parse(i);if(a.code!==0)return console.error(`\u274C \u83B7\u53D6\u5931\u8D25: ${a.msg}`),1;let r=a.data||[];if(r.length===0)return console.log("\u6682\u65E0\u547D\u540D\u7A7A\u95F4"),0;console.log(`\u5171 ${r.length} \u4E2A\u547D\u540D\u7A7A\u95F4:
|
|
@@ -253,13 +253,13 @@ EXAMPLES:
|
|
|
253
253
|
coder skills publish --visibility PRIVATE my-skill.zip
|
|
254
254
|
coder skills unpublish global/my-skill
|
|
255
255
|
coder skills namespaces
|
|
256
|
-
`)}};Ke.exports=oe});var We=p((dt,ze)=>{var Ts=de(),Ms=Oe(),qs=Me(),Fs=Fe(),Us=Le(),Ns=Ge(),Bs=je(),{isPrintMode:Ls}=
|
|
256
|
+
`)}};Ke.exports=oe});var We=p((dt,ze)=>{var Ts=de(),Ms=Oe(),qs=Me(),Fs=Fe(),Us=Le(),Ns=Ge(),Bs=je(),{isPrintMode:Ls}=N(),ne=class{constructor(){this.argParser=new Ts,this.claudeLauncher=new Ms,this.geminiLauncher=new qs,this.codexLauncher=new Fs,this.vscodeExtensionService=new Us,this.publishService=new Ns,this.skillsService=new Bs}async run(e=process.argv.slice(2)){try{try{await this.vscodeExtensionService.ensureExtensionInstalled()}catch(t){process.env.CODEV_DEBUG&&console.error("VSCode Extension Service Error:",t)}if(!e.includes("--agent")&&!e.includes("-a")){let t=e.length>0&&["claude","gemini","codex"].includes(e[0]),o=e.length>0&&["pub","update","skills"].includes(e[0]);if(!t&&!o&&(e.includes("--help")||e.includes("-h")))return this.argParser.showHelp(),0;if(!t&&!o&&(e.includes("--version")||e.includes("-v")))return this.showVersion(),0}let s=await this.argParser.parse(e);return s.command==="login"?await this.handleLogin(s):s.command==="update"?this.handleUpdate():s.command==="skills"?await this.skillsService.handle(s):s.command==="pub"?await this.publishService.publish({name:s.pubName,ak:s.auth_ak,sk:s.auth_sk,serverBaseUrl:s.codevServer,allowClone:s.allowClone}):await this.launchAgent(s)}catch(s){return console.error(`Error: ${s.message}`),process.env.CODEV_DEBUG&&console.error("Stack trace:",s.stack),1}}async launchAgent(e){let{agent:s,remainingArgs:t}=e;return Ls(t)||console.log(`cwd:\x1B[90m\x1B[3m ${process.cwd()} \x1B[0m`),s==="claude"?await this.claudeLauncher.launch(e):s==="gemini"?await this.geminiLauncher.launch(e):s==="codex"?await this.codexLauncher.launch(e):1}async handleLogin(e){let s=e.auth_ak,t=e.auth_sk;if(!s||!t){console.log(`
|
|
257
257
|
\u{1F511} \u8BF7\u5148\u5728 MakeCoder \u521B\u5EFA API Key\uFF1A`),console.log(` \u{1F449} https://makecoder.com/my/apikeys
|
|
258
|
-
`);try{let n=await this.argParser.promptForAKSK();s=n.ak,t=n.sk}catch(n){return console.error(`\u274C ${n.message}`),1}}if(this.argParser.saveAuthToConfig(s,t))console.log("\u2705 API Key \u5DF2\u4FDD\u5B58\u5230 ~/.coder/config.json"),console.log(" \u73B0\u5728\u53EF\u4EE5\u76F4\u63A5\u8FD0\u884C coder \u5F00\u59CB\u4F7F\u7528\u4E86 \u{1F680}");else return console.error("\u274C \u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 ~/.coder/ \u76EE\u5F55\u7684\u6587\u4EF6\u6743\u9650"),1;return 0}handleUpdate(){let{execSync:e}=require("child_process"),s=
|
|
258
|
+
`);try{let n=await this.argParser.promptForAKSK();s=n.ak,t=n.sk}catch(n){return console.error(`\u274C ${n.message}`),1}}if(this.argParser.saveAuthToConfig(s,t))console.log("\u2705 API Key \u5DF2\u4FDD\u5B58\u5230 ~/.coder/config.json"),console.log(" \u73B0\u5728\u53EF\u4EE5\u76F4\u63A5\u8FD0\u884C coder \u5F00\u59CB\u4F7F\u7528\u4E86 \u{1F680}");else return console.error("\u274C \u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 ~/.coder/ \u76EE\u5F55\u7684\u6587\u4EF6\u6743\u9650"),1;return 0}handleUpdate(){let{execSync:e}=require("child_process"),s=O();console.log(`\u5F53\u524D\u7248\u672C: ${s.version}`),console.log(`\u6B63\u5728\u5347\u7EA7 Coder...
|
|
259
259
|
`);try{return e("npm install -g makecoder@latest",{stdio:"inherit"}),console.log(`
|
|
260
260
|
\u2705 \u5347\u7EA7\u6210\u529F`),0}catch(t){return console.error(`
|
|
261
|
-
\u274C \u5347\u7EA7\u5931\u8D25:`,t.message),1}}showVersion(){let e=
|
|
262
|
-
Shutting down...`),process.exit(0)}};ze.exports=ne});var Rs=We(),{isPrintMode:Vs}=
|
|
263
|
-
`)
|
|
261
|
+
\u274C \u5347\u7EA7\u5931\u8D25:`,t.message),1}}showVersion(){let e=O();console.log(`coder version: ${e.version}`)}async shutdown(){console.log(`
|
|
262
|
+
Shutting down...`),process.exit(0)}};ze.exports=ne});var Rs=We(),{isPrintMode:Vs}=N();process.on("unhandledRejection",(h,e)=>{console.error("Unhandled Promise Rejection:",h),process.exit(1)});process.on("uncaughtException",h=>{console.error("Uncaught Exception:",h.message),process.env.CODEV_DEBUG&&console.error(h.stack),process.exit(1)});async function Gs(){if(!Vs()){let{version:e}=O();console.log(`Welcome to Coder v${e}!
|
|
263
|
+
`)}let h=new Rs;process.on("SIGINT",async()=>{console.log(`
|
|
264
264
|
Received SIGINT, shutting down gracefully...`),await h.shutdown()}),process.on("SIGTERM",async()=>{console.log(`
|
|
265
265
|
Received SIGTERM, shutting down gracefully...`),await h.shutdown()});try{let e=await h.run();process.exit(e)}catch(e){console.error(`Fatal error: ${e.message}`),process.env.CODEV_DEBUG&&console.error(e.stack),process.exit(1)}}Gs().catch(h=>{console.error(`Startup error: ${h.message}`),process.exit(1)});
|
|
@@ -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{$c as yR,$e as aH,$m as d3,Ab as QU,Am as xR,B as xU,Be as tH,Bf as Mre,Bm as o3,Ce as ER,Cf as uH,Cm as s3,De as nH,Df as dH,Dl as DR,Ec as jU,Ee as CR,Fe as rH,Ff as al,Fg as EH,Ge as iH,Gf as fH,Gg as CH,Gj as OA,Hf as hH,Hh as NH,Hl as zH,Hm as a3,Ih as rc,Im as iv,Jl as qH,Jm as l3,K as BU,Le as v0,M as wU,Mb as _U,Mf as AH,Ne as JD,Nm as c3,Oe as oH,Of as SR,Om as u3,Pb as qD,Rk as nv,S as Jo,Sb as AR,Si as LH,Ub as FU,Vb as mR,Vl as YH,Wb as NU,Wc as zU,Wh as kH,Xb as kU,Xl as vR,Yb as MU,Yk as UA,Zk as GH,Zl as KH,_e as sH,a as Fre,ad as Og,bd as qU,be as WU,cd as YU,ci as MH,dh as SH,dk as LA,ef as lH,fa as kre,fc as YD,fe as VD,ga as RU,gi as OH,gm as VH,ha as Ng,hh as bH,hm as rv,ia as kg,ik as HH,im as WH,je as JU,jg as mH,jh as Ji,jj as bR,kg as pH,kh as ev,km as JH,le as XU,lf as cH,lg as XD,lh as IH,lm as XH,mc as pR,me as $U,mg as gH,mh as tv,nc as OU,ne as ZU,ng as Ore,nh as DH,nk as IR,oc as LU,og as ua,oh as vH,om as $H,pc as UU,pg as $D,ph as xH,pm as ZH,q as SU,qc as HU,qf as Lg,qg as Lre,qh as BH,qm as e3,rc as GU,rd as KU,rg as Ure,rh as x0,rm as t3,s as bU,sc as PU,sd as VU,sh as B0,sm as n3,t as PD,td as D0,th as wH,tl as PH,tm as r3,uh as TH,ui as da,vh as RH,vn as f3,wd as KD,we as eH,wg as yH,wh as QH,wl as jH,wm as Gg,x as IU,xb as zD,xe as WD,xh as Ug,xi as Mf,y as DU,yb as hR,yc as gR,yh as _H,yi as Hg,ym as i3,z as vU,zg as ZD,zh as FH}from"./chunk-YE6OXWU4.js";import{$ as kf,$d as Mg,C as uR,Gd as jD,Id as _t,Od as I0,Pa as EU,Yc as CU,Zd as TU,a as vt,b as Ce,ba as Fi,be as gt,da as dR,ea as mU,ga as fR,ha as LD,ka as pU,la as UD,na as Nre,pa as fr,ra as gU,sa as yU,tc as HD,te as UH,uc as GD}from"./chunk-VEQE4EAQ.js";import{b as ov,c as Of}from"./chunk-LP5C4GJE.js";import{a as $n,c as me,d as _re,e as Se}from"./chunk-YUXORC52.js";var I3=me(Vt=>{"use strict";var TR=Symbol.for("react.transitional.element"),Hre=Symbol.for("react.portal"),Gre=Symbol.for("react.fragment"),Pre=Symbol.for("react.strict_mode"),jre=Symbol.for("react.profiler"),zre=Symbol.for("react.consumer"),qre=Symbol.for("react.context"),Yre=Symbol.for("react.forward_ref"),Kre=Symbol.for("react.suspense"),Vre=Symbol.for("react.memo"),g3=Symbol.for("react.lazy"),Wre=Symbol.for("react.activity"),h3=Symbol.iterator;function Jre(e){return e===null||typeof e!="object"?null:(e=h3&&e[h3]||e["@@iterator"],typeof e=="function"?e:null)}var y3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E3=Object.assign,C3={};function jg(e,t,n){this.props=e,this.context=t,this.refs=C3,this.updater=n||y3}jg.prototype.isReactComponent={};jg.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")};jg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function S3(){}S3.prototype=jg.prototype;function RR(e,t,n){this.props=e,this.context=t,this.refs=C3,this.updater=n||y3}var QR=RR.prototype=new S3;QR.constructor=RR;E3(QR,jg.prototype);QR.isPureReactComponent=!0;var A3=Array.isArray;function wR(){}var wr={H:null,A:null,T:null,S:null},b3=Object.prototype.hasOwnProperty;function _R(e,t,n){var r=n.ref;return{$$typeof:TR,type:e,key:t,ref:r!==void 0?r:null,props:n}}function Xre(e,t){return _R(e.type,t,e.props)}function FR(e){return typeof e=="object"&&e!==null&&e.$$typeof===TR}function $re(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var m3=/\/+/g;function BR(e,t){return typeof e=="object"&&e!==null&&e.key!=null?$re(""+e.key):t.toString(36)}function Zre(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(wR,wR):(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 Pg(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 TR:case Hre:a=!0;break;case g3:return a=e._init,Pg(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+BR(e,0):r,A3(i)?(n="",a!=null&&(n=a.replace(m3,"$&/")+"/"),Pg(i,t,n,"",function(A){return A})):i!=null&&(FR(i)&&(i=Xre(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(m3,"$&/")+"/")+a)),t.push(i)),1;a=0;var c=r===""?".":r+":";if(A3(e))for(var f=0;f<e.length;f++)r=e[f],s=c+BR(r,f),a+=Pg(r,t,n,s,i);else if(f=Jre(e),typeof f=="function")for(e=f.call(e),f=0;!(r=e.next()).done;)r=r.value,s=c+BR(r,f++),a+=Pg(r,t,n,s,i);else if(s==="object"){if(typeof e.then=="function")return Pg(Zre(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 sv(e,t,n){if(e==null)return e;var r=[],i=0;return Pg(e,r,"","",function(s){return t.call(n,s,i++)}),r}function eie(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 p3=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)},tie={map:sv,forEach:function(e,t,n){sv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return sv(e,function(){t++}),t},toArray:function(e){return sv(e,function(t){return t})||[]},only:function(e){if(!FR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Vt.Activity=Wre;Vt.Children=tie;Vt.Component=jg;Vt.Fragment=Gre;Vt.Profiler=jre;Vt.PureComponent=RR;Vt.StrictMode=Pre;Vt.Suspense=Kre;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=E3({},e.props),i=e.key;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)!b3.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 _R(e.type,i,r)};Vt.createContext=function(e){return e={$$typeof:qre,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:zre,_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)b3.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 _R(e,s,i)};Vt.createRef=function(){return{current:null}};Vt.forwardRef=function(e){return{$$typeof:Yre,render:e}};Vt.isValidElement=FR;Vt.lazy=function(e){return{$$typeof:g3,_payload:{_status:-1,_result:e},_init:eie}};Vt.memo=function(e,t){return{$$typeof:Vre,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(wR,p3)}catch(s){p3(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 D3=me((jt,av)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){function e(k,z){Object.defineProperty(r.prototype,k,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",z[0],z[1])}})}function t(k){return k===null||typeof k!="object"?null:(k=Ve&&k[Ve]||k["@@iterator"],typeof k=="function"?k:null)}function n(k,z){k=(k=k.constructor)&&(k.displayName||k.name)||"ReactClass";var Le=k+"."+z;Qe[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.",z,k),Qe[Le]=!0)}function r(k,z,Le){this.props=k,this.context=z,this.refs=yt,this.updater=Le||bt}function i(){}function s(k,z,Le){this.props=k,this.context=z,this.refs=yt,this.updater=Le||bt}function a(){}function c(k){return""+k}function f(k){try{c(k);var z=!1}catch{z=!0}if(z){z=console;var Le=z.error,We=typeof Symbol=="function"&&Symbol.toStringTag&&k[Symbol.toStringTag]||k.constructor.name||"Object";return Le.call(z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",We),c(k)}}function A(k){if(k==null)return null;if(typeof k=="function")return k.$$typeof===Gn?null:k.displayName||k.name||null;if(typeof k=="string")return k;switch(k){case Ze:return"Fragment";case J:return"Profiler";case xe:return"StrictMode";case St:return"Suspense";case j:return"SuspenseList";case Ae:return"Activity"}if(typeof k=="object")switch(typeof k.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),k.$$typeof){case ke:return"Portal";case Oe:return k.displayName||"Context";case Re:return(k._context.displayName||"Context")+".Consumer";case nt:var z=k.render;return k=k.displayName,k||(k=z.displayName||z.name||"",k=k!==""?"ForwardRef("+k+")":"ForwardRef"),k;case q:return z=k.displayName||null,z!==null?z:A(k.type)||"Memo";case Y:z=k._payload,k=k._init;try{return A(k(z))}catch{}}return null}function m(k){if(k===Ze)return"<>";if(typeof k=="object"&&k!==null&&k.$$typeof===Y)return"<...>";try{var z=A(k);return z?"<"+z+">":"<...>"}catch{return"<...>"}}function E(){var k=pt.A;return k===null?null:k.getOwner()}function C(){return Error("react-stack-top-frame")}function p(k){if(Si.call(k,"key")){var z=Object.getOwnPropertyDescriptor(k,"key").get;if(z&&z.isReactWarning)return!1}return k.key!==void 0}function g(k,z){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)",z))}Le.isReactWarning=!0,Object.defineProperty(k,"key",{get:Le,configurable:!0})}function b(){var k=A(this.type);return to[k]||(to[k]=!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.")),k=this.props.ref,k!==void 0?k:null}function v(k,z,Le,We,ee,le){var be=Le.ref;return k={$$typeof:pe,type:k,key:z,props:Le,_owner:We},(be!==void 0?be:null)!==null?Object.defineProperty(k,"ref",{enumerable:!1,get:b}):Object.defineProperty(k,"ref",{enumerable:!1,value:null}),k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(k,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(k,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.defineProperty(k,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k}function w(k,z){return z=v(k.type,z,k.props,k._owner,k._debugStack,k._debugTask),k._store&&(z._store.validated=k._store.validated),z}function T(k){_(k)?k._store&&(k._store.validated=1):typeof k=="object"&&k!==null&&k.$$typeof===Y&&(k._payload.status==="fulfilled"?_(k._payload.value)&&k._payload.value._store&&(k._payload.value._store.validated=1):k._store&&(k._store.validated=1))}function _(k){return typeof k=="object"&&k!==null&&k.$$typeof===pe}function M(k){var z={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(Le){return z[Le]})}function U(k,z){return typeof k=="object"&&k!==null&&k.key!=null?(f(k.key),M(""+k.key)):z.toString(36)}function P(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(a,a):(k.status="pending",k.then(function(z){k.status==="pending"&&(k.status="fulfilled",k.value=z)},function(z){k.status==="pending"&&(k.status="rejected",k.reason=z)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function V(k,z,Le,We,ee){var le=typeof k;(le==="undefined"||le==="boolean")&&(k=null);var be=!1;if(k===null)be=!0;else switch(le){case"bigint":case"string":case"number":be=!0;break;case"object":switch(k.$$typeof){case pe:case ke:be=!0;break;case Y:return be=k._init,V(be(k._payload),z,Le,We,ee)}}if(be){be=k,ee=ee(be);var $e=We===""?"."+U(be,0):We;return Fr(ee)?(Le="",$e!=null&&(Le=$e.replace(Oi,"$&/")+"/"),V(ee,z,Le,"",function(mr){return mr})):ee!=null&&(_(ee)&&(ee.key!=null&&(be&&be.key===ee.key||f(ee.key)),Le=w(ee,Le+(ee.key==null||be&&be.key===ee.key?"":(""+ee.key).replace(Oi,"$&/")+"/")+$e),We!==""&&be!=null&&_(be)&&be.key==null&&be._store&&!be._store.validated&&(Le._store.validated=2),ee=Le),z.push(ee)),1}if(be=0,$e=We===""?".":We+":",Fr(k))for(var Et=0;Et<k.length;Et++)We=k[Et],le=$e+U(We,Et),be+=V(We,z,Le,le,ee);else if(Et=t(k),typeof Et=="function")for(Et===k.entries&&(Nr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Nr=!0),k=Et.call(k),Et=0;!(We=k.next()).done;)We=We.value,le=$e+U(We,Et++),be+=V(We,z,Le,le,ee);else if(le==="object"){if(typeof k.then=="function")return V(P(k),z,Le,We,ee);throw z=String(k),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return be}function te(k,z,Le){if(k==null)return k;var We=[],ee=0;return V(k,We,"","",function(le){return z.call(Le,le,ee++)}),We}function G(k){if(k._status===-1){var z=k._ioInfo;z!=null&&(z.start=z.end=performance.now()),z=k._result;var Le=z();if(Le.then(function(ee){if(k._status===0||k._status===-1){k._status=1,k._result=ee;var le=k._ioInfo;le!=null&&(le.end=performance.now()),Le.status===void 0&&(Le.status="fulfilled",Le.value=ee)}},function(ee){if(k._status===0||k._status===-1){k._status=2,k._result=ee;var le=k._ioInfo;le!=null&&(le.end=performance.now()),Le.status===void 0&&(Le.status="rejected",Le.reason=ee)}}),z=k._ioInfo,z!=null){z.value=Le;var We=Le.displayName;typeof We=="string"&&(z.name=We)}k._status===-1&&(k._status=0,k._result=Le)}if(k._status===1)return z=k._result,z===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
|
+
import{$c as yR,$e as aH,$m as d3,Ab as QU,Am as xR,B as xU,Be as tH,Bf as Mre,Bm as o3,Ce as ER,Cf as uH,Cm as s3,De as nH,Df as dH,Dl as DR,Ec as jU,Ee as CR,Fe as rH,Ff as al,Fg as EH,Ge as iH,Gf as fH,Gg as CH,Gj as OA,Hf as hH,Hh as NH,Hl as zH,Hm as a3,Ih as rc,Im as iv,Jl as qH,Jm as l3,K as BU,Le as v0,M as wU,Mb as _U,Mf as AH,Ne as JD,Nm as c3,Oe as oH,Of as SR,Om as u3,Pb as qD,Rk as nv,S as Jo,Sb as AR,Si as LH,Ub as FU,Vb as mR,Vl as YH,Wb as NU,Wc as zU,Wh as kH,Xb as kU,Xl as vR,Yb as MU,Yk as UA,Zk as GH,Zl as KH,_e as sH,a as Fre,ad as Og,bd as qU,be as WU,cd as YU,ci as MH,dh as SH,dk as LA,ef as lH,fa as kre,fc as YD,fe as VD,ga as RU,gi as OH,gm as VH,ha as Ng,hh as bH,hm as rv,ia as kg,ik as HH,im as WH,je as JU,jg as mH,jh as Ji,jj as bR,kg as pH,kh as ev,km as JH,le as XU,lf as cH,lg as XD,lh as IH,lm as XH,mc as pR,me as $U,mg as gH,mh as tv,nc as OU,ne as ZU,ng as Ore,nh as DH,nk as IR,oc as LU,og as ua,oh as vH,om as $H,pc as UU,pg as $D,ph as xH,pm as ZH,q as SU,qc as HU,qf as Lg,qg as Lre,qh as BH,qm as e3,rc as GU,rd as KU,rg as Ure,rh as x0,rm as t3,s as bU,sc as PU,sd as VU,sh as B0,sm as n3,t as PD,td as D0,th as wH,tl as PH,tm as r3,uh as TH,ui as da,vh as RH,vn as f3,wd as KD,we as eH,wg as yH,wh as QH,wl as jH,wm as Gg,x as IU,xb as zD,xe as WD,xh as Ug,xi as Mf,y as DU,yb as hR,yc as gR,yh as _H,yi as Hg,ym as i3,z as vU,zg as ZD,zh as FH}from"./chunk-NQYDZB3F.js";import{$ as kf,$d as Mg,C as uR,Gd as jD,Id as _t,Od as I0,Pa as EU,Yc as CU,Zd as TU,a as vt,b as Ce,ba as Fi,be as gt,da as dR,ea as mU,ga as fR,ha as LD,ka as pU,la as UD,na as Nre,pa as fr,ra as gU,sa as yU,tc as HD,te as UH,uc as GD}from"./chunk-VEQE4EAQ.js";import{b as ov,c as Of}from"./chunk-LP5C4GJE.js";import{a as $n,c as me,d as _re,e as Se}from"./chunk-YUXORC52.js";var I3=me(Vt=>{"use strict";var TR=Symbol.for("react.transitional.element"),Hre=Symbol.for("react.portal"),Gre=Symbol.for("react.fragment"),Pre=Symbol.for("react.strict_mode"),jre=Symbol.for("react.profiler"),zre=Symbol.for("react.consumer"),qre=Symbol.for("react.context"),Yre=Symbol.for("react.forward_ref"),Kre=Symbol.for("react.suspense"),Vre=Symbol.for("react.memo"),g3=Symbol.for("react.lazy"),Wre=Symbol.for("react.activity"),h3=Symbol.iterator;function Jre(e){return e===null||typeof e!="object"?null:(e=h3&&e[h3]||e["@@iterator"],typeof e=="function"?e:null)}var y3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E3=Object.assign,C3={};function jg(e,t,n){this.props=e,this.context=t,this.refs=C3,this.updater=n||y3}jg.prototype.isReactComponent={};jg.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")};jg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function S3(){}S3.prototype=jg.prototype;function RR(e,t,n){this.props=e,this.context=t,this.refs=C3,this.updater=n||y3}var QR=RR.prototype=new S3;QR.constructor=RR;E3(QR,jg.prototype);QR.isPureReactComponent=!0;var A3=Array.isArray;function wR(){}var wr={H:null,A:null,T:null,S:null},b3=Object.prototype.hasOwnProperty;function _R(e,t,n){var r=n.ref;return{$$typeof:TR,type:e,key:t,ref:r!==void 0?r:null,props:n}}function Xre(e,t){return _R(e.type,t,e.props)}function FR(e){return typeof e=="object"&&e!==null&&e.$$typeof===TR}function $re(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var m3=/\/+/g;function BR(e,t){return typeof e=="object"&&e!==null&&e.key!=null?$re(""+e.key):t.toString(36)}function Zre(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(wR,wR):(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 Pg(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 TR:case Hre:a=!0;break;case g3:return a=e._init,Pg(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+BR(e,0):r,A3(i)?(n="",a!=null&&(n=a.replace(m3,"$&/")+"/"),Pg(i,t,n,"",function(A){return A})):i!=null&&(FR(i)&&(i=Xre(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(m3,"$&/")+"/")+a)),t.push(i)),1;a=0;var c=r===""?".":r+":";if(A3(e))for(var f=0;f<e.length;f++)r=e[f],s=c+BR(r,f),a+=Pg(r,t,n,s,i);else if(f=Jre(e),typeof f=="function")for(e=f.call(e),f=0;!(r=e.next()).done;)r=r.value,s=c+BR(r,f++),a+=Pg(r,t,n,s,i);else if(s==="object"){if(typeof e.then=="function")return Pg(Zre(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 sv(e,t,n){if(e==null)return e;var r=[],i=0;return Pg(e,r,"","",function(s){return t.call(n,s,i++)}),r}function eie(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 p3=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)},tie={map:sv,forEach:function(e,t,n){sv(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return sv(e,function(){t++}),t},toArray:function(e){return sv(e,function(t){return t})||[]},only:function(e){if(!FR(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Vt.Activity=Wre;Vt.Children=tie;Vt.Component=jg;Vt.Fragment=Gre;Vt.Profiler=jre;Vt.PureComponent=RR;Vt.StrictMode=Pre;Vt.Suspense=Kre;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=E3({},e.props),i=e.key;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)!b3.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 _R(e.type,i,r)};Vt.createContext=function(e){return e={$$typeof:qre,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:zre,_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)b3.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 _R(e,s,i)};Vt.createRef=function(){return{current:null}};Vt.forwardRef=function(e){return{$$typeof:Yre,render:e}};Vt.isValidElement=FR;Vt.lazy=function(e){return{$$typeof:g3,_payload:{_status:-1,_result:e},_init:eie}};Vt.memo=function(e,t){return{$$typeof:Vre,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(wR,p3)}catch(s){p3(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 D3=me((jt,av)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){function e(k,z){Object.defineProperty(r.prototype,k,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",z[0],z[1])}})}function t(k){return k===null||typeof k!="object"?null:(k=Ve&&k[Ve]||k["@@iterator"],typeof k=="function"?k:null)}function n(k,z){k=(k=k.constructor)&&(k.displayName||k.name)||"ReactClass";var Le=k+"."+z;Qe[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.",z,k),Qe[Le]=!0)}function r(k,z,Le){this.props=k,this.context=z,this.refs=yt,this.updater=Le||bt}function i(){}function s(k,z,Le){this.props=k,this.context=z,this.refs=yt,this.updater=Le||bt}function a(){}function c(k){return""+k}function f(k){try{c(k);var z=!1}catch{z=!0}if(z){z=console;var Le=z.error,We=typeof Symbol=="function"&&Symbol.toStringTag&&k[Symbol.toStringTag]||k.constructor.name||"Object";return Le.call(z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",We),c(k)}}function A(k){if(k==null)return null;if(typeof k=="function")return k.$$typeof===Gn?null:k.displayName||k.name||null;if(typeof k=="string")return k;switch(k){case Ze:return"Fragment";case J:return"Profiler";case xe:return"StrictMode";case St:return"Suspense";case j:return"SuspenseList";case Ae:return"Activity"}if(typeof k=="object")switch(typeof k.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),k.$$typeof){case ke:return"Portal";case Oe:return k.displayName||"Context";case Re:return(k._context.displayName||"Context")+".Consumer";case nt:var z=k.render;return k=k.displayName,k||(k=z.displayName||z.name||"",k=k!==""?"ForwardRef("+k+")":"ForwardRef"),k;case q:return z=k.displayName||null,z!==null?z:A(k.type)||"Memo";case Y:z=k._payload,k=k._init;try{return A(k(z))}catch{}}return null}function m(k){if(k===Ze)return"<>";if(typeof k=="object"&&k!==null&&k.$$typeof===Y)return"<...>";try{var z=A(k);return z?"<"+z+">":"<...>"}catch{return"<...>"}}function E(){var k=pt.A;return k===null?null:k.getOwner()}function C(){return Error("react-stack-top-frame")}function p(k){if(Si.call(k,"key")){var z=Object.getOwnPropertyDescriptor(k,"key").get;if(z&&z.isReactWarning)return!1}return k.key!==void 0}function g(k,z){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)",z))}Le.isReactWarning=!0,Object.defineProperty(k,"key",{get:Le,configurable:!0})}function b(){var k=A(this.type);return to[k]||(to[k]=!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.")),k=this.props.ref,k!==void 0?k:null}function v(k,z,Le,We,ee,le){var be=Le.ref;return k={$$typeof:pe,type:k,key:z,props:Le,_owner:We},(be!==void 0?be:null)!==null?Object.defineProperty(k,"ref",{enumerable:!1,get:b}):Object.defineProperty(k,"ref",{enumerable:!1,value:null}),k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(k,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(k,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.defineProperty(k,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k}function w(k,z){return z=v(k.type,z,k.props,k._owner,k._debugStack,k._debugTask),k._store&&(z._store.validated=k._store.validated),z}function T(k){_(k)?k._store&&(k._store.validated=1):typeof k=="object"&&k!==null&&k.$$typeof===Y&&(k._payload.status==="fulfilled"?_(k._payload.value)&&k._payload.value._store&&(k._payload.value._store.validated=1):k._store&&(k._store.validated=1))}function _(k){return typeof k=="object"&&k!==null&&k.$$typeof===pe}function M(k){var z={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(Le){return z[Le]})}function U(k,z){return typeof k=="object"&&k!==null&&k.key!=null?(f(k.key),M(""+k.key)):z.toString(36)}function P(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(a,a):(k.status="pending",k.then(function(z){k.status==="pending"&&(k.status="fulfilled",k.value=z)},function(z){k.status==="pending"&&(k.status="rejected",k.reason=z)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function V(k,z,Le,We,ee){var le=typeof k;(le==="undefined"||le==="boolean")&&(k=null);var be=!1;if(k===null)be=!0;else switch(le){case"bigint":case"string":case"number":be=!0;break;case"object":switch(k.$$typeof){case pe:case ke:be=!0;break;case Y:return be=k._init,V(be(k._payload),z,Le,We,ee)}}if(be){be=k,ee=ee(be);var $e=We===""?"."+U(be,0):We;return Fr(ee)?(Le="",$e!=null&&(Le=$e.replace(Oi,"$&/")+"/"),V(ee,z,Le,"",function(mr){return mr})):ee!=null&&(_(ee)&&(ee.key!=null&&(be&&be.key===ee.key||f(ee.key)),Le=w(ee,Le+(ee.key==null||be&&be.key===ee.key?"":(""+ee.key).replace(Oi,"$&/")+"/")+$e),We!==""&&be!=null&&_(be)&&be.key==null&&be._store&&!be._store.validated&&(Le._store.validated=2),ee=Le),z.push(ee)),1}if(be=0,$e=We===""?".":We+":",Fr(k))for(var Et=0;Et<k.length;Et++)We=k[Et],le=$e+U(We,Et),be+=V(We,z,Le,le,ee);else if(Et=t(k),typeof Et=="function")for(Et===k.entries&&(Nr||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Nr=!0),k=Et.call(k),Et=0;!(We=k.next()).done;)We=We.value,le=$e+U(We,Et++),be+=V(We,z,Le,le,ee);else if(le==="object"){if(typeof k.then=="function")return V(P(k),z,Le,We,ee);throw z=String(k),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return be}function te(k,z,Le){if(k==null)return k;var We=[],ee=0;return V(k,We,"","",function(le){return z.call(Le,le,ee++)}),We}function G(k){if(k._status===-1){var z=k._ioInfo;z!=null&&(z.start=z.end=performance.now()),z=k._result;var Le=z();if(Le.then(function(ee){if(k._status===0||k._status===-1){k._status=1,k._result=ee;var le=k._ioInfo;le!=null&&(le.end=performance.now()),Le.status===void 0&&(Le.status="fulfilled",Le.value=ee)}},function(ee){if(k._status===0||k._status===-1){k._status=2,k._result=ee;var le=k._ioInfo;le!=null&&(le.end=performance.now()),Le.status===void 0&&(Le.status="rejected",Le.reason=ee)}}),z=k._ioInfo,z!=null){z.value=Le;var We=Le.displayName;typeof We=="string"&&(z.name=We)}k._status===-1&&(k._status=0,k._result=Le)}if(k._status===1)return z=k._result,z===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'))
|
|
@@ -671,7 +671,7 @@ Update your environment and try again (no reload needed if using .env)!`:null}re
|
|
|
671
671
|
- `)}`);else for(let w of e)try{let T=Mee.resolve(Du(w));C===1&&await g.setValue(T,"TRUST_FOLDER"),p.addDirectory(T),v.push(w)}catch(T){let _=T;b.push(`Error adding '${w}': ${_.message}`)}await i(s,a,v,b),t()};return(0,Ic.jsxs)(ce,{flexDirection:"column",width:"100%",children:[(0,Ic.jsxs)(ce,{flexDirection:"column",borderStyle:"round",borderColor:oe.status.warning,padding:1,marginLeft:1,marginRight:1,children:[(0,Ic.jsxs)(ce,{flexDirection:"column",marginBottom:1,children:[(0,Ic.jsx)(H,{bold:!0,color:oe.text.primary,children:"Do you trust the following folders being added to this workspace?"}),(0,Ic.jsx)(H,{color:oe.text.secondary,children:e.map(C=>`- ${C}`).join(`
|
|
672
672
|
`)}),(0,Ic.jsx)(H,{color:oe.text.primary,children:"Trusting a folder allows Gemini to read and perform auto-edits when in auto-approval mode. This is a security feature to prevent accidental execution in untrusted directories."})]}),(0,Ic.jsx)(tI,{items:m,onSelect:E,isFocused:!c})]}),c&&(0,Ic.jsx)(ce,{marginLeft:1,marginTop:1,children:(0,Ic.jsx)(H,{color:oe.text.primary,children:"Applying trust settings..."})})]})};var EE=Se(ut(),1);var Pee=Se(Gee(),1);function XBe({type:e="dots"}){let[t,n]=(0,EE.useState)(0),r=Pee.default[e];return(0,EE.useEffect)(()=>{let i=setInterval(()=>{n(s=>s===r.frames.length-1?0:s+1)},r.interval);return()=>{clearInterval(i)}},[r]),EE.default.createElement(H,null,r.frames[t])}var jd=XBe;var jee=Se(ut(),1);var qee=Se(It(),1);var zee=e=>{let n=$f().merged.ui?.showSpinner!==!1;return(0,jee.useEffect)(()=>{if(n)return TS.debugNumAnimatedComponents++,()=>{TS.debugNumAnimatedComponents--}},[n]),n?(0,qee.jsx)(jd,{...e}):null};var Yee=Se(ut(),1);var nI=Se(It(),1);var $Be=150,ZBe=({label:e,matchedIndex:t,userInput:n="",textColor:r=oe.text.primary,isExpanded:i=!1,maxWidth:s=$Be,maxLines:a})=>{if(!(t!==void 0&&t>=0&&t<e.length&&n.length>0)){let C=e;if(!i)if(a!==void 0){let p=e.split(`
|
|
673
673
|
`),g=p.slice(0,a).join(`
|
|
674
|
-
`),b=p.length>a;g.length>s?g=g.slice(0,s)+"...":b&&(g+="..."),C=g}else e.length>s&&(C=e.slice(0,s)+"...");return(0,nI.jsx)(H,{wrap:"wrap",color:r,children:C})}let f=n.length,A="",m="",E="";if(i||e.length<=s)A=e.slice(0,t),m=e.slice(t,t+f),E=e.slice(t+f);else if(f>=s)m=e.slice(t,t+s-1)+"...";else{let C=s-f,p=Math.floor(C/2),g=Math.ceil(C/2),b=t-p,v=t+f+g;b<0&&(v+=-b,b=0),v>e.length&&(b-=v-e.length,v=e.length),b=Math.max(0,b);let w=t-b,T=e.slice(b,v);A=T.slice(0,w),m=T.slice(w,w+f),E=T.slice(w+f),b>0&&(A=A.length>=3?"..."+A.slice(3):"..."),v<e.length&&(E=E.length>=3?E.slice(0,-3)+"...":"...")}return(0,nI.jsxs)(H,{color:r,wrap:"wrap",children:[A,m?m.split(/(\s+)/).map((C,p)=>(0,nI.jsx)(H,{inverse:!0,color:r,children:C},`match-${p}`)):null,E]})},Kee=Yee.default.memo(ZBe);import Gm from"node:process";var Vee={name:"about",description:"Show version info",kind:"built-in",autoExecute:!0,isSafeConcurrent:!0,action:async e=>{let t=Gm.platform,n="no sandbox";Gm.env.SANDBOX&&Gm.env.SANDBOX!=="sandbox-exec"?n=Gm.env.SANDBOX:Gm.env.SANDBOX==="sandbox-exec"&&(n=`sandbox-exec (${Gm.env.SEATBELT_PROFILE||"unknown"})`);let r=e.services.agentContext?.config.getModel()||"Unknown",i=await ZD(),s=e.services.settings.merged.security.auth.selectedType||"",a=Gm.env.GOOGLE_CLOUD_PROJECT||"",c=await ewe(e),A=new kg().getCachedGoogleAccount();Ce.log("AboutCommand: Retrieved cached Google account",{cachedAccount:A});let m=A??void 0,E=e.services.agentContext?.config.getUserTierName(),C={type:"about",cliVersion:i,osVersion:t,sandboxEnv:n,modelVersion:r,selectedAuthType:s,gcpProject:a,ideClient:c,userEmail:m,tier:E};e.ui.addItem(C)}};async function ewe(e){return e.services.agentContext?.config.getIdeMode()?(await al.getInstance())?.getDetectedIdeDisplayName()??"":""}function GT(e,t,n){let r=["Workspace","User"],i=[],s=[];for(let c of r)if(Al(c)){let f=e.forScope(c).path;n.needsEnabling(e,c,t)?i.push({scope:c,path:f}):s.push({scope:c,path:f})}if(i.length===0)return{status:"no-op",featureName:t,action:"enable",modifiedScopes:[],alreadyInStateScopes:s};let a=[];for(let{scope:c,path:f}of i)Al(c)&&(n.enable(e,c,t),a.push({scope:c,path:f}));return{status:"success",featureName:t,action:"enable",modifiedScopes:a,alreadyInStateScopes:s}}function PT(e,t,n,r){if(!Al(n))return{status:"error",featureName:t,action:"disable",modifiedScopes:[],alreadyInStateScopes:[],error:`Invalid settings scope: ${n}`};let i=e.forScope(n).path;if(r.isExplicitlyDisabled(e,n,t))return{status:"no-op",featureName:t,action:"disable",modifiedScopes:[],alreadyInStateScopes:[{scope:n,path:i}]};let s=n==="Workspace"?"User":"Workspace",a=[];return Al(s)&&r.isExplicitlyDisabled(e,s,t)&&a.push({scope:s,path:e.forScope(s).path}),r.disable(e,n,t),{status:"success",featureName:t,action:"disable",modifiedScopes:[{scope:n,path:i}],alreadyInStateScopes:a}}var Wee={needsEnabling:(e,t,n)=>e.forScope(t).settings.agents?.overrides?.[n]?.enabled!==!0,enable:(e,t,n)=>{e.setValue(t,`agents.overrides.${n}.enabled`,!0)},isExplicitlyDisabled:(e,t,n)=>e.forScope(t).settings.agents?.overrides?.[n]?.enabled===!1,disable:(e,t,n)=>{e.setValue(t,`agents.overrides.${n}.enabled`,!1)}};function Jee(e,t){let{featureName:n,...r}=GT(e,t,Wee);return{...r,agentName:n}}function Xee(e,t,n){let{featureName:r,...i}=PT(e,t,n,Wee);return{...i,agentName:r}}function rI(e,t){let{agentName:n,action:r,status:i,error:s}=e;if(i==="error")return s||`An error occurred while attempting to ${r} agent "${n}".`;if(i==="no-op")return`Agent "${n}" is already ${r==="enable"?"enabled":"disabled"}.`;let a=r==="enable",c=a?"enabled":"disabled",f=a?"by setting it to enabled in":"by setting it to disabled in",A=C=>{let p=C.scope==="Workspace"?"project":C.scope.toLowerCase();return t(p,C.path)},m=[...e.modifiedScopes,...e.alreadyInStateScopes];if(m.length===2){let C=A(m[0]),p=A(m[1]);return a?`Agent "${n}" ${c} ${f} ${C} and ${p} settings.`:`Agent "${n}" is now disabled in both ${C} and ${p} settings.`}let E=A(m[0]);return`Agent "${n}" ${c} ${f} ${E} settings.`}var $ee={name:"list",description:"List available local and remote agents",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return{type:"message",messageType:"error",content:"Config not loaded."};let n=t.getAgentRegistry();if(!n)return{type:"message",messageType:"error",content:"Agent registry not found."};let r=n.getAllDefinitions().map(s=>({name:s.name,displayName:s.displayName,description:s.description,kind:s.kind})),i={type:"agents_list",agents:r};e.ui.addItem(i)}};async function twe(e,t){let n=e.services.agentContext?.config,{settings:r}=e.services;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let i=t.trim();if(!i)return{type:"message",messageType:"error",content:"Usage: /agents enable <agent-name>"};let s=n.getAgentRegistry();if(!s)return{type:"message",messageType:"error",content:"Agent registry not found."};let a=s.getAllAgentNames(),c=r.merged.agents.overrides,f=Object.keys(c).filter(m=>c[m]?.enabled===!1);if(a.includes(i)&&!f.includes(i))return{type:"message",messageType:"info",content:`Agent '${i}' is already enabled.`};if(!f.includes(i)&&!a.includes(i))return{type:"message",messageType:"error",content:`Agent '${i}' not found.`};let A=Jee(r,i);return A.status==="no-op"?{type:"message",messageType:"info",content:rI(A,(m,E)=>`${m} (${E})`)}:(e.ui.addItem({type:"info",text:`Enabling ${i}...`}),await s.reload(),{type:"message",messageType:"info",content:rI(A,(m,E)=>`${m} (${E})`)})}async function nwe(e,t){let n=e.services.agentContext?.config,{settings:r}=e.services;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let i=t.trim();if(!i)return{type:"message",messageType:"error",content:"Usage: /agents disable <agent-name>"};let s=n.getAgentRegistry();if(!s)return{type:"message",messageType:"error",content:"Agent registry not found."};let a=s.getAllAgentNames(),c=r.merged.agents.overrides;if(Object.keys(c).filter(E=>c[E]?.enabled===!1).includes(i))return{type:"message",messageType:"info",content:`Agent '${i}' is already disabled.`};if(!a.includes(i))return{type:"message",messageType:"error",content:`Agent '${i}' not found.`};let A=e.services.settings.workspace.path?"Workspace":"User",m=Xee(r,i,A);return m.status==="no-op"?{type:"message",messageType:"info",content:rI(m,(E,C)=>`${E} (${C})`)}:(e.ui.addItem({type:"info",text:`Disabling ${i}...`}),await s.reload(),{type:"message",messageType:"info",content:rI(m,(E,C)=>`${E} (${C})`)})}async function rwe(e,t){let n=e.services.agentContext?.config;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let r=t.trim();if(!r)return{type:"message",messageType:"error",content:"Usage: /agents config <agent-name>"};let i=n.getAgentRegistry();if(!i)return{type:"message",messageType:"error",content:"Agent registry not found."};let s=i.getDiscoveredDefinition(r);if(!s)return{type:"message",messageType:"error",content:`Agent '${r}' not found.`};let a=s.displayName||r;return{type:"dialog",dialog:"agentConfig",props:{name:r,displayName:a,definition:s}}}function iwe(e,t){let n=e.services.agentContext?.config,{settings:r}=e.services;if(!n)return[];let i=r.merged.agents.overrides;return Object.entries(i).filter(([a,c])=>c?.enabled===!1).map(([a])=>a).filter(a=>a.startsWith(t))}function owe(e,t){let n=e.services.agentContext?.config;if(!n)return[];let r=n.getAgentRegistry();return(r?r.getAllAgentNames():[]).filter(s=>s.startsWith(t))}function swe(e,t){let n=e.services.agentContext?.config;return n?(n.getAgentRegistry()?.getAllDiscoveredAgentNames()??[]).filter(s=>s.startsWith(t)):[]}var awe={name:"enable",description:"Enable a disabled agent",kind:"built-in",autoExecute:!1,action:twe,completion:iwe},lwe={name:"disable",description:"Disable an enabled agent",kind:"built-in",autoExecute:!1,action:nwe,completion:owe},cwe={name:"config",description:"Configure an agent",kind:"built-in",autoExecute:!1,action:rwe,completion:swe},uwe={name:"reload",altNames:["refresh"],description:"Reload the agent registry",kind:"built-in",action:async e=>{let n=e.services.agentContext?.config?.getAgentRegistry();return n?(e.ui.addItem({type:"info",text:"Reloading agent registry..."}),await n.reload(),{type:"message",messageType:"info",content:"Agents reloaded successfully"}):{type:"message",messageType:"error",content:"Agent registry not found."}}},Zee={name:"agents",description:"Manage agents",kind:"built-in",subCommands:[$ee,uwe,awe,lwe,cwe],action:async(e,t)=>$ee.action(e,t)};var ete={name:"signin",altNames:["login"],description:"Sign in or change the authentication method",kind:"built-in",autoExecute:!0,action:(e,t)=>({type:"dialog",dialog:"auth"})},dwe={name:"signout",altNames:["logout"],description:"Sign out and clear all cached credentials",kind:"built-in",action:async(e,t)=>(await jU(),e.services.settings.setValue("User","security.auth.selectedType",void 0),e.services.agentContext?.geminiClient.stripThoughtsFromHistory(),{type:"logout"})},tte={name:"auth",description:"Manage authentication",kind:"built-in",subCommands:[ete,dwe],action:(e,t)=>ete.action(e,t)};import Bh from"node:process";var nte="
|
|
674
|
+
`),b=p.length>a;g.length>s?g=g.slice(0,s)+"...":b&&(g+="..."),C=g}else e.length>s&&(C=e.slice(0,s)+"...");return(0,nI.jsx)(H,{wrap:"wrap",color:r,children:C})}let f=n.length,A="",m="",E="";if(i||e.length<=s)A=e.slice(0,t),m=e.slice(t,t+f),E=e.slice(t+f);else if(f>=s)m=e.slice(t,t+s-1)+"...";else{let C=s-f,p=Math.floor(C/2),g=Math.ceil(C/2),b=t-p,v=t+f+g;b<0&&(v+=-b,b=0),v>e.length&&(b-=v-e.length,v=e.length),b=Math.max(0,b);let w=t-b,T=e.slice(b,v);A=T.slice(0,w),m=T.slice(w,w+f),E=T.slice(w+f),b>0&&(A=A.length>=3?"..."+A.slice(3):"..."),v<e.length&&(E=E.length>=3?E.slice(0,-3)+"...":"...")}return(0,nI.jsxs)(H,{color:r,wrap:"wrap",children:[A,m?m.split(/(\s+)/).map((C,p)=>(0,nI.jsx)(H,{inverse:!0,color:r,children:C},`match-${p}`)):null,E]})},Kee=Yee.default.memo(ZBe);import Gm from"node:process";var Vee={name:"about",description:"Show version info",kind:"built-in",autoExecute:!0,isSafeConcurrent:!0,action:async e=>{let t=Gm.platform,n="no sandbox";Gm.env.SANDBOX&&Gm.env.SANDBOX!=="sandbox-exec"?n=Gm.env.SANDBOX:Gm.env.SANDBOX==="sandbox-exec"&&(n=`sandbox-exec (${Gm.env.SEATBELT_PROFILE||"unknown"})`);let r=e.services.agentContext?.config.getModel()||"Unknown",i=await ZD(),s=e.services.settings.merged.security.auth.selectedType||"",a=Gm.env.GOOGLE_CLOUD_PROJECT||"",c=await ewe(e),A=new kg().getCachedGoogleAccount();Ce.log("AboutCommand: Retrieved cached Google account",{cachedAccount:A});let m=A??void 0,E=e.services.agentContext?.config.getUserTierName(),C={type:"about",cliVersion:i,osVersion:t,sandboxEnv:n,modelVersion:r,selectedAuthType:s,gcpProject:a,ideClient:c,userEmail:m,tier:E};e.ui.addItem(C)}};async function ewe(e){return e.services.agentContext?.config.getIdeMode()?(await al.getInstance())?.getDetectedIdeDisplayName()??"":""}function GT(e,t,n){let r=["Workspace","User"],i=[],s=[];for(let c of r)if(Al(c)){let f=e.forScope(c).path;n.needsEnabling(e,c,t)?i.push({scope:c,path:f}):s.push({scope:c,path:f})}if(i.length===0)return{status:"no-op",featureName:t,action:"enable",modifiedScopes:[],alreadyInStateScopes:s};let a=[];for(let{scope:c,path:f}of i)Al(c)&&(n.enable(e,c,t),a.push({scope:c,path:f}));return{status:"success",featureName:t,action:"enable",modifiedScopes:a,alreadyInStateScopes:s}}function PT(e,t,n,r){if(!Al(n))return{status:"error",featureName:t,action:"disable",modifiedScopes:[],alreadyInStateScopes:[],error:`Invalid settings scope: ${n}`};let i=e.forScope(n).path;if(r.isExplicitlyDisabled(e,n,t))return{status:"no-op",featureName:t,action:"disable",modifiedScopes:[],alreadyInStateScopes:[{scope:n,path:i}]};let s=n==="Workspace"?"User":"Workspace",a=[];return Al(s)&&r.isExplicitlyDisabled(e,s,t)&&a.push({scope:s,path:e.forScope(s).path}),r.disable(e,n,t),{status:"success",featureName:t,action:"disable",modifiedScopes:[{scope:n,path:i}],alreadyInStateScopes:a}}var Wee={needsEnabling:(e,t,n)=>e.forScope(t).settings.agents?.overrides?.[n]?.enabled!==!0,enable:(e,t,n)=>{e.setValue(t,`agents.overrides.${n}.enabled`,!0)},isExplicitlyDisabled:(e,t,n)=>e.forScope(t).settings.agents?.overrides?.[n]?.enabled===!1,disable:(e,t,n)=>{e.setValue(t,`agents.overrides.${n}.enabled`,!1)}};function Jee(e,t){let{featureName:n,...r}=GT(e,t,Wee);return{...r,agentName:n}}function Xee(e,t,n){let{featureName:r,...i}=PT(e,t,n,Wee);return{...i,agentName:r}}function rI(e,t){let{agentName:n,action:r,status:i,error:s}=e;if(i==="error")return s||`An error occurred while attempting to ${r} agent "${n}".`;if(i==="no-op")return`Agent "${n}" is already ${r==="enable"?"enabled":"disabled"}.`;let a=r==="enable",c=a?"enabled":"disabled",f=a?"by setting it to enabled in":"by setting it to disabled in",A=C=>{let p=C.scope==="Workspace"?"project":C.scope.toLowerCase();return t(p,C.path)},m=[...e.modifiedScopes,...e.alreadyInStateScopes];if(m.length===2){let C=A(m[0]),p=A(m[1]);return a?`Agent "${n}" ${c} ${f} ${C} and ${p} settings.`:`Agent "${n}" is now disabled in both ${C} and ${p} settings.`}let E=A(m[0]);return`Agent "${n}" ${c} ${f} ${E} settings.`}var $ee={name:"list",description:"List available local and remote agents",kind:"built-in",autoExecute:!0,action:async e=>{let t=e.services.agentContext?.config;if(!t)return{type:"message",messageType:"error",content:"Config not loaded."};let n=t.getAgentRegistry();if(!n)return{type:"message",messageType:"error",content:"Agent registry not found."};let r=n.getAllDefinitions().map(s=>({name:s.name,displayName:s.displayName,description:s.description,kind:s.kind})),i={type:"agents_list",agents:r};e.ui.addItem(i)}};async function twe(e,t){let n=e.services.agentContext?.config,{settings:r}=e.services;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let i=t.trim();if(!i)return{type:"message",messageType:"error",content:"Usage: /agents enable <agent-name>"};let s=n.getAgentRegistry();if(!s)return{type:"message",messageType:"error",content:"Agent registry not found."};let a=s.getAllAgentNames(),c=r.merged.agents.overrides,f=Object.keys(c).filter(m=>c[m]?.enabled===!1);if(a.includes(i)&&!f.includes(i))return{type:"message",messageType:"info",content:`Agent '${i}' is already enabled.`};if(!f.includes(i)&&!a.includes(i))return{type:"message",messageType:"error",content:`Agent '${i}' not found.`};let A=Jee(r,i);return A.status==="no-op"?{type:"message",messageType:"info",content:rI(A,(m,E)=>`${m} (${E})`)}:(e.ui.addItem({type:"info",text:`Enabling ${i}...`}),await s.reload(),{type:"message",messageType:"info",content:rI(A,(m,E)=>`${m} (${E})`)})}async function nwe(e,t){let n=e.services.agentContext?.config,{settings:r}=e.services;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let i=t.trim();if(!i)return{type:"message",messageType:"error",content:"Usage: /agents disable <agent-name>"};let s=n.getAgentRegistry();if(!s)return{type:"message",messageType:"error",content:"Agent registry not found."};let a=s.getAllAgentNames(),c=r.merged.agents.overrides;if(Object.keys(c).filter(E=>c[E]?.enabled===!1).includes(i))return{type:"message",messageType:"info",content:`Agent '${i}' is already disabled.`};if(!a.includes(i))return{type:"message",messageType:"error",content:`Agent '${i}' not found.`};let A=e.services.settings.workspace.path?"Workspace":"User",m=Xee(r,i,A);return m.status==="no-op"?{type:"message",messageType:"info",content:rI(m,(E,C)=>`${E} (${C})`)}:(e.ui.addItem({type:"info",text:`Disabling ${i}...`}),await s.reload(),{type:"message",messageType:"info",content:rI(m,(E,C)=>`${E} (${C})`)})}async function rwe(e,t){let n=e.services.agentContext?.config;if(!n)return{type:"message",messageType:"error",content:"Config not loaded."};let r=t.trim();if(!r)return{type:"message",messageType:"error",content:"Usage: /agents config <agent-name>"};let i=n.getAgentRegistry();if(!i)return{type:"message",messageType:"error",content:"Agent registry not found."};let s=i.getDiscoveredDefinition(r);if(!s)return{type:"message",messageType:"error",content:`Agent '${r}' not found.`};let a=s.displayName||r;return{type:"dialog",dialog:"agentConfig",props:{name:r,displayName:a,definition:s}}}function iwe(e,t){let n=e.services.agentContext?.config,{settings:r}=e.services;if(!n)return[];let i=r.merged.agents.overrides;return Object.entries(i).filter(([a,c])=>c?.enabled===!1).map(([a])=>a).filter(a=>a.startsWith(t))}function owe(e,t){let n=e.services.agentContext?.config;if(!n)return[];let r=n.getAgentRegistry();return(r?r.getAllAgentNames():[]).filter(s=>s.startsWith(t))}function swe(e,t){let n=e.services.agentContext?.config;return n?(n.getAgentRegistry()?.getAllDiscoveredAgentNames()??[]).filter(s=>s.startsWith(t)):[]}var awe={name:"enable",description:"Enable a disabled agent",kind:"built-in",autoExecute:!1,action:twe,completion:iwe},lwe={name:"disable",description:"Disable an enabled agent",kind:"built-in",autoExecute:!1,action:nwe,completion:owe},cwe={name:"config",description:"Configure an agent",kind:"built-in",autoExecute:!1,action:rwe,completion:swe},uwe={name:"reload",altNames:["refresh"],description:"Reload the agent registry",kind:"built-in",action:async e=>{let n=e.services.agentContext?.config?.getAgentRegistry();return n?(e.ui.addItem({type:"info",text:"Reloading agent registry..."}),await n.reload(),{type:"message",messageType:"info",content:"Agents reloaded successfully"}):{type:"message",messageType:"error",content:"Agent registry not found."}}},Zee={name:"agents",description:"Manage agents",kind:"built-in",subCommands:[$ee,uwe,awe,lwe,cwe],action:async(e,t)=>$ee.action(e,t)};var ete={name:"signin",altNames:["login"],description:"Sign in or change the authentication method",kind:"built-in",autoExecute:!0,action:(e,t)=>({type:"dialog",dialog:"auth"})},dwe={name:"signout",altNames:["logout"],description:"Sign out and clear all cached credentials",kind:"built-in",action:async(e,t)=>(await jU(),e.services.settings.setValue("User","security.auth.selectedType",void 0),e.services.agentContext?.geminiClient.stripThoughtsFromHistory(),{type:"logout"})},tte={name:"auth",description:"Manage authentication",kind:"built-in",subCommands:[ete,dwe],action:(e,t)=>ete.action(e,t)};import Bh from"node:process";var nte="2e3887d";import*as jT from"node:fs/promises";import rte from"node:path";function fwe(e){return e.map(t=>{let n=t.parts?.map(i=>i.text?i.text:i.functionCall?"**Tool Command**:\n```json\n"+JSON.stringify(i.functionCall,null,2)+"\n```":i.functionResponse?"**Tool Response**:\n```json\n"+JSON.stringify(i.functionResponse,null,2)+"\n```":"").join("")||"",r=t.role==="user"?"\u{1F9D1}\u200D\u{1F4BB}":"\u2728";return`## ${(t.role||"model").toUpperCase()} ${r}
|
|
675
675
|
|
|
676
676
|
${n}`}).join(`
|
|
677
677
|
|
|
@@ -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(E=>` - ${E}`).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-
|
|
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-U4UJ5U3G.js"),A=a.oauth;A||(A={enabled:!1});let m=a.httpUrl||a.url;await new f(new IR).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))}},lI=async(e,t=!1,n=!1,r)=>{let i=e.services.agentContext,s=i?.config;if(!s)return{type:"message",messageType:"error",content:"Config not loaded."};s.setUserInteractedWithMcp();let a=i.toolRegistry;if(!a)return{type:"message",messageType:"error",content:"Could not retrieve tool registry."};let c=s.getMcpClientManager()?.getMcpServers()||{},f=s.getMcpClientManager()?.getBlockedMcpServers()||[];if(r){let G=r.trim().toLowerCase();G&&(c=Object.fromEntries(Object.entries(c).filter(([W])=>W.toLowerCase().includes(G)||js(W).includes(G))))}let A=Object.keys(c),m=A.filter(G=>zH(G)==="connecting"),C=qH()==="in_progress"||m.length>0,g=a.getAllTools().filter(G=>G instanceof CU),v=s.getPromptRegistry().getAllPrompts().filter(G=>"serverName"in G&&A.includes(G.serverName)),T=s.getResourceRegistry().getAllResources().filter(G=>A.includes(G.serverName)),_={},M=new IR;for(let G of A)if(c[G].oauth?.enabled||DR.has(G)){let ye=await M.getCredentials(G);ye?ye.token.expiresAt&&ye.token.expiresAt<Date.now()?_[G]="expired":_[G]="authenticated":_[G]="unauthenticated"}else _[G]="not-configured";let U=vh.getInstance(),P={};for(let G of A)P[G]=await U.getDisplayState(G);let V={};for(let G of A){let W=s.getMcpClientManager()?.getLastError(G);W&&(V[G]=W)}let te={type:"mcp_status",servers:c,tools:g.map(G=>({serverName:G.serverName,name:G.name,description:G.description,schema:G.schema})),prompts:v.map(G=>({serverName:G.serverName,name:G.name,description:G.description})),resources:T.map(G=>({serverName:G.serverName,name:G.name,uri:G.uri,mimeType:G.mimeType,description:G.description})),authStatus:_,enablementState:P,errors:V,blockedServers:f.map(G=>({name:G.name,extensionName:G.extensionName})),discoveryInProgress:C,connectingServers:m,showDescriptions:!!t,showSchema:!!n};e.ui.addItem(te)},hne={name:"list",altNames:["ls","nodesc","nodescription"],description:"List configured MCP servers and tools",kind:"built-in",autoExecute:!0,action:(e,t)=>lI(e,!1,!1,t)},ATe={name:"desc",altNames:["description"],description:"List configured MCP servers and tools with descriptions",kind:"built-in",autoExecute:!0,action:(e,t)=>lI(e,!0,!1,t)},mTe={name:"schema",description:"List configured MCP servers and tools with descriptions and schemas",kind:"built-in",autoExecute:!0,action:(e,t)=>lI(e,!0,!0,t)},pTe={name:"reload",altNames:["refresh"],description:"Reloads MCP servers",kind:"built-in",autoExecute:!0,takesArgs:!1,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=js(c),m=i.getMcpClientManager()?.getMcpServers()||{};if(!Object.keys(m).map(js).includes(A))return{type:"message",messageType:"error",content:`Server '${c}' not found. Use /mcp list to see available servers.`};let C=vh.getInstance();if(n){let b=Iy(),v=await Bee(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=vh.getInstance(),c=[];for(let f of s)(await a.getDisplayState(f)).enabled===n&&f.startsWith(t)&&c.push(f);return c}var gTe={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)},yTe={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)},MO={name:"mcp",description:"Manage configured Model Context Protocol (MCP) servers",kind:"built-in",autoExecute:!1,subCommands:[hne,ATe,mTe,hTe,pTe,gTe,yTe],action:async(e,t)=>{if(t){let n=Ih(`/${t}`,MO.subCommands);return n.commandToExecute?.action?n.commandToExecute.action(e,n.args):lI(e,!1,!1,t)}return lI(e)}};var pne={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=e3(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=t3(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 n3(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=r3(t);e.ui.addItem({type:"info",text:n.content},Date.now())}}]};var ETe={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 kU(r);tH(e.services.agentContext.config,s),e.ui.addItem({type:"info",text:`Model set to ${r}${i?" (persisted)":""}`})}}},gne={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"})},yne={name:"model",description:"Manage model configuration",kind:"built-in",autoExecute:!1,subCommands:[gne,ETe],action:async(e,t)=>gne.action(e,t)};var eo=Se(ut(),1);var ot=Se(It(),1);var OO=6,LO=20,e1=25,Km=5,Ene=10,cI=e=>!e||!e.reactionGroups?0:e.reactionGroups.reduce((t,n)=>t+n.users.totalCount,0),STe=(e,t)=>t?.toLowerCase()==="duplicate"?"magenta":e==="OPEN"?"green":"red",Cne=({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,E]=(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)([]),[M,U]=(0,eo.useState)(!1),[P,V]=(0,eo.useState)(0);(0,eo.useEffect)(()=>{f<P?V(f):f>=P+Km&&V(f-Km+1)},[f,P]);let te=async xe=>{try{let{stdout:J}=await Jo("gh",["issue","view",String(xe),"--json","number,title,body,state,stateReason,labels,url,comments,author,reactionGroups"]);return JSON.parse(J)}catch(J){return Ce.error(`Failed to fetch details for candidate #${xe}`,J),null}},G=(0,eo.useCallback)(async xe=>{let J=xe.comments.find(Qe=>Qe.body.includes("Found possible duplicate issues:"));if(!J)return null;let Re=J.body.split(`
|
|
733
733
|
`),Oe=[];for(let Qe of Re){let bt=Qe.match(/#(\d+)/);if(bt){let Mt=parseInt(bt[1],10);Mt!==xe.number&&Oe.push(Mt)}}if(Oe.length===0)return null;let nt=[];for(let Qe of Oe){let bt=await te(Qe);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
|
|
|
@@ -845,7 +845,7 @@ Please restart your terminal for the changes to take effect.`),{type:"message",c
|
|
|
845
845
|
`,m.description&&(A+=` ${m.description}
|
|
846
846
|
`),A+=` (required: ${m.required?"yes":"no"})
|
|
847
847
|
|
|
848
|
-
`;return{type:"message",messageType:"info",content:A}}}],action:async(A,m)=>{if(!this.config)return{type:"message",messageType:"error",content:"Config not loaded."};let E=this.parseArgs(m,a.arguments);if(E instanceof Error)return{type:"message",messageType:"error",content:E.message};try{if(!(this.config.getMcpClientManager()?.getMcpServers()||{})[i])return{type:"message",messageType:"error",content:`MCP server config not found for '${i}'.`};let g=await a.invoke(E);if(g.error)return{type:"message",messageType:"error",content:`Error invoking prompt: ${g.error}`};let b=g.messages?.[0]?.content;return b.type!=="text"?{type:"message",messageType:"error",content:"Received an empty or invalid prompt response from the server."}:{type:"submit_prompt",content:JSON.stringify(b.text)}}catch(C){return{type:"message",messageType:"error",content:`Error: ${_t(C)}`}}},completion:async(A,m)=>{let E=A.invocation;if(!a||!a.arguments||!E)return[];let C=E.raw.indexOf(" ")+1,p=C===0?{}:this.parseArgs(E.raw.substring(C),a.arguments);p instanceof Error&&(p={});let g=Object.keys(p),b=a.arguments.filter(T=>g.includes(T.name)?p[T.name]===m:!0).map(T=>`--${T.name}="`)||[],v=a.arguments.map(T=>`--${T.name}="`).filter(T=>new RegExp(`${T}[^"]*$`).test(E.raw));return v.length===1?v[0]===m?[`${m}"`]:m.endsWith('"')?[m]:[`${m}"`]:b.filter(T=>T.startsWith(m))}};n.push(f)}}return Promise.resolve(n)}parseArgs(t,n){let r={},i={},s=/--([^=]+)=(?:"((?:\\.|[^"\\])*)"|([^ ]+))/g,a,c=0,f=[];for(;(a=s.exec(t))!==null;){let p=a[1],g=(a[2]??a[3]).replace(/\\(.)/g,"$1");r[p]=g,a.index>c&&f.push(t.substring(c,a.index)),c=s.lastIndex}c<t.length&&f.push(t.substring(c));let A=f.join("").trim(),m=/(?:"((?:\\.|[^"\\])*)"|([^ ]+))/g,E=[];for(;(a=m.exec(A))!==null;)E.push((a[1]??a[2]).replace(/\\(.)/g,"$1"));if(!n)return i;for(let p of n)r[p.name]&&(i[p.name]=r[p.name]);let C=n.filter(p=>p.required&&!i[p.name]);if(C.length===1)i[C[0].name]=E.join(" ");else{let p=[];for(let g=0;g<C.length;g++)E.length>g?i[C[g].name]=E[g]:p.push(C[g].name);if(p.length>0){let g=p.map(b=>`--${b}`).join(", ");return new Error(`Missing required argument(s): ${g}`)}}return i}};export{ms as a,Wke as b,Jke as c,Xke as d,$ke as e,Zke as f,eMe as g,tMe as h,nMe as i,rMe as j,iMe as k,Ay as l,oMe as m,sMe as n,aMe as o,lMe as p,cMe as q,uMe as r,dMe as s,n5 as t,S_ as u,f5 as v,h5 as w,rm as x,ln as y,fS as z,gMe as A,my as B,om as C,D_ as D,Vf as E,v_ as F,NMe as G,un as H,ct as I,I5 as J,or as K,AS as L,D5 as M,kMe as N,xx as O,vx as P,ut as Q,ZTe as R,e1e as S,Ble as T,gy as U,v5 as V,Rle as W,Qle as X,x5 as Y,Bx as Z,zMe as _,qMe as $,WMe as aa,Ey as ba,c2 as ca,ds as da,Al as ea,BOe as fa,Iy as ga,wOe as ha,o1e as ia,s1e as ja,iie as ka,a1e as la,UR as ma,l1e as na,c1e as oa,u1e as pa,Zx as qa,YB as ra,Gde as sa,vj as ta,xj as ua,eB as va,Pde as wa,ZN as xa,XOe as ya,$Oe as za,o6 as Aa,Zf as Ba,Us as Ca,tPe as Da,kY as Ea,MY as Fa,OY as Ga,UY as Ha,pc as Ia,GY as Ja,js as Ka,Bee as La,vh as Ma,tO as Na,fWe as Oa,hee as Pa,mV as Qa,Hne as Ra,Gne as Sa,YO as Ta,krt as Ua,jne as Va,Mrt as Wa,x3 as Xa,kZ as Ya,i5e as Za,Ck as _a,o5e as $a,s5e as ab,DVe as bb,vVe as cb,xVe as db,Ih as eb,wee as fb,By as gb,nte as hb,OT as ib,Zb as jb,dO as kb,vy as lb,y2 as mb,ou as nb,uv as ob,zt as pb,
|
|
848
|
+
`;return{type:"message",messageType:"info",content:A}}}],action:async(A,m)=>{if(!this.config)return{type:"message",messageType:"error",content:"Config not loaded."};let E=this.parseArgs(m,a.arguments);if(E instanceof Error)return{type:"message",messageType:"error",content:E.message};try{if(!(this.config.getMcpClientManager()?.getMcpServers()||{})[i])return{type:"message",messageType:"error",content:`MCP server config not found for '${i}'.`};let g=await a.invoke(E);if(g.error)return{type:"message",messageType:"error",content:`Error invoking prompt: ${g.error}`};let b=g.messages?.[0]?.content;return b.type!=="text"?{type:"message",messageType:"error",content:"Received an empty or invalid prompt response from the server."}:{type:"submit_prompt",content:JSON.stringify(b.text)}}catch(C){return{type:"message",messageType:"error",content:`Error: ${_t(C)}`}}},completion:async(A,m)=>{let E=A.invocation;if(!a||!a.arguments||!E)return[];let C=E.raw.indexOf(" ")+1,p=C===0?{}:this.parseArgs(E.raw.substring(C),a.arguments);p instanceof Error&&(p={});let g=Object.keys(p),b=a.arguments.filter(T=>g.includes(T.name)?p[T.name]===m:!0).map(T=>`--${T.name}="`)||[],v=a.arguments.map(T=>`--${T.name}="`).filter(T=>new RegExp(`${T}[^"]*$`).test(E.raw));return v.length===1?v[0]===m?[`${m}"`]:m.endsWith('"')?[m]:[`${m}"`]:b.filter(T=>T.startsWith(m))}};n.push(f)}}return Promise.resolve(n)}parseArgs(t,n){let r={},i={},s=/--([^=]+)=(?:"((?:\\.|[^"\\])*)"|([^ ]+))/g,a,c=0,f=[];for(;(a=s.exec(t))!==null;){let p=a[1],g=(a[2]??a[3]).replace(/\\(.)/g,"$1");r[p]=g,a.index>c&&f.push(t.substring(c,a.index)),c=s.lastIndex}c<t.length&&f.push(t.substring(c));let A=f.join("").trim(),m=/(?:"((?:\\.|[^"\\])*)"|([^ ]+))/g,E=[];for(;(a=m.exec(A))!==null;)E.push((a[1]??a[2]).replace(/\\(.)/g,"$1"));if(!n)return i;for(let p of n)r[p.name]&&(i[p.name]=r[p.name]);let C=n.filter(p=>p.required&&!i[p.name]);if(C.length===1)i[C[0].name]=E.join(" ");else{let p=[];for(let g=0;g<C.length;g++)E.length>g?i[C[g].name]=E[g]:p.push(C[g].name);if(p.length>0){let g=p.map(b=>`--${b}`).join(", ");return new Error(`Missing required argument(s): ${g}`)}}return i}};export{ms as a,Wke as b,Jke as c,Xke as d,$ke as e,Zke as f,eMe as g,tMe as h,nMe as i,rMe as j,iMe as k,Ay as l,oMe as m,sMe as n,aMe as o,lMe as p,cMe as q,uMe as r,dMe as s,n5 as t,S_ as u,f5 as v,h5 as w,rm as x,ln as y,fS as z,gMe as A,my as B,om as C,D_ as D,Vf as E,v_ as F,NMe as G,un as H,ct as I,I5 as J,or as K,AS as L,D5 as M,kMe as N,xx as O,vx as P,ut as Q,ZTe as R,e1e as S,Ble as T,gy as U,v5 as V,Rle as W,Qle as X,x5 as Y,Bx as Z,zMe as _,qMe as $,WMe as aa,Ey as ba,c2 as ca,ds as da,Al as ea,BOe as fa,Iy as ga,wOe as ha,o1e as ia,s1e as ja,iie as ka,a1e as la,UR as ma,l1e as na,c1e as oa,u1e as pa,Zx as qa,YB as ra,Gde as sa,vj as ta,xj as ua,eB as va,Pde as wa,ZN as xa,XOe as ya,$Oe as za,o6 as Aa,Zf as Ba,Us as Ca,tPe as Da,kY as Ea,MY as Fa,OY as Ga,UY as Ha,pc as Ia,GY as Ja,js as Ka,Bee as La,vh as Ma,tO as Na,fWe as Oa,hee as Pa,mV as Qa,Hne as Ra,Gne as Sa,YO as Ta,krt as Ua,jne as Va,Mrt as Wa,x3 as Xa,kZ as Ya,i5e as Za,Ck as _a,o5e as $a,s5e as ab,DVe as bb,vVe as cb,xVe as db,Ih as eb,wee as fb,By as gb,nte as hb,OT as ib,Zb as jb,dO as kb,vy as lb,y2 as mb,ou as nb,uv as ob,zt as pb,Qa as qb,uo as rb,VA as sb,Roe as tb,vv as ub,LG as vb,Joe as wb,Xoe as xb,ce as yb,H as zb,ox as Ab,uae as Bb,_P as Cb,FP as Db,kP as Eb,tm as Fb,Eae as Gb,c_ as Hb,lS as Ib,oe as Jb,iu as Kb,HOe as Lb,GOe as Mb,m2 as Nb,POe as Ob,VOe as Pb,W4 as Qb,$f as Rb,Dy as Sb,It as Tb,fLe as Ub,Sr as Vb,Ls as Wb,He as Xb,xy as Yb,yLe as Zb,SLe as _b,Ei as $b,Hm as ac,tI as bc,Du as cc,hO as dc,Oee as ec,NVe as fc,kVe as gc,MVe as hc,JZ as ic,oee as jc,ABe as kc,$M as lc,ZM as mc,EBe as nc,FT as oc,nee as pc,IBe as qc,gE as rc,SE as sc,bE as tc,EWe as uc,Aee as vc,mde as wc,Ty as xc,qUe as yc,JUe as zc,fde as Ac,gl as Bc,Ite as Cc,YZe as Dc,kte as Ec,tet as Fc,net as Gc,ret as Hc,iet as Ic,oet as Jc,set as Kc,xO as Lc,Ote as Mc,aet as Nc,Lte as Oc,TS as Pc,bd as Qc,hHe as Rc,O6 as Sc,Qet as Tc,jd as Uc,zee as Vc,$Be as Wc,Kee as Xc,DWe as Yc,rO as Zc,kWe as _c,ore as $c,are as ad,lre as bd,ure as cd,YWe as dd,JWe as ed,wHe as fd,THe as gd,GBe as hd,eJe as id,pde as jd,NHe as kd};
|
|
849
849
|
/**
|
|
850
850
|
* @license
|
|
851
851
|
* Copyright 2026 Google LLC
|