@sourcegraph/amp 0.0.1780014135-gb8f1f5 → 0.0.1780032159-g3925ab
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +16 -16
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -4409,7 +4409,7 @@ ${I}`)}}if(A.skipParseResponse)return;try{let J=new Uint8Array(await F.arrayBuff
|
|
|
4409
4409
|
`,D)}while(B!==-1);return E+=A.slice(D),E}var{stdout:PX4,stderr:TX4}=LX4,Mx0=Symbol("GENERATOR"),hP=Symbol("STYLER"),ic=Symbol("IS_EMPTY"),vX4=["ansi","ansi","ansi256","ansi16m"],gP=Object.create(null),qo6=(A,Q={})=>{if(Q.level&&!(Number.isInteger(Q.level)&&Q.level>=0&&Q.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let $=PX4?PX4.level:0;A.level=Q.level===void 0?$:Q.level};var wo6=(A)=>{let Q=(...$)=>$.join(" ");return qo6(Q,A),Object.setPrototypeOf(Q,nc.prototype),Q};function nc(A){return wo6(A)}Object.setPrototypeOf(nc.prototype,Function.prototype);for(let[A,Q]of Object.entries(dF))gP[A]={get(){let $=mB0(this,jx0(Q.open,Q.close,this[hP]),this[ic]);return Object.defineProperty(this,A,{value:$}),$}};gP.visible={get(){let A=mB0(this,this[hP],!0);return Object.defineProperty(this,"visible",{value:A}),A}};var Lx0=(A,Q,$,...B)=>{if(A==="rgb"){if(Q==="ansi16m")return dF[$].ansi16m(...B);if(Q==="ansi256")return dF[$].ansi256(dF.rgbToAnsi256(...B));return dF[$].ansi(dF.rgbToAnsi(...B))}if(A==="hex")return Lx0("rgb",Q,$,...dF.hexToRgb(...B));return dF[$][A](...B)},Oo6=["rgb","hex","ansi256"];for(let A of Oo6){gP[A]={get(){let{level:$}=this;return function(...B){let D=jx0(Lx0(A,vX4[$],"color",...B),dF.color.close,this[hP]);return mB0(this,D,this[ic])}}};let Q="bg"+A[0].toUpperCase()+A.slice(1);gP[Q]={get(){let{level:$}=this;return function(...B){let D=jx0(Lx0(A,vX4[$],"bgColor",...B),dF.bgColor.close,this[hP]);return mB0(this,D,this[ic])}}}}var Mo6=Object.defineProperties(()=>{},{...gP,level:{enumerable:!0,get(){return this[Mx0].level},set(A){this[Mx0].level=A}}}),jx0=(A,Q,$)=>{let B,D;if($===void 0)B=A,D=Q;else B=$.openAll+A,D=Q+$.closeAll;return{open:A,close:Q,openAll:B,closeAll:D,parent:$}},mB0=(A,Q,$)=>{let B=(...D)=>Lo6(B,D.length===1?""+D[0]:D.join(" "));return Object.setPrototypeOf(B,Mo6),B[Mx0]=A,B[hP]=Q,B[ic]=$,B},Lo6=(A,Q)=>{if(A.level<=0||!Q)return A[ic]?"":Q;let $=A[hP];if($===void 0)return Q;let{openAll:B,closeAll:D}=$;if(Q.includes("\x1B"))while($!==void 0)Q=jX4(Q,$.close,$.open),$=$.parent;let E=Q.indexOf(`
|
|
4410
4410
|
`);if(E!==-1)Q=RX4(Q,D,B,E);return B+Q+D};Object.defineProperties(nc.prototype,gP);var jo6=nc(),Jf$=nc({level:TX4?TX4.level:0});var f0=jo6;var aX4=N4(nX4(),1),{program:zf$,createCommand:Kf$,createArgument:Cf$,createOption:Wf$,CommanderError:oX4,InvalidArgumentError:cB0,InvalidOptionArgumentError:uf$,Command:fX,Argument:Hf$,Option:pF,Help:Nf$}=aX4.default;var jf$=process.hrtime.bigint(),fx0=null;function rX4(){fx0=process.hrtime.bigint()}function sX4(){if(fx0===null)return null;return Number(process.hrtime.bigint()-fx0)/1e6}function pB0(A){return A instanceof Error&&"code"in A&&A.code==="EPIPE"}function tX4(){process.stdout.on("error",(A)=>{if(!pB0(A))throw A;process.exit(0)})}import dP from"node:fs";import cP from"node:path";He();function xx0(A,Q){let $=Q.formatter??Ve,B=Q.encoder??new TextEncoder,D=Q.maxSize??1048576,E=Q.maxFiles??5,F=Q.bufferSize??8192,J=Q.flushInterval??5000,U=0;try{U=Q.statSync(A).size}catch{}let Y=Q.openSync(A),Z=Date.now(),X="";function I(w){return U+w.length>D}function G(){Q.closeSync(Y);for(let w=E-1;w>0;w--){let M=`${A}.${w}`,R=`${A}.${w+1}`;try{Q.renameSync(M,R)}catch(S){}}Q.renameSync(A,`${A}.1`),U=0,Y=Q.openSync(A)}if(!Q.nonBlocking){let w=function(){if(X.length>0){let R=B.encode(X);if(X="",I(R))G();Q.writeSync(Y,R),Q.flushSync(Y),U+=R.length,Z=Date.now()}},M=(R)=>{X+=$(R);let S=X.length>=F,P=J>0&&R.timestamp-Z>=J;if(S||P)w()};return M[Symbol.dispose]=()=>{w(),Q.closeSync(Y)},M}let V=Q,z=!1,K=null,C=null;async function W(){if(X.length===0)return;let w=X;X="";try{let M=B.encode(w);if(I(M))G();V.writeSync(Y,M),await V.flush(Y),U+=M.length,Z=Date.now()}catch{}}function u(){if(K||z)return;K=W().finally(()=>{K=null})}function H(){if(C!==null||z)return;C=setInterval(()=>{u()},J)}let N=(w)=>{if(z)return;X+=$(w);let M=X.length>=F,R=J>0&&w.timestamp-Z>=J;if(M||R)u();else if(C===null&&J>0)H()};return N[Symbol.asyncDispose]=async()=>{if(z=!0,C!==null)clearInterval(C),C=null;await W();try{await V.close(Y)}catch{}},N}import aB from"node:fs";import{join as eX4}from"node:path";import{promisify as lB0}from"node:util";var yx0={openSync(A){return aB.openSync(A,"a")},writeSync:aB.writeSync,writeManySync(A,Q){if(Q.length===0)return;if(Q.length===1){aB.writeSync(A,Q[0]);return}aB.writevSync(A,Q)},flushSync:aB.fsyncSync,closeSync:aB.closeSync,statSync:aB.statSync,renameSync:aB.renameSync},AI4={...yx0,async writeMany(A,Q){if(Q.length===0)return;if(Q.length===1){await lB0(aB.write)(A,Q[0]);return}await lB0(aB.writev)(A,Q)},flush:lB0(aB.fsync),close:lB0(aB.close)},yf$={...yx0,readdirSync:aB.readdirSync,unlinkSync:aB.unlinkSync,mkdirSync:aB.mkdirSync,joinPath:eX4},bf$={...AI4,readdirSync:aB.readdirSync,unlinkSync:aB.unlinkSync,mkdirSync:aB.mkdirSync,joinPath:eX4};function bx0(A,Q={}){if(Q.nonBlocking)return xx0(A,{...Q,...AI4});return xx0(A,{...Q,...yx0})}He();h0();var hx0=N4(eA(),1);import{inspect as Jr6}from"node:util";function iB0(A,...Q){if(Q.length===0)return A;return($)=>{let B=$;for(let D of Q)B=D(B);A(B)}}var nB0=(A)=>{let Q=hx0.trace.getActiveSpan();if(!Q)return A;let{traceId:$,spanId:B}=Q.spanContext();return{...A,properties:{...A.properties,traceId:$,spanId:B}}},aB0=(A)=>{let Q=null;for(let $ of Object.keys(A.properties)){let B=A.properties[$];if(B instanceof Error)Q??={...A.properties},Q[$]=QI4(B)}return Q===null?A:{...A,properties:Q}},QI4=(A)=>({name:A.name,message:A.message,stack:A.stack,cause:A.cause instanceof Error?QI4(A.cause):A.cause}),gx0=(A)=>({...A,properties:{...A.properties,pid:process.pid}});var $I4=(A)=>{let Q=hx0.trace.getActiveSpan();if(!Q)return;Q.addEvent(Ur6(A.message),A.properties)};var mP={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",gray:"\x1B[90m"};var nf$={trace:mP.magenta,debug:mP.blue,info:mP.green,warning:mP.yellow,error:mP.red,fatal:mP.red};function Ur6(A,Q){let $="";for(let B=0;B<A.length;B++){let D=A[B];if(B%2===0)$+=typeof D==="string"?D:String(D);else $+=typeof D==="string"?D:Jr6(D,Q)}return $}var BI4=cP.join(EU,"logs"),Yr6=604800000,oB0=cP.join(BI4,"threads"),rc=cP.join(BI4,"cli.log"),Zr6=Number(process.env.AMP_MAX_LOG_FILE_SIZE)||10485760,Xr6={error:"error",warn:"warning",info:"info",debug:"debug"},mx0=!1,oc=null,dx0=!1;function cx0(){dx0=!0}function pP(A){return cP.join(oB0,`${A}.log`)}function DI4(A=Date.now()){let Q;try{Q=dP.readdirSync(oB0)}catch{return}let $=A-Yr6;for(let B of Q){if(!B.endsWith(".log"))continue;let D=cP.join(oB0,B);try{let E=dP.statSync(D);if(E.isFile()&&E.mtimeMs<$)dP.rmSync(D,{force:!0})}catch{}}}function EI4(A){oc=null,dx0=!1;let{logFile:Q,logLevel:$}=A,B=Xr6[mSA.catch("info").parse($)],D=ze({properties:"flatten"});return dP.mkdirSync(cP.dirname(Q),{recursive:!0}),_M(),Zy({sinks:{file:iB0(bx0(Q,{maxSize:Zr6,maxFiles:2,formatter:D}),gx0,nB0,aB0),otel:iB0($I4,nB0,aB0),thread:iB0(Ir6(oB0,D),gx0,nB0,aB0)},loggers:[{category:["logtape","meta"],sinks:["file"],lowestLevel:"warning"},{category:[],sinks:["file","otel","thread"],lowestLevel:B}]}),mx0=!0,Q}var rB0=new Map;function Ir6(A,Q){return($)=>{if(!dx0)return;let B=$.properties.threadId;if(typeof B!=="string"||B.length===0)return;try{let D=rB0.get(B);if(!D)dP.mkdirSync(A,{recursive:!0}),D=dP.createWriteStream(pP(B),{flags:"a"}),rB0.set(B,D);D.write(Q($))}catch{}}}function JY(){if(oc)return oc;if(!mx0)return Promise.resolve();return oc=Gr6(),oc}async function Gr6(){await new Promise((D)=>{setImmediate(D)});let A=Array.from(rB0.values());rB0.clear();let Q=Promise.all(A.map((D)=>new Promise((E)=>D.end(()=>E())))),$,B=new Promise((D)=>{$=setTimeout(D,500)});try{await Promise.race([Promise.all([Q,We()]),B])}finally{if($)clearTimeout($)}try{_M()}catch{}mx0=!1}lA();h0();import*as FI4 from"node:child_process";import*as JI4 from"node:fs/promises";import*as UI4 from"node:path";import{promisify as zr6}from"node:util";function Vr6(A){if(A.startsWith("http://")||A.startsWith("https://"))try{let Q=new URL(A);return Q.username="",Q.password="",Q.toString()}catch{}return A}function sB0(A){let Q=["github.com","gitlab.com","bitbucket.org"];A=Vr6(A);let $=null,B=null,D=A.match(/^([^@]+)@([^:/]+)[:/](.+)$/);if(D&&D[1]&&D[2]&&D[3]){let E=D[1],F=D[2],J=D[3],U=E==="git",Y=F==="github.com"&&E.startsWith("org-");if(U||Y)$=F,B=J}if(!$||!B){let E=A.match(/^https?:\/\/([^/]+)\/(.+)$/);if(E&&E[1]&&E[2])$=E[1],B=E[2]}if(!$||!B){let E=A.match(/^([^:]+):(.+)$/);if(E&&E[1]&&E[2])$=E[1],B=E[2]}if($&&B&&Q.includes($)){let E=B.replace(/\.git$/,"").replace(/\/+$/,"").replace(/@[^/]+$/,"");return`https://${$}/${E}`.toLowerCase()}return A.replace(/\.git$/,"").replace(/\/+$/,"").replace(/@[^/]+$/,"").toLowerCase()}var px0=zr6(FI4.exec);async function YI4(A){let Q={displayName:l0.basename(A)};if(!Fy(A))return Q;Q.uri=bA(A);try{if(!await JI4.access(UI4.join(A.fsPath,".git")).then(()=>!0).catch(()=>!1))return Q;let{stdout:B}=await px0("git remote get-url origin",{cwd:A.fsPath}).catch(()=>({stdout:""}));if(!B.trim())return Q;let{stdout:D}=await px0("git symbolic-ref HEAD",{cwd:A.fsPath}).catch(()=>({stdout:""})),{stdout:E}=await px0("git rev-parse HEAD",{cwd:A.fsPath}).catch(()=>({stdout:""}));return{...Q,repository:{type:"git",url:sB0(B.trim()),ref:D.trim()||void 0,sha:E.trim()??void 0}}}catch($){return _.error("Error getting repository info:",$,{dir:A.fsPath}),Q}}LE();function tB0(){let A=SB(),Q=m40(),$=YbA();return{os:Q.os,osVersion:Q.osVersion,cpuArchitecture:Q.cpuArchitecture,webBrowser:Q.webBrowser,client:A.name,clientVersion:A.version,clientType:A.type,installationID:$?.installationID,deviceFingerprint:$?.deviceFingerprint}}lA();async function xX(){return{trees:[await YI4(y0.file(process.cwd()))],platform:tB0()}}h0();import{execFileSync as Kr6}from"node:child_process";import{mkdir as Cr6,writeFile as Wr6}from"node:fs/promises";import ur6 from"node:path";function lP(){if(process.platform==="win32")return"edit";return process.env.AMP_EDITOR||process.env.EDITOR||process.env.VISUAL||"vi"}async function Hr6(A){await Cr6(ur6.dirname(A),{recursive:!0});try{await Wr6(A,`{
|
|
4411
4411
|
}
|
|
4412
|
-
`,{encoding:"utf-8",flag:"wx",mode:384})}catch(Q){if(Q.code!=="EEXIST")throw Q}}async function Nr6(A){await Hr6(A);let Q=lP();try{Kr6(Q,[A],{stdio:"inherit"})}catch($){throw _.error("Failed to open settings file in editor",{editor:Q,settingsPath:A,error:$}),Error(`Failed to open ${Q}`)}}function ZI4(A,Q){let $=A.command("config").summary("Manage Amp configuration").description("Manage Amp configuration").action(()=>{$.outputHelp(),process.exit(0)});$.command("edit").summary("Open the Amp settings file in $EDITOR").description("Open the Amp settings file in $EDITOR. By default, this opens user settings. Use --workspace to edit the workspace-specific .amp/settings.json file.").option("--global","Edit user settings (default)").option("--workspace","Edit workspace settings").action(async(B,D)=>{if(B.global&&B.workspace)throw Error("Use only one of --global or --workspace");let E=await Q(D.optsWithGlobals()),F=B.workspace?E.settings.getWorkspaceSettingsPath():E.settings.getSettingsFilePath();await Nr6(F),process.exit(0)})}h0();import{execFile as qr6}from"node:child_process";import{promisify as wr6}from"node:util";var Or6=wr6(qr6),Mr6=["private","
|
|
4412
|
+
`,{encoding:"utf-8",flag:"wx",mode:384})}catch(Q){if(Q.code!=="EEXIST")throw Q}}async function Nr6(A){await Hr6(A);let Q=lP();try{Kr6(Q,[A],{stdio:"inherit"})}catch($){throw _.error("Failed to open settings file in editor",{editor:Q,settingsPath:A,error:$}),Error(`Failed to open ${Q}`)}}function ZI4(A,Q){let $=A.command("config").summary("Manage Amp configuration").description("Manage Amp configuration").action(()=>{$.outputHelp(),process.exit(0)});$.command("edit").summary("Open the Amp settings file in $EDITOR").description("Open the Amp settings file in $EDITOR. By default, this opens user settings. Use --workspace to edit the workspace-specific .amp/settings.json file.").option("--global","Edit user settings (default)").option("--workspace","Edit workspace settings").action(async(B,D)=>{if(B.global&&B.workspace)throw Error("Use only one of --global or --workspace");let E=await Q(D.optsWithGlobals()),F=B.workspace?E.settings.getWorkspaceSettingsPath():E.settings.getSettingsFilePath();await Nr6(F),process.exit(0)})}h0();import{execFile as qr6}from"node:child_process";import{promisify as wr6}from"node:util";var Or6=wr6(qr6),Mr6=["private","workspace"];function Lr6(A){switch(A){case"private":return{visibility:"private",sharedGroupIDs:[]};case"workspace":return{visibility:"thread_workspace_shared"};case"group":return{visibility:"private",shareWithAllCreatorGroups:!0}}}function lx0(A){return A.endsWith("/")?A.slice(0,-1):A}function jr6(A){let Q=sB0(A);try{let D=new URL(Q);return lx0(`${D.host}${D.pathname}`).replace(/^\//,"")}catch{}let $=Q.match(/^[^@]+@([^:/]+)[:/](.+)$/);if($?.[1]&&$[2])return lx0(`${$[1]}/${$[2]}`).replace(/\.git$/,"");let B=Q.match(/^([^:]+):(.+)$/);if(B?.[1]&&B[2])return lx0(`${B[1]}/${B[2]}`).replace(/\.git$/,"");return null}async function II4(A){try{let{stdout:Q}=await Or6("git",["remote","get-url","origin"],{cwd:A}),$=Q.trim();if(!$)return null;return jr6($)}catch{return null}}function Rr6(A){let Q=[...Mr6];if(A?.team?.disablePrivateThreads){let $=Q.indexOf("private");if($!==-1)Q.splice($,1)}if(A?.team?.groups&&A.team.groups.length>0)Q.push("group");return Q}function Pr6(A){if(A?.team?.groups!==void 0)return Error(["Group visibility is not available. ",`You are not a member of any group in this workspace.
|
|
4413
4413
|
`].join(""));return Error(`Group visibility is not available.
|
|
4414
4414
|
`)}function XI4(A,Q){let B=[`Invalid ${A?`visibility for amp.defaultVisibility.${A}`:"visibility"}. `,`Must be one of: ${Q.join(", ")}.
|
|
4415
4415
|
`].join("");return Error(B)}function Tr6(A,Q){return Q.includes(A)}function vr6(A){return A?.team?.billingMode==="enterprise"||A?.team?.billingMode==="enterprise.selfserve"}function GI4(A,Q,$){if(A===void 0||A===null)return;let B=Rr6(Q);if(typeof A!=="string")return XI4($,B);if(A==="group"&&!B.includes("group"))return Pr6(Q);if(Tr6(A,B))return A;return XI4($,B)}async function _r6(A,Q,$){let B=await II4(Q);if(!B)return;let D;try{D=await A.get("defaultVisibility")}catch(F){_.warn("Failed to read defaultVisibility setting",{error:F});return}let E=D?.[B];return GI4(E,$,B)}async function eB0(A,Q,$,B){if(B)return B;if(!vr6($))return;let D=await _r6(A,Q,$);if(D instanceof Error)return D;if(D===void 0)return;return Lr6(D)}function VI4(A,Q){return GI4(A,Q)}async function zI4(A,Q,$){let B=await II4(Q);if(!B)return Error("No git origin remote found for this repository.");let E={...await A.get("defaultVisibility","global")??{},[B]:$};return await A.set("defaultVisibility",E,"global"),{repoKey:B}}import{spawn as Sr6}from"node:child_process";async function kr6(A,Q,$){let B=Q.split("/");if(B.length!==2||!B[0]||!B[1])throw new MA("Drive must be specified as <workspace-or-user>/<drive-name>",1);let D=$??B[1],E=await A.secrets.get("apiKey",A.ampURL);if(!E)throw new MA("API key required. Please run `amp login` first.",1);let F=new URL(`/drive/${encodeURIComponent(B[0])}/${encodeURIComponent(B[1])}`,A.ampURL);F.username="x-amp-user",F.password=E;let J=Sr6("git",["clone",F.toString(),D],{stdio:"inherit"}),U=await new Promise((Y,Z)=>{J.once("error",Z),J.once("close",(X)=>Y(X??1))});if(U!==0)throw new MA(`git clone failed with exit code ${U}`,U)}function KI4(A,Q){A.command("drive",{hidden:!0}).description("Drive commands").command("clone <drive> [target-dir]",{hidden:!0}).description("Clone a workspace drive").action(async(B,D,E,F)=>{let J=F.optsWithGlobals(),U=await Q(J);await kr6(U,B,D),process.exit(process.exitCode??0)})}import{stderr as xz}from"node:process";h0();var vx$=Buffer.from([1]),_x$=Buffer.from([2]),Sx$=Buffer.from([3]),kx$=Buffer.from([4]),fx$=Buffer.from([5]),xx$=Buffer.from([6]),yx$=Buffer.from([8]),bx$=Buffer.from([11]),hx$=Buffer.from([12]),gx$=Buffer.from([14]),mx$=Buffer.from([16]),dx$=Buffer.from([21]),cx$=Buffer.from([23]),px$=Buffer.from([25]),lx$=Buffer.from([7]),ix$=Buffer.from([15]),nx$=Buffer.from([17]),ax$=Buffer.from([18]),ox$=Buffer.from([19]),rx$=Buffer.from([20]),sx$=Buffer.from([22]),tx$=Buffer.from([24]),ex$=Buffer.from([26]),Ay$=Buffer.from([27]),Qy$=Buffer.from([13]),$y$=Buffer.from([10]),By$=Buffer.from([127]),Dy$=Buffer.from([9]),Ey$=Buffer.from([27,91,90]),Fy$=Buffer.from([27,91,65]),Jy$=Buffer.from([27,91,66]),Uy$=Buffer.from([27,91,67]),Yy$=Buffer.from([27,91,68]),Zy$=Buffer.from([27,91,49,59,50,65]),Xy$=Buffer.from([27,91,49,59,50,66]),Iy$=Buffer.from([27,91,49,59,50,67]),Gy$=Buffer.from([27,91,49,59,50,68]),Vy$=Buffer.from([27,91,53,126]),zy$=Buffer.from([27,91,54,126]),Ky$=Buffer.from([27,91,72]),Cy$=Buffer.from([27,91,70]),Wy$=Buffer.from([27,91,49,126]),uy$=Buffer.from([27,91,52,126]),Hy$=Buffer.from([27,91,55,126]),Ny$=Buffer.from([27,91,56,126]),qy$=Buffer.from([27,91,51,126]),wy$=Buffer.from([27,91,50,126]),Oy$=Buffer.from([27,91,71]),My$=Buffer.from([27,91,49,48,126]),Ly$=Buffer.from([27,91,49,49,126]),jy$=Buffer.from([27,91,49,50,126]),Ry$=Buffer.from([27,91,49,51,126]),Py$=Buffer.from([27,91,49,52,126]),Ty$=Buffer.from([27,91,49,53,126]),vy$=Buffer.from([27,91,49,55,126]),_y$=Buffer.from([27,91,49,56,126]),Sy$=Buffer.from([27,91,49,57,126]),ky$=Buffer.from([27,91,50,48,126]),fy$=Buffer.from([27,91,50,49,126]),xy$=Buffer.from([27,91,50,51,126]),yy$=Buffer.from([27,91,50,52,126]),by$=Buffer.from([27,91,50,53,126]),hy$=Buffer.from([27,91,50,54,126]),gy$=Buffer.from([27,91,50,56,126]),my$=Buffer.from([27,91,50,57,126]),dy$=Buffer.from([27,91,51,49,126]),cy$=Buffer.from([27,91,51,50,126]),py$=Buffer.from([27,91,51,51,126]),ly$=Buffer.from([27,91,51,52,126]),iy$=Buffer.from([27,79,80]),ny$=Buffer.from([27,79,81]),ay$=Buffer.from([27,79,82]),oy$=Buffer.from([27,79,83]),ry$=Buffer.from([27,91,49,80]),sy$=Buffer.from([27,91,49,81]),ty$=Buffer.from([27,91,49,82]),ey$=Buffer.from([27,91,49,83]),Ab$=Buffer.from([27,102]),Qb$=Buffer.from([27,98]),$b$=Buffer.from([27,100]),Bb$=Buffer.from([27,127]),Db$=Buffer.from([27,91,49,59,51,65]),Eb$=Buffer.from([27,91,49,59,51,66]),Fb$=Buffer.from([27,91,49,59,53,65]),Jb$=Buffer.from([27,91,49,59,53,66]),Ub$=Buffer.from([27,91,49,59,53,68]),Yb$=Buffer.from([27,91,49,59,53,67]),Zb$=Buffer.from([27,91,49,50,55,59,53,117]),Xb$=Buffer.from([27,91,50,55,59,50,59,49,51,126]),Ib$=Buffer.from([27,91,50,55,59,53,59,49,51,126]),Gb$=Buffer.from([27,91,50,55,59,56,59,49,51,126]),CI4={ESC:Buffer.from([27,91,50,55,117]),CTRL_A:Buffer.from([27,91,57,55,59,53,117]),CTRL_B:Buffer.from([27,91,57,56,59,53,117]),CTRL_C:Buffer.from([27,91,57,57,59,53,117]),CTRL_D:Buffer.from([27,91,49,48,48,59,53,117]),CTRL_E:Buffer.from([27,91,49,48,49,59,53,117]),CTRL_F:Buffer.from([27,91,49,48,50,59,53,117]),CTRL_H:Buffer.from([27,91,49,48,52,59,53,117]),CTRL_K:Buffer.from([27,91,49,48,55,59,53,117]),CTRL_L:Buffer.from([27,91,49,48,56,59,53,117]),CTRL_N:Buffer.from([27,91,49,49,48,59,53,117]),CTRL_P:Buffer.from([27,91,49,49,50,59,53,117]),CTRL_U:Buffer.from([27,91,49,49,55,59,53,117]),CTRL_W:Buffer.from([27,91,49,49,57,59,53,117]),CTRL_Y:Buffer.from([27,91,49,50,49,59,53,117]),CTRL_G:Buffer.from([27,91,49,48,51,59,53,117]),CTRL_O:Buffer.from([27,91,49,49,49,59,53,117]),CTRL_Q:Buffer.from([27,91,49,49,51,59,53,117]),CTRL_R:Buffer.from([27,91,49,49,52,59,53,117]),CTRL_S:Buffer.from([27,91,49,49,53,59,53,117]),CTRL_T:Buffer.from([27,91,49,49,54,59,53,117]),CTRL_V:Buffer.from([27,91,49,49,56,59,53,117]),CTRL_X:Buffer.from([27,91,49,50,48,59,53,117]),CTRL_Z:Buffer.from([27,91,49,50,50,59,53,117]),ALT_B:Buffer.from([27,91,57,56,59,51,117]),ALT_F:Buffer.from([27,91,49,48,50,59,51,117]),ALT_D:Buffer.from([27,91,49,48,48,59,51,117]),ALT_BACKSPACE:Buffer.from([27,91,49,50,55,59,51,117]),ALT_ARROW_UP:Buffer.from([27,91,49,59,51,65]),ALT_ARROW_DOWN:Buffer.from([27,91,49,59,51,66]),CTRL_ARROW_UP:Buffer.from([27,91,49,59,53,65]),CTRL_ARROW_DOWN:Buffer.from([27,91,49,59,53,66]),CTRL_ARROW_LEFT:Buffer.from([27,91,49,59,53,68]),CTRL_ARROW_RIGHT:Buffer.from([27,91,49,59,53,67]),CTRL_BACKSPACE:Buffer.from([27,91,49,50,55,59,53,117]),SHIFT_BACKSPACE:Buffer.from([27,91,49,50,55,59,50,117]),SHIFT_TAB:Buffer.from([27,91,57,59,50,117]),SHIFT_ENTER:Buffer.from([27,91,49,51,59,50,117]),CTRL_ENTER:Buffer.from([27,91,49,51,59,53,117]),PAGE_UP:Buffer.from([27,91,53,117]),PAGE_DOWN:Buffer.from([27,91,54,117]),HOME:Buffer.from([27,91,72,117]),END:Buffer.from([27,91,70,117]),DEL:Buffer.from([27,91,81,117]),enable(){process.stderr.write("\x1B[=1u")},disable(){process.stderr.write("\x1B[=0u"),process.stderr.write("\x1B[<u")}};var fr6=process.env.AMP_DEBUG!==void 0&&process.env.AMP_DEBUG!=="0"&&!!process.env.AMP_DEBUG,CB={unknownCommand:(A)=>`Unknown command "${A}". Run 'amp --help' for the full list.`,badFlag:(A)=>`Invalid flag "${A}". See 'amp --help' for valid options.`,notLoggedIn:"Not logged in. Run 'amp login' to authenticate.",invalidAPIKey:"Invalid or missing API key. Run 'amp login' to authenticate.",authExpired:"Access token expired. Run 'amp login' to refresh.",networkTimeout:"Network timeout. Check your connection or proxy settings and retry.",networkOffline:"Cannot reach Amp servers. Are you offline?",serverError:"Amp server returned an error. Try again in a moment.",terminalTooSmall:"Terminal is too small. Resize the pane or window to at least 9 rows and try again.",webSocketConnectionFailed:"WebSocket connection failed. Check your connection or proxy settings and retry.",threadNotFound:(A)=>`Thread ${A} not found or you don't have access. Verify the ID.`,invalidThreadId:"Invalid thread ID format.",internalBug:`Unexpected error inside Amp CLI.${fr6?" Run with AMP_DEBUG=1 to see detailed logs.":""}`,nodeVersion:(A)=>`Amp CLI requires Node.js v20+. Current version: ${A}`};function JD(A){throw new MA(`Invalid thread ID or URL: ${A}`,1,"Provide a valid thread ID (e.g., T-5928a90d-d53b-488f-a829-4e36442142ee) or thread URL (e.g., https://ampcode.com/threads/T-5928a90d-d53b-488f-a829-4e36442142ee)")}function xr6(A){if(!(A instanceof Error))return!1;let Q=(A.message??"").toLowerCase()+(A.stack??"").toLowerCase();return["thread","threadservice","threadsync","threadworker","threadhistory","threadsummary","thread-"].some((B)=>Q.includes(B))}function ZN(){try{_.debug("cleanupTerminal() called"),CI4.disable(),xz.write("\x1B[?25h")}catch(A){}}function ix0(A){if(A instanceof MA)return{message:A.userMessage,suggestion:A.suggestion};if(A instanceof oX4)return{message:A.message};if(A instanceof Error){let Q=(A.message??"").toLowerCase();if(Q.includes("401")||Q.includes("unauthorized"))return{message:CB.invalidAPIKey};if(Q.includes("403")||Q.includes("forbidden"))return{message:CB.authExpired};if(Q.includes("timeout")||Q.includes("etimedout"))return{message:CB.networkTimeout};if(Q.includes("websocket connection failed")||Q.includes("websocket closed during connect")||Q.includes("expected 101 status code")||Q.includes("failed to get wstoken")||Q.includes("websocket is not connected"))return{message:CB.webSocketConnectionFailed};if(Q.includes("enotfound")||Q.includes("econnrefused")||Q.includes("unable to connect"))return{message:CB.networkOffline};if(/api request .* failed: 5\d\d/.test(Q))return{message:CB.serverError};if(Q.includes("minrows must be <= maxrows"))return{message:CB.terminalTooSmall};if(Q.includes("thread")&&Q.includes("not found"))return{message:"Thread not found or you don't have access."};if(Q.includes("fetch failed")||Q.includes("failed to fetch"))return{message:CB.networkOffline}}return{message:CB.internalBug}}function WI4(A,Q){let $=process.env.AMP_DEBUG==="1"||process.argv.includes("--debug");_.error("CLI Error",A);let{message:B,suggestion:D}=ix0(A);if(xz.write(f0.red.bold("Error: ")+B+`
|
|
@@ -4470,7 +4470,7 @@ password=${E}
|
|
|
4470
4470
|
`)),lF.write(f0.dim(`Copy the full URL from your browser address bar and paste it below.
|
|
4471
4471
|
`)),lF.write(`
|
|
4472
4472
|
`),await Ae6("Paste the callback URL or authorization code: ")}}async function Ae6(A){let Q=tt6({input:st6,output:lF});return new Promise(($,B)=>{Q.on("SIGINT",()=>{Q.close(),B(Error("OAuth authorization cancelled"))}),Q.question(A,(D)=>{Q.close(),$(D.trim())})})}function nG4(){if(process.env.AMP_HEADLESS_OAUTH==="1"||process.env.AMP_HEADLESS_OAUTH==="true")return!0;return cG4()}import{readFileSync as Qe6,rmSync as $e6}from"node:fs";import{mkdir as Be6,readFile as De6,rm as Gy0,writeFile as Ee6}from"node:fs/promises";import aG4 from"node:path";h0();var Fe6=aG4.join(EU,"pids");function Je6(A){try{return process.kill(A,0),!0}catch(Q){return Q.code==="EPERM"}}function oG4(A){let Q=A.trim();if(!/^\d+$/.test(Q))return;let $=Number.parseInt(Q,10);return Number.isSafeInteger($)&&$>0?$:void 0}function Vy0(A,Q){return A.code===Q}async function rG4(A){try{let Q=await De6(A,"utf-8"),$=oG4(Q);if($===void 0)return{kind:"invalid",value:Q.trim()};return{kind:"valid",pid:$}}catch(Q){if(Vy0(Q,"ENOENT"))return{kind:"missing"};throw Q}}async function Ue6(A,Q){let $=await rG4(A);if($.kind!=="valid"||$.pid!==Q)return;await Gy0(A,{force:!0}),_.info("Removed headless PID file",{currentPID:Q,pidFilePath:A})}function Ye6(A,Q){try{let $=Qe6(A,"utf-8");if(oG4($)!==Q)return}catch($){if(Vy0($,"ENOENT"))return;throw $}$e6(A,{force:!0})}async function sG4(A,Q={}){let $=Q.pidDir??Fe6,B=Q.currentPID??process.pid,D=Q.isProcessRunning??Je6,E=aG4.join($,`${A}.pid`);await Be6($,{recursive:!0});while(!0){let F=await rG4(E);if(F.kind==="valid"){if(D(F.pid))return _.info("Headless instance already running for thread, exiting",{pidFilePath:E,runningPID:F.pid,threadID:A}),{status:"already-running",pidFilePath:E,runningPID:F.pid};_.info("Replacing stale headless PID file",{pidFilePath:E,stalePID:F.pid,threadID:A}),await Gy0(E,{force:!0})}if(F.kind==="invalid")_.warn("Replacing invalid headless PID file content",{invalidPID:F.value,pidFilePath:E,threadID:A}),await Gy0(E,{force:!0});try{await Ee6(E,`${B}
|
|
4473
|
-
`,{encoding:"utf-8",flag:"wx",mode:384}),_.info("Claimed headless PID file",{currentPID:B,pidFilePath:E,threadID:A});let J=!1,U=()=>{if(J)return;J=!0,Ye6(E,B)},Y=(I)=>{if(U(),process.off("SIGINT",Z),process.off("SIGTERM",X),process.listenerCount(I)===0)process.kill(process.pid,I)},Z=()=>Y("SIGINT"),X=()=>Y("SIGTERM");return process.once("exit",U),process.on("SIGINT",Z),process.on("SIGTERM",X),{status:"claimed",pidFilePath:E,release:async()=>{if(J)return;await Ue6(E,B),J=!0,process.off("exit",U),process.off("SIGINT",Z),process.off("SIGTERM",X)}}}catch(J){if(Vy0(J,"EEXIST"))continue;throw J}}}fZ();var tG4={"agent.skipTitleGenerationIfMessageContains":{value:[],visible:!1,description:"List of strings that, if present in a message, will skip title generation"},"anthropic.interleavedThinking.enabled":{value:!1,visible:!1,description:"Enable interleaved thinking for Claude 4 models (allows reasoning between tool calls)"},"anthropic.provider":{value:"anthropic",visible:!1,description:'Which provider to use for Anthropic Claude inference: "anthropic" or "vertex"'},"anthropic.speed":{value:void 0,visible:!1,description:"Fast speed toggle for Opus modes (Anthropic fast mode, billed at a premium)"},"anthropic.temperature":{value:1,visible:!1,description:"Temperature setting for Anthropic models (0.0 = deterministic, 1.0 = creative). Note: Only takes effect when thinking is disabled. Internal use only."},"anthropic.thinking.enabled":{value:!1,visible:!1,description:"Enable Claude thinking process output for debugging"},bitbucketToken:{value:void 0,visible:!0,description:"Personal access token for Bitbucket Enterprise. Used with a workspace-level Bitbucket connection configured by an admin."},dangerouslyAllowAll:{value:!1,visible:!0,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},defaultVisibility:{value:{"github.com/sourcegraph/amp":"workspace"},visible:!0,description:["Define default thread visibility per repository origin using mappings like ",'"github.com/org/repo": "workspace". Values: private,
|
|
4473
|
+
`,{encoding:"utf-8",flag:"wx",mode:384}),_.info("Claimed headless PID file",{currentPID:B,pidFilePath:E,threadID:A});let J=!1,U=()=>{if(J)return;J=!0,Ye6(E,B)},Y=(I)=>{if(U(),process.off("SIGINT",Z),process.off("SIGTERM",X),process.listenerCount(I)===0)process.kill(process.pid,I)},Z=()=>Y("SIGINT"),X=()=>Y("SIGTERM");return process.once("exit",U),process.on("SIGINT",Z),process.on("SIGTERM",X),{status:"claimed",pidFilePath:E,release:async()=>{if(J)return;await Ue6(E,B),J=!0,process.off("exit",U),process.off("SIGINT",Z),process.off("SIGTERM",X)}}}catch(J){if(Vy0(J,"EEXIST"))continue;throw J}}}fZ();var tG4={"agent.skipTitleGenerationIfMessageContains":{value:[],visible:!1,description:"List of strings that, if present in a message, will skip title generation"},"anthropic.interleavedThinking.enabled":{value:!1,visible:!1,description:"Enable interleaved thinking for Claude 4 models (allows reasoning between tool calls)"},"anthropic.provider":{value:"anthropic",visible:!1,description:'Which provider to use for Anthropic Claude inference: "anthropic" or "vertex"'},"anthropic.speed":{value:void 0,visible:!1,description:"Fast speed toggle for Opus modes (Anthropic fast mode, billed at a premium)"},"anthropic.temperature":{value:1,visible:!1,description:"Temperature setting for Anthropic models (0.0 = deterministic, 1.0 = creative). Note: Only takes effect when thinking is disabled. Internal use only."},"anthropic.thinking.enabled":{value:!1,visible:!1,description:"Enable Claude thinking process output for debugging"},bitbucketToken:{value:void 0,visible:!0,description:"Personal access token for Bitbucket Enterprise. Used with a workspace-level Bitbucket connection configured by an admin."},dangerouslyAllowAll:{value:!1,visible:!0,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},defaultVisibility:{value:{"github.com/sourcegraph/amp":"workspace"},visible:!0,description:["Define default thread visibility per repository origin using mappings like ",'"github.com/org/repo": "workspace". Values: private, workspace, group.'].join("")},"experimental.applyPatchFreeform.enabled":{value:!1,visible:!1,description:"Use OpenAI custom-tool freeform input for the apply_patch tool"},"experimental.cli.nativeSecretsStorage.enabled":{value:!1,visible:!1,description:"Use native secret storage instead of the plain-text secrets configuration file"},"experimental.modes":{value:[],visible:!0,description:"Enable experimental agent modes by name. Available modes: deep"},"experimental.tools":{value:[],visible:!1,description:"Enable experimental tools by name"},"fuzzy.alwaysIncludePaths":{value:[],visible:!0,description:"Glob patterns for paths that should always be included in fuzzy file search, even if gitignored"},"gemini.thinkingLevel":{value:void 0,visible:!1,description:"Thinking level for Gemini models (minimal, low, medium, high, or undefined)"},"git.commit.ampThread.enabled":{value:!0,visible:!0,description:"Enable adding Amp-Thread trailer in git commits"},"git.commit.coauthor.enabled":{value:!0,visible:!0,description:"Enable adding Amp as co-author in git commits"},"guardedFiles.allowlist":{value:[],visible:!0,description:"Array of file glob patterns that are allowed to be accessed without confirmation. Takes precedence over the built-in denylist."},"jetbrains.skipInstall":{value:!1,visible:!1,description:"Skip JetBrains plugin installation"},mcpServers:{value:{filesystem:{command:"npx",args:["@modelcontextprotocol/server-filesystem","/path/to/allowed/dir"]}},visible:!0,description:"Model Context Protocol servers to connect to for additional tools"},"network.timeout":{value:30,visible:!0,description:"How many seconds to wait for network requests to the Amp server before timing out"},"notifications.enabled":{value:!0,visible:!0,description:"Enable notification alerts when the agent completes tasks. Over SSH, or when AMP_FORCE_BEL is set, this sends a terminal bell."},"notifications.system.enabled":{value:!0,visible:!0,description:"Enable system notifications when terminal is not focused"},"openai.speed":{value:void 0,visible:!1,description:"Fast speed toggle for deep/internal modes (OpenAI priority tier)"},"painter.model":{value:"gpt-image-2",visible:!1,description:"Experimental internal painter backend override."},permissions:{value:[{tool:"Bash",action:"ask",matches:{cmd:["git push*","git commit*","git branch -D*","git checkout HEAD*"]}}],visible:!0,description:"Permission rules for tool calls. See amp permissions --help"},proxy:{value:void 0,visible:!0,description:"Proxy URL used for both HTTP and HTTPS requests to the Amp server"},showCosts:{value:!0,visible:!0,description:"Set to false to hide costs while working on a thread"},gauge:{value:"cost",visible:!1,description:"Controls the usage gauge in the prompt editor border: 'tokens', 'cost', or false to hide."},"skills.disableClaudeCodeSkills":{value:!1,visible:!0,description:"Disable loading skills from Claude Code directories (.claude/skills/, ~/.claude/skills/, ~/.claude/plugins/cache/). Amp-native skill directories are not affected."},"skills.path":{value:void 0,visible:!0,description:"Path to additional directories containing skills. Supports colon-separated paths (semicolon on Windows). Use ~ for home directory."},submitOnEnter:{value:!0,visible:!1,description:"Whether to submit messages on Enter (true) or require Ctrl+Enter (false)"},systemPrompt:{value:void 0,visible:!1,description:"Custom system prompt text to append (SDK use only)"},"terminal.animation":{value:!0,visible:!0,description:"Set to false to disable terminal animations (or use the equivalent NO_ANIMATION=1 env var)"},"terminal.theme":{value:"terminal",visible:!0,description:"Color theme for the CLI. Built-in: terminal, dark, light, catppuccin-mocha, solarized-dark, solarized-light, gruvbox-dark-hard, nord. Custom themes: ~/.config/amp/themes/<name>/colors.toml"},"terminal.copyOnSelect":{value:!0,visible:!0,description:"Automatically copy selection to clipboard."},"toolbox.path":{value:void 0,visible:!0,description:"Path to the directory containing toolbox scripts. Supports colon-separated paths."},"tools.disable":{value:["browser_navigate","builtin:edit_file"],visible:!0,description:"Array of tool names to disable. Use 'builtin:toolname' to disable only the builtin tool with that name (allowing an MCP server to provide a tool by that name)."},"tools.enable":{value:void 0,visible:!0,description:"Array of tool name patterns to enable. Supports glob patterns (e.g., 'mcp__metabase__*'). If not set, all tools are enabled. If set, only matching tools are enabled."},"updates.mode":{value:"auto",visible:!0,description:'Control update checking behavior: "warn" shows update notifications, "disabled" turns off checking, "auto" automatically runs update.'},url:{value:"https://ampcode.com",visible:!1,description:"The Amp server URL to connect to"}},Ze6=Object.fromEntries(Object.entries(tG4).filter(([,A])=>A.visible).map(([A,Q])=>[`amp.${A}`,Q.value])),$p={examples:[{description:"Start an interactive session:",command:"amp"},{description:"Start an interactive session with a user message:",command:'echo "commit all my unstaged changes" | amp'},{description:"Use execute mode (--execute or -x) to send a command to an agent, have it execute it, print only the agent's last message, and then exit:",command:'amp -x "what file in this folder is in markdown format?"',output:`All Markdown files in this folder:
|
|
4474
4474
|
|
|
4475
4475
|
- README.md (root)
|
|
4476
4476
|
- AGENT.md (root)
|
|
@@ -4582,13 +4582,13 @@ ${z}`))}},error:(V)=>{if(!G)G=!0,Y(Error(`Failed to spawn brew: ${V.message}`))}
|
|
|
4582
4582
|
${z}`;if(F==="pnpm"&&z.includes("Unable to find the global bin directory"))K+=`
|
|
4583
4583
|
|
|
4584
4584
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
|
4585
|
-
npm install -g ${E}`;Y(Error(K))}},error:(V)=>{if(!I)I=!0,Y(Error(`Failed to spawn ${F}: ${V.message}`))},complete:()=>{if(!I)I=!0,U()}})})}h0();h0();Gg();var F0Q="@ampcode/cli";async function N50(A,Q,$=F0Q){let D=`${Q||"https://registry.npmjs.org"}/${$}/latest`,E=new AbortController,F=setTimeout(()=>E.abort(),5000);try{let J=await fetch(D,{signal:E.signal});if(!J.ok)return{hasUpdate:!1,currentVersion:A,source:"npm"};let U=await J.json(),Y=U.version??U["dist-tags"]?.latest;if(!Y)return{hasUpdate:!1,currentVersion:A,source:"npm"};let Z=Zp(A,Y),X=Z<0,I,G;if(U.time){let V=U.time[A],z=U.time[Y],K=Date.now();if(V)I=Math.floor((K-new Date(V).getTime())/3600000);if(z)G=Math.floor((K-new Date(z).getTime())/3600000)}return _.info("NPM version comparison",{currentVersion:A,latestVersion:Y,compareResult:Z,hasUpdate:X,currentVersionAge:I,latestVersionAge:G}),{hasUpdate:X,latestVersion:Y,currentVersion:A,currentVersionAge:I,latestVersionAge:G,source:"npm"}}catch(J){return _.debug("Error checking npm version",{error:J}),{hasUpdate:!1,currentVersion:A,source:"npm"}}finally{clearTimeout(F)}}var J0Q="https://static.ampcode.com/cli/cli-version.txt";async function q50(A){let Q=new AbortController,$=setTimeout(()=>Q.abort(),5000);try{let B=await fetch(`${J0Q}?t=${Date.now()}`,{signal:Q.signal,cache:"no-store"});if(!B.ok)return{hasUpdate:!1,currentVersion:A,source:"bin"};let D=(await B.text()).trim();if(!D||!/^\d+\.\d+\.\d+/.test(D))return{hasUpdate:!1,currentVersion:A,source:"bin"};let E=Zp(A,D),F=E<0;return _.info("Bin version comparison",{currentVersion:A,latestVersion:D,compareResult:E,hasUpdate:F}),{hasUpdate:F,latestVersion:D,currentVersion:A,source:"bin"}}catch(B){return _.debug("Error checking bin version",{error:B}),{hasUpdate:!1,currentVersion:A,source:"bin"}}finally{clearTimeout($)}}function Zp(A,Q){let $=(F)=>{let[J,U]=F.split("-");return{parts:J?.split(".").map(Number)||[],label:U}},B=$(A),D=$(Q),E=Math.max(B.parts.length,D.parts.length);for(let F=0;F<E;F++){let J=B.parts[F]||0,U=D.parts[F]||0;if(J<U)return-1;if(J>U)return 1}if(B.label===D.label)return 0;if(!B.label&&D.label)return 1;if(B.label&&!D.label)return-1;if(B.label&&D.label)return B.label<D.label?-1:1;return 0}function Xp(A){try{let Q=A.match(/^0\.0\.(\d+)(?:-(.+))?/);if(!Q)return null;let $=parseInt(Q[1],10),B=$!==0?$*1000:void 0,E=Q[2]?.match(/^g?([a-f0-9]+)$/)?.[1],F=B!==void 0?bV(B):void 0;return{sha:E,timestamp:B,age:F}}catch{return null}}LA();h0();import{readFile as U0Q,realpath as Y0Q}from"node:fs/promises";import{dirname as cV4,join as Z0Q}from"node:path";async function pV4(A){switch(A){case"binary":case"brew":return X0Q(Up());case"npm":case"pnpm":case"yarn":case"bun":return I0Q()}}async function X0Q(A){let Q=await dz(A,["--version"],5000);if(Q.reason!=="success")return _.debug("failed to read version from binary",{binaryPath:A,result:Q}),null;return Q.output.trim().split(/\s+/)[0]||null}async function I0Q(){try{let A=process.argv[1];if(!A)return null;let Q=await Y0Q(A),$=cV4(cV4(Q));return await G0Q(Z0Q($,"package.json"))}catch(A){return _.debug("failed to read installed version from package.json",{error:A}),null}}async function G0Q(A){let Q=await U0Q(A,"utf8"),$=JSON.parse(Q);if(!$.name||!My0($.name))return _.debug("package.json name mismatch",{pkgJsonPath:A,name:$.name}),null;return $.version||null}h0();import{spawn as V0Q}from"node:child_process";function _y0(A){if(A=A.replace(/\/$/,""),!A.startsWith("http://")&&!A.startsWith("https://"))A=`https://${A}`;try{return new URL(A),A}catch{return _.warn(`Invalid registry URL: ${A}, falling back to npmjs.org`),"https://registry.npmjs.org"}}var w50=null,Ip=null;function lV4(A){return new Promise((Q)=>{let $=V0Q("npm",["config","get",A],{stdio:["ignore","pipe","ignore"],timeout:5000,shell:process.platform==="win32"}),B="";$.stdout.on("data",(D)=>{B+=D.toString()}),$.on("close",(D,E)=>{if(D!==0||E==="SIGTERM"){Q(null);return}let F=B.trim();Q(F&&F!=="undefined"?F:null)}),$.on("error",()=>{Q(null)})})}async function O50(){if(w50)return w50;if(Ip)return Ip;Ip=(async()=>{let A=process.env.NPM_CONFIG_REGISTRY??process.env.npm_config_registry;if(A)return _y0(A);let Q=await lV4("@sourcegraph:registry");if(Q)return _y0(Q);let $=await lV4("registry");if($)return _y0($);return"https://registry.npmjs.org"})();try{return w50=await Ip,w50}finally{Ip=null}}var z0Q=3600000,K0Q=5000;function Sy0(A,Q,$={}){let B=new O4,D=B.pipe(BQ({shouldCountRefs:!1})),E=$.startDelayMs??0,F=$.checkIntervalMs??z0Q,J=!1,U=()=>{J=!0};return setImmediate(async()=>{let Y=_.getChild("update");if(E>0){if(await gV(E),J)return}let Z=D.subscribe({next:(I)=>{Y.debug("emit new state",I)}}),X=A;try{while(!J){let I=await C0Q(X,Q,Y,B);if(I.stop)return;if(I.updatedTo)X=I.updatedTo;if(I.emittedVisibleState){if(await gV(K0Q),J)return;B.next("hidden")}if(F<=0)return;let G=1000,V=F;while(V>0&&!J){let z=Math.min(G,V);await gV(z),V-=z}}}finally{Z.unsubscribe(),B.complete()}}),{state:D,dispose:U}}async function C0Q(A,Q,$,B){let D={stop:!1,emittedVisibleState:!1};try{if(process.env.AMP_SKIP_UPDATE_CHECK==="1")return $.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable"),D.stop=!0,D;let E=await Q.get("updates.mode");if(E==="disabled")return $.debug("checking disabled"),D.stop=!0,D;let F=await UY(),J=F==="binary"||F==="brew",U=J?void 0:await cz();$.debug("checking",{currentVersion:A,mode:E,packageManager:F,isBinaryDistribution:J,npmPackageName:U});let Y;if(J)Y=await q50(A);else{let I=await O50();Y=await N50(A,I,U)}if(!(Y.latestVersion&&Y.hasUpdate))return $.debug("no update available"),D;let Z=(I)=>{B.next(I),D.emittedVisibleState=!0};if(F){let I=await pV4(F);if(I&&Zp(I,Y.latestVersion)>=0){if($.debug("on-disk version already up to date",{currentVersion:A,installedVersion:I,latestVersion:Y.latestVersion}),D.updatedTo=I,Zp(A,I)<0){let G=await bX(I),V={from:A,to:I,externallyUpdated:!0,...G};if(G.status==="same")$.info("on-disk already updated by another instance",V),Z("updated");else $.warn("on-disk already updated by another instance, with PATH warning",V),Z("updated-with-warning")}return D}}let X=()=>{if(Y.currentVersionAge!==void 0&&Y.latestVersionAge!==void 0){let I=Y.currentVersionAge-Y.latestVersionAge,G=0.5;if(Math.abs(I)<0.5)return $.debug("versions too close together, suppressing update warning",{currentVersionAge:Y.currentVersionAge,latestVersionAge:Y.latestVersionAge,ageDifferenceHours:I}),!0}return!1};if(!E)E=F==="pnpm"?"warn":"auto",$.debug("no configured update mode; selected default based on package manager",{packageManager:F,mode:E});if(F==="brew"){if(!X())Z("update-available-brew");return D}if(F==="binary"&&process.execPath!==Up()){if($.debug("non-standard binary path, showing warning"),!X())Z("update-available-unrecognized-path");return D}if(E==="warn"){if(!X())Z("update-available");return D}if(!F){if($.debug("auto-update not supported, falling back to warn mode"),!X())Z("update-available");return D}try{await Yp(Y.latestVersion,F),D.updatedTo=Y.latestVersion;let I=await bX(Y.latestVersion),G={from:Y.currentVersion,to:Y.latestVersion,...I};if(I.status==="same")$.info("success",G),Z("updated");else $.warn("success with warning",G),Z("updated-with-warning")}catch(I){Z("update-error")}return D}catch(E){return $.debug("check failed",{error:E}),D}}Gg();import{stderr as U2}from"node:process";function iV4(A){let Q=new fX().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(B)=>{await wy0(B.force||!1,B.verbose||!1,"0.0.
|
|
4585
|
+
npm install -g ${E}`;Y(Error(K))}},error:(V)=>{if(!I)I=!0,Y(Error(`Failed to spawn ${F}: ${V.message}`))},complete:()=>{if(!I)I=!0,U()}})})}h0();h0();Gg();var F0Q="@ampcode/cli";async function N50(A,Q,$=F0Q){let D=`${Q||"https://registry.npmjs.org"}/${$}/latest`,E=new AbortController,F=setTimeout(()=>E.abort(),5000);try{let J=await fetch(D,{signal:E.signal});if(!J.ok)return{hasUpdate:!1,currentVersion:A,source:"npm"};let U=await J.json(),Y=U.version??U["dist-tags"]?.latest;if(!Y)return{hasUpdate:!1,currentVersion:A,source:"npm"};let Z=Zp(A,Y),X=Z<0,I,G;if(U.time){let V=U.time[A],z=U.time[Y],K=Date.now();if(V)I=Math.floor((K-new Date(V).getTime())/3600000);if(z)G=Math.floor((K-new Date(z).getTime())/3600000)}return _.info("NPM version comparison",{currentVersion:A,latestVersion:Y,compareResult:Z,hasUpdate:X,currentVersionAge:I,latestVersionAge:G}),{hasUpdate:X,latestVersion:Y,currentVersion:A,currentVersionAge:I,latestVersionAge:G,source:"npm"}}catch(J){return _.debug("Error checking npm version",{error:J}),{hasUpdate:!1,currentVersion:A,source:"npm"}}finally{clearTimeout(F)}}var J0Q="https://static.ampcode.com/cli/cli-version.txt";async function q50(A){let Q=new AbortController,$=setTimeout(()=>Q.abort(),5000);try{let B=await fetch(`${J0Q}?t=${Date.now()}`,{signal:Q.signal,cache:"no-store"});if(!B.ok)return{hasUpdate:!1,currentVersion:A,source:"bin"};let D=(await B.text()).trim();if(!D||!/^\d+\.\d+\.\d+/.test(D))return{hasUpdate:!1,currentVersion:A,source:"bin"};let E=Zp(A,D),F=E<0;return _.info("Bin version comparison",{currentVersion:A,latestVersion:D,compareResult:E,hasUpdate:F}),{hasUpdate:F,latestVersion:D,currentVersion:A,source:"bin"}}catch(B){return _.debug("Error checking bin version",{error:B}),{hasUpdate:!1,currentVersion:A,source:"bin"}}finally{clearTimeout($)}}function Zp(A,Q){let $=(F)=>{let[J,U]=F.split("-");return{parts:J?.split(".").map(Number)||[],label:U}},B=$(A),D=$(Q),E=Math.max(B.parts.length,D.parts.length);for(let F=0;F<E;F++){let J=B.parts[F]||0,U=D.parts[F]||0;if(J<U)return-1;if(J>U)return 1}if(B.label===D.label)return 0;if(!B.label&&D.label)return 1;if(B.label&&!D.label)return-1;if(B.label&&D.label)return B.label<D.label?-1:1;return 0}function Xp(A){try{let Q=A.match(/^0\.0\.(\d+)(?:-(.+))?/);if(!Q)return null;let $=parseInt(Q[1],10),B=$!==0?$*1000:void 0,E=Q[2]?.match(/^g?([a-f0-9]+)$/)?.[1],F=B!==void 0?bV(B):void 0;return{sha:E,timestamp:B,age:F}}catch{return null}}LA();h0();import{readFile as U0Q,realpath as Y0Q}from"node:fs/promises";import{dirname as cV4,join as Z0Q}from"node:path";async function pV4(A){switch(A){case"binary":case"brew":return X0Q(Up());case"npm":case"pnpm":case"yarn":case"bun":return I0Q()}}async function X0Q(A){let Q=await dz(A,["--version"],5000);if(Q.reason!=="success")return _.debug("failed to read version from binary",{binaryPath:A,result:Q}),null;return Q.output.trim().split(/\s+/)[0]||null}async function I0Q(){try{let A=process.argv[1];if(!A)return null;let Q=await Y0Q(A),$=cV4(cV4(Q));return await G0Q(Z0Q($,"package.json"))}catch(A){return _.debug("failed to read installed version from package.json",{error:A}),null}}async function G0Q(A){let Q=await U0Q(A,"utf8"),$=JSON.parse(Q);if(!$.name||!My0($.name))return _.debug("package.json name mismatch",{pkgJsonPath:A,name:$.name}),null;return $.version||null}h0();import{spawn as V0Q}from"node:child_process";function _y0(A){if(A=A.replace(/\/$/,""),!A.startsWith("http://")&&!A.startsWith("https://"))A=`https://${A}`;try{return new URL(A),A}catch{return _.warn(`Invalid registry URL: ${A}, falling back to npmjs.org`),"https://registry.npmjs.org"}}var w50=null,Ip=null;function lV4(A){return new Promise((Q)=>{let $=V0Q("npm",["config","get",A],{stdio:["ignore","pipe","ignore"],timeout:5000,shell:process.platform==="win32"}),B="";$.stdout.on("data",(D)=>{B+=D.toString()}),$.on("close",(D,E)=>{if(D!==0||E==="SIGTERM"){Q(null);return}let F=B.trim();Q(F&&F!=="undefined"?F:null)}),$.on("error",()=>{Q(null)})})}async function O50(){if(w50)return w50;if(Ip)return Ip;Ip=(async()=>{let A=process.env.NPM_CONFIG_REGISTRY??process.env.npm_config_registry;if(A)return _y0(A);let Q=await lV4("@sourcegraph:registry");if(Q)return _y0(Q);let $=await lV4("registry");if($)return _y0($);return"https://registry.npmjs.org"})();try{return w50=await Ip,w50}finally{Ip=null}}var z0Q=3600000,K0Q=5000;function Sy0(A,Q,$={}){let B=new O4,D=B.pipe(BQ({shouldCountRefs:!1})),E=$.startDelayMs??0,F=$.checkIntervalMs??z0Q,J=!1,U=()=>{J=!0};return setImmediate(async()=>{let Y=_.getChild("update");if(E>0){if(await gV(E),J)return}let Z=D.subscribe({next:(I)=>{Y.debug("emit new state",I)}}),X=A;try{while(!J){let I=await C0Q(X,Q,Y,B);if(I.stop)return;if(I.updatedTo)X=I.updatedTo;if(I.emittedVisibleState){if(await gV(K0Q),J)return;B.next("hidden")}if(F<=0)return;let G=1000,V=F;while(V>0&&!J){let z=Math.min(G,V);await gV(z),V-=z}}}finally{Z.unsubscribe(),B.complete()}}),{state:D,dispose:U}}async function C0Q(A,Q,$,B){let D={stop:!1,emittedVisibleState:!1};try{if(process.env.AMP_SKIP_UPDATE_CHECK==="1")return $.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable"),D.stop=!0,D;let E=await Q.get("updates.mode");if(E==="disabled")return $.debug("checking disabled"),D.stop=!0,D;let F=await UY(),J=F==="binary"||F==="brew",U=J?void 0:await cz();$.debug("checking",{currentVersion:A,mode:E,packageManager:F,isBinaryDistribution:J,npmPackageName:U});let Y;if(J)Y=await q50(A);else{let I=await O50();Y=await N50(A,I,U)}if(!(Y.latestVersion&&Y.hasUpdate))return $.debug("no update available"),D;let Z=(I)=>{B.next(I),D.emittedVisibleState=!0};if(F){let I=await pV4(F);if(I&&Zp(I,Y.latestVersion)>=0){if($.debug("on-disk version already up to date",{currentVersion:A,installedVersion:I,latestVersion:Y.latestVersion}),D.updatedTo=I,Zp(A,I)<0){let G=await bX(I),V={from:A,to:I,externallyUpdated:!0,...G};if(G.status==="same")$.info("on-disk already updated by another instance",V),Z("updated");else $.warn("on-disk already updated by another instance, with PATH warning",V),Z("updated-with-warning")}return D}}let X=()=>{if(Y.currentVersionAge!==void 0&&Y.latestVersionAge!==void 0){let I=Y.currentVersionAge-Y.latestVersionAge,G=0.5;if(Math.abs(I)<0.5)return $.debug("versions too close together, suppressing update warning",{currentVersionAge:Y.currentVersionAge,latestVersionAge:Y.latestVersionAge,ageDifferenceHours:I}),!0}return!1};if(!E)E=F==="pnpm"?"warn":"auto",$.debug("no configured update mode; selected default based on package manager",{packageManager:F,mode:E});if(F==="brew"){if(!X())Z("update-available-brew");return D}if(F==="binary"&&process.execPath!==Up()){if($.debug("non-standard binary path, showing warning"),!X())Z("update-available-unrecognized-path");return D}if(E==="warn"){if(!X())Z("update-available");return D}if(!F){if($.debug("auto-update not supported, falling back to warn mode"),!X())Z("update-available");return D}try{await Yp(Y.latestVersion,F),D.updatedTo=Y.latestVersion;let I=await bX(Y.latestVersion),G={from:Y.currentVersion,to:Y.latestVersion,...I};if(I.status==="same")$.info("success",G),Z("updated");else $.warn("success with warning",G),Z("updated-with-warning")}catch(I){Z("update-error")}return D}catch(E){return $.debug("check failed",{error:E}),D}}Gg();import{stderr as U2}from"node:process";function iV4(A){let Q=new fX().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(B)=>{await wy0(B.force||!1,B.verbose||!1,"0.0.1780032159-g3925ab"),process.exit()});A.addCommand(Q,{hidden:!0});let $=new fX("update").alias("up").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("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(B)=>{await H0Q(B.targetVersion)});A.addCommand($)}function W0Q(A){let Q=Boolean(A.isTTY),$=0,B=!1;function D(){if(!Q||!B)return;A.write(`
|
|
4586
4586
|
`),B=!1,$=0}function E(F){if(!Q)return;let J=F.padEnd($," ");A.write(`\r${J}`),B=!0,$=J.length}return{flushProgressLine:D,renderProgress:E}}function u0Q(A){if(A.source==="npm"&&A.latestVersionAge!==void 0&&A.latestVersionAge>36)U2.write(f0.yellow(`The latest Amp CLI version reported by npm is older than expected. Be aware that you may be using an npm proxy with a corporate policy to delay package updates.
|
|
4587
4587
|
`))}async function H0Q(A){let $=process.platform==="win32"&&WN()?{currentExecutablePath:process.execPath}:void 0,{flushProgressLine:B,renderProgress:D}=W0Q(U2);if(process.env.AMP_SKIP_UPDATE_CHECK==="1")U2.write(f0.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
|
|
4588
4588
|
|
|
4589
4589
|
`));try{if(!A){U2.write(f0.blue(`Checking for updates...
|
|
4590
|
-
`));let J=!1,U;if(WN()){let Y=await q50("0.0.
|
|
4591
|
-
`));let X=await bX("0.0.
|
|
4590
|
+
`));let J=!1,U;if(WN()){let Y=await q50("0.0.1780032159-g3925ab");J=Y.hasUpdate,U=Y.latestVersion}else{let Y=await O50(),Z=await cz(),X=await N50("0.0.1780032159-g3925ab",Y,Z);u0Q(X),J=X.hasUpdate,U=X.latestVersion}if(!J){let Y=Xp("0.0.1780032159-g3925ab"),Z=Y?.age?`released ${Y.age} ago`:`built ${bV(new Date("2026-05-29T05:27:28.532Z"))} ago`;U2.write(f0.green(`✓ Amp is already up to date on version ${"0.0.1780032159-g3925ab"} (${Z})
|
|
4591
|
+
`));let X=await bX("0.0.1780032159-g3925ab",$);if(X.warning)U2.write(`
|
|
4592
4592
|
`+f0.yellow(X.warning)+`
|
|
4593
4593
|
`);process.exit(0)}if(!U)U2.write(f0.yellow("[WARN] could not find latest version")),process.exit(0);A=U}U2.write(f0.blue(`Updating to version ${A}...
|
|
4594
4594
|
`)),await Yp(A,void 0,(J)=>{B(),U2.write(f0.dim(`Running: ${J}
|
|
@@ -4741,7 +4741,7 @@ ${B}`}async function ABQ(A,Q){if(!Q?.forceExternal&&Q?.onShowImagePreview&&VH4(A
|
|
|
4741
4741
|
`).length,D=new F0({text:new g(A,new $0({color:$}))});if(B<=nD0)return D;return new b0({width:1/0,height:nD0,child:new v3({autofocus:!1,controller:Q,child:D})})}function Z9Q(){return new Map([[WA.key("PageUp"),new aD0],[WA.key("PageDown"),new Vm0],[WA.ctrl("u"),new aD0],[WA.shift("Home"),new zm0],[WA.shift("End"),new Km0]])}function X9Q(A,Q,$){return Math.max(Q,Math.min(A,$))}var Cm0=8,yw4=1,bw4=Cm0-1;class Wm0 extends I4{}class um0 extends I4{}class oD0 extends I4{}class rD0 extends I4{}class Hm0 extends I4{}class Nm0 extends I4{}class qm0 extends a0{props;constructor(A){super(A.key===void 0?{}:{key:A.key});this.props=A}createState(){return new hw4}}class hw4 extends n0{messageScroll=new Z$;initState(){super.initState(),this.messageScroll.followMode=!1,this.messageScroll.jumpTo(0)}dispose(){this.messageScroll.dispose(),super.dispose()}build(A){let Q=this.widget.props,$=I9Q(Q,this.messageScroll),B=G9Q(Q.options.message),D=B?new u4({actions:this.buildScrollActions(),child:new e6({debugLabel:"SelectDialogScrollShortcuts",shortcuts:z9Q(),child:$})}):$,E=[{keys:["↑/↓","j/k"],label:"move"},{keys:["Enter"],label:"select"}];if(B)E.push({keys:["Ctrl+E","Ctrl+Y"],label:"scroll"});return E.push({keys:["Esc"],label:"cancel"}),new s4({header:Q.options.title,minWidth:64,maxWidth:80,footer:E,autofocus:!1,onDismiss:Q.onCancel,child:D})}buildScrollActions(){let A=(Q)=>{let $=K9Q(this.messageScroll.offset+Q,0,this.messageScroll.maxScrollExtent);this.messageScroll.jumpTo($)};return new Map([[Wm0,new cA(()=>A(-yw4))],[um0,new cA(()=>A(yw4))],[oD0,new cA(()=>A(-bw4))],[rD0,new cA(()=>A(bw4))],[Hm0,new cA(()=>this.messageScroll.jumpTo(0))],[Nm0,new cA(()=>this.messageScroll.jumpTo(this.messageScroll.maxScrollExtent))]])}}function I9Q(A,Q){let $=A.options.options.map((D)=>({value:D,label:D})),B=Math.max(0,$.findIndex((D)=>D.value===A.options.initialValue));return new nX({options:$,selectedIndex:B,body:V9Q(A.options.message,Q),onSelect:(D)=>{if(D===null){A.onCancel();return}A.onSelect(D)},padding:t0.all(0),showBorder:!1,showDismissalMessage:!1,enableMouseInteraction:!0,wrapOptions:!0})}function G9Q(A){if(A===void 0)return!1;return A.split(`
|
|
4742
4742
|
`).length>Cm0}function V9Q(A,Q){if(A===void 0)return;let $=A.split(`
|
|
4743
4743
|
`).length,B=Math.min($,Cm0);return new b0({width:1/0,height:B,child:new v3({autofocus:!1,controller:Q,child:new F0({text:new g(A)})})})}function z9Q(){return new Map([[WA.key("PageUp"),new oD0],[WA.key("PageDown"),new rD0],[WA.ctrl("u"),new oD0],[WA.ctrl("d"),new rD0],[WA.ctrl("y"),new Wm0],[WA.ctrl("e"),new um0],[WA.shift("Home"),new Hm0],[WA.shift("End"),new Nm0]])}function K9Q(A,Q,$){return Math.max(Q,Math.min(A,$))}var C9Q=3,W9Q=2097152,u9Q=new J3("PluginDialogOverlay");function sD0(A,Q,$){if($!==void 0)return{type:"response",id:A,error:$};if(Q===void 0)return{type:"response",id:A};return{type:"response",id:A,result:Q}}function H9Q(A){let Q=new TextEncoder().encode(JSON.stringify(A)).byteLength;if(Q<=W9Q)return;throw Error(`thread.messages response is too large (${Q} bytes). Request fewer messages.`)}class wm0{options;unregisterPluginCommands=null;pluginCommandSubscriptions=[];pluginErrorToastKeys=new Set;activeDialog=null;queuedDialogs=[];resolvingDialog=null;pendingOwnerUIRequests=new Map;pendingActorUIRequests=new Map;stateBackedRequestIDs=new Set;pluginUIRespondRequestCounter=0;statusItems=new Map;blockingConfirmDialog=!1;disposed=!1;constructor(A){this.options=A}init(){this.disposed=!1,this.configurePluginPlatform(),this.subscribePluginCommands()}dispose(){this.disposed=!0,this.unregisterPluginCommands?.(),this.unregisterPluginCommands=null;for(let A of this.pluginCommandSubscriptions)A.unsubscribe();this.pluginCommandSubscriptions=[],this.cancelOwnerUIRequests(),this.cancelPendingDialogs(),this.statusItems.clear(),this.clearPluginPlatformStatusHandlers()}handlePluginMessage(A,Q){let $=A.message;if($.type==="response"){this.cancelOwnerUIRequest($.id),this.cancelActorUIRequest($.id);return}if($.type==="event"){if(this.handlePluginUIStateEvent($,Q))return;this.handlePluginEvent($);return}if(this.stateBackedRequestIDs.has($.id))return;if(!RB0($.method)){if($.method==="thread.messages")this.handleThreadMessagesRequest($,Q);return}this.handleOwnerUIRequest($,Q)}cancelOwnerUIRequests(){let A=[...this.pendingOwnerUIRequests.values(),...this.pendingActorUIRequests.values()];this.pendingOwnerUIRequests.clear(),this.pendingActorUIRequests.clear(),this.stateBackedRequestIDs.clear();for(let Q of A)Q.abort()}hasBlockingDialog(){return this.activeDialog!==null}hasBlockingConfirmDialog(){return this.activeDialog?.kind==="confirm"}buildDialogLayers(){let A=this.activeDialog;if(!A)return[];return[new Y$({key:u9Q,debugLabel:"PluginDialogOverlay",autofocus:!1,canRequestFocus:!0,child:this.buildActiveDialog(A)})]}buildActiveDialog(A){switch(A.kind){case"input":return new al({key:new pz(A),header:A.options.title??"Input",helpText:A.options.helpText,initialValue:A.options.initialValue,isRequired:!1,onSubmit:(Q)=>this.resolveInputDialog(A,Q),onDismiss:()=>this.resolveInputDialog(A,void 0)});case"confirm":return new Gm0({key:new pz(A),options:A.options,onConfirm:()=>this.resolveConfirmDialog(A,!0),onCancel:()=>this.resolveConfirmDialog(A,!1)});case"select":return new qm0({key:new pz(A),options:A.options,onSelect:(Q)=>this.resolveSelectDialog(A,Q),onCancel:()=>this.resolveSelectDialog(A,void 0)})}}getStatusItems(){return[...this.statusItems.values()].flatMap((A)=>A.value===void 0?[]:[{pluginURI:A.pluginURI,id:A.id,value:A.value}])}configurePluginPlatform(){let A=this.options.context.pluginPlatform;if(!A)return;if(A.showToast=(Q)=>this.options.toastController.show(Q,"success"),A.showOpenedURLToast=(Q)=>{this.options.toastController.show(`Opened URL: ${Q}`,"success",8000)},A.appendToThreadHandler=this.options.context.observerOnly?async()=>{throw Error("thread.append is only available from an executor-owned plugin runtime")}:this.options.appendToThread,this.options.readThreadMessages)A.readThreadMessagesHandler=this.readThreadMessages;A.runAgentHandler=this.options.context.observerOnly?async()=>{throw Error("agent.run is only available from an executor-owned plugin runtime")}:this.options.runAgent??(async()=>{throw Error("agent.run is not available in this context")}),A.showInputDialog=this.showInputDialog,A.showConfirmDialog=this.showConfirmDialog,A.showSelectDialog=this.showSelectDialog,A.createStatusItemHandler=this.createStatusItem,A.updateStatusItemHandler=this.updateStatusItem,A.removeStatusItemHandler=this.removeStatusItem}handlePluginEvent(A){if(A.event!=="ui.notify")return;let Q=A.data;if(typeof Q.message==="string")this.options.toastController.show(Q.message,"success")}async handleThreadMessagesRequest(A,Q){try{let{options:$,threadID:B}=this.parseThreadMessagesRequestParams(A.params),D=await this.readThreadMessages($,B);H9Q(D),Q(sD0(A.id,D))}catch($){Q(sD0(A.id,void 0,$ instanceof Error?$.message:String($)))}}parseThreadMessagesRequestParams(A){if(!A||typeof A!=="object")return{options:void 0,threadID:void 0};let Q=A;return{options:Q.options,threadID:typeof Q.threadID==="string"?Q.threadID:void 0}}async handleOwnerUIRequest(A,Q){let $=new AbortController;this.pendingOwnerUIRequests.set(A.id,$);try{let B=await this.dispatchOwnerUIRequest(A,$.signal);if(this.pendingOwnerUIRequests.get(A.id)!==$)return;this.pendingOwnerUIRequests.delete(A.id),Q(sD0(A.id,B))}catch(B){if(this.pendingOwnerUIRequests.get(A.id)!==$)return;this.pendingOwnerUIRequests.delete(A.id),Q(sD0(A.id,void 0,B instanceof Error?B.message:String(B)))}}dispatchOwnerUIRequest(A,Q){switch(A.method){case"ui.input":return this.showInputDialog(A.params.options,Q);case"ui.confirm":return this.showConfirmDialog(A.params.options,Q);case"ui.select":return this.showSelectDialog(A.params.options,Q);default:throw Error(`Unknown owner UI request method: ${A.method}`)}}cancelOwnerUIRequest(A){let Q=this.pendingOwnerUIRequests.get(A);if(!Q)return;this.pendingOwnerUIRequests.delete(A),Q.abort()}cancelActorUIRequest(A){let Q=this.pendingActorUIRequests.get(A);if(!Q)return;this.pendingActorUIRequests.delete(A),Q.abort()}buildPluginUIRespondRequest(A,Q,$){this.pluginUIRespondRequestCounter+=1;let B={requestId:A};if($!==void 0)B.error=$;else if(Q!==void 0)B.result=Q;return{type:"request",id:`plugin-ui-respond-${A}-${this.pluginUIRespondRequestCounter}`,method:"plugin.ui.respond",params:B}}async handleActorUIRequest(A,Q){let $=new AbortController;this.pendingActorUIRequests.set(A.requestId,$);let B={type:"request",id:A.requestId,method:A.method,params:A.params};try{let D=await this.dispatchOwnerUIRequest(B,$.signal);if(this.pendingActorUIRequests.get(A.requestId)!==$)return;this.pendingActorUIRequests.delete(A.requestId),Q(this.buildPluginUIRespondRequest(A.requestId,D))}catch(D){if(this.pendingActorUIRequests.get(A.requestId)!==$)return;this.pendingActorUIRequests.delete(A.requestId),Q(this.buildPluginUIRespondRequest(A.requestId,void 0,D instanceof Error?D.message:String(D)))}}upsertActorUIState(A,Q){if(this.stateBackedRequestIDs.add(A.requestId),A.status!=="pending"){this.cancelActorUIRequest(A.requestId);return}if(this.pendingActorUIRequests.has(A.requestId))return;this.handleActorUIRequest(A,Q)}handlePluginUISnapshot(A,Q){let $=new Set(A.requests.map((B)=>B.requestId));for(let B of this.pendingActorUIRequests.keys())if(!$.has(B))this.cancelActorUIRequest(B);for(let B of this.stateBackedRequestIDs)if(!$.has(B))this.stateBackedRequestIDs.delete(B);for(let B of A.requests)this.upsertActorUIState(B,Q)}handlePluginUIRequestAdded(A,Q){this.upsertActorUIState(A.request,Q)}handlePluginUIRequestSettled(A,Q){this.upsertActorUIState(A.request,Q)}handlePluginUIRequestRemoved(A){this.cancelActorUIRequest(A.requestId),this.stateBackedRequestIDs.delete(A.requestId)}handlePluginUIStateEvent(A,Q){if(A.event==="plugin.ui.snapshot"){let $=HZ4.safeParse(A.data);if($.success)this.handlePluginUISnapshot($.data,Q);return!0}if(A.event==="plugin.ui.request_added"){let $=NZ4.safeParse(A.data);if($.success)this.handlePluginUIRequestAdded($.data,Q);return!0}if(A.event==="plugin.ui.request_settled"){let $=qZ4.safeParse(A.data);if($.success)this.handlePluginUIRequestSettled($.data,Q);return!0}if(A.event==="plugin.ui.request_removed"){let $=wZ4.safeParse(A.data);if($.success)this.handlePluginUIRequestRemoved($.data);return!0}return!1}clearPluginPlatformStatusHandlers(){let A=this.options.context.pluginPlatform;if(!A)return;if(A.readThreadMessagesHandler===this.readThreadMessages)A.readThreadMessagesHandler=null;if(A.createStatusItemHandler===this.createStatusItem)A.createStatusItemHandler=null;if(A.updateStatusItemHandler===this.updateStatusItem)A.updateStatusItemHandler=null;if(A.removeStatusItemHandler===this.removeStatusItem)A.removeStatusItemHandler=null;if(A.runAgentHandler===this.options.runAgent)A.runAgentHandler=null}subscribePluginCommands(){let A=this.options.context.pluginService;if(!A)return;this.refreshPluginCommands(A.commands.list()),this.pluginCommandSubscriptions=[A.plugins.subscribe((Q)=>{this.removeInactivePluginStatusItems(Q),this.showNewPluginErrorToasts(Q),this.refreshPluginCommands(A.commands.list())}),A.commands.changed.subscribe(()=>{this.refreshPluginCommands(A.commands.list())})]}refreshPluginCommands(A){this.unregisterPluginCommands?.();let $=A.map((B)=>this.createPluginCommand(B)).map((B)=>this.options.commandRegistry.register(B));this.unregisterPluginCommands=()=>{for(let B of $)B()}}showNewPluginErrorToasts(A){let Q=new Set;for(let $ of A){if($.status!=="error")continue;if(Lh($.errorMessage))continue;let B=`${$.uri.toString()}
|
|
4744
|
-
${$.errorMessage??""}`;if(Q.add(B),this.pluginErrorToastKeys.has(B))continue;this.options.toastController.show(this.formatPluginErrorToast($),"error",8000)}this.pluginErrorToastKeys=Q}removeInactivePluginStatusItems(A){let Q=new Set(A.filter((B)=>B.status==="active").map((B)=>B.uri.toString())),$=[];for(let[B,D]of this.statusItems){if(Q.has(D.pluginURI))continue;$.push(B)}if($.length===0)return;this.updateStatusItemState(()=>{for(let B of $)this.statusItems.delete(B)})}formatPluginErrorToast(A){let Q=A.uri.toString();return`Plugin failed: ${Q.split("/").pop()??Q}. See logs: ${this.options.context.logFilePath}`}createPluginCommand(A){return{id:A.id,noun:A.category,verb:A.title,description:A.description??`Run plugin command ${A.category}: ${A.title}`,status:A.availability,run:async(Q,$,B)=>{B();try{await this.options.context.pluginService?.commands.execute(A.pluginName,A.id,{threadID:this.options.getActiveThreadID()})}catch(D){_.error("Neo plugin command failed",{error:D,command:A}),this.options.toastController.show(D instanceof Error?D.message:String(D),"error",5000)}}}}showInputDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"input",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=JV(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showConfirmDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(!1);return}let B={kind:"confirm",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=JV(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showSelectDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"select",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=JV(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};createStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{let B=this.statusItemKey(A,Q),D={pluginURI:A,id:Q};if($!==void 0)D.value=$;this.statusItems.set(B,D)})};updateStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.set(this.statusItemKey(A,Q),{pluginURI:A,id:Q,value:$})})};removeStatusItem=(A,Q)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.delete(this.statusItemKey(A,Q))})};readThreadMessages=(A,Q)=>{let $=this.options.readThreadMessages;if(!$)return Promise.reject(Error("thread.messages is not available - no active thread"));return $(A,Q)};updateStatusItemState(A){if(this.options.state.mounted)this.options.state.setState(A);else A()}statusItemKey(A,Q){return`${A}\x00${Q}`}cancelPendingDialogs(){let A=[];if(this.activeDialog)A.push(this.activeDialog);A.push(...this.queuedDialogs),this.activeDialog=null,this.queuedDialogs=[],this.resolvingDialog=null,this.emitBlockingConfirmDialogChange();for(let Q of A)this.cancelDialog(Q)}cancelDialog(A){switch(A.abortUnsubscribe(),A.kind){case"input":A.resolve(void 0);return;case"confirm":A.resolve(!1);return;case"select":A.resolve(void 0);return}}abortDialog(A){if(this.activeDialog===A){this.advanceDialog(),this.cancelDialog(A);return}let Q=this.queuedDialogs.indexOf(A);if(Q===-1)return;this.updateDialogState(()=>{this.queuedDialogs.splice(Q,1)}),this.cancelDialog(A)}enqueueDialog(A){if(this.activeDialog){if(this.queuedDialogs.push(A),this.resolvingDialog===this.activeDialog)this.advanceResolvingDialog(this.activeDialog);return}this.options.commandPalette.disable(),this.options.state.setState(()=>{this.activeDialog=A}),this.emitBlockingConfirmDialogChange()}resolveInputDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveConfirmDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveSelectDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveDialog(A,Q){if(this.activeDialog!==A||this.resolvingDialog===A)return;this.resolvingDialog=A,A.abortUnsubscribe(),Q(),this.scheduleResolvingDialogAdvance(A,C9Q)}scheduleResolvingDialogAdvance(A,Q){LQ.instance.addPostFrameCallback(()=>{if(this.activeDialog!==A)return;if(this.queuedDialogs.length>0||Q<=1){this.advanceResolvingDialog(A);return}this.scheduleResolvingDialogAdvance(A,Q-1)},"PluginIntegration.advanceDialog")}advanceResolvingDialog(A){if(this.resolvingDialog===A)this.resolvingDialog=null;if(this.activeDialog!==A)return;this.advanceDialog()}advanceDialog(){this.updateDialogState(()=>{this.activeDialog=this.queuedDialogs.shift()??null})}updateDialogState(A){if(this.options.state.mounted)this.options.state.setState(A);else A();this.emitBlockingConfirmDialogChange()}emitBlockingConfirmDialogChange(){let A=this.hasBlockingConfirmDialog();if(A===this.blockingConfirmDialog)return;this.blockingConfirmDialog=A,this.options.onBlockingConfirmDialogChange?.(A)}}h0();import{spawnSync as N9Q}from"node:child_process";import w8 from"node:process";var gw4={options:new Set(["settings-file","log-level","log-file","mcp-config"]),booleans:new Set(["color","dangerously-allow-all","ide","jetbrains","neo-orb","notifications"])};function ol(A){let Q=A.getRelaunchThreadIDs();if(A.onRelaunchRequested?.(Q),A.stop)A.stop();else I1.instance.stop()}function mw4(A){return{noun:"amp",verb:"Relaunch (Quit & Reopen)",description:"Quit, reopen Amp, and resume active threads",keywords:["restart","update"],shortcut:w8.env.NODE_ENV==="development"&&w8.platform==="darwin"?WA.meta("r"):void 0,status:{type:"enabled"},sortBoost:90,run:(Q,$,B)=>{B(),ol(A)}}}function q9Q(A,Q){let{command:$,args:B}=w9Q(A),D=w8.execve,E=w8.platform==="win32"||!D,F=E?"spawnSync":"execve";if(_.info("Relaunching Amp; threads will be resumed",{threadIDs:A,relaunchMethod:F}),E){let J=N9Q($,B,{cwd:Q,env:w8.env,stdio:"inherit"});if(J.error)return _.error("Failed to relaunch Amp",{error:J.error}),1;return J.status??1}try{if(w8.chdir(Q),$.includes("/"))return D($,[$,...B],w8.env);return D("/usr/bin/env",["env",$,...B],w8.env)}catch(J){return _.error("Failed to relaunch Amp",{error:J}),1}}class Om0{relaunchRequested=!1;requestedThreadIDs=[];request=(A)=>{_.info("Relaunch requested; threads will be resumed",{threadIDs:A}),this.relaunchRequested=!0,this.requestedThreadIDs=A};get shouldShowExitSummary(){return!this.relaunchRequested}relaunchIfRequested(A){if(!this.relaunchRequested)return;return q9Q(this.requestedThreadIDs,A)}}function w9Q(A){let Q=A.length>0?["threads","continue",...A]:[],$=O9Q(w8.argv),B=L9Q();if(B)return{command:B.command,args:[...B.args,...$,...Q]};let D=w8.argv[1],E=D&&M9Q(D)?[D]:[];return{command:w8.execPath,args:[...E,...$,...Q]}}function O9Q(A){let Q=[],$=A.slice(2);for(let B=0;B<$.length;B+=1){let D=$[B];if(!D?.startsWith("--"))continue;let[E,F]=D.split("=",2);if(!E)continue;let J=E.slice(2),U=J.startsWith("no-")?J.slice(3):J;if(gw4.booleans.has(U)){Q.push(D);continue}if(!gw4.options.has(J))continue;if(F!==void 0){Q.push(D);continue}let Y=$[B+1];if(Y===void 0||Y.startsWith("--"))continue;Q.push(D,Y),B+=1}return Q}function M9Q(A){return A!==w8.execPath&&!A.startsWith("/$bunfs/")}function L9Q(){if(w8.env.NODE_ENV!=="development")return null;let A=w8.env.AMP_DEV_RELAUNCH_COMMAND?.trim();if(!A)return null;let Q=j9Q(A),$=Q[0];if(!$)return null;return{command:$,args:Q.slice(1)}}function j9Q(A){if(A.startsWith("["))try{let Q=JSON.parse(A);if(Array.isArray(Q)&&Q.every(($)=>typeof $==="string"))return Q}catch{return[]}return A.split(/\s+/).filter(Boolean)}var R9Q=48;class Mm0{visible=!1;onClick=void 0;listeners=new Set;show(A){this.visible=!0,this.onClick=A,this.notifyListeners()}activate(){this.onClick?.()}get isVisible(){return this.visible}dismiss(){this.visible=!1,this.onClick=void 0,this.notifyListeners()}addListener(A){this.listeners.add(A)}removeListener(A){this.listeners.delete(A)}buildComplexToast(){if(!this.visible||!this.onClick)return null;return new ll({width:R9Q,title:"Relaunch to Update Amp",message:"Your threads will resume.",variant:"success",mouseBehavior:"click-anywhere",action:{keyboardShortcut:"Ctrl+O",command:"amp: relaunch",confirmShortcut:"Enter",label:"relaunch",onAction:()=>this.activate()}})}notifyListeners(){for(let A of this.listeners)A()}}import{readFile as P9Q}from"node:fs/promises";import Lm0 from"node:os";Q3();function T9Q(A=new Date){return A.toISOString().replaceAll("-","").replaceAll(":","").slice(0,15)+"Z"}async function dw4(A,Q){try{return{path:Q,contents:IT0(await P9Q(A,"utf8"))}}catch{return null}}async function tD0(A,Q){let $=[],B=T9Q(),D=await k4.getThread({thread:Q},{config:A.configService}),E=D.ok?D.result.thread.data:null;$.push({path:`${B}/thread.json`,contents:JSON.stringify(yU(E),null,2)});let F=await dw4(pP(Q),`${B}/logs/${Q}.log`);if(F)$.push(F);let J=await dw4(A.settingsFilePath,`${B}/settings/global.json`);if(J)$.push(J);let U=await UY()??"unknown",Y=await k4.sendReport({threadID:Q,files:$,metadata:{clientVersion:"0.0.1780014135-gb8f1f5",clientOS:`${Lm0.platform()} ${Lm0.release()} ${Lm0.arch()}`,installMethod:U}},{config:A.configService});if(!Y.ok)throw Error(`Failed to submit report: ${Y.error.message}`);return Y.result.reportID}class jm0{backStack=[];forwardStack=[];canNavigateBack(){return this.backStack.length>0}canNavigateForward(){return this.forwardStack.length>0}recordNavigation(A){if(!A)return;this.backStack.push(A),this.forwardStack.length=0}startBackNavigation(A){let Q=this.backStack.pop();if(!Q)return null;let $=Boolean(A);if(A)this.forwardStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.forwardStack.pop();this.backStack.push(Q)}}}startForwardNavigation(A){let Q=this.forwardStack.pop();if(!Q)return null;let $=Boolean(A);if(A)this.backStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.backStack.pop();this.forwardStack.push(Q)}}}}var v9Q=86400000;class Rm0{options;subscription=null;relaunchNotificationShown=!1;relaunchNotificationPending=!1;relaunchNotificationTimer=null;openedAt=Date.now();constructor(A){this.options=A}init(){if(this.subscription=this.options.updateService?.state.subscribe((A)=>{this.handleUpdateState(A)})??null,process.env.DEV_SHOW_RELAUNCH_NOTIF_ON_STARTUP==="1")this.showUpdateRelaunchNotification(!0)}dispose(){if(this.subscription?.unsubscribe(),this.subscription=null,this.relaunchNotificationTimer)clearTimeout(this.relaunchNotificationTimer),this.relaunchNotificationTimer=null}handleUpdateState(A){if(A!=="updated")return;this.showUpdateRelaunchNotification()}showUpdateRelaunchNotification(A=!1){if(this.relaunchNotificationShown)return;let $=(this.options.minimumOpenDurationMs??v9Q)-(Date.now()-this.openedAt);if($>0&&!A){if(this.relaunchNotificationPending=!0,!this.relaunchNotificationTimer)this.relaunchNotificationTimer=setTimeout(()=>{if(this.relaunchNotificationTimer=null,!this.relaunchNotificationPending)return;this.relaunchNotificationPending=!1,this.showUpdateRelaunchNotification()},$),this.relaunchNotificationTimer.unref();return}this.relaunchNotificationPending=!1,this.relaunchNotificationShown=!0,this.options.relaunchNotificationController.show(()=>ol(this.options))}}class eD0 extends hQ{offstage;constructor({key:A,offstage:Q=!0,child:$}){super({key:A,child:$});this.offstage=Q}createRenderObject(){return new Pm0(this.offstage)}updateRenderObject(A){if(A instanceof Pm0)A.offstage=this.offstage}}class Pm0 extends xA{_offstage;constructor(A){super();this._offstage=A}get offstage(){return this._offstage}set offstage(A){if(A===this._offstage)return;this._offstage=A,this.markNeedsLayout()}getMinIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicWidth(A)??0}getMaxIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicWidth(A)??0}getMinIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicHeight(A)??0}getMaxIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicHeight(A)??0}performLayout(){let A=this._lastConstraints;sA(!!A,"performLayout called without constraints");let Q=this.children[0];if(this._offstage){if(this.setSize(0,0),Q)Q.layout(A),Q.setOffset(0,0)}else if(Q){Q.layout(A);let $=A.constrain(Q.size.width,Q.size.height);this.setSize($.width,$.height),Q.setOffset(0,0)}else{let $=A.smallest;this.setSize($.width,$.height)}super.performLayout()}paint(A,Q,$){if(this._offstage)return;super.paint(A,Q,$)}hitTest(A,Q,$,B){if(this._offstage)return!1;return super.hitTest(A,Q,$,B)}}class rl{_state=null;_attach(A){this._state=A}_detach(){this._state=null}push(A){this._state?.push(A)}pushWithDismiss(A){this._state?.pushWithDismiss(A)}pop(){return this._state?.pop()??!1}get canPop(){return this._state?.canPop??!1}}class Tm0 extends a0{root;controller;constructor(A){super();this.root=A.root,this.controller=A.controller}createState(){return new cw4}}class cw4 extends n0{entries=[];initState(){this.widget.controller._attach(this)}didUpdateWidget(A){if(A.controller!==this.widget.controller)A.controller._detach(),this.widget.controller._attach(this)}dispose(){this.widget.controller._detach(),super.dispose()}push(A){let Q=new $T,$=this.makeScopedDismiss(Q);this.setState(()=>{this.entries.push({key:Q,widget:A,dismiss:$})})}pushWithDismiss(A){let Q=new $T,$=this.makeScopedDismiss(Q),B=A($);this.setState(()=>{this.entries.push({key:Q,widget:B,dismiss:$})})}pop(){if(this.entries.length===0)return!1;return this.setState(()=>{this.entries.pop()}),!0}get canPop(){return this.entries.length>0}makeScopedDismiss(A){return()=>{if(!this.mounted)return;let Q=this.entries[this.entries.length-1];if(!Q||Q.key!==A)return;this.setState(()=>{this.entries.pop()})}}build(A){let Q=[];Q.push(new eD0({offstage:this.entries.length>0,child:this.widget.root}));for(let $=0;$<this.entries.length;$++){let B=this.entries[$],D=$===this.entries.length-1,E=D?new Y$({autofocus:!0,debugLabel:`ModalStackEntry[${$}]`,onKey:(F)=>{if(F.key!=="Escape")return"ignored";return B.dismiss(),"handled"},child:B.widget}):B.widget;Q.push(new eD0({key:B.key,offstage:!D,child:E}))}return new A6({fit:"expand",children:Q})}}class _m0 extends $4{props;constructor(A){super();this.props=A}build(A){let Q=this.props.commands.filter((D)=>D.status.type!=="hidden"),$=S9Q(Q),B="";return new s4({header:"Command Palette",autofocus:!1,barrierOpaque:!1,chromePadding:t0.only({left:1,top:1,right:1}),footer:"none",onDismiss:this.props.onDismiss,child:new S5({items:Q,showBorder:!1,getLabel:(D)=>{let E=vm0(D);return D.keywords&&D.keywords.length>0?`${E} ${D.keywords.join(" ").toLowerCase()}`:E},onQueryChange:(D)=>{B=D},sortItems:(D,E,F)=>{B=F;let J=F.trim().toLowerCase();if(J===""){let V=D.item.status.type==="disabled"?1:0,z=E.item.status.type==="disabled"?1:0;if(V!==z)return V-z;let K=D.item.sortBoost??0,C=E.item.sortBoost??0;if(K!==C)return C-K;let W=D.item.noun?.toLowerCase()??"",u=E.item.noun?.toLowerCase()??"";if(W!==u)return W<u?-1:1;return 0}let U=pw4(D.item,J),Y=pw4(E.item,J);if(U!==Y)return U?-1:1;let Z=pN(D.item.verb.toLowerCase(),F),X=pN(E.item.verb.toLowerCase(),F);if(Z!==X)return X-Z;let I=pN(vm0(D.item),F),G=pN(vm0(E.item),F);if(I!==G)return G-I;return E.score-D.score},isItemDisabled:(D)=>D.status.type==="disabled",buildDisabledReasonWidget:(D,E)=>{if(D.status.type!=="disabled")return;let{colors:F}=EA.of(E);return new F0({text:new g(D.status.reason,new $0({color:F.mutedForeground,dim:!0})),textAlign:"center",maxLines:1,overflow:"ellipsis"})},renderItem:(D,E,F,J)=>new lw4({command:D,isSelected:E,isDisabled:F,categoryWidth:$,query:B,buildContext:J}),onAccept:(D)=>{this.props.onAccept(D)},onDismiss:this.props.onDismiss})})}}class lw4 extends $4{props;constructor(A){super();this.props=A}build(A){let{command:Q,isSelected:$,isDisabled:B,categoryWidth:D,query:E,buildContext:F}=this.props,J=EA.of(F),{colors:U,app:Y}=J,Z=$?Y.selectionBackground:void 0,X=$?Y.selectionForeground:U.foreground,I=$?X:U.mutedForeground,G=new F0({text:new g(Q.noun?.toLowerCase()??"",new $0({color:I,dim:B||!$})),textAlign:"right",maxLines:1,overflow:"ellipsis"}),V=Q.verb.toLowerCase();if(B)V+=" (unavailable)";let z=_9Q(Q,E);if(z)V+=` (alias: ${z})`;let K=new F0({text:new g(V,new $0({color:X,bold:!0,dim:B})),maxLines:1,overflow:"ellipsis"}),C=[{child:G,fixedWidth:D},{child:K,expanded:!0}];if(Q.shortcut)C.push({child:k9Q(Q.shortcut,J,B)});return new iw4({columns:C,padding:t0.horizontal(1),backgroundColor:Z})}}function vm0(A){return A.noun?`${A.noun.toLowerCase()} ${A.verb.toLowerCase()}`:A.verb.toLowerCase()}function pw4(A,Q){return A.keywords?.some(($)=>$.trim().toLowerCase()===Q)??!1}function _9Q(A,Q){let $=Q.trim().toLowerCase();if($==="")return;return A.keywords?.find((B)=>B.trim().toLowerCase()===$)}function S9Q(A){return A.reduce((Q,$)=>{return $.noun?Math.max(Q,oA($.noun)):Q},0)}function k9Q(A,Q,$){let{app:B}=Q,D=new $0({color:B.keybind,bold:!0,dim:$}),E=[],F=mX(A.toString()).split("+");for(let J=0;J<F.length;J++){if(J>0)E.push(new g("+",D));E.push(new g(F[J],D))}return F0.spans(E)}class iw4 extends $4{props;constructor(A){super();this.props=A}build(A){let{columns:Q,gap:$=2,padding:B,backgroundColor:D}=this.props,E=[];for(let J=0;J<Q.length;J++){let U=Q[J];if(J>0&&$>0)E.push(new b0({width:$}));if(U.fixedWidth!==void 0)E.push(new b0({width:U.fixedWidth,child:U.child}));else if(U.expanded)E.push(new M4({child:U.child}));else E.push(U.child)}let F=new uA({crossAxisAlignment:"start",children:E});if(!B&&!D)return F;return new KA({decoration:D?{color:D}:void 0,padding:B,child:F})}}class Sm0{#A=[];#Q=new Set;get commands(){return this.#A}register(A){return this.#A.push(A),this.#$(),()=>{let Q=this.#A.indexOf(A);if(Q===-1)return;this.#A.splice(Q,1),this.#$()}}findByID(A){return this.#A.find((Q)=>Q.id===A)}runByID(A,Q){let $=this.findByID(A);if(!$||$.status.type!=="enabled")return!1;return $.run(new rl,Q,()=>{}),!0}addListener(A){this.#Q.add(A)}removeListener(A){this.#Q.delete(A)}#$(){for(let A of this.#Q)A()}}class AB extends EQ{commandRegistry;constructor({commandRegistry:A,child:Q}){super({child:Q});this.commandRegistry=A}updateShouldNotify(A){return!1}static of(A){let Q=AB.maybeOf(A);if(!Q)throw Error("No CommandRegistryProvider found in widget tree");return Q}static maybeOf(A){return A.dependOnInheritedWidgetOfExactType(AB)?.commandRegistry??null}}class km0 extends a0{onDismiss;constructor(A){super();this.onDismiss=A.onDismiss}createState(){return new nw4}}class nw4 extends n0{modalStack=new rl;commandRegistry=null;initState(){super.initState(),queueMicrotask(()=>{if(!this.mounted)return;let A=AB.of(this.context);this.commandRegistry=A,A.addListener(this.onCommandsChanged)})}dispose(){this.commandRegistry?.removeListener(this.onCommandsChanged),this.commandRegistry=null,super.dispose()}onCommandsChanged=()=>{this.setState()};build(A){let Q=AB.of(A).commands,$=new _m0({commands:Q,onAccept:(B)=>{B.run(this.modalStack,A,this.widget.onDismiss)},onDismiss:()=>{if(this.modalStack.canPop)this.modalStack.pop();else this.widget.onDismiss()}});return new Tm0({root:$,controller:this.modalStack})}}var aw4=[{description:"Move cursor up/down",methods:[{keys:["↑"]},{keys:["↓"]}]},{description:"Move cursor left/right",methods:[{keys:["←"]},{keys:["→"]},{input:"B",keys:["Ctrl"]},{input:"F",keys:["Ctrl"]}]},{description:"Insert newline",methods:[{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!0},{description:"Insert newline",methods:[{keys:["Enter"]},{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!1},{description:"Submit message",methods:[{keys:["Enter"]}],submitOnEnterOnly:!0},{description:"Submit message",methods:[{keys:["Ctrl/Cmd","Enter"]}],submitOnEnterOnly:!1},{description:"Clear input",methods:[{keys:["Escape"]}]},{description:"Edit prompt in $EDITOR",methods:[{input:"G",keys:["Ctrl"]}]},{description:"Navigate history (previous/next)",methods:[{input:"P",keys:["Ctrl"]},{input:"N",keys:["Ctrl"]}]},{description:"Jump to start of line",methods:[{keys:["Cmd","←"]},{input:"A",keys:["Ctrl"]}]},{description:"Jump to end of line",methods:[{keys:["Cmd","→"]},{input:"E",keys:["Ctrl"]}]},{description:"Jump to previous word",methods:[{keys:["Alt","←"]},{keys:["Ctrl","←"]},{input:"B",keys:["Alt"]}]},{description:"Jump to next word",methods:[{keys:["Alt","→"]},{keys:["Ctrl","→"]},{input:"F",keys:["Alt"]}]},{description:"Delete character backward",methods:[{keys:["Backspace"]},{input:"H",keys:["Ctrl"]}]},{description:"Delete word backward",methods:[{keys:["Alt","Backspace"]},{input:"W",keys:["Ctrl"]}]},{description:"Delete character forward",methods:[{keys:["Delete"]},{input:"D",keys:["Ctrl"]}]},{description:"Delete to start of line",methods:[{keys:["Cmd","Backspace"]},{input:"U",keys:["Ctrl"]}]},{description:"Delete to end of line",methods:[{input:"K",keys:["Ctrl"]}]},{description:"Yank (paste deleted text)",methods:[{input:"Y",keys:["Ctrl"]}]},{description:"Paste image from clipboard",methods:[{input:"V",keys:["Ctrl"]}]},{description:"Switch agent mode",methods:[{input:"S",keys:["Ctrl"]}]},{description:"Toggle reasoning effort",methods:[{input:"D",keys:["Alt"]}]},{description:"Open command palette",methods:[{input:"O",keys:["Ctrl"]}]},{description:"Mention files",methods:[{keys:["@"]}]},{description:"Mention threads",methods:[{keys:["@@"]}]},{description:"Show prompt history",methods:[{input:"R",keys:["Ctrl"]}]},{description:"Toggle inline shortcuts help",methods:[{keys:["?"]}]},{description:"Toggle thinking/dense view",methods:[{input:"T",keys:["Alt"]}]}],ow4=[{description:"Page scroll",methods:[{keys:["Pg Up"]},{keys:["Pg Down"]}]},{description:"Half-page scroll",methods:[{input:"K",keys:["Alt"]},{input:"J",keys:["Alt"]}]},{description:"Mouse wheel scroll",methods:[{keys:["Mouse Wheel"]}]},{description:"Jump to first message",methods:[{keys:["Home"]}]},{description:"Jump to bottom of screen",methods:[{keys:["End"]}]},{description:"Navigate to previous messages",methods:[{keys:["Tab"]},{keys:["Shift","Tab"]}]}];class A80 extends $4{items;renderRow;constructor({items:A,renderRow:Q}){super();this.items=A,this.renderRow=Q}build(A){let $=z4.of(A).size.width<50,B=[];for(let D of this.items){let[E,F]=this.renderRow(D),J;if($)J=new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[E,new gA({padding:t0.only({left:4}),child:F})]});else J=new uA({crossAxisAlignment:"start",children:[new M4({flex:1,child:E}),new b0({width:1}),new M4({flex:1,child:F})]});B.push(new gA({padding:t0.horizontal(6),child:J}))}return new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:B})}}function f9Q(A){let Q=[...A.keys];if(A.input)Q.push(A.input);return mX(Q.join("+"))}class fm0 extends $4{commands;onDismiss;constructor(A){super();this.commands=A.commands,this.onDismiss=A.onDismiss}build(A){let Q=EA.of(A),{colors:$,app:B}=Q,D=z4.of(A),E=new $0({color:$.secondary,bold:!0}),F=new $0({color:B.keybind}),J=new $0({color:B.command}),U=new $0({color:$.foreground}),Y=Math.max(40,Math.min(80,D.size.width-4)),X=[...this.commands.filter((V)=>{let z=V.noun?.toLowerCase();return z!=="dev"&&z!=="debug"&&V.status.type!=="hidden"})].sort((V,z)=>{let K=(V.noun??"").toLowerCase(),C=(z.noun??"").toLowerCase(),W=K.localeCompare(C);if(W!==0)return W;return V.verb.toLowerCase().localeCompare(z.verb.toLowerCase())}),I=(V)=>{let z=V.methods.map((K)=>f9Q(K)).join(", ");return[new F0({text:new g(z,F)}),new F0({text:new g(V.description,U)})]},G=new v3({autofocus:!0,child:new KA({constraints:new Y4(Y,Y,0,Number.POSITIVE_INFINITY),child:new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[new gA({padding:t0.horizontal(2),child:new F0({text:new g(`Editor Shortcuts
|
|
4744
|
+
${$.errorMessage??""}`;if(Q.add(B),this.pluginErrorToastKeys.has(B))continue;this.options.toastController.show(this.formatPluginErrorToast($),"error",8000)}this.pluginErrorToastKeys=Q}removeInactivePluginStatusItems(A){let Q=new Set(A.filter((B)=>B.status==="active").map((B)=>B.uri.toString())),$=[];for(let[B,D]of this.statusItems){if(Q.has(D.pluginURI))continue;$.push(B)}if($.length===0)return;this.updateStatusItemState(()=>{for(let B of $)this.statusItems.delete(B)})}formatPluginErrorToast(A){let Q=A.uri.toString();return`Plugin failed: ${Q.split("/").pop()??Q}. See logs: ${this.options.context.logFilePath}`}createPluginCommand(A){return{id:A.id,noun:A.category,verb:A.title,description:A.description??`Run plugin command ${A.category}: ${A.title}`,status:A.availability,run:async(Q,$,B)=>{B();try{await this.options.context.pluginService?.commands.execute(A.pluginName,A.id,{threadID:this.options.getActiveThreadID()})}catch(D){_.error("Neo plugin command failed",{error:D,command:A}),this.options.toastController.show(D instanceof Error?D.message:String(D),"error",5000)}}}}showInputDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"input",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=JV(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showConfirmDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(!1);return}let B={kind:"confirm",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=JV(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};showSelectDialog=(A,Q)=>{return new Promise(($)=>{if(this.disposed||!this.options.state.mounted||Q?.aborted){$(void 0);return}let B={kind:"select",options:A,resolve:$,abortUnsubscribe:()=>{}};B.abortUnsubscribe=JV(Q,()=>this.abortDialog(B)),this.enqueueDialog(B)})};createStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{let B=this.statusItemKey(A,Q),D={pluginURI:A,id:Q};if($!==void 0)D.value=$;this.statusItems.set(B,D)})};updateStatusItem=(A,Q,$)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.set(this.statusItemKey(A,Q),{pluginURI:A,id:Q,value:$})})};removeStatusItem=(A,Q)=>{if(this.disposed)return;this.updateStatusItemState(()=>{this.statusItems.delete(this.statusItemKey(A,Q))})};readThreadMessages=(A,Q)=>{let $=this.options.readThreadMessages;if(!$)return Promise.reject(Error("thread.messages is not available - no active thread"));return $(A,Q)};updateStatusItemState(A){if(this.options.state.mounted)this.options.state.setState(A);else A()}statusItemKey(A,Q){return`${A}\x00${Q}`}cancelPendingDialogs(){let A=[];if(this.activeDialog)A.push(this.activeDialog);A.push(...this.queuedDialogs),this.activeDialog=null,this.queuedDialogs=[],this.resolvingDialog=null,this.emitBlockingConfirmDialogChange();for(let Q of A)this.cancelDialog(Q)}cancelDialog(A){switch(A.abortUnsubscribe(),A.kind){case"input":A.resolve(void 0);return;case"confirm":A.resolve(!1);return;case"select":A.resolve(void 0);return}}abortDialog(A){if(this.activeDialog===A){this.advanceDialog(),this.cancelDialog(A);return}let Q=this.queuedDialogs.indexOf(A);if(Q===-1)return;this.updateDialogState(()=>{this.queuedDialogs.splice(Q,1)}),this.cancelDialog(A)}enqueueDialog(A){if(this.activeDialog){if(this.queuedDialogs.push(A),this.resolvingDialog===this.activeDialog)this.advanceResolvingDialog(this.activeDialog);return}this.options.commandPalette.disable(),this.options.state.setState(()=>{this.activeDialog=A}),this.emitBlockingConfirmDialogChange()}resolveInputDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveConfirmDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveSelectDialog(A,Q){this.resolveDialog(A,()=>A.resolve(Q))}resolveDialog(A,Q){if(this.activeDialog!==A||this.resolvingDialog===A)return;this.resolvingDialog=A,A.abortUnsubscribe(),Q(),this.scheduleResolvingDialogAdvance(A,C9Q)}scheduleResolvingDialogAdvance(A,Q){LQ.instance.addPostFrameCallback(()=>{if(this.activeDialog!==A)return;if(this.queuedDialogs.length>0||Q<=1){this.advanceResolvingDialog(A);return}this.scheduleResolvingDialogAdvance(A,Q-1)},"PluginIntegration.advanceDialog")}advanceResolvingDialog(A){if(this.resolvingDialog===A)this.resolvingDialog=null;if(this.activeDialog!==A)return;this.advanceDialog()}advanceDialog(){this.updateDialogState(()=>{this.activeDialog=this.queuedDialogs.shift()??null})}updateDialogState(A){if(this.options.state.mounted)this.options.state.setState(A);else A();this.emitBlockingConfirmDialogChange()}emitBlockingConfirmDialogChange(){let A=this.hasBlockingConfirmDialog();if(A===this.blockingConfirmDialog)return;this.blockingConfirmDialog=A,this.options.onBlockingConfirmDialogChange?.(A)}}h0();import{spawnSync as N9Q}from"node:child_process";import w8 from"node:process";var gw4={options:new Set(["settings-file","log-level","log-file","mcp-config"]),booleans:new Set(["color","dangerously-allow-all","ide","jetbrains","neo-orb","notifications"])};function ol(A){let Q=A.getRelaunchThreadIDs();if(A.onRelaunchRequested?.(Q),A.stop)A.stop();else I1.instance.stop()}function mw4(A){return{noun:"amp",verb:"Relaunch (Quit & Reopen)",description:"Quit, reopen Amp, and resume active threads",keywords:["restart","update"],shortcut:w8.env.NODE_ENV==="development"&&w8.platform==="darwin"?WA.meta("r"):void 0,status:{type:"enabled"},sortBoost:90,run:(Q,$,B)=>{B(),ol(A)}}}function q9Q(A,Q){let{command:$,args:B}=w9Q(A),D=w8.execve,E=w8.platform==="win32"||!D,F=E?"spawnSync":"execve";if(_.info("Relaunching Amp; threads will be resumed",{threadIDs:A,relaunchMethod:F}),E){let J=N9Q($,B,{cwd:Q,env:w8.env,stdio:"inherit"});if(J.error)return _.error("Failed to relaunch Amp",{error:J.error}),1;return J.status??1}try{if(w8.chdir(Q),$.includes("/"))return D($,[$,...B],w8.env);return D("/usr/bin/env",["env",$,...B],w8.env)}catch(J){return _.error("Failed to relaunch Amp",{error:J}),1}}class Om0{relaunchRequested=!1;requestedThreadIDs=[];request=(A)=>{_.info("Relaunch requested; threads will be resumed",{threadIDs:A}),this.relaunchRequested=!0,this.requestedThreadIDs=A};get shouldShowExitSummary(){return!this.relaunchRequested}relaunchIfRequested(A){if(!this.relaunchRequested)return;return q9Q(this.requestedThreadIDs,A)}}function w9Q(A){let Q=A.length>0?["threads","continue",...A]:[],$=O9Q(w8.argv),B=L9Q();if(B)return{command:B.command,args:[...B.args,...$,...Q]};let D=w8.argv[1],E=D&&M9Q(D)?[D]:[];return{command:w8.execPath,args:[...E,...$,...Q]}}function O9Q(A){let Q=[],$=A.slice(2);for(let B=0;B<$.length;B+=1){let D=$[B];if(!D?.startsWith("--"))continue;let[E,F]=D.split("=",2);if(!E)continue;let J=E.slice(2),U=J.startsWith("no-")?J.slice(3):J;if(gw4.booleans.has(U)){Q.push(D);continue}if(!gw4.options.has(J))continue;if(F!==void 0){Q.push(D);continue}let Y=$[B+1];if(Y===void 0||Y.startsWith("--"))continue;Q.push(D,Y),B+=1}return Q}function M9Q(A){return A!==w8.execPath&&!A.startsWith("/$bunfs/")}function L9Q(){if(w8.env.NODE_ENV!=="development")return null;let A=w8.env.AMP_DEV_RELAUNCH_COMMAND?.trim();if(!A)return null;let Q=j9Q(A),$=Q[0];if(!$)return null;return{command:$,args:Q.slice(1)}}function j9Q(A){if(A.startsWith("["))try{let Q=JSON.parse(A);if(Array.isArray(Q)&&Q.every(($)=>typeof $==="string"))return Q}catch{return[]}return A.split(/\s+/).filter(Boolean)}var R9Q=48;class Mm0{visible=!1;onClick=void 0;listeners=new Set;show(A){this.visible=!0,this.onClick=A,this.notifyListeners()}activate(){this.onClick?.()}get isVisible(){return this.visible}dismiss(){this.visible=!1,this.onClick=void 0,this.notifyListeners()}addListener(A){this.listeners.add(A)}removeListener(A){this.listeners.delete(A)}buildComplexToast(){if(!this.visible||!this.onClick)return null;return new ll({width:R9Q,title:"Relaunch to Update Amp",message:"Your threads will resume.",variant:"success",mouseBehavior:"click-anywhere",action:{keyboardShortcut:"Ctrl+O",command:"amp: relaunch",confirmShortcut:"Enter",label:"relaunch",onAction:()=>this.activate()}})}notifyListeners(){for(let A of this.listeners)A()}}import{readFile as P9Q}from"node:fs/promises";import Lm0 from"node:os";Q3();function T9Q(A=new Date){return A.toISOString().replaceAll("-","").replaceAll(":","").slice(0,15)+"Z"}async function dw4(A,Q){try{return{path:Q,contents:IT0(await P9Q(A,"utf8"))}}catch{return null}}async function tD0(A,Q){let $=[],B=T9Q(),D=await k4.getThread({thread:Q},{config:A.configService}),E=D.ok?D.result.thread.data:null;$.push({path:`${B}/thread.json`,contents:JSON.stringify(yU(E),null,2)});let F=await dw4(pP(Q),`${B}/logs/${Q}.log`);if(F)$.push(F);let J=await dw4(A.settingsFilePath,`${B}/settings/global.json`);if(J)$.push(J);let U=await UY()??"unknown",Y=await k4.sendReport({threadID:Q,files:$,metadata:{clientVersion:"0.0.1780032159-g3925ab",clientOS:`${Lm0.platform()} ${Lm0.release()} ${Lm0.arch()}`,installMethod:U}},{config:A.configService});if(!Y.ok)throw Error(`Failed to submit report: ${Y.error.message}`);return Y.result.reportID}class jm0{backStack=[];forwardStack=[];canNavigateBack(){return this.backStack.length>0}canNavigateForward(){return this.forwardStack.length>0}recordNavigation(A){if(!A)return;this.backStack.push(A),this.forwardStack.length=0}startBackNavigation(A){let Q=this.backStack.pop();if(!Q)return null;let $=Boolean(A);if(A)this.forwardStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.forwardStack.pop();this.backStack.push(Q)}}}startForwardNavigation(A){let Q=this.forwardStack.pop();if(!Q)return null;let $=Boolean(A);if(A)this.backStack.push(A);return{targetThreadID:Q,rollback:()=>{if($)this.backStack.pop();this.forwardStack.push(Q)}}}}var v9Q=86400000;class Rm0{options;subscription=null;relaunchNotificationShown=!1;relaunchNotificationPending=!1;relaunchNotificationTimer=null;openedAt=Date.now();constructor(A){this.options=A}init(){if(this.subscription=this.options.updateService?.state.subscribe((A)=>{this.handleUpdateState(A)})??null,process.env.DEV_SHOW_RELAUNCH_NOTIF_ON_STARTUP==="1")this.showUpdateRelaunchNotification(!0)}dispose(){if(this.subscription?.unsubscribe(),this.subscription=null,this.relaunchNotificationTimer)clearTimeout(this.relaunchNotificationTimer),this.relaunchNotificationTimer=null}handleUpdateState(A){if(A!=="updated")return;this.showUpdateRelaunchNotification()}showUpdateRelaunchNotification(A=!1){if(this.relaunchNotificationShown)return;let $=(this.options.minimumOpenDurationMs??v9Q)-(Date.now()-this.openedAt);if($>0&&!A){if(this.relaunchNotificationPending=!0,!this.relaunchNotificationTimer)this.relaunchNotificationTimer=setTimeout(()=>{if(this.relaunchNotificationTimer=null,!this.relaunchNotificationPending)return;this.relaunchNotificationPending=!1,this.showUpdateRelaunchNotification()},$),this.relaunchNotificationTimer.unref();return}this.relaunchNotificationPending=!1,this.relaunchNotificationShown=!0,this.options.relaunchNotificationController.show(()=>ol(this.options))}}class eD0 extends hQ{offstage;constructor({key:A,offstage:Q=!0,child:$}){super({key:A,child:$});this.offstage=Q}createRenderObject(){return new Pm0(this.offstage)}updateRenderObject(A){if(A instanceof Pm0)A.offstage=this.offstage}}class Pm0 extends xA{_offstage;constructor(A){super();this._offstage=A}get offstage(){return this._offstage}set offstage(A){if(A===this._offstage)return;this._offstage=A,this.markNeedsLayout()}getMinIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicWidth(A)??0}getMaxIntrinsicWidth(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicWidth(A)??0}getMinIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMinIntrinsicHeight(A)??0}getMaxIntrinsicHeight(A){if(this._offstage)return 0;return this.children[0]?.getMaxIntrinsicHeight(A)??0}performLayout(){let A=this._lastConstraints;sA(!!A,"performLayout called without constraints");let Q=this.children[0];if(this._offstage){if(this.setSize(0,0),Q)Q.layout(A),Q.setOffset(0,0)}else if(Q){Q.layout(A);let $=A.constrain(Q.size.width,Q.size.height);this.setSize($.width,$.height),Q.setOffset(0,0)}else{let $=A.smallest;this.setSize($.width,$.height)}super.performLayout()}paint(A,Q,$){if(this._offstage)return;super.paint(A,Q,$)}hitTest(A,Q,$,B){if(this._offstage)return!1;return super.hitTest(A,Q,$,B)}}class rl{_state=null;_attach(A){this._state=A}_detach(){this._state=null}push(A){this._state?.push(A)}pushWithDismiss(A){this._state?.pushWithDismiss(A)}pop(){return this._state?.pop()??!1}get canPop(){return this._state?.canPop??!1}}class Tm0 extends a0{root;controller;constructor(A){super();this.root=A.root,this.controller=A.controller}createState(){return new cw4}}class cw4 extends n0{entries=[];initState(){this.widget.controller._attach(this)}didUpdateWidget(A){if(A.controller!==this.widget.controller)A.controller._detach(),this.widget.controller._attach(this)}dispose(){this.widget.controller._detach(),super.dispose()}push(A){let Q=new $T,$=this.makeScopedDismiss(Q);this.setState(()=>{this.entries.push({key:Q,widget:A,dismiss:$})})}pushWithDismiss(A){let Q=new $T,$=this.makeScopedDismiss(Q),B=A($);this.setState(()=>{this.entries.push({key:Q,widget:B,dismiss:$})})}pop(){if(this.entries.length===0)return!1;return this.setState(()=>{this.entries.pop()}),!0}get canPop(){return this.entries.length>0}makeScopedDismiss(A){return()=>{if(!this.mounted)return;let Q=this.entries[this.entries.length-1];if(!Q||Q.key!==A)return;this.setState(()=>{this.entries.pop()})}}build(A){let Q=[];Q.push(new eD0({offstage:this.entries.length>0,child:this.widget.root}));for(let $=0;$<this.entries.length;$++){let B=this.entries[$],D=$===this.entries.length-1,E=D?new Y$({autofocus:!0,debugLabel:`ModalStackEntry[${$}]`,onKey:(F)=>{if(F.key!=="Escape")return"ignored";return B.dismiss(),"handled"},child:B.widget}):B.widget;Q.push(new eD0({key:B.key,offstage:!D,child:E}))}return new A6({fit:"expand",children:Q})}}class _m0 extends $4{props;constructor(A){super();this.props=A}build(A){let Q=this.props.commands.filter((D)=>D.status.type!=="hidden"),$=S9Q(Q),B="";return new s4({header:"Command Palette",autofocus:!1,barrierOpaque:!1,chromePadding:t0.only({left:1,top:1,right:1}),footer:"none",onDismiss:this.props.onDismiss,child:new S5({items:Q,showBorder:!1,getLabel:(D)=>{let E=vm0(D);return D.keywords&&D.keywords.length>0?`${E} ${D.keywords.join(" ").toLowerCase()}`:E},onQueryChange:(D)=>{B=D},sortItems:(D,E,F)=>{B=F;let J=F.trim().toLowerCase();if(J===""){let V=D.item.status.type==="disabled"?1:0,z=E.item.status.type==="disabled"?1:0;if(V!==z)return V-z;let K=D.item.sortBoost??0,C=E.item.sortBoost??0;if(K!==C)return C-K;let W=D.item.noun?.toLowerCase()??"",u=E.item.noun?.toLowerCase()??"";if(W!==u)return W<u?-1:1;return 0}let U=pw4(D.item,J),Y=pw4(E.item,J);if(U!==Y)return U?-1:1;let Z=pN(D.item.verb.toLowerCase(),F),X=pN(E.item.verb.toLowerCase(),F);if(Z!==X)return X-Z;let I=pN(vm0(D.item),F),G=pN(vm0(E.item),F);if(I!==G)return G-I;return E.score-D.score},isItemDisabled:(D)=>D.status.type==="disabled",buildDisabledReasonWidget:(D,E)=>{if(D.status.type!=="disabled")return;let{colors:F}=EA.of(E);return new F0({text:new g(D.status.reason,new $0({color:F.mutedForeground,dim:!0})),textAlign:"center",maxLines:1,overflow:"ellipsis"})},renderItem:(D,E,F,J)=>new lw4({command:D,isSelected:E,isDisabled:F,categoryWidth:$,query:B,buildContext:J}),onAccept:(D)=>{this.props.onAccept(D)},onDismiss:this.props.onDismiss})})}}class lw4 extends $4{props;constructor(A){super();this.props=A}build(A){let{command:Q,isSelected:$,isDisabled:B,categoryWidth:D,query:E,buildContext:F}=this.props,J=EA.of(F),{colors:U,app:Y}=J,Z=$?Y.selectionBackground:void 0,X=$?Y.selectionForeground:U.foreground,I=$?X:U.mutedForeground,G=new F0({text:new g(Q.noun?.toLowerCase()??"",new $0({color:I,dim:B||!$})),textAlign:"right",maxLines:1,overflow:"ellipsis"}),V=Q.verb.toLowerCase();if(B)V+=" (unavailable)";let z=_9Q(Q,E);if(z)V+=` (alias: ${z})`;let K=new F0({text:new g(V,new $0({color:X,bold:!0,dim:B})),maxLines:1,overflow:"ellipsis"}),C=[{child:G,fixedWidth:D},{child:K,expanded:!0}];if(Q.shortcut)C.push({child:k9Q(Q.shortcut,J,B)});return new iw4({columns:C,padding:t0.horizontal(1),backgroundColor:Z})}}function vm0(A){return A.noun?`${A.noun.toLowerCase()} ${A.verb.toLowerCase()}`:A.verb.toLowerCase()}function pw4(A,Q){return A.keywords?.some(($)=>$.trim().toLowerCase()===Q)??!1}function _9Q(A,Q){let $=Q.trim().toLowerCase();if($==="")return;return A.keywords?.find((B)=>B.trim().toLowerCase()===$)}function S9Q(A){return A.reduce((Q,$)=>{return $.noun?Math.max(Q,oA($.noun)):Q},0)}function k9Q(A,Q,$){let{app:B}=Q,D=new $0({color:B.keybind,bold:!0,dim:$}),E=[],F=mX(A.toString()).split("+");for(let J=0;J<F.length;J++){if(J>0)E.push(new g("+",D));E.push(new g(F[J],D))}return F0.spans(E)}class iw4 extends $4{props;constructor(A){super();this.props=A}build(A){let{columns:Q,gap:$=2,padding:B,backgroundColor:D}=this.props,E=[];for(let J=0;J<Q.length;J++){let U=Q[J];if(J>0&&$>0)E.push(new b0({width:$}));if(U.fixedWidth!==void 0)E.push(new b0({width:U.fixedWidth,child:U.child}));else if(U.expanded)E.push(new M4({child:U.child}));else E.push(U.child)}let F=new uA({crossAxisAlignment:"start",children:E});if(!B&&!D)return F;return new KA({decoration:D?{color:D}:void 0,padding:B,child:F})}}class Sm0{#A=[];#Q=new Set;get commands(){return this.#A}register(A){return this.#A.push(A),this.#$(),()=>{let Q=this.#A.indexOf(A);if(Q===-1)return;this.#A.splice(Q,1),this.#$()}}findByID(A){return this.#A.find((Q)=>Q.id===A)}runByID(A,Q){let $=this.findByID(A);if(!$||$.status.type!=="enabled")return!1;return $.run(new rl,Q,()=>{}),!0}addListener(A){this.#Q.add(A)}removeListener(A){this.#Q.delete(A)}#$(){for(let A of this.#Q)A()}}class AB extends EQ{commandRegistry;constructor({commandRegistry:A,child:Q}){super({child:Q});this.commandRegistry=A}updateShouldNotify(A){return!1}static of(A){let Q=AB.maybeOf(A);if(!Q)throw Error("No CommandRegistryProvider found in widget tree");return Q}static maybeOf(A){return A.dependOnInheritedWidgetOfExactType(AB)?.commandRegistry??null}}class km0 extends a0{onDismiss;constructor(A){super();this.onDismiss=A.onDismiss}createState(){return new nw4}}class nw4 extends n0{modalStack=new rl;commandRegistry=null;initState(){super.initState(),queueMicrotask(()=>{if(!this.mounted)return;let A=AB.of(this.context);this.commandRegistry=A,A.addListener(this.onCommandsChanged)})}dispose(){this.commandRegistry?.removeListener(this.onCommandsChanged),this.commandRegistry=null,super.dispose()}onCommandsChanged=()=>{this.setState()};build(A){let Q=AB.of(A).commands,$=new _m0({commands:Q,onAccept:(B)=>{B.run(this.modalStack,A,this.widget.onDismiss)},onDismiss:()=>{if(this.modalStack.canPop)this.modalStack.pop();else this.widget.onDismiss()}});return new Tm0({root:$,controller:this.modalStack})}}var aw4=[{description:"Move cursor up/down",methods:[{keys:["↑"]},{keys:["↓"]}]},{description:"Move cursor left/right",methods:[{keys:["←"]},{keys:["→"]},{input:"B",keys:["Ctrl"]},{input:"F",keys:["Ctrl"]}]},{description:"Insert newline",methods:[{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!0},{description:"Insert newline",methods:[{keys:["Enter"]},{keys:["Shift","Enter"]},{keys:["Alt","Enter"]},{input:"J",keys:["Ctrl"]}],submitOnEnterOnly:!1},{description:"Submit message",methods:[{keys:["Enter"]}],submitOnEnterOnly:!0},{description:"Submit message",methods:[{keys:["Ctrl/Cmd","Enter"]}],submitOnEnterOnly:!1},{description:"Clear input",methods:[{keys:["Escape"]}]},{description:"Edit prompt in $EDITOR",methods:[{input:"G",keys:["Ctrl"]}]},{description:"Navigate history (previous/next)",methods:[{input:"P",keys:["Ctrl"]},{input:"N",keys:["Ctrl"]}]},{description:"Jump to start of line",methods:[{keys:["Cmd","←"]},{input:"A",keys:["Ctrl"]}]},{description:"Jump to end of line",methods:[{keys:["Cmd","→"]},{input:"E",keys:["Ctrl"]}]},{description:"Jump to previous word",methods:[{keys:["Alt","←"]},{keys:["Ctrl","←"]},{input:"B",keys:["Alt"]}]},{description:"Jump to next word",methods:[{keys:["Alt","→"]},{keys:["Ctrl","→"]},{input:"F",keys:["Alt"]}]},{description:"Delete character backward",methods:[{keys:["Backspace"]},{input:"H",keys:["Ctrl"]}]},{description:"Delete word backward",methods:[{keys:["Alt","Backspace"]},{input:"W",keys:["Ctrl"]}]},{description:"Delete character forward",methods:[{keys:["Delete"]},{input:"D",keys:["Ctrl"]}]},{description:"Delete to start of line",methods:[{keys:["Cmd","Backspace"]},{input:"U",keys:["Ctrl"]}]},{description:"Delete to end of line",methods:[{input:"K",keys:["Ctrl"]}]},{description:"Yank (paste deleted text)",methods:[{input:"Y",keys:["Ctrl"]}]},{description:"Paste image from clipboard",methods:[{input:"V",keys:["Ctrl"]}]},{description:"Switch agent mode",methods:[{input:"S",keys:["Ctrl"]}]},{description:"Toggle reasoning effort",methods:[{input:"D",keys:["Alt"]}]},{description:"Open command palette",methods:[{input:"O",keys:["Ctrl"]}]},{description:"Mention files",methods:[{keys:["@"]}]},{description:"Mention threads",methods:[{keys:["@@"]}]},{description:"Show prompt history",methods:[{input:"R",keys:["Ctrl"]}]},{description:"Toggle inline shortcuts help",methods:[{keys:["?"]}]},{description:"Toggle thinking/dense view",methods:[{input:"T",keys:["Alt"]}]}],ow4=[{description:"Page scroll",methods:[{keys:["Pg Up"]},{keys:["Pg Down"]}]},{description:"Half-page scroll",methods:[{input:"K",keys:["Alt"]},{input:"J",keys:["Alt"]}]},{description:"Mouse wheel scroll",methods:[{keys:["Mouse Wheel"]}]},{description:"Jump to first message",methods:[{keys:["Home"]}]},{description:"Jump to bottom of screen",methods:[{keys:["End"]}]},{description:"Navigate to previous messages",methods:[{keys:["Tab"]},{keys:["Shift","Tab"]}]}];class A80 extends $4{items;renderRow;constructor({items:A,renderRow:Q}){super();this.items=A,this.renderRow=Q}build(A){let $=z4.of(A).size.width<50,B=[];for(let D of this.items){let[E,F]=this.renderRow(D),J;if($)J=new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[E,new gA({padding:t0.only({left:4}),child:F})]});else J=new uA({crossAxisAlignment:"start",children:[new M4({flex:1,child:E}),new b0({width:1}),new M4({flex:1,child:F})]});B.push(new gA({padding:t0.horizontal(6),child:J}))}return new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:B})}}function f9Q(A){let Q=[...A.keys];if(A.input)Q.push(A.input);return mX(Q.join("+"))}class fm0 extends $4{commands;onDismiss;constructor(A){super();this.commands=A.commands,this.onDismiss=A.onDismiss}build(A){let Q=EA.of(A),{colors:$,app:B}=Q,D=z4.of(A),E=new $0({color:$.secondary,bold:!0}),F=new $0({color:B.keybind}),J=new $0({color:B.command}),U=new $0({color:$.foreground}),Y=Math.max(40,Math.min(80,D.size.width-4)),X=[...this.commands.filter((V)=>{let z=V.noun?.toLowerCase();return z!=="dev"&&z!=="debug"&&V.status.type!=="hidden"})].sort((V,z)=>{let K=(V.noun??"").toLowerCase(),C=(z.noun??"").toLowerCase(),W=K.localeCompare(C);if(W!==0)return W;return V.verb.toLowerCase().localeCompare(z.verb.toLowerCase())}),I=(V)=>{let z=V.methods.map((K)=>f9Q(K)).join(", ");return[new F0({text:new g(z,F)}),new F0({text:new g(V.description,U)})]},G=new v3({autofocus:!0,child:new KA({constraints:new Y4(Y,Y,0,Number.POSITIVE_INFINITY),child:new IA({crossAxisAlignment:"start",mainAxisSize:"min",children:[new gA({padding:t0.horizontal(2),child:new F0({text:new g(`Editor Shortcuts
|
|
4745
4745
|
`,E)})}),new A80({items:aw4.filter((V)=>V.submitOnEnterOnly===void 0||V.submitOnEnterOnly===!0),renderRow:I}),new b0({height:1}),new gA({padding:t0.horizontal(2),child:new F0({text:new g(`Scrolling & Navigation
|
|
4746
4746
|
`,E)})}),new A80({items:ow4,renderRow:I}),new b0({height:1}),new gA({padding:t0.horizontal(2),child:new F0({text:new g(`Command Palette Commands
|
|
4747
4747
|
`,E)})}),new A80({items:X,renderRow:(V)=>{let z=V.noun?`${V.noun}: ${V.verb}`:V.verb;return[new F0({text:new g(z,J)}),new F0({text:new g(V.description,U)})]}}),new b0({height:1})]})})});return new s4({header:"Amp CLI — Help & Keyboard Shortcuts",minWidth:Y,maxWidth:Y,maxHeight:D.size.height,autofocus:!1,footer:[{keys:["Esc"],label:"close"},{keys:["↑↓","j/k"],label:"scroll"}],onDismiss:this.onDismiss,child:G})}}class ST extends EQ{completionBuilder;constructor({completionBuilder:A,child:Q}){super({child:Q});this.completionBuilder=A}updateShouldNotify(A){return!1}static of(A){let Q=A.dependOnInheritedWidgetOfExactType(ST);if(!Q)throw Error("No CompletionBuilderProvider found in widget tree");return Q.completionBuilder}}var x9Q=250,y9Q=2000;class xm0 extends a0{configReloadEvents;toastController;child;constructor(A){super();this.configReloadEvents=A.configReloadEvents,this.toastController=A.toastController,this.child=A.child}createState(){return new rw4}}class rw4 extends n0{subscription=null;toastTimer=null;pendingToastType=null;lastToast=null;initState(){this.subscribeToConfigReloadEvents()}didUpdateWidget(A){if(A.configReloadEvents===this.widget.configReloadEvents)return;this.clearPendingToast(),this.subscribeToConfigReloadEvents()}dispose(){this.subscription?.unsubscribe(),this.subscription=null,this.clearPendingToast(),super.dispose()}build(A){return this.widget.child}subscribeToConfigReloadEvents(){this.subscription?.unsubscribe(),this.subscription=this.widget.configReloadEvents.subscribe((A)=>{this.scheduleToast(A)})}scheduleToast(A){if(this.pendingToastType=b9Q(this.pendingToastType,A),this.toastTimer)clearTimeout(this.toastTimer);this.toastTimer=setTimeout(()=>{if(!this.mounted)return;this.flushToast()},x9Q),this.toastTimer.unref()}flushToast(){let A=this.pendingToastType;if(this.clearPendingToast(),!A)return;let Q=Date.now();if(h9Q(this.lastToast,A,Q))return;this.lastToast={type:A,shownAt:Q},g9Q(this.widget.toastController,A)}clearPendingToast(){if(this.toastTimer)clearTimeout(this.toastTimer),this.toastTimer=null;this.pendingToastType=null}}function b9Q(A,Q){return A==="failed"||Q.type==="failed"?"failed":"succeeded"}function h9Q(A,Q,$){return A?.type===Q&&$-A.shownAt<y9Q}function g9Q(A,Q){switch(Q){case"succeeded":A.show("Config reloaded","success",1500);break;case"failed":A.show("Config reload failed","error",5000);break}}class H6 extends EQ{context;constructor({context:A,child:Q}){super({child:Q});this.context=A}updateShouldNotify(A){return!1}static of(A){let Q=A.dependOnInheritedWidgetOfExactType(H6);if(!Q)throw Error("No ContextProvider found in widget tree");return Q.context}}h0();l7();var $80=80,m9Q=13,d9Q=1,sw4=-$80,c9Q=16,p9Q=ib0($80,$80);function tw4({ampURL:A,threadID:Q,logPath:$}){return[`Debug thread ${sG(new URL(A),Q).toString()} (cli log: ${$}). Start with the CLI log, actor logs, and Rivet DB/inspector as sources of truth. Read thread-actors/docs/debugging-actors.md and thread-actors/scripts/README.md. For dev, actor logs are in .amp/in/thread-actors.json.log; for staging/prod, logs are in gcloud.`,"","Problem: "].join(`
|
|
@@ -4822,7 +4822,7 @@ Ctrl-X, Y, Z to unlock`;if(this.widget.centerContent)R=this.widget.centerContent
|
|
|
4822
4822
|
`));if(J.tools.length===0)F.push(new g(` └─ No tools available
|
|
4823
4823
|
`,D));else for(let Z of J.tools)XXQ(F,Z,$);F.push(new g(`
|
|
4824
4824
|
`))}return F}function XXQ(A,Q,$){let{colors:B,app:D}=$,E=IXQ(Q.status,$);if(A.push(new g(` ${E.icon} `,new $0({color:E.color}))),A.push(new g(Q.name,new $0({color:Q.status==="pending"?B.warning:D.command}))),Q.status==="pending")A.push(new g(" discovering...",new $0({color:B.foreground,dim:!0})));else if(Q.description)A.push(new g(` ${iR4(Q.description,50)}`,new $0({color:B.foreground,dim:!0})));if(Q.error)A.push(new g(` ${iR4(Q.error,40)}`,new $0({color:D.toolError})));A.push(new g(`
|
|
4825
|
-
`))}function IXQ(A,Q){let{colors:$,app:B}=Q;switch(A){case"pending":return{icon:"◌",color:$.warning};case"registered":return{icon:"•",color:$.mutedForeground};case"failed":return{icon:"✗",color:B.toolError};case"duplicate":return{icon:"◇",color:$.warning};default:return{icon:"?",color:$.foreground}}}function iR4(A,Q){let $=A.replace(/\s+/g," ").trim();if(oA($)<=Q)return $;let B="...",D=oA(B);if(Q<=D)return YD(B,Q);return`${YD($,Q-D,!0,"")}${B}`}var Dp0="https://ampcode.com/news/neo",Ep0=[{title:"Meet the new Amp CLI",body:[]},{title:"Rebuilt From The Ground Up",body:["Same close-up terminal workflow. Completely different underneath."]},{title:"Just Keep Typing",body:["Context is summarized automatically at ~90%.","No handoff flow. No context percentage to babysit."]},{title:"Queueing and Steering",body:["Sending a message now queues by default instead of cancelling tools.","Use steering when you want the agent to see something sooner."]},{title:"Remote Control",body:["Start a thread in the CLI, then keep going from ampcode.com.","Watch live updates and queue follow-ups from any device."]},{title:"Customize Amp with Amp",body:[{text:"Amp now has a ",linkText:"complete plugin API",href:"https://ampcode.com/manual/plugin-api",textAfter:"."},"Add tools, commands, control UI, and hook into events."]},{title:"Permissions",body:[{text:"By default (when no ",highlightText:"amp.permissions",textAfterHighlight:" setting is present), Amp no longer asks for confirmation before running any tools and commands. And you can now implement your own custom permission logic with ",linkText:"plugins",href:"https://ampcode.com/manual/plugin-api",textAfter:"."}]},{title:null,body:["Check out the full news post for more:",{text:Dp0,href:Dp0}]}];function GXQ(A){return[{title:"Upgrade your Amp CLI",body:[{text:"This npm-based distribution of Amp CLI has been deprecated. To use the ",linkText:"new Amp CLI",href:Dp0,textAfter:" you'll need to switch to the binary install:",linkWidget:!0},"",{codeBlock:["npm uninstall -g @sourcegraph/amp",A]}]}]}function VXQ(){if(process.platform==="win32")return'powershell -c "irm https://ampcode.com/install.ps1 | iex"';return"curl -fsSL https://ampcode.com/install.sh | bash"}var oT=50,Iq=40,$p0=1000,zXQ=420,KXQ=760,CXQ=-250,WXQ=1100,t80=33,rR4=0.999,uXQ=2.1,HXQ=720,NXQ=420,DP4="Meet the new",EP4="Amp",FP4="CLI",Fp0=F4(DP4).length,qXQ=F4(EP4).length,wXQ=F4(FP4).length,e80={primary:{r:140,g:38,b:0},secondary:{r:255,g:225,b:102}},sR4={primary:{r:10,g:42,b:18},secondary:{r:200,g:230,b:68}},tR4={primary:{r:18,g:0,b:107},secondary:{r:103,g:255,b:168}},eR4=[e80,sR4,tR4,e80,sR4,tR4,e80],OXQ=e80;class Jp0 extends a0{onDismiss;onQuit;animationProgress;animationsEnabled;variant;binaryInstallCommand;introStages;dismissible;constructor(A){super();this.onDismiss=A.onDismiss,this.onQuit=A.onQuit,this.animationProgress=A.animationProgress,this.animationsEnabled=A.animationsEnabled??!0,this.variant=A.variant??"intro",this.binaryInstallCommand=A.binaryInstallCommand??VXQ(),this.introStages=this.variant==="npm-migration"?GXQ(this.binaryInstallCommand):Ep0,this.dismissible=this.variant!=="npm-migration"}createState(){return new JP4}}class JP4 extends n0{startedAt=performance.now();animationTimer=null;stageTransitionTimer=null;firstStageTitleTimer=null;firstStageHintTimer=null;firstStageRevealTimer=null;firstStageTitleRevealStartedAt=null;firstStageHintRevealStartedAt=null;stageTransitionStartedAt=performance.now();animationStartProgress=0;animationTargetProgress=1;animationDurationMs=$p0;onAnimationComplete=null;animationProgress=0;introStage=0;previousIntroStage=null;stageTransitionProgress=1;stageTransitionDirection=1;firstStageTitleVisible=!1;firstStageHintVisible=!1;firstStageTitleRevealProgress=0;firstStageHintRevealProgress=0;dismissTimer=null;dismissStartedAt=performance.now();dismissProgress=0;isDismissing=!1;splashOrbGlow=new f5(42);initState(){super.initState(),this.startAnimationIfNeeded()}didUpdateWidget(A){if(super.didUpdateWidget(A),A.animationProgress!==this.widget.animationProgress||A.animationsEnabled!==this.widget.animationsEnabled)this.startAnimationIfNeeded()}dispose(){this.stopAnimation(),this.stopStageTransitionTimer(),this.stopFirstStageRevealTimers(),this.stopDismissAnimation(),super.dispose()}startAnimationIfNeeded(){if(this.stopAnimation(),this.stopFirstStageRevealTimers(),this.widget.animationProgress!==void 0){this.animationProgress=h9(this.widget.animationProgress),this.firstStageTitleVisible=this.animationProgress>=rR4,this.firstStageHintVisible=this.animationProgress>=rR4,this.firstStageTitleRevealProgress=this.firstStageTitleVisible?1:0,this.firstStageHintRevealProgress=this.firstStageHintVisible?1:0;return}if(!this.widget.animationsEnabled){this.stopStageTransitionTimer(),this.stopDismissAnimation(),this.animationProgress=1,this.isDismissing=!1,this.dismissProgress=0,this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1,this.previousIntroStage=null,this.stageTransitionProgress=1;return}if(this.firstStageTitleVisible=!1,this.firstStageHintVisible=!1,this.firstStageTitleRevealProgress=0,this.firstStageHintRevealProgress=0,this.startProgressAnimation({from:0,to:1,durationMs:$p0,onComplete:()=>{if(!this.widget.dismissible)this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1})}}),this.widget.dismissible)this.startFirstStageRevealSequence()}startDismissAnimation(){if(this.isDismissing)return;if(!this.widget.animationsEnabled){this.widget.onDismiss();return}this.stopFirstStageRevealTimers(),this.stopStageTransitionTimer(),this.dismissStartedAt=performance.now(),this.setState(()=>{this.isDismissing=!0,this.dismissProgress=0}),this.dismissTimer=setInterval(()=>{let A=performance.now()-this.dismissStartedAt,Q=h9(A/KXQ);if(this.setState(()=>{this.dismissProgress=Q}),Q>=1)this.stopDismissAnimation(),this.widget.onDismiss()},t80)}canNavigateIntroStage(){if(this.isDismissing)return!1;if(!this.firstStageHintVisible)return!1;if(this.introStage===0&&this.firstStageHintRevealProgress<1)return!1;return!0}advanceIntroStage(){if(!this.canNavigateIntroStage())return;if(this.isFinalIntroStage()){if(this.widget.dismissible)this.startDismissAnimation();return}this.moveIntroStage(1)}dismissFromFinalIntroStage(){if(!this.widget.dismissible||!this.canNavigateIntroStage()||!this.isFinalIntroStage())return!1;return this.startDismissAnimation(),!0}nextIntroStage(){if(!this.canNavigateIntroStage()||this.isFinalIntroStage())return;this.moveIntroStage(1)}goToPreviousIntroStage(){if(!this.canNavigateIntroStage()||this.introStage<=0)return;this.moveIntroStage(-1)}isFinalIntroStage(){return this.introStage>=this.widget.introStages.length-1}moveIntroStage(A){let Q=this.introStage+A;if(this.stopStageTransitionTimer(),this.stageTransitionStartedAt=performance.now(),this.setState(()=>{this.previousIntroStage=this.introStage,this.introStage=Q,this.stageTransitionDirection=A}),this.widget.animationProgress!==void 0||!this.widget.animationsEnabled){this.setState(()=>{this.previousIntroStage=null,this.stageTransitionProgress=1});return}this.setState(()=>{this.stageTransitionProgress=0}),this.stageTransitionTimer=setInterval(()=>{let $=performance.now()-this.stageTransitionStartedAt,B=h9($/zXQ);if(this.setState(()=>{if(this.stageTransitionProgress=B,B>=1)this.previousIntroStage=null}),B>=1)this.stopStageTransitionTimer()},t80)}startProgressAnimation({from:A,to:Q,durationMs:$,onComplete:B}){this.stopAnimation(),this.startedAt=performance.now(),this.animationStartProgress=A,this.animationTargetProgress=Q,this.animationDurationMs=$,this.onAnimationComplete=B,this.animationProgress=A,this.animationTimer=setInterval(()=>{let D=performance.now()-this.startedAt,E=h9(D/this.animationDurationMs),F=this.animationStartProgress+(this.animationTargetProgress-this.animationStartProgress)*rT(E);if(this.setState(()=>{this.animationProgress=F}),E>=1)this.stopAnimation(),this.onAnimationComplete?.(),this.onAnimationComplete=null},t80)}stopAnimation(){if(this.animationTimer)clearInterval(this.animationTimer),this.animationTimer=null}stopStageTransitionTimer(){if(this.stageTransitionTimer)clearInterval(this.stageTransitionTimer),this.stageTransitionTimer=null}startFirstStageRevealSequence(){if(this.stopFirstStageRevealTimers(),!this.widget.animationsEnabled){this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1});return}this.setState(()=>{this.firstStageTitleVisible=!1,this.firstStageHintVisible=!1,this.firstStageTitleRevealProgress=0,this.firstStageHintRevealProgress=0});let A=Math.max(0,$p0+CXQ),Q=A+WXQ;this.firstStageTitleTimer=setTimeout(()=>{this.firstStageTitleRevealStartedAt=performance.now(),this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageTitleRevealProgress=0}),this.startFirstStageRevealTimer()},A),this.firstStageHintTimer=setTimeout(()=>{this.firstStageHintRevealStartedAt=performance.now(),this.setState(()=>{this.firstStageHintVisible=!0,this.firstStageHintRevealProgress=0}),this.startFirstStageRevealTimer()},Q)}startFirstStageRevealTimer(){if(this.firstStageRevealTimer)return;this.firstStageRevealTimer=setInterval(()=>{let A=performance.now(),Q=this.firstStageTitleRevealStartedAt?h9((A-this.firstStageTitleRevealStartedAt)/HXQ):this.firstStageTitleRevealProgress,$=this.firstStageHintRevealStartedAt?h9((A-this.firstStageHintRevealStartedAt)/NXQ):this.firstStageHintRevealProgress;if(this.setState(()=>{this.firstStageTitleRevealProgress=Q,this.firstStageHintRevealProgress=$}),Q>=1&&$>=1)this.stopFirstStageRevealTimer()},t80)}stopFirstStageRevealTimers(){if(this.stopFirstStageRevealTimer(),this.firstStageTitleRevealStartedAt=null,this.firstStageHintRevealStartedAt=null,this.firstStageTitleTimer)clearTimeout(this.firstStageTitleTimer),this.firstStageTitleTimer=null;if(this.firstStageHintTimer)clearTimeout(this.firstStageHintTimer),this.firstStageHintTimer=null}stopFirstStageRevealTimer(){if(this.firstStageRevealTimer)clearInterval(this.firstStageRevealTimer),this.firstStageRevealTimer=null}stopDismissAnimation(){if(this.dismissTimer)clearInterval(this.dismissTimer),this.dismissTimer=null}currentOrbPalette(){let A=AP4(this.introStage),Q=this.previousIntroStage===null||this.stageTransitionProgress>=1?A:QP4(AP4(this.previousIntroStage),A,rT(this.stageTransitionProgress));return this.dismissProgress>0?QP4(Q,OXQ,rT(this.dismissProgress)):Q}build(A){let Q=f4.of(A).colorScheme,$=EA.of(A),B=this.currentOrbPalette(),D=H7(1,"deep",B),E=z4.of(A).size,J=this.widget.animationProgress??this.animationProgress,U=Math.max(E.width/oT,E.height/Iq)*uXQ,Y=U+(1-U)*J,Z=rT(this.dismissProgress),X=Math.max(oT,Math.round(oT*Y)),I=Math.max(Iq,Math.round(Iq*Y)),G=Math.round((E.width-X)/2),V=Math.round((E.height-I)/2),z=Math.max(0,Math.floor((E.width-oT)/2)),K=-Math.floor(Iq/2),C=Math.round(G+(z-G)*J),W=Math.round(V+(K-V)*J),u=C+X/2,H=W+I/2,N=MXQ({dismissProgress:this.dismissProgress,easedDismissProgress:Z,introOrbScale:Y,normalOrbCenterX:u,normalOrbCenterY:H,size:E}),w=Math.max(oT,Math.round(oT*N.orbScale)),M=Math.max(Iq,Math.round(Iq*N.orbScale)),R=N.orbCenterX,S=N.orbCenterY,P=Math.round(R-w/2),f=Math.round(S-M/2),m=Math.max(3,Math.min(E.height-5,Math.floor(Iq/2)+2)),x=Math.max(m+3,E.height-3),v=N.textDissolveProgress,k=this.isFinalIntroStage()?N.backdropDissolveProgress:0,c=this.firstStageTitleVisible&&v<1,d=c&&this.firstStageHintVisible,b=d&&this.widget.dismissible&&this.introStage>0&&!this.isFinalIntroStage(),p=this.introStage===0?this.firstStageTitleRevealProgress:1,n=this.introStage===0?this.firstStageHintRevealProgress:1,s=Math.max(24,Math.min(74,E.width-4)),X0=Math.min(12,Math.max(8,E.height-m-6)),E0=Math.max(0,Math.floor((E.width-s)/2)),G0=Math.max(0,Math.min(E.height-X0,Math.floor(E.height*0.55-X0/2))),N0=this.widget.animationProgress!==void 0||!this.widget.animationsEnabled?new UK({width:w,height:M,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,seed:42,fps:0,onClick:()=>{}}):new UK({width:w,height:M,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,onClick:()=>{}});return new Y$({autofocus:!0,canRequestFocus:!0,debugLabel:"WelcomeTakeover",onKey:(t)=>{if(t.key==="Enter")return this.advanceIntroStage(),"handled";if(!this.widget.dismissible&&t.key==="c"&&t.ctrlKey)return this.widget.onQuit?.(),"handled";if(!this.widget.dismissible&&t.key==="q")return this.widget.onQuit?.(),"handled";if((t.key===" "||t.key==="Space")&&!this.isFinalIntroStage())return this.advanceIntroStage(),"handled";if(t.key==="Escape"||t.key==="Esc"){if(!this.widget.dismissible)return this.widget.onQuit?.(),"handled";return this.dismissFromFinalIntroStage()?"handled":"ignored"}if(t.key==="ArrowRight")return this.nextIntroStage(),"handled";if(t.key==="ArrowLeft")return this.goToPreviousIntroStage(),"handled";return"ignored"},child:new A6({fit:"expand",children:[new UP4({color:Q.background,dissolveProgress:k}),new A6({fit:"expand",children:[new nA({onClick:()=>{},child:b0.expand()}),new r1({left:P,top:f,width:w,height:M,child:N0}),...c?[new r1({left:E0,top:G0,width:s,height:X0,child:jXQ({introStages:this.widget.introStages,stage:this.introStage,previousStage:this.previousIntroStage,progress:this.stageTransitionProgress,direction:this.stageTransitionDirection,width:s,height:X0,foreground:Q.foreground,mutedForeground:Q.mutedForeground,accent:D,link:$.app.link,keybind:$.app.keybind,titleRevealProgress:p,dissolveProgress:v,context:A})})]:[],...d?[...b?[new r1({left:E0,top:Math.max(0,x-1),width:s,height:1,child:new F0({text:SXQ({stage:this.introStage,featureStageCount:Math.max(0,this.widget.introStages.length-2),foreground:Q.mutedForeground,dissolveProgress:v}),textAlign:"center"})})]:[],new r1({left:E0,top:x,width:s,height:1,child:fXQ({finalStage:this.isFinalIntroStage(),dismissible:this.widget.dismissible,foreground:Q.mutedForeground,keybind:$.app.keybind,revealProgress:n,dissolveProgress:v,context:A})})]:[]]})]})})}}class UP4 extends U3{color;dissolveProgress;constructor({color:A,dissolveProgress:Q}){super();this.color=A,this.dissolveProgress=Q}createRenderObject(){return new YP4(this.color,this.dissolveProgress)}updateRenderObject(A){A.update(this.color,this.dissolveProgress)}}class YP4 extends xA{color;dissolveProgress;constructor(A,Q){super();this.color=A,this.dissolveProgress=Q}update(A,Q){this.color=A,this.dissolveProgress=Q,this.markNeedsPaint()}performLayout(){let A=this._lastConstraints;sA(!!A,"performLayout called without constraints");let Q=A.constrain(A.biggest.width,A.biggest.height);this.setSize(Q.width,Q.height),super.performLayout()}paint(A,Q=0,$=0){let B=Math.floor(Q+this.offset.x),D=Math.floor($+this.offset.y),E=Math.floor(this.size.width),F=Math.floor(this.size.height),J={bg:this.color},U=h9(this.dissolveProgress);if(U<=0){A.fill(B,D,E,F," ",J);return}if(U>=1)return;for(let Y=0;Y<F;Y++)for(let Z=0;Z<E;Z++)if(!LXQ(Z,Y,E,F,U))A.fill(B+Z,D+Y,1,1," ",J)}}function h9(A){return Math.min(1,Math.max(0,A))}function rT(A){return 1-(1-A)**3}function AP4(A){return eR4[A]??eR4[0]}function QP4(A,Q,$){return{primary:lN(A.primary,Q.primary,$),secondary:lN(A.secondary,Q.secondary,$)}}function MXQ({dismissProgress:A,easedDismissProgress:Q,introOrbScale:$,normalOrbCenterX:B,normalOrbCenterY:D,size:E}){return{orbScale:$+($*0.86-$)*Q,orbCenterX:B+(E.width*0.54-B)*Q,orbCenterY:D-E.height*0.44*Q,textDissolveProgress:h9(A/0.52),backdropDissolveProgress:rT(h9((A-0.12)/0.88))}}function LXQ(A,Q,$,B,D){let E=B<=1?0:Q/(B-1),F=ZP4(A+Q*Math.max(1,$));return(1-E)*0.72+F*0.28<D}function jXQ({introStages:A,stage:Q,previousStage:$,progress:B,direction:D,width:E,height:F,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V}){if($===null||B>=1)return Bp0({introStages:A,stage:Q,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V});let z=rT(B),K=D*Math.round((1-z)*E),C=-D*Math.round(z*E);return new vN(new A6({fit:"expand",children:[new r1({left:C,top:0,width:E,height:F,child:Bp0({introStages:A,stage:$,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:$===0?1:I,dissolveProgress:G,context:V})}),new r1({left:K,top:0,width:E,height:F,child:Bp0({introStages:A,stage:Q,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V})})]}))}function Bp0({introStages:A,stage:Q,foreground:$,mutedForeground:B,accent:D,link:E,keybind:F,titleRevealProgress:J,dissolveProgress:U,context:Y}){let Z=A[Q]??A[0]??Ep0[0],X=new $0({color:D,bold:!0}),I=new $0({color:$}),G=A===Ep0&&Q===0,V=[...Z.title===null?[]:[new F0({text:G?A90(TXQ({progress:J,foreground:D,pulseColor:D}),U):new g(KD(Z.title,U),X),textAlign:"center"})],...Z.body.length>0?[RXQ()]:[],...Z.body.map((z)=>PXQ(z,I,B,E,F,U,Y))];return new AQ({child:new gA({padding:t0.horizontal(1),child:new IA({crossAxisAlignment:"stretch",mainAxisAlignment:"center",mainAxisSize:"min",children:V})})})}function RXQ(){return b0.height(1)}function PXQ(A,Q,$,B,D,E,F){if(typeof A==="string")return new F0({text:new g(KD(A,E),Q),textAlign:"center"});if("codeBlock"in A)return new XD({onCopy:(J,U)=>{if(U)D6.success(F,"Copied to clipboard",2000)},child:new IA({mainAxisSize:"min",children:A.codeBlock.map((J)=>new F0({text:new g(KD(J,E),new $0({color:D})),textAlign:"center",selectable:!0}))})});if("keybind"in A){let J=new F0({text:new g("",void 0,[new g(KD(A.text,E),new $0({color:$,dim:!0})),new g(KD(A.keybind,E,F4(A.text).length),new $0({color:D}))]),textAlign:"center",selectable:"selectable"in A?A.selectable:!1});if("selectable"in A)return new AQ({child:new XD({child:J})});return J}if("highlightText"in A){let J=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),U=$I.of(F),Y=new g("",void 0,[new g(A.text,Q),new g(A.highlightText,new $0({color:D})),new g(A.textAfterHighlight,Q),new g(J.text,J.style,J.children,J.hyperlink,()=>{H$(F,A.href,{forceExternal:!1,onShowImagePreview:U})}),new g(A.textAfter,Q)]);return new F0({text:A90(Y,E),textAlign:"center"})}if("linkText"in A){if(A.linkWidget)return new IA({mainAxisSize:"min",children:[new F0({text:new g(KD(A.text,E),Q),textAlign:"center"}),new AQ({child:new uA({mainAxisSize:"min",children:[q$.createWidget(F,A.href,KD(A.linkText,E),new $0({color:B,underline:!0})),new F0({text:new g(KD(A.textAfter,E),Q)})]})})]});let J=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),U=$I.of(F),Y=new g("",void 0,[new g(A.text,Q),new g(J.text,J.style,J.children,J.hyperlink,()=>{H$(F,A.href,{forceExternal:!1,onShowImagePreview:U})}),new g(A.textAfter,Q)]);return new F0({text:A90(Y,E),textAlign:"center"})}if(E>0)return new F0({text:new g(KD(A.text,E),new $0({color:B,underline:!0})),textAlign:"center"});return new AQ({child:q$.createWidget(F,A.href,A.text,new $0({color:B,underline:!0}))})}function TXQ({progress:A,foreground:Q,pulseColor:$}){let B=new $0({color:Q,bold:!0}),D=new $0({color:_XQ({progress:A,foreground:Q,pulseColor:$}),bold:!0});return new g("",void 0,[new g(vXQ(A).padEnd(Fp0," "),B),new g(" ",B),new g($P4(EP4,qXQ,A,0.72),B),new g(" ",B),new g($P4(FP4,wXQ,A,0.88),D)])}function vXQ(A){let Q=F4(DP4),$=Math.min(Fp0,Math.ceil(h9(A/0.62)*Fp0));return Q.slice(0,$).join("")}function $P4(A,Q,$,B){return $>=B?A:"".padEnd(Q," ")}function _XQ({progress:A,foreground:Q,pulseColor:$}){if(A<0.88||A>=1)return Q;let B=h9((A-0.88)/0.12);return Math.cos(B*Math.PI*4)*(1-B)>0.12?$:Q}function SXQ({stage:A,featureStageCount:Q,foreground:$,dissolveProgress:B}){return new g(KD(`${A}/${Q}`,B),new $0({color:$,dim:!0}))}function kXQ({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:D,dissolveProgress:E}){let F=new $0({color:B}),J=new $0({color:$,dim:!0}),U=Q?A?"Enter":"Space":"Esc",Y=Q?A?" to get started":" to continue":" to quit",Z="",X="",I=`${Y}`;if(!Q)return new g("",void 0,[new g(U,F),new g(Y,J),new g("",F),new g("",J)]);let G=BP4(U,D),V=BP4(I,h9((D*(F4(U).length+F4(I).length)-F4(U).length)/F4(I).length));return new g("",void 0,[new g(KD(G,E),F),new g(KD(V.slice(0,Y.length),E),J),new g(KD(V.slice(Y.length,Y.length+0),E),F),new g(KD(V.slice(Y.length+0),E),J)])}function fXQ({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:D,dissolveProgress:E,context:F}){if(Q)return new F0({text:kXQ({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:D,dissolveProgress:E}),textAlign:"center"});let J=new $0({color:B}),U=new $0({color:$,dim:!0});return new XD({onCopy:(Y,Z)=>{if(Z)D6.success(F,"Copied to clipboard",2000)},child:new F0({text:new g("",void 0,[new g("q",J),new g(" to quit",U)]),textAlign:"center",selectable:!0})})}function BP4(A,Q){let $=F4(A),B=Math.min($.length,Math.ceil(h9(Q)*$.length));return $.slice(0,B).join("").padEnd($.length," ")}function A90(A,Q,$=0){if(Q<=0)return A;let B=$+F4(A.text??"").length,D=A.children?.map((E)=>{let F=A90(E,Q,B);return B+=F4(E.toPlainText()).length,F});return new g(A.text?KD(A.text,Q,$):A.text,A.style,D,A.hyperlink,A.onClick)}function KD(A,Q,$=0){if(Q<=0)return A;return F4(A).map((D,E)=>{if(D.trim()==="")return D;return ZP4($+E)<Q?" ":D}).join("")}function ZP4(A){let Q=Math.sin((A+1)*12.9898)*43758.5453;return Q-Math.floor(Q)}function xXQ(A){let $=A.observer.protocolMessages().filter((B)=>B.role==="assistant").at(-1);if(!$)return null;return $.content.filter((B)=>B.type==="text").map((B)=>B.text).join("")}function yXQ(A,Q={}){return new Promise(($,B)=>{let D=!1,E=setTimeout(()=>{F.unsubscribe(),B(Error("Timed out waiting for agent response"))},Q.timeoutMs??600000),F=A.observer.agentState().subscribe((J)=>{if(nB(J)){D=!0;return}if(!D)return;let U=xXQ(A);if(U===null)return;clearTimeout(E),F.unsubscribe(),$(U)})})}class Up0 extends a0{listSkillsForThread;clientPool;completionBuilder;history;ideManager;configService;updateService;initialThreadIDs;showWelcome;welcomeVariant;onWelcomeDismissed;notificationService;mcpTrustHandler;onThreadArchived;onActiveThreadChange;onRelaunchRequested;onFirstFrame;initialUserInput;getDefaultNewThreadVisibility;observeThreadSummaries;openThreadPickerOnStart;workspaceSettingsFilePath;context;constructor(A){super();this.listSkillsForThread=A.listSkillsForThread,this.clientPool=A.clientPool,this.completionBuilder=A.completionBuilder,this.history=A.history,this.ideManager=A.ideManager,this.configService=A.configService,this.updateService=A.updateService,this.initialThreadIDs=A.initialThreadIDs??[],this.showWelcome=A.showWelcome??!1,this.welcomeVariant=A.welcomeVariant??"intro",this.onWelcomeDismissed=A.onWelcomeDismissed,this.notificationService=A.notificationService,this.mcpTrustHandler=A.mcpTrustHandler,this.onThreadArchived=A.onThreadArchived,this.onActiveThreadChange=A.onActiveThreadChange,this.onRelaunchRequested=A.onRelaunchRequested,this.onFirstFrame=A.onFirstFrame,this.initialUserInput=A.initialUserInput,this.getDefaultNewThreadVisibility=A.getDefaultNewThreadVisibility,this.observeThreadSummaries=A.observeThreadSummaries,this.openThreadPickerOnStart=A.openThreadPickerOnStart??!1,this.workspaceSettingsFilePath=A.workspaceSettingsFilePath,this.context=A.context}createState(){return new IP4}}class IP4 extends n0{editorController=new CY;commandPalette=new dp(this);commandRegistry=new Sm0;toastController=new pb0;relaunchNotificationController=new Mm0;exitHintTimer=new mp(this,1000);ideStatus=new t3(this,{});threadNavigationHistory=new jm0;draftThreadSettings={};draftThreadSettingsSeed={};hasDraftThreadSettingsSeed=!1;draftThreadSettingsInitPromise=null;activeThreadContext=null;activeThreadIDSubscription=null;activePluginMessageSubscription=null;activePluginUIRequestsSubscription=null;connectionErrorsSubscription=null;configSubscription=null;connectingToThreadID=null;executorAlreadyConnectedDialog=null;switchThreadPickerVisible=!1;welcomeVisible=!1;endCreditsVisible=!1;invadersHighScore=0;debugOverlayVisible=!1;focusDebugVisible=!1;unregisterCommands=null;emptyThreadTerminalTitleController=new Ei;pluginIntegration=null;mcpTrustIntegration=null;updateRelaunchIntegration=null;noticesPollingTimeout=null;notices;loadThreads=async()=>{return this.widget.context.listThreads()};analyzeContextForThread=async(A,Q)=>{return ZC4({ampURL:this.widget.context.ampURL,configService:this.widget.configService,threadID:A,signal:Q})};onSwitchThread=(A)=>{return this.connectToExistingThread(A,{recordNavigation:!0,rethrowError:!0})};threadListSidebar=new Ap0({state:this,isBlocked:()=>this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal(),getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,getWorkspaceRoot:()=>this.widget.context.workspaceRoot,loadThreads:this.loadThreads,observeThreadSummaries:()=>this.widget.observeThreadSummaries(),onSelectThread:this.onSwitchThread});sendFeedbackReport=async(A)=>tD0({configService:this.widget.configService,settingsFilePath:this.widget.context.settingsFilePath},A);archiveThread=async(A)=>{let Q=await f70({configService:this.widget.configService},A);if(Q===null)this.widget.onThreadArchived?.(A);return Q};addThreadLabel=async(A,Q)=>{let $=await IN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};removeThreadLabel=async(A,Q)=>{let $=await GN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};initState(){if(gX.getInstance().interceptConsole(),this.invadersHighScore=this.widget.context.invadersHighScore??0,this.notices=new Um0(this.widget.configService,($)=>this.setState($)),LQ.instance.addPostFrameCallback(()=>{setTimeout(()=>this.widget.onFirstFrame?.(),0),this.noticesPollingTimeout=setTimeout(()=>{this.noticesPollingTimeout=null,this.notices.startPolling()},500)},"Neo notices polling"),this.widget.showWelcome)this.welcomeVisible=!0;if(this.connectionErrorsSubscription=this.widget.clientPool.connectionErrors$.subscribe(({threadID:$,error:B})=>{if(_.error("Neo failed to connect to thread",{threadID:$,error:B}),!$)this.toastController.show(`Connection failed: ${B.message}`,"error",4000)}),this.configSubscription=this.widget.configService.config.subscribe(($)=>{this.applyDraftThreadSettingsSeed(this.applySessionDefaultsToThreadSettings(H00($.settings)))}),this.updateRelaunchIntegration=new Rm0({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested,relaunchNotificationController:this.relaunchNotificationController,updateService:this.widget.updateService}),this.updateRelaunchIntegration.init(),this.ideStatus.subscribe(this.widget.ideManager.status),this.widget.openThreadPickerOnStart)this.switchThreadPickerVisible=!0;this.ensureDraftThreadSettingsInitialized();let A=this.widget.initialUserInput,Q=this.widget.initialThreadIDs[0];if(Q){let $={};if(A)$.initialUserInput=A;this.connectToInitialThreads(Q,$)}else if(A)this.onNewThread([{type:"text",text:A}],this.widget.context.sessionAgentMode);this.pluginIntegration=new wm0({state:this,commandPalette:this.commandPalette,commandRegistry:this.commandRegistry,toastController:this.toastController,context:this.widget.context,getActiveThreadID:this.getActiveThreadID,appendToThread:this.appendPluginMessagesToThread,readThreadMessages:this.readPluginThreadMessages,runAgent:this.runPluginAgent,onBlockingConfirmDialogChange:this.syncEmptyThreadPluginConfirmationTitle}),this.pluginIntegration.init(),this.mcpTrustIntegration=new Eg0({state:this,mcpTrustHandler:this.widget.mcpTrustHandler,toastController:this.toastController,workspaceSettingsFilePath:this.widget.workspaceSettingsFilePath}),this.mcpTrustIntegration.init(),this.unregisterCommands=this.registerAppCommands(),queueMicrotask(()=>{if(!this.mounted)return;this.replayEarlyInputToEditor()})}replayEarlyInputToEditor(){let A=I1.instance.tuiInstance.getEarlyInputText();if(!A)return;this.editorController.insertText(A)}registerAppCommands(){let A=this,Q=this.widget.context.pluginService?Sw4({pluginService:this.widget.context.pluginService,workspaceRoot:this.widget.context.workspaceRoot,logFilePath:this.widget.context.logFilePath,toastController:this.toastController}):[],B=[mw4({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),{noun:"thread",verb:"switch",description:"Switch to existing thread",keywords:["resume"],status:{type:"enabled"},sortBoost:100,run:(D,E,F)=>{D.pushWithDismiss((J)=>Qc0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:J,onThreadSelected:F}))}},...this.threadListSidebar.commands(),{noun:"thread",verb:"switch to previous",description:"Switch to previous thread",keywords:["back"],get status(){return A.threadNavigationHistory.canNavigateBack()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to previous with no previous thread"}},run:(D,E,F)=>{A.navigateBack(),F()}},kM4({configService:this.widget.configService,getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??void 0,toastController:this.toastController}),{noun:"thread",verb:"switch to next",description:"Switch to next thread",keywords:["forward"],get status(){return A.threadNavigationHistory.canNavigateForward()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to next with no next thread"}},run:(D,E,F)=>{A.navigateForward(),F()}},{noun:"mcp",verb:"info",description:"Show MCP servers and tools",status:{type:"enabled"},run:(D,E,F)=>{D.push(new Vd0({mcpServers:this.widget.context.mcpServers,onDismiss:F}))}},{noun:"toolbox",verb:"list",description:"List all toolboxes and their tools",status:{type:"enabled"},run:(D)=>{D.pushWithDismiss((E)=>new Qp0({toolboxes:this.widget.context.toolboxes,onDismiss:E}))}},{noun:"news",verb:"open",description:"Open Amp Chronicle in browser",keywords:["chronicle","blog","announcements"],status:{type:"enabled"},run:async(D,E,F)=>{try{await H$(E,"https://ampcode.com/chronicle")}finally{F()}}},{noun:"settings",verb:"open in editor",description:"Open CLI settings in $EDITOR",keywords:["config"],status:{type:"enabled"},run:()=>{nz(this.widget.context.settingsFilePath).catch((D)=>{_.error("Failed to open settings file in editor",{error:D})})}},{noun:"IDE",verb:"connect",description:"Connect to an IDE",keywords:["vscode","cursor","jetbrains"],status:{type:"enabled"},run:(D,E,F)=>{D.pushWithDismiss((J)=>new Gd0({onCancel:J,onSelect:(U)=>{this.handleIdeSelection(U),F()}}))}},{noun:"amp",verb:"help",description:"Show help & keyboard shortcuts",keywords:["manual","?"],status:{type:"enabled"},run:(D,E,F)=>{D.push(new fm0({commands:AB.of(E).commands,onDismiss:F}))}},{noun:"amp",verb:"show welcome",description:"Show the welcome message again",status:{type:"enabled"},run:(D,E,F)=>{F(),A.showWelcome()}},{noun:"amp",verb:"end credits",description:"Roll the full-screen Amp credits",status:{type:"enabled"},run:(D,E,F)=>{F(),A.showEndCredits()}},{noun:"amp",verb:"show version",description:"Show current Amp version",keywords:["v"],status:{type:"enabled"},run:(D,E,F)=>{D.push(new s4({header:"Amp Version",maxWidth:72,onDismiss:F,child:new F0({text:new g(U70({version:"0.0.1780014135-gb8f1f5",buildTimestamp:"2026-05-29T00:26:55.777Z",buildType:"release"}))})}))}},{noun:"amp",verb:"quit",description:"Exit application",keywords:["exit","close","bye"],shortcut:WA.ctrl("c"),status:{type:"enabled"},run:(D,E)=>{u4.maybeInvoke(E,new $K)}},...Q,...XN4(this.widget.context.logFilePath)].map((D)=>this.commandRegistry.register(D));return()=>{for(let D of B)D()}}build(A){let Q=this.buildHints(),$=this.ideStatus.getValue(),B=this.notices.current,D=new oc0({initialAgentMode:this.widget.context.sessionAgentMode,initialPluginAgentModeKey:this.widget.context.initialPluginAgentModeKey,analyzeContextForThread:this.analyzeContextForThread,listSkillsForThread:this.widget.listSkillsForThread,threadContext:this.activeThreadContext,draftThreadSettings:this.draftThreadSettings,editorController:this.editorController,history:this.widget.history,updateDraftThreadSettings:this.updateDraftThreadSettings,onNewThread:this.onNewThread,sendFeedbackReport:this.sendFeedbackReport,archiveThread:this.archiveThread,addThreadLabel:this.addThreadLabel,removeThreadLabel:this.removeThreadLabel,configService:this.widget.configService,hints:Q,ideStatus:$,statusItems:this.pluginIntegration?.getStatusItems()??[],pluginConfirmationBlocked:this.pluginIntegration?.hasBlockingConfirmDialog()??!1,notificationService:this.widget.notificationService,notice:this.activeThreadContext||this.welcomeVisible?null:B,onDismissNotice:(Z)=>this.notices.dismiss(Z)}),E=z4.of(A),F=E.capabilities.animationSupport!=="disabled",U=[new KA({constraints:Y4.tight(E.size.width,E.size.height),child:this.threadListSidebar.buildBody(D)})];if(this.commandPalette.isEnabled())U.push(new Y$({debugLabel:"CommandPaletteOverlay",onFocusChange:this.closeCommandPaletteOnFocusLoss,child:new km0({onDismiss:this.commandPalette.disable})}));if(this.switchThreadPickerVisible&&!this.welcomeVisible)U.push(Qc0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:this.closeSwitchThreadPicker,onThreadSelected:this.closeSwitchThreadPicker}));if(this.welcomeVisible)U.push(new Y$({debugLabel:"WelcomeDialogOverlay",child:new Jp0({onDismiss:this.dismissWelcome,onQuit:()=>I1.instance.stop(),animationsEnabled:F,variant:this.widget.welcomeVariant})}));let Y=this.executorAlreadyConnectedDialog;if(Y)U.push(new Y$({debugLabel:"ExecutorAlreadyConnectedDialogOverlay",child:new Xd0({existingExecutorPid:Y.existingExecutorPid,onChoice:this.handleExecutorAlreadyConnectedChoice})}));if(U.push(...this.mcpTrustIntegration?.buildDialogLayers()??[]),U.push(...this.pluginIntegration?.buildDialogLayers()??[]),this.widget.context.isInternalUser)U.push(new ym0({top:this.focusDebugVisible?33:1,visible:this.debugOverlayVisible,pid:Q90.pid,activeThreadID:this.activeThreadContext?.client.getThreadId()??null,connectionInfo$:this.activeThreadContext?.observer.connectionInfo()??null}));if(this.focusDebugVisible)U.push(new Id0);if(this.endCreditsVisible)U.push(new Ed0({onComplete:this.completeEndCredits,highScore:this.invadersHighScore,onHighScoreChange:this.updateInvadersHighScore}));return new H6({context:this.widget.context,child:new AB({commandRegistry:this.commandRegistry,child:new ST({completionBuilder:this.widget.completionBuilder,child:new D6({controller:this.toastController,child:new u4({actions:this.buildActions(),child:new e6({debugLabel:"AppShortcuts",shortcuts:this.buildShortcuts(),child:new u6({debugLabel:"AppShellFocus",child:new lb0({controller:this.toastController,complexToastControllers:[this.relaunchNotificationController,...B&&this.activeThreadContext&&!this.welcomeVisible?[this.notices]:[]],child:new xm0({configReloadEvents:this.widget.configService.configReloadEvents,toastController:this.toastController,child:new A6({children:U})})})})})})})})})})}buildShortcuts(){let A=new Map([[WA.ctrl("c"),new e70],[WA.ctrl("o"),new QD0],[WA.alt("i"),new BD0],[WA.alt("p"),new up],[WA.ctrl("."),new FD0],[WA.ctrl("t"),new YD0],...this.threadListSidebar.shortcutEntries()]);if(Q90.env.NODE_ENV==="development"&&Q90.platform==="darwin")A.set(WA.meta("r"),new AD0);return A}buildActions(){let A=new cA(()=>{if(aF.hasAnyCopyableSelection())return aF.tryCopyAnyActiveSelection(),"handled";return this.onExitPressed(),"handled"}),Q=new cA(()=>{if(!this.commandPalette.isEnabled()&&this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.toggle(),"handled"}),$=new cA(()=>{if(this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.enable(),"handled"}),B=new cA(()=>{return this.startNewDraftThread(),"handled"}),D=new cA(()=>{return I1.instance.stop(),"handled"}),E=new cA(()=>{return ol({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),"handled"}),F=new cA((I)=>{if(!I.text)return"ignored";return I1.instance.tuiInstance.clipboard.writeText(I.text).then((G)=>{if(G.ok)this.toastController.show(I.successMessage,"success",2000);else this.toastController.show(`${I.failureMessage}: ${G.userFacingErrorMessage}`,"error",4000)}).catch((G)=>{_.error("Failed to copy Neo text to clipboard",{error:G}),this.toastController.show(I.failureMessage,"error",2000)}),"handled"}),J=new cA(()=>{return I1.instance.toggleFrameStatsOverlay(),"handled"}),U=new cA(()=>this.notices.dismissCurrent()?"handled":"ignored"),Y=new cA(()=>{if(!this.widget.context.isInternalUser)return"ignored";return this.setState(()=>{this.debugOverlayVisible=!this.debugOverlayVisible}),"handled"}),Z=ew4({getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,context:this.widget.context,toastController:this.toastController,startNewDraftThread:this.startNewDraftThread,sendFeedbackReport:this.sendFeedbackReport}),X=new cA(()=>{return this.setState(()=>{this.focusDebugVisible=!this.focusDebugVisible}),"handled"});return new Map([[e70,A],[Wl,B],[$K,D],[AD0,E],[Y3,F],[ql,$],[QD0,Q],[BD0,Y],...this.threadListSidebar.actionEntries(),[FD0,U],...Z,[up,J],[YD0,X]])}startNewDraftThread(A={}){let Q=this.activeThreadContext?.client.getThreadId();if(this.commandPalette.disable(),this.threadNavigationHistory.recordNavigation(Q),this.setState(()=>{if(this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.cancelOwnerUIRequests(),this.activeThreadContext=null,this.connectingToThreadID=null,A.hideDebugOverlay)this.debugOverlayVisible=!1}),this.widget.onActiveThreadChange?.(null),this.syncEmptyThreadPluginConfirmationTitle(),A.prompt!==void 0)this.editorController.text=A.prompt}syncEmptyThreadPluginConfirmationTitle=()=>{this.emptyThreadTerminalTitleController.setPluginConfirmationBlocked(this.activeThreadContext===null&&(this.pluginIntegration?.hasBlockingConfirmDialog()??!1))};closeCommandPaletteOnFocusLoss=(A)=>{if(A||!this.commandPalette.isEnabled())return;this.commandPalette.disable()};ensureDraftThreadSettingsInitialized(){if(this.hasDraftThreadSettingsSeed)return Promise.resolve();if(!this.draftThreadSettingsInitPromise)this.draftThreadSettingsInitPromise=this.initDraftThreadSettings();return this.draftThreadSettingsInitPromise}async initDraftThreadSettings(){try{let A=this.applySessionDefaultsToThreadSettings(await tP(this.widget.configService));this.applyDraftThreadSettingsSeed(A)}catch(A){_.warn("Failed to initialize Neo draft thread settings",{error:A instanceof Error?A.message:String(A)})}}applySessionDefaultsToThreadSettings(A){let Q=this.widget.context.sessionAgentMode,$=A,B=uN(Q),D=j50(this.widget.context,Q);if(B!==void 0&&D!==void 0)$={...$,[B]:D};return M50($,{agentMode:Q,explicitEffort:this.widget.context.explicitReasoningEffort,sessionState:this.widget.context})}applyDraftThreadSettingsSeed(A){if(!this.mounted)return;if(!this.hasDraftThreadSettingsSeed){this.setState(()=>{this.hasDraftThreadSettingsSeed=!0,this.draftThreadSettings=XP4(this.draftThreadSettings,{},A),this.draftThreadSettingsSeed={...A}});return}if(JU(this.draftThreadSettingsSeed,A))return;this.setState(()=>{this.draftThreadSettings=XP4(this.draftThreadSettings,this.draftThreadSettingsSeed,A),this.draftThreadSettingsSeed={...A}})}buildHints(){let A=new Set;if(this.connectingToThreadID)A.add(QK);if(this.exitHintTimer.isActive())A.add(NT);return A}onExitPressed=()=>{if(this.exitHintTimer.isActive())this.exitHintTimer.clear(),I1.instance.stop();else this.exitHintTimer.activate()};dismissWelcome=()=>{if(!this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!1}),this.widget.onWelcomeDismissed?.()};updateInvadersHighScore=(A)=>{if(A<=this.invadersHighScore)return;this.setState(()=>{this.invadersHighScore=A}),YY((Q)=>({...Q,neoInvadersHighScore:Math.max(Q.neoInvadersHighScore,A)})).catch((Q)=>{_.warn("Failed to save Neo Invaders high score",{error:Q instanceof Error?Q.message:String(Q)})})};showWelcome=()=>{if(this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!0})};showEndCredits=()=>{if(this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!0})};completeEndCredits=()=>{if(!this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!1})};promptExecutorAlreadyConnected(A){return new Promise((Q)=>{this.setState(()=>{this.executorAlreadyConnectedDialog={existingExecutorPid:A.existingExecutorPid,resolve:($)=>{Q($==="watch"?"observe":"disconnect")}}})})}handleExecutorAlreadyConnectedChoice=(A)=>{if(this.resolveExecutorAlreadyConnectedDialog(A),A==="exit")I1.instance.stop()};resolveExecutorAlreadyConnectedDialog(A){let Q=this.executorAlreadyConnectedDialog;if(!Q)return;this.setState(()=>{this.executorAlreadyConnectedDialog=null}),Q.resolve(A)}closeSwitchThreadPicker=()=>{if(!this.switchThreadPickerVisible)return;this.setState(()=>{this.switchThreadPickerVisible=!1})};updateDraftThreadSettings=(A)=>{this.setState(()=>{this.draftThreadSettings=A(this.draftThreadSettings)})};onNewThread=async(A,Q,$=null,B,D,E)=>{await this.ensureDraftThreadSettingsInitialized();let F=this.activeThreadContext?.client.getThreadId(),J=A.find(G00);if(J)this.widget.history.add(J.text,Q90.cwd()),this.widget.history.reset();let U=$?void 0:await this.widget.getDefaultNewThreadVisibility?.(),Y=$??U??null,Z=this.widget.clientPool.createNewThread(Q,this.draftThreadSettings,Y??void 0,D,E);if(this.sendUserMessage(Z,A,D?void 0:Q,D?void 0:B),!D)this.rememberSessionDefaultsForNewMessage(Q,this.draftThreadSettings);this.threadNavigationHistory.recordNavigation(F),this.setActiveClient(Z)};rememberSessionDefaultsForNewMessage(A,Q){this.widget.context.sessionAgentMode=A;let $=Q["reasoning.effort"];if($!==void 0)this.widget.context.lastReasoningEffortByMode={...this.widget.context.lastReasoningEffortByMode??{},[A]:$};let B=uN(A),D=B?Q[B]:void 0;if(D!==void 0)this.widget.context.lastSpeedByMode={...this.widget.context.lastSpeedByMode??{},[A]:D};YY((E)=>{let F={...E,agentMode:A};if($!==void 0)F={...F,lastReasoningEffortByMode:{...F.lastReasoningEffortByMode??{},[A]:$}};if(D!==void 0)F={...F,lastSpeedByMode:{...F.lastSpeedByMode??{},[A]:D}};return F}).catch((E)=>{_.warn("Failed to persist Neo session defaults for new message",{error:E instanceof Error?E.message:String(E)})})}sendUserMessage(A,Q,$,B){let D=J70(this.ideStatus.getValue());if(B===void 0){A.client.sendUserMessage(Q,$,{userState:D});return}A.client.sendUserMessage(Q,$,{reasoningEffort:B,userState:D})}getActiveThreadID=()=>{return this.activeThreadContext?.client.getThreadId()??void 0};getRelaunchThreadIDs=()=>{let A=new Set,Q=this.getActiveThreadID();if(Q)A.add(Q);for(let $ of this.widget.clientPool.activeThreadIDs)A.add($);return[...A]};appendPluginMessagesToThread=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("appendToThread is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.append is only available for the active executor thread");for(let D of A)this.sendUserMessage($,[{type:"text",text:D.content}])};readPluginThreadMessages=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("thread.messages is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.messages is only available for the active thread");return laA(iaA($.observer.protocolMessages()),A)};runPluginAgent=async(A,Q)=>{await this.ensureDraftThreadSettingsInitialized();let $=this.widget.clientPool.createNewThread(this.widget.context.sessionAgentMode,this.draftThreadSettings,void 0,A,Q.agentModeDisplay,Q.parentThreadID,{trackAsLastActive:!1});this.sendUserMessage($,[{type:"text",text:Q.message}]);try{let B=await yXQ($,{timeoutMs:Q.timeoutMs}),D=$.client.getThreadId();return D?{threadID:D,text:B}:{text:B}}finally{this.widget.clientPool.disconnect($)}};async connectToExistingThread(A,Q={}){let $=this.activeThreadContext?.client.getThreadId();this.setState(()=>{this.connectingToThreadID=A});try{let B=await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:(D)=>this.promptExecutorAlreadyConnected(D)});if(this.setActiveClient(B),Q.recordNavigation&&$!==A)this.threadNavigationHistory.recordNavigation($);if(Q.initialUserInput)this.sendUserMessage(B,[{type:"text",text:Q.initialUserInput}])}catch(B){if(_.error("Failed to load thread",{error:B,threadID:A}),this.toastController.show(`Failed to load ${A}: ${B instanceof Error?B.message:String(B)}`,"error",4000),Q.rethrowError)throw B}finally{this.setState(()=>{this.connectingToThreadID=null})}}async connectToInitialThreads(A,Q={}){await this.connectToExistingThread(A,Q);let $=this.widget.initialThreadIDs.filter((B)=>B!==A);await Promise.all($.map((B)=>this.resumeBackgroundThread(B)))}async resumeBackgroundThread(A){try{await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:async()=>"observe"})}catch(Q){_.error("Failed to resume background thread",{error:Q,threadID:A}),this.toastController.show(`Failed to resume ${A}: ${Q instanceof Error?Q.message:String(Q)}`,"error",4000)}}async navigateBack(){let A=this.threadNavigationHistory.startBackNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateForward(){let A=this.threadNavigationHistory.startForwardNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateToThread(A){try{await this.connectToExistingThread(A.targetThreadID,{rethrowError:!0})}catch{A.rollback()}}setActiveClient({client:A,observer:Q,agentModeDisplay:$}){this.setState(()=>{this.activeThreadContext={client:A,observer:Q,agentModeDisplay:$}}),this.syncEmptyThreadPluginConfirmationTitle(),this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=Q.threadID().subscribe((B)=>{this.widget.onActiveThreadChange?.(B)}),this.activePluginMessageSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription?.unsubscribe(),this.pluginIntegration?.cancelOwnerUIRequests(),this.activePluginMessageSubscription=Q.pluginMessages().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage(B,(D)=>{A.sendPluginMessage(D)})}),this.activePluginUIRequestsSubscription=Q.pluginUIRequests().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage({type:"plugin_message",message:{type:"event",event:"plugin.ui.snapshot",data:{requests:[...B]}}},(D)=>{A.sendPluginMessage(D)})})}handleIdeSelection=async(A)=>{try{await this.widget.ideManager.connect(A)}catch(Q){_.error("Failed to connect to IDE",{error:Q});let $=Q instanceof Error?Q.message:String(Q);this.toastController.show(`IDE connection failed: ${$}`,"error",4000)}};dispose(){if(this.unregisterCommands?.(),this.unregisterCommands=null,this.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.dispose(),this.pluginIntegration=null,this.emptyThreadTerminalTitleController.dispose(),this.mcpTrustIntegration?.dispose(),this.mcpTrustIntegration=null,this.updateRelaunchIntegration?.dispose(),this.updateRelaunchIntegration=null,this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.noticesPollingTimeout)clearTimeout(this.noticesPollingTimeout),this.noticesPollingTimeout=null;this.connectionErrorsSubscription?.unsubscribe(),this.configSubscription?.unsubscribe(),this.configSubscription=null,this.notices.dispose(),this.widget.notificationService.detach(),this.toastController.dispose(),super.dispose()}hasBlockingTopLevelModal(){return this.switchThreadPickerVisible||this.executorAlreadyConnectedDialog!==null||this.welcomeVisible||(this.mcpTrustIntegration?.hasBlockingDialog()??!1)||this.endCreditsVisible||(this.pluginIntegration?.hasBlockingDialog()??!1)}}function XP4(A,Q,$){let B={...A};for(let D of bXQ(Q,$)){if(!JU(A[D],Q[D]))continue;let E=$[D];if(E===void 0)delete B[D];else B[D]=E}return B}function bXQ(...A){return Array.from(new Set(A.flatMap((Q)=>Object.keys(Q))))}A3();function GP4(A,Q,$,B){let D=nyA(A),E="\x1B[0m",F="\x1B[34m",J="\x1B[90m",U="\x1B[2m",Y=[];if(A.archived)Y.push("\x1B[90m\x1B[2mArchived\x1B[0m");Y.push(`${D}`),Y.push(`\x1B[34m${Q}\x1B[0m`),Y.push(`\x1B[90mamp threads continue ${A.id}\x1B[0m`);let Z=14,X=7,I=new nF(Z,X),G=new f5(42),V=new fT(Z,X,Z,X,Z,X,0,A.agentMode??"smart","intensity","ascii",void 0,void 0,d0.default(),G);V.layout(Y4.tight(Z,X)),V.paint(I,0,0);let z=I.getBuffer().getCells(),K=0;for(let R=0;R<X;R++)if(z[R].some((S)=>S.char!==" ")){K=R;break}let C=X-1;for(let R=X-1;R>=0;R--)if(z[R].some((S)=>S.char!==" ")){C=R;break}function W(R,S){if(!R)return"";if(R.type==="rgb"){let{r:P,g:f,b:m}=R.value;if($.getColorDepth()>=24)return`\x1B[${S?38:48};2;${P};${f};${m}m`;let x=Tp(P,f,m);return`\x1B[${S?38:48};5;${x}m`}return""}let u=[];if(C>=K)for(let R=K;R<=C;R++){let S="";for(let P=0;P<Z;P++){let f=z[R][P],m=f.char,x=W(f.style.fg,!0);S+=x+m+"\x1B[0m"}u.push(S)}let H=u.length,N=Math.max(H,Y.length),w=Math.floor((N-H)/2),M=Math.floor((N-Y.length)/2);for(let R=0;R<N;R++){let S=" ".repeat(Z);if(R>=w&&R<w+H)S=u[R-w];let P=" ",f="";if(R>=M&&R<M+Y.length)f=Y[R-M];$.write(S+P+f+`
|
|
4825
|
+
`))}function IXQ(A,Q){let{colors:$,app:B}=Q;switch(A){case"pending":return{icon:"◌",color:$.warning};case"registered":return{icon:"•",color:$.mutedForeground};case"failed":return{icon:"✗",color:B.toolError};case"duplicate":return{icon:"◇",color:$.warning};default:return{icon:"?",color:$.foreground}}}function iR4(A,Q){let $=A.replace(/\s+/g," ").trim();if(oA($)<=Q)return $;let B="...",D=oA(B);if(Q<=D)return YD(B,Q);return`${YD($,Q-D,!0,"")}${B}`}var Dp0="https://ampcode.com/news/neo",Ep0=[{title:"Meet the new Amp CLI",body:[]},{title:"Rebuilt From The Ground Up",body:["Same close-up terminal workflow. Completely different underneath."]},{title:"Just Keep Typing",body:["Context is summarized automatically at ~90%.","No handoff flow. No context percentage to babysit."]},{title:"Queueing and Steering",body:["Sending a message now queues by default instead of cancelling tools.","Use steering when you want the agent to see something sooner."]},{title:"Remote Control",body:["Start a thread in the CLI, then keep going from ampcode.com.","Watch live updates and queue follow-ups from any device."]},{title:"Customize Amp with Amp",body:[{text:"Amp now has a ",linkText:"complete plugin API",href:"https://ampcode.com/manual/plugin-api",textAfter:"."},"Add tools, commands, control UI, and hook into events."]},{title:"Permissions",body:[{text:"By default (when no ",highlightText:"amp.permissions",textAfterHighlight:" setting is present), Amp no longer asks for confirmation before running any tools and commands. And you can now implement your own custom permission logic with ",linkText:"plugins",href:"https://ampcode.com/manual/plugin-api",textAfter:"."}]},{title:null,body:["Check out the full news post for more:",{text:Dp0,href:Dp0}]}];function GXQ(A){return[{title:"Upgrade your Amp CLI",body:[{text:"This npm-based distribution of Amp CLI has been deprecated. To use the ",linkText:"new Amp CLI",href:Dp0,textAfter:" you'll need to switch to the binary install:",linkWidget:!0},"",{codeBlock:["npm uninstall -g @sourcegraph/amp",A]}]}]}function VXQ(){if(process.platform==="win32")return'powershell -c "irm https://ampcode.com/install.ps1 | iex"';return"curl -fsSL https://ampcode.com/install.sh | bash"}var oT=50,Iq=40,$p0=1000,zXQ=420,KXQ=760,CXQ=-250,WXQ=1100,t80=33,rR4=0.999,uXQ=2.1,HXQ=720,NXQ=420,DP4="Meet the new",EP4="Amp",FP4="CLI",Fp0=F4(DP4).length,qXQ=F4(EP4).length,wXQ=F4(FP4).length,e80={primary:{r:140,g:38,b:0},secondary:{r:255,g:225,b:102}},sR4={primary:{r:10,g:42,b:18},secondary:{r:200,g:230,b:68}},tR4={primary:{r:18,g:0,b:107},secondary:{r:103,g:255,b:168}},eR4=[e80,sR4,tR4,e80,sR4,tR4,e80],OXQ=e80;class Jp0 extends a0{onDismiss;onQuit;animationProgress;animationsEnabled;variant;binaryInstallCommand;introStages;dismissible;constructor(A){super();this.onDismiss=A.onDismiss,this.onQuit=A.onQuit,this.animationProgress=A.animationProgress,this.animationsEnabled=A.animationsEnabled??!0,this.variant=A.variant??"intro",this.binaryInstallCommand=A.binaryInstallCommand??VXQ(),this.introStages=this.variant==="npm-migration"?GXQ(this.binaryInstallCommand):Ep0,this.dismissible=this.variant!=="npm-migration"}createState(){return new JP4}}class JP4 extends n0{startedAt=performance.now();animationTimer=null;stageTransitionTimer=null;firstStageTitleTimer=null;firstStageHintTimer=null;firstStageRevealTimer=null;firstStageTitleRevealStartedAt=null;firstStageHintRevealStartedAt=null;stageTransitionStartedAt=performance.now();animationStartProgress=0;animationTargetProgress=1;animationDurationMs=$p0;onAnimationComplete=null;animationProgress=0;introStage=0;previousIntroStage=null;stageTransitionProgress=1;stageTransitionDirection=1;firstStageTitleVisible=!1;firstStageHintVisible=!1;firstStageTitleRevealProgress=0;firstStageHintRevealProgress=0;dismissTimer=null;dismissStartedAt=performance.now();dismissProgress=0;isDismissing=!1;splashOrbGlow=new f5(42);initState(){super.initState(),this.startAnimationIfNeeded()}didUpdateWidget(A){if(super.didUpdateWidget(A),A.animationProgress!==this.widget.animationProgress||A.animationsEnabled!==this.widget.animationsEnabled)this.startAnimationIfNeeded()}dispose(){this.stopAnimation(),this.stopStageTransitionTimer(),this.stopFirstStageRevealTimers(),this.stopDismissAnimation(),super.dispose()}startAnimationIfNeeded(){if(this.stopAnimation(),this.stopFirstStageRevealTimers(),this.widget.animationProgress!==void 0){this.animationProgress=h9(this.widget.animationProgress),this.firstStageTitleVisible=this.animationProgress>=rR4,this.firstStageHintVisible=this.animationProgress>=rR4,this.firstStageTitleRevealProgress=this.firstStageTitleVisible?1:0,this.firstStageHintRevealProgress=this.firstStageHintVisible?1:0;return}if(!this.widget.animationsEnabled){this.stopStageTransitionTimer(),this.stopDismissAnimation(),this.animationProgress=1,this.isDismissing=!1,this.dismissProgress=0,this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1,this.previousIntroStage=null,this.stageTransitionProgress=1;return}if(this.firstStageTitleVisible=!1,this.firstStageHintVisible=!1,this.firstStageTitleRevealProgress=0,this.firstStageHintRevealProgress=0,this.startProgressAnimation({from:0,to:1,durationMs:$p0,onComplete:()=>{if(!this.widget.dismissible)this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1})}}),this.widget.dismissible)this.startFirstStageRevealSequence()}startDismissAnimation(){if(this.isDismissing)return;if(!this.widget.animationsEnabled){this.widget.onDismiss();return}this.stopFirstStageRevealTimers(),this.stopStageTransitionTimer(),this.dismissStartedAt=performance.now(),this.setState(()=>{this.isDismissing=!0,this.dismissProgress=0}),this.dismissTimer=setInterval(()=>{let A=performance.now()-this.dismissStartedAt,Q=h9(A/KXQ);if(this.setState(()=>{this.dismissProgress=Q}),Q>=1)this.stopDismissAnimation(),this.widget.onDismiss()},t80)}canNavigateIntroStage(){if(this.isDismissing)return!1;if(!this.firstStageHintVisible)return!1;if(this.introStage===0&&this.firstStageHintRevealProgress<1)return!1;return!0}advanceIntroStage(){if(!this.canNavigateIntroStage())return;if(this.isFinalIntroStage()){if(this.widget.dismissible)this.startDismissAnimation();return}this.moveIntroStage(1)}dismissFromFinalIntroStage(){if(!this.widget.dismissible||!this.canNavigateIntroStage()||!this.isFinalIntroStage())return!1;return this.startDismissAnimation(),!0}nextIntroStage(){if(!this.canNavigateIntroStage()||this.isFinalIntroStage())return;this.moveIntroStage(1)}goToPreviousIntroStage(){if(!this.canNavigateIntroStage()||this.introStage<=0)return;this.moveIntroStage(-1)}isFinalIntroStage(){return this.introStage>=this.widget.introStages.length-1}moveIntroStage(A){let Q=this.introStage+A;if(this.stopStageTransitionTimer(),this.stageTransitionStartedAt=performance.now(),this.setState(()=>{this.previousIntroStage=this.introStage,this.introStage=Q,this.stageTransitionDirection=A}),this.widget.animationProgress!==void 0||!this.widget.animationsEnabled){this.setState(()=>{this.previousIntroStage=null,this.stageTransitionProgress=1});return}this.setState(()=>{this.stageTransitionProgress=0}),this.stageTransitionTimer=setInterval(()=>{let $=performance.now()-this.stageTransitionStartedAt,B=h9($/zXQ);if(this.setState(()=>{if(this.stageTransitionProgress=B,B>=1)this.previousIntroStage=null}),B>=1)this.stopStageTransitionTimer()},t80)}startProgressAnimation({from:A,to:Q,durationMs:$,onComplete:B}){this.stopAnimation(),this.startedAt=performance.now(),this.animationStartProgress=A,this.animationTargetProgress=Q,this.animationDurationMs=$,this.onAnimationComplete=B,this.animationProgress=A,this.animationTimer=setInterval(()=>{let D=performance.now()-this.startedAt,E=h9(D/this.animationDurationMs),F=this.animationStartProgress+(this.animationTargetProgress-this.animationStartProgress)*rT(E);if(this.setState(()=>{this.animationProgress=F}),E>=1)this.stopAnimation(),this.onAnimationComplete?.(),this.onAnimationComplete=null},t80)}stopAnimation(){if(this.animationTimer)clearInterval(this.animationTimer),this.animationTimer=null}stopStageTransitionTimer(){if(this.stageTransitionTimer)clearInterval(this.stageTransitionTimer),this.stageTransitionTimer=null}startFirstStageRevealSequence(){if(this.stopFirstStageRevealTimers(),!this.widget.animationsEnabled){this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageHintVisible=!0,this.firstStageTitleRevealProgress=1,this.firstStageHintRevealProgress=1});return}this.setState(()=>{this.firstStageTitleVisible=!1,this.firstStageHintVisible=!1,this.firstStageTitleRevealProgress=0,this.firstStageHintRevealProgress=0});let A=Math.max(0,$p0+CXQ),Q=A+WXQ;this.firstStageTitleTimer=setTimeout(()=>{this.firstStageTitleRevealStartedAt=performance.now(),this.setState(()=>{this.firstStageTitleVisible=!0,this.firstStageTitleRevealProgress=0}),this.startFirstStageRevealTimer()},A),this.firstStageHintTimer=setTimeout(()=>{this.firstStageHintRevealStartedAt=performance.now(),this.setState(()=>{this.firstStageHintVisible=!0,this.firstStageHintRevealProgress=0}),this.startFirstStageRevealTimer()},Q)}startFirstStageRevealTimer(){if(this.firstStageRevealTimer)return;this.firstStageRevealTimer=setInterval(()=>{let A=performance.now(),Q=this.firstStageTitleRevealStartedAt?h9((A-this.firstStageTitleRevealStartedAt)/HXQ):this.firstStageTitleRevealProgress,$=this.firstStageHintRevealStartedAt?h9((A-this.firstStageHintRevealStartedAt)/NXQ):this.firstStageHintRevealProgress;if(this.setState(()=>{this.firstStageTitleRevealProgress=Q,this.firstStageHintRevealProgress=$}),Q>=1&&$>=1)this.stopFirstStageRevealTimer()},t80)}stopFirstStageRevealTimers(){if(this.stopFirstStageRevealTimer(),this.firstStageTitleRevealStartedAt=null,this.firstStageHintRevealStartedAt=null,this.firstStageTitleTimer)clearTimeout(this.firstStageTitleTimer),this.firstStageTitleTimer=null;if(this.firstStageHintTimer)clearTimeout(this.firstStageHintTimer),this.firstStageHintTimer=null}stopFirstStageRevealTimer(){if(this.firstStageRevealTimer)clearInterval(this.firstStageRevealTimer),this.firstStageRevealTimer=null}stopDismissAnimation(){if(this.dismissTimer)clearInterval(this.dismissTimer),this.dismissTimer=null}currentOrbPalette(){let A=AP4(this.introStage),Q=this.previousIntroStage===null||this.stageTransitionProgress>=1?A:QP4(AP4(this.previousIntroStage),A,rT(this.stageTransitionProgress));return this.dismissProgress>0?QP4(Q,OXQ,rT(this.dismissProgress)):Q}build(A){let Q=f4.of(A).colorScheme,$=EA.of(A),B=this.currentOrbPalette(),D=H7(1,"deep",B),E=z4.of(A).size,J=this.widget.animationProgress??this.animationProgress,U=Math.max(E.width/oT,E.height/Iq)*uXQ,Y=U+(1-U)*J,Z=rT(this.dismissProgress),X=Math.max(oT,Math.round(oT*Y)),I=Math.max(Iq,Math.round(Iq*Y)),G=Math.round((E.width-X)/2),V=Math.round((E.height-I)/2),z=Math.max(0,Math.floor((E.width-oT)/2)),K=-Math.floor(Iq/2),C=Math.round(G+(z-G)*J),W=Math.round(V+(K-V)*J),u=C+X/2,H=W+I/2,N=MXQ({dismissProgress:this.dismissProgress,easedDismissProgress:Z,introOrbScale:Y,normalOrbCenterX:u,normalOrbCenterY:H,size:E}),w=Math.max(oT,Math.round(oT*N.orbScale)),M=Math.max(Iq,Math.round(Iq*N.orbScale)),R=N.orbCenterX,S=N.orbCenterY,P=Math.round(R-w/2),f=Math.round(S-M/2),m=Math.max(3,Math.min(E.height-5,Math.floor(Iq/2)+2)),x=Math.max(m+3,E.height-3),v=N.textDissolveProgress,k=this.isFinalIntroStage()?N.backdropDissolveProgress:0,c=this.firstStageTitleVisible&&v<1,d=c&&this.firstStageHintVisible,b=d&&this.widget.dismissible&&this.introStage>0&&!this.isFinalIntroStage(),p=this.introStage===0?this.firstStageTitleRevealProgress:1,n=this.introStage===0?this.firstStageHintRevealProgress:1,s=Math.max(24,Math.min(74,E.width-4)),X0=Math.min(12,Math.max(8,E.height-m-6)),E0=Math.max(0,Math.floor((E.width-s)/2)),G0=Math.max(0,Math.min(E.height-X0,Math.floor(E.height*0.55-X0/2))),N0=this.widget.animationProgress!==void 0||!this.widget.animationsEnabled?new UK({width:w,height:M,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,seed:42,fps:0,onClick:()=>{}}):new UK({width:w,height:M,agentMode:"deep",glyphSet:"dotField",backgroundColor:Q.background,primaryColor:B.primary,secondaryColor:B.secondary,glow:this.splashOrbGlow,onClick:()=>{}});return new Y$({autofocus:!0,canRequestFocus:!0,debugLabel:"WelcomeTakeover",onKey:(t)=>{if(t.key==="Enter")return this.advanceIntroStage(),"handled";if(!this.widget.dismissible&&t.key==="c"&&t.ctrlKey)return this.widget.onQuit?.(),"handled";if(!this.widget.dismissible&&t.key==="q")return this.widget.onQuit?.(),"handled";if((t.key===" "||t.key==="Space")&&!this.isFinalIntroStage())return this.advanceIntroStage(),"handled";if(t.key==="Escape"||t.key==="Esc"){if(!this.widget.dismissible)return this.widget.onQuit?.(),"handled";return this.dismissFromFinalIntroStage()?"handled":"ignored"}if(t.key==="ArrowRight")return this.nextIntroStage(),"handled";if(t.key==="ArrowLeft")return this.goToPreviousIntroStage(),"handled";return"ignored"},child:new A6({fit:"expand",children:[new UP4({color:Q.background,dissolveProgress:k}),new A6({fit:"expand",children:[new nA({onClick:()=>{},child:b0.expand()}),new r1({left:P,top:f,width:w,height:M,child:N0}),...c?[new r1({left:E0,top:G0,width:s,height:X0,child:jXQ({introStages:this.widget.introStages,stage:this.introStage,previousStage:this.previousIntroStage,progress:this.stageTransitionProgress,direction:this.stageTransitionDirection,width:s,height:X0,foreground:Q.foreground,mutedForeground:Q.mutedForeground,accent:D,link:$.app.link,keybind:$.app.keybind,titleRevealProgress:p,dissolveProgress:v,context:A})})]:[],...d?[...b?[new r1({left:E0,top:Math.max(0,x-1),width:s,height:1,child:new F0({text:SXQ({stage:this.introStage,featureStageCount:Math.max(0,this.widget.introStages.length-2),foreground:Q.mutedForeground,dissolveProgress:v}),textAlign:"center"})})]:[],new r1({left:E0,top:x,width:s,height:1,child:fXQ({finalStage:this.isFinalIntroStage(),dismissible:this.widget.dismissible,foreground:Q.mutedForeground,keybind:$.app.keybind,revealProgress:n,dissolveProgress:v,context:A})})]:[]]})]})})}}class UP4 extends U3{color;dissolveProgress;constructor({color:A,dissolveProgress:Q}){super();this.color=A,this.dissolveProgress=Q}createRenderObject(){return new YP4(this.color,this.dissolveProgress)}updateRenderObject(A){A.update(this.color,this.dissolveProgress)}}class YP4 extends xA{color;dissolveProgress;constructor(A,Q){super();this.color=A,this.dissolveProgress=Q}update(A,Q){this.color=A,this.dissolveProgress=Q,this.markNeedsPaint()}performLayout(){let A=this._lastConstraints;sA(!!A,"performLayout called without constraints");let Q=A.constrain(A.biggest.width,A.biggest.height);this.setSize(Q.width,Q.height),super.performLayout()}paint(A,Q=0,$=0){let B=Math.floor(Q+this.offset.x),D=Math.floor($+this.offset.y),E=Math.floor(this.size.width),F=Math.floor(this.size.height),J={bg:this.color},U=h9(this.dissolveProgress);if(U<=0){A.fill(B,D,E,F," ",J);return}if(U>=1)return;for(let Y=0;Y<F;Y++)for(let Z=0;Z<E;Z++)if(!LXQ(Z,Y,E,F,U))A.fill(B+Z,D+Y,1,1," ",J)}}function h9(A){return Math.min(1,Math.max(0,A))}function rT(A){return 1-(1-A)**3}function AP4(A){return eR4[A]??eR4[0]}function QP4(A,Q,$){return{primary:lN(A.primary,Q.primary,$),secondary:lN(A.secondary,Q.secondary,$)}}function MXQ({dismissProgress:A,easedDismissProgress:Q,introOrbScale:$,normalOrbCenterX:B,normalOrbCenterY:D,size:E}){return{orbScale:$+($*0.86-$)*Q,orbCenterX:B+(E.width*0.54-B)*Q,orbCenterY:D-E.height*0.44*Q,textDissolveProgress:h9(A/0.52),backdropDissolveProgress:rT(h9((A-0.12)/0.88))}}function LXQ(A,Q,$,B,D){let E=B<=1?0:Q/(B-1),F=ZP4(A+Q*Math.max(1,$));return(1-E)*0.72+F*0.28<D}function jXQ({introStages:A,stage:Q,previousStage:$,progress:B,direction:D,width:E,height:F,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V}){if($===null||B>=1)return Bp0({introStages:A,stage:Q,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V});let z=rT(B),K=D*Math.round((1-z)*E),C=-D*Math.round(z*E);return new vN(new A6({fit:"expand",children:[new r1({left:C,top:0,width:E,height:F,child:Bp0({introStages:A,stage:$,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:$===0?1:I,dissolveProgress:G,context:V})}),new r1({left:K,top:0,width:E,height:F,child:Bp0({introStages:A,stage:Q,foreground:J,mutedForeground:U,accent:Y,link:Z,keybind:X,titleRevealProgress:I,dissolveProgress:G,context:V})})]}))}function Bp0({introStages:A,stage:Q,foreground:$,mutedForeground:B,accent:D,link:E,keybind:F,titleRevealProgress:J,dissolveProgress:U,context:Y}){let Z=A[Q]??A[0]??Ep0[0],X=new $0({color:D,bold:!0}),I=new $0({color:$}),G=A===Ep0&&Q===0,V=[...Z.title===null?[]:[new F0({text:G?A90(TXQ({progress:J,foreground:D,pulseColor:D}),U):new g(KD(Z.title,U),X),textAlign:"center"})],...Z.body.length>0?[RXQ()]:[],...Z.body.map((z)=>PXQ(z,I,B,E,F,U,Y))];return new AQ({child:new gA({padding:t0.horizontal(1),child:new IA({crossAxisAlignment:"stretch",mainAxisAlignment:"center",mainAxisSize:"min",children:V})})})}function RXQ(){return b0.height(1)}function PXQ(A,Q,$,B,D,E,F){if(typeof A==="string")return new F0({text:new g(KD(A,E),Q),textAlign:"center"});if("codeBlock"in A)return new XD({onCopy:(J,U)=>{if(U)D6.success(F,"Copied to clipboard",2000)},child:new IA({mainAxisSize:"min",children:A.codeBlock.map((J)=>new F0({text:new g(KD(J,E),new $0({color:D})),textAlign:"center",selectable:!0}))})});if("keybind"in A){let J=new F0({text:new g("",void 0,[new g(KD(A.text,E),new $0({color:$,dim:!0})),new g(KD(A.keybind,E,F4(A.text).length),new $0({color:D}))]),textAlign:"center",selectable:"selectable"in A?A.selectable:!1});if("selectable"in A)return new AQ({child:new XD({child:J})});return J}if("highlightText"in A){let J=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),U=$I.of(F),Y=new g("",void 0,[new g(A.text,Q),new g(A.highlightText,new $0({color:D})),new g(A.textAfterHighlight,Q),new g(J.text,J.style,J.children,J.hyperlink,()=>{H$(F,A.href,{forceExternal:!1,onShowImagePreview:U})}),new g(A.textAfter,Q)]);return new F0({text:A90(Y,E),textAlign:"center"})}if("linkText"in A){if(A.linkWidget)return new IA({mainAxisSize:"min",children:[new F0({text:new g(KD(A.text,E),Q),textAlign:"center"}),new AQ({child:new uA({mainAxisSize:"min",children:[q$.createWidget(F,A.href,KD(A.linkText,E),new $0({color:B,underline:!0})),new F0({text:new g(KD(A.textAfter,E),Q)})]})})]});let J=q$.createSpan(A.href,A.linkText,new $0({color:B,underline:!0})),U=$I.of(F),Y=new g("",void 0,[new g(A.text,Q),new g(J.text,J.style,J.children,J.hyperlink,()=>{H$(F,A.href,{forceExternal:!1,onShowImagePreview:U})}),new g(A.textAfter,Q)]);return new F0({text:A90(Y,E),textAlign:"center"})}if(E>0)return new F0({text:new g(KD(A.text,E),new $0({color:B,underline:!0})),textAlign:"center"});return new AQ({child:q$.createWidget(F,A.href,A.text,new $0({color:B,underline:!0}))})}function TXQ({progress:A,foreground:Q,pulseColor:$}){let B=new $0({color:Q,bold:!0}),D=new $0({color:_XQ({progress:A,foreground:Q,pulseColor:$}),bold:!0});return new g("",void 0,[new g(vXQ(A).padEnd(Fp0," "),B),new g(" ",B),new g($P4(EP4,qXQ,A,0.72),B),new g(" ",B),new g($P4(FP4,wXQ,A,0.88),D)])}function vXQ(A){let Q=F4(DP4),$=Math.min(Fp0,Math.ceil(h9(A/0.62)*Fp0));return Q.slice(0,$).join("")}function $P4(A,Q,$,B){return $>=B?A:"".padEnd(Q," ")}function _XQ({progress:A,foreground:Q,pulseColor:$}){if(A<0.88||A>=1)return Q;let B=h9((A-0.88)/0.12);return Math.cos(B*Math.PI*4)*(1-B)>0.12?$:Q}function SXQ({stage:A,featureStageCount:Q,foreground:$,dissolveProgress:B}){return new g(KD(`${A}/${Q}`,B),new $0({color:$,dim:!0}))}function kXQ({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:D,dissolveProgress:E}){let F=new $0({color:B}),J=new $0({color:$,dim:!0}),U=Q?A?"Enter":"Space":"Esc",Y=Q?A?" to get started":" to continue":" to quit",Z="",X="",I=`${Y}`;if(!Q)return new g("",void 0,[new g(U,F),new g(Y,J),new g("",F),new g("",J)]);let G=BP4(U,D),V=BP4(I,h9((D*(F4(U).length+F4(I).length)-F4(U).length)/F4(I).length));return new g("",void 0,[new g(KD(G,E),F),new g(KD(V.slice(0,Y.length),E),J),new g(KD(V.slice(Y.length,Y.length+0),E),F),new g(KD(V.slice(Y.length+0),E),J)])}function fXQ({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:D,dissolveProgress:E,context:F}){if(Q)return new F0({text:kXQ({finalStage:A,dismissible:Q,foreground:$,keybind:B,revealProgress:D,dissolveProgress:E}),textAlign:"center"});let J=new $0({color:B}),U=new $0({color:$,dim:!0});return new XD({onCopy:(Y,Z)=>{if(Z)D6.success(F,"Copied to clipboard",2000)},child:new F0({text:new g("",void 0,[new g("q",J),new g(" to quit",U)]),textAlign:"center",selectable:!0})})}function BP4(A,Q){let $=F4(A),B=Math.min($.length,Math.ceil(h9(Q)*$.length));return $.slice(0,B).join("").padEnd($.length," ")}function A90(A,Q,$=0){if(Q<=0)return A;let B=$+F4(A.text??"").length,D=A.children?.map((E)=>{let F=A90(E,Q,B);return B+=F4(E.toPlainText()).length,F});return new g(A.text?KD(A.text,Q,$):A.text,A.style,D,A.hyperlink,A.onClick)}function KD(A,Q,$=0){if(Q<=0)return A;return F4(A).map((D,E)=>{if(D.trim()==="")return D;return ZP4($+E)<Q?" ":D}).join("")}function ZP4(A){let Q=Math.sin((A+1)*12.9898)*43758.5453;return Q-Math.floor(Q)}function xXQ(A){let $=A.observer.protocolMessages().filter((B)=>B.role==="assistant").at(-1);if(!$)return null;return $.content.filter((B)=>B.type==="text").map((B)=>B.text).join("")}function yXQ(A,Q={}){return new Promise(($,B)=>{let D=!1,E=setTimeout(()=>{F.unsubscribe(),B(Error("Timed out waiting for agent response"))},Q.timeoutMs??600000),F=A.observer.agentState().subscribe((J)=>{if(nB(J)){D=!0;return}if(!D)return;let U=xXQ(A);if(U===null)return;clearTimeout(E),F.unsubscribe(),$(U)})})}class Up0 extends a0{listSkillsForThread;clientPool;completionBuilder;history;ideManager;configService;updateService;initialThreadIDs;showWelcome;welcomeVariant;onWelcomeDismissed;notificationService;mcpTrustHandler;onThreadArchived;onActiveThreadChange;onRelaunchRequested;onFirstFrame;initialUserInput;getDefaultNewThreadVisibility;observeThreadSummaries;openThreadPickerOnStart;workspaceSettingsFilePath;context;constructor(A){super();this.listSkillsForThread=A.listSkillsForThread,this.clientPool=A.clientPool,this.completionBuilder=A.completionBuilder,this.history=A.history,this.ideManager=A.ideManager,this.configService=A.configService,this.updateService=A.updateService,this.initialThreadIDs=A.initialThreadIDs??[],this.showWelcome=A.showWelcome??!1,this.welcomeVariant=A.welcomeVariant??"intro",this.onWelcomeDismissed=A.onWelcomeDismissed,this.notificationService=A.notificationService,this.mcpTrustHandler=A.mcpTrustHandler,this.onThreadArchived=A.onThreadArchived,this.onActiveThreadChange=A.onActiveThreadChange,this.onRelaunchRequested=A.onRelaunchRequested,this.onFirstFrame=A.onFirstFrame,this.initialUserInput=A.initialUserInput,this.getDefaultNewThreadVisibility=A.getDefaultNewThreadVisibility,this.observeThreadSummaries=A.observeThreadSummaries,this.openThreadPickerOnStart=A.openThreadPickerOnStart??!1,this.workspaceSettingsFilePath=A.workspaceSettingsFilePath,this.context=A.context}createState(){return new IP4}}class IP4 extends n0{editorController=new CY;commandPalette=new dp(this);commandRegistry=new Sm0;toastController=new pb0;relaunchNotificationController=new Mm0;exitHintTimer=new mp(this,1000);ideStatus=new t3(this,{});threadNavigationHistory=new jm0;draftThreadSettings={};draftThreadSettingsSeed={};hasDraftThreadSettingsSeed=!1;draftThreadSettingsInitPromise=null;activeThreadContext=null;activeThreadIDSubscription=null;activePluginMessageSubscription=null;activePluginUIRequestsSubscription=null;connectionErrorsSubscription=null;configSubscription=null;connectingToThreadID=null;executorAlreadyConnectedDialog=null;switchThreadPickerVisible=!1;welcomeVisible=!1;endCreditsVisible=!1;invadersHighScore=0;debugOverlayVisible=!1;focusDebugVisible=!1;unregisterCommands=null;emptyThreadTerminalTitleController=new Ei;pluginIntegration=null;mcpTrustIntegration=null;updateRelaunchIntegration=null;noticesPollingTimeout=null;notices;loadThreads=async()=>{return this.widget.context.listThreads()};analyzeContextForThread=async(A,Q)=>{return ZC4({ampURL:this.widget.context.ampURL,configService:this.widget.configService,threadID:A,signal:Q})};onSwitchThread=(A)=>{return this.connectToExistingThread(A,{recordNavigation:!0,rethrowError:!0})};threadListSidebar=new Ap0({state:this,isBlocked:()=>this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal(),getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,getWorkspaceRoot:()=>this.widget.context.workspaceRoot,loadThreads:this.loadThreads,observeThreadSummaries:()=>this.widget.observeThreadSummaries(),onSelectThread:this.onSwitchThread});sendFeedbackReport=async(A)=>tD0({configService:this.widget.configService,settingsFilePath:this.widget.context.settingsFilePath},A);archiveThread=async(A)=>{let Q=await f70({configService:this.widget.configService},A);if(Q===null)this.widget.onThreadArchived?.(A);return Q};addThreadLabel=async(A,Q)=>{let $=await IN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};removeThreadLabel=async(A,Q)=>{let $=await GN4({configService:this.widget.configService},A,Q);if($ instanceof Error)return $;return this.toastController.show($.message,$.type,2000),null};initState(){if(gX.getInstance().interceptConsole(),this.invadersHighScore=this.widget.context.invadersHighScore??0,this.notices=new Um0(this.widget.configService,($)=>this.setState($)),LQ.instance.addPostFrameCallback(()=>{setTimeout(()=>this.widget.onFirstFrame?.(),0),this.noticesPollingTimeout=setTimeout(()=>{this.noticesPollingTimeout=null,this.notices.startPolling()},500)},"Neo notices polling"),this.widget.showWelcome)this.welcomeVisible=!0;if(this.connectionErrorsSubscription=this.widget.clientPool.connectionErrors$.subscribe(({threadID:$,error:B})=>{if(_.error("Neo failed to connect to thread",{threadID:$,error:B}),!$)this.toastController.show(`Connection failed: ${B.message}`,"error",4000)}),this.configSubscription=this.widget.configService.config.subscribe(($)=>{this.applyDraftThreadSettingsSeed(this.applySessionDefaultsToThreadSettings(H00($.settings)))}),this.updateRelaunchIntegration=new Rm0({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested,relaunchNotificationController:this.relaunchNotificationController,updateService:this.widget.updateService}),this.updateRelaunchIntegration.init(),this.ideStatus.subscribe(this.widget.ideManager.status),this.widget.openThreadPickerOnStart)this.switchThreadPickerVisible=!0;this.ensureDraftThreadSettingsInitialized();let A=this.widget.initialUserInput,Q=this.widget.initialThreadIDs[0];if(Q){let $={};if(A)$.initialUserInput=A;this.connectToInitialThreads(Q,$)}else if(A)this.onNewThread([{type:"text",text:A}],this.widget.context.sessionAgentMode);this.pluginIntegration=new wm0({state:this,commandPalette:this.commandPalette,commandRegistry:this.commandRegistry,toastController:this.toastController,context:this.widget.context,getActiveThreadID:this.getActiveThreadID,appendToThread:this.appendPluginMessagesToThread,readThreadMessages:this.readPluginThreadMessages,runAgent:this.runPluginAgent,onBlockingConfirmDialogChange:this.syncEmptyThreadPluginConfirmationTitle}),this.pluginIntegration.init(),this.mcpTrustIntegration=new Eg0({state:this,mcpTrustHandler:this.widget.mcpTrustHandler,toastController:this.toastController,workspaceSettingsFilePath:this.widget.workspaceSettingsFilePath}),this.mcpTrustIntegration.init(),this.unregisterCommands=this.registerAppCommands(),queueMicrotask(()=>{if(!this.mounted)return;this.replayEarlyInputToEditor()})}replayEarlyInputToEditor(){let A=I1.instance.tuiInstance.getEarlyInputText();if(!A)return;this.editorController.insertText(A)}registerAppCommands(){let A=this,Q=this.widget.context.pluginService?Sw4({pluginService:this.widget.context.pluginService,workspaceRoot:this.widget.context.workspaceRoot,logFilePath:this.widget.context.logFilePath,toastController:this.toastController}):[],B=[mw4({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),{noun:"thread",verb:"switch",description:"Switch to existing thread",keywords:["resume"],status:{type:"enabled"},sortBoost:100,run:(D,E,F)=>{D.pushWithDismiss((J)=>Qc0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:J,onThreadSelected:F}))}},...this.threadListSidebar.commands(),{noun:"thread",verb:"switch to previous",description:"Switch to previous thread",keywords:["back"],get status(){return A.threadNavigationHistory.canNavigateBack()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to previous with no previous thread"}},run:(D,E,F)=>{A.navigateBack(),F()}},kM4({configService:this.widget.configService,getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??void 0,toastController:this.toastController}),{noun:"thread",verb:"switch to next",description:"Switch to next thread",keywords:["forward"],get status(){return A.threadNavigationHistory.canNavigateForward()?{type:"enabled"}:{type:"disabled",reason:"Cannot use thread: switch to next with no next thread"}},run:(D,E,F)=>{A.navigateForward(),F()}},{noun:"mcp",verb:"info",description:"Show MCP servers and tools",status:{type:"enabled"},run:(D,E,F)=>{D.push(new Vd0({mcpServers:this.widget.context.mcpServers,onDismiss:F}))}},{noun:"toolbox",verb:"list",description:"List all toolboxes and their tools",status:{type:"enabled"},run:(D)=>{D.pushWithDismiss((E)=>new Qp0({toolboxes:this.widget.context.toolboxes,onDismiss:E}))}},{noun:"news",verb:"open",description:"Open Amp Chronicle in browser",keywords:["chronicle","blog","announcements"],status:{type:"enabled"},run:async(D,E,F)=>{try{await H$(E,"https://ampcode.com/chronicle")}finally{F()}}},{noun:"settings",verb:"open in editor",description:"Open CLI settings in $EDITOR",keywords:["config"],status:{type:"enabled"},run:()=>{nz(this.widget.context.settingsFilePath).catch((D)=>{_.error("Failed to open settings file in editor",{error:D})})}},{noun:"IDE",verb:"connect",description:"Connect to an IDE",keywords:["vscode","cursor","jetbrains"],status:{type:"enabled"},run:(D,E,F)=>{D.pushWithDismiss((J)=>new Gd0({onCancel:J,onSelect:(U)=>{this.handleIdeSelection(U),F()}}))}},{noun:"amp",verb:"help",description:"Show help & keyboard shortcuts",keywords:["manual","?"],status:{type:"enabled"},run:(D,E,F)=>{D.push(new fm0({commands:AB.of(E).commands,onDismiss:F}))}},{noun:"amp",verb:"show welcome",description:"Show the welcome message again",status:{type:"enabled"},run:(D,E,F)=>{F(),A.showWelcome()}},{noun:"amp",verb:"end credits",description:"Roll the full-screen Amp credits",status:{type:"enabled"},run:(D,E,F)=>{F(),A.showEndCredits()}},{noun:"amp",verb:"show version",description:"Show current Amp version",keywords:["v"],status:{type:"enabled"},run:(D,E,F)=>{D.push(new s4({header:"Amp Version",maxWidth:72,onDismiss:F,child:new F0({text:new g(U70({version:"0.0.1780032159-g3925ab",buildTimestamp:"2026-05-29T05:27:28.532Z",buildType:"release"}))})}))}},{noun:"amp",verb:"quit",description:"Exit application",keywords:["exit","close","bye"],shortcut:WA.ctrl("c"),status:{type:"enabled"},run:(D,E)=>{u4.maybeInvoke(E,new $K)}},...Q,...XN4(this.widget.context.logFilePath)].map((D)=>this.commandRegistry.register(D));return()=>{for(let D of B)D()}}build(A){let Q=this.buildHints(),$=this.ideStatus.getValue(),B=this.notices.current,D=new oc0({initialAgentMode:this.widget.context.sessionAgentMode,initialPluginAgentModeKey:this.widget.context.initialPluginAgentModeKey,analyzeContextForThread:this.analyzeContextForThread,listSkillsForThread:this.widget.listSkillsForThread,threadContext:this.activeThreadContext,draftThreadSettings:this.draftThreadSettings,editorController:this.editorController,history:this.widget.history,updateDraftThreadSettings:this.updateDraftThreadSettings,onNewThread:this.onNewThread,sendFeedbackReport:this.sendFeedbackReport,archiveThread:this.archiveThread,addThreadLabel:this.addThreadLabel,removeThreadLabel:this.removeThreadLabel,configService:this.widget.configService,hints:Q,ideStatus:$,statusItems:this.pluginIntegration?.getStatusItems()??[],pluginConfirmationBlocked:this.pluginIntegration?.hasBlockingConfirmDialog()??!1,notificationService:this.widget.notificationService,notice:this.activeThreadContext||this.welcomeVisible?null:B,onDismissNotice:(Z)=>this.notices.dismiss(Z)}),E=z4.of(A),F=E.capabilities.animationSupport!=="disabled",U=[new KA({constraints:Y4.tight(E.size.width,E.size.height),child:this.threadListSidebar.buildBody(D)})];if(this.commandPalette.isEnabled())U.push(new Y$({debugLabel:"CommandPaletteOverlay",onFocusChange:this.closeCommandPaletteOnFocusLoss,child:new km0({onDismiss:this.commandPalette.disable})}));if(this.switchThreadPickerVisible&&!this.welcomeVisible)U.push(Qc0({activeThreadID:this.activeThreadContext?.client.getThreadId()??null,loadThreads:this.loadThreads,loadThreadTail:this.widget.context.loadThreadTail,onSelectThread:this.onSwitchThread,onDismiss:this.closeSwitchThreadPicker,onThreadSelected:this.closeSwitchThreadPicker}));if(this.welcomeVisible)U.push(new Y$({debugLabel:"WelcomeDialogOverlay",child:new Jp0({onDismiss:this.dismissWelcome,onQuit:()=>I1.instance.stop(),animationsEnabled:F,variant:this.widget.welcomeVariant})}));let Y=this.executorAlreadyConnectedDialog;if(Y)U.push(new Y$({debugLabel:"ExecutorAlreadyConnectedDialogOverlay",child:new Xd0({existingExecutorPid:Y.existingExecutorPid,onChoice:this.handleExecutorAlreadyConnectedChoice})}));if(U.push(...this.mcpTrustIntegration?.buildDialogLayers()??[]),U.push(...this.pluginIntegration?.buildDialogLayers()??[]),this.widget.context.isInternalUser)U.push(new ym0({top:this.focusDebugVisible?33:1,visible:this.debugOverlayVisible,pid:Q90.pid,activeThreadID:this.activeThreadContext?.client.getThreadId()??null,connectionInfo$:this.activeThreadContext?.observer.connectionInfo()??null}));if(this.focusDebugVisible)U.push(new Id0);if(this.endCreditsVisible)U.push(new Ed0({onComplete:this.completeEndCredits,highScore:this.invadersHighScore,onHighScoreChange:this.updateInvadersHighScore}));return new H6({context:this.widget.context,child:new AB({commandRegistry:this.commandRegistry,child:new ST({completionBuilder:this.widget.completionBuilder,child:new D6({controller:this.toastController,child:new u4({actions:this.buildActions(),child:new e6({debugLabel:"AppShortcuts",shortcuts:this.buildShortcuts(),child:new u6({debugLabel:"AppShellFocus",child:new lb0({controller:this.toastController,complexToastControllers:[this.relaunchNotificationController,...B&&this.activeThreadContext&&!this.welcomeVisible?[this.notices]:[]],child:new xm0({configReloadEvents:this.widget.configService.configReloadEvents,toastController:this.toastController,child:new A6({children:U})})})})})})})})})})}buildShortcuts(){let A=new Map([[WA.ctrl("c"),new e70],[WA.ctrl("o"),new QD0],[WA.alt("i"),new BD0],[WA.alt("p"),new up],[WA.ctrl("."),new FD0],[WA.ctrl("t"),new YD0],...this.threadListSidebar.shortcutEntries()]);if(Q90.env.NODE_ENV==="development"&&Q90.platform==="darwin")A.set(WA.meta("r"),new AD0);return A}buildActions(){let A=new cA(()=>{if(aF.hasAnyCopyableSelection())return aF.tryCopyAnyActiveSelection(),"handled";return this.onExitPressed(),"handled"}),Q=new cA(()=>{if(!this.commandPalette.isEnabled()&&this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.toggle(),"handled"}),$=new cA(()=>{if(this.commandPalette.isEnabled()||this.hasBlockingTopLevelModal())return"ignored";return this.commandPalette.enable(),"handled"}),B=new cA(()=>{return this.startNewDraftThread(),"handled"}),D=new cA(()=>{return I1.instance.stop(),"handled"}),E=new cA(()=>{return ol({getRelaunchThreadIDs:this.getRelaunchThreadIDs,onRelaunchRequested:this.widget.onRelaunchRequested}),"handled"}),F=new cA((I)=>{if(!I.text)return"ignored";return I1.instance.tuiInstance.clipboard.writeText(I.text).then((G)=>{if(G.ok)this.toastController.show(I.successMessage,"success",2000);else this.toastController.show(`${I.failureMessage}: ${G.userFacingErrorMessage}`,"error",4000)}).catch((G)=>{_.error("Failed to copy Neo text to clipboard",{error:G}),this.toastController.show(I.failureMessage,"error",2000)}),"handled"}),J=new cA(()=>{return I1.instance.toggleFrameStatsOverlay(),"handled"}),U=new cA(()=>this.notices.dismissCurrent()?"handled":"ignored"),Y=new cA(()=>{if(!this.widget.context.isInternalUser)return"ignored";return this.setState(()=>{this.debugOverlayVisible=!this.debugOverlayVisible}),"handled"}),Z=ew4({getActiveThreadID:()=>this.activeThreadContext?.client.getThreadId()??null,context:this.widget.context,toastController:this.toastController,startNewDraftThread:this.startNewDraftThread,sendFeedbackReport:this.sendFeedbackReport}),X=new cA(()=>{return this.setState(()=>{this.focusDebugVisible=!this.focusDebugVisible}),"handled"});return new Map([[e70,A],[Wl,B],[$K,D],[AD0,E],[Y3,F],[ql,$],[QD0,Q],[BD0,Y],...this.threadListSidebar.actionEntries(),[FD0,U],...Z,[up,J],[YD0,X]])}startNewDraftThread(A={}){let Q=this.activeThreadContext?.client.getThreadId();if(this.commandPalette.disable(),this.threadNavigationHistory.recordNavigation(Q),this.setState(()=>{if(this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.cancelOwnerUIRequests(),this.activeThreadContext=null,this.connectingToThreadID=null,A.hideDebugOverlay)this.debugOverlayVisible=!1}),this.widget.onActiveThreadChange?.(null),this.syncEmptyThreadPluginConfirmationTitle(),A.prompt!==void 0)this.editorController.text=A.prompt}syncEmptyThreadPluginConfirmationTitle=()=>{this.emptyThreadTerminalTitleController.setPluginConfirmationBlocked(this.activeThreadContext===null&&(this.pluginIntegration?.hasBlockingConfirmDialog()??!1))};closeCommandPaletteOnFocusLoss=(A)=>{if(A||!this.commandPalette.isEnabled())return;this.commandPalette.disable()};ensureDraftThreadSettingsInitialized(){if(this.hasDraftThreadSettingsSeed)return Promise.resolve();if(!this.draftThreadSettingsInitPromise)this.draftThreadSettingsInitPromise=this.initDraftThreadSettings();return this.draftThreadSettingsInitPromise}async initDraftThreadSettings(){try{let A=this.applySessionDefaultsToThreadSettings(await tP(this.widget.configService));this.applyDraftThreadSettingsSeed(A)}catch(A){_.warn("Failed to initialize Neo draft thread settings",{error:A instanceof Error?A.message:String(A)})}}applySessionDefaultsToThreadSettings(A){let Q=this.widget.context.sessionAgentMode,$=A,B=uN(Q),D=j50(this.widget.context,Q);if(B!==void 0&&D!==void 0)$={...$,[B]:D};return M50($,{agentMode:Q,explicitEffort:this.widget.context.explicitReasoningEffort,sessionState:this.widget.context})}applyDraftThreadSettingsSeed(A){if(!this.mounted)return;if(!this.hasDraftThreadSettingsSeed){this.setState(()=>{this.hasDraftThreadSettingsSeed=!0,this.draftThreadSettings=XP4(this.draftThreadSettings,{},A),this.draftThreadSettingsSeed={...A}});return}if(JU(this.draftThreadSettingsSeed,A))return;this.setState(()=>{this.draftThreadSettings=XP4(this.draftThreadSettings,this.draftThreadSettingsSeed,A),this.draftThreadSettingsSeed={...A}})}buildHints(){let A=new Set;if(this.connectingToThreadID)A.add(QK);if(this.exitHintTimer.isActive())A.add(NT);return A}onExitPressed=()=>{if(this.exitHintTimer.isActive())this.exitHintTimer.clear(),I1.instance.stop();else this.exitHintTimer.activate()};dismissWelcome=()=>{if(!this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!1}),this.widget.onWelcomeDismissed?.()};updateInvadersHighScore=(A)=>{if(A<=this.invadersHighScore)return;this.setState(()=>{this.invadersHighScore=A}),YY((Q)=>({...Q,neoInvadersHighScore:Math.max(Q.neoInvadersHighScore,A)})).catch((Q)=>{_.warn("Failed to save Neo Invaders high score",{error:Q instanceof Error?Q.message:String(Q)})})};showWelcome=()=>{if(this.welcomeVisible)return;this.setState(()=>{this.welcomeVisible=!0})};showEndCredits=()=>{if(this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!0})};completeEndCredits=()=>{if(!this.endCreditsVisible)return;this.setState(()=>{this.endCreditsVisible=!1})};promptExecutorAlreadyConnected(A){return new Promise((Q)=>{this.setState(()=>{this.executorAlreadyConnectedDialog={existingExecutorPid:A.existingExecutorPid,resolve:($)=>{Q($==="watch"?"observe":"disconnect")}}})})}handleExecutorAlreadyConnectedChoice=(A)=>{if(this.resolveExecutorAlreadyConnectedDialog(A),A==="exit")I1.instance.stop()};resolveExecutorAlreadyConnectedDialog(A){let Q=this.executorAlreadyConnectedDialog;if(!Q)return;this.setState(()=>{this.executorAlreadyConnectedDialog=null}),Q.resolve(A)}closeSwitchThreadPicker=()=>{if(!this.switchThreadPickerVisible)return;this.setState(()=>{this.switchThreadPickerVisible=!1})};updateDraftThreadSettings=(A)=>{this.setState(()=>{this.draftThreadSettings=A(this.draftThreadSettings)})};onNewThread=async(A,Q,$=null,B,D,E)=>{await this.ensureDraftThreadSettingsInitialized();let F=this.activeThreadContext?.client.getThreadId(),J=A.find(G00);if(J)this.widget.history.add(J.text,Q90.cwd()),this.widget.history.reset();let U=$?void 0:await this.widget.getDefaultNewThreadVisibility?.(),Y=$??U??null,Z=this.widget.clientPool.createNewThread(Q,this.draftThreadSettings,Y??void 0,D,E);if(this.sendUserMessage(Z,A,D?void 0:Q,D?void 0:B),!D)this.rememberSessionDefaultsForNewMessage(Q,this.draftThreadSettings);this.threadNavigationHistory.recordNavigation(F),this.setActiveClient(Z)};rememberSessionDefaultsForNewMessage(A,Q){this.widget.context.sessionAgentMode=A;let $=Q["reasoning.effort"];if($!==void 0)this.widget.context.lastReasoningEffortByMode={...this.widget.context.lastReasoningEffortByMode??{},[A]:$};let B=uN(A),D=B?Q[B]:void 0;if(D!==void 0)this.widget.context.lastSpeedByMode={...this.widget.context.lastSpeedByMode??{},[A]:D};YY((E)=>{let F={...E,agentMode:A};if($!==void 0)F={...F,lastReasoningEffortByMode:{...F.lastReasoningEffortByMode??{},[A]:$}};if(D!==void 0)F={...F,lastSpeedByMode:{...F.lastSpeedByMode??{},[A]:D}};return F}).catch((E)=>{_.warn("Failed to persist Neo session defaults for new message",{error:E instanceof Error?E.message:String(E)})})}sendUserMessage(A,Q,$,B){let D=J70(this.ideStatus.getValue());if(B===void 0){A.client.sendUserMessage(Q,$,{userState:D});return}A.client.sendUserMessage(Q,$,{reasoningEffort:B,userState:D})}getActiveThreadID=()=>{return this.activeThreadContext?.client.getThreadId()??void 0};getRelaunchThreadIDs=()=>{let A=new Set,Q=this.getActiveThreadID();if(Q)A.add(Q);for(let $ of this.widget.clientPool.activeThreadIDs)A.add($);return[...A]};appendPluginMessagesToThread=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("appendToThread is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.append is only available for the active executor thread");for(let D of A)this.sendUserMessage($,[{type:"text",text:D.content}])};readPluginThreadMessages=async(A,Q)=>{let $=this.activeThreadContext;if(!$)throw Error("thread.messages is not available - no active thread");let B=$.client.getThreadId();if(Q&&B!==Q)throw Error("thread.messages is only available for the active thread");return laA(iaA($.observer.protocolMessages()),A)};runPluginAgent=async(A,Q)=>{await this.ensureDraftThreadSettingsInitialized();let $=this.widget.clientPool.createNewThread(this.widget.context.sessionAgentMode,this.draftThreadSettings,void 0,A,Q.agentModeDisplay,Q.parentThreadID,{trackAsLastActive:!1});this.sendUserMessage($,[{type:"text",text:Q.message}]);try{let B=await yXQ($,{timeoutMs:Q.timeoutMs}),D=$.client.getThreadId();return D?{threadID:D,text:B}:{text:B}}finally{this.widget.clientPool.disconnect($)}};async connectToExistingThread(A,Q={}){let $=this.activeThreadContext?.client.getThreadId();this.setState(()=>{this.connectingToThreadID=A});try{let B=await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:(D)=>this.promptExecutorAlreadyConnected(D)});if(this.setActiveClient(B),Q.recordNavigation&&$!==A)this.threadNavigationHistory.recordNavigation($);if(Q.initialUserInput)this.sendUserMessage(B,[{type:"text",text:Q.initialUserInput}])}catch(B){if(_.error("Failed to load thread",{error:B,threadID:A}),this.toastController.show(`Failed to load ${A}: ${B instanceof Error?B.message:String(B)}`,"error",4000),Q.rethrowError)throw B}finally{this.setState(()=>{this.connectingToThreadID=null})}}async connectToInitialThreads(A,Q={}){await this.connectToExistingThread(A,Q);let $=this.widget.initialThreadIDs.filter((B)=>B!==A);await Promise.all($.map((B)=>this.resumeBackgroundThread(B)))}async resumeBackgroundThread(A){try{await this.widget.clientPool.connectToThread(A,{observerOnly:this.widget.context.observerOnly,onExecutorAlreadyConnected:async()=>"observe"})}catch(Q){_.error("Failed to resume background thread",{error:Q,threadID:A}),this.toastController.show(`Failed to resume ${A}: ${Q instanceof Error?Q.message:String(Q)}`,"error",4000)}}async navigateBack(){let A=this.threadNavigationHistory.startBackNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateForward(){let A=this.threadNavigationHistory.startForwardNavigation(this.activeThreadContext?.client.getThreadId());if(!A)return;await this.navigateToThread(A)}async navigateToThread(A){try{await this.connectToExistingThread(A.targetThreadID,{rethrowError:!0})}catch{A.rollback()}}setActiveClient({client:A,observer:Q,agentModeDisplay:$}){this.setState(()=>{this.activeThreadContext={client:A,observer:Q,agentModeDisplay:$}}),this.syncEmptyThreadPluginConfirmationTitle(),this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=Q.threadID().subscribe((B)=>{this.widget.onActiveThreadChange?.(B)}),this.activePluginMessageSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription?.unsubscribe(),this.pluginIntegration?.cancelOwnerUIRequests(),this.activePluginMessageSubscription=Q.pluginMessages().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage(B,(D)=>{A.sendPluginMessage(D)})}),this.activePluginUIRequestsSubscription=Q.pluginUIRequests().subscribe((B)=>{this.pluginIntegration?.handlePluginMessage({type:"plugin_message",message:{type:"event",event:"plugin.ui.snapshot",data:{requests:[...B]}}},(D)=>{A.sendPluginMessage(D)})})}handleIdeSelection=async(A)=>{try{await this.widget.ideManager.connect(A)}catch(Q){_.error("Failed to connect to IDE",{error:Q});let $=Q instanceof Error?Q.message:String(Q);this.toastController.show(`IDE connection failed: ${$}`,"error",4000)}};dispose(){if(this.unregisterCommands?.(),this.unregisterCommands=null,this.activePluginMessageSubscription?.unsubscribe(),this.activePluginMessageSubscription=null,this.activePluginUIRequestsSubscription?.unsubscribe(),this.activePluginUIRequestsSubscription=null,this.pluginIntegration?.dispose(),this.pluginIntegration=null,this.emptyThreadTerminalTitleController.dispose(),this.mcpTrustIntegration?.dispose(),this.mcpTrustIntegration=null,this.updateRelaunchIntegration?.dispose(),this.updateRelaunchIntegration=null,this.activeThreadIDSubscription?.unsubscribe(),this.activeThreadIDSubscription=null,this.noticesPollingTimeout)clearTimeout(this.noticesPollingTimeout),this.noticesPollingTimeout=null;this.connectionErrorsSubscription?.unsubscribe(),this.configSubscription?.unsubscribe(),this.configSubscription=null,this.notices.dispose(),this.widget.notificationService.detach(),this.toastController.dispose(),super.dispose()}hasBlockingTopLevelModal(){return this.switchThreadPickerVisible||this.executorAlreadyConnectedDialog!==null||this.welcomeVisible||(this.mcpTrustIntegration?.hasBlockingDialog()??!1)||this.endCreditsVisible||(this.pluginIntegration?.hasBlockingDialog()??!1)}}function XP4(A,Q,$){let B={...A};for(let D of bXQ(Q,$)){if(!JU(A[D],Q[D]))continue;let E=$[D];if(E===void 0)delete B[D];else B[D]=E}return B}function bXQ(...A){return Array.from(new Set(A.flatMap((Q)=>Object.keys(Q))))}A3();function GP4(A,Q,$,B){let D=nyA(A),E="\x1B[0m",F="\x1B[34m",J="\x1B[90m",U="\x1B[2m",Y=[];if(A.archived)Y.push("\x1B[90m\x1B[2mArchived\x1B[0m");Y.push(`${D}`),Y.push(`\x1B[34m${Q}\x1B[0m`),Y.push(`\x1B[90mamp threads continue ${A.id}\x1B[0m`);let Z=14,X=7,I=new nF(Z,X),G=new f5(42),V=new fT(Z,X,Z,X,Z,X,0,A.agentMode??"smart","intensity","ascii",void 0,void 0,d0.default(),G);V.layout(Y4.tight(Z,X)),V.paint(I,0,0);let z=I.getBuffer().getCells(),K=0;for(let R=0;R<X;R++)if(z[R].some((S)=>S.char!==" ")){K=R;break}let C=X-1;for(let R=X-1;R>=0;R--)if(z[R].some((S)=>S.char!==" ")){C=R;break}function W(R,S){if(!R)return"";if(R.type==="rgb"){let{r:P,g:f,b:m}=R.value;if($.getColorDepth()>=24)return`\x1B[${S?38:48};2;${P};${f};${m}m`;let x=Tp(P,f,m);return`\x1B[${S?38:48};5;${x}m`}return""}let u=[];if(C>=K)for(let R=K;R<=C;R++){let S="";for(let P=0;P<Z;P++){let f=z[R][P],m=f.char,x=W(f.style.fg,!0);S+=x+m+"\x1B[0m"}u.push(S)}let H=u.length,N=Math.max(H,Y.length),w=Math.floor((N-H)/2),M=Math.floor((N-Y.length)/2);for(let R=0;R<N;R++){let S=" ".repeat(Z);if(R>=w&&R<w+H)S=u[R-w];let P=" ",f="";if(R>=M&&R<M+Y.length)f=Y[R-M];$.write(S+P+f+`
|
|
4826
4826
|
`)}if(B)$.write(`
|
|
4827
4827
|
\x1B[90m${B}\x1B[0m
|
|
4828
4828
|
`)}h0();class Yp0{status=yB.status;constructor(){this.autoConnect()}async connect(A){await yB.start(A,!0,"user-initiated"),yB.selectConfig(A)}autoConnect(){let A=yB.getSelectedConfig();if(A){yB.start(A,!0,"auto-startup").catch((Q)=>{_.error("Failed to auto-connect to IDE",{error:Q})});return}this.discoverAndConnect()}async discoverAndConnect(){try{await HhA();let A=await Yu({});if(A.length===1&&A[0])yB.selectConfig(A[0]),await yB.start(A[0],!0,"auto-startup")}catch(A){_.error("Failed to auto-discover IDE",{error:A})}}}h0();h0();import{exec as Gq}from"node:child_process";function VP4(A="idle"){try{if(A==="idle"){if(process.platform==="darwin")Gq("afplay /System/Library/Sounds/Submarine.aiff");else if(process.platform==="win32")Gq("powershell [console]::beep(800,200)");else if(process.platform==="linux")Gq("paplay /usr/share/sounds/freedesktop/stereo/message.oga || beep")}else if(A==="idle-review"){if(process.platform==="darwin")Gq("afplay /System/Library/Sounds/Glass.aiff")}else if(A==="requires-user-input"){if(process.platform==="darwin")Gq("afplay /System/Library/Sounds/Ping.aiff");else if(process.platform==="win32")Gq("powershell [console]::beep(1000,300)");else if(process.platform==="linux")Gq("paplay /usr/share/sounds/freedesktop/stereo/dialog-information.oga || beep -f 1000 -l 100")}}catch(Q){_.error(`Failed to play notification sound (${A}):`,Q)}}fp();kb0();var hXQ=2000,gXQ="Agent is ready",mXQ="Waiting for approval";function zP4(A){let Q=!0,$=!0,B=A.configService.config.subscribe((C)=>{Q=C.settings["notifications.enabled"]??!0,$=C.settings["notifications.system.enabled"]!==!1}),D=0,E=()=>{let C=G?.prepareTerminalTitleForNotification();if(C!==void 0)process.stdout.write($K4(C))},F=(C)=>{if(!Q)return;let W=Date.now();if(W-D<hXQ)return;if(D=W,iz())return;if(mG4())E(),setTimeout(dG4,zb0);else VP4(C)},J=()=>{F("idle"),V(gXQ)},U=()=>{F("requires-user-input"),V(mXQ)},Y=(C)=>C?.attempt===void 0||C.attempt===0,Z=null,X=null,I=null,G,V=(C)=>{if(!Q||!$)return;if(iz()&&!Sb0()&&!c50())return;E(),setTimeout(()=>{process.stdout.write(QK4(C))},zb0)},z=()=>{Z?.unsubscribe(),X?.unsubscribe(),Z=null,X=null,I=null,G=void 0};return{attach:(C,W,u)=>{if(z(),G=u,W)X=W.subscribe({next:(H)=>{if(H===null)return;if(!Y(H))return;J()},error:(H)=>{_.debug("Neo notification active error stream errored",{error:H})}});Z=C.subscribe({next:(H)=>{try{let N=I!==null&&nB(I),w=I==="awaiting_approval",M=N||w;if(H==="awaiting_approval"&&!w)U();else if(H==="idle"&&M)J()}catch(N){_.debug("Neo notification handling failed",{error:N})}finally{I=H}},error:(H)=>{_.debug("Neo notification agent state stream errored",{error:H})}})},detach:z,unsubscribe(){z(),B.unsubscribe()}}}function dXQ({initialUserInput:A,showWelcome:Q,hideWelcome:$,welcomeVariant:B,welcomeDismissed:D}){if($)return{show:!1,markDismissedOnDismiss:!1};if(B==="npm-migration")return{show:!0,markDismissedOnDismiss:!1};if(Q)return{show:!0,markDismissedOnDismiss:!0};let E=!A&&!D;return{show:E,markDismissedOnDismiss:E}}async function cXQ(A){await YY((Q)=>QT(Q,A,"interactive"))}async function KP4(A,Q={}){let{initialThreadIDs:$=[],initialUserInput:B,getDefaultNewThreadVisibility:D,openThreadPickerOnStart:E=!1,observerOnly:F=!1,initialAgentMode:J,initialPluginAgentModeKey:U,initialReasoningEffort:Y,onFirstFrame:Z,showWelcome:X=!1,hideWelcome:I=!1,welcomeVariant:G="intro"}=Q,V=G==="npm-migration";if($.length>1)_.info("Resuming multiple initial threads",{threadIDs:$});let z=async(m)=>{let x=await A.getThreadFromServer(m);if(!x)return null;return B50(x)},K=async(m)=>{let x=await A.getThreadFromServer(m);if(!x)throw Error(`Thread ${m} not found`);let v=await P3(m,A.configService,A.apiKey,{usesThreadActors:!0}),k=z8({endpoint:A.rivetEndpoint,poolName:v.poolName}),c={wsToken:v.wsToken,transport:"json-rpc"},b=await k.threadActor.get([v.threadId],{params:c}).fetch("/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({thread:D50(x)}),skipReadyWait:!0});if(!b.ok&&b.status!==409)throw Error(`Thread import failed (${b.status}): ${await b.text()}`);try{await X50(m,A.configService,A.apiKey,{executorType:"local-client"})}catch(p){_.warn("failed to mark thread as imported on server",{threadID:m,error:p instanceof Error?p.message:String(p)})}},C=new Eb0(A.rivetEndpoint,A.apiKey,A.configService,{clientID:Sz.parse(`neo-${crypto.randomUUID()}`),toolService:A.toolService,skillService:A.skillService,requestPluginToolCall:(m)=>A.pluginService.event.toolCall(m),requestPluginToolResult:(m)=>A.pluginService.event.toolResult(m),pluginService:A.pluginService,pluginPlatform:A.pluginPlatform,invokeTool:async(m,x)=>{let v=typeof x.args==="object"&&x.args!==null?x.args:{},k=await gz({toolName:x.toolName,configService:A.configService,toolService:A.toolService,mcpService:A.mcpService,skillService:A.skillService,toolUseID:x.toolCallId,threadId:m});return A.toolService.invokeTool(x.toolName,{args:v},k)},persistLastThreadID:cXQ,readFileSystemDirectory:A.readFileSystemDirectory},z,K),W=await HN(),u=dXQ({initialUserInput:B,showWelcome:X,hideWelcome:I,welcomeVariant:G,welcomeDismissed:W.neoWelcomeDismissed}),H={ampURL:A.ampURL,configService:A.configService,getThreadMarkdown:async(m)=>{let x=await A.getThreadFromServer(m);return x?z60(x):null},isInternalUser:A.isInternalUser,listThreads:A.listThreads,loadThreadTail:A.getThreadTail,logFilePath:rc,mcpServers:A.mcpService.servers,pluginPlatform:A.pluginPlatform,pluginService:A.pluginService,toolboxes:A.toolboxes,observerOnly:V?!1:F,invadersHighScore:W.neoInvadersHighScore,sessionAgentMode:J??W.agentMode,initialPluginAgentModeKey:U,explicitReasoningEffort:Y,lastReasoningEffortByMode:W.lastReasoningEffortByMode,lastSpeedByMode:W.lastSpeedByMode,settingsFilePath:A.settingsFilePath,workspaceRoot:A.workspaceRoot},N=(m,x)=>{return kz4({ampURL:A.ampURL,configService:A.configService,threadID:m,signal:x})},w=()=>xz4({apiKey:A.apiKey,configService:A.configService,rivetEndpoint:A.rivetEndpoint}),M=new Yp0,R=zP4({configService:A.configService}),S=await A.configService.getLatest();I1.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:S.settings["terminal.animation"]===!1}});let P=new Set,f=new Om0;try{await fb0(new Up0({clientPool:C,listSkillsForThread:N,completionBuilder:A.completionBuilder,history:new xy0,ideManager:M,configService:A.configService,updateService:A.updateService,initialThreadIDs:V?[]:$,notificationService:R,mcpTrustHandler:A.mcpTrustHandler,initialUserInput:V?void 0:B,getDefaultNewThreadVisibility:D,observeThreadSummaries:w,openThreadPickerOnStart:V?!1:E,workspaceSettingsFilePath:A.workspaceSettingsFilePath,context:H,showWelcome:u.show,welcomeVariant:G,onActiveThreadChange:A.setActiveThreadID,onRelaunchRequested:f.request,onWelcomeDismissed:u.markDismissedOnDismiss?()=>{YY(gz4).catch((x)=>{_.warn("Failed to mark Neo welcome as dismissed",{error:x})})}:void 0,onThreadArchived:(x)=>{P.add(x)},onFirstFrame:Z}));let m=C.lastActiveObservingClient;if(m&&f.shouldShowExitSummary){let{client:x,observer:v}=m,k=x.getThreadId();if(k){let c={id:k,title:v.title().getValue(),agentMode:v.agentMode,archived:P.has(k)},d=`${A.ampURL.replace(/\/$/,"")}/threads/${k}`;GP4(c,d,process.stdout)}}}finally{process.stdout.write(s50("")),R.unsubscribe(),C.dispose(),await A.dispose?.()}process.exit(f.relaunchIfRequested(A.workspaceRoot)??0)}import{execFile as pXQ}from"node:child_process";import{closeSync as CP4,openSync as lXQ,writeSync as iXQ}from"node:fs";import nXQ from"node:tty";var aXQ="\x1B[c",oXQ="\x1B[?1004h",rXQ="\x1B[?1004l",sXQ="\x1B[?u",WP4=200,tXQ="\x1B[>4;2m",eXQ="\x1B[?9001h",AIQ="\x1B[?9001l";function uP4(){let A=null;try{if(process.stdout.isTTY){let Q=process.stdout.getWindowSize();A=[Q[0],Q[1]]}}catch{}return{isTTY:process.stdout.isTTY,columns:process.stdout.columns??null,rows:process.stdout.rows??null,windowSize:A,hasRefreshSize:typeof process.stdout._refreshSize==="function"}}function QIQ(){if(process.stdout.isTTY)return{stream:process.stdout,target:"stdout",dispose:()=>{}};if(process.stderr.isTTY)return{stream:process.stderr,target:"stderr",dispose:()=>{}};if(process.platform!=="win32")try{let A=lXQ("/dev/tty","w");if(nXQ.isatty(A))return{stream:{write(Q){return iXQ(A,Q),!0}},target:"dev-tty",dispose:()=>{CP4(A)}};CP4(A)}catch{}return{stream:process.stdout,target:"stdout",dispose:()=>{}}}function w$(A,Q){if(!process.stdout.writable||process.stdout.destroyed){Q?.();return}let $=`${JSON.stringify(A)}
|
|
@@ -5095,10 +5095,10 @@ Examples:
|
|
|
5095
5095
|
`),process.exit(0)}finally{await J.asyncDispose()}}catch(F){process.stderr.write((F instanceof Error?F.message:String(F))+`
|
|
5096
5096
|
`),process.exit(1)}})}function rGQ(A,Q){if(Q.header&&Q.header.length>0)throw Error("HTTP headers cannot be used with command-based MCP servers. Use --env instead");let $,B,D=A.indexOf("--");if(D!==-1){let J=A.slice(D+1);if(J.length===0)throw Error("No command provided after -- separator");$=J[0],B=J.length>1?J.slice(1):void 0}else{if(Q.env&&Q.env.length>0&&A.length===0)throw Error("Environment variables provided but no command specified. Use: amp mcp add <name> --env KEY=VAL -- <command>");$=A[0],B=A.length>1?A.slice(1):void 0}let F=sGQ(Q.env||[]);return{command:$,args:B,env:Object.keys(F).length>0?F:void 0}}function BT4(A,Q){return Q.concat(A)}function sGQ(A){let Q={};for(let $ of A){let B=$.indexOf("=");if(B<=0)throw Error(`Invalid --env format: ${$}. Expected KEY=VALUE`);let D=$.slice(0,B),E=$.slice(B+1);if(D.trim()==="")throw Error(`Invalid --env format: ${$}. Expected KEY=VALUE`);if(E==="")throw Error(`Invalid --env format: ${$}. Expected KEY=VALUE`);Q[D]=E}return Q}function tGQ(A){let Q={};for(let $ of A){let B=$.indexOf("=");if(B<=0)throw Error(`Invalid --header format: ${$}. Expected KEY=VALUE`);let D=$.slice(0,B),E=$.slice(B+1);if(E==="")throw Error(`Invalid --header format: ${$}. Expected KEY=VALUE`);Q[D]=E}return Q}function eGQ(A){return"url"in A}function AVQ(A){let Q=A.clientId??A.client_id,$=A.authUrl??A.authorizationUrl??A.auth_url??A.authorization_url,B=A.tokenUrl??A.token_url;if(!Q||!$||!B)return;return{clientId:Q,clientSecret:A.clientSecret??A.client_secret,authUrl:$,tokenUrl:B,scopes:A.scopes,redirectUrl:A.redirectUrl??A.redirect_url}}function QVQ(A){if(!eGQ(A))return A;let Q={url:A.url};if(A.headers)Q.headers=A.headers;if(A.transport)Q.transport=A.transport;if(A.oauth){let $=AVQ(A.oauth);if($)Q.oauth=$}return Q}function ET4(A){return Object.fromEntries(Object.entries(A).map(([Q,$])=>[Q,QVQ($)]))}var $VQ=j.object({clientId:j.string().optional(),clientSecret:j.string().optional(),authUrl:j.string().optional(),authorizationUrl:j.string().optional(),tokenUrl:j.string().optional(),scopes:j.array(j.string()).optional(),redirectUrl:j.string().optional(),client_id:j.string().optional(),client_secret:j.string().optional(),auth_url:j.string().optional(),authorization_url:j.string().optional(),token_url:j.string().optional(),redirect_url:j.string().optional()}).refine((A)=>{let Q=A.clientId||A.client_id,$=A.authUrl||A.authorizationUrl||A.auth_url||A.authorization_url,B=A.tokenUrl||A.token_url;return Q&&$&&B},{message:"OAuth config requires clientId (or client_id), authUrl/authorizationUrl (or auth_url/authorization_url), and tokenUrl (or token_url)"}),BVQ=j.object({command:j.string(),args:j.array(j.string()).optional(),env:j.record(j.string(),j.string()).optional()}).strict(),DVQ=j.looseObject({url:j.string(),headers:j.record(j.string(),j.string()).optional(),transport:j.string().optional(),oauth:$VQ.optional()}),EVQ=j.union([BVQ,DVQ]),FVQ=j.record(j.string(),EVQ);async function FT4(A){let Q;if(A.trim().startsWith("{"))Q=A;else{let{readFile:E}=await import("node:fs/promises");try{Q=await E(A,"utf-8")}catch(F){throw new MA(`Failed to read --mcp-config file: ${F instanceof Error?F.message:String(F)}`)}}let B;try{B=JSON.parse(Q)}catch(E){throw new MA(`Failed to parse --mcp-config as JSON: ${E instanceof Error?E.message:String(E)}`)}let D;try{D=FVQ.parse(B)}catch(E){if(E instanceof j.ZodError){let F=E.issues.map((J)=>`${J.path.join(".")}: ${J.message}`).join(", ");throw new MA(`Invalid MCP server configuration: ${F}`)}throw new MA(`Failed to validate MCP server configuration: ${String(E)}`)}return ET4(D)}function JT4(A,Q){return{...A,async get($,B){if($!=="mcpServers")return A.get($);let D=Object.fromEntries(Object.entries(Q).map(([J,U])=>[J,{...U,_target:"flag"}])),E=await A.get($,"global"),F=await A.get($,"workspace");if(B==="global")return q00({global:E,override:D});else if(B==="workspace")return F;return q00({global:E,workspace:F,override:D})},async keys(){let $=await A.keys();if(!$.includes("mcpServers"))$.push("mcpServers");return $}}}h0();LA();import{stderr as JVQ}from"node:process";function UT4(A,Q){A.onUntrustedWorkspaceServer=($)=>{let B=Q.getSettingsFilePath();JVQ.write(f0.yellow(`Warning: Untrusted MCP server '${$}' found in workspace settings.
|
|
5097
5097
|
To fix: Add "amp.mcpTrustedWorkspaces": ["${Q.getWorkspaceRootPath()}"] to ${B}
|
|
5098
|
-
`))}}class Hp0{mcpService;workspaceFolder;pendingServers=new Set;notificationTimeout;_pendingServersSubject=new G4([]);serversSubscription;pendingServers$=this._pendingServersSubject;constructor(A,Q){this.mcpService=A;this.workspaceFolder=Q;this.setupListener()}setupListener(){this.mcpService.onUntrustedWorkspaceServer=(Q,$)=>{if(this.pendingServers.add(Q),this.notificationTimeout)clearTimeout(this.notificationTimeout);this.notificationTimeout=setTimeout(()=>{this._pendingServersSubject.next(Array.from(this.pendingServers)),this.notificationTimeout=void 0},700)};let A=this.mcpService.trustStore.changes?this.mcpService.trustStore.changes.pipe(K6(void 0)):v0.of(void 0);this.serversSubscription=GQ(this.mcpService.servers,A).pipe(d4(([Q,$])=>e4(async()=>{let B=new Set;for(let D of Q)if(D.requiresApproval&&D.specHash){if(!await this.mcpService.trustStore.hasEntry?.({serverName:D.name,specHash:D.specHash}))B.add(D.name)}return B}))).subscribe((Q)=>{if(UVQ(this.pendingServers,Q))return;this.pendingServers=Q,this._pendingServersSubject.next(Array.from(this.pendingServers))})}async trustAlways(){try{await this.mcpService.allowWorkspace(this.workspaceFolder);let A=Array.from(this.pendingServers);for(let Q of A)try{await this.mcpService.approveWorkspaceServer(Q)}catch($){_.error("Failed to approve MCP server",{serverName:Q,error:$})}}catch(A){_.error("Failed to allow workspace",{error:A})}this.clear()}async trustOnce(A){try{await this.mcpService.approveWorkspaceServer(A),this.pendingServers.delete(A),this._pendingServersSubject.next(Array.from(this.pendingServers))}catch(Q){_.error("Failed to approve MCP server",{serverName:A,error:Q})}}async deny(){let A=Array.from(this.pendingServers);for(let Q of A)try{await this.mcpService.denyWorkspaceServer(Q)}catch($){_.error("Failed to deny MCP server",{serverName:Q,error:$})}this.clear()}clear(){this.pendingServers.clear(),this._pendingServersSubject.next([])}dispose(){if(this.notificationTimeout)clearTimeout(this.notificationTimeout);if(this.serversSubscription)this.serversSubscription.unsubscribe()}}function UVQ(A,Q){if(A.size!==Q.size)return!1;for(let $ of A)if(!Q.has($))return!1;return!0}I5();function X90(A){let Q=[],$={meta:{visibility:"private",sharedGroupIDs:[]}};if(A.workspace?.disablePrivateThreads)$.disabledReason="Disabled by workspace policy";if(Q.push($),A.workspace?.groups&&A.workspace.groups.length>0){let
|
|
5098
|
+
`))}}class Hp0{mcpService;workspaceFolder;pendingServers=new Set;notificationTimeout;_pendingServersSubject=new G4([]);serversSubscription;pendingServers$=this._pendingServersSubject;constructor(A,Q){this.mcpService=A;this.workspaceFolder=Q;this.setupListener()}setupListener(){this.mcpService.onUntrustedWorkspaceServer=(Q,$)=>{if(this.pendingServers.add(Q),this.notificationTimeout)clearTimeout(this.notificationTimeout);this.notificationTimeout=setTimeout(()=>{this._pendingServersSubject.next(Array.from(this.pendingServers)),this.notificationTimeout=void 0},700)};let A=this.mcpService.trustStore.changes?this.mcpService.trustStore.changes.pipe(K6(void 0)):v0.of(void 0);this.serversSubscription=GQ(this.mcpService.servers,A).pipe(d4(([Q,$])=>e4(async()=>{let B=new Set;for(let D of Q)if(D.requiresApproval&&D.specHash){if(!await this.mcpService.trustStore.hasEntry?.({serverName:D.name,specHash:D.specHash}))B.add(D.name)}return B}))).subscribe((Q)=>{if(UVQ(this.pendingServers,Q))return;this.pendingServers=Q,this._pendingServersSubject.next(Array.from(this.pendingServers))})}async trustAlways(){try{await this.mcpService.allowWorkspace(this.workspaceFolder);let A=Array.from(this.pendingServers);for(let Q of A)try{await this.mcpService.approveWorkspaceServer(Q)}catch($){_.error("Failed to approve MCP server",{serverName:Q,error:$})}}catch(A){_.error("Failed to allow workspace",{error:A})}this.clear()}async trustOnce(A){try{await this.mcpService.approveWorkspaceServer(A),this.pendingServers.delete(A),this._pendingServersSubject.next(Array.from(this.pendingServers))}catch(Q){_.error("Failed to approve MCP server",{serverName:A,error:Q})}}async deny(){let A=Array.from(this.pendingServers);for(let Q of A)try{await this.mcpService.denyWorkspaceServer(Q)}catch($){_.error("Failed to deny MCP server",{serverName:Q,error:$})}this.clear()}clear(){this.pendingServers.clear(),this._pendingServersSubject.next([])}dispose(){if(this.notificationTimeout)clearTimeout(this.notificationTimeout);if(this.serversSubscription)this.serversSubscription.unsubscribe()}}function UVQ(A,Q){if(A.size!==Q.size)return!1;for(let $ of A)if(!Q.has($))return!1;return!0}I5();function X90(A){let Q=[],$={meta:{visibility:"private",sharedGroupIDs:[]}};if(A.workspace?.disablePrivateThreads)$.disabledReason="Disabled by workspace policy";if(Q.push($),A.workspace?.groups&&A.workspace.groups.length>0){let E={meta:{visibility:"private",shareWithAllCreatorGroups:!0}};if(A.creatorIsViewer===!1)E.disabledReason="Can only be set by thread creator";Q.push(E)}if(A.workspace)Q.push({meta:{visibility:"thread_workspace_shared"}});let B=A.workspace?.disablePublicSharing?"Disabled by workspace policy":void 0,D={meta:{visibility:"public_unlisted"}};if(B)D.disabledReason=B;return Q.push(D),Q}function Np0(A,Q={}){switch(A.visibility){case"thread_workspace_shared":return{text:"Workspace",description:"Visible to all members of the workspace"};case"public_discoverable":return{text:"Public",description:"Visible on public profile & publicly searchable"};case"public_unlisted":return{text:"Unlisted",description:"Visible to anyone on the Internet who has the link"};case"thread_group_shared":case"private":{let $=A.visibility==="private"&&"shareWithAllCreatorGroups"in A&&A.shareWithAllCreatorGroups,B=$?Q.workspace?.groups.map((E)=>E.id)??[]:("sharedGroupIDs"in A)?A.sharedGroupIDs:[],D=B.reduce((E,F)=>{let J=Q.workspace?.groups.find((U)=>U.id===F)?.name;if(J)E.push(`'${J}'`);return E},[]);if(D.length>0)return{text:"Group",description:`Shared with ${O1(D.length,"group")} ${D.join(", ")} and workspace admins`};if($)return{text:"Group",description:"Shared with creator groups and workspace admins"};if(B.length>0)return{text:"Group",description:`Shared with ${O1(B.length,"group")} and workspace admins`};return{text:"Private",description:Q.workspace?"Only visible to you and workspace admins":"Only you can see this thread"}}}}function I90(A){if(A.visibility==="private")return"shareWithAllCreatorGroups"in A?"group":"private";if(A.visibility==="thread_workspace_shared")return"workspace";return"unlisted"}function Oi(A,Q=null){let $=A!==null&&typeof A==="object"&&"visibility"in A?A.visibility:void 0;if(!$||typeof $!=="string")return;let D=X90({workspace:Q?.team??void 0}).filter((E)=>!E.disabledReason).map((E)=>I90(E.meta));if(D.includes($))return YVQ($);if($==="group"&&!D.includes("group")){if(Q?.team?.groups!==void 0)return Error(`Group visibility is not available. You are not a member of any group in this workspace.
|
|
5099
5099
|
`);return Error(`Group visibility is not available.
|
|
5100
5100
|
`)}return Error(`Invalid visibility. Must be one of: ${D.join(", ")}
|
|
5101
|
-
`)}function YVQ(A){switch(A){case"
|
|
5101
|
+
`)}function YVQ(A){switch(A){case"unlisted":return{visibility:"public_unlisted"};case"workspace":return{visibility:"thread_workspace_shared"};case"private":return{visibility:"private",sharedGroupIDs:[]};case"group":return{visibility:"private",shareWithAllCreatorGroups:!0}}}async function ZVQ(A,Q,$){let B=VA0(A);if(!B.success)throw Error(`Invalid permission format: ${B.error.message}`);if(B.data.length===0)throw Error("No permission entry provided");let D=QV(B.data);if(!D.success){let U=D.error.issues.map((Y)=>Y.message).join(", ");throw Error(`Invalid permission entry: ${U}`)}let E=await Q.get("permissions",$)??[],J=[B.data[0],...E];await Q.set("permissions",J,$)}async function YT4(A){try{let Q=A.args.map(($)=>{if(/[\s/\\*?[\]{}()"]/.test($))return`"${$}"`;return $}).join(" ");await ZVQ(Q,A.settings,A.scope),A.exit(0)}catch(Q){let $=Q instanceof Error?Q.message:"Unknown error";A.stderr.write(`Error: ${$}
|
|
5102
5102
|
`),A.exit(1)}}async function ZT4(A){let Q=A.builtinOnly?vL:await A.settings.get("permissions",A.scope)??[];if(A.json)A.stdout.write(JSON.stringify(Q,null,2));else{let $=Lb(Q);A.stdout.write($),A.stdout.write(`
|
|
5103
5103
|
`)}A.exit(0)}var XVQ={outputResult(A,Q,$){let B={tool:A.toolName,arguments:Q,...A.context&&{context:A.context},...A.threadId&&{threadId:A.threadId},...$};A.stdout.write(JSON.stringify(B,null,2))},outputError(A,Q,$){let B={tool:A.toolName,arguments:Q,...A.context&&{context:A.context},...A.threadId&&{threadId:A.threadId},...$};A.stdout.write(JSON.stringify(B,null,2))}},IVQ={outputResult(A,Q,$){if(A.stdout.write(`tool: ${A.toolName}
|
|
5104
5104
|
`),A.stdout.write(`arguments: ${JSON.stringify(Q)}
|
|
@@ -6722,7 +6722,7 @@ Start Amp from a smaller directory.`};function JI(A,Q){if(!TG4())return;_.debug(
|
|
|
6722
6722
|
`)}function Xv4(A,Q){A.command("usage").description("Show your current Amp usage and credit balance").action(async($,B)=>{let D=B.optsWithGlobals(),E=await Q(D),F=await E.settings.get("proxy"),J=hbA({settings:{url:E.ampURL,proxy:F},secrets:{getToken:(Y,Z)=>E.secrets.get(Y,Z)}}),U=await k4.userDisplayBalanceInfo({},{config:J});if(!U.ok){if(U.error.code==="auth-required")process.stderr.write(f0.red("Error: ")+"You must be logged in to view usage. Run `amp login` first.\n"),process.exit(1);process.stderr.write(f0.red("Error: ")+U.error.message+`
|
|
6723
6723
|
`),process.exit(1)}process.stdout.write(await JKQ(U.result.displayText)+`
|
|
6724
6724
|
`),process.exit(0)})}var THQ=ri.join(EU,"logs","headless.log"),Yi0=ri.join(ey,"device-id.json");tX4();async function vHQ(){let A=await Promise.all(Uu.map(async(Q)=>{try{return{query:Q,hasConfigs:(await Q.listConfigs()).length>0}}catch($){return _.debug("Failed to detect query-based IDE integration",{ideName:Q.ideName,error:$}),{query:Q,hasConfigs:!1}}}));for(let Q of A)if(Q.hasConfigs)return Q.query;return}function hk4(){vHQ().then((A)=>{if(A){let Q=S00(A.ideName);if(Q)Qu(Q)}})}try{if(process.platform==="win32")await Promise.resolve().then(() => N4(Hv(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(A){R7.write(`Failed to change directory to ${process.env.AMP_PWD}: ${A}
|
|
6725
|
-
`)}function _HQ(A){process.emitWarning=(Q,$,B,D)=>{let E=typeof Q==="string"?Q:Q.message||String(Q),F=$||"Warning",J=!1;A.warn(E,{name:F,code:B})}}function qB(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")AV("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("mode")==="cli"&&Nv(Q.mode))AV("experimental.agentMode",Q.mode)}function SHQ(A,Q){if(!$$(Q))return;if(!b7(Q.user.email)){if(A.model)throw new MA("The --model flag is only available for Amp employees.",1);AV("internal.model",void 0);return}if(A.model)AV("internal.model",xHQ(A.model))}function _k4(A){let Q=A.indexOf(":");if(Q===-1)throw new MA(`Invalid model format "${A}". Expected "provider:model" (e.g., "anthropic:claude-sonnet-4-20250514").`,1);let $=A.slice(0,Q).trim(),B=A.slice(Q+1).trim();if(!$||!B)throw new MA(`Invalid model format "${A}". Both provider and model must be non-empty (e.g., "anthropic:claude-sonnet-4-20250514").`,1)}function kHQ(A){if(A===void 0)return;let Q=A.trim();if(C00(Q))return Q;throw new MA(`Invalid effort "${A}". Expected one of: none, minimal, low, medium, high, xhigh, max.`,1)}function fHQ(A,Q){if(xZ(A,Q))return;let $=Eu(A)?.levels,B=$?` Allowed for ${A}: ${$.join(", ")}.`:"";throw new MA(`Reasoning effort "${Q}" is not available for ${A} mode.${B}`,1)}function xHQ(A){if(!A.includes("="))return _k4(A),A;let Q={};for(let $ of A.split(",")){let B=$.trim();if(!B)continue;let D=B.indexOf("=");if(D===-1)throw new MA(`Invalid mode-specific model entry "${B}". Expected "mode=provider:model" (e.g., "smart=anthropic:claude-sonnet-4-20250514").`,1);let E=B.slice(0,D).trim(),F=B.slice(D+1).trim();if(!E)throw new MA(`Missing mode name in "${B}". Expected "mode=provider:model".`,1);if(!F)throw new MA(`Missing model value for mode "${E}". Expected "${E}=provider:model".`,1);_k4(F),Q[E]=F}if(Object.keys(Q).length===0)throw new MA("No valid model overrides found in --model flag value.",1);return Q}function EE0(A,Q,$){let B=Number(A);if(!Number.isInteger(B)||B<$.min)throw new cB0(`${Q} must be an integer >= ${$.min}`);if($.max!==void 0&&B>$.max)throw new cB0(`${Q} must be an integer <= ${$.max}`);return B}function yHQ(A,Q){if(A.getOptionValueSourceWithGlobals("sp")==="cli"&&Q.sp)return Q.sp;if(A.getOptionValueSourceWithGlobals("systemPrompt")==="cli"&&Q.systemPrompt)return Q.systemPrompt;return}async function bHQ(A){try{return await bk4(A,"utf-8")}catch{return A}}async function hHQ(A,Q,$){let B=yHQ(A,Q);if(!B)return;let D=$$($)?$.features:[],E=$$($)?$.user.email:void 0;if(!gk4(D,qE.HARNESS_SYSTEM_PROMPT)&&!(E&&b7(E)))throw new MA("You are not allowed to do this.",1);AV("systemPrompt",await bHQ(B))}function gk4(A,Q){return A?.some(($)=>$.name===Q&&$.enabled)??!1}function gHQ(A){return A!=="pending"}function jq(A){if(!$$(A))return null;return{...A.user,features:A.features??[],team:A.workspace??void 0}}function mHQ(A){let Q=jq(A);if(Q)return Q.id;if($u(A))throw Error(A.error.message);throw Error("unreachable")}function dHQ(A){try{let Q=new URL(A);return Q.hostname==="localhost"||Q.hostname==="127.0.0.1"}catch{return A.includes("localhost")||A.includes("127.0.0.1")}}function cHQ(A){let B=dHQ(A)?"Run `pnpm dev` to start the local server, then try again.":"Check your network connection or the server URL and try again.";return new MA(`Couldn't connect to the Amp server at ${A}.`,1,B)}function Ii0(A,Q){let $=ix0(Error(A.error.message));if($.message===CB.networkOffline||$.message===CB.networkTimeout)return cHQ(Q);if($.message!==CB.internalBug)return new MA($.message,1,$.suggestion);return new MA(A.error.message.replace(/^Error: /,""),1)}async function pHQ(){if(process.versions.bun)return!1;try{return await UY()==="npm"}catch(A){return _.debug("Failed to detect package manager for Neo npm migration welcome",{error:A}),!1}}var Sk4=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} notification alerts (audio locally, terminal bell over SSH or with AMP_FORCE_BEL; enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(A)=>`${A?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??JF,description:`Custom settings file path (overrides the default location ${JF})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(_).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${rc})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","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:_9(),description:(A)=>A?"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:(A)=>A?"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:(A)=>A?"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:"mode",long:"mode",short:"m",type:"option",default:B9.SMART.key,description:`Set the agent mode (${eG({}).map((A)=>A.mode).join(", ")}) — controls the model, system prompt, and tool selection`},{name:"effort",long:"effort",type:"option",description:"Set reasoning effort for the new thread, when supported by the selected mode",choices:["none","minimal","low","medium","high","xhigh","max"]},{name:"takeMeBack",long:"take-me-back",type:"switch",description:"Show migration instructions for the removed legacy runtime",hidden:!0},{name:"orb",long:"neo-orb",type:"switch",description:"Use the experimental Neo splash orb",hidden:!0},{name:"hideWelcome",long:"hide-welcome",type:"switch",description:"Skip the welcome experience on startup",hidden:!0},{name:"showWelcome",long:"show-welcome",type:"switch",description:"Show the welcome experience on startup",hidden:!0},{name:"observe",long:"observe",type:"option",description:"Open the Neo TUI as an observer of an existing thread (thread ID or URL)",hidden:!0},{name:"headless",long:"headless",type:"optional-option",description:"Run headless thread-actor executor (no TUI). Optionally provide a thread ID to connect to existing thread, otherwise create one.",hidden:!0},{name:"sp",long:"sp",type:"option",description:"Custom system prompt text or file path",hidden:!0},{name:"systemPrompt",long:"system-prompt",type:"option",description:"Custom system prompt text",hidden:!0},{name:"model",long:"model",type:"option",description:'Override the model. Use "provider:model" for all modes, or "mode=provider:model,mode=provider:model" for mode-specific overrides',hidden:!0}],kk4=(A)=>("deprecated"in A)&&A.deprecated===!0,lHQ=(A)=>("hidden"in A)&&A.hidden===!0,iHQ=(A)=>("default"in A),nHQ=(A)=>("default"in A)?A.default:void 0;function fk4(A,Q){if(A.getOptionValueSourceWithGlobals("effort")!=="cli")return;let $=kHQ(Q.effort);if($!==void 0){if(Nv(Q.mode))fHQ(Q.mode,$)}return $}var aHQ="Amp Neo is now Amp and available to everyone. If you need to finish work in the old Amp, you can use an older version. For instructions on how to do that and more information: https://ampcode.com/news/drop-the-neo";function Nv(A){return Object.values(B9).some((Q)=>Q.key===A)}function oHQ(A,Q){if(Nv(A))return A;throw new MA(`${Q} does not support plugin-defined agent modes`,1)}function mk4(A,Q){if(Nv(Q))return{agentMode:Q};let $=A.agentModes.list().find((D)=>D.key===Q||D.label===Q);if(!$){let D=eG({}).map((J)=>J.mode).join(", "),E=A.agentModes.list().map((J)=>J.label).join(", "),F=E?` Plugin modes: ${E}.`:"";throw new MA(`Unknown agent mode '${Q}'. Built-in modes: ${D}.${F}`,1)}let B={label:$.label};if($.color!==void 0)B.color=$.color;return{agentMode:B9.SMART.key,agent:$.agent,agentModeDisplay:B,pluginAgentModeKey:$.key}}async function rHQ(A,Q,$){if(A.getOptionValueSourceWithGlobals("mode")!=="cli")return;return await Q.initialized,mk4(Q,$)}function sHQ(A,Q){let $=Q.args[0],B=Q.commands.map((E)=>E.name());if($&&!$.includes(" ")&&$.length<30&&!/[./\\]/.test($)){let E=B.filter((J)=>$.includes(J)||J.includes($)),F="Run amp --help for a list of available commands.";if(E.length>0)F=`Did you mean: ${E.join(", ")}? Or run amp --help for all commands.`;throw new MA(CB.unknownCommand($),1,F)}}var FE0=y0.file(PHQ.homedir()),Zi0=process.env.XDG_CONFIG_HOME?y0.file(process.env.XDG_CONFIG_HOME):l0.joinPath(FE0,".config");async function _3(A,Q,$){let B=$?.deferAuth??!1,D=$?.skipToolProviders??!1;FbA("0.0.1780014135-gb8f1f5");let E=j00({storage:A.settings,secretStorage:A.secrets,workspaceRoot:v0.of(y0.file(process.cwd())),defaultAmpURL:A.ampURL,homeDir:FE0,userConfigDir:Zi0}),F=A.secrets.get("apiKey",A.ampURL),J=ZL(E),U=null,Y=()=>{return},Z=new Promise((t)=>{Y=t}),X=F.then(async(t)=>{if(!t&&!B)await Z;return U??=J.subscribe(()=>{}),K4(J.pipe(G5(gHQ)))});X.catch(()=>{return}),iT4(E);let I=await E.getLatest();_.debug("Global configuration initialized",{settingsKeys:Object.keys(I.settings)});let G=!1;{let t=await F;if(G=Boolean(t),_.info("API key lookup before login",{found:Boolean(t),ampURL:A.ampURL,deferAuth:B}),!t)if(B)_.info("No API key found, continuing startup with deferred auth");else{v6.write(`No API key found. Starting login flow...
|
|
6725
|
+
`)}function _HQ(A){process.emitWarning=(Q,$,B,D)=>{let E=typeof Q==="string"?Q:Q.message||String(Q),F=$||"Warning",J=!1;A.warn(E,{name:F,code:B})}}function qB(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")AV("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("mode")==="cli"&&Nv(Q.mode))AV("experimental.agentMode",Q.mode)}function SHQ(A,Q){if(!$$(Q))return;if(!b7(Q.user.email)){if(A.model)throw new MA("The --model flag is only available for Amp employees.",1);AV("internal.model",void 0);return}if(A.model)AV("internal.model",xHQ(A.model))}function _k4(A){let Q=A.indexOf(":");if(Q===-1)throw new MA(`Invalid model format "${A}". Expected "provider:model" (e.g., "anthropic:claude-sonnet-4-20250514").`,1);let $=A.slice(0,Q).trim(),B=A.slice(Q+1).trim();if(!$||!B)throw new MA(`Invalid model format "${A}". Both provider and model must be non-empty (e.g., "anthropic:claude-sonnet-4-20250514").`,1)}function kHQ(A){if(A===void 0)return;let Q=A.trim();if(C00(Q))return Q;throw new MA(`Invalid effort "${A}". Expected one of: none, minimal, low, medium, high, xhigh, max.`,1)}function fHQ(A,Q){if(xZ(A,Q))return;let $=Eu(A)?.levels,B=$?` Allowed for ${A}: ${$.join(", ")}.`:"";throw new MA(`Reasoning effort "${Q}" is not available for ${A} mode.${B}`,1)}function xHQ(A){if(!A.includes("="))return _k4(A),A;let Q={};for(let $ of A.split(",")){let B=$.trim();if(!B)continue;let D=B.indexOf("=");if(D===-1)throw new MA(`Invalid mode-specific model entry "${B}". Expected "mode=provider:model" (e.g., "smart=anthropic:claude-sonnet-4-20250514").`,1);let E=B.slice(0,D).trim(),F=B.slice(D+1).trim();if(!E)throw new MA(`Missing mode name in "${B}". Expected "mode=provider:model".`,1);if(!F)throw new MA(`Missing model value for mode "${E}". Expected "${E}=provider:model".`,1);_k4(F),Q[E]=F}if(Object.keys(Q).length===0)throw new MA("No valid model overrides found in --model flag value.",1);return Q}function EE0(A,Q,$){let B=Number(A);if(!Number.isInteger(B)||B<$.min)throw new cB0(`${Q} must be an integer >= ${$.min}`);if($.max!==void 0&&B>$.max)throw new cB0(`${Q} must be an integer <= ${$.max}`);return B}function yHQ(A,Q){if(A.getOptionValueSourceWithGlobals("sp")==="cli"&&Q.sp)return Q.sp;if(A.getOptionValueSourceWithGlobals("systemPrompt")==="cli"&&Q.systemPrompt)return Q.systemPrompt;return}async function bHQ(A){try{return await bk4(A,"utf-8")}catch{return A}}async function hHQ(A,Q,$){let B=yHQ(A,Q);if(!B)return;let D=$$($)?$.features:[],E=$$($)?$.user.email:void 0;if(!gk4(D,qE.HARNESS_SYSTEM_PROMPT)&&!(E&&b7(E)))throw new MA("You are not allowed to do this.",1);AV("systemPrompt",await bHQ(B))}function gk4(A,Q){return A?.some(($)=>$.name===Q&&$.enabled)??!1}function gHQ(A){return A!=="pending"}function jq(A){if(!$$(A))return null;return{...A.user,features:A.features??[],team:A.workspace??void 0}}function mHQ(A){let Q=jq(A);if(Q)return Q.id;if($u(A))throw Error(A.error.message);throw Error("unreachable")}function dHQ(A){try{let Q=new URL(A);return Q.hostname==="localhost"||Q.hostname==="127.0.0.1"}catch{return A.includes("localhost")||A.includes("127.0.0.1")}}function cHQ(A){let B=dHQ(A)?"Run `pnpm dev` to start the local server, then try again.":"Check your network connection or the server URL and try again.";return new MA(`Couldn't connect to the Amp server at ${A}.`,1,B)}function Ii0(A,Q){let $=ix0(Error(A.error.message));if($.message===CB.networkOffline||$.message===CB.networkTimeout)return cHQ(Q);if($.message!==CB.internalBug)return new MA($.message,1,$.suggestion);return new MA(A.error.message.replace(/^Error: /,""),1)}async function pHQ(){if(process.versions.bun)return!1;try{return await UY()==="npm"}catch(A){return _.debug("Failed to detect package manager for Neo npm migration welcome",{error:A}),!1}}var Sk4=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} notification alerts (audio locally, terminal bell over SSH or with AMP_FORCE_BEL; enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(A)=>`${A?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??JF,description:`Custom settings file path (overrides the default location ${JF})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(_).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${rc})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","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:_9(),description:(A)=>A?"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:(A)=>A?"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:(A)=>A?"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:"mode",long:"mode",short:"m",type:"option",default:B9.SMART.key,description:`Set the agent mode (${eG({}).map((A)=>A.mode).join(", ")}) — controls the model, system prompt, and tool selection`},{name:"effort",long:"effort",type:"option",description:"Set reasoning effort for the new thread, when supported by the selected mode",choices:["none","minimal","low","medium","high","xhigh","max"]},{name:"takeMeBack",long:"take-me-back",type:"switch",description:"Show migration instructions for the removed legacy runtime",hidden:!0},{name:"orb",long:"neo-orb",type:"switch",description:"Use the experimental Neo splash orb",hidden:!0},{name:"hideWelcome",long:"hide-welcome",type:"switch",description:"Skip the welcome experience on startup",hidden:!0},{name:"showWelcome",long:"show-welcome",type:"switch",description:"Show the welcome experience on startup",hidden:!0},{name:"observe",long:"observe",type:"option",description:"Open the Neo TUI as an observer of an existing thread (thread ID or URL)",hidden:!0},{name:"headless",long:"headless",type:"optional-option",description:"Run headless thread-actor executor (no TUI). Optionally provide a thread ID to connect to existing thread, otherwise create one.",hidden:!0},{name:"sp",long:"sp",type:"option",description:"Custom system prompt text or file path",hidden:!0},{name:"systemPrompt",long:"system-prompt",type:"option",description:"Custom system prompt text",hidden:!0},{name:"model",long:"model",type:"option",description:'Override the model. Use "provider:model" for all modes, or "mode=provider:model,mode=provider:model" for mode-specific overrides',hidden:!0}],kk4=(A)=>("deprecated"in A)&&A.deprecated===!0,lHQ=(A)=>("hidden"in A)&&A.hidden===!0,iHQ=(A)=>("default"in A),nHQ=(A)=>("default"in A)?A.default:void 0;function fk4(A,Q){if(A.getOptionValueSourceWithGlobals("effort")!=="cli")return;let $=kHQ(Q.effort);if($!==void 0){if(Nv(Q.mode))fHQ(Q.mode,$)}return $}var aHQ="Amp Neo is now Amp and available to everyone. If you need to finish work in the old Amp, you can use an older version. For instructions on how to do that and more information: https://ampcode.com/news/drop-the-neo";function Nv(A){return Object.values(B9).some((Q)=>Q.key===A)}function oHQ(A,Q){if(Nv(A))return A;throw new MA(`${Q} does not support plugin-defined agent modes`,1)}function mk4(A,Q){if(Nv(Q))return{agentMode:Q};let $=A.agentModes.list().find((D)=>D.key===Q||D.label===Q);if(!$){let D=eG({}).map((J)=>J.mode).join(", "),E=A.agentModes.list().map((J)=>J.label).join(", "),F=E?` Plugin modes: ${E}.`:"";throw new MA(`Unknown agent mode '${Q}'. Built-in modes: ${D}.${F}`,1)}let B={label:$.label};if($.color!==void 0)B.color=$.color;return{agentMode:B9.SMART.key,agent:$.agent,agentModeDisplay:B,pluginAgentModeKey:$.key}}async function rHQ(A,Q,$){if(A.getOptionValueSourceWithGlobals("mode")!=="cli")return;return await Q.initialized,mk4(Q,$)}function sHQ(A,Q){let $=Q.args[0],B=Q.commands.map((E)=>E.name());if($&&!$.includes(" ")&&$.length<30&&!/[./\\]/.test($)){let E=B.filter((J)=>$.includes(J)||J.includes($)),F="Run amp --help for a list of available commands.";if(E.length>0)F=`Did you mean: ${E.join(", ")}? Or run amp --help for all commands.`;throw new MA(CB.unknownCommand($),1,F)}}var FE0=y0.file(PHQ.homedir()),Zi0=process.env.XDG_CONFIG_HOME?y0.file(process.env.XDG_CONFIG_HOME):l0.joinPath(FE0,".config");async function _3(A,Q,$){let B=$?.deferAuth??!1,D=$?.skipToolProviders??!1;FbA("0.0.1780032159-g3925ab");let E=j00({storage:A.settings,secretStorage:A.secrets,workspaceRoot:v0.of(y0.file(process.cwd())),defaultAmpURL:A.ampURL,homeDir:FE0,userConfigDir:Zi0}),F=A.secrets.get("apiKey",A.ampURL),J=ZL(E),U=null,Y=()=>{return},Z=new Promise((t)=>{Y=t}),X=F.then(async(t)=>{if(!t&&!B)await Z;return U??=J.subscribe(()=>{}),K4(J.pipe(G5(gHQ)))});X.catch(()=>{return}),iT4(E);let I=await E.getLatest();_.debug("Global configuration initialized",{settingsKeys:Object.keys(I.settings)});let G=!1;{let t=await F;if(G=Boolean(t),_.info("API key lookup before login",{found:Boolean(t),ampURL:A.ampURL,deferAuth:B}),!t)if(B)_.info("No API key found, continuing startup with deferred auth");else{v6.write(`No API key found. Starting login flow...
|
|
6726
6726
|
`);let C0=await tHQ(A),l=await A.secrets.get("apiKey",A.ampURL);if(_.info("Login flow completed",{success:C0,storedKeyPresent:Boolean(l),ampURL:A.ampURL}),!C0)await JY(),process.exit(1);G=!0,Y()}}{let t=await E.getLatest(),C0=t.settings.url,l=t.secrets.isSet?.[C0];_.info("Config secrets state after login",{configURL:C0,apiKeySet:l?.apiKey??!1})}let V=B?"pending":await X;if(!B)_.info("Server status resolved",{status:"ready",isAuthenticated:$$(V),isError:$u(V),errorMessage:$u(V)?V.error.message:void 0});SHQ(Q,V);let z=X.then((t)=>mHQ(t));z.catch(()=>{return});let K=$$(V),C=!1;if(process.env.AMP_DISABLE_PLUGINS==="1")_.warn("Ignoring AMP_DISABLE_PLUGINS outside development");let W=C?"off":"all",{toolService:u,dispose:H}=v24({configService:E}),N=new Map,w=()=>N.clear(),M=new gO0(E,A.settings.getWorkspaceRootPath()),R=vtA({configService:E}),S=VaA({configService:E,trustStore:M,skillMCPServers:R.skillMCPServers,uploadImageAttachments:K,createOAuthProvider:async(t,C0,l)=>{let i=`${t}:${C0}`,A0=N.get(i);if(A0)return _.debug("Reusing existing OAuth provider for server",{serverName:t,serverUrl:C0}),A0;_.debug("Creating OAuth provider for server",{serverName:t,serverUrl:C0});let r=(async()=>{let B0=new zu(A.secrets),Q0=await B0.getClientInfo(t,C0),V0=l?.scopes??Q0?.scopes,z0=nG4();_.info("OAuth headless mode check",{useHeadless:z0,executeMode:A.executeMode,envVar:process.env.AMP_HEADLESS_OAUTH,isTTY:v6.isTTY});let w0;if(z0)w0=A.executeMode?iG4():lG4(t);let I0=new PN0({storage:B0,serverName:t,serverUrl:C0,clientId:l?.clientId??Q0?.clientId,clientSecret:l?.clientSecret??Q0?.clientSecret,authUrl:l?.authUrl??Q0?.authUrl,tokenUrl:l?.tokenUrl??Q0?.tokenUrl,scopes:V0,headlessAuthHandler:w0});return _.debug("OAuth provider created",{serverName:t,serverUrl:C0,hasManualClientId:!!(l?.clientId??Q0?.clientId),willUseDCR:!(l?.clientId??Q0?.clientId),scopes:V0,headlessMode:z0,executeMode:A.executeMode}),I0})();return N.set(i,r),r}}),P=C_0({configService:E,spawn:a$0}),f=Q.headless?KT4():void 0,m=f??new G90({configService:E}),x=m instanceof G90?m:void 0;if(x)x.pluginExecutorKind="local";let v=new G4(null),k=null,c=K&&!C?[...uT4(I.settings)?[{name:"permissions",entryPoint:Mp0}]:[],{name:"thread-visibility",entryPoint:qT4(E,()=>X.then(jq),()=>k,(t)=>{k=t}),alwaysLoad:!0}]:[],d=eO0({configService:E,platform:m,loadGlobalPlugins:Jy0(E),pluginFilter:W,activeThread$:v,internalPlugins:c}),b=GoA(d),p=[S,P,b],n;if(D)n=new Map;else if(A.executeMode){let t=await W84({toolService:u,providers:p,initialTimeout:15000});n=t.registrations;for(let[C0,l]of t.initErrors)_.warn(`${C0} provider initialization slow or failed:`,l)}else n=W_0({toolService:u,providers:p});if(Q.jetbrains)Qu("JetBrains");else if(Q.ide&&WV4())Qu("VS Code");else if(Q.ide&&uV4())Qu("Neovim");else if(Q.ide&&A.executeMode)hk4();if(A.executeMode)JbA(!0);let s,X0=yB.status.pipe(jA((t)=>Boolean(t.connected&&t.authenticated&&t.ideName&&GhA(t.ideName))),f1()).subscribe((t)=>{if(t){if(!s)s=u.registerTool(C84)}else s?.dispose(),s=void 0}),E0;if(!A.executeMode){let t=await A.settings.get("fuzzy.alwaysIncludePaths")??[];E0=new G50(process.cwd(),{alwaysIncludePaths:t},!0)}else E0=new class extends G50{async start(){}async query(){return[]}async queryCompletions(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};let G0=new xL0(Zg(E,{usesThreadActors:!1}),{maxThreads:200});_.info("Starting Amp background services");let Z0=new _p0,N0={configService:E,toolService:u,mcpService:S,skillService:R,toolboxService:P,trustStore:M,threadService:G0,secretStorage:A.secrets,settingsStorage:A.settings,fuzzyServer:E0,terminal:Z0,pluginService:d,pluginPlatform:x,headlessPluginPlatform:f,activeThread$:v,serverStatus:V,serverStatusPromise:X,viewerUserIDPromise:z,hasAPIKeyAtStartup:G,consumeDraftNewThreadVisibility:()=>{let t=k;return k=null,t}};return{...N0,async asyncDispose(){if(N0.mcpService.hasAuthenticatingClients())_.info("Waiting for OAuth authentication to complete before exit..."),await N0.mcpService.waitForAuthentication();for(let t of n.values())t.dispose();await N0.mcpService.dispose(),w(),await N0.threadService.asyncDispose(),N0.configService.unsubscribe(),U?.unsubscribe(),H(),N0.fuzzyServer.dispose(),N0.settingsStorage[Symbol.dispose](),X0.unsubscribe(),s?.dispose(),await N0.pluginService.dispose()}}}async function tHQ(A){if(!A.executeMode){if(!await Z90("Would you like to log in to Amp? [(y)es, (n)o]: "))return v6.write(`Login cancelled. Run the command again to retry.
|
|
6727
6727
|
`),!1}return await dk4(A)}async function dk4(A){let Q=LHQ(32).toString("hex"),$=await up0(A.ampURL,Q),B=new AbortController;try{await yG($,B.signal)}catch(E){_.error("Error opening browser",{error:E})}let D=await up0(A.ampURL,Q,!1);v6.write(`If your browser does not open automatically, visit:
|
|
6728
6728
|
|
|
@@ -6730,10 +6730,10 @@ ${f0.blue.bold(D)}
|
|
|
6730
6730
|
|
|
6731
6731
|
`);try{return await tP4(A.ampURL,Q,A.secrets,B),v6.write("\nLogin successful! Run `amp` to get started.\n"),!0}catch(E){return _.error("Login failed",{error:E}),R7.write(`
|
|
6732
6732
|
Login failed: ${E instanceof Error?E.message:String(E)}
|
|
6733
|
-
`),!1}}async function eHQ(A,Q,$){let B=await Q.get("apiKey",A);if(!B)throw new MA("No Amp API key found. Run `amp login` first.",1);let D=MHQ("curl",["-H",`Authorization: Bearer ${B}`,...$],{stdio:"inherit"});process.exitCode=await new Promise((E,F)=>{D.on("error",F),D.on("close",(J)=>E(J??1))})}function ANQ(A){let Q=new fX().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private,
|
|
6733
|
+
`),!1}}async function eHQ(A,Q,$){let B=await Q.get("apiKey",A);if(!B)throw new MA("No Amp API key found. Run `amp login` first.",1);let D=MHQ("curl",["-H",`Authorization: Bearer ${B}`,...$],{stdio:"inherit"});process.exitCode=await new Promise((E,F)=>{D.on("error",F),D.on("close",(J)=>E(J??1))})}function ANQ(A){let Q=new fX().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, unlisted, workspace, group)").configureOutput({writeErr:()=>{}});Q.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)ZN(),process.exit(0);let u=W.originalError??W;uI4(u)}),IC4(Q,{version:"0.0.1780032159-g3925ab",buildTimestamp:"2026-05-29T05:27:28.532Z",buildType:"release"}),Q.addHelpText("after",zV4()),Q.configureHelp({formatHelp:KV4}),Q.command("logout").description("Log out by removing stored API key").action(async(W,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await XNQ(N)}),Q.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,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await ZNQ(N,await jp0(H,N.settings))}),KI4(Q,JQ);let B=Q.command("internal",{hidden:!0}).description("Internal commands").command("curl [args...]").description("Internal: run curl with the current Amp API key as a bearer token").allowUnknownOption(!0).allowExcessArguments(!0).action(async(...W)=>{let u=W.find((M)=>typeof M==="object"&&M!==null&&typeof M.optsWithGlobals==="function")??B,H=W.filter((M)=>M!==u).flatMap((M)=>Array.isArray(M)?M:typeof M==="string"?[M]:[]),N=u.optsWithGlobals(),w=await JQ(N);await eHQ(w.ampURL,w.secrets,H),process.exit(process.exitCode??0)});Q.command("git-credential-helper [action]",{hidden:!0}).summary("Git credential helper for GitHub").description("Internal: implements the git credential helper protocol. Used inside sandboxes to authenticate git operations with GitHub.").action(async(W,u,H)=>{let N=H.optsWithGlobals(),w=await JQ(N);await SG4(W??"get",w.ampURL,w.secrets),process.exit(process.exitCode??0)}),Q.command("sign-commit",{hidden:!0}).summary("Git commit signing helper").description("Internal: implements the gpg signing interface for git commit signing. Used inside sandboxes as gpg.program.").allowUnknownOption().action(async(W,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await kG4(N.ampURL,N.secrets),process.exit(process.exitCode??0)}),Q.command("keyboard-tester",{hidden:!0}).summary("Keyboard input tester").description("Internal: stream parsed terminal input events as JSONL.").option("--raw","Log raw incoming terminal bytes before parsing").action(async(W)=>{await qP4({raw:W.raw===!0}),process.exit(process.exitCode??0)}),Q.command("live-sync [threadIDOrURL]",{hidden:!0}).summary("Mirror live DTW thread changes into the current checkout").description("Experimental: watch a v2 thread URL or ID and mirror its live working-tree changes into your local checkout, or apply the current snapshot once and exit.").addHelpText("after",["","Examples:"," amp live-sync T-5928a90d-d53b-488f-a829-4e36442142ee"," amp live-sync --apply T-5928a90d-d53b-488f-a829-4e36442142ee"," amp live-sync https://ampcode.com/threads/T-5928a90d-d53b-488f-a829-4e36442142ee"].join(`
|
|
6734
6734
|
`)).option("--apply <threadIDOrURL>","Apply the current DTW thread snapshot once and exit").option("--checkout","Automatically check out the thread commit when it differs").option("--skip-checkout","Skip the startup checkout prompt when commits differ").action(async(W,u,H)=>{if(W&&u.apply)throw new MA("Choose either a positional thread ID/URL or --apply <thread-id>, not both.",1);let N=u.apply??W;if(!N||N.trim().length===0)v6.write(`live-sync watches a v2 thread and mirrors its live changes locally. Use --apply <thread-id> to materialize the current snapshot once and exit.
|
|
6735
6735
|
|
|
6736
|
-
`),H.outputHelp(),process.exit(0);let w=H3(N)??JD(N),M=H.optsWithGlobals(),R=await JQ(M);qB(H,M);let S=await _3(R,M),P=!1;try{if(u.checkout&&u.skipCheckout)throw new MA("Choose either --checkout or --skip-checkout, not both.",1);if($u(S.serverStatus))throw Ii0(S.serverStatus,R.ampURL);let f=$$(S.serverStatus)?S.serverStatus.features:void 0;if(!gk4(f,qE.V2))throw new MA("live-sync is not enabled for your user",1);await gP4({ampURL:R.ampURL,threadId:w,configService:S.configService,threadService:S.threadService,apiKey:process.env.AMP_API_KEY,applyOnce:typeof u.apply==="string",checkoutMode:u.checkout?"always":u.skipCheckout?"never":"prompt",promptForYesNo:Z90}),P=!0}finally{if(await S.asyncDispose(),P)process.exit(0)}});let D=async(W,u,H)=>{j00({storage:u.settings,secretStorage:u.secrets,workspaceRoot:v0.of(y0.file(process.cwd())),defaultAmpURL:u.ampURL,homeDir:FE0,userConfigDir:Zi0});let N={...u,executeMode:!1};await Xi0(N,{...W,openThreadSwitcher:!0},H)},E=Q.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").option("--include-archived","Include archived threads in the list").option("--limit <number>","Maximum number of threads to return",(W)=>EE0(W,"--limit",{min:1,max:500})).option("--offset <number>","Number of threads to skip",(W)=>EE0(W,"--offset",{min:0})).action(async(W,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await yk4(H,N,u)});E.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,
|
|
6736
|
+
`),H.outputHelp(),process.exit(0);let w=H3(N)??JD(N),M=H.optsWithGlobals(),R=await JQ(M);qB(H,M);let S=await _3(R,M),P=!1;try{if(u.checkout&&u.skipCheckout)throw new MA("Choose either --checkout or --skip-checkout, not both.",1);if($u(S.serverStatus))throw Ii0(S.serverStatus,R.ampURL);let f=$$(S.serverStatus)?S.serverStatus.features:void 0;if(!gk4(f,qE.V2))throw new MA("live-sync is not enabled for your user",1);await gP4({ampURL:R.ampURL,threadId:w,configService:S.configService,threadService:S.threadService,apiKey:process.env.AMP_API_KEY,applyOnce:typeof u.apply==="string",checkoutMode:u.checkout?"always":u.skipCheckout?"never":"prompt",promptForYesNo:Z90}),P=!0}finally{if(await S.asyncDispose(),P)process.exit(0)}});let D=async(W,u,H)=>{j00({storage:u.settings,secretStorage:u.secrets,workspaceRoot:v0.of(y0.file(process.cwd())),defaultAmpURL:u.ampURL,homeDir:FE0,userConfigDir:Zi0});let N={...u,executeMode:!1};await Xi0(N,{...W,openThreadSwitcher:!0},H)},E=Q.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").option("--include-archived","Include archived threads in the list").option("--limit <number>","Maximum number of threads to return",(W)=>EE0(W,"--limit",{min:1,max:500})).option("--offset <number>","Number of threads to skip",(W)=>EE0(W,"--offset",{min:0})).action(async(W,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await yk4(H,N,u)});E.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, unlisted, workspace, group)").action(async(W,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await ONQ(H,N,u)}),E.command("continue [threadIDOrURLs...]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, interactive mode shows a picker. Use --last to continue the last thread for the current mode directly. When multiple thread are given, all are resumed and the first is shown in the foreground.").option("--last","Continue the last thread for the current mode directly").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(W,u,H)=>{let N=H.optsWithGlobals(),w=await JQ(N),M=Array.isArray(W)?W:[];if(u.pick)R7.write(`${f0.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
|
|
6737
6737
|
`);if(u.last||M.length!==0||w.executeMode){let R;try{R=await NNQ(M,w.executeMode?"execute":"interactive")}catch(S){await A50(S,M.at(0));return}await wNQ(N,w,R,H,A)}else await D(N,w,H)});let F=new fX("fork").argument("[threadId]").alias("f").action(async()=>{R7.write(`\x1B[31mThe fork command has been deprecated.\x1B[0m
|
|
6738
6738
|
|
|
6739
6739
|
Use thread mentions to continue work from another thread.
|
|
@@ -6741,7 +6741,7 @@ See: https://ampcode.com/news/stick-a-fork-in-it
|
|
|
6741
6741
|
`),process.exit(1)});E.addCommand(F,{hidden:!0});let J=new fX("handoff").argument("[threadId]").alias("h").action(async()=>{R7.write(`\x1B[31mThe handoff command has been removed.\x1B[0m
|
|
6742
6742
|
|
|
6743
6743
|
Use a new thread and mention the previous thread to continue its work.
|
|
6744
|
-
`),process.exit(1)});E.addCommand(J,{hidden:!0}),E.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").option("--include-archived","Include archived threads in the list").option("--installation-id <installationID>","Only list threads for a specific installation ID").option("--limit <number>","Maximum number of threads to return",(W)=>EE0(W,"--limit",{min:1,max:500})).option("--offset <number>","Number of threads to skip",(W)=>EE0(W,"--offset",{min:0})).option("--json","Output as JSON").action(async(W,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await yk4(H,N,u)}),aT4(E,JQ,{initializeCLIOverrides:qB,createThreadDependencies:_3,printErrorExit:UQ}),E.command("visibility [visibility]").alias("v").summary("Show or set default visibility for this repository").description('Print the explicit repo visibility override or "inherited", or set a new default (private,
|
|
6744
|
+
`),process.exit(1)});E.addCommand(J,{hidden:!0}),E.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").option("--include-archived","Include archived threads in the list").option("--installation-id <installationID>","Only list threads for a specific installation ID").option("--limit <number>","Maximum number of threads to return",(W)=>EE0(W,"--limit",{min:1,max:500})).option("--offset <number>","Number of threads to skip",(W)=>EE0(W,"--offset",{min:0})).option("--json","Output as JSON").action(async(W,u)=>{let H=u.optsWithGlobals(),N=await JQ(H);await yk4(H,N,u)}),aT4(E,JQ,{initializeCLIOverrides:qB,createThreadDependencies:_3,printErrorExit:UQ}),E.command("visibility [visibility]").alias("v").summary("Show or set default visibility for this repository").description('Print the explicit repo visibility override or "inherited", or set a new default (private, workspace, group).').action(async(W,u,H)=>{let N=H.optsWithGlobals(),w=await JQ(N);await MNQ(N,w,H,W)}),E.command("search <query>").alias("find").summary("Search threads").description(`Search for threads using a query DSL.
|
|
6745
6745
|
|
|
6746
6746
|
Query syntax:
|
|
6747
6747
|
- Keywords: Bare words or quoted phrases for text search: auth or "race condition"
|
|
@@ -6750,13 +6750,13 @@ Use a new thread and mention the previous thread to continue its work.
|
|
|
6750
6750
|
- Ref filter: ref:name to scope to a git ref: ref:main
|
|
6751
6751
|
- Combine filters: Use implicit AND: auth file:src/foo.ts repo:amp ref:main
|
|
6752
6752
|
|
|
6753
|
-
All matching is case-insensitive. File paths use partial matching.`).option("-n, --limit <number>","Maximum number of threads to return","20").option("--offset <number>","Number of results to skip (for pagination)","0").option("--json","Output as JSON").action(async(W,u,H)=>{let N=H.optsWithGlobals(),w=await JQ(N);await jNQ(N,w,W,u.limit?parseInt(u.limit,10):20,u.offset?parseInt(u.offset,10):0,u.json??!1)}),E.command("label <threadIDOrURL> <labels...>").summary("Add labels to a thread").description("Add one or more labels to an existing thread without removing the labels it already has.").action(async(W,u,H,N)=>{let w=H3(W)??JD(W),M=N.optsWithGlobals(),R=await JQ(M);await uNQ(M,R,w,u,N)}),E.command("share <threadIDOrURL>").summary("Share a thread").description("Change thread visibility (private,
|
|
6753
|
+
All matching is case-insensitive. File paths use partial matching.`).option("-n, --limit <number>","Maximum number of threads to return","20").option("--offset <number>","Number of results to skip (for pagination)","0").option("--json","Output as JSON").action(async(W,u,H)=>{let N=H.optsWithGlobals(),w=await JQ(N);await jNQ(N,w,W,u.limit?parseInt(u.limit,10):20,u.offset?parseInt(u.offset,10):0,u.json??!1)}),E.command("label <threadIDOrURL> <labels...>").summary("Add labels to a thread").description("Add one or more labels to an existing thread without removing the labels it already has.").action(async(W,u,H,N)=>{let w=H3(W)??JD(W),M=N.optsWithGlobals(),R=await JQ(M);await uNQ(M,R,w,u,N)}),E.command("share <threadIDOrURL>").summary("Share a thread").description("Change thread visibility (private, unlisted, 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, unlisted, workspace, group)").option("--support [message]","Share thread with Amp support for debugging").action(async(W,u,H)=>{let N=H3(W)??JD(W),w=H.optsWithGlobals(),M=await JQ(w);if(u.support)await xk4(w,M,N,H);else await CNQ(w,M,N,H,u.support)}),E.command("report <threadIDOrURL>").summary("Send a report with diagnostics for a thread to Amp support").description('Send a diagnostic report (thread state, client logs, settings) for the given thread to Amp support. Equivalent to running "feedback: send report with diagnostics" from within the CLI on this thread. Prints the report ID and copies it to the clipboard.').action(async(W,u,H)=>{let N=H3(W)??JD(W),w=H.optsWithGlobals(),M=await JQ(w);await xk4(w,M,N,H)}),E.command("rename <threadIDOrURL> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(W,u,H,N)=>{let w=H3(W)??JD(W),M=N.optsWithGlobals(),R=await JQ(M);await INQ(M,R,w,u,N)}),E.command("archive <threadIDOrURL>").summary("Archive a thread").description("Archive a thread to hide it from the thread switcher and navigation. Use --unarchive to restore.").option("--unarchive","Unarchive the thread instead of archiving").action(async(W,u,H)=>{let N=H3(W)??JD(W),w=H.optsWithGlobals(),M=await JQ(w);await GNQ(w,M,N,!u.unarchive)}),E.command("delete <threadIDOrURL>").summary("Delete a thread").description("Permanently delete a thread from both the local client and the server.").action(async(W,u,H)=>{let N=H3(W)??JD(W),w=H.optsWithGlobals(),M=await JQ(w);await VNQ(w,M,N)}),E.command("markdown <threadIDOrURL>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(W,u,H)=>{let N=H3(W)??JD(W),w=H.optsWithGlobals(),M=await JQ(w);await zNQ(w,M,N,H)}),E.command("export <threadIDOrURL>").summary("Export a thread as JSON").description("Export a thread as JSON. This outputs the full thread payload.").action(async(W,u,H)=>{let N=H3(W)??JD(W),w=H.optsWithGlobals(),M=await JQ(w);await KNQ(w,M,N,H)}),Fv4(Q,async(W,u)=>{let H=await JQ(u);qB(W,u);let N=await _3(H,u);return{context:H,mcpService:N.mcpService,toolService:N.toolService,toolServices:N.toolService,skillService:N.skillService,pluginService:N.pluginService,threadService:N.threadService,getThreadEnvironment:xX,serverStatus:N.serverStatus,toolboxService:N.toolboxService,configService:N.configService,cleanupTerminal:ZN,asyncDispose:N.asyncDispose.bind(N)}}),jT4(Q,async(W)=>{let u=W.optsWithGlobals(),H=await JQ(u);qB(W,u);let N=j00({storage:H.settings,secretStorage:H.secrets,workspaceRoot:v0.of(y0.file(process.cwd())),defaultAmpURL:H.ampURL,homeDir:FE0,userConfigDir:Zi0});return{pluginService:eO0({configService:N,platform:{pluginExecutorKind:"unknown",async notify(R){_.debug("plugin notification (TUI not loaded): %s",R)},async open(R){R7.write(`
|
|
6754
6754
|
${R}
|
|
6755
6755
|
|
|
6756
6756
|
`)},async input(){return},async confirm(){return!1},async select(){return},async ask(){return{result:"uncertain",probability:0.5,reason:"AI not available"}}},loadGlobalPlugins:Jy0(N),pluginFilter:process.env.PLUGINS??"all"}),asyncDispose:async()=>{}}}),fT4(Q,async(W)=>{let u=W.optsWithGlobals(),H=await JQ(u);qB(W,u);let N=await _3(H,u),w=await N.secretStorage.get("apiKey",H.ampURL);if(!w)throw await N.asyncDispose(),new MA("API key required. Please run `amp login` first.",1);return{configService:N.configService,actorOptions:{apiKey:w,ampURL:H.ampURL,workspaceRoot:process.cwd(),dependencies:N},cleanupTerminal:ZN,asyncDispose:N.asyncDispose.bind(N)}}),pT4(Q,async(W)=>{let u=W.optsWithGlobals(),H=await JQ(u);qB(W,u);let N=await _3(H,u);return{settings:H.settings,configService:N.configService,skillService:N.skillService,asyncDispose:N.asyncDispose.bind(N)}}),IT4(Q,async(W)=>{let u=W.optsWithGlobals();return await JQ(u)}),DT4(Q,async(W)=>{let u=await JQ(W);return{settings:u.settings,secretStorage:u.secrets,getThreadDeps:async(H)=>{qB(H,W);let N=await _3(u,W);return{mcpService:N.mcpService,settings:u.settings,asyncDispose:N.asyncDispose.bind(N)}}}}),ZI4(Q,JQ),Xv4(Q,JQ);function Y(W,u,H){let w=typeof W.description==="string"?W.description:H===void 0?W.description(!0):W.description(H),M=new pF(u,w),R=nHQ(W);if(R)M.default(R);if(M.hidden=lHQ(W)||kk4(W),"choices"in W&&Array.isArray(W.choices))if("hiddenChoices"in W){let S=[...W.choices],P=Array.isArray(W.hiddenChoices)?W.hiddenChoices:[],f=new Set([...S,...P]);M.argParser((m)=>{if(!f.has(m))throw new cB0(`Allowed choices are ${S.join(", ")}.`);return m})}else M.choices([...W.choices]);return M}for(let W of Sk4){switch(W.type){case"flag":{Q.addOption(Y(W,`--${W.long}`)),Q.addOption(Y(W,`--no-${W.long}`,!1));break}case"switch":{Q.addOption(Y(W,`--${W.long}`,!0));break}case"optional-option":{Q.addOption(Y(W,`${"short"in W?`-${W.short}, `:""}--${W.long} [value]`));break}default:{Q.addOption(Y(W,`${"short"in W?`-${W.short}, `:""}--${W.long} <value>`));break}}if("aliases"in W&&Array.isArray(W.aliases))for(let u of W.aliases){let H=new pF(`--${u}`,W.description);H.hidden=!0,H.implies({[W.name]:!0}),Q.addOption(H)}}Q.hook("preAction",(W,u)=>{if(u.optsWithGlobals().takeMeBack)UQ(aHQ)});let Z=new pF("-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);Q.addOption(Z);let X=new pF("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp(!0);Q.addOption(X);let I=new pF("--stream-json","When used with --execute, output in Claude Code-compatible stream JSON format instead of plain text.").default(!1);Q.addOption(I);let G=new pF("--stream-json-thinking","Include thinking blocks in stream JSON output (non-Claude Code extension). Implies --stream-json.").default(!1);Q.addOption(G);let V=new pF("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);Q.addOption(V);let z=new pF("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);Q.addOption(z);let K=new pF("--archive","When used with --execute, archive the thread after the command finishes.").default(!1);Q.addOption(K);let C=new pF("-l, --label <label>","When used with --execute, add a label to the thread. Repeat the flag for multiple labels.").argParser((W,u)=>{if(u===void 0)return[W];return[...u,W]});return Q.addOption(C),Q.action(async(W,u)=>{let H=W,N=await JQ(H);if(Object.keys(H).forEach((w)=>{let M=Sk4.find((R)=>R.name===w);if(M&&kk4(M)&&!iHQ(M))R7.write(f0.yellow(`Warning: '--${w}' flag is deprecated
|
|
6757
6757
|
`))}),u.args.length>0)sHQ(N,u);await Xi0(N,H,u)}),iV4(Q),Q}async function ck4(A,Q){await YY(($)=>QT($,A,Q))}async function QNQ(A){if(A.streamJsonInput)return{userInput:"",stdinInput:null};if(typeof A.execute==="string"){let Q=(await Rp0()).trimEnd();return{userInput:A.execute,stdinInput:Q||null}}return{userInput:(await Rp0()).trimEnd(),stdinInput:null}}function $NQ(A,Q,$){if(A.remote&&!Q)throw new MA("The -r/--remote flag requires --execute mode",1,'Use: amp --remote --execute "your message"');if(A.streamJson&&!Q)throw new MA("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(A.streamJsonInput&&!Q)throw new MA("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(A.streamJsonInput&&!A.streamJson)throw new MA("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if(A.stats&&A.streamJson)throw new MA("The --stats and --stream-json flags are mutually exclusive output formats",1,'Use one or the other: amp --execute "your message" --stats OR amp --execute "your message" --stream-json');if(A.stats&&!Q)throw new MA("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(A.archive&&!Q)throw new MA("The --archive flag requires --execute mode",1,'Use: amp --execute "your message" --archive');if(A.streamJsonInput&&typeof A.execute==="string"&&A.execute.trim()!=="")throw new MA("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"},{"type":"image","source":{"type":"base64","media_type":"image/png","data":"..."}}]}}' | amp --execute --stream-json --stream-json-input`);if(Q&&$===""&&!A.streamJsonInput&&!A.headless)throw new MA("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"
|
|
6758
|
-
Or pipe via stdin: echo "your message" | amp --execute`)}function BNQ(){hmA([M00.parse({tool:"*",action:"allow"})]),XmA({bypass:!0})}function DNQ(A){if(A.threadId&&!p7(A.threadId))delete A.threadId}async function Xi0(A,Q,$){if(Q.headless)return ENQ(A,Q,$);let B=await _3(A,Q);if(Q.showWelcome&&Q.hideWelcome)throw await B.asyncDispose(),new MA("Cannot use --show-welcome and --hide-welcome together",1);let D=!A.executeMode&&await pHQ();return BNQ(),DNQ(Q),FNQ(A,Q,$,B,{showNpmMigrationWelcome:D})}async function ENQ(A,Q,$){let B=(C,W)=>{let u=Number(process.hrtime.bigint()-W)/1e6,H=sX4();_.info("Startup phase",{phase:C,phaseMs:Math.round(u),sinceMainMs:H===null?void 0:Math.round(H)})};qB($,Q);let D=process.hrtime.bigint(),E=await _3(A,Q);B("runMainThread:createThreadDependencies",D);let{serverStatus:F}=E;if($u(F))throw Ii0(F,A.ampURL);let J=$$(F)?F:null,U=J?.user.email;await hHQ($,Q,F);let Y=jq(F),Z=Oi(Q,Y);if(Z instanceof Error)UQ(Z.message);if(J&&Nv(Q.mode)&&!W00(Q.mode,U))throw new MA(`Agent mode '${Q.mode}' is only available for Amp employees`,1);if(process.env.AMP_EXECUTOR!=="1"&&(!U||!b7(U)))throw new MA("Headless executor mode is only available for Amp employees",1);cx0();let I=await E.secretStorage.get("apiKey",A.ampURL);if(!I)throw new MA("API key required for headless mode. Please run `amp login` first.",1);let G=typeof Q.headless==="string"&&Q.headless!=="true"?Q.headless:void 0;if(G&&!p7(G))throw new MA(`Invalid thread ID: ${G}`,1);let V=G?void 0:await qNQ({dependencies:E,apiKey:I,visibility:Z??void 0}),z=G??V?.threadId;if(!z)throw new MA("Failed to resolve headless thread ID",1);let K=await sG4(z);if(K.status==="already-running")await E.asyncDispose(),await JY(),process.exit(0);try{await hG4({ampURL:A.ampURL,apiKey:I,workspaceRoot:process.cwd(),threadId:z,ownerUserId:V?.ownerUserId,threadVersion:V?.threadVersion,agentMode:V?.agentMode,initialToolDiscovery:Promise.all([E.mcpService.initialized,E.toolboxService.initialized,E.pluginService.initialized]).then(()=>{return}),configService:E.configService,mcpService:E.mcpService,toolService:E.toolService,skillService:E.skillService,pluginService:E.pluginService,pluginPlatform:E.headlessPluginPlatform})}finally{await K.release(),await E.asyncDispose()}await JY(),process.exit(0)}async function FNQ(A,Q,$,B,D){let{userInput:E,stdinInput:F}=await QNQ(Q),J=!!Q.streamJson||!!Q.streamJsonThinking;$NQ({...Q,streamJson:J},A.executeMode,E),qB($,Q),DI4(),cx0();let U=Q.threadId,Y=Q.resumeThreadIDs??(U?[U]:[]),Z=Q.observe?H3(Q.observe)??JD(Q.observe):void 0,X=await B.serverStatusPromise;if($u(X))throw Ii0(X,A.ampURL);let I=jq(X),G=Oi(Q,I);if(G instanceof Error)UQ(G.message);if(A.executeMode&&Q.remote){if(!Nv(Q.mode))throw new MA("Remote execute mode does not support plugin-defined agent modes",1);if(!$$(X)||!b7(X.user.email))throw new MA("Remote execute mode is only available for Amp employees",1);await RT4(E,F,B.configService,Q.mode),await B.asyncDispose(),await JY(),process.exit(0)}let V=null,z=async()=>{let W=B.consumeDraftNewThreadVisibility();if(W!==null)return W;return V??=(async()=>{let u=await eB0(A.settings,process.cwd(),I,G);if(u instanceof Error)UQ(u.message);return u})(),V},K=await B.secretStorage.get("apiKey",A.ampURL);if(!K)throw new MA("API key required. Please run `amp login` first.",1);let C=$$(X)&&b7(X.user.email);if(A.executeMode){if(Y.length>1)throw new MA("Execute mode can only resume one thread.",1);UT4(B.mcpService,A.settings);try{await B.pluginService.initialized;let W=mk4(B.pluginService,Q.mode),u=fk4($,Q),H=await HN(),N=U?u:by0({agentMode:W.agentMode,explicitEffort:u,sessionState:H}),w=U?void 0:M50(await tP(B.configService),{agentMode:W.agentMode,explicitEffort:u,sessionState:H}),M=U?void 0:await z(),{threadID:R}=await I50({apiKey:K,ampURL:A.ampURL,workspaceRoot:process.cwd(),dependencies:B,userInput:E,stdinInput:F,stats:!!Q.stats,streamJson:J,streamJsonThinking:!!Q.streamJsonThinking,streamJsonInput:!!Q.streamJsonInput,stdin:process.stdin,agentMode:W.agentMode,reasoningEffort:W.agent?void 0:N,agent:W.agent,labels:Q.label,initialThreadID:U,initialThreadMeta:M,initialSettings:w});if(await ck4(R,"execute"),Q.archive)await B.threadService.archive(R,!0)}finally{await B.asyncDispose()}await JY(),process.exit(0)}else{let W=fk4($,Q),u=await rHQ($,B.pluginService,Q.mode),H=D.showNpmMigrationWelcome?"npm-migration":"intro",N=Sy0("0.0.
|
|
6759
|
-
`);let Q=!!A.execute||!process.stdout.isTTY&&!A.streamJson,$=process.stdout.isTTY&&process.stderr.isTTY;_.info("Execution mode resolved",{executeMode:Q,stdoutTTY:process.stdout.isTTY,stderrTTY:process.stderr.isTTY,streamJson:A.streamJson,executeFlag:A.execute});let B=await uaA({get:async(J)=>{if(J!==Wh)return;try{let U=await bk4(Yi0,"utf-8");return JSON.parse(U).installationID}catch{return}},set:async(J,U)=>{if(J!==Wh)return;await jHQ(ri.dirname(Yi0),{recursive:!0}),await RHQ(Yi0,JSON.stringify({installationID:U},null,2),{mode:384})}},{clientType:"cli",platform:m40()});UbA(B);let D=await dT4({...A,workspaceTrust:{current:!0,changes:Iy},getHook:process.env.AMP_URL?(J,U)=>{if(J==="url")return Promise.resolve(process.env.AMP_URL);return U()}:void 0});if(A.mcpConfig){let J=await FT4(A.mcpConfig);D=JT4(D,J)}let E=ri.dirname(D.getSettingsFilePath());f24(ey,E),D=IkA(D);let F=await D.get("url","admin")??await D.get("url","global");if(!F)F=iD;if(_.info("Resolved Amp URL",{ampURL:F,settingsFile:D.getSettingsFilePath(),workspaceRoot:D.getWorkspaceRootPath()}),!JL(F))_.info("Targeting custom Amp server",{ampURL:F});return{executeMode:Q,isTTY:$,ampURL:F,settings:D,secrets:xT4(await jp0(A,D))}}function JNQ(A){let Q={};for(let $=0;$<A.length;$++){let B=A[$];if(B?.startsWith("--")){let E=B.slice(2).replace(/-([a-z])/g,(J,U)=>U.toUpperCase()),F=A[$+1];if(F&&!F.startsWith("--"))Q[E]=F,$++}}return Q}function UNQ(A,Q){let $=A.includes("--headless")||A.some((D)=>D.startsWith("--headless=")),B=ri.resolve(Q.logFile??process.env.AMP_LOG_FILE??($?THQ:rc));return{logLevel:Q.logLevel??process.env.AMP_LOG_LEVEL??"info",logFile:B}}async function YNQ(){rX4();let A=JNQ(process.argv),Q=UNQ(process.argv,A),$=EI4(Q);AB0("silent");let B=process.argv.includes("--no-color"),D=process.argv.includes("--color"),E=process.stdout.isTTY&&process.stderr.isTTY;if(B||!D&&!E)f0.level=0;if(_HQ(_),_.info("Starting Amp CLI.",{version:"0.0.
|
|
6758
|
+
Or pipe via stdin: echo "your message" | amp --execute`)}function BNQ(){hmA([M00.parse({tool:"*",action:"allow"})]),XmA({bypass:!0})}function DNQ(A){if(A.threadId&&!p7(A.threadId))delete A.threadId}async function Xi0(A,Q,$){if(Q.headless)return ENQ(A,Q,$);let B=await _3(A,Q);if(Q.showWelcome&&Q.hideWelcome)throw await B.asyncDispose(),new MA("Cannot use --show-welcome and --hide-welcome together",1);let D=!A.executeMode&&await pHQ();return BNQ(),DNQ(Q),FNQ(A,Q,$,B,{showNpmMigrationWelcome:D})}async function ENQ(A,Q,$){let B=(C,W)=>{let u=Number(process.hrtime.bigint()-W)/1e6,H=sX4();_.info("Startup phase",{phase:C,phaseMs:Math.round(u),sinceMainMs:H===null?void 0:Math.round(H)})};qB($,Q);let D=process.hrtime.bigint(),E=await _3(A,Q);B("runMainThread:createThreadDependencies",D);let{serverStatus:F}=E;if($u(F))throw Ii0(F,A.ampURL);let J=$$(F)?F:null,U=J?.user.email;await hHQ($,Q,F);let Y=jq(F),Z=Oi(Q,Y);if(Z instanceof Error)UQ(Z.message);if(J&&Nv(Q.mode)&&!W00(Q.mode,U))throw new MA(`Agent mode '${Q.mode}' is only available for Amp employees`,1);if(process.env.AMP_EXECUTOR!=="1"&&(!U||!b7(U)))throw new MA("Headless executor mode is only available for Amp employees",1);cx0();let I=await E.secretStorage.get("apiKey",A.ampURL);if(!I)throw new MA("API key required for headless mode. Please run `amp login` first.",1);let G=typeof Q.headless==="string"&&Q.headless!=="true"?Q.headless:void 0;if(G&&!p7(G))throw new MA(`Invalid thread ID: ${G}`,1);let V=G?void 0:await qNQ({dependencies:E,apiKey:I,visibility:Z??void 0}),z=G??V?.threadId;if(!z)throw new MA("Failed to resolve headless thread ID",1);let K=await sG4(z);if(K.status==="already-running")await E.asyncDispose(),await JY(),process.exit(0);try{await hG4({ampURL:A.ampURL,apiKey:I,workspaceRoot:process.cwd(),threadId:z,ownerUserId:V?.ownerUserId,threadVersion:V?.threadVersion,agentMode:V?.agentMode,initialToolDiscovery:Promise.all([E.mcpService.initialized,E.toolboxService.initialized,E.pluginService.initialized]).then(()=>{return}),configService:E.configService,mcpService:E.mcpService,toolService:E.toolService,skillService:E.skillService,pluginService:E.pluginService,pluginPlatform:E.headlessPluginPlatform})}finally{await K.release(),await E.asyncDispose()}await JY(),process.exit(0)}async function FNQ(A,Q,$,B,D){let{userInput:E,stdinInput:F}=await QNQ(Q),J=!!Q.streamJson||!!Q.streamJsonThinking;$NQ({...Q,streamJson:J},A.executeMode,E),qB($,Q),DI4(),cx0();let U=Q.threadId,Y=Q.resumeThreadIDs??(U?[U]:[]),Z=Q.observe?H3(Q.observe)??JD(Q.observe):void 0,X=await B.serverStatusPromise;if($u(X))throw Ii0(X,A.ampURL);let I=jq(X),G=Oi(Q,I);if(G instanceof Error)UQ(G.message);if(A.executeMode&&Q.remote){if(!Nv(Q.mode))throw new MA("Remote execute mode does not support plugin-defined agent modes",1);if(!$$(X)||!b7(X.user.email))throw new MA("Remote execute mode is only available for Amp employees",1);await RT4(E,F,B.configService,Q.mode),await B.asyncDispose(),await JY(),process.exit(0)}let V=null,z=async()=>{let W=B.consumeDraftNewThreadVisibility();if(W!==null)return W;return V??=(async()=>{let u=await eB0(A.settings,process.cwd(),I,G);if(u instanceof Error)UQ(u.message);return u})(),V},K=await B.secretStorage.get("apiKey",A.ampURL);if(!K)throw new MA("API key required. Please run `amp login` first.",1);let C=$$(X)&&b7(X.user.email);if(A.executeMode){if(Y.length>1)throw new MA("Execute mode can only resume one thread.",1);UT4(B.mcpService,A.settings);try{await B.pluginService.initialized;let W=mk4(B.pluginService,Q.mode),u=fk4($,Q),H=await HN(),N=U?u:by0({agentMode:W.agentMode,explicitEffort:u,sessionState:H}),w=U?void 0:M50(await tP(B.configService),{agentMode:W.agentMode,explicitEffort:u,sessionState:H}),M=U?void 0:await z(),{threadID:R}=await I50({apiKey:K,ampURL:A.ampURL,workspaceRoot:process.cwd(),dependencies:B,userInput:E,stdinInput:F,stats:!!Q.stats,streamJson:J,streamJsonThinking:!!Q.streamJsonThinking,streamJsonInput:!!Q.streamJsonInput,stdin:process.stdin,agentMode:W.agentMode,reasoningEffort:W.agent?void 0:N,agent:W.agent,labels:Q.label,initialThreadID:U,initialThreadMeta:M,initialSettings:w});if(await ck4(R,"execute"),Q.archive)await B.threadService.archive(R,!0)}finally{await B.asyncDispose()}await JY(),process.exit(0)}else{let W=fk4($,Q),u=await rHQ($,B.pluginService,Q.mode),H=D.showNpmMigrationWelcome?"npm-migration":"intro",N=Sy0("0.0.1780032159-g3925ab",B.settingsStorage,{startDelayMs:3000}),w=new Hp0(B.mcpService,A.settings.getWorkspaceRootPath()),M=Zg(B.configService),R=new xp0(B.fuzzyServer),S=process.cwd();await KP4({ampURL:A.ampURL,apiKey:K,rivetEndpoint:process.env.RIVET_PUBLIC_ENDPOINT??K8(A.ampURL),configService:B.configService,toolService:B.toolService,pluginPlatform:B.pluginPlatform,pluginService:B.pluginService,skillService:B.skillService,mcpService:B.mcpService,readFileSystemDirectory:({uri:P})=>nP({workspaceRoot:S},P),completionBuilder:R,updateService:N,workspaceRoot:S,listThreads:()=>M.listThreads(),getThreadFromServer:(P)=>M.getThread(P),getThreadTail:async(P,f)=>{let m=await k4.getThreadTail({thread:P,limit:f},{config:B.configService});if(!m.ok){if(m.error.code==="thread-not-found")return null;throw Error(m.error.message??m.error.code)}return{...m.result.thread.data,messages:m.result.messages}},toolboxes:B.toolboxService.toolboxes,isInternalUser:C,settingsFilePath:B.settingsStorage.getSettingsFilePath(),workspaceSettingsFilePath:B.settingsStorage.getWorkspaceSettingsPath(),mcpTrustHandler:w,setActiveThreadID:(P)=>B.activeThread$.next(P),dispose:()=>{return w.dispose(),N.dispose(),B.asyncDispose()}},{initialThreadIDs:Z?[Z]:Y,initialUserInput:E||void 0,getDefaultNewThreadVisibility:z,onFirstFrame:Q.ide?hk4:void 0,openThreadPickerOnStart:Q.openThreadSwitcher,observerOnly:!!Z,hideWelcome:!!Q.hideWelcome,showWelcome:Q.showWelcome,welcomeVariant:H,initialAgentMode:u?.agentMode,initialPluginAgentModeKey:u?.pluginAgentModeKey,initialReasoningEffort:W}),process.exit(0)}}async function JQ(A){if(_.info("Initializing CLI context",{argv:process.argv,nodeEnv:"production",hasAmpURL:Boolean(process.env.AMP_URL),hasAmpAPIKey:Boolean(process.env.AMP_API_KEY),hasSettingsFile:Boolean(process.env.AMP_SETTINGS_FILE)}),A.interactive)R7.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
6759
|
+
`);let Q=!!A.execute||!process.stdout.isTTY&&!A.streamJson,$=process.stdout.isTTY&&process.stderr.isTTY;_.info("Execution mode resolved",{executeMode:Q,stdoutTTY:process.stdout.isTTY,stderrTTY:process.stderr.isTTY,streamJson:A.streamJson,executeFlag:A.execute});let B=await uaA({get:async(J)=>{if(J!==Wh)return;try{let U=await bk4(Yi0,"utf-8");return JSON.parse(U).installationID}catch{return}},set:async(J,U)=>{if(J!==Wh)return;await jHQ(ri.dirname(Yi0),{recursive:!0}),await RHQ(Yi0,JSON.stringify({installationID:U},null,2),{mode:384})}},{clientType:"cli",platform:m40()});UbA(B);let D=await dT4({...A,workspaceTrust:{current:!0,changes:Iy},getHook:process.env.AMP_URL?(J,U)=>{if(J==="url")return Promise.resolve(process.env.AMP_URL);return U()}:void 0});if(A.mcpConfig){let J=await FT4(A.mcpConfig);D=JT4(D,J)}let E=ri.dirname(D.getSettingsFilePath());f24(ey,E),D=IkA(D);let F=await D.get("url","admin")??await D.get("url","global");if(!F)F=iD;if(_.info("Resolved Amp URL",{ampURL:F,settingsFile:D.getSettingsFilePath(),workspaceRoot:D.getWorkspaceRootPath()}),!JL(F))_.info("Targeting custom Amp server",{ampURL:F});return{executeMode:Q,isTTY:$,ampURL:F,settings:D,secrets:xT4(await jp0(A,D))}}function JNQ(A){let Q={};for(let $=0;$<A.length;$++){let B=A[$];if(B?.startsWith("--")){let E=B.slice(2).replace(/-([a-z])/g,(J,U)=>U.toUpperCase()),F=A[$+1];if(F&&!F.startsWith("--"))Q[E]=F,$++}}return Q}function UNQ(A,Q){let $=A.includes("--headless")||A.some((D)=>D.startsWith("--headless=")),B=ri.resolve(Q.logFile??process.env.AMP_LOG_FILE??($?THQ:rc));return{logLevel:Q.logLevel??process.env.AMP_LOG_LEVEL??"info",logFile:B}}async function YNQ(){rX4();let A=JNQ(process.argv),Q=UNQ(process.argv,A),$=EI4(Q);AB0("silent");let B=process.argv.includes("--no-color"),D=process.argv.includes("--color"),E=process.stdout.isTTY&&process.stderr.isTTY;if(B||!D&&!E)f0.level=0;if(_HQ(_),_.info("Starting Amp CLI.",{version:"0.0.1780032159-g3925ab",buildTimestamp:"2026-05-29T05:27:28.532Z"}),process.platform==="win32"&&WN())mV4();if(parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new MA(CB.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await ANQ($).parseAsync(process.argv)}S24().startActiveSpan("main",async(A)=>{process.on("exit",()=>A.end()),await YNQ().catch(A50)});async function ZNQ(A,Q){let $=A.ampURL.includes("localhost")||A.ampURL.includes("127.0.0.1");if(process.env.AMP_URL&&!$)await A.settings.set("url",process.env.AMP_URL,"global"),v6.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
6760
6760
|
`);else if(!JL(A.ampURL))v6.write(`Logging in to ${new URL(A.ampURL).hostname}
|
|
6761
6761
|
`);let B=process.env.AMP_API_KEY;if(B)v6.write(`API key found in environment variable, storing...
|
|
6762
6762
|
`),await Q.set("apiKey",B,A.ampURL),v6.write(`API key successfully stored.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sourcegraph/amp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1780032159-g3925ab",
|
|
4
4
|
"description": "Renamed to @ampcode/cli - see https://ampcode.com/news/npm-package-changes",
|
|
5
5
|
"homepage": "https://ampcode.com/",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"amp": "node_modules/@ampcode/cli/bin/amp.exe"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@ampcode/cli": "0.0.
|
|
11
|
+
"@ampcode/cli": "0.0.1780032159-g3925ab"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist/main.js",
|