@sylphai/adal-cli-darwin-x64 0.3.0-beta.7 → 0.3.0-beta.8
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
|
@@ -1001,7 +1001,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
1001
1001
|
`)}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>$g.stringWidth(s)&&(d+=" ".repeat(l-$g.stringWidth(s))),e[a].align&&e[a].align!=="left"&&this.wrap){let E=KAu[e[a].align];d=E(d,l),$g.stringWidth(d)<l&&(d+=" ".repeat((c||0)-$g.stringWidth(d)-1))}let p=e[a].padding||[0,0,0,0];p[nbe]&&(i+=" ".repeat(p[nbe])),i+=TJo(e[a],d,"| "),i+=d,i+=TJo(e[a],d," |"),p[rbe]&&(i+=" ".repeat(p[rbe])),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=$g.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=$g.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
|
|
1002
1002
|
`):o=i.text.split(`
|
|
1003
1003
|
`),i.border&&(o.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(o.unshift(...new Array(i.padding[zAu]||0).fill("")),o.push(...new Array(i.padding[$Au]||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[nbe]||0)+(e.padding[rbe]||0)),e.border&&(r-=4),r}columnWidths(e){if(!this.wrap)return e.map(s=>s.width||$g.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,JAu(e[a])):s)}};function TJo(t,e,r){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?r:" ":""}function JAu(t){let e=t.padding||[],r=1+(e[nbe]||0)+(e[rbe]||0);return t.border?r+4:r}function XAu(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function ZAu(t,e){t=t.trim();let r=$g.stringWidth(t);return r<e?" ".repeat(e-r)+t:t}function epu(t,e){t=t.trim();let r=$g.stringWidth(t);return r>=e?t:" ".repeat(e-r>>1)+t}var $g;function SJo(t,e){return $g=e,new NTt({width:t?.width||XAu(),wrap:t?.wrap})}var hJo=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function OTt(t){return t.replace(hJo,"")}function mJo(t,e){let[r,n]=t.match(hJo)||["",""];t=OTt(t);let o="";for(let i=0;i<t.length;i++)i!==0&&i%e===0&&(o+=`
|
|
1004
|
-
`),o+=t.charAt(i);return r&&n&&(o=`${r}${o}${n}`),o}function MTt(t){return SJo(t,{stringWidth:e=>[...e].length,stripAnsi:OTt,wrap:mJo})}import{dirname as gJo,resolve as RJo}from"path";import{readdirSync as tpu,statSync as rpu}from"fs";function CJo(t,e){let r=RJo(".",t),n;for(rpu(r).isDirectory()||(r=gJo(r));;){if(n=e(r,tpu(r)),n)return RJo(r,n);if(r=gJo(n=r),n===r)break}}import{inspect as dpu}from"util";import{readFileSync as Apu}from"fs";import{fileURLToPath as ppu}from"url";import{basename as Epu,dirname as _pu,extname as fpu,relative as Tpu,resolve as MJo}from"path";import{readFileSync as npu,statSync as opu,writeFile as ipu}from"fs";import{format as spu}from"util";import{resolve as apu}from"path";var IJo={fs:{readFileSync:npu,writeFile:ipu},format:spu,resolve:apu,exists:t=>{try{return opu(t).isFile()}catch{return!1}}};var mM,yTt=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 NJo(t,e){mM=e;let r=new yTt(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 cpu=t=>NJo(t,IJo),OJo=cpu;var Spu="require is not supported by ESM",yJo="loading a directory of commands is not supported yet for ESM",Toe;try{Toe=ppu(import.meta.url)}catch{Toe=process.cwd()}var hpu=Toe.substring(0,Toe.lastIndexOf("node_modules")),mpu={assert:{notStrictEqual:lpu,strictEqual:upu},cliui:MTt,findUp:CJo,getEnv:t=>process.env[t],inspect:dpu,getCallerFile:()=>{throw new Kk(yJo)},getProcessArgvBin:dJo,mainFilename:hpu||process.cwd(),Parser:ITt,path:{basename:Epu,dirname:_pu,extname:fpu,relative:Tpu,resolve:MJo},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:Apu,require:()=>{throw new Kk(Spu)},requireDirectory:()=>{throw new Kk(yJo)},stringWidth:t=>[...t].length,y18n:OJo({directory:MJo(Toe,"../../../locales"),updateFiles:!1})};Gn();import gM from"node:process";Ebe();async function _be(){let t=await goe();return"0.3.0-beta.7"}var lZo=Ue(__t(),1);import*as Roe from"node:fs";import*as bL from"node:path";import*as XTt from"node:os";async function r_u(){return await lJo(hTt(gM.argv)).option("model",{alias:"m",type:"string",description:"Model",default:gM.env.ADAL_MODEL||uee}).option("prompt",{alias:"p",type:"string",description:"Prompt. Appended to input on stdin (if any)."}).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 _be()).alias("v","version").help().alias("h","help").strict().argv}async function ZTt(t,e){o_u();let r=await r_u(),n=r.debug||!1;t.contextFileName?fee(t.contextFileName):fee(Tee());let o=new OY(gM.cwd()),i="",s=t.mcpServers||{},a=t.excludeTools||[];return new B0e({sessionId:e,embeddingModel:dee,targetDir:gM.cwd(),debugMode:n,question:r.prompt||"",fullContext:r.all_files||!1,coreTools:t.coreTools||void 0,excludeTools:a,toolDiscoveryCommand:t.toolDiscoveryCommand,toolCallCommand:t.toolCallCommand,mcpServerCommand:t.mcpServerCommand,mcpServers:s,userMemory:i,approvalMode:r.yolo?lL.YOLO:lL.DEFAULT,showMemoryUsage:r.show_memory_usage||t.showMemoryUsage||!1,accessibility:t.accessibility,telemetry:{enabled:r.telemetry??t.telemetry?.enabled,target:r.telemetryTarget??t.telemetry?.target,otlpEndpoint:r.telemetryOtlpEndpoint??gM.env.OTEL_EXPORTER_OTLP_ENDPOINT??t.telemetry?.otlpEndpoint,logPrompts:r.telemetryLogPrompts??t.telemetry?.logPrompts},usageStatisticsEnabled:t.usageStatisticsEnabled??!0,fileFiltering:{respectGitIgnore:t.fileFiltering?.respectGitIgnore,enableRecursiveFileSearch:t.fileFiltering?.enableRecursiveFileSearch},checkpointing:r.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:o,bugCommand:t.bugCommand,model:r.model})}function n_u(t){let e=bL.resolve(t);for(;;){let r=bL.join(e,".adal",".env");if(Roe.existsSync(r))return r;let n=bL.join(e,".env");if(Roe.existsSync(n))return n;let o=bL.dirname(e);if(o===e||!o){let i=bL.join(XTt.homedir(),".adal",".env");if(Roe.existsSync(i))return i;let s=bL.join(XTt.homedir(),".env");return Roe.existsSync(s)?s:null}e=o}}function o_u(){let t=n_u(gM.cwd());t&&lZo.config({path:t,quiet:!0})}Gn();var fbe=Ue(AZo(),1);import*as Jg from"fs";import*as ej from"path";import{homedir as c_u}from"os";Gn();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"]},Ri={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 Ea=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];me.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 Coe=new Ea("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 Xq=new Ea("Default","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Ri.Background,color:Ri.Foreground},"hljs-keyword":{color:Ri.AccentBlue},"hljs-literal":{color:Ri.AccentBlue},"hljs-symbol":{color:Ri.AccentBlue},"hljs-name":{color:Ri.AccentBlue},"hljs-link":{color:Ri.AccentBlue,textDecoration:"underline"},"hljs-built_in":{color:Ri.AccentCyan},"hljs-type":{color:Ri.AccentCyan},"hljs-number":{color:Ri.AccentGreen},"hljs-class":{color:Ri.AccentGreen},"hljs-string":{color:Ri.AccentYellow},"hljs-meta-string":{color:Ri.AccentYellow},"hljs-regexp":{color:Ri.AccentRed},"hljs-template-tag":{color:Ri.AccentRed},"hljs-subst":{color:Ri.Foreground},"hljs-function":{color:Ri.Foreground},"hljs-title":{color:Ri.Foreground},"hljs-params":{color:Ri.Foreground},"hljs-formula":{color:Ri.Foreground},"hljs-comment":{color:Ri.Comment,fontStyle:"italic"},"hljs-quote":{color:Ri.Comment,fontStyle:"italic"},"hljs-doctag":{color:Ri.Comment},"hljs-meta":{color:Ri.Gray},"hljs-meta-keyword":{color:Ri.Gray},"hljs-tag":{color:Ri.Gray},"hljs-variable":{color:Ri.AccentPurple},"hljs-template-variable":{color:Ri.AccentPurple},"hljs-attr":{color:Ri.LightBlue},"hljs-attribute":{color:Ri.LightBlue},"hljs-builtin-name":{color:Ri.LightBlue},"hljs-section":{color:Ri.AccentYellow},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-bullet":{color:Ri.AccentYellow},"hljs-selector-tag":{color:Ri.AccentYellow},"hljs-selector-id":{color:Ri.AccentYellow},"hljs-selector-class":{color:Ri.AccentYellow},"hljs-selector-attr":{color:Ri.AccentYellow},"hljs-selector-pseudo":{color:Ri.AccentYellow},"hljs-addition":{backgroundColor:"#144212",display:"inline-block",width:"100%"},"hljs-deletion":{backgroundColor:"#600",display:"inline-block",width:"100%"}},Ri);var pZo=".adal",l_u=ej.join(c_u(),pZo),Zq=ej.join(l_u,"settings.json");var tSt=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(),d_u(o)}};function u_u(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 Tbe(t){if(t==null||typeof t=="boolean"||typeof t=="number")return t;if(typeof t=="string")return u_u(t);if(Array.isArray(t))return t.map(e=>Tbe(e));if(typeof t=="object"){let e={...t};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=Tbe(e[r]));return e}return t}function EZo(t){let e={},r={},n=[];try{if(Jg.existsSync(Zq)){let i=Jg.readFileSync(Zq,"utf-8"),s=JSON.parse((0,fbe.default)(i));e=Tbe(s),e.theme&&e.theme==="VS"?e.theme=Coe.name:e.theme&&e.theme==="VS2015"&&(e.theme=Xq.name)}}catch(i){n.push({message:mu(i),path:Zq})}let o=ej.join(t,pZo,"settings.json");try{if(Jg.existsSync(o)){let i=Jg.readFileSync(o,"utf-8"),s=JSON.parse((0,fbe.default)(i));r=Tbe(s),r.theme&&r.theme==="VS"?r.theme=Coe.name:r.theme&&r.theme==="VS2015"&&(r.theme=Xq.name)}}catch(i){n.push({message:mu(i),path:o})}return new tSt({path:Zq,settings:e},{path:o,settings:r},n)}function d_u(t){try{let e=ej.dirname(t.path);Jg.existsSync(e)||Jg.mkdirSync(e,{recursive:!0});let r={};if(Jg.existsSync(t.path))try{let o=Jg.readFileSync(t.path,"utf-8");r=JSON.parse((0,fbe.default)(o))}catch{}let n={...r,...t.settings};Jg.writeFileSync(t.path,JSON.stringify(n,null,2),"utf-8")}catch(e){console.error("Error saving user settings file:",e)}}Gn();Gn();var A_u=`
|
|
1004
|
+
`),o+=t.charAt(i);return r&&n&&(o=`${r}${o}${n}`),o}function MTt(t){return SJo(t,{stringWidth:e=>[...e].length,stripAnsi:OTt,wrap:mJo})}import{dirname as gJo,resolve as RJo}from"path";import{readdirSync as tpu,statSync as rpu}from"fs";function CJo(t,e){let r=RJo(".",t),n;for(rpu(r).isDirectory()||(r=gJo(r));;){if(n=e(r,tpu(r)),n)return RJo(r,n);if(r=gJo(n=r),n===r)break}}import{inspect as dpu}from"util";import{readFileSync as Apu}from"fs";import{fileURLToPath as ppu}from"url";import{basename as Epu,dirname as _pu,extname as fpu,relative as Tpu,resolve as MJo}from"path";import{readFileSync as npu,statSync as opu,writeFile as ipu}from"fs";import{format as spu}from"util";import{resolve as apu}from"path";var IJo={fs:{readFileSync:npu,writeFile:ipu},format:spu,resolve:apu,exists:t=>{try{return opu(t).isFile()}catch{return!1}}};var mM,yTt=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 NJo(t,e){mM=e;let r=new yTt(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 cpu=t=>NJo(t,IJo),OJo=cpu;var Spu="require is not supported by ESM",yJo="loading a directory of commands is not supported yet for ESM",Toe;try{Toe=ppu(import.meta.url)}catch{Toe=process.cwd()}var hpu=Toe.substring(0,Toe.lastIndexOf("node_modules")),mpu={assert:{notStrictEqual:lpu,strictEqual:upu},cliui:MTt,findUp:CJo,getEnv:t=>process.env[t],inspect:dpu,getCallerFile:()=>{throw new Kk(yJo)},getProcessArgvBin:dJo,mainFilename:hpu||process.cwd(),Parser:ITt,path:{basename:Epu,dirname:_pu,extname:fpu,relative:Tpu,resolve:MJo},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:Apu,require:()=>{throw new Kk(Spu)},requireDirectory:()=>{throw new Kk(yJo)},stringWidth:t=>[...t].length,y18n:OJo({directory:MJo(Toe,"../../../locales"),updateFiles:!1})};Gn();import gM from"node:process";Ebe();async function _be(){let t=await goe();return"0.3.0-beta.8"}var lZo=Ue(__t(),1);import*as Roe from"node:fs";import*as bL from"node:path";import*as XTt from"node:os";async function r_u(){return await lJo(hTt(gM.argv)).option("model",{alias:"m",type:"string",description:"Model",default:gM.env.ADAL_MODEL||uee}).option("prompt",{alias:"p",type:"string",description:"Prompt. Appended to input on stdin (if any)."}).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 _be()).alias("v","version").help().alias("h","help").strict().argv}async function ZTt(t,e){o_u();let r=await r_u(),n=r.debug||!1;t.contextFileName?fee(t.contextFileName):fee(Tee());let o=new OY(gM.cwd()),i="",s=t.mcpServers||{},a=t.excludeTools||[];return new B0e({sessionId:e,embeddingModel:dee,targetDir:gM.cwd(),debugMode:n,question:r.prompt||"",fullContext:r.all_files||!1,coreTools:t.coreTools||void 0,excludeTools:a,toolDiscoveryCommand:t.toolDiscoveryCommand,toolCallCommand:t.toolCallCommand,mcpServerCommand:t.mcpServerCommand,mcpServers:s,userMemory:i,approvalMode:r.yolo?lL.YOLO:lL.DEFAULT,showMemoryUsage:r.show_memory_usage||t.showMemoryUsage||!1,accessibility:t.accessibility,telemetry:{enabled:r.telemetry??t.telemetry?.enabled,target:r.telemetryTarget??t.telemetry?.target,otlpEndpoint:r.telemetryOtlpEndpoint??gM.env.OTEL_EXPORTER_OTLP_ENDPOINT??t.telemetry?.otlpEndpoint,logPrompts:r.telemetryLogPrompts??t.telemetry?.logPrompts},usageStatisticsEnabled:t.usageStatisticsEnabled??!0,fileFiltering:{respectGitIgnore:t.fileFiltering?.respectGitIgnore,enableRecursiveFileSearch:t.fileFiltering?.enableRecursiveFileSearch},checkpointing:r.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:o,bugCommand:t.bugCommand,model:r.model})}function n_u(t){let e=bL.resolve(t);for(;;){let r=bL.join(e,".adal",".env");if(Roe.existsSync(r))return r;let n=bL.join(e,".env");if(Roe.existsSync(n))return n;let o=bL.dirname(e);if(o===e||!o){let i=bL.join(XTt.homedir(),".adal",".env");if(Roe.existsSync(i))return i;let s=bL.join(XTt.homedir(),".env");return Roe.existsSync(s)?s:null}e=o}}function o_u(){let t=n_u(gM.cwd());t&&lZo.config({path:t,quiet:!0})}Gn();var fbe=Ue(AZo(),1);import*as Jg from"fs";import*as ej from"path";import{homedir as c_u}from"os";Gn();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"]},Ri={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 Ea=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];me.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 Coe=new Ea("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 Xq=new Ea("Default","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Ri.Background,color:Ri.Foreground},"hljs-keyword":{color:Ri.AccentBlue},"hljs-literal":{color:Ri.AccentBlue},"hljs-symbol":{color:Ri.AccentBlue},"hljs-name":{color:Ri.AccentBlue},"hljs-link":{color:Ri.AccentBlue,textDecoration:"underline"},"hljs-built_in":{color:Ri.AccentCyan},"hljs-type":{color:Ri.AccentCyan},"hljs-number":{color:Ri.AccentGreen},"hljs-class":{color:Ri.AccentGreen},"hljs-string":{color:Ri.AccentYellow},"hljs-meta-string":{color:Ri.AccentYellow},"hljs-regexp":{color:Ri.AccentRed},"hljs-template-tag":{color:Ri.AccentRed},"hljs-subst":{color:Ri.Foreground},"hljs-function":{color:Ri.Foreground},"hljs-title":{color:Ri.Foreground},"hljs-params":{color:Ri.Foreground},"hljs-formula":{color:Ri.Foreground},"hljs-comment":{color:Ri.Comment,fontStyle:"italic"},"hljs-quote":{color:Ri.Comment,fontStyle:"italic"},"hljs-doctag":{color:Ri.Comment},"hljs-meta":{color:Ri.Gray},"hljs-meta-keyword":{color:Ri.Gray},"hljs-tag":{color:Ri.Gray},"hljs-variable":{color:Ri.AccentPurple},"hljs-template-variable":{color:Ri.AccentPurple},"hljs-attr":{color:Ri.LightBlue},"hljs-attribute":{color:Ri.LightBlue},"hljs-builtin-name":{color:Ri.LightBlue},"hljs-section":{color:Ri.AccentYellow},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-bullet":{color:Ri.AccentYellow},"hljs-selector-tag":{color:Ri.AccentYellow},"hljs-selector-id":{color:Ri.AccentYellow},"hljs-selector-class":{color:Ri.AccentYellow},"hljs-selector-attr":{color:Ri.AccentYellow},"hljs-selector-pseudo":{color:Ri.AccentYellow},"hljs-addition":{backgroundColor:"#144212",display:"inline-block",width:"100%"},"hljs-deletion":{backgroundColor:"#600",display:"inline-block",width:"100%"}},Ri);var pZo=".adal",l_u=ej.join(c_u(),pZo),Zq=ej.join(l_u,"settings.json");var tSt=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(),d_u(o)}};function u_u(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 Tbe(t){if(t==null||typeof t=="boolean"||typeof t=="number")return t;if(typeof t=="string")return u_u(t);if(Array.isArray(t))return t.map(e=>Tbe(e));if(typeof t=="object"){let e={...t};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=Tbe(e[r]));return e}return t}function EZo(t){let e={},r={},n=[];try{if(Jg.existsSync(Zq)){let i=Jg.readFileSync(Zq,"utf-8"),s=JSON.parse((0,fbe.default)(i));e=Tbe(s),e.theme&&e.theme==="VS"?e.theme=Coe.name:e.theme&&e.theme==="VS2015"&&(e.theme=Xq.name)}}catch(i){n.push({message:mu(i),path:Zq})}let o=ej.join(t,pZo,"settings.json");try{if(Jg.existsSync(o)){let i=Jg.readFileSync(o,"utf-8"),s=JSON.parse((0,fbe.default)(i));r=Tbe(s),r.theme&&r.theme==="VS"?r.theme=Coe.name:r.theme&&r.theme==="VS2015"&&(r.theme=Xq.name)}}catch(i){n.push({message:mu(i),path:o})}return new tSt({path:Zq,settings:e},{path:o,settings:r},n)}function d_u(t){try{let e=ej.dirname(t.path);Jg.existsSync(e)||Jg.mkdirSync(e,{recursive:!0});let r={};if(Jg.existsSync(t.path))try{let o=Jg.readFileSync(t.path,"utf-8");r=JSON.parse((0,fbe.default)(o))}catch{}let n={...r,...t.settings};Jg.writeFileSync(t.path,JSON.stringify(n,null,2),"utf-8")}catch(e){console.error("Error saving user settings file:",e)}}Gn();Gn();var A_u=`
|
|
1005
1005
|
Please wait and try again later. To increase your limits, upgrade to a plan with higher limits, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`,p_u=`
|
|
1006
1006
|
Please wait and try again later. To increase your limits, request a quota increase through AI Studio, or switch to another /auth method`,E_u=`
|
|
1007
1007
|
Please wait and try again later. To increase your limits, request a quota increase through Vertex, or switch to another /auth method`,__u="Your request has been rate limited. Please wait and try again later.";function _Zo(t){return typeof t=="object"&&t!==null&&"error"in t&&typeof t.error=="object"&&"message"in t.error}function f_u(t){return typeof t=="object"&&t!==null&&"message"in t&&typeof t.message=="string"}function fZo(t){switch(t){case CS.LOGIN_WITH_ADAL:return A_u;case CS.USE_ADAL_KEY:return p_u;case CS.USE_VERTEX_AI:return E_u;default:return __u}}function T_u(t){if(!t)return!1;let e=t.toUpperCase();return e.includes("RESOURCE_EXHAUSTED")||e.includes("TOO MANY REQUESTS")||e.includes("TOO_MANY_REQUESTS")||e.includes("429")}function tj(t,e){if(f_u(t)){let r=`API Error: ${t.message}`,n=t.status;return(n===429||String(n).includes("429")||String(n).toUpperCase().includes("TOO MANY REQUESTS"))&&(r+=fZo(e)),r}if(typeof t=="string"){let r=t.indexOf("{");if(r===-1)return`API Error: ${t}`;let n=t.substring(r);try{let o=JSON.parse(n);if(_Zo(o)){let i=o.error.message,s;try{let d=JSON.parse(i);_Zo(d)&&(i=d.error.message,s=d.error.status)}catch{}let a=o.error.status||s,c=`[API Error: ${i} (Status: ${a??"Unknown"})]`;return(o.error.code===429||T_u(a))&&(c+=fZo(e)),c}}catch{}return`[API Error: ${t}]`}return"[API Error: An unknown error occurred.]"}function S_u(t){if(t.candidates&&t.candidates.length>0){let e=t.candidates[0];if(e.content&&e.content.parts&&e.content.parts.length>0)return e.content.parts[0]?.thought?null:e.content.parts.filter(n=>n.text).map(n=>n.text).join("")}return null}async function TZo(t,e){process.stdout.on("error",a=>{a.code==="EPIPE"&&process.exit(0)});let r=t.getGeminiClient(),n=await t.getToolRegistry(),o=await r.getChat(),i=new AbortController,s=[{role:"user",parts:[{text:e}]}];try{for(;;){let a=[],c=await o.sendMessageStream({message:s[0]?.parts||[],config:{abortSignal:i.signal,tools:[{functionDeclarations:n.getFunctionDeclarations()}]}});for await(let l of c){if(i.signal.aborted){console.error("Operation cancelled.");return}let d=S_u(l);d&&process.stdout.write(d),l.functionCalls&&a.push(...l.functionCalls)}if(a.length>0){let l=[];for(let d of a){let E={callId:d.id??`${d.name}-${Date.now()}`,name:d.name,args:d.args??{},isClientInitiated:!1},T=await oWo(t,E,n,i.signal);if(T.error){let h=T.error.message.includes("not found in registry");console.error(`Error executing tool ${d.name}: ${T.resultDisplay||T.error.message}`),h||process.exit(1)}if(T.responseParts){let h=Array.isArray(T.responseParts)?T.responseParts:[T.responseParts];for(let m of h)typeof m=="string"?l.push({text:m}):m&&l.push(m)}}s=[{role:"user",parts:l}]}else{process.stdout.write(`
|
|
Binary file
|
|
Binary file
|