@sylphai/adal-cli-darwin-x64 0.2.0 → 0.2.2
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/adal-cli.js
CHANGED
|
@@ -1000,7 +1000,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
1000
1000
|
`)}rowToString(e,r){return this.rasterize(e).forEach((n,o)=>{let i="";n.forEach((s,a)=>{let{width:c}=e[a],l=this.negatePadding(e[a]),d=s;if(l>aC.stringWidth(s)&&(d+=" ".repeat(l-aC.stringWidth(s))),e[a].align&&e[a].align!=="left"&&this.wrap){let E=jpu[e[a].align];d=E(d,l),aC.stringWidth(d)<l&&(d+=" ".repeat((c||0)-aC.stringWidth(d)-1))}let p=e[a].padding||[0,0,0,0];p[z1e]&&(i+=" ".repeat(p[z1e])),i+=xJo(e[a],d,"| "),i+=d,i+=xJo(e[a],d," |"),p[K1e]&&(i+=" ".repeat(p[K1e])),o===0&&r.length>0&&(i=this.renderInline(i,r[r.length-1]))}),r.push({text:i.replace(/ +$/,""),span:e.span})}),r}renderInline(e,r){let n=e.match(/^ */),o=n?n[0].length:0,i=r.text,s=aC.stringWidth(i.trimRight());return r.span?this.wrap?o<s?e:(r.hidden=!0,i.trimRight()+" ".repeat(o-s)+e.trimLeft()):(r.hidden=!0,i+e):e}rasterize(e){let r=[],n=this.columnWidths(e),o;return e.forEach((i,s)=>{i.width=n[s],this.wrap?o=aC.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
|
|
1001
1001
|
`):o=i.text.split(`
|
|
1002
1002
|
`),i.border&&(o.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(o.unshift(...new Array(i.padding[Wpu]||0).fill("")),o.push(...new Array(i.padding[Kpu]||0).fill(""))),o.forEach((a,c)=>{r[c]||r.push([]);let l=r[c];for(let d=0;d<s;d++)l[d]===void 0&&l.push("");l.push(a)})}),r}negatePadding(e){let r=e.width||0;return e.padding&&(r-=(e.padding[z1e]||0)+(e.padding[K1e]||0)),e.border&&(r-=4),r}columnWidths(e){if(!this.wrap)return e.map(s=>s.width||aC.stringWidth(s.text));let r=e.length,n=this.width,o=e.map(s=>{if(s.width)return r--,n-=s.width,s.width}),i=r?Math.floor(n/r):0;return o.map((s,a)=>s===void 0?Math.max(i,zpu(e[a])):s)}};function xJo(t,e,r){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?r:" ":""}function zpu(t){let e=t.padding||[],r=1+(e[z1e]||0)+(e[K1e]||0);return t.border?r+4:r}function $pu(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Jpu(t,e){t=t.trim();let r=aC.stringWidth(t);return r<e?" ".repeat(e-r)+t:t}function Xpu(t,e){t=t.trim();let r=aC.stringWidth(t);return r>=e?t:" ".repeat(e-r>>1)+t}var aC;function UJo(t,e){return aC=e,new Kft({width:t?.width||$pu(),wrap:t?.wrap})}var BJo=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function zft(t){return t.replace(BJo,"")}function wJo(t,e){let[r,n]=t.match(BJo)||["",""];t=zft(t);let o="";for(let i=0;i<t.length;i++)i!==0&&i%e===0&&(o+=`
|
|
1003
|
-
`),o+=t.charAt(i);return r&&n&&(o=`${r}${o}${n}`),o}function $ft(t){return UJo(t,{stringWidth:e=>[...e].length,stripAnsi:zft,wrap:wJo})}import{dirname as VJo,resolve as GJo}from"path";import{readdirSync as Zpu,statSync as eEu}from"fs";function FJo(t,e){let r=GJo(".",t),n;for(eEu(r).isDirectory()||(r=VJo(r));;){if(n=e(r,Zpu(r)),n)return GJo(r,n);if(r=VJo(n=r),n===r)break}}import{inspect as lEu}from"util";import{readFileSync as uEu}from"fs";import{fileURLToPath as dEu}from"url";import{basename as AEu,dirname as pEu,extname as EEu,relative as _Eu,resolve as YJo}from"path";import{readFileSync as tEu,statSync as rEu,writeFile as nEu}from"fs";import{format as oEu}from"util";import{resolve as iEu}from"path";var QJo={fs:{readFileSync:tEu,writeFile:nEu},format:oEu,resolve:iEu,exists:t=>{try{return rEu(t).isFile()}catch{return!1}}};var mM,Jft=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),mM.format.apply(mM.format,[this.cache[this.locale][r]||r].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),r=e.shift(),n=e.shift(),o=e.shift(),i=function(){};typeof e[e.length-1]=="function"&&(i=e.pop()),this.cache[this.locale]||this._readLocaleFile();let s=o===1?r:n;this.cache[this.locale][r]&&(s=this.cache[this.locale][r][o===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();let a=[s];return~s.indexOf("%d")&&a.push(o),mM.format.apply(mM.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.cache[this.locale][r]=e[r])}_taggedLiteral(e,...r){let n="";return e.forEach(function(o,i){let s=r[i+1];n+=o,typeof s<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,r=this.writeQueue[0],n=r.directory,o=r.locale,i=r.cb,s=this._resolveLocaleFile(n,o),a=JSON.stringify(this.cache[o],null,2);mM.fs.writeFile(s,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),i(c)})}_readLocaleFile(){let e={},r=this._resolveLocaleFile(this.directory,this.locale);try{mM.fs.readFileSync&&(e=JSON.parse(mM.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,r){let n=mM.resolve(e,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){let o=mM.resolve(e,"./",r.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return mM.exists(e)}};function kJo(t,e){mM=e;let r=new Jft(t);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var sEu=t=>kJo(t,QJo),HJo=sEu;var fEu="require is not supported by ESM",qJo="loading a directory of commands is not supported yet for ESM",Doe;try{Doe=dEu(import.meta.url)}catch{Doe=process.cwd()}var TEu=Doe.substring(0,Doe.lastIndexOf("node_modules")),SEu={assert:{notStrictEqual:aEu,strictEqual:cEu},cliui:$ft,findUp:FJo,getEnv:t=>process.env[t],inspect:lEu,getCallerFile:()=>{throw new r4(qJo)},getProcessArgvBin:DJo,mainFilename:TEu||process.cwd(),Parser:Wft,path:{basename:AEu,dirname:pEu,extname:EEu,relative:_Eu,resolve:YJo},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:uEu,require:()=>{throw new r4(fEu)},requireDirectory:()=>{throw new r4(qJo)},stringWidth:t=>[...t].length,y18n:HJo({directory:YJo(Doe,"../../../locales"),updateFiles:!1})};_n();import gM from"node:process";Loe();async function sbe(){let t=await i4();return"0.2.0"}var wZo=be(vEt(),1);import*as xoe from"node:fs";import*as VL from"node:path";import*as ITt from"node:os";var boe=be(bZo(),1);Loe();import*as xZo from"node:os";var UZo=["docker","podman","sandbox-exec"];function cfu(t){return UZo.includes(t)}function lfu(t){if(process.env.SANDBOX)return"";let e=process.env.GEMINI_SANDBOX?.toLowerCase().trim()??"";if(t=e?.length>0?e:t,t==="1"||t==="true"?t=!0:(t==="0"||t==="false"||!t)&&(t=!1),t===!1)return"";if(typeof t=="string"&&t){if(cfu(t)||(console.error(`ERROR: invalid sandbox command '${t}'. Must be one of ${UZo.join(", ")}`),process.exit(1)),boe.default.sync(t))return t;console.error(`ERROR: missing sandbox command '${t}' (from GEMINI_SANDBOX)`),process.exit(1)}return xZo.platform()==="darwin"&&boe.default.sync("sandbox-exec")?"sandbox-exec":boe.default.sync("docker")&&t===!0?"docker":boe.default.sync("podman")&&t===!0?"podman":(t===!0&&(console.error("ERROR: GEMINI_SANDBOX is true but failed to determine command for sandbox; install docker or podman or specify command in GEMINI_SANDBOX"),process.exit(1)),"")}async function BZo(t,e){let r=e.sandbox??t.sandbox,n=lfu(r),o=await i4(),i=e["sandbox-image"]??process.env.GEMINI_SANDBOX_IMAGE??o?.config?.sandboxImageUri;return n&&i?{command:n,image:i}:void 0}var ufu={debug:(...t)=>console.debug("[DEBUG]",...t),warn:(...t)=>fe.warn("[WARN]",...t),error:(...t)=>console.error("[ERROR]",...t)};async function dfu(){return await OJo(kft(gM.argv)).option("model",{alias:"m",type:"string",description:"Model",default:gM.env.GEMINI_MODEL||mee}).option("prompt",{alias:"p",type:"string",description:"Prompt. Appended to input on stdin (if any)."}).option("sandbox",{alias:"s",type:"boolean",description:"Run in sandbox?"}).option("sandbox-image",{type:"string",description:"Sandbox image URI."}).option("debug",{alias:"d",type:"boolean",description:"Run in debug mode?",default:!1}).option("all_files",{alias:"a",type:"boolean",description:"Include ALL files in context?",default:!1}).option("show_memory_usage",{type:"boolean",description:"Show memory usage in status bar",default:!1}).option("yolo",{alias:"y",type:"boolean",description:"Automatically accept all actions (aka YOLO mode, see https://www.youtube.com/watch?v=xvFZjo5PgG0 for more details)?",default:!1}).option("telemetry",{type:"boolean",description:"Enable telemetry? This flag specifically controls if telemetry is sent. Other --telemetry-* flags set specific values but do not enable telemetry on their own."}).option("telemetry-target",{type:"string",choices:["local","gcp"],description:"Set the telemetry target (local or gcp). Overrides settings files."}).option("telemetry-otlp-endpoint",{type:"string",description:"Set the OTLP endpoint for telemetry. Overrides environment variables and settings files."}).option("telemetry-log-prompts",{type:"boolean",description:"Enable or disable logging of user prompts for telemetry. Overrides settings files."}).option("checkpointing",{alias:"c",type:"boolean",description:"Enables checkpointing of file edits",default:!1}).version(await sbe()).alias("v","version").help().alias("h","help").strict().argv}async function NTt(t,e,r){OTt();let n=await dfu(),o=n.debug||!1;t.contextFileName?Iee(t.contextFileName):Iee(Nee());let i=e.flatMap(E=>E.contextFiles),s=new F8(gM.cwd()),a="",c=0,l=Afu(t,e),d=pfu(t,e),p=await BZo(t,n);return new C0e({sessionId:r,embeddingModel:gee,sandbox:p,targetDir:gM.cwd(),debugMode:o,question:n.prompt||"",fullContext:n.all_files||!1,coreTools:t.coreTools||void 0,excludeTools:d,toolDiscoveryCommand:t.toolDiscoveryCommand,toolCallCommand:t.toolCallCommand,mcpServerCommand:t.mcpServerCommand,mcpServers:l,userMemory:a,geminiMdFileCount:c,approvalMode:n.yolo?pL.YOLO:pL.DEFAULT,showMemoryUsage:n.show_memory_usage||t.showMemoryUsage||!1,accessibility:t.accessibility,telemetry:{enabled:n.telemetry??t.telemetry?.enabled,target:n.telemetryTarget??t.telemetry?.target,otlpEndpoint:n.telemetryOtlpEndpoint??gM.env.OTEL_EXPORTER_OTLP_ENDPOINT??t.telemetry?.otlpEndpoint,logPrompts:n.telemetryLogPrompts??t.telemetry?.logPrompts},usageStatisticsEnabled:t.usageStatisticsEnabled??!0,fileFiltering:{respectGitIgnore:t.fileFiltering?.respectGitIgnore,enableRecursiveFileSearch:t.fileFiltering?.enableRecursiveFileSearch},checkpointing:n.checkpointing||t.checkpointing?.enabled,proxy:gM.env.HTTPS_PROXY||gM.env.https_proxy||gM.env.HTTP_PROXY||gM.env.http_proxy,cwd:gM.cwd(),fileDiscoveryService:s,bugCommand:t.bugCommand,model:n.model,extensionContextFilePaths:i})}function Afu(t,e){let r={...t.mcpServers||{}};for(let n of e)Object.entries(n.config.mcpServers||{}).forEach(([o,i])=>{if(r[o]){ufu.warn(`Skipping extension MCP config for server with key "${o}" as it already exists.`);return}r[o]=i});return r}function pfu(t,e){let r=new Set(t.excludeTools||[]);for(let n of e)for(let o of n.config.excludeTools||[])r.add(o);return[...r]}function Efu(t){let e=VL.resolve(t);for(;;){let r=VL.join(e,AB,".env");if(xoe.existsSync(r))return r;let n=VL.join(e,".env");if(xoe.existsSync(n))return n;let o=VL.dirname(e);if(o===e||!o){let i=VL.join(ITt.homedir(),AB,".env");if(xoe.existsSync(i))return i;let s=VL.join(ITt.homedir(),".env");return xoe.existsSync(s)?s:null}e=o}}function OTt(){let t=Efu(gM.cwd());t&&wZo.config({path:t,quiet:!0})}var s4=t=>{if(OTt(),t===Ll.LOGIN_WITH_ADAL)return null;if(t===Ll.USE_ADAL_KEY)return process.env.GEMINI_API_KEY?null:"GEMINI_API_KEY environment variable not found. Add that to your .env and try again, no reload needed!";if(t===Ll.USE_VERTEX_AI){let e=!!process.env.GOOGLE_CLOUD_PROJECT&&!!process.env.GOOGLE_CLOUD_LOCATION,r=!!process.env.GOOGLE_API_KEY;return!e&&!r?`Must specify GOOGLE_GENAI_USE_VERTEXAI=true and either:
|
|
1003
|
+
`),o+=t.charAt(i);return r&&n&&(o=`${r}${o}${n}`),o}function $ft(t){return UJo(t,{stringWidth:e=>[...e].length,stripAnsi:zft,wrap:wJo})}import{dirname as VJo,resolve as GJo}from"path";import{readdirSync as Zpu,statSync as eEu}from"fs";function FJo(t,e){let r=GJo(".",t),n;for(eEu(r).isDirectory()||(r=VJo(r));;){if(n=e(r,Zpu(r)),n)return GJo(r,n);if(r=VJo(n=r),n===r)break}}import{inspect as lEu}from"util";import{readFileSync as uEu}from"fs";import{fileURLToPath as dEu}from"url";import{basename as AEu,dirname as pEu,extname as EEu,relative as _Eu,resolve as YJo}from"path";import{readFileSync as tEu,statSync as rEu,writeFile as nEu}from"fs";import{format as oEu}from"util";import{resolve as iEu}from"path";var QJo={fs:{readFileSync:tEu,writeFile:nEu},format:oEu,resolve:iEu,exists:t=>{try{return rEu(t).isFile()}catch{return!1}}};var mM,Jft=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),mM.format.apply(mM.format,[this.cache[this.locale][r]||r].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),r=e.shift(),n=e.shift(),o=e.shift(),i=function(){};typeof e[e.length-1]=="function"&&(i=e.pop()),this.cache[this.locale]||this._readLocaleFile();let s=o===1?r:n;this.cache[this.locale][r]&&(s=this.cache[this.locale][r][o===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();let a=[s];return~s.indexOf("%d")&&a.push(o),mM.format.apply(mM.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.cache[this.locale][r]=e[r])}_taggedLiteral(e,...r){let n="";return e.forEach(function(o,i){let s=r[i+1];n+=o,typeof s<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,r=this.writeQueue[0],n=r.directory,o=r.locale,i=r.cb,s=this._resolveLocaleFile(n,o),a=JSON.stringify(this.cache[o],null,2);mM.fs.writeFile(s,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),i(c)})}_readLocaleFile(){let e={},r=this._resolveLocaleFile(this.directory,this.locale);try{mM.fs.readFileSync&&(e=JSON.parse(mM.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,r){let n=mM.resolve(e,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){let o=mM.resolve(e,"./",r.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return mM.exists(e)}};function kJo(t,e){mM=e;let r=new Jft(t);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var sEu=t=>kJo(t,QJo),HJo=sEu;var fEu="require is not supported by ESM",qJo="loading a directory of commands is not supported yet for ESM",Doe;try{Doe=dEu(import.meta.url)}catch{Doe=process.cwd()}var TEu=Doe.substring(0,Doe.lastIndexOf("node_modules")),SEu={assert:{notStrictEqual:aEu,strictEqual:cEu},cliui:$ft,findUp:FJo,getEnv:t=>process.env[t],inspect:lEu,getCallerFile:()=>{throw new r4(qJo)},getProcessArgvBin:DJo,mainFilename:TEu||process.cwd(),Parser:Wft,path:{basename:AEu,dirname:pEu,extname:EEu,relative:_Eu,resolve:YJo},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:uEu,require:()=>{throw new r4(fEu)},requireDirectory:()=>{throw new r4(qJo)},stringWidth:t=>[...t].length,y18n:HJo({directory:YJo(Doe,"../../../locales"),updateFiles:!1})};_n();import gM from"node:process";Loe();async function sbe(){let t=await i4();return"0.2.2"}var wZo=be(vEt(),1);import*as xoe from"node:fs";import*as VL from"node:path";import*as ITt from"node:os";var boe=be(bZo(),1);Loe();import*as xZo from"node:os";var UZo=["docker","podman","sandbox-exec"];function cfu(t){return UZo.includes(t)}function lfu(t){if(process.env.SANDBOX)return"";let e=process.env.GEMINI_SANDBOX?.toLowerCase().trim()??"";if(t=e?.length>0?e:t,t==="1"||t==="true"?t=!0:(t==="0"||t==="false"||!t)&&(t=!1),t===!1)return"";if(typeof t=="string"&&t){if(cfu(t)||(console.error(`ERROR: invalid sandbox command '${t}'. Must be one of ${UZo.join(", ")}`),process.exit(1)),boe.default.sync(t))return t;console.error(`ERROR: missing sandbox command '${t}' (from GEMINI_SANDBOX)`),process.exit(1)}return xZo.platform()==="darwin"&&boe.default.sync("sandbox-exec")?"sandbox-exec":boe.default.sync("docker")&&t===!0?"docker":boe.default.sync("podman")&&t===!0?"podman":(t===!0&&(console.error("ERROR: GEMINI_SANDBOX is true but failed to determine command for sandbox; install docker or podman or specify command in GEMINI_SANDBOX"),process.exit(1)),"")}async function BZo(t,e){let r=e.sandbox??t.sandbox,n=lfu(r),o=await i4(),i=e["sandbox-image"]??process.env.GEMINI_SANDBOX_IMAGE??o?.config?.sandboxImageUri;return n&&i?{command:n,image:i}:void 0}var ufu={debug:(...t)=>console.debug("[DEBUG]",...t),warn:(...t)=>fe.warn("[WARN]",...t),error:(...t)=>console.error("[ERROR]",...t)};async function dfu(){return await OJo(kft(gM.argv)).option("model",{alias:"m",type:"string",description:"Model",default:gM.env.GEMINI_MODEL||mee}).option("prompt",{alias:"p",type:"string",description:"Prompt. Appended to input on stdin (if any)."}).option("sandbox",{alias:"s",type:"boolean",description:"Run in sandbox?"}).option("sandbox-image",{type:"string",description:"Sandbox image URI."}).option("debug",{alias:"d",type:"boolean",description:"Run in debug mode?",default:!1}).option("all_files",{alias:"a",type:"boolean",description:"Include ALL files in context?",default:!1}).option("show_memory_usage",{type:"boolean",description:"Show memory usage in status bar",default:!1}).option("yolo",{alias:"y",type:"boolean",description:"Automatically accept all actions (aka YOLO mode, see https://www.youtube.com/watch?v=xvFZjo5PgG0 for more details)?",default:!1}).option("telemetry",{type:"boolean",description:"Enable telemetry? This flag specifically controls if telemetry is sent. Other --telemetry-* flags set specific values but do not enable telemetry on their own."}).option("telemetry-target",{type:"string",choices:["local","gcp"],description:"Set the telemetry target (local or gcp). Overrides settings files."}).option("telemetry-otlp-endpoint",{type:"string",description:"Set the OTLP endpoint for telemetry. Overrides environment variables and settings files."}).option("telemetry-log-prompts",{type:"boolean",description:"Enable or disable logging of user prompts for telemetry. Overrides settings files."}).option("checkpointing",{alias:"c",type:"boolean",description:"Enables checkpointing of file edits",default:!1}).version(await sbe()).alias("v","version").help().alias("h","help").strict().argv}async function NTt(t,e,r){OTt();let n=await dfu(),o=n.debug||!1;t.contextFileName?Iee(t.contextFileName):Iee(Nee());let i=e.flatMap(E=>E.contextFiles),s=new F8(gM.cwd()),a="",c=0,l=Afu(t,e),d=pfu(t,e),p=await BZo(t,n);return new C0e({sessionId:r,embeddingModel:gee,sandbox:p,targetDir:gM.cwd(),debugMode:o,question:n.prompt||"",fullContext:n.all_files||!1,coreTools:t.coreTools||void 0,excludeTools:d,toolDiscoveryCommand:t.toolDiscoveryCommand,toolCallCommand:t.toolCallCommand,mcpServerCommand:t.mcpServerCommand,mcpServers:l,userMemory:a,geminiMdFileCount:c,approvalMode:n.yolo?pL.YOLO:pL.DEFAULT,showMemoryUsage:n.show_memory_usage||t.showMemoryUsage||!1,accessibility:t.accessibility,telemetry:{enabled:n.telemetry??t.telemetry?.enabled,target:n.telemetryTarget??t.telemetry?.target,otlpEndpoint:n.telemetryOtlpEndpoint??gM.env.OTEL_EXPORTER_OTLP_ENDPOINT??t.telemetry?.otlpEndpoint,logPrompts:n.telemetryLogPrompts??t.telemetry?.logPrompts},usageStatisticsEnabled:t.usageStatisticsEnabled??!0,fileFiltering:{respectGitIgnore:t.fileFiltering?.respectGitIgnore,enableRecursiveFileSearch:t.fileFiltering?.enableRecursiveFileSearch},checkpointing:n.checkpointing||t.checkpointing?.enabled,proxy:gM.env.HTTPS_PROXY||gM.env.https_proxy||gM.env.HTTP_PROXY||gM.env.http_proxy,cwd:gM.cwd(),fileDiscoveryService:s,bugCommand:t.bugCommand,model:n.model,extensionContextFilePaths:i})}function Afu(t,e){let r={...t.mcpServers||{}};for(let n of e)Object.entries(n.config.mcpServers||{}).forEach(([o,i])=>{if(r[o]){ufu.warn(`Skipping extension MCP config for server with key "${o}" as it already exists.`);return}r[o]=i});return r}function pfu(t,e){let r=new Set(t.excludeTools||[]);for(let n of e)for(let o of n.config.excludeTools||[])r.add(o);return[...r]}function Efu(t){let e=VL.resolve(t);for(;;){let r=VL.join(e,AB,".env");if(xoe.existsSync(r))return r;let n=VL.join(e,".env");if(xoe.existsSync(n))return n;let o=VL.dirname(e);if(o===e||!o){let i=VL.join(ITt.homedir(),AB,".env");if(xoe.existsSync(i))return i;let s=VL.join(ITt.homedir(),".env");return xoe.existsSync(s)?s:null}e=o}}function OTt(){let t=Efu(gM.cwd());t&&wZo.config({path:t,quiet:!0})}var s4=t=>{if(OTt(),t===Ll.LOGIN_WITH_ADAL)return null;if(t===Ll.USE_ADAL_KEY)return process.env.GEMINI_API_KEY?null:"GEMINI_API_KEY environment variable not found. Add that to your .env and try again, no reload needed!";if(t===Ll.USE_VERTEX_AI){let e=!!process.env.GOOGLE_CLOUD_PROJECT&&!!process.env.GOOGLE_CLOUD_LOCATION,r=!!process.env.GOOGLE_API_KEY;return!e&&!r?`Must specify GOOGLE_GENAI_USE_VERTEXAI=true and either:
|
|
1004
1004
|
\u2022 GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION environment variables.
|
|
1005
1005
|
\u2022 GOOGLE_API_KEY environment variable (if using express mode).
|
|
1006
1006
|
Update your .env and try again, no reload needed!`:null}return"Invalid auth method selected."};_n();import*as Cv from"fs";import*as cj from"path";import*as GZo from"os";var _fu=cj.join(".gemini","extensions"),ffu="gemini-extension.json";function FZo(t){let e=[...VZo(t),...VZo(GZo.homedir())],r=[],n=new Set;for(let o of e)n.has(o.config.name)||(fe.debug(`Loading extension: ${o.config.name} (version: ${o.config.version})`),r.push(o),n.add(o.config.name));return r}function VZo(t){let e=cj.join(t,_fu);if(!Cv.existsSync(e))return[];let r=[];for(let n of Cv.readdirSync(e)){let o=cj.join(e,n),i=Tfu(o);i!=null&&r.push(i)}return r}function Tfu(t){if(!Cv.statSync(t).isDirectory())return console.error(`Warning: unexpected file ${t} in extensions directory.`),null;let e=cj.join(t,ffu);if(!Cv.existsSync(e))return console.error(`Warning: extension directory ${t} does not contain a config file ${e}.`),null;try{let r=Cv.readFileSync(e,"utf-8"),n=JSON.parse(r);if(!n.name||!n.version)return console.error(`Invalid extension config in ${e}: missing name or version.`),null;let o=Sfu(n).map(i=>cj.join(t,i)).filter(i=>Cv.existsSync(i));return{config:n,contextFiles:o}}catch(r){return console.error(`Warning: error parsing extension config in ${e}: ${r}`),null}}function Sfu(t){if(t.contextFileName){if(!Array.isArray(t.contextFileName))return[t.contextFileName]}else return["GEMINI.md"];return t.contextFileName}_n();var cbe=be(HZo(),1);import*as cC from"fs";import*as dj from"path";import{homedir as Cfu}from"os";_n();var ks={type:"light",Background:"#FAFAFA",Foreground:"#3C3C43",LightBlue:"#89BDCD",AccentBlue:"#3B82F6",AccentPurple:"#8B5CF6",AccentCyan:"#06B6D4",AccentGreen:"#3CA84B",AccentYellow:"#D5A40A",AccentRed:"#DD4C4C",Comment:"#008000",Gray:"#B7BECC",GradientColors:["#4796E4","#847ACE","#C3677F"]},hi={type:"dark",Background:"#1E1E2E",Foreground:"#CDD6F4",LightBlue:"#ADD8E6",AccentBlue:"#89B4FA",AccentPurple:"#CBA6F7",AccentCyan:"#89DCEB",AccentGreen:"#A6E3A1",AccentYellow:"#F9E2AF",AccentRed:"#F38BA8",Comment:"#6C7086",Gray:"#6C7086",GradientColors:["#4796E4","#847ACE","#C3677F"]};var ua=class t{constructor(e,r,n,o){this.name=e;this.type=r;this.colors=o;this._colorMap=Object.freeze(this._buildColorMap(n));let i=n.hljs?.color;this.defaultColor=(i?t._resolveColor(i):void 0)??""}defaultColor;_colorMap;static cssNameToHexMap={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",blanchedalmond:"#ffebcd",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",whitesmoke:"#f5f5f5",yellowgreen:"#9acd32"};static inkSupportedNames=new Set(["black","red","green","yellow","blue","cyan","magenta","white","gray","grey","blackbright","redbright","greenbright","yellowbright","bluebright","cyanbright","magentabright","whitebright"]);getInkColor(e){return this._colorMap[e]}static _resolveColor(e){let r=e.toLowerCase();if(r.startsWith("#"))return r;if(t.inkSupportedNames.has(r))return r;if(t.cssNameToHexMap[r])return t.cssNameToHexMap[r];fe.warn(`[Theme] Could not resolve color "${e}" to an Ink-compatible format.`)}_buildColorMap(e){let r={};for(let n in e){if(!n.startsWith("hljs-")&&n!=="hljs")continue;let o=e[n];if(o?.color){let i=t._resolveColor(o.color);i!==void 0&&(r[n]=i)}}return r}};var Uoe=new ua("Default Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:ks.Background,color:ks.Foreground},"hljs-comment":{color:ks.Comment},"hljs-quote":{color:ks.Comment},"hljs-variable":{color:ks.Foreground},"hljs-keyword":{color:ks.AccentBlue},"hljs-selector-tag":{color:ks.AccentBlue},"hljs-built_in":{color:ks.AccentBlue},"hljs-name":{color:ks.AccentBlue},"hljs-tag":{color:ks.AccentBlue},"hljs-string":{color:ks.AccentRed},"hljs-title":{color:ks.AccentRed},"hljs-section":{color:ks.AccentRed},"hljs-attribute":{color:ks.AccentRed},"hljs-literal":{color:ks.AccentRed},"hljs-template-tag":{color:ks.AccentRed},"hljs-template-variable":{color:ks.AccentRed},"hljs-type":{color:ks.AccentRed},"hljs-addition":{color:ks.AccentGreen},"hljs-deletion":{color:ks.AccentRed},"hljs-selector-attr":{color:ks.AccentCyan},"hljs-selector-pseudo":{color:ks.AccentCyan},"hljs-meta":{color:ks.AccentCyan},"hljs-doctag":{color:ks.Gray},"hljs-attr":{color:ks.AccentRed},"hljs-symbol":{color:ks.AccentCyan},"hljs-bullet":{color:ks.AccentCyan},"hljs-link":{color:ks.AccentCyan},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},ks);var lj=new ua("Default","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:hi.Background,color:hi.Foreground},"hljs-keyword":{color:hi.AccentBlue},"hljs-literal":{color:hi.AccentBlue},"hljs-symbol":{color:hi.AccentBlue},"hljs-name":{color:hi.AccentBlue},"hljs-link":{color:hi.AccentBlue,textDecoration:"underline"},"hljs-built_in":{color:hi.AccentCyan},"hljs-type":{color:hi.AccentCyan},"hljs-number":{color:hi.AccentGreen},"hljs-class":{color:hi.AccentGreen},"hljs-string":{color:hi.AccentYellow},"hljs-meta-string":{color:hi.AccentYellow},"hljs-regexp":{color:hi.AccentRed},"hljs-template-tag":{color:hi.AccentRed},"hljs-subst":{color:hi.Foreground},"hljs-function":{color:hi.Foreground},"hljs-title":{color:hi.Foreground},"hljs-params":{color:hi.Foreground},"hljs-formula":{color:hi.Foreground},"hljs-comment":{color:hi.Comment,fontStyle:"italic"},"hljs-quote":{color:hi.Comment,fontStyle:"italic"},"hljs-doctag":{color:hi.Comment},"hljs-meta":{color:hi.Gray},"hljs-meta-keyword":{color:hi.Gray},"hljs-tag":{color:hi.Gray},"hljs-variable":{color:hi.AccentPurple},"hljs-template-variable":{color:hi.AccentPurple},"hljs-attr":{color:hi.LightBlue},"hljs-attribute":{color:hi.LightBlue},"hljs-builtin-name":{color:hi.LightBlue},"hljs-section":{color:hi.AccentYellow},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-bullet":{color:hi.AccentYellow},"hljs-selector-tag":{color:hi.AccentYellow},"hljs-selector-id":{color:hi.AccentYellow},"hljs-selector-class":{color:hi.AccentYellow},"hljs-selector-attr":{color:hi.AccentYellow},"hljs-selector-pseudo":{color:hi.AccentYellow},"hljs-addition":{backgroundColor:"#144212",display:"inline-block",width:"100%"},"hljs-deletion":{backgroundColor:"#600",display:"inline-block",width:"100%"}},hi);var GL=".adal",yTt=dj.join(Cfu(),GL),uj=dj.join(yTt,"settings.json");var DTt=class{constructor(e,r,n){this.user=e,this.workspace=r,this.errors=n,this._merged=this.computeMergedSettings()}user;workspace;errors;_merged;get merged(){return this._merged}computeMergedSettings(){return{...this.user.settings,...this.workspace.settings}}forScope(e){switch(e){case"User":return this.user;case"Workspace":return this.workspace;default:throw new Error(`Invalid scope: ${e}`)}}setValue(e,r,n){let o=this.forScope(e);o.settings[r]=n,this._merged=this.computeMergedSettings(),Ifu(o)}};function Rfu(t){let e=/\$(?:(\w+)|{([^}]+)})/g;return t.replace(e,(r,n,o)=>{let i=n||o;return process&&process.env&&typeof process.env[i]=="string"?process.env[i]:r})}function lbe(t){if(t==null||typeof t=="boolean"||typeof t=="number")return t;if(typeof t=="string")return Rfu(t);if(Array.isArray(t))return t.map(e=>lbe(e));if(typeof t=="object"){let e={...t};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=lbe(e[r]));return e}return t}function YZo(t){let e={},r={},n=[];try{if(cC.existsSync(uj)){let i=cC.readFileSync(uj,"utf-8"),s=JSON.parse((0,cbe.default)(i));e=lbe(s),e.theme&&e.theme==="VS"?e.theme=Uoe.name:e.theme&&e.theme==="VS2015"&&(e.theme=lj.name)}}catch(i){n.push({message:Wu(i),path:uj})}let o=dj.join(t,GL,"settings.json");try{if(cC.existsSync(o)){let i=cC.readFileSync(o,"utf-8"),s=JSON.parse((0,cbe.default)(i));r=lbe(s),r.theme&&r.theme==="VS"?r.theme=Uoe.name:r.theme&&r.theme==="VS2015"&&(r.theme=lj.name)}}catch(i){n.push({message:Wu(i),path:o})}return new DTt({path:uj,settings:e},{path:o,settings:r},n)}function Ifu(t){try{let e=dj.dirname(t.path);cC.existsSync(e)||cC.mkdirSync(e,{recursive:!0});let r={};if(cC.existsSync(t.path))try{let o=cC.readFileSync(t.path,"utf-8");r=JSON.parse((0,cbe.default)(o))}catch{}let n={...r,...t.settings};cC.writeFileSync(t.path,JSON.stringify(n,null,2),"utf-8")}catch(e){console.error("Error saving user settings file:",e)}}_n();_n();var Nfu=`
|
|
@@ -1057,7 +1057,7 @@ ${U.tools_count} tools available in ${U.response_time_ms}ms`),p(null)):(p(`Conne
|
|
|
1057
1057
|
`);if(a>0){let d=`\x1B[90m... [${a} more lines]${i} ...\x1B[0m`;l=e?d+`
|
|
1058
1058
|
`+l:l+`
|
|
1059
1059
|
`+d}else r!==void 0&&(l=l+`
|
|
1060
|
-
\x1B[90m(`+r+"s)\x1B[0m");return l}function h4(t){let e=t?.trim()||"";if(!e)return"";if(e.length<=110)return e;let r=e.substring(0,50),n=e.substring(e.length-50),o=e.length-100;return`${r} \x1B[90m ... [${o} more chars] ...\x1B[0m ${n}`}var oi=be(Kt(),1);var gSt=
|
|
1060
|
+
\x1B[90m(`+r+"s)\x1B[0m");return l}function h4(t){let e=t?.trim()||"";if(!e)return"";if(e.length<=110)return e;let r=e.substring(0,50),n=e.substring(e.length-50),o=e.length-100;return`${r} \x1B[90m ... [${o} more chars] ...\x1B[0m ${n}`}var oi=be(Kt(),1);var gSt=2;var RSt=({name:t,description:e,specialDescription:r,resultDisplay:n,status:o,availableTerminalHeight:i,terminalWidth:s,emphasis:a="medium",renderOutputAsMarkdown:c=!0,activities:l,timeout:d,startTime:p})=>{let E=o==="Confirming"?void 0:i?Math.min(i,20):20,[T,h]=CSt.default.useState(void 0);CSt.default.useEffect(()=>{if(d&&p&&o==="Executing"){let O=setInterval(()=>{let B=Math.floor((Date.now()-p)/1e3);h(B)},1e3);return()=>clearInterval(O)}},[d,p,o]);let m=s-gSt-1,C=typeof n=="string"&&t!=="Plan Task"?S4(n,o==="Executing",T):n;return(0,oi.jsxs)(Ae,{flexDirection:"column",children:[(0,oi.jsxs)(Ae,{minHeight:1,flexDirection:"row",children:[o!=="Confirming"&&(0,oi.jsx)(qSu,{status:o}),(0,oi.jsx)(jSu,{name:t,status:o,description:e,emphasis:a,terminalWidth:s,timeout:d})]}),r&&(0,oi.jsxs)(Ae,{marginTop:0,marginBottom:1,children:[(0,oi.jsx)(X,{color:oe.Gray,children:"\u23BF "}),(0,oi.jsx)(X,{color:oe.Gray,children:r})]}),(l?.length||C)&&(0,oi.jsxs)(Ae,{flexDirection:"column",children:[l&&l.length>0&&(0,oi.jsxs)(Ae,{flexDirection:"column",marginBottom:1,children:[(0,oi.jsxs)(Ae,{children:[(0,oi.jsx)(X,{color:oe.Gray,children:"\u23BF "}),(0,oi.jsx)(X,{color:oe.Gray,bold:!0,children:"Activities:"})]}),l.map((O,B)=>(0,oi.jsx)(Ae,{marginLeft:4,children:(0,oi.jsxs)(X,{color:oe.Gray,children:["\u2022 ",O]})},B))]}),C&&(0,oi.jsxs)(Ae,{flexDirection:"column",children:[l&&l.length>0&&(0,oi.jsxs)(Ae,{marginBottom:1,children:[(0,oi.jsx)(X,{color:oe.Gray,children:"\u23BF "}),(0,oi.jsx)(X,{color:oe.Gray,bold:!0,children:"Final Output:"})]}),typeof C=="string"&&c&&(0,oi.jsxs)(Ae,{flexDirection:"row",children:[(0,oi.jsx)(X,{color:oe.Gray,children:"\u23BF "}),(0,oi.jsx)(Ae,{flexDirection:"column",flexGrow:1,children:(0,oi.jsx)(Oj,{text:C,isPending:!1,availableTerminalHeight:E,terminalWidth:s-gSt-2})})]}),typeof C=="string"&&!c&&(0,oi.jsxs)(Ae,{flexDirection:"row",children:[(0,oi.jsx)(X,{color:oe.Gray,children:"\u23BF "}),(0,oi.jsx)(X,{wrap:"wrap",children:C})]}),typeof n!="string"&&n&&(0,oi.jsxs)(Ae,{flexDirection:"row",marginTop:1,children:[(0,oi.jsx)(X,{color:oe.Gray,children:"\u23BF "}),(0,oi.jsxs)(Ae,{flexDirection:"column",flexGrow:1,children:[(0,oi.jsx)(T4,{diffContent:n.fileDiff,filename:n.fileName,availableTerminalHeight:o==="Confirming"?void 0:20,terminalWidth:s-gSt-2}),n?.statusMessage&&(0,oi.jsx)(Ae,{marginTop:1,children:(0,oi.jsx)(X,{color:o==="Success"?oe.AccentGreen:o==="Canceled"?oe.AccentYellow:o==="Error"?oe.AccentRed:oe.AccentGreen,children:n.statusMessage})})]})]})]})]})]})},qSu=({status:t})=>(0,oi.jsxs)(Ae,{width:2,flexShrink:0,children:[t==="Pending"&&(0,oi.jsx)(X,{color:oe.AccentGreen,children:"o"}),t==="Executing"&&(0,oi.jsx)(Gbe,{spinnerType:"flip",color:oe.AccentGreen}),t==="Success"&&(0,oi.jsx)(X,{color:oe.AccentGreen,children:"\u2714"}),t==="Canceled"&&(0,oi.jsx)(X,{color:oe.AccentYellow,children:"\u2714"}),t==="Error"&&(0,oi.jsx)(X,{color:oe.AccentRed,children:"\u2714"})]}),jSu=({name:t,description:e,status:r,emphasis:n,terminalWidth:o=80,timeout:i})=>{let s=r==="Confirming"?oe.AccentBlue:void 0,a=e?e.trim():"",c=l=>{if(l<60)return`${l}s`;let d=Math.floor(l/60),p=l%60;return p>0?`${d}m ${p}s`:`${d}m`};return(0,oi.jsxs)(X,{color:s,strikethrough:r==="Canceled",wrap:"wrap",children:[(0,oi.jsx)(X,{bold:!0,children:t}),a&&` (${h4(a)})`,i&&(0,oi.jsxs)(X,{color:oe.Gray,children:[" timeout: ",c(i)]})]})};var Dv=be(Kt(),1);var tni=({toolCalls:t,availableTerminalHeight:e,terminalWidth:r,config:n,isFocused:o=!0})=>{let i=r,s=0,a=(0,eni.useMemo)(()=>t.find(p=>p.status==="Confirming"),[t]),c=0;for(let p of t)p.resultDisplay!==void 0&&p.resultDisplay!==""&&c++;let l=t.length-c,d=a?void 0:e?Math.max(Math.floor((e-s-l)/Math.max(1,c)),1):void 0;return(0,Dv.jsx)(Ae,{flexDirection:"column",marginTop:1,marginBottom:0,width:"100%",gap:1,children:t.map(p=>{let E=a?.callId===p.callId;if(E){let T=i>=50;return(0,Dv.jsxs)(Ae,{flexDirection:"column",minHeight:1,paddingX:1,paddingY:1,...T&&{borderStyle:"round",borderColor:oe.AccentBlue},children:[(0,Dv.jsx)(RSt,{callId:p.callId,name:p.name,description:p.description,specialDescription:p?.specialDescription,resultDisplay:p.resultDisplay,status:p.status,confirmationDetails:p.confirmationDetails,availableTerminalHeight:d,terminalWidth:i-4,emphasis:"high",renderOutputAsMarkdown:p.renderOutputAsMarkdown,activities:p.activities}),p.status==="Confirming"&&p.confirmationDetails&&(0,Dv.jsx)(hSt,{confirmationDetails:p.confirmationDetails,config:n,isFocused:o,availableTerminalHeight:d,terminalWidth:i-4})]},p.callId)}return(0,Dv.jsxs)(Ae,{flexDirection:"column",minHeight:1,children:[(0,Dv.jsx)(Ae,{flexDirection:"row",alignItems:"center",children:(0,Dv.jsx)(RSt,{callId:p.callId,name:p.name,description:p.description,resultDisplay:p.resultDisplay,status:p.status,confirmationDetails:p.confirmationDetails,availableTerminalHeight:d,terminalWidth:i,emphasis:E?"high":a?"low":"medium",renderOutputAsMarkdown:p.renderOutputAsMarkdown,activities:p.activities,timeout:p.timeout,startTime:p.startTime})}),p.status==="Confirming"&&E&&p.confirmationDetails&&(0,Dv.jsx)(hSt,{confirmationDetails:p.confirmationDetails,config:n,isFocused:o,availableTerminalHeight:d,terminalWidth:i})]},p.callId)})})};var ISt=be(Kt(),1);var rni=({text:t,isPending:e,availableTerminalHeight:r,terminalWidth:n})=>{let s=Math.max(n-2-4,20);return(0,ISt.jsx)(Ae,{flexDirection:"column",paddingLeft:2,width:s+2,children:(0,ISt.jsx)(Oj,{text:t,isPending:e,availableTerminalHeight:r,terminalWidth:s})})};var VA=be(Kt(),1);var nni=({compression:t,terminalWidth:e})=>{if(t.isPending)return(0,VA.jsx)(Ae,{borderStyle:"round",borderColor:oe.Gray,flexDirection:"column",marginTop:1,paddingY:1,paddingX:2,children:(0,VA.jsxs)(Ae,{flexDirection:"row",children:[(0,VA.jsx)(Ae,{marginRight:1,children:(0,VA.jsx)(Ow,{type:"dots"})}),(0,VA.jsx)(Ae,{children:(0,VA.jsx)(X,{color:oe.AccentGreen,children:"Compressing chat history"})})]})});let r=t.originalTokenCount??0,n=t.newTokenCount??0,o=r-n,i=r>0?o/r*100:0,s=t.turnsProcessed??1;return(0,VA.jsx)(Ae,{flexDirection:"column",marginTop:1,children:(0,VA.jsxs)(Ae,{borderStyle:"round",borderColor:oe.Gray,paddingY:1,paddingX:2,width:Math.min(e-4,100),flexDirection:"column",children:[(0,VA.jsx)(Ae,{marginBottom:1,children:(0,VA.jsxs)(X,{bold:!0,color:oe.AccentGreen,children:["> ","Auto-Compression Report"]})}),(0,VA.jsx)(Ae,{flexDirection:"row",children:(0,VA.jsxs)(X,{color:oe.Foreground,children:[" Compressed from ",r," to ",n," tokens"]})}),(0,VA.jsx)(Ae,{flexDirection:"row",children:(0,VA.jsxs)(X,{color:oe.Foreground,children:[" Turns processed: ",s]})}),(0,VA.jsx)(Ae,{flexDirection:"row",children:(0,VA.jsxs)(X,{color:oe.Foreground,children:[" Compression ratio: ",i.toFixed(1),"%"]})}),(0,VA.jsx)(Ae,{flexDirection:"row",children:(0,VA.jsxs)(X,{color:oe.Foreground,children:[" Tokens saved: ",o]})})]})})};var ini=be(Kt(),1);var oni=({text:t,terminalWidth:e})=>{let{columns:r}=e!==void 0?{columns:e}:dbe();return(0,ini.jsx)(bbe,{text:t,isPending:!1,terminalWidth:r,prefixColor:oe.Gray})};var yv=be(Kt(),1);var sni=({content:t,stepNumber:e,modelName:r,isCollapsed:n=!0,terminalWidth:o})=>{let i=n,s=" ",a=s.length,c=o?Math.max(o-a-4,20):void 0;return i?(0,yv.jsx)(Ae,{flexDirection:"row",marginTop:1,children:(0,yv.jsxs)(X,{color:oe.Gray,children:[s,"Thought... [Ctrl+R to expand]"]})}):(0,yv.jsxs)(Ae,{flexDirection:"column",marginTop:1,children:[(0,yv.jsx)(Ae,{flexDirection:"row",children:(0,yv.jsxs)(X,{color:oe.Gray,children:[s,"Thought... [Ctrl+R to collapse]"]})}),(0,yv.jsx)(Ae,{marginTop:1,marginLeft:a,children:(0,yv.jsx)(Ae,{width:c,flexGrow:c?0:1,children:(0,yv.jsx)(X,{wrap:"wrap",color:oe.Gray,children:t})})})]})};var yj=be(Kt(),1),ani=({modelName:t,modelId:e,terminalWidth:r})=>{let n=r?Math.max(r-8,20):void 0;return(0,yj.jsx)(Ae,{flexDirection:"column",marginTop:1,children:(0,yj.jsx)(Ae,{width:n,flexGrow:n?0:1,children:(0,yj.jsxs)(X,{wrap:"wrap",children:["\u23BF Set model to ",(0,yj.jsx)(X,{bold:!0,children:t})]})})})};var YL=be(Kt(),1),cni=({serverName:t,statusText:e,terminalWidth:r})=>{let n=r?Math.max(r-8,60):void 0;return(0,YL.jsx)(Ae,{flexDirection:"column",marginTop:1,children:(0,YL.jsx)(Ae,{width:n,flexGrow:n?0:1,children:(0,YL.jsxs)(X,{wrap:"wrap",children:["\u23BF Server added: ",(0,YL.jsx)(X,{bold:!0,children:t}),e&&(0,YL.jsxs)(YL.Fragment,{children:[`
|
|
1061
1061
|
`,e]})]})})})};var $oe=be(Kt(),1);var lni=({duration:t})=>(0,$oe.jsxs)(Ae,{borderStyle:"round",borderColor:oe.Gray,padding:1,marginY:1,flexDirection:"column",children:[(0,$oe.jsx)(X,{bold:!0,color:oe.AccentGreen,children:"Agent powering down. Goodbye!"}),(0,$oe.jsxs)(X,{color:oe.Foreground,children:["Session duration: ",t]})]});var hm=be(Kt(),1);var uni=()=>{let t=[{title:"Input Buffer Shortcuts",shortcuts:[{keys:"Escape Backspace",description:"Clear entire input buffer"},{keys:"Ctrl+L",description:"Clear screen and input buffer"},{keys:"Ctrl+U",description:"Clear text from cursor to beginning of line"},{keys:"Ctrl+K",description:"Clear text from cursor to end of line"},{keys:"Ctrl+A",description:"Move cursor to start of line (Home)"},{keys:"Ctrl+E",description:"Move cursor to end of line (End)"}]},{title:"History Navigation",shortcuts:[{keys:"Ctrl+P / \u2191",description:"Navigate to previous input"},{keys:"Ctrl+N / \u2193",description:"Navigate to next input"}]},{title:"Shell Mode",shortcuts:[{keys:"!",description:"Toggle shell mode (at empty prompt)"},{keys:"Escape",description:"Exit shell mode"}]},{title:"Completion & Suggestions",shortcuts:[{keys:"Tab",description:"Accept current suggestion"},{keys:"\u2191/\u2193",description:"Navigate through suggestions"},{keys:"@filepath",description:"File path completion"},{keys:"/command",description:"Slash command completion"}]},{title:"Text Input",shortcuts:[{keys:"Enter",description:"Submit message"},{keys:"Ctrl+Enter",description:"Insert new line"},{keys:"\\+Enter",description:"Escaped newline"}]},{title:"Popular Slash Commands",shortcuts:[{keys:"/help or /?",description:"Show help"},{keys:"/clear",description:"Clear conversation history"},{keys:"/shortcuts",description:"Show this shortcuts guide"},{keys:"/quit or /exit",description:"Exit AdaL CLI"},{keys:"/model",description:"Change AI model"},{keys:"/stats",description:"Show session statistics"},{keys:"/health",description:"Check system status"}]}];return(0,hm.jsxs)(Ae,{borderStyle:"round",borderColor:oe.Gray,flexDirection:"column",padding:1,marginY:1,width:"100%",minWidth:80,children:[(0,hm.jsx)(Ae,{marginBottom:1,children:(0,hm.jsx)(X,{bold:!0,color:oe.AccentGreen,children:"AdaL CLI Keyboard Shortcuts & Commands"})}),t.map((e,r)=>(0,hm.jsxs)(Ae,{flexDirection:"column",marginBottom:1,children:[(0,hm.jsx)(Ae,{marginBottom:0,children:(0,hm.jsxs)(X,{bold:!0,color:oe.AccentGreen,children:[e.title,":"]})}),(0,hm.jsx)(Ae,{flexDirection:"column",children:e.shortcuts.map((n,o)=>(0,hm.jsxs)(Ae,{flexDirection:"row",children:[(0,hm.jsx)(Ae,{width:25,marginRight:1,children:(0,hm.jsx)(X,{color:oe.AccentBlue,bold:!0,children:n.keys})}),(0,hm.jsx)(Ae,{flexGrow:1,children:(0,hm.jsx)(X,{color:oe.Foreground,children:n.description})})]},o))})]},r))]})};_n();var J_=be(Kt(),1);var WSu=["user","user_shell","gemini","gemini_content","info","error","quit","tool_group","compression","thought","reasoning","model_change","mcp_server_added","shortcuts"],KSu=({item:t,availableTerminalHeight:e,terminalWidth:r,isPending:n,config:o,isFocused:i=!0,reasoningCollapsed:s=!0})=>WSu.includes(t.type)?(0,J_.jsxs)(Ae,{flexDirection:"column",children:[t.type==="user"&&(0,J_.jsx)(hbe,{text:t.text,displayText:t.displayText,pastedTextMetadata:t.pastedTextMetadata,referencedFiles:t.referencedFiles,referencedDirectories:t.referencedDirectories,terminalWidth:r,source:t.source}),t.type==="user_shell"&&(0,J_.jsx)(rti,{text:t.text,terminalWidth:r}),t.type==="gemini"&&(0,J_.jsx)(bbe,{text:t.text,isPending:n,availableTerminalHeight:e,terminalWidth:r}),t.type==="gemini_content"&&(0,J_.jsx)(rni,{text:t.text,isPending:n,availableTerminalHeight:e,terminalWidth:r}),t.type==="info"&&(0,J_.jsx)(qri,{text:t.text,terminalWidth:r}),t.type==="error"&&(0,J_.jsx)(jri,{text:t.text,terminalWidth:r}),t.type==="quit"&&(0,J_.jsx)(lni,{duration:t.duration}),t.type==="tool_group"&&(0,J_.jsx)(tni,{toolCalls:t.tools,groupId:t.id,availableTerminalHeight:e,terminalWidth:r,config:o,isFocused:i}),t.type==="compression"&&(0,J_.jsx)(nni,{compression:t.compression,terminalWidth:r}),t.type==="thought"&&(0,J_.jsx)(oni,{text:t.text,terminalWidth:r}),t.type==="reasoning"&&(0,J_.jsx)(sni,{content:t.content,stepNumber:t.stepNumber,modelName:t.modelName,isCollapsed:s,terminalWidth:r}),t.type==="model_change"&&(0,J_.jsx)(ani,{modelName:t.modelName,modelId:t.modelId,terminalWidth:r}),t.type==="mcp_server_added"&&(0,J_.jsx)(cni,{serverName:t.serverName,statusText:t.statusText,terminalWidth:r}),t.type==="shortcuts"&&(0,J_.jsx)(uni,{})]}):(fe.warn("[HistoryItemDisplay] Received unknown message type:",t.type,"Item:",t),null),Fbe=dni.default.memo(KSu);var NM=be(Kt(),1);var Ani=({messagesDisplayed:t,earlierMessages:e,jsonlPath:r,terminalWidth:n})=>(0,NM.jsxs)(Ae,{flexDirection:"column",width:"100%",alignItems:"center",marginTop:1,children:[(0,NM.jsx)(Ae,{flexDirection:"row",justifyContent:"center",width:n,children:(0,NM.jsxs)(X,{color:oe.Gray,children:["Messages displayed: ",t,e&&e>0&&(0,NM.jsxs)(NM.Fragment,{children:[" \u2022 Earlier messages: ",e]})]})}),(0,NM.jsx)(Ae,{flexDirection:"row",justifyContent:"center",width:n,marginTop:1,children:(0,NM.jsxs)(X,{color:oe.Gray,children:["View full log: ",r]})}),(0,NM.jsx)(Ae,{borderStyle:"single",borderBottom:!0,borderTop:!1,borderLeft:!1,borderRight:!1,width:n,marginTop:1})]});var aA=be(dr(),1);var WS=be(Kt(),1);var Pw=8;function pni({suggestions:t,activeIndex:e,isLoading:r,width:n,scrollOffset:o,userInput:i}){if(r)return(0,WS.jsx)(Ae,{paddingX:1,width:n,children:(0,WS.jsx)(X,{color:"gray",children:"Loading suggestions..."})});if(t.length===0)return null;let s=o,a=Math.min(o+Pw,t.length),c=t.slice(s,a);return(0,WS.jsxs)(Ae,{flexDirection:"column",paddingX:1,width:n,children:[o>0&&(0,WS.jsx)(X,{color:oe.Foreground,children:"\u25B2"}),c.map((l,d)=>{let p=s+d,T=p===e?oe.AccentGreen:oe.Gray;return(0,WS.jsx)(Ae,{width:n,children:(0,WS.jsxs)(Ae,{flexDirection:"row",children:[i.startsWith("/")?(0,WS.jsx)(Ae,{width:20,flexShrink:0,children:(0,WS.jsx)(X,{color:T,children:l.label})}):(0,WS.jsx)(X,{color:T,children:l.label}),l.description?(0,WS.jsx)(Ae,{flexGrow:1,children:(0,WS.jsx)(X,{color:T,wrap:"wrap",children:l.description})}):null]})},`${l}-${p}`)}),a<t.length&&(0,WS.jsx)(X,{color:"gray",children:"\u25BC"}),t.length>Pw&&(0,WS.jsxs)(X,{color:"gray",children:["(",e+1,"/",t.length,")"]})]})}var Lw=be(dr(),1);function Eni({userMessages:t,onSubmit:e,isActive:r,currentQuery:n,onChange:o}){let[i,s]=(0,Lw.useState)(-1),[a,c]=(0,Lw.useState)(""),l=(0,Lw.useCallback)(()=>{s(-1),c("")},[]),d=(0,Lw.useCallback)(T=>{let h=T.trim();h&&e(h),l()},[e,l]),p=(0,Lw.useCallback)(()=>{if(!r||t.length===0)return!1;let T=i;if(i===-1)c(n),T=0;else if(i<t.length-1)T=i+1;else return!1;if(T!==i){s(T);let h=t[t.length-1-T];return o(h),!0}return!1},[i,s,o,t,r,n,c]),E=(0,Lw.useCallback)(()=>{if(!r||i===-1)return!1;let T=i-1;if(s(T),T===-1)o(a);else{let h=t[t.length-1-T];o(h)}return!0},[i,s,a,o,t,r]);return{handleSubmit:d,navigateUp:p,navigateDown:E}}import kni from"node:process";var vv=be(dr(),1);_n();import*as vj from"fs/promises";import*as Qbe from"path";var zSu="shell_history",$Su=100;async function JSu(t){let e=_U(t);return Qbe.join(e,zSu)}async function XSu(t){try{return(await vj.readFile(t,"utf-8")).split(`
|
|
1062
1062
|
`).filter(Boolean)}catch(e){return P_(e)&&e.code==="ENOENT"?[]:(console.error("Error reading shell history:",e),[])}}async function ZSu(t,e){try{await vj.mkdir(Qbe.dirname(t),{recursive:!0}),await vj.writeFile(t,e.join(`
|
|
1063
1063
|
`))}catch(r){console.error("Error writing shell history:",r)}}function _ni(t){let[e,r]=(0,vv.useState)([]),[n,o]=(0,vv.useState)(-1),[i,s]=(0,vv.useState)(null);(0,vv.useEffect)(()=>{async function d(){let p=await JSu(t);s(p);let E=await XSu(p);r(E.reverse())}d()},[t]);let a=(0,vv.useCallback)(d=>{if(!d.trim()||!i)return;let p=[d,...e.filter(E=>E!==d)].slice(0,$Su).filter(Boolean);r(p),ZSu(i,[...p].reverse()),o(-1)},[e,i]),c=(0,vv.useCallback)(()=>{if(e.length===0)return null;let d=Math.min(n+1,e.length-1);return o(d),e[d]??null},[e,n]),l=(0,vv.useCallback)(()=>{if(n<0)return null;let d=n-1;return o(d),d<0?"":e[d]??null},[e,n]);return{addCommandToHistory:a,getPreviousCommand:c,getNextCommand:l,resetHistoryPosition:()=>o(-1)}}var JI=be(dr(),1);kee();_n();import*as NSt from"fs/promises";import*as OM from"path";function fni(t,e,r,n,o,i){let[s,a]=(0,JI.useState)([]),[c,l]=(0,JI.useState)(-1),[d,p]=(0,JI.useState)(0),[E,T]=(0,JI.useState)(!1),[h,m]=(0,JI.useState)(!1),C=(0,JI.useCallback)(()=>{a([]),l(-1),p(0),T(!1),m(!1)},[]),O=(0,JI.useCallback)(()=>s.length===0||s.length===1?!1:(l(U=>{let L=U<=0?s.length-1:U-1;return p(w=>L===s.length-1&&s.length>Pw?Math.max(0,s.length-Pw):L<w?L:w),L}),!0),[s.length]),B=(0,JI.useCallback)(()=>s.length===0||s.length===1?!1:(l(U=>{let L=U>=s.length-1?0:U+1;return p(w=>{if(L===0&&s.length>Pw)return 0;let k=w+Pw;return L>=k?L-Pw+1:w}),L}),!0),[s.length]);return(0,JI.useEffect)(()=>{if(!r){C();return}let U=t.trimStart();if(U.startsWith("/")){let me=U.substring(1).split(" "),Ve=me[0],Ke=me.slice(1).join(" "),Xe=n.find(le=>le.name===Ve||le.altName===Ve);if(Xe&&Xe.completion&&me.length>1){(async()=>{if(m(!0),Xe.completion){let Qe=(await Xe.completion()).filter(qe=>qe.startsWith(Ke)).map(qe=>({label:qe,value:qe}));a(Qe),T(Qe.length>0),l(Qe.length>0?0:-1)}m(!1)})();return}let Pt=U.substring(1),Se=n.filter(le=>le.name.startsWith(Pt)||le.altName?.startsWith(Pt)).filter(le=>{let ue=le.name.startsWith(Pt),Be=le.altName?.startsWith(Pt);return Pt.length===1?ue||Be:ue&&le.name.length>1||Be&&le.altName&&le.altName.length>1}).filter(le=>le.description).map(le=>({label:le.name,value:le.name,description:le.description})).sort((le,ue)=>le.label.localeCompare(ue.label));a(Se),T(Se.length>0),l(Se.length>0?0:-1),p(0),m(!1);return}let L=i!==void 0?t.substring(0,i):t,w=L.lastIndexOf("@");if(w===-1){C();return}let k=L.substring(w+1),W=k.lastIndexOf("/"),ee=W===-1?".":k.substring(0,W+1),K=tY(W===-1?k:k.substring(W+1)),Re=OM.resolve(e,ee),ce=!0,Ue=async(me,Ve,Ke,Xe="",Pt=0,Se=10,le=50)=>{if(Pt>Se)return[];let ue=Ve.toLowerCase(),Be=[];try{let Qe=await NSt.readdir(me,{withFileTypes:!0});for(let qe of Qe){if(Be.length>=le)break;let Et=OM.join(Xe,qe.name),Bt=OM.relative(e,OM.join(me,qe.name));Ke&&Ke.shouldGitIgnoreFile(Bt)||(qe.name.toLowerCase().startsWith(ue)&&Be.push({label:Et+(qe.isDirectory()?"/":""),value:cge(Et+(qe.isDirectory()?"/":""))}),qe.isDirectory()&&qe.name!=="node_modules"&&!qe.name.startsWith(".")&&Be.length<le&&(Be=Be.concat(await Ue(OM.join(me,qe.name),Ve,Ke,Et,Pt+1,Se,le-Be.length))))}}catch{}return Be.slice(0,le)},Pe=async(me,Ve,Ke=50)=>{let Xe=`**/${me}*`;return(await hF(Xe,{cwd:e,dot:!0,nocase:!0})).map(le=>{let ue=OM.relative(e,le);return{label:ue,value:cge(ue)}}).filter(le=>Ve?!Ve.shouldGitIgnoreFile(le.label):!0).slice(0,Ke)},de=setTimeout(async()=>{m(!0);let me=[],Ve=o?o.getFileService():null,Ke=o?.getEnableRecursiveFileSearch()??!0;try{if(k.indexOf("/")===-1&&K&&Ke)Ve?me=await Pe(K,Ve):me=await Ue(e,K,Ve);else{let Xe=K.toLowerCase(),Pt=await NSt.readdir(Re,{withFileTypes:!0}),Se=[];for(let le of Pt){if(!le.name.toLowerCase().startsWith(Xe))continue;let ue=OM.relative(e,OM.join(Re,le.name));Ve&&Ve.shouldGitIgnoreFile(ue)||Se.push(le)}me=Se.map(le=>{let ue=le.isDirectory()?le.name+"/":le.name;return{label:ue,value:cge(ue)}})}me.sort((Xe,Pt)=>{let Se=(Xe.label.match(/\//g)||[]).length,le=(Pt.label.match(/\//g)||[]).length;if(Se!==le)return Se-le;let ue=Xe.label.endsWith("/"),Be=Pt.label.endsWith("/");return ue&&!Be?-1:!ue&&Be?1:Xe.label.localeCompare(Pt.label)}),ce&&(a(me),T(me.length>0),l(me.length>0?0:-1),p(0))}catch(Xe){P_(Xe)&&Xe.code==="ENOENT"?ce&&(a([]),T(!1)):ce&&C()}ce&&m(!1)},100);return()=>{ce=!1,clearTimeout(de)}},[t,e,r,C,n,o]),{suggestions:s,activeSuggestionIndex:c,visibleStartIndex:d,showSuggestions:E,isLoadingSuggestions:h,setActiveSuggestionIndex:l,setShowSuggestions:T,resetCompletionState:C,navigateUp:O,navigateDown:B}}var OSt=be(dr(),1);_n();_n();function Tni(t,e,r,n){if(!n||n.length===0)return{expandedText:t,pastedMetadata:[]};let o=t,i=[];return n.forEach(s=>{let a=`${r}_${s}`,c=e.get(a);if(c){let l=Tj(c,s);o.includes(l)?(o=o.replace(l,c),fe.info(`\u{1F4CB} Expanding paste #${s} from key "${a}" (${c.length} chars)`)):fe.warn(`\u26A0\uFE0F Placeholder "${l}" not found in text`),i.push({localNum:s,fullText:c})}else fe.warn(`\u{1F4CB} Local paste #${s} not found (key: "${a}")`)}),{expandedText:o,pastedMetadata:i}}function Sni(t,e,r){if(t.length===0)return"";if(t.length===1){let s=t[0],a=s.displayText||s.text,c=s.pastedTextMetadata;return!c||Object.keys(c).length===0||Object.entries(c).forEach(([l,d])=>{let p=parseInt(l,10),E=`${r}_${p}`;e.set(E,d.fullText),fe.info(`\u{1F4CB} Restored paste #${p} to map key "${E}"`)}),a}fe.info(`\u{1F4CB} Restoring ${t.length} messages with global renumbering`);let n=1,o=[];t.forEach(s=>{let a=s.displayText||s.text,c=s.pastedTextMetadata;c&&Object.keys(c).length>0&&Object.entries(c).sort(([d],[p])=>parseInt(d)-parseInt(p)).forEach(([d,p])=>{let E=parseInt(d,10),T=Tj(p.fullText,E),h=Tj(p.fullText,n);a.includes(T)&&(a=a.replace(T,h));let m=`${r}_${n}`;e.set(m,p.fullText),fe.info(`\u{1F4CB} Renumbered paste #${E} \u2192 #${n}, key "${m}"`),n++}),o.push(a)});let i=o.join(`
|
|
Binary file
|
|
Binary file
|