@sourcegraph/amp 0.0.1760990140-g391ead → 0.0.1760990359-g26e9bd

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.
Files changed (2) hide show
  1. package/dist/main.js +8 -8
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -123,7 +123,7 @@ ${Y}
123
123
  `,J.length-Y>Q&&q>Y)z+=J.slice(Y,q)+`
124
124
  `+J.slice(q+1);else z+=J.slice(Y);return z.slice(1)}function AI6(J){var Q="",Z=0,X;for(var Y=0;Y<J.length;Z>=65536?Y+=2:Y++)if(Z=jk(J,Y),X=yJ[Z],!X&&Pk(Z)){if(Q+=J[Y],Z>=65536)Q+=J[Y+1]}else Q+=X||FI6(Z);return Q}function wI6(J,Q,Z){var X="",Y=J.tag,K,q,G;for(K=0,q=Z.length;K<q;K+=1){if(G=Z[K],J.replacer)G=J.replacer.call(Z,String(K),G);if(bF(J,Q,G,!1,!1)||typeof G>"u"&&bF(J,Q,null,!1,!1)){if(X!=="")X+=","+(!J.condenseFlow?" ":"");X+=J.dump}}J.tag=Y,J.dump="["+X+"]"}function l10(J,Q,Z,X){var Y="",K=J.tag,q,G,z;for(q=0,G=Z.length;q<G;q+=1){if(z=Z[q],J.replacer)z=J.replacer.call(Z,String(q),z);if(bF(J,Q+1,z,!0,!0,!1,!0)||typeof z>"u"&&bF(J,Q+1,null,!0,!0,!1,!0)){if(!X||Y!=="")Y+=$F1(J,Q);if(J.dump&&Ek===J.dump.charCodeAt(0))Y+="-";else Y+="- ";Y+=J.dump}}J.tag=K,J.dump=Y||"[]"}function RI6(J,Q,Z){var X="",Y=J.tag,K=Object.keys(Z),q,G,z,U,F;for(q=0,G=K.length;q<G;q+=1){if(F="",X!=="")F+=", ";if(J.condenseFlow)F+='"';if(z=K[q],U=Z[z],J.replacer)U=J.replacer.call(Z,z,U);if(!bF(J,Q,z,!1,!1))continue;if(J.dump.length>1024)F+="? ";if(F+=J.dump+(J.condenseFlow?'"':"")+":"+(J.condenseFlow?"":" "),!bF(J,Q,U,!1,!1))continue;F+=J.dump,X+=F}J.tag=Y,J.dump="{"+X+"}"}function OI6(J,Q,Z,X){var Y="",K=J.tag,q=Object.keys(Z),G,z,U,F,W,H;if(J.sortKeys===!0)q.sort();else if(typeof J.sortKeys==="function")q.sort(J.sortKeys);else if(J.sortKeys)throw new AZ("sortKeys must be a boolean or a function");for(G=0,z=q.length;G<z;G+=1){if(H="",!X||Y!=="")H+=$F1(J,Q);if(U=q[G],F=Z[U],J.replacer)F=J.replacer.call(Z,U,F);if(!bF(J,Q+1,U,!0,!0,!0))continue;if(W=J.tag!==null&&J.tag!=="?"||J.dump&&J.dump.length>1024,W)if(J.dump&&Ek===J.dump.charCodeAt(0))H+="?";else H+="? ";if(H+=J.dump,W)H+=$F1(J,Q);if(!bF(J,Q+1,F,!0,W))continue;if(J.dump&&Ek===J.dump.charCodeAt(0))H+=":";else H+=": ";H+=J.dump,Y+=H}J.tag=K,J.dump=Y||"{}"}function i10(J,Q,Z){var X,Y,K,q,G,z;Y=Z?J.explicitTypes:J.implicitTypes;for(K=0,q=Y.length;K<q;K+=1)if(G=Y[K],(G.instanceOf||G.predicate)&&(!G.instanceOf||typeof Q==="object"&&Q instanceof G.instanceOf)&&(!G.predicate||G.predicate(Q))){if(Z)if(G.multi&&G.representName)J.tag=G.representName(Q);else J.tag=G.tag;else J.tag="?";if(G.represent){if(z=J.styleMap[G.tag]||G.defaultStyle,G00.call(G.represent)==="[object Function]")X=G.represent(Q,z);else if(z00.call(G.represent,z))X=G.represent[z](Q,z);else throw new AZ("!<"+G.tag+'> tag resolver accepts not "'+z+'" style');J.dump=X}return!0}return!1}function bF(J,Q,Z,X,Y,K,q){if(J.tag=null,J.dump=Z,!i10(J,Z,!1))i10(J,Z,!0);var G=G00.call(J.dump),z=X,U;if(X)X=J.flowLevel<0||J.flowLevel>Q;var F=G==="[object Object]"||G==="[object Array]",W,H;if(F)W=J.duplicates.indexOf(Z),H=W!==-1;if(J.tag!==null&&J.tag!=="?"||H||J.indent!==2&&Q>0)Y=!1;if(H&&J.usedDuplicates[W])J.dump="*ref_"+W;else{if(F&&H&&!J.usedDuplicates[W])J.usedDuplicates[W]=!0;if(G==="[object Object]"){if(X&&Object.keys(J.dump).length!==0){if(OI6(J,Q,J.dump,Y),H)J.dump="&ref_"+W+J.dump}else if(RI6(J,Q,J.dump),H)J.dump="&ref_"+W+" "+J.dump}else if(G==="[object Array]"){if(X&&J.dump.length!==0){if(J.noArrayIndent&&!q&&Q>0)l10(J,Q-1,J.dump,Y);else l10(J,Q,J.dump,Y);if(H)J.dump="&ref_"+W+J.dump}else if(wI6(J,Q,J.dump),H)J.dump="&ref_"+W+" "+J.dump}else if(G==="[object String]"){if(J.tag!=="?")NI6(J,J.dump,Q,K,z)}else if(G==="[object Undefined]")return!1;else{if(J.skipInvalid)return!1;throw new AZ("unacceptable kind of an object to dump "+G)}if(J.tag!==null&&J.tag!=="?"){if(U=encodeURI(J.tag[0]==="!"?J.tag.slice(1):J.tag).replace(/!/g,"%21"),J.tag[0]==="!")U="!"+U;else if(U.slice(0,18)==="tag:yaml.org,2002:")U="!!"+U.slice(18);else U="!<"+U+">";J.dump=U+" "+J.dump}}return!0}function jI6(J,Q){var Z=[],X=[],Y,K;IF1(J,Z,X);for(Y=0,K=X.length;Y<K;Y+=1)Q.duplicates.push(Z[X[Y]]);Q.usedDuplicates=Array(K)}function IF1(J,Q,Z){var X,Y,K;if(J!==null&&typeof J==="object")if(Y=Q.indexOf(J),Y!==-1){if(Z.indexOf(Y)===-1)Z.push(Y)}else if(Q.push(J),Array.isArray(J))for(Y=0,K=J.length;Y<K;Y+=1)IF1(J[Y],Q,Z);else{X=Object.keys(J);for(Y=0,K=X.length;Y<K;Y+=1)IF1(J[X[Y]],Q,Z)}}function $I6(J,Q){Q=Q||{};var Z=new HI6(Q);if(!Z.noRefs)jI6(J,Z);var X=J;if(Z.replacer)X=Z.replacer.call({"":X},"",X);if(bF(Z,0,X,!0,!0))return Z.dump+`
125
125
  `;return""}function vF1(J,Q){return function(){throw Error("Function yaml."+J+" is removed in js-yaml 4. Use yaml."+Q+" instead, which is now safe by default.")}}var F$6,W$6,H$6,B$6,D$6,M$6,J5,AZ,N$6,L$6,A$6,bJ,j$6,$$6,E$6,I$6,P$6,v$6,b$6,p$6,d$6,i$6,r$6,s$6,o$6,r10,s10,QE6,XE6,PF1=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
126
- \r`,zE6,UE6,FE6,BE6,DE6,NE6,LE6,RE6,o10,XD,ri=1,t10=2,e10=3,si=4,RF1=1,OE6=2,_10=3,jE6,$E6,EE6,J00,Q00,Z00,X00,QD,y10,dE6,cE6,q00,G00,z00,SF1=65279,lE6=9,Ek=10,iE6=13,nE6=32,aE6=33,rE6=34,jF1=35,sE6=37,oE6=38,tE6=39,eE6=42,U00=44,JI6=45,ti=58,QI6=61,ZI6=62,XI6=63,YI6=64,F00=91,W00=93,KI6=96,H00=123,qI6=124,B00=125,yJ,GI6,zI6,WI6=1,Ik=2,M00=1,EF1=2,V00=3,N00=4,Wj=5,EI6,II6,Mj,Y$9,L00,K$9,q$9,G$9;var Qn=B1(()=>{/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */F$6=n10,W$6=K$6,H$6=q$6,B$6=z$6,D$6=U$6,M$6=G$6,J5={isNothing:F$6,isObject:W$6,toArray:H$6,repeat:B$6,isNegativeZero:D$6,extend:M$6};$k.prototype=Object.create(Error.prototype);$k.prototype.constructor=$k;$k.prototype.toString=function(Q){return this.name+": "+a10(this,Q)};AZ=$k;N$6=V$6,L$6=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],A$6=["scalar","sequence","mapping"];bJ=R$6;OF1.prototype.extend=function(Q){var Z=[],X=[];if(Q instanceof bJ)X.push(Q);else if(Array.isArray(Q))X=X.concat(Q);else if(Q&&(Array.isArray(Q.implicit)||Array.isArray(Q.explicit))){if(Q.implicit)Z=Z.concat(Q.implicit);if(Q.explicit)X=X.concat(Q.explicit)}else throw new AZ("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");Z.forEach(function(K){if(!(K instanceof bJ))throw new AZ("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(K.loadKind&&K.loadKind!=="scalar")throw new AZ("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(K.multi)throw new AZ("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),X.forEach(function(K){if(!(K instanceof bJ))throw new AZ("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var Y=Object.create(OF1.prototype);return Y.implicit=(this.implicit||[]).concat(Z),Y.explicit=(this.explicit||[]).concat(X),Y.compiledImplicit=k10(Y,"implicit"),Y.compiledExplicit=k10(Y,"explicit"),Y.compiledTypeMap=O$6(Y.compiledImplicit,Y.compiledExplicit),Y};j$6=OF1,$$6=new bJ("tag:yaml.org,2002:str",{kind:"scalar",construct:function(J){return J!==null?J:""}}),E$6=new bJ("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(J){return J!==null?J:[]}}),I$6=new bJ("tag:yaml.org,2002:map",{kind:"mapping",construct:function(J){return J!==null?J:{}}}),P$6=new j$6({explicit:[$$6,E$6,I$6]});v$6=new bJ("tag:yaml.org,2002:null",{kind:"scalar",resolve:T$6,construct:C$6,predicate:S$6,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});b$6=new bJ("tag:yaml.org,2002:bool",{kind:"scalar",resolve:k$6,construct:_$6,predicate:x$6,represent:{lowercase:function(J){return J?"true":"false"},uppercase:function(J){return J?"TRUE":"FALSE"},camelcase:function(J){return J?"True":"False"}},defaultStyle:"lowercase"});p$6=new bJ("tag:yaml.org,2002:int",{kind:"scalar",resolve:g$6,construct:m$6,predicate:u$6,represent:{binary:function(J){return J>=0?"0b"+J.toString(2):"-0b"+J.toString(2).slice(1)},octal:function(J){return J>=0?"0o"+J.toString(8):"-0o"+J.toString(8).slice(1)},decimal:function(J){return J.toString(10)},hexadecimal:function(J){return J>=0?"0x"+J.toString(16).toUpperCase():"-0x"+J.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),d$6=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");i$6=/^[-+]?[0-9]+e/;r$6=new bJ("tag:yaml.org,2002:float",{kind:"scalar",resolve:c$6,construct:l$6,predicate:a$6,represent:n$6,defaultStyle:"lowercase"}),s$6=P$6.extend({implicit:[v$6,b$6,p$6,r$6]}),o$6=s$6,r10=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),s10=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");QE6=new bJ("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:t$6,construct:e$6,instanceOf:Date,represent:JE6});XE6=new bJ("tag:yaml.org,2002:merge",{kind:"scalar",resolve:ZE6});zE6=new bJ("tag:yaml.org,2002:binary",{kind:"scalar",resolve:YE6,construct:KE6,predicate:GE6,represent:qE6}),UE6=Object.prototype.hasOwnProperty,FE6=Object.prototype.toString;BE6=new bJ("tag:yaml.org,2002:omap",{kind:"sequence",resolve:WE6,construct:HE6}),DE6=Object.prototype.toString;NE6=new bJ("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:ME6,construct:VE6}),LE6=Object.prototype.hasOwnProperty;RE6=new bJ("tag:yaml.org,2002:set",{kind:"mapping",resolve:AE6,construct:wE6}),o10=o$6.extend({implicit:[QE6,XE6],explicit:[zE6,BE6,NE6,RE6]}),XD=Object.prototype.hasOwnProperty,jE6=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,$E6=/[\x85\u2028\u2029]/,EE6=/[,\[\]\{\}]/,J00=/^(?:!|!!|![a-z\-]+!)$/i,Q00=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;Z00=Array(256),X00=Array(256);for(QD=0;QD<256;QD++)Z00[QD]=b10(QD)?1:0,X00[QD]=b10(QD);y10={YAML:function(Q,Z,X){var Y,K,q;if(Q.version!==null)a6(Q,"duplication of %YAML directive");if(X.length!==1)a6(Q,"YAML directive accepts exactly one argument");if(Y=/^([0-9]+)\.([0-9]+)$/.exec(X[0]),Y===null)a6(Q,"ill-formed argument of the YAML directive");if(K=parseInt(Y[1],10),q=parseInt(Y[2],10),K!==1)a6(Q,"unacceptable YAML version of the document");if(Q.version=X[0],Q.checkLineBreaks=q<2,q!==1&&q!==2)oi(Q,"unsupported YAML version of the document")},TAG:function(Q,Z,X){var Y,K;if(X.length!==2)a6(Q,"TAG directive accepts exactly two arguments");if(Y=X[0],K=X[1],!J00.test(Y))a6(Q,"ill-formed tag handle (first argument) of the TAG directive");if(XD.call(Q.tagMap,Y))a6(Q,'there is a previously declared suffix for "'+Y+'" tag handle');if(!Q00.test(K))a6(Q,"ill-formed tag prefix (second argument) of the TAG directive");try{K=decodeURIComponent(K)}catch(q){a6(Q,"tag prefix is malformed: "+K)}Q.tagMap[Y]=K}};dE6=uE6,cE6=pE6,q00={loadAll:dE6,load:cE6},G00=Object.prototype.toString,z00=Object.prototype.hasOwnProperty,yJ={};yJ[0]="\\0";yJ[7]="\\a";yJ[8]="\\b";yJ[9]="\\t";yJ[10]="\\n";yJ[11]="\\v";yJ[12]="\\f";yJ[13]="\\r";yJ[27]="\\e";yJ[34]="\\\"";yJ[92]="\\\\";yJ[133]="\\N";yJ[160]="\\_";yJ[8232]="\\L";yJ[8233]="\\P";GI6=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],zI6=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;EI6=$I6,II6={dump:EI6};Mj=q00.load,Y$9=q00.loadAll,L00=II6.dump,K$9=vF1("safeLoad","load"),q$9=vF1("safeLoadAll","loadAll"),G$9=vF1("safeDump","dump")});function RQ(J){return J instanceof XJ||J instanceof Error&&J.name==="FileNotExistError"||typeof J==="object"&&J!==null&&"code"in J&&typeof J.code==="string"&&["ENOENT","FileNotFound"].includes(J.code)}function A00(J){return typeof J==="object"&&J!==null&&"base"in J&&"pattern"in J&&typeof J.pattern==="string"}function w00(J){return{readFile:J.readFile,readBinaryFile:J.readBinaryFile,stat:J.stat,getMtime:J.getMtime,realpath:J.realpath,readdir:J.readdir,findFiles:J.findFiles,access:J.access,watch:J.watch}}function R00(J){return{...J,writeFile:()=>Promise.reject(Error("Write operations not implemented")),delete:()=>Promise.reject(Error("Write operations not implemented")),mkdirp:()=>Promise.reject(Error("Write operations not implemented")),rename:()=>Promise.reject(Error("Write operations not implemented")),isExclusiveWriterFor:()=>Promise.resolve(!1)}}function Hq(J){return"__isImmutableBaseFileSystem"in J&&J.__isImmutableBaseFileSystem===!0}async function Vj(J,Q,Z){try{return await J.readFile(Q,Z)}catch(X){if(X instanceof XJ)return null;throw X}}async function Zn(J,Q,Z){try{return await J.access(Q,Z),!0}catch(X){if(RQ(X))return!1;throw X}}var XJ;var OQ=B1(()=>{XJ=class XJ extends Error{constructor(J){let Q=typeof J==="string"?J:J.toString();super(`File not found: ${Q}`);this.name="FileNotExistError"}}});function O00(J,Q){if(Q.length===0)return e1.of([]);return new e1((Z)=>{let X=new VZ,Y=()=>{Z.next(Array.from(X.keys()).toSorted((G,z)=>G.toString().localeCompare(z.toString())))},K=new AbortController;Promise.all(Q.map(async(G)=>{if(A00(G))return J.findFiles(G,{signal:K.signal});try{return await J.stat(G),[G]}catch(z){if(z instanceof XJ)return[];if(typeof z==="object"&&z!==null&&"code"in z&&z.code==="ELOOP")return l.warn("Infinite symlink loop detected in guidance file",{file:G.toString()}),[];throw z}})).then(async(G)=>{for(let z of G.flat()){let U=await J.realpath(z,{signal:K.signal});X.add(U)}Y()}).catch((G)=>{if(!K.signal.aborted)K.abort();if(!nO(G))Z.error(G)});let q=Q.map((G)=>J.watch(G,{ignoreChanges:!0}).subscribe({next:(z)=>{if(z.type==="create"||z.type==="change")X.add(z.uri);else if(z.type==="delete")X.delete(z.uri);Y()}}));return()=>{K.abort();for(let G of q)G.unsubscribe()}})}var j00=B1(()=>{T0();aO();z0();Uq();OQ()});var d9=a((xI6)=>{var _F1=Symbol.for("yaml.alias"),$00=Symbol.for("yaml.document"),Xn=Symbol.for("yaml.map"),E00=Symbol.for("yaml.pair"),xF1=Symbol.for("yaml.scalar"),Yn=Symbol.for("yaml.seq"),yF=Symbol.for("yaml.node.type"),PI6=(J)=>!!J&&typeof J==="object"&&J[yF]===_F1,TI6=(J)=>!!J&&typeof J==="object"&&J[yF]===$00,CI6=(J)=>!!J&&typeof J==="object"&&J[yF]===Xn,SI6=(J)=>!!J&&typeof J==="object"&&J[yF]===E00,I00=(J)=>!!J&&typeof J==="object"&&J[yF]===xF1,vI6=(J)=>!!J&&typeof J==="object"&&J[yF]===Yn;function P00(J){if(J&&typeof J==="object")switch(J[yF]){case Xn:case Yn:return!0}return!1}function kI6(J){if(J&&typeof J==="object")switch(J[yF]){case _F1:case Xn:case xF1:case Yn:return!0}return!1}var _I6=(J)=>(I00(J)||P00(J))&&!!J.anchor;xI6.ALIAS=_F1;xI6.DOC=$00;xI6.MAP=Xn;xI6.NODE_TYPE=yF;xI6.PAIR=E00;xI6.SCALAR=xF1;xI6.SEQ=Yn;xI6.hasAnchor=_I6;xI6.isAlias=PI6;xI6.isCollection=P00;xI6.isDocument=TI6;xI6.isMap=CI6;xI6.isNode=kI6;xI6.isPair=SI6;xI6.isScalar=I00;xI6.isSeq=vI6});var Tk=a((oI6)=>{var Q5=d9(),RZ=Symbol("break visit"),T00=Symbol("skip children"),Hz=Symbol("remove node");function Kn(J,Q){let Z=C00(Q);if(Q5.isDocument(J)){if(Nj(null,J.contents,Z,Object.freeze([J]))===Hz)J.contents=null}else Nj(null,J,Z,Object.freeze([]))}Kn.BREAK=RZ;Kn.SKIP=T00;Kn.REMOVE=Hz;function Nj(J,Q,Z,X){let Y=S00(J,Q,Z,X);if(Q5.isNode(Y)||Q5.isPair(Y))return v00(J,X,Y),Nj(J,Y,Z,X);if(typeof Y!=="symbol"){if(Q5.isCollection(Q)){X=Object.freeze(X.concat(Q));for(let K=0;K<Q.items.length;++K){let q=Nj(K,Q.items[K],Z,X);if(typeof q==="number")K=q-1;else if(q===RZ)return RZ;else if(q===Hz)Q.items.splice(K,1),K-=1}}else if(Q5.isPair(Q)){X=Object.freeze(X.concat(Q));let K=Nj("key",Q.key,Z,X);if(K===RZ)return RZ;else if(K===Hz)Q.key=null;let q=Nj("value",Q.value,Z,X);if(q===RZ)return RZ;else if(q===Hz)Q.value=null}}return Y}async function qn(J,Q){let Z=C00(Q);if(Q5.isDocument(J)){if(await Lj(null,J.contents,Z,Object.freeze([J]))===Hz)J.contents=null}else await Lj(null,J,Z,Object.freeze([]))}qn.BREAK=RZ;qn.SKIP=T00;qn.REMOVE=Hz;async function Lj(J,Q,Z,X){let Y=await S00(J,Q,Z,X);if(Q5.isNode(Y)||Q5.isPair(Y))return v00(J,X,Y),Lj(J,Y,Z,X);if(typeof Y!=="symbol"){if(Q5.isCollection(Q)){X=Object.freeze(X.concat(Q));for(let K=0;K<Q.items.length;++K){let q=await Lj(K,Q.items[K],Z,X);if(typeof q==="number")K=q-1;else if(q===RZ)return RZ;else if(q===Hz)Q.items.splice(K,1),K-=1}}else if(Q5.isPair(Q)){X=Object.freeze(X.concat(Q));let K=await Lj("key",Q.key,Z,X);if(K===RZ)return RZ;else if(K===Hz)Q.key=null;let q=await Lj("value",Q.value,Z,X);if(q===RZ)return RZ;else if(q===Hz)Q.value=null}}return Y}function C00(J){if(typeof J==="object"&&(J.Collection||J.Node||J.Value))return Object.assign({Alias:J.Node,Map:J.Node,Scalar:J.Node,Seq:J.Node},J.Value&&{Map:J.Value,Scalar:J.Value,Seq:J.Value},J.Collection&&{Map:J.Collection,Seq:J.Collection},J);return J}function S00(J,Q,Z,X){if(typeof Z==="function")return Z(J,Q,X);if(Q5.isMap(Q))return Z.Map?.(J,Q,X);if(Q5.isSeq(Q))return Z.Seq?.(J,Q,X);if(Q5.isPair(Q))return Z.Pair?.(J,Q,X);if(Q5.isScalar(Q))return Z.Scalar?.(J,Q,X);if(Q5.isAlias(Q))return Z.Alias?.(J,Q,X);return}function v00(J,Q,Z){let X=Q[Q.length-1];if(Q5.isCollection(X))X.items[J]=Z;else if(Q5.isPair(X))if(J==="key")X.key=Z;else X.value=Z;else if(Q5.isDocument(X))X.contents=Z;else{let Y=Q5.isAlias(X)?"alias":"scalar";throw Error(`Cannot replace node with ${Y} parent`)}}oI6.visit=Kn;oI6.visitAsync=qn});var bF1=a((XP6)=>{var k00=d9(),JP6=Tk(),QP6={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ZP6=(J)=>J.replace(/[!,[\]{}]/g,(Q)=>QP6[Q]);class PY{constructor(J,Q){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},PY.defaultYaml,J),this.tags=Object.assign({},PY.defaultTags,Q)}clone(){let J=new PY(this.yaml,this.tags);return J.docStart=this.docStart,J}atDocument(){let J=new PY(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:PY.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},PY.defaultTags);break}return J}add(J,Q){if(this.atNextDocument)this.yaml={explicit:PY.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},PY.defaultTags),this.atNextDocument=!1;let Z=J.trim().split(/[ \t]+/),X=Z.shift();switch(X){case"%TAG":{if(Z.length!==2){if(Q(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[Y,K]=Z;return this.tags[Y]=K,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return Q(0,"%YAML directive should contain exactly one part"),!1;let[Y]=Z;if(Y==="1.1"||Y==="1.2")return this.yaml.version=Y,!0;else{let K=/^\d+\.\d+$/.test(Y);return Q(6,`Unsupported YAML version ${Y}`,K),!1}}default:return Q(0,`Unknown directive ${X}`,!0),!1}}tagName(J,Q){if(J==="!")return"!";if(J[0]!=="!")return Q(`Not a valid tag: ${J}`),null;if(J[1]==="<"){let K=J.slice(2,-1);if(K==="!"||K==="!!")return Q(`Verbatim tags aren't resolved, so ${J} is invalid.`),null;if(J[J.length-1]!==">")Q("Verbatim tags must end with a >");return K}let[,Z,X]=J.match(/^(.*!)([^!]*)$/s);if(!X)Q(`The ${J} tag has no suffix`);let Y=this.tags[Z];if(Y)try{return Y+decodeURIComponent(X)}catch(K){return Q(String(K)),null}if(Z==="!")return J;return Q(`Could not resolve tag: ${J}`),null}tagString(J){for(let[Q,Z]of Object.entries(this.tags))if(J.startsWith(Z))return Q+ZP6(J.substring(Z.length));return J[0]==="!"?J:`!<${J}>`}toString(J){let Q=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),X;if(J&&Z.length>0&&k00.isNode(J.contents)){let Y={};JP6.visit(J.contents,(K,q)=>{if(k00.isNode(q)&&q.tag)Y[q.tag]=!0}),X=Object.keys(Y)}else X=[];for(let[Y,K]of Z){if(Y==="!!"&&K==="tag:yaml.org,2002:")continue;if(!J||X.some((q)=>q.startsWith(K)))Q.push(`%TAG ${Y} ${K}`)}return Q.join(`
126
+ \r`,zE6,UE6,FE6,BE6,DE6,NE6,LE6,RE6,o10,XD,ri=1,t10=2,e10=3,si=4,RF1=1,OE6=2,_10=3,jE6,$E6,EE6,J00,Q00,Z00,X00,QD,y10,dE6,cE6,q00,G00,z00,SF1=65279,lE6=9,Ek=10,iE6=13,nE6=32,aE6=33,rE6=34,jF1=35,sE6=37,oE6=38,tE6=39,eE6=42,U00=44,JI6=45,ti=58,QI6=61,ZI6=62,XI6=63,YI6=64,F00=91,W00=93,KI6=96,H00=123,qI6=124,B00=125,yJ,GI6,zI6,WI6=1,Ik=2,M00=1,EF1=2,V00=3,N00=4,Wj=5,EI6,II6,Mj,Y$9,L00,K$9,q$9,G$9;var Qn=B1(()=>{/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */F$6=n10,W$6=K$6,H$6=q$6,B$6=z$6,D$6=U$6,M$6=G$6,J5={isNothing:F$6,isObject:W$6,toArray:H$6,repeat:B$6,isNegativeZero:D$6,extend:M$6};$k.prototype=Object.create(Error.prototype);$k.prototype.constructor=$k;$k.prototype.toString=function(Q){return this.name+": "+a10(this,Q)};AZ=$k;N$6=V$6,L$6=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],A$6=["scalar","sequence","mapping"];bJ=R$6;OF1.prototype.extend=function(Q){var Z=[],X=[];if(Q instanceof bJ)X.push(Q);else if(Array.isArray(Q))X=X.concat(Q);else if(Q&&(Array.isArray(Q.implicit)||Array.isArray(Q.explicit))){if(Q.implicit)Z=Z.concat(Q.implicit);if(Q.explicit)X=X.concat(Q.explicit)}else throw new AZ("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");Z.forEach(function(K){if(!(K instanceof bJ))throw new AZ("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(K.loadKind&&K.loadKind!=="scalar")throw new AZ("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(K.multi)throw new AZ("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),X.forEach(function(K){if(!(K instanceof bJ))throw new AZ("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var Y=Object.create(OF1.prototype);return Y.implicit=(this.implicit||[]).concat(Z),Y.explicit=(this.explicit||[]).concat(X),Y.compiledImplicit=k10(Y,"implicit"),Y.compiledExplicit=k10(Y,"explicit"),Y.compiledTypeMap=O$6(Y.compiledImplicit,Y.compiledExplicit),Y};j$6=OF1,$$6=new bJ("tag:yaml.org,2002:str",{kind:"scalar",construct:function(J){return J!==null?J:""}}),E$6=new bJ("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(J){return J!==null?J:[]}}),I$6=new bJ("tag:yaml.org,2002:map",{kind:"mapping",construct:function(J){return J!==null?J:{}}}),P$6=new j$6({explicit:[$$6,E$6,I$6]});v$6=new bJ("tag:yaml.org,2002:null",{kind:"scalar",resolve:T$6,construct:C$6,predicate:S$6,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});b$6=new bJ("tag:yaml.org,2002:bool",{kind:"scalar",resolve:k$6,construct:_$6,predicate:x$6,represent:{lowercase:function(J){return J?"true":"false"},uppercase:function(J){return J?"TRUE":"FALSE"},camelcase:function(J){return J?"True":"False"}},defaultStyle:"lowercase"});p$6=new bJ("tag:yaml.org,2002:int",{kind:"scalar",resolve:g$6,construct:m$6,predicate:u$6,represent:{binary:function(J){return J>=0?"0b"+J.toString(2):"-0b"+J.toString(2).slice(1)},octal:function(J){return J>=0?"0o"+J.toString(8):"-0o"+J.toString(8).slice(1)},decimal:function(J){return J.toString(10)},hexadecimal:function(J){return J>=0?"0x"+J.toString(16).toUpperCase():"-0x"+J.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),d$6=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");i$6=/^[-+]?[0-9]+e/;r$6=new bJ("tag:yaml.org,2002:float",{kind:"scalar",resolve:c$6,construct:l$6,predicate:a$6,represent:n$6,defaultStyle:"lowercase"}),s$6=P$6.extend({implicit:[v$6,b$6,p$6,r$6]}),o$6=s$6,r10=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),s10=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");QE6=new bJ("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:t$6,construct:e$6,instanceOf:Date,represent:JE6});XE6=new bJ("tag:yaml.org,2002:merge",{kind:"scalar",resolve:ZE6});zE6=new bJ("tag:yaml.org,2002:binary",{kind:"scalar",resolve:YE6,construct:KE6,predicate:GE6,represent:qE6}),UE6=Object.prototype.hasOwnProperty,FE6=Object.prototype.toString;BE6=new bJ("tag:yaml.org,2002:omap",{kind:"sequence",resolve:WE6,construct:HE6}),DE6=Object.prototype.toString;NE6=new bJ("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:ME6,construct:VE6}),LE6=Object.prototype.hasOwnProperty;RE6=new bJ("tag:yaml.org,2002:set",{kind:"mapping",resolve:AE6,construct:wE6}),o10=o$6.extend({implicit:[QE6,XE6],explicit:[zE6,BE6,NE6,RE6]}),XD=Object.prototype.hasOwnProperty,jE6=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,$E6=/[\x85\u2028\u2029]/,EE6=/[,\[\]\{\}]/,J00=/^(?:!|!!|![a-z\-]+!)$/i,Q00=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;Z00=Array(256),X00=Array(256);for(QD=0;QD<256;QD++)Z00[QD]=b10(QD)?1:0,X00[QD]=b10(QD);y10={YAML:function(Q,Z,X){var Y,K,q;if(Q.version!==null)a6(Q,"duplication of %YAML directive");if(X.length!==1)a6(Q,"YAML directive accepts exactly one argument");if(Y=/^([0-9]+)\.([0-9]+)$/.exec(X[0]),Y===null)a6(Q,"ill-formed argument of the YAML directive");if(K=parseInt(Y[1],10),q=parseInt(Y[2],10),K!==1)a6(Q,"unacceptable YAML version of the document");if(Q.version=X[0],Q.checkLineBreaks=q<2,q!==1&&q!==2)oi(Q,"unsupported YAML version of the document")},TAG:function(Q,Z,X){var Y,K;if(X.length!==2)a6(Q,"TAG directive accepts exactly two arguments");if(Y=X[0],K=X[1],!J00.test(Y))a6(Q,"ill-formed tag handle (first argument) of the TAG directive");if(XD.call(Q.tagMap,Y))a6(Q,'there is a previously declared suffix for "'+Y+'" tag handle');if(!Q00.test(K))a6(Q,"ill-formed tag prefix (second argument) of the TAG directive");try{K=decodeURIComponent(K)}catch(q){a6(Q,"tag prefix is malformed: "+K)}Q.tagMap[Y]=K}};dE6=uE6,cE6=pE6,q00={loadAll:dE6,load:cE6},G00=Object.prototype.toString,z00=Object.prototype.hasOwnProperty,yJ={};yJ[0]="\\0";yJ[7]="\\a";yJ[8]="\\b";yJ[9]="\\t";yJ[10]="\\n";yJ[11]="\\v";yJ[12]="\\f";yJ[13]="\\r";yJ[27]="\\e";yJ[34]="\\\"";yJ[92]="\\\\";yJ[133]="\\N";yJ[160]="\\_";yJ[8232]="\\L";yJ[8233]="\\P";GI6=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],zI6=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;EI6=$I6,II6={dump:EI6};Mj=q00.load,Y$9=q00.loadAll,L00=II6.dump,K$9=vF1("safeLoad","load"),q$9=vF1("safeLoadAll","loadAll"),G$9=vF1("safeDump","dump")});function RQ(J){return J instanceof XJ||J instanceof Error&&J.name==="FileNotExistError"||typeof J==="object"&&J!==null&&"code"in J&&typeof J.code==="string"&&["ENOENT","FileNotFound"].includes(J.code)}function A00(J){return typeof J==="object"&&J!==null&&"base"in J&&"pattern"in J&&typeof J.pattern==="string"}function w00(J){return{readFile:J.readFile,readBinaryFile:J.readBinaryFile,stat:J.stat,getMtime:J.getMtime,realpath:J.realpath,readdir:J.readdir,findFiles:J.findFiles,access:J.access,watch:J.watch}}function R00(J){return{...J,writeFile:()=>Promise.reject(Error("Write operations not implemented")),delete:()=>Promise.reject(Error("Write operations not implemented")),mkdirp:()=>Promise.reject(Error("Write operations not implemented")),rename:()=>Promise.reject(Error("Write operations not implemented")),isExclusiveWriterFor:()=>Promise.resolve(!1)}}function Hq(J){return"__isImmutableBaseFileSystem"in J&&J.__isImmutableBaseFileSystem===!0}async function Vj(J,Q,Z){try{return await J.readFile(Q,Z)}catch(X){if(X instanceof XJ)return null;throw X}}async function Zn(J,Q,Z){try{return await J.access(Q,Z),!0}catch(X){if(RQ(X))return!1;throw X}}var XJ;var OQ=B1(()=>{XJ=class XJ extends Error{constructor(J){let Q=typeof J==="string"?J:J.toString();super(`File not found: ${Q}`);this.name="FileNotExistError"}}});function O00(J,Q){if(Q.length===0)return e1.of([]);return new e1((Z)=>{let X=new VZ,Y=()=>{Z.next(Array.from(X.keys()).toSorted((G,z)=>G.toString().localeCompare(z.toString())))},K=new AbortController;Promise.all(Q.map(async(G)=>{if(A00(G))return J.findFiles(G,{signal:K.signal});try{return await J.stat(G),[G]}catch(z){if(z instanceof XJ)return[];if(typeof z==="object"&&z!==null&&"code"in z&&z.code==="ELOOP")return l.warn("Infinite symlink loop detected in guidance file",{file:G.toString()}),[];throw z}})).then((G)=>{for(let z of G.flat())X.add(z);Y()}).catch((G)=>{if(!K.signal.aborted)K.abort();if(!nO(G))Z.error(G)});let q=Q.map((G)=>J.watch(G,{ignoreChanges:!0}).subscribe({next:(z)=>{if(z.type==="create"||z.type==="change")X.add(z.uri);else if(z.type==="delete")X.delete(z.uri);Y()}}));return()=>{K.abort();for(let G of q)G.unsubscribe()}})}var j00=B1(()=>{T0();aO();z0();Uq();OQ()});var d9=a((xI6)=>{var _F1=Symbol.for("yaml.alias"),$00=Symbol.for("yaml.document"),Xn=Symbol.for("yaml.map"),E00=Symbol.for("yaml.pair"),xF1=Symbol.for("yaml.scalar"),Yn=Symbol.for("yaml.seq"),yF=Symbol.for("yaml.node.type"),PI6=(J)=>!!J&&typeof J==="object"&&J[yF]===_F1,TI6=(J)=>!!J&&typeof J==="object"&&J[yF]===$00,CI6=(J)=>!!J&&typeof J==="object"&&J[yF]===Xn,SI6=(J)=>!!J&&typeof J==="object"&&J[yF]===E00,I00=(J)=>!!J&&typeof J==="object"&&J[yF]===xF1,vI6=(J)=>!!J&&typeof J==="object"&&J[yF]===Yn;function P00(J){if(J&&typeof J==="object")switch(J[yF]){case Xn:case Yn:return!0}return!1}function kI6(J){if(J&&typeof J==="object")switch(J[yF]){case _F1:case Xn:case xF1:case Yn:return!0}return!1}var _I6=(J)=>(I00(J)||P00(J))&&!!J.anchor;xI6.ALIAS=_F1;xI6.DOC=$00;xI6.MAP=Xn;xI6.NODE_TYPE=yF;xI6.PAIR=E00;xI6.SCALAR=xF1;xI6.SEQ=Yn;xI6.hasAnchor=_I6;xI6.isAlias=PI6;xI6.isCollection=P00;xI6.isDocument=TI6;xI6.isMap=CI6;xI6.isNode=kI6;xI6.isPair=SI6;xI6.isScalar=I00;xI6.isSeq=vI6});var Tk=a((oI6)=>{var Q5=d9(),RZ=Symbol("break visit"),T00=Symbol("skip children"),Hz=Symbol("remove node");function Kn(J,Q){let Z=C00(Q);if(Q5.isDocument(J)){if(Nj(null,J.contents,Z,Object.freeze([J]))===Hz)J.contents=null}else Nj(null,J,Z,Object.freeze([]))}Kn.BREAK=RZ;Kn.SKIP=T00;Kn.REMOVE=Hz;function Nj(J,Q,Z,X){let Y=S00(J,Q,Z,X);if(Q5.isNode(Y)||Q5.isPair(Y))return v00(J,X,Y),Nj(J,Y,Z,X);if(typeof Y!=="symbol"){if(Q5.isCollection(Q)){X=Object.freeze(X.concat(Q));for(let K=0;K<Q.items.length;++K){let q=Nj(K,Q.items[K],Z,X);if(typeof q==="number")K=q-1;else if(q===RZ)return RZ;else if(q===Hz)Q.items.splice(K,1),K-=1}}else if(Q5.isPair(Q)){X=Object.freeze(X.concat(Q));let K=Nj("key",Q.key,Z,X);if(K===RZ)return RZ;else if(K===Hz)Q.key=null;let q=Nj("value",Q.value,Z,X);if(q===RZ)return RZ;else if(q===Hz)Q.value=null}}return Y}async function qn(J,Q){let Z=C00(Q);if(Q5.isDocument(J)){if(await Lj(null,J.contents,Z,Object.freeze([J]))===Hz)J.contents=null}else await Lj(null,J,Z,Object.freeze([]))}qn.BREAK=RZ;qn.SKIP=T00;qn.REMOVE=Hz;async function Lj(J,Q,Z,X){let Y=await S00(J,Q,Z,X);if(Q5.isNode(Y)||Q5.isPair(Y))return v00(J,X,Y),Lj(J,Y,Z,X);if(typeof Y!=="symbol"){if(Q5.isCollection(Q)){X=Object.freeze(X.concat(Q));for(let K=0;K<Q.items.length;++K){let q=await Lj(K,Q.items[K],Z,X);if(typeof q==="number")K=q-1;else if(q===RZ)return RZ;else if(q===Hz)Q.items.splice(K,1),K-=1}}else if(Q5.isPair(Q)){X=Object.freeze(X.concat(Q));let K=await Lj("key",Q.key,Z,X);if(K===RZ)return RZ;else if(K===Hz)Q.key=null;let q=await Lj("value",Q.value,Z,X);if(q===RZ)return RZ;else if(q===Hz)Q.value=null}}return Y}function C00(J){if(typeof J==="object"&&(J.Collection||J.Node||J.Value))return Object.assign({Alias:J.Node,Map:J.Node,Scalar:J.Node,Seq:J.Node},J.Value&&{Map:J.Value,Scalar:J.Value,Seq:J.Value},J.Collection&&{Map:J.Collection,Seq:J.Collection},J);return J}function S00(J,Q,Z,X){if(typeof Z==="function")return Z(J,Q,X);if(Q5.isMap(Q))return Z.Map?.(J,Q,X);if(Q5.isSeq(Q))return Z.Seq?.(J,Q,X);if(Q5.isPair(Q))return Z.Pair?.(J,Q,X);if(Q5.isScalar(Q))return Z.Scalar?.(J,Q,X);if(Q5.isAlias(Q))return Z.Alias?.(J,Q,X);return}function v00(J,Q,Z){let X=Q[Q.length-1];if(Q5.isCollection(X))X.items[J]=Z;else if(Q5.isPair(X))if(J==="key")X.key=Z;else X.value=Z;else if(Q5.isDocument(X))X.contents=Z;else{let Y=Q5.isAlias(X)?"alias":"scalar";throw Error(`Cannot replace node with ${Y} parent`)}}oI6.visit=Kn;oI6.visitAsync=qn});var bF1=a((XP6)=>{var k00=d9(),JP6=Tk(),QP6={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ZP6=(J)=>J.replace(/[!,[\]{}]/g,(Q)=>QP6[Q]);class PY{constructor(J,Q){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},PY.defaultYaml,J),this.tags=Object.assign({},PY.defaultTags,Q)}clone(){let J=new PY(this.yaml,this.tags);return J.docStart=this.docStart,J}atDocument(){let J=new PY(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:PY.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},PY.defaultTags);break}return J}add(J,Q){if(this.atNextDocument)this.yaml={explicit:PY.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},PY.defaultTags),this.atNextDocument=!1;let Z=J.trim().split(/[ \t]+/),X=Z.shift();switch(X){case"%TAG":{if(Z.length!==2){if(Q(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[Y,K]=Z;return this.tags[Y]=K,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return Q(0,"%YAML directive should contain exactly one part"),!1;let[Y]=Z;if(Y==="1.1"||Y==="1.2")return this.yaml.version=Y,!0;else{let K=/^\d+\.\d+$/.test(Y);return Q(6,`Unsupported YAML version ${Y}`,K),!1}}default:return Q(0,`Unknown directive ${X}`,!0),!1}}tagName(J,Q){if(J==="!")return"!";if(J[0]!=="!")return Q(`Not a valid tag: ${J}`),null;if(J[1]==="<"){let K=J.slice(2,-1);if(K==="!"||K==="!!")return Q(`Verbatim tags aren't resolved, so ${J} is invalid.`),null;if(J[J.length-1]!==">")Q("Verbatim tags must end with a >");return K}let[,Z,X]=J.match(/^(.*!)([^!]*)$/s);if(!X)Q(`The ${J} tag has no suffix`);let Y=this.tags[Z];if(Y)try{return Y+decodeURIComponent(X)}catch(K){return Q(String(K)),null}if(Z==="!")return J;return Q(`Could not resolve tag: ${J}`),null}tagString(J){for(let[Q,Z]of Object.entries(this.tags))if(J.startsWith(Z))return Q+ZP6(J.substring(Z.length));return J[0]==="!"?J:`!<${J}>`}toString(J){let Q=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),X;if(J&&Z.length>0&&k00.isNode(J.contents)){let Y={};JP6.visit(J.contents,(K,q)=>{if(k00.isNode(q)&&q.tag)Y[q.tag]=!0}),X=Object.keys(Y)}else X=[];for(let[Y,K]of Z){if(Y==="!!"&&K==="tag:yaml.org,2002:")continue;if(!J||X.some((q)=>q.startsWith(K)))Q.push(`%TAG ${Y} ${K}`)}return Q.join(`
127
127
  `)}}PY.defaultYaml={explicit:!1,version:"1.2"};PY.defaultTags={"!!":"tag:yaml.org,2002:"};XP6.Directives=PY});var Gn=a((zP6)=>{var _00=d9(),KP6=Tk();function qP6(J){if(/[\x00-\x19\s,[\]{}]/.test(J)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify(J)}`;throw Error(Z)}return!0}function x00(J){let Q=new Set;return KP6.visit(J,{Value(Z,X){if(X.anchor)Q.add(X.anchor)}}),Q}function b00(J,Q){for(let Z=1;;++Z){let X=`${J}${Z}`;if(!Q.has(X))return X}}function GP6(J,Q){let Z=[],X=new Map,Y=null;return{onAnchor:(K)=>{Z.push(K),Y??(Y=x00(J));let q=b00(Q,Y);return Y.add(q),q},setAnchors:()=>{for(let K of Z){let q=X.get(K);if(typeof q==="object"&&q.anchor&&(_00.isScalar(q.node)||_00.isCollection(q.node)))q.node.anchor=q.anchor;else{let G=Error("Failed to resolve repeated object (this should not happen)");throw G.source=K,G}}},sourceObjects:X}}zP6.anchorIsValid=qP6;zP6.anchorNames=x00;zP6.createNodeAnchors=GP6;zP6.findNewAnchor=b00});var yF1=a((BP6)=>{function Ck(J,Q,Z,X){if(X&&typeof X==="object")if(Array.isArray(X))for(let Y=0,K=X.length;Y<K;++Y){let q=X[Y],G=Ck(J,X,String(Y),q);if(G===void 0)delete X[Y];else if(G!==q)X[Y]=G}else if(X instanceof Map)for(let Y of Array.from(X.keys())){let K=X.get(Y),q=Ck(J,X,Y,K);if(q===void 0)X.delete(Y);else if(q!==K)X.set(Y,q)}else if(X instanceof Set)for(let Y of Array.from(X)){let K=Ck(J,X,Y,Y);if(K===void 0)X.delete(Y);else if(K!==Y)X.delete(Y),X.add(K)}else for(let[Y,K]of Object.entries(X)){let q=Ck(J,X,Y,K);if(q===void 0)delete X[Y];else if(q!==K)X[Y]=q}return J.call(Q,Z,X)}BP6.applyReviver=Ck});var YD=a((VP6)=>{var MP6=d9();function y00(J,Q,Z){if(Array.isArray(J))return J.map((X,Y)=>y00(X,String(Y),Z));if(J&&typeof J.toJSON==="function"){if(!Z||!MP6.hasAnchor(J))return J.toJSON(Q,Z);let X={aliasCount:0,count:1,res:void 0};Z.anchors.set(J,X),Z.onCreate=(K)=>{X.res=K,delete Z.onCreate};let Y=J.toJSON(Q,Z);if(Z.onCreate)Z.onCreate(Y);return Y}if(typeof J==="bigint"&&!Z?.keep)return Number(J);return J}VP6.toJS=y00});var zn=a((wP6)=>{var LP6=yF1(),f00=d9(),AP6=YD();class h00{constructor(J){Object.defineProperty(this,f00.NODE_TYPE,{value:J})}clone(){let J=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)J.range=this.range.slice();return J}toJS(J,{mapAsMap:Q,maxAliasCount:Z,onAnchor:X,reviver:Y}={}){if(!f00.isDocument(J))throw TypeError("A document argument is required");let K={anchors:new Map,doc:J,keep:!0,mapAsMap:Q===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},q=AP6.toJS(this,"",K);if(typeof X==="function")for(let{count:G,res:z}of K.anchors.values())X(z,G);return typeof Y==="function"?LP6.applyReviver(Y,{"":q},"",q):q}}wP6.NodeBase=h00});var Sk=a((IP6)=>{var OP6=Gn(),jP6=Tk(),Aj=d9(),$P6=zn(),EP6=YD();class g00 extends $P6.NodeBase{constructor(J){super(Aj.ALIAS);this.source=J,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(J,Q){let Z;if(Q?.aliasResolveCache)Z=Q.aliasResolveCache;else if(Z=[],jP6.visit(J,{Node:(Y,K)=>{if(Aj.isAlias(K)||Aj.hasAnchor(K))Z.push(K)}}),Q)Q.aliasResolveCache=Z;let X=void 0;for(let Y of Z){if(Y===this)break;if(Y.anchor===this.source)X=Y}return X}toJSON(J,Q){if(!Q)return{source:this.source};let{anchors:Z,doc:X,maxAliasCount:Y}=Q,K=this.resolve(X,Q);if(!K){let G=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(G)}let q=Z.get(K);if(!q)EP6.toJS(K,null,Q),q=Z.get(K);if(!q||q.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(Y>=0){if(q.count+=1,q.aliasCount===0)q.aliasCount=Un(X,K,Z);if(q.count*q.aliasCount>Y)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return q.res}toString(J,Q,Z){let X=`*${this.source}`;if(J){if(OP6.anchorIsValid(this.source),J.options.verifyAliasOrder&&!J.anchors.has(this.source)){let Y=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(Y)}if(J.implicitKey)return`${X} `}return X}}function Un(J,Q,Z){if(Aj.isAlias(Q)){let X=Q.resolve(J),Y=Z&&X&&Z.get(X);return Y?Y.count*Y.aliasCount:0}else if(Aj.isCollection(Q)){let X=0;for(let Y of Q.items){let K=Un(J,Y,Z);if(K>X)X=K}return X}else if(Aj.isPair(Q)){let X=Un(J,Q.key,Z),Y=Un(J,Q.value,Z);return Math.max(X,Y)}return 1}IP6.Alias=g00});var T7=a((kP6)=>{var TP6=d9(),CP6=zn(),SP6=YD(),vP6=(J)=>!J||typeof J!=="function"&&typeof J!=="object";class L3 extends CP6.NodeBase{constructor(J){super(TP6.SCALAR);this.value=J}toJSON(J,Q){return Q?.keep?this.value:SP6.toJS(this.value,J,Q)}toString(){return String(this.value)}}L3.BLOCK_FOLDED="BLOCK_FOLDED";L3.BLOCK_LITERAL="BLOCK_LITERAL";L3.PLAIN="PLAIN";L3.QUOTE_DOUBLE="QUOTE_DOUBLE";L3.QUOTE_SINGLE="QUOTE_SINGLE";kP6.Scalar=L3;kP6.isScalarValue=vP6});var vk=a((gP6)=>{var bP6=Sk(),A3=d9(),m00=T7(),yP6="tag:yaml.org,2002:";function fP6(J,Q,Z){if(Q){let X=Z.filter((K)=>K.tag===Q),Y=X.find((K)=>!K.format)??X[0];if(!Y)throw Error(`Tag ${Q} not found`);return Y}return Z.find((X)=>X.identify?.(J)&&!X.format)}function hP6(J,Q,Z){if(A3.isDocument(J))J=J.contents;if(A3.isNode(J))return J;if(A3.isPair(J)){let W=Z.schema[A3.MAP].createNode?.(Z.schema,null,Z);return W.items.push(J),W}if(J instanceof String||J instanceof Number||J instanceof Boolean||typeof BigInt<"u"&&J instanceof BigInt)J=J.valueOf();let{aliasDuplicateObjects:X,onAnchor:Y,onTagObj:K,schema:q,sourceObjects:G}=Z,z=void 0;if(X&&J&&typeof J==="object")if(z=G.get(J),z)return z.anchor??(z.anchor=Y(J)),new bP6.Alias(z.anchor);else z={anchor:null,node:null},G.set(J,z);if(Q?.startsWith("!!"))Q=yP6+Q.slice(2);let U=fP6(J,Q,q.tags);if(!U){if(J&&typeof J.toJSON==="function")J=J.toJSON();if(!J||typeof J!=="object"){let W=new m00.Scalar(J);if(z)z.node=W;return W}U=J instanceof Map?q[A3.MAP]:(Symbol.iterator in Object(J))?q[A3.SEQ]:q[A3.MAP]}if(K)K(U),delete Z.onTagObj;let F=U?.createNode?U.createNode(Z.schema,J,Z):typeof U?.nodeClass?.from==="function"?U.nodeClass.from(Z.schema,J,Z):new m00.Scalar(J);if(Q)F.tag=Q;else if(!U.default)F.tag=U.tag;if(z)z.node=F;return F}gP6.createNode=hP6});var Fn=a((dP6)=>{var uP6=vk(),Bz=d9(),pP6=zn();function fF1(J,Q,Z){let X=Z;for(let Y=Q.length-1;Y>=0;--Y){let K=Q[Y];if(typeof K==="number"&&Number.isInteger(K)&&K>=0){let q=[];q[K]=X,X=q}else X=new Map([[K,X]])}return uP6.createNode(X,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:J,sourceObjects:new Map})}var u00=(J)=>J==null||typeof J==="object"&&!!J[Symbol.iterator]().next().done;class p00 extends pP6.NodeBase{constructor(J,Q){super(J);Object.defineProperty(this,"schema",{value:Q,configurable:!0,enumerable:!1,writable:!0})}clone(J){let Q=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(J)Q.schema=J;if(Q.items=Q.items.map((Z)=>Bz.isNode(Z)||Bz.isPair(Z)?Z.clone(J):Z),this.range)Q.range=this.range.slice();return Q}addIn(J,Q){if(u00(J))this.add(Q);else{let[Z,...X]=J,Y=this.get(Z,!0);if(Bz.isCollection(Y))Y.addIn(X,Q);else if(Y===void 0&&this.schema)this.set(Z,fF1(this.schema,X,Q));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}}deleteIn(J){let[Q,...Z]=J;if(Z.length===0)return this.delete(Q);let X=this.get(Q,!0);if(Bz.isCollection(X))return X.deleteIn(Z);else throw Error(`Expected YAML collection at ${Q}. Remaining path: ${Z}`)}getIn(J,Q){let[Z,...X]=J,Y=this.get(Z,!0);if(X.length===0)return!Q&&Bz.isScalar(Y)?Y.value:Y;else return Bz.isCollection(Y)?Y.getIn(X,Q):void 0}hasAllNullValues(J){return this.items.every((Q)=>{if(!Bz.isPair(Q))return!1;let Z=Q.value;return Z==null||J&&Bz.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn(J){let[Q,...Z]=J;if(Z.length===0)return this.has(Q);let X=this.get(Q,!0);return Bz.isCollection(X)?X.hasIn(Z):!1}setIn(J,Q){let[Z,...X]=J;if(X.length===0)this.set(Z,Q);else{let Y=this.get(Z,!0);if(Bz.isCollection(Y))Y.setIn(X,Q);else if(Y===void 0&&this.schema)this.set(Z,fF1(this.schema,X,Q));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}}}dP6.Collection=p00;dP6.collectionFromPath=fF1;dP6.isEmptyPath=u00});var kk=a((rP6)=>{var nP6=(J)=>J.replace(/^(?!$)(?: $)?/gm,"#");function hF1(J,Q){if(/^\n+$/.test(J))return J.substring(1);return Q?J.replace(/^(?! *$)/gm,Q):J}var aP6=(J,Q,Z)=>J.endsWith(`
128
128
  `)?hF1(Z,Q):Z.includes(`
129
129
  `)?`
@@ -6191,7 +6191,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||uR}function pZ6(J,Q){let
6191
6191
  `;async function iZ6(J,Q,Z,X){let Y=performance.now(),K=[...c_(gM1(J)),{role:"user",parts:[{text:T59.replace("{USER_GOAL}",Q)}]}],q=await C$(vr,K,[],J,Z,X,{responseMimeType:"application/json",responseJsonSchema:M0.toJSONSchema(lZ6)}),G=lZ6.parse(JSON.parse(q.message.text??"")),z=performance.now()-Y;return l.debug("Thread handoff prepared",{threadId:J.id,goalLength:Q.length,instructionsLength:G.instructions.length,fileCount:G.relevantFiles.length,durationMs:Math.round(z)}),{instructions:G.instructions,relevantFiles:G.relevantFiles}}UL();H8();_6();function nZ6(J){let Q=J.trim();if(Q==="quit"||Q==="exit")return"/quit";return J}function aZ6(J,Q,Z){if(J.agentMode)return J.agentMode;if(Q?.agentMode){let X=Q.agentMode;if(X==="free"){if(Z?.canUseAmpFree??!1)return"free";return"smart"}return X}return"smart"}z0();nB();import C59 from"node:fs";import rZ6 from"node:path";function sZ6(J){let Q=J.trim().replace(/^["']|["']$/g,"");if(Q=Q.replace(/\\(.)/g,"$1"),!/\.(png|jpe?g|gif|webp)$/i.test(Q))return null;if(!rZ6.isAbsolute(Q))return null;return l.debug("Extracted image path",{original:J,extracted:Q}),Q}function oZ6(J){try{let Q=rZ6.extname(J).toLowerCase(),Z=Te1(Q);if(!Z)return l.warn("Unsupported image file extension",{ext:Q}),null;try{let X=C59.readFileSync(J);return S59(X,Z)}catch(X){l.error(`Failed to read image file ${J}:`,X)}}catch(Q){l.error("Error handling image file path",{imagePath:J,error:Q})}return null}function S59(J,Q){if(J.length>EF)return l.warn(`Image file too large: ${J.length} bytes (max: ${EF})`),null;return{type:"image",source:{type:"base64",data:J.toString("base64"),mediaType:Q}}}import{execSync as OK6}from"node:child_process";import{rmdir as $Y9}from"node:fs/promises";import{tmpdir as EY9}from"node:os";import jK6 from"node:path";aO();z0();import{spawn as v59}from"node:child_process";import{promises as k59}from"node:fs";function tZ6(J){return J.kind==="executable"}function eZ6(J){return J.kind==="markdown"}var lH=50000,JX6=300000;async function wy1(J,Q,Z,X={}){let{timeoutMs:Y=JX6,signal:K}=X;try{let q=await Z.getCommand(J);if(!q)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Z.isCommandAvailable(J))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(l.debug("Executing command",{commandName:J,filePath:q.filePath,args:Q}),eZ6(q))return await _59(q,Q);else if(tZ6(q))return await x59(q,Q,Y,K);else return{success:!1,output:"",error:"Unsupported command type"}}catch(q){return l.error("Failed to execute command",{commandName:J,error:q}),{success:!1,output:"",error:q instanceof Error?q.message:"Unknown error occurred"}}}async function _59(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await k59.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>lH?Z.slice(0,lH)+`
6192
6192
  ... (output truncated at ${lH} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function x59(J,Q,Z=JX6,X){return new Promise((Y)=>{let[K,q]=b59(J,Q);l.debug("Spawning command",{spawnCommand:K,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Z});let G=$e1(X),z=!1,U=setTimeout(()=>{z=!0,G.abort(),l.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),F=v59(K,q,{stdio:["pipe","pipe","pipe"],signal:G.signal,detached:!0}),W=[],H=[],B=0;F.stdout?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=lH)W.push(V);else{let N=lH-(B-V.length);if(N>0)W.push(V.slice(0,N))}}),F.stderr?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=lH)H.push(V);else{let N=lH-(B-V.length);if(N>0)H.push(V.slice(0,N))}}),F.on("close",(M)=>{if(clearTimeout(U),z){Y({success:!1,output:W.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(G.signal.aborted){Y({success:!1,output:W.join(""),error:"The command was aborted",exitCode:M??void 0});return}let V=M===0||M===1,N=W.join(""),L=H.join(""),A=N;if(!V&&!N.trim()&&L.trim())A=L;else if(L.trim())A+=N?`
6193
6193
  ${L}`:L;if(B>lH)A+=`
6194
- ... (output truncated at ${lH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),F.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:W.join(""),error:V})})})}function b59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return f59(Z,X?[...X]:null,Y,Q);else return y59(Z,X?[...X]:null,Y,Q)}function y59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function f59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}z0();Tj();z2();TB();CY();hF();_6();T0();import{mkdtemp as IY9,readFile as PY9,unlink as TY9,writeFile as ew2}from"fs/promises";var K51={};R6(K51,{scrollUp:()=>XJ9,scrollDown:()=>YJ9,link:()=>FJ9,image:()=>WJ9,iTerm:()=>HJ9,exitAlternativeScreen:()=>zJ9,eraseUp:()=>ZJ9,eraseStartLine:()=>JJ9,eraseScreen:()=>Ry1,eraseLines:()=>t59,eraseLine:()=>YX6,eraseEndLine:()=>e59,eraseDown:()=>QJ9,enterAlternativeScreen:()=>GJ9,cursorUp:()=>ZX6,cursorTo:()=>m59,cursorShow:()=>o59,cursorSavePosition:()=>l59,cursorRestorePosition:()=>i59,cursorPrevLine:()=>r59,cursorNextLine:()=>a59,cursorMove:()=>u59,cursorLeft:()=>XX6,cursorHide:()=>s59,cursorGetPosition:()=>n59,cursorForward:()=>d59,cursorDown:()=>p59,cursorBackward:()=>c59,clearTerminal:()=>qJ9,clearScreen:()=>KJ9,beep:()=>UJ9});import Oy1 from"node:process";var Y51=globalThis.window?.document!==void 0,eL2=globalThis.process?.versions?.node!==void 0,JA2=globalThis.process?.versions?.bun!==void 0,QA2=globalThis.Deno?.version?.deno!==void 0,ZA2=globalThis.process?.versions?.electron!==void 0,XA2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,YA2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,KA2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,qA2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,GA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Cu=globalThis.navigator?.userAgentData?.platform,zA2=Cu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",UA2=Cu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",FA2=Cu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",WA2=Cu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),HA2=Cu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var V2="\x1B[",vu="\x1B]",WC="\x07",Su=";",QX6=!Y51&&Oy1.env.TERM_PROGRAM==="Apple_Terminal",h59=!Y51&&Oy1.platform==="win32",g59=Y51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Oy1.cwd,m59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return V2+(J+1)+"G";return V2+(Q+1)+Su+(J+1)+"H"},u59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=V2+-J+"D";else if(J>0)Z+=V2+J+"C";if(Q<0)Z+=V2+-Q+"A";else if(Q>0)Z+=V2+Q+"B";return Z},ZX6=(J=1)=>V2+J+"A",p59=(J=1)=>V2+J+"B",d59=(J=1)=>V2+J+"C",c59=(J=1)=>V2+J+"D",XX6=V2+"G",l59=QX6?"\x1B7":V2+"s",i59=QX6?"\x1B8":V2+"u",n59=V2+"6n",a59=V2+"E",r59=V2+"F",s59=V2+"?25l",o59=V2+"?25h",t59=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=YX6+(Z<J-1?ZX6():"");if(J)Q+=XX6;return Q},e59=V2+"K",JJ9=V2+"1K",YX6=V2+"2K",QJ9=V2+"J",ZJ9=V2+"1J",Ry1=V2+"2J",XJ9=V2+"S",YJ9=V2+"T",KJ9="\x1Bc",qJ9=h59?`${Ry1}${V2}0f`:`${Ry1}${V2}3J${V2}H`,GJ9=V2+"?1049h",zJ9=V2+"?1049l",UJ9=WC,FJ9=(J,Q)=>[vu,"8",Su,Su,Q,WC,J,vu,"8",Su,Su,WC].join(""),WJ9=(J,Q={})=>{let Z=`${vu}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+WC},HJ9={setCwd:(J=g59())=>`${vu}50;CurrentDir=${J}${WC}`,annotation(J,Q={}){let Z=`${vu}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+WC}};var q51=m6(WX6(),1);function rV(J,Q,{target:Z="stdout",...X}={}){if(!q51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (​${Q}​)`}return K51.link(J,Q)}rV.isSupported=q51.default.stdout;rV.stderr=(J,Q,Z={})=>rV(J,Q,{target:"stderr",...Z});rV.stderr.isSupported=q51.default.stderr;z0();CY();class Py1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1760990140-g391ead"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await nn(Q,this.configService)}catch(Q){l.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}import{execFile as z51}from"node:child_process";import{platform as Ty1}from"node:os";import{promisify as VJ9}from"node:util";var G51=VJ9(z51),NJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,LJ9="\x1B]52;c;?\x1B\\",AJ9="\x1B]52;p;?\x1B\\";class HX6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await G51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=z51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=z51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=z51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery(LJ9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await G51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await G51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await G51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(AJ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Ty1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(Ty1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=NJ9(Z);process.stdout.write(X);return}if(Ty1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var zY=new HX6;z0();class U51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class p7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function BX6(J){if(J instanceof U51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof p7)return{title:"Info",description:J.message,type:"info"};return l.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var ZN=null,CY9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(ZN)return Error("Already connected. Use /disconnect first to reconnect.");let{connectedClientsService:Z}=J;await Z.start({clientId:J.clientId,currentThreadID:J.worker.thread.id});let Y=Z.getCurrentStatus().clientID||"unknown",{connectBackground:K}=await Promise.resolve().then(() => (fb1(),xJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{ZN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});ZN=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{ZN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,F=new URL(`/threads/${U}`,z).toString(),W=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => m6(Of1(),1))).toString(F,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){l.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:W,qrCode:H});else return new p7(`Continue at ${W}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!ZN)return new p7("Not connected to Amp web interface");try{ZN.disconnect();let Z=ZN.clientID;return ZN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new p7(`Disconnected from Amp web interface
6194
+ ... (output truncated at ${lH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),F.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:W.join(""),error:V})})})}function b59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return f59(Z,X?[...X]:null,Y,Q);else return y59(Z,X?[...X]:null,Y,Q)}function y59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function f59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}z0();Tj();z2();TB();CY();hF();_6();T0();import{mkdtemp as IY9,readFile as PY9,unlink as TY9,writeFile as ew2}from"fs/promises";var K51={};R6(K51,{scrollUp:()=>XJ9,scrollDown:()=>YJ9,link:()=>FJ9,image:()=>WJ9,iTerm:()=>HJ9,exitAlternativeScreen:()=>zJ9,eraseUp:()=>ZJ9,eraseStartLine:()=>JJ9,eraseScreen:()=>Ry1,eraseLines:()=>t59,eraseLine:()=>YX6,eraseEndLine:()=>e59,eraseDown:()=>QJ9,enterAlternativeScreen:()=>GJ9,cursorUp:()=>ZX6,cursorTo:()=>m59,cursorShow:()=>o59,cursorSavePosition:()=>l59,cursorRestorePosition:()=>i59,cursorPrevLine:()=>r59,cursorNextLine:()=>a59,cursorMove:()=>u59,cursorLeft:()=>XX6,cursorHide:()=>s59,cursorGetPosition:()=>n59,cursorForward:()=>d59,cursorDown:()=>p59,cursorBackward:()=>c59,clearTerminal:()=>qJ9,clearScreen:()=>KJ9,beep:()=>UJ9});import Oy1 from"node:process";var Y51=globalThis.window?.document!==void 0,eL2=globalThis.process?.versions?.node!==void 0,JA2=globalThis.process?.versions?.bun!==void 0,QA2=globalThis.Deno?.version?.deno!==void 0,ZA2=globalThis.process?.versions?.electron!==void 0,XA2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,YA2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,KA2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,qA2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,GA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Cu=globalThis.navigator?.userAgentData?.platform,zA2=Cu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",UA2=Cu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",FA2=Cu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",WA2=Cu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),HA2=Cu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var V2="\x1B[",vu="\x1B]",WC="\x07",Su=";",QX6=!Y51&&Oy1.env.TERM_PROGRAM==="Apple_Terminal",h59=!Y51&&Oy1.platform==="win32",g59=Y51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Oy1.cwd,m59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return V2+(J+1)+"G";return V2+(Q+1)+Su+(J+1)+"H"},u59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=V2+-J+"D";else if(J>0)Z+=V2+J+"C";if(Q<0)Z+=V2+-Q+"A";else if(Q>0)Z+=V2+Q+"B";return Z},ZX6=(J=1)=>V2+J+"A",p59=(J=1)=>V2+J+"B",d59=(J=1)=>V2+J+"C",c59=(J=1)=>V2+J+"D",XX6=V2+"G",l59=QX6?"\x1B7":V2+"s",i59=QX6?"\x1B8":V2+"u",n59=V2+"6n",a59=V2+"E",r59=V2+"F",s59=V2+"?25l",o59=V2+"?25h",t59=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=YX6+(Z<J-1?ZX6():"");if(J)Q+=XX6;return Q},e59=V2+"K",JJ9=V2+"1K",YX6=V2+"2K",QJ9=V2+"J",ZJ9=V2+"1J",Ry1=V2+"2J",XJ9=V2+"S",YJ9=V2+"T",KJ9="\x1Bc",qJ9=h59?`${Ry1}${V2}0f`:`${Ry1}${V2}3J${V2}H`,GJ9=V2+"?1049h",zJ9=V2+"?1049l",UJ9=WC,FJ9=(J,Q)=>[vu,"8",Su,Su,Q,WC,J,vu,"8",Su,Su,WC].join(""),WJ9=(J,Q={})=>{let Z=`${vu}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+WC},HJ9={setCwd:(J=g59())=>`${vu}50;CurrentDir=${J}${WC}`,annotation(J,Q={}){let Z=`${vu}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+WC}};var q51=m6(WX6(),1);function rV(J,Q,{target:Z="stdout",...X}={}){if(!q51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (​${Q}​)`}return K51.link(J,Q)}rV.isSupported=q51.default.stdout;rV.stderr=(J,Q,Z={})=>rV(J,Q,{target:"stderr",...Z});rV.stderr.isSupported=q51.default.stderr;z0();CY();class Py1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1760990359-g26e9bd"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await nn(Q,this.configService)}catch(Q){l.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}import{execFile as z51}from"node:child_process";import{platform as Ty1}from"node:os";import{promisify as VJ9}from"node:util";var G51=VJ9(z51),NJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,LJ9="\x1B]52;c;?\x1B\\",AJ9="\x1B]52;p;?\x1B\\";class HX6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await G51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=z51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=z51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=z51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery(LJ9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await G51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await G51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await G51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(AJ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(Ty1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(Ty1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=NJ9(Z);process.stdout.write(X);return}if(Ty1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var zY=new HX6;z0();class U51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class p7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function BX6(J){if(J instanceof U51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof p7)return{title:"Info",description:J.message,type:"info"};return l.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var ZN=null,CY9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(ZN)return Error("Already connected. Use /disconnect first to reconnect.");let{connectedClientsService:Z}=J;await Z.start({clientId:J.clientId,currentThreadID:J.worker.thread.id});let Y=Z.getCurrentStatus().clientID||"unknown",{connectBackground:K}=await Promise.resolve().then(() => (fb1(),xJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{ZN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});ZN=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{ZN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,F=new URL(`/threads/${U}`,z).toString(),W=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => m6(Of1(),1))).toString(F,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){l.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:W,qrCode:H});else return new p7(`Continue at ${W}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!ZN)return new p7("Not connected to Amp web interface");try{ZN.disconnect();let Z=ZN.clientID;return ZN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new p7(`Disconnected from Amp web interface
6195
6195
  Client ID: ${Z}
6196
6196
  Server will clean up automatically within 60 seconds`)}catch(Z){return Error(`Failed to disconnect: ${Z.message}`)}}}};class jf1{configService;commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=tC(),Q){this.configService=Q;this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Z)=>this.latestCustom=Z),this.telemetrySubmitter=new Py1(async()=>{try{return(await this.configService.getLatest()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}},this.configService),this.configService.config.pipe(C0((Z)=>AB(Z.settings)),o6()).subscribe((Z)=>{this._initBaseCommands(Z.length>1)})}_initBaseCommands(J){if(this.commands={...SY9},process.env.AMP_CONNECT==="1")Object.assign(this.commands,CY9);if(J)Object.assign(this.commands,vY9)}async execute(J,Q,Z=[],X){this.telemetrySubmitter.submit(J).catch((G)=>{l.debug("Failed to submit command telemetry",G)});let Y=this.commands[J];if(Y)return Y.execute(Q,Z);let K=this.latestCustom.find((G)=>G.name===J),q=await wy1(J,Z,this.customRegistry,{signal:X});if(q.success)if(K?.kind==="markdown"){Q.editorDispatch({type:"set-input",input:q.output});return}else{Q.submitMessage(q.output);return}return Error(q.error??`Command '${J}' failed`)}query(J,Q,Z){let X=J.toLowerCase(),Y=Object.values(this.commands).filter((q)=>q.name.toLowerCase().includes(X)).filter((q)=>{if(!Q||!q.isVisible)return!0;return q.isVisible(Q,Z)}),K=this.latestCustom.filter((q)=>q.available&&q.name.toLowerCase().includes(X)).map((q)=>({name:q.name,description:"Custom command",requiresArgs:q.kind==="executable",execute:(G,z)=>this.execute(q.name,G,z??[])}));return[...Y,...K]}async cleanup(){await this.telemetrySubmitter.dispose()}get(J){let Q=this.commands[J];if(Q)return Q;let Z=this.latestCustom.find((X)=>X.name===J);return{name:J,description:"Custom command",requiresArgs:Z?.kind==="executable",execute:(X,Y)=>this.execute(J,X,Y??[])}}}var SY9={"generate-agent-file":{name:"generate-agent-file",description:`Generate an ${Z5} file in the current workspace`,execute:async(J,Q)=>{let Z=await J.configService.getLatest(),X=bq(Z.settings),K=J.getInMemoryAgentModeOverride()??X;J.worker.handle({type:"user:message",message:{content:[{type:"text",text:q90}],agentMode:K}});return}},compact:{name:"compact",description:"Compact the thread. Optional: /compact [message] to queue a message after compaction",execute:async(J,Q)=>{if(J.thread.messages.length===0)return new U51;if(Q&&Q.length>0){let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}try{await J.worker.summarizeThread(new AbortController().signal)}catch(Z){return Z instanceof Error?Z:Error("Failed to compact thread")}},isVisible:(J)=>J.agentMode!=="free"},editor:{name:"editor",description:"Open $EDITOR to write a prompt",launchesWindow:!0,execute:async(J,Q)=>{try{let Z=process.env.EDITOR||process.env.VISUAL||"nano",X=await IY9(jK6.join(EY9(),"amp-edit-")),Y=jK6.join(X,"message.amp.md");OK6(`${Z} "${Y}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let q=(await PY9(Y,"utf-8")).trim();if(q)J.editorDispatch({type:"set-input",input:q})}catch(K){if(K?.code==="ENOENT")return;return l.error("Failed to read temporary file",K),Error("Failed to read editor content")}try{await TY9(Y),await $Y9(X)}catch(K){l.warn("Failed to clean up temporary file",K)}return}catch(Z){return l.error("Failed to open editor",Z),Error("Failed to open editor")}}},help:{name:"help",description:"Show help and hotkeys",execute:async(J,Q)=>{J.openHelp();return}},permissions:{name:"permissions",description:"Edit permission rules in $EDITOR, or `/permissions off|on` to toggle for this session",launchesWindow:!0,execute:async(J,Q)=>{if(Q&&Q.length>0){let Y=Q[0]?.trim().toLowerCase();switch(Y){case"on":try{return rG("dangerouslyAllowAll",!1),new p7("Amp is now following permissions rules for this session")}catch(K){return l.error("Failed to set dangerously allow all setting",K),Error("Failed to enable permissions for this session")}case"off":try{return rG("dangerouslyAllowAll",!0),new p7("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(K){return l.error("Failed to set dangerously allow all setting",K),Error("Failed to disable permissions for this session")}case"edit":break;default:return Error(`Invalid option: ${Y}. Use: on, off, or edit (or no argument for edit)`)}}let Z=await UC();if(Z===null)return Error("No editor found, please set $EDITOR to edit permissions");let X="";try{let Y={stdin:process.stdin,stdout:process.stdout,stderr:{write:(K)=>{return X=K.toString(),!0}},exit:(K)=>{if(K!==0)throw l.error("editPermissions exited with status",K),Error(X)},settingsFile:J.settingsFilePath,resolveEditor:UC};await Q51(Y);return}catch(Y){l.error("failed to open permissions editor:",Y);let K=Y instanceof Error?`: ${Y.message}`:"";return Error(`Failed to open ${Z}${K}`)}finally{process.stdout.write("\x1B[?25l")}}},new:{name:"new",description:"Start a new thread",execute:async(J,Q)=>{try{await J.startNewThread();return}catch(Z){return l.error("Failed to start new thread",Z),Error("Failed to start new thread")}},isVisible:(J)=>J.messages.length!==0},handoff:{name:"handoff",description:"Start new focused thread with relevant files and prompt: /handoff <your goal>",statusMessage:"Handing off...",requiresArgs:!0,execute:async()=>{return},isVisible:(J)=>J.messages.length!==0&&J.agentMode!=="free"},continue:{name:"continue",description:"Continue an existing thread",requiresArgs:!1,requiresPicker:!0,execute:async(J,Q)=>{try{if(Q&&Q.length>0){let Z=Q[0]?.trim();if(!Z)return Error("Invalid thread ID provided");return await J.switchToThread(Z),new p7(`Switched to existing thread: ${Z}`)}await J.pickAndContinueThread();return}catch(Z){return l.error("Failed to continue thread",Z),Error("Failed to continue thread")}}},queue:{name:"queue",description:"Queue a message to send when inference completes. If no inference running, sends immediately.",requiresArgs:!0,execute:async(J,Q)=>{if(!Q||Q.length===0)return Error("Queue command requires a message argument. Usage: /queue <message>");let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}},dequeue:{name:"dequeue",description:"Dequeue all messages and restore them to the prompt editor",execute:async(J,Q)=>{let Z=J.thread.queuedMessages??[];if(Z.length===0)return;let Y=Z.map((K)=>{return K.queuedMessage.content.filter((G)=>G.type==="text").map((G)=>G.text).join("").trim()}).filter(Boolean).join(`
6197
6197
  `).trim();await J.worker.handle({type:"user:message-queue:discard"}),J.editorDispatch({type:"set-input",input:Y})},isVisible:(J)=>(J.queuedMessages?.length??0)>0},share:{name:"share",description:"Set thread visibility - `/share private|workspace|group|public`",execute:async(J,Q)=>{let{thread:Z,threadSyncService:X,ampURL:Y}=J;if(!Q||Q.length===0)return Error("Please specify a visibility option: private, workspace, group, or public");let K=Cj(new URL(Y),Z.id).toString(),G=`Thread URL: ${rV(K,K,{fallback:()=>K})}`,z=Q[0]?.trim().toLowerCase(),U;switch(z){case"private":U={visibility:"private",sharedGroupIDs:[]};break;case"workspace":U={visibility:"thread_workspace_shared"};break;case"group":U={visibility:"private",sharedGroupIDs:[],shareWithAllCreatorGroups:!0};break;case"public":U={visibility:"public"};break;default:return Error(`Invalid visibility option: ${z}. Use: private, workspace, group, or public`)}try{return await X.updateThreadMeta(Z.id,U),new p7(`${G}
@@ -6400,7 +6400,7 @@ ${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTr
6400
6400
  `),J.stdout.write(`Thread: ${H}
6401
6401
  `),J.stdout.write(`Continue this thread with: amp threads continue ${F}
6402
6402
  `)}}function Hu1(J){return J==="smart"?k1.rgb(3,197,97):J==="fast"?k1.rgb(228,180,2):J==="free"?k1.rgb(0,184,255):AW9(J)}function AW9(J){let Q=0;for(let Y=0;Y<J.length;Y++){let K=J.charCodeAt(Y);Q=(Q<<5)-Q+K,Q=Q&Q}let Z=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Z.length;return k1.index(Z[X])}df1();if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){n7.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
6403
- `)}var Du1=Bu1.join(pc1||Bu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function $W9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function JF(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")rG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new g9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${V8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")rG("experimental.agentMode",Q.agentMode)}async function Vu1(J){try{await RW9(Bu1.dirname(Du1),{recursive:!0}),await OW9(Du1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function EW9(){try{return(await fF6(Du1,"utf-8")).trim()}catch(J){return null}}function IW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return pl1("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var xF6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??GY,description:`Custom settings file path (overrides the default location ${GY})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(l).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Ib1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:gK(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:Ed}],bF6=(J)=>("deprecated"in J)&&J.deprecated===!0,PW9=(J)=>("hidden"in J)&&J.hidden===!0,TW9=(J)=>("default"in J),CW9=(J)=>("default"in J)?J.default:void 0;function SW9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new g9(hK.unknownCommand(Z),1,q)}}var hF6=null;function Wt2(){return hF6}function nJ1(J){return{...J,getThreadEnvironment:T71,vfs:c20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new F_(J.fileSystem),generateThreadTitle:KG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var Nu1=j0.file(jW9.homedir()),gF6=process.env.XDG_CONFIG_HOME?j0.file(process.env.XDG_CONFIG_HOME):y0.joinPath(Nu1,".config");async function QF(J,Q){ii1("0.0.1760990140-g391ead");let Z=sZ1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:e1.of([j0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Nu1,userConfigDir:gF6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (lJ1(),cJ1));X(Z);let Y=await Z.getLatest();l.debug("Global configuration initialized",{settingsKeys:Object.keys(Y.settings)});let K=Ua(zO({configService:Z})),q=w20({configService:Z,toolService:K}),G=IR0(K,T9,ye).catch((w)=>{l.warn("Toolbox registration failed, continuing anyway:",w)}),z=q.initialized.catch((w)=>{l.warn("MCP service initialization failed, continuing anyway:",w)});if(J.executeMode)await Promise.all([z,G]);if(Q.jetbrains)WO("JetBrains");else if(Q.ide&&mQ6())WO("VS Code");else if(Q.ide&&uQ6())WO("Neovim");if(J.executeMode)ni1(!0);k96(K,{configService:Z});let U,F=v5.status.pipe(C0((w)=>Boolean(w.connected&&w.authenticated)),o6()).subscribe((w)=>{if(w){if(!U)U=K.registerTool(Qs)}else U?.dispose(),U=void 0}),W;if(!J.executeMode)W=new p71(process.cwd(),{},!0);else W=new class extends p71{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(s2.write(`No API key found. Starting login flow...
6403
+ `)}var Du1=Bu1.join(pc1||Bu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function $W9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function JF(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")rG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new g9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${V8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")rG("experimental.agentMode",Q.agentMode)}async function Vu1(J){try{await RW9(Bu1.dirname(Du1),{recursive:!0}),await OW9(Du1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function EW9(){try{return(await fF6(Du1,"utf-8")).trim()}catch(J){return null}}function IW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return pl1("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var xF6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??GY,description:`Custom settings file path (overrides the default location ${GY})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(l).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${Ib1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:gK(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:Ed}],bF6=(J)=>("deprecated"in J)&&J.deprecated===!0,PW9=(J)=>("hidden"in J)&&J.hidden===!0,TW9=(J)=>("default"in J),CW9=(J)=>("default"in J)?J.default:void 0;function SW9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new g9(hK.unknownCommand(Z),1,q)}}var hF6=null;function Wt2(){return hF6}function nJ1(J){return{...J,getThreadEnvironment:T71,vfs:c20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new F_(J.fileSystem),generateThreadTitle:KG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var Nu1=j0.file(jW9.homedir()),gF6=process.env.XDG_CONFIG_HOME?j0.file(process.env.XDG_CONFIG_HOME):y0.joinPath(Nu1,".config");async function QF(J,Q){ii1("0.0.1760990359-g26e9bd");let Z=sZ1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:e1.of([j0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:Nu1,userConfigDir:gF6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (lJ1(),cJ1));X(Z);let Y=await Z.getLatest();l.debug("Global configuration initialized",{settingsKeys:Object.keys(Y.settings)});let K=Ua(zO({configService:Z})),q=w20({configService:Z,toolService:K}),G=IR0(K,T9,ye).catch((w)=>{l.warn("Toolbox registration failed, continuing anyway:",w)}),z=q.initialized.catch((w)=>{l.warn("MCP service initialization failed, continuing anyway:",w)});if(J.executeMode)await Promise.all([z,G]);if(Q.jetbrains)WO("JetBrains");else if(Q.ide&&mQ6())WO("VS Code");else if(Q.ide&&uQ6())WO("Neovim");if(J.executeMode)ni1(!0);k96(K,{configService:Z});let U,F=v5.status.pipe(C0((w)=>Boolean(w.connected&&w.authenticated)),o6()).subscribe((w)=>{if(w){if(!U)U=K.registerTool(Qs)}else U?.dispose(),U=void 0}),W;if(!J.executeMode)W=new p71(process.cwd(),{},!0);else W=new class extends p71{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(s2.write(`No API key found. Starting login flow...
6404
6404
  `),!await vW9(J))await tw(),process.exit(1)}let H=await r20({isDevelopment:!1}),B=new $H1(H),M=new OH1(H,Z,{lazy:!0}),V=Q.notifications!==void 0?Q.notifications:!J.executeMode,N=x96({playNotificationSound:async(w)=>{if(V){_96(w);let R=uf1(),O=pf1();if((!R||O)&&Y.settings["notifications.system.enabled"]!==!1){if(w==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(w==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:B,configService:Z});l.info("Starting Amp background services");let L=e20({threadService:B,threadHistoryService:M,configService:Z,isExtensionDevelopment:!1}),A={configService:Z,toolService:K,mcpService:q,threadService:B,threadHistoryService:M,threadSyncService:L,threadStorage:H,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:W,notificationService:N,fileSystem:Q.jetbrains||Q.ide?u20:T9};return{...A,async asyncDispose(){await A.mcpService.dispose(),await A.threadService.asyncDispose(),A.configService.unsubscribe(),A.toolService.dispose(),A.fuzzyServer.dispose(),A.threadSyncService.dispose(),A.settingsStorage[Symbol.dispose](),F.unsubscribe(),U?.dispose()}}}async function vW9(J){if(!J.executeMode){if(!await By1("Would you like to log in to Amp? [(y)es, (n)o]: "))return s2.write(`Login cancelled. Run the command again to retry.
6405
6405
  `),!1}return await mF6(J)}async function mF6(J){let Q=wW9(32).toString("hex"),Z=await Hy1(J.ampURL,Q);try{await uK(Z)}catch(Y){l.error("Failed to open browser",{error:Y})}let X=await Hy1(J.ampURL,Q,!1);s2.write(`If your browser did not open automatically, visit:
6406
6406
 
@@ -6410,12 +6410,12 @@ ${V8.blue.bold(X)}
6410
6410
  Login successful! You can now use the Amp CLI.
6411
6411
  `),!0}catch(Y){return l.error("Login failed",{error:Y}),n7.write(`
6412
6412
  Login failed: ${Y instanceof Error?Y.message:String(Y)}
6413
- `),!1}}function kW9(){let J=new e41().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)ZR(),process.exit(0);let H=W.originalError??W;fJ6(H)}),J.option("-V, --version","output the version number",()=>{s2.write(`0.0.1760990140-g391ead (released 2025-10-20T20:01:41.464Z)
6414
- `),process.exit(0)}),J.addHelpText("after",fQ6()),J.configureHelp({formatHelp:hQ6}),J.command("logout").description("Log out by removing stored API key").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await yW9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await bW9(M,await Jy1(B,M.settings))});let Q=async(W,H,B)=>{sZ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([j0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:Nu1,userConfigDir:gF6});let M={...H,executeMode:!1};await Mu1(M,{...W,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await yF6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await pW9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);if(H.pick)await Q(M,V,B);else await uW9(M,V,W,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);await mW9(M,V,W,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await yF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);await gW9(M,V,W,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);await hW9(M,V,W,B)}),pZ6(J,async(W,H)=>{let B=await MY(H);JF(W,H);let M=await QF(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:ZR,asyncDispose:M.asyncDispose.bind(M)}}),MZ6(J),GZ6(J,async(W)=>{let H=await MY(W);return{settings:H.settings,getThreadDeps:async(B)=>{JF(B,W);let M=await QF(H,W);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);JF(H,B);let V=await QF(M,B);try{await yb1(V,V.configService,{})}finally{await V.asyncDispose(),await ZR()}});let X=new e41().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(W)=>{await Gy1(W.force||!1,W.verbose||!1,"0.0.1760990140-g391ead"),process.exit()});J.addCommand(X,{hidden:!0});function Y(W,H,B){let V=typeof W.description==="string"?W.description:B===void 0?W.description(!0):W.description(B),N=new hV(H,V),L=CW9(W);if(L)N.default(L);if(N.hidden=PW9(W)||bF6(W),"choices"in W)N.choices([...W.choices]);return N}for(let W of xF6)switch(W.type){case"flag":{J.addOption(Y(W,`--${W.long}`)),J.addOption(Y(W,`--no-${W.long}`,!1));break}case"switch":{J.addOption(Y(W,`--${W.long}`,!0));break}default:{J.addOption(Y(W,`--${W.long} <value>`));break}}let K=new hV("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(K);let q=new hV("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(q);let G=new hV("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1);J.addOption(G);let z=new hV("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(z);let U=new hV("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(U),process.env.AMP_CONNECT==="1"){let W=new hV("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(W)}J.action(async(W,H)=>{let B=W,M=await MY(B);if(Object.keys(B).forEach((V)=>{let N=xF6.find((L)=>L.name===V);if(N&&bF6(N)&&!TW9(N))n7.write(V8.yellow(`Warning: '--${V}' flag is deprecated
6413
+ `),!1}}function kW9(){let J=new e41().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)ZR(),process.exit(0);let H=W.originalError??W;fJ6(H)}),J.option("-V, --version","output the version number",()=>{s2.write(`0.0.1760990359-g26e9bd (released 2025-10-20T20:04:45.771Z)
6414
+ `),process.exit(0)}),J.addHelpText("after",fQ6()),J.configureHelp({formatHelp:hQ6}),J.command("logout").description("Log out by removing stored API key").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await yW9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await bW9(M,await Jy1(B,M.settings))});let Q=async(W,H,B)=>{sZ1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([j0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:Nu1,userConfigDir:gF6});let M={...H,executeMode:!1};await Mu1(M,{...W,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await yF6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await pW9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);if(H.pick)await Q(M,V,B);else await uW9(M,V,W,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);await mW9(M,V,W,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);await yF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);await gW9(M,V,W,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await MY(M);await hW9(M,V,W,B)}),pZ6(J,async(W,H)=>{let B=await MY(H);JF(W,H);let M=await QF(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:ZR,asyncDispose:M.asyncDispose.bind(M)}}),MZ6(J),GZ6(J,async(W)=>{let H=await MY(W);return{settings:H.settings,getThreadDeps:async(B)=>{JF(B,W);let M=await QF(H,W);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await MY(B);JF(H,B);let V=await QF(M,B);try{await yb1(V,V.configService,{})}finally{await V.asyncDispose(),await ZR()}});let X=new e41().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(W)=>{await Gy1(W.force||!1,W.verbose||!1,"0.0.1760990359-g26e9bd"),process.exit()});J.addCommand(X,{hidden:!0});function Y(W,H,B){let V=typeof W.description==="string"?W.description:B===void 0?W.description(!0):W.description(B),N=new hV(H,V),L=CW9(W);if(L)N.default(L);if(N.hidden=PW9(W)||bF6(W),"choices"in W)N.choices([...W.choices]);return N}for(let W of xF6)switch(W.type){case"flag":{J.addOption(Y(W,`--${W.long}`)),J.addOption(Y(W,`--no-${W.long}`,!1));break}case"switch":{J.addOption(Y(W,`--${W.long}`,!0));break}default:{J.addOption(Y(W,`--${W.long} <value>`));break}}let K=new hV("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(K);let q=new hV("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(q);let G=new hV("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1);J.addOption(G);let z=new hV("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(z);let U=new hV("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(U),process.env.AMP_CONNECT==="1"){let W=new hV("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(W)}J.action(async(W,H)=>{let B=W,M=await MY(B);if(Object.keys(B).forEach((V)=>{let N=xF6.find((L)=>L.name===V);if(N&&bF6(N)&&!TW9(N))n7.write(V8.yellow(`Warning: '--${V}' flag is deprecated
6415
6415
  `))}),H.args.length>0)SW9(M,H);await Mu1(M,B,H)});let F=new e41("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(W)=>{await fW9(W.version)});return J.addCommand(F),J}async function iJ1(J,Q){let{thread:Z,visibility:X}=Q,Y=Z?.id??Xq(),K=nJ1(J);if(Z)await J.threadStorage.set(Y,Z);let q=await uJ.getOrCreateForThread(K,Y);if(X)await J.threadSyncService.updateThreadMeta(Y,e71(X));let G=J.threadService.observe(Y).subscribe(async(z)=>{if(a7(z,"assistant"))await Vu1(Y),G.unsubscribe()});return await q.resume(),q}async function Mu1(J,Q,Z){let X=t71(Q);if(X instanceof Error)fG(X.message);let Y,K=null;if(Q.streamJsonInput)Y="";else if(typeof Q.execute==="string"){Y=Q.execute;let R=(await My1()).trimEnd();if(R)K=R}else Y=(await My1()).trimEnd();if(Q.remote&&!J.executeMode)throw new g9("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new g9("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new g9("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new g9("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if((J.executeMode||Q.streamJson)&&Q.agentMode&&Q.agentMode!=="smart")throw new g9(`Execute mode is not permitted with --agent-mode '${Q.agentMode}'`,1);if(Q.stats&&!J.executeMode)throw new g9("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new g9("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&Y===""&&!Q.streamJsonInput)throw new g9("User message must be provided through stdin or as argument when using execute mode",1,`Either pass a message as an argument: amp --execute "your message"
6416
6416
  Or pipe via stdin: echo "your message" | amp --execute`);JF(Z,Q);let q=await QF(J,Q);hF6=q;let G=nJ1(q),z=async(R)=>{let O=await fF6(R,"utf-8"),$=JSON.parse(O);if(!WF($.id))throw new g9(hK.invalidThreadId);return iJ1(q,{visibility:X,thread:$})},U=async(R)=>{if(!WF(R))throw new g9(hK.invalidThreadId);let O=await q.threadService.get(R)??void 0;if(l.info(`[fetchAndStartThread] Loaded thread ${R}, agentMode: ${O?.agentMode??"undefined"}`),O?.agentMode)l.info(`[fetchAndStartThread] Setting runtime override for agentMode to: ${O.agentMode}`),rG("experimental.agentMode",O.agentMode);else l.info("[fetchAndStartThread] No agentMode on thread, not setting override");return iJ1(q,{visibility:X,thread:O})},F=async()=>{try{if(Q.threadId)return U(Q.threadId);else return iJ1(q,{visibility:X})}catch(R){if(R instanceof g9)throw R;throw await x71(R,Q.threadId),Error("handleError should have called process.exit()")}},W=async()=>{return iJ1(q,{visibility:X})};if(Q.format==="jsonl")n7.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
6417
- `),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await VZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await F();if(J.executeMode)await sJ6(H,H.threadID,Y,K,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await Ur1();let R=await EO({jetbrainsOnly:Q.jetbrains});if(R.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(R.length===1){let O=R[0];if(O)v5.selectConfig(O)}else B=!0}let V=Fy1("0.0.1760990140-g391ead",q.settingsStorage),N=e1.of([j0.file(process.cwd())]),L=tC(void 0,N);if(Y)H.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}});let A;try{A=await YJ.getUserFreeTierStatus({},{config:q.configService})}catch(R){A={ok:!1,error:R}}l.info("User free tier status:",A);let w=await wZ6();l.info("Loaded session state:",w),await _F6({stdout:process.stdout,history:new ub1,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadSyncService:q.threadSyncService,threadID:H.threadID,worker:H,workerDeps:G,configService:q.configService,internalAPIClient:YJ,ampURL:J.ampURL,startNewThread:W,pickAndContinueThread:async()=>{l.info("Thread picker requested - not yet implemented in TUI")},switchToThread:U,ideClient:v5,connectedClientsService:new td,commandRegistry:L,showJetBrainsInstaller:M,showIdePicker:B,startWithPicker:Q.startWithPicker,updateService:V,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:w,freeTierStatus:A.ok?A.result:void 0}),await q.asyncDispose(),process.exit(0)}async function MY(J){if(J.interactive)n7.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
6418
- `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await pU(J.settingsFile),Y=dU({...J,settingsFile:X,getHook:process.env.AMP_URL?(G,z)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return z()}:void 0});if(await RZ6(Y),await OZ6(Y),J.mcpConfig){let G=await zZ6(J.mcpConfig);Y=IW9(Y,G)}let K=await Y.get("url","global");if(!K)K=zZ;if(!wB(K))l.info("Targeting custom Amp server",{ampURL:K});if(Y=zl1(Y),await Y.get("debug.httpLogging"))Kl1();return{executeMode:Q,isTTY:Z,ampURL:K,settings:Y,secrets:NZ6(await Jy1(J,Y))}}function _W9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function xW9(){let J=_W9(process.argv);if(LJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),$W9(l),l.info("Starting Amp CLI.",{version:"0.0.1760990140-g391ead",buildTimestamp:"2025-10-20T20:01:41.464Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new g9(hK.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await kW9().parseAsync(process.argv)}xW9().catch(x71);async function bW9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),s2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
6417
+ `),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await VZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await F();if(J.executeMode)await sJ6(H,H.threadID,Y,K,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await Ur1();let R=await EO({jetbrainsOnly:Q.jetbrains});if(R.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(R.length===1){let O=R[0];if(O)v5.selectConfig(O)}else B=!0}let V=Fy1("0.0.1760990359-g26e9bd",q.settingsStorage),N=e1.of([j0.file(process.cwd())]),L=tC(void 0,N);if(Y)H.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}});let A;try{A=await YJ.getUserFreeTierStatus({},{config:q.configService})}catch(R){A={ok:!1,error:R}}l.info("User free tier status:",A);let w=await wZ6();l.info("Loaded session state:",w),await _F6({stdout:process.stdout,history:new ub1,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadSyncService:q.threadSyncService,threadID:H.threadID,worker:H,workerDeps:G,configService:q.configService,internalAPIClient:YJ,ampURL:J.ampURL,startNewThread:W,pickAndContinueThread:async()=>{l.info("Thread picker requested - not yet implemented in TUI")},switchToThread:U,ideClient:v5,connectedClientsService:new td,commandRegistry:L,showJetBrainsInstaller:M,showIdePicker:B,startWithPicker:Q.startWithPicker,updateService:V,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:w,freeTierStatus:A.ok?A.result:void 0}),await q.asyncDispose(),process.exit(0)}async function MY(J){if(J.interactive)n7.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
6418
+ `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await pU(J.settingsFile),Y=dU({...J,settingsFile:X,getHook:process.env.AMP_URL?(G,z)=>{if(G==="url")return Promise.resolve(process.env.AMP_URL);return z()}:void 0});if(await RZ6(Y),await OZ6(Y),J.mcpConfig){let G=await zZ6(J.mcpConfig);Y=IW9(Y,G)}let K=await Y.get("url","global");if(!K)K=zZ;if(!wB(K))l.info("Targeting custom Amp server",{ampURL:K});if(Y=zl1(Y),await Y.get("debug.httpLogging"))Kl1();return{executeMode:Q,isTTY:Z,ampURL:K,settings:Y,secrets:NZ6(await Jy1(J,Y))}}function _W9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function xW9(){let J=_W9(process.argv);if(LJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),$W9(l),l.info("Starting Amp CLI.",{version:"0.0.1760990359-g26e9bd",buildTimestamp:"2025-10-20T20:04:45.771Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new g9(hK.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await kW9().parseAsync(process.argv)}xW9().catch(x71);async function bW9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),s2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
6419
6419
  `);else if(!wB(J.ampURL))s2.write(`Logging in to ${new URL(J.ampURL).hostname}
6420
6420
  `);let Z=process.env.AMP_API_KEY;if(Z)s2.write(`API key found in environment variable, storing...
6421
6421
  `),await Q.set("apiKey",Z,J.ampURL),s2.write(`API key successfully stored.
@@ -6431,7 +6431,7 @@ Or pipe via stdin: echo "your message" | amp --execute`);JF(Z,Q);let q=await QF(
6431
6431
  `));try{let Q;if(J)Q=J,n7.write(V8.blue(`Updating to version ${J}...
6432
6432
  `)),await GC(J),n7.write(V8.green(`✓ Successfully updated to version ${J}
6433
6433
  `));else{n7.write(V8.blue(`Checking for updates...
6434
- `));let{hasUpdate:X,latestVersion:Y}=await r41("0.0.1760990140-g391ead");if(!X)n7.write(V8.green(`✓ Amp CLI is already up to date.
6434
+ `));let{hasUpdate:X,latestVersion:Y}=await r41("0.0.1760990359-g26e9bd");if(!X)n7.write(V8.green(`✓ Amp CLI is already up to date.
6435
6435
  `)),process.exit(0);if(!Y)n7.write(V8.yellow("[WARN] could not find latest version")),process.exit(0);Q=Y,n7.write(V8.blue(`Updating to version ${Y}...
6436
6436
  `)),await GC(Y),n7.write(V8.green(`✓ Successfully updated to version ${Y}
6437
6437
  `))}let Z=await qR(Q);if(Z.warning)n7.write(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourcegraph/amp",
3
- "version": "0.0.1760990140-g391ead",
3
+ "version": "0.0.1760990359-g26e9bd",
4
4
  "description": "CLI for Amp, an agentic coding tool built by Sourcegraph.",
5
5
  "homepage": "https://ampcode.com/",
6
6
  "author": {