@sourcegraph/amp 0.0.1760169682-g2c1445 → 0.0.1760198483-g276de5
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 +7 -7
- package/package.json +1 -1
package/dist/main.js
CHANGED
@@ -5870,7 +5870,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||_w}function LZ6(J,Q){let
|
|
5870
5870
|
`);J.command("use").argument("<tool-name>","The tool to invoke").summary("Invoke a tool with arguments or JSON input from stdin").description(Z).option("--only <field>","Extract only the specified field from the result").allowUnknownOption(!0).allowExcessArguments(!0).action(async function(X,Y,K){let q=K.optsWithGlobals(),G=await Q(K,q),z=0;await G.mcpService.initialized;let U=K.args.slice(1),W;if(VZ6()){let F=[];for await(let H of process.stdin)F.push(H);W=Buffer.concat(F).toString("utf-8").trim()}await DZ6({toolName:X,rawArgs:U,stdinInput:W,only:Y.only,threadDeps:G,stdout:process.stdout,stderr:process.stderr,exit:(F)=>{z=F}}),await G.asyncDispose(),G.cleanupTerminal(),process.exit(z)})}import{homedir as mW9}from"node:os";import Sp from"node:path";var AZ6=[{id:"e5f6ce3f-3eb0-4841-be9f-95d53fe773cc",advertiser_id:"baseten",advertiser_name:"Baseten",title:"Baseten model routing",text:"Baseten gives you one client for all providers.",button_text:"Get Started",destination_url:"https://www.baseten.co/",call_to_action:"link_to",ad_tool_tip:"Suggested because you're switching SDKs to call models.",keywords:["model","switching","routing","inference"],status:"active",demo_user_message:"We're switching models from gpt-4o to Claude 3.5 (and maybe Gemini). What's a clean way to do model routing and fallback across providers in our Node inference service without rewriting everything?",demo_assistant_message:"Create a provider-agnostic interface and a routing layer that selects the model based on cost, latency, or quality. Implement retries and fallback so if one provider errors or is slow, you can route inference to another model. Start with a simple rules-based router, log per-request metrics, and then evolve to latency-aware or A/B routing.",created_at:new Date("2024-01-15").toISOString(),updated_at:new Date("2024-01-15").toISOString()},{id:"46cf2889-eb7a-427f-8403-6dd9bb8f29a1",advertiser_id:"baseten",advertiser_name:"Baseten",title:"No cold starts with Baseten",text:"Keep models warm and call times down with Baseten",button_text:"Learn More",destination_url:"https://www.baseten.co/",call_to_action:"link_to",ad_tool_tip:"Suggested because you want to optimize model inference times.",keywords:["cold starts","models","fast"],status:"active",demo_user_message:"Our model endpoints have cold starts-the first request takes 8-12s but later ones are fast. How can we keep models warm and reduce time-to-first-token in production?",demo_assistant_message:"Keep a warm pool or set min replicas to avoid cold starts, preload weights at startup, and send periodic keep-alives so the models stay warm. Pin model weights in GPU memory, enable token streaming to improve perceived latency, and watch p50/p95 to ensure consistently fast responses under load.",created_at:new Date("2024-02-01").toISOString(),updated_at:new Date("2024-02-01").toISOString()},{id:"9009f4bf-8584-418a-ac87-43052d14e996",advertiser_id:"parallel",advertiser_name:"Parallel",title:"Web API built for AI agents",text:"Get accurate, verifiable web data with predictable costs.",button_text:"Get Started",destination_url:"https://parallel.ai/",call_to_action:"custom",custom_actions:[{text:"Start Free Trial",description:"Opens Parallel signup page"}],ad_tool_tip:"Suggested because you're building AI agents that need web data.",keywords:["web search","ai agents","web scraping","research"],status:"active",demo_user_message:"We're building an AI agent that needs to research companies and products on the web, but we keep getting hallucinated data or unpredictable API costs. How can we get reliable web data for our agent?",demo_assistant_message:"Use a purpose-built web API for AI agents that provides cross-referenced facts with provenance. Look for services that charge per query instead of per token for predictable costs, and ensure outputs are evidence-based so you can verify sources. This reduces hallucination and gives you an audit trail for the information your agent uses.",created_at:new Date("2024-03-01").toISOString(),updated_at:new Date("2024-03-01").toISOString()},{id:"9e91d62d-8f11-4634-8ffc-8af2a1cc78e2",advertiser_id:"parallel",advertiser_name:"Parallel",title:"Predictable costs for AI web search",text:"Pay per query, not per token. Budget compute by task complexity.",button_text:"Learn More",destination_url:"https://parallel.ai/",call_to_action:"link_to",ad_tool_tip:"Suggested because you need cost-effective web research for AI.",keywords:["cost","pricing","web search","budget","research"],status:"active",demo_user_message:"Our AI agent's web research costs are all over the place-some queries cost pennies, others cost dollars because of token usage. How can we make web API costs more predictable for budgeting?",demo_assistant_message:"Switch to a web API that charges per query instead of per token. This lets you flex compute budget based on task complexity and gives you predictable pricing regardless of how much text gets processed. Monitor cost per query type and set limits so you can forecast spend accurately.",created_at:new Date("2024-03-15").toISOString(),updated_at:new Date("2024-03-15").toISOString()},{id:"1755b522-ee2e-49c0-8337-de53211dc543",advertiser_id:"parallel",advertiser_name:"Parallel",title:"test ad for parallel",text:"Pay per query, not per token. Budget compute by task complexity.",button_text:"Learn More",destination_url:"https://parallel.ai/",call_to_action:"custom",custom_actions:[{text:"go do something crazy"},{text:"try another action",description:"This is a second custom action"}],ad_tool_tip:"Suggested because you need cost-effective web research for AI.",keywords:["cost","pricing","web search","budget","research"],status:"active",demo_user_message:"Our AI agent's web research costs are all over the place-some queries cost pennies, others cost dollars because of token usage. How can we make web API costs more predictable for budgeting?",demo_assistant_message:"Switch to a web API that charges per query instead of per token. This lets you flex compute budget based on task complexity and gives you predictable pricing regardless of how much text gets processed. Monitor cost per query type and set limits so you can forecast spend accurately.",created_at:new Date("2024-03-15").toISOString(),updated_at:new Date("2024-03-15").toISOString()}];W0();yE();jj();a2();Z3();P2();YL();p6();S0();function RZ6(J){let Q=J.trim();if(Q==="quit"||Q==="exit")return"/quit";return J}W0();Z3();import t79 from"node:fs";import wZ6 from"node:path";function OZ6(J){let Q=J.trim().replace(/^["']|["']$/g,"");if(Q=Q.replace(/\\(.)/g,"$1"),!/\.(png|jpe?g|gif|webp)$/i.test(Q))return null;if(!wZ6.isAbsolute(Q))return null;return l.debug("Extracted image path",{original:J,extracted:Q}),Q}function jZ6(J){try{let Q=wZ6.extname(J).toLowerCase(),Z=Qe1(Q);if(!Z)return l.warn("Unsupported image file extension",{ext:Q}),null;try{let X=t79.readFileSync(J);return e79(X,Z)}catch(X){l.error(`Failed to read image file ${J}:`,X)}}catch(Q){l.error("Error handling image file path",{imagePath:J,error:Q})}return null}function e79(J,Q){if(J.length>nO)return l.warn(`Image file too large: ${J.length} bytes (max: ${nO})`),null;return{type:"image",source:{type:"base64",data:J.toString("base64"),mediaType:Q}}}import{execSync as nY6}from"node:child_process";import{rmdir as dX9}from"node:fs/promises";import{tmpdir as cX9}from"node:os";import aY6 from"node:path";lO();W0();import{spawn as J59}from"node:child_process";import{promises as Q59}from"node:fs";function $Z6(J){return J.kind==="executable"}function EZ6(J){return J.kind==="markdown"}var yH=50000,IZ6=300000;async function Hy1(J,Q,Z,X={}){let{timeoutMs:Y=IZ6,signal:K}=X;try{let q=await Z.getCommand(J);if(!q)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Z.isCommandAvailable(J))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(l.debug("Executing command",{commandName:J,filePath:q.filePath,args:Q}),EZ6(q))return await Z59(q,Q);else if($Z6(q))return await X59(q,Q,Y,K);else return{success:!1,output:"",error:"Unsupported command type"}}catch(q){return l.error("Failed to execute command",{commandName:J,error:q}),{success:!1,output:"",error:q instanceof Error?q.message:"Unknown error occurred"}}}async function Z59(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await Q59.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>yH?Z.slice(0,yH)+`
|
5871
5871
|
... (output truncated at ${yH} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function X59(J,Q,Z=IZ6,X){return new Promise((Y)=>{let[K,q]=Y59(J,Q);l.debug("Spawning command",{spawnCommand:K,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Z});let G=ot1(X),z=!1,U=setTimeout(()=>{z=!0,G.abort(),l.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),W=J59(K,q,{stdio:["pipe","pipe","pipe"],signal:G.signal,detached:!0}),F=[],H=[],B=0;W.stdout?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=yH)F.push(V);else{let N=yH-(B-V.length);if(N>0)F.push(V.slice(0,N))}}),W.stderr?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=yH)H.push(V);else{let N=yH-(B-V.length);if(N>0)H.push(V.slice(0,N))}}),W.on("close",(M)=>{if(clearTimeout(U),z){Y({success:!1,output:F.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(G.signal.aborted){Y({success:!1,output:F.join(""),error:"The command was aborted",exitCode:M??void 0});return}let V=M===0||M===1,N=F.join(""),L=H.join(""),A=N;if(!V&&!N.trim()&&L.trim())A=L;else if(L.trim())A+=N?`
|
5872
5872
|
${L}`:L;if(B>yH)A+=`
|
5873
|
-
... (output truncated at ${yH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:F.join(""),error:V})})})}function Y59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return q59(Z,X?[...X]:null,Y,Q);else return K59(Z,X?[...X]:null,Y,Q)}function K59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function q59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}W0();yE();jj();a2();TN();qq();kW();p6();S0();import{mkdtemp as lX9,readFile as iX9,unlink as nX9,writeFile as KR2}from"fs/promises";var a71={};A6(a71,{scrollUp:()=>I59,scrollDown:()=>P59,link:()=>_59,image:()=>x59,iTerm:()=>b59,exitAlternativeScreen:()=>v59,eraseUp:()=>E59,eraseStartLine:()=>j59,eraseScreen:()=>By1,eraseLines:()=>w59,eraseLine:()=>SZ6,eraseEndLine:()=>O59,eraseDown:()=>$59,enterAlternativeScreen:()=>S59,cursorUp:()=>TZ6,cursorTo:()=>U59,cursorShow:()=>R59,cursorSavePosition:()=>D59,cursorRestorePosition:()=>M59,cursorPrevLine:()=>L59,cursorNextLine:()=>N59,cursorMove:()=>W59,cursorLeft:()=>CZ6,cursorHide:()=>A59,cursorGetPosition:()=>V59,cursorForward:()=>H59,cursorDown:()=>F59,cursorBackward:()=>B59,clearTerminal:()=>C59,clearScreen:()=>T59,beep:()=>k59});import Dy1 from"node:process";var n71=globalThis.window?.document!==void 0,UL2=globalThis.process?.versions?.node!==void 0,WL2=globalThis.process?.versions?.bun!==void 0,FL2=globalThis.Deno?.version?.deno!==void 0,HL2=globalThis.process?.versions?.electron!==void 0,BL2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,DL2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,ML2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,VL2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,NL2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Iu=globalThis.navigator?.userAgentData?.platform,LL2=Iu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",AL2=Iu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",RL2=Iu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",wL2=Iu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),OL2=Iu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var U2="\x1B[",Tu="\x1B]",zC="\x07",Pu=";",PZ6=!n71&&Dy1.env.TERM_PROGRAM==="Apple_Terminal",G59=!n71&&Dy1.platform==="win32",z59=n71?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Dy1.cwd,U59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return U2+(J+1)+"G";return U2+(Q+1)+Pu+(J+1)+"H"},W59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=U2+-J+"D";else if(J>0)Z+=U2+J+"C";if(Q<0)Z+=U2+-Q+"A";else if(Q>0)Z+=U2+Q+"B";return Z},TZ6=(J=1)=>U2+J+"A",F59=(J=1)=>U2+J+"B",H59=(J=1)=>U2+J+"C",B59=(J=1)=>U2+J+"D",CZ6=U2+"G",D59=PZ6?"\x1B7":U2+"s",M59=PZ6?"\x1B8":U2+"u",V59=U2+"6n",N59=U2+"E",L59=U2+"F",A59=U2+"?25l",R59=U2+"?25h",w59=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=SZ6+(Z<J-1?TZ6():"");if(J)Q+=CZ6;return Q},O59=U2+"K",j59=U2+"1K",SZ6=U2+"2K",$59=U2+"J",E59=U2+"1J",By1=U2+"2J",I59=U2+"S",P59=U2+"T",T59="\x1Bc",C59=G59?`${By1}${U2}0f`:`${By1}${U2}3J${U2}H`,S59=U2+"?1049h",v59=U2+"?1049l",k59=zC,_59=(J,Q)=>[Tu,"8",Pu,Pu,Q,zC,J,Tu,"8",Pu,Pu,zC].join(""),x59=(J,Q={})=>{let Z=`${Tu}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+zC},b59={setCwd:(J=z59())=>`${Tu}50;CurrentDir=${J}${zC}`,annotation(J,Q={}){let Z=`${Tu}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+zC}};var r71=P6(fZ6(),1);function hV(J,Q,{target:Z="stdout",...X}={}){if(!r71.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return a71.link(J,Q)}hV.isSupported=r71.default.stdout;hV.stderr=(J,Q,Z={})=>hV(J,Q,{target:"stderr",...Z});hV.stderr.isSupported=r71.default.stderr;W0();qq();class Ay1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.
|
5873
|
+
... (output truncated at ${yH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),W.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:F.join(""),error:V})})})}function Y59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return q59(Z,X?[...X]:null,Y,Q);else return K59(Z,X?[...X]:null,Y,Q)}function K59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function q59(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}W0();yE();jj();a2();TN();qq();kW();p6();S0();import{mkdtemp as lX9,readFile as iX9,unlink as nX9,writeFile as KR2}from"fs/promises";var a71={};A6(a71,{scrollUp:()=>I59,scrollDown:()=>P59,link:()=>_59,image:()=>x59,iTerm:()=>b59,exitAlternativeScreen:()=>v59,eraseUp:()=>E59,eraseStartLine:()=>j59,eraseScreen:()=>By1,eraseLines:()=>w59,eraseLine:()=>SZ6,eraseEndLine:()=>O59,eraseDown:()=>$59,enterAlternativeScreen:()=>S59,cursorUp:()=>TZ6,cursorTo:()=>U59,cursorShow:()=>R59,cursorSavePosition:()=>D59,cursorRestorePosition:()=>M59,cursorPrevLine:()=>L59,cursorNextLine:()=>N59,cursorMove:()=>W59,cursorLeft:()=>CZ6,cursorHide:()=>A59,cursorGetPosition:()=>V59,cursorForward:()=>H59,cursorDown:()=>F59,cursorBackward:()=>B59,clearTerminal:()=>C59,clearScreen:()=>T59,beep:()=>k59});import Dy1 from"node:process";var n71=globalThis.window?.document!==void 0,UL2=globalThis.process?.versions?.node!==void 0,WL2=globalThis.process?.versions?.bun!==void 0,FL2=globalThis.Deno?.version?.deno!==void 0,HL2=globalThis.process?.versions?.electron!==void 0,BL2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,DL2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,ML2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,VL2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,NL2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Iu=globalThis.navigator?.userAgentData?.platform,LL2=Iu==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",AL2=Iu==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",RL2=Iu==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",wL2=Iu==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),OL2=Iu==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var U2="\x1B[",Tu="\x1B]",zC="\x07",Pu=";",PZ6=!n71&&Dy1.env.TERM_PROGRAM==="Apple_Terminal",G59=!n71&&Dy1.platform==="win32",z59=n71?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Dy1.cwd,U59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return U2+(J+1)+"G";return U2+(Q+1)+Pu+(J+1)+"H"},W59=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=U2+-J+"D";else if(J>0)Z+=U2+J+"C";if(Q<0)Z+=U2+-Q+"A";else if(Q>0)Z+=U2+Q+"B";return Z},TZ6=(J=1)=>U2+J+"A",F59=(J=1)=>U2+J+"B",H59=(J=1)=>U2+J+"C",B59=(J=1)=>U2+J+"D",CZ6=U2+"G",D59=PZ6?"\x1B7":U2+"s",M59=PZ6?"\x1B8":U2+"u",V59=U2+"6n",N59=U2+"E",L59=U2+"F",A59=U2+"?25l",R59=U2+"?25h",w59=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=SZ6+(Z<J-1?TZ6():"");if(J)Q+=CZ6;return Q},O59=U2+"K",j59=U2+"1K",SZ6=U2+"2K",$59=U2+"J",E59=U2+"1J",By1=U2+"2J",I59=U2+"S",P59=U2+"T",T59="\x1Bc",C59=G59?`${By1}${U2}0f`:`${By1}${U2}3J${U2}H`,S59=U2+"?1049h",v59=U2+"?1049l",k59=zC,_59=(J,Q)=>[Tu,"8",Pu,Pu,Q,zC,J,Tu,"8",Pu,Pu,zC].join(""),x59=(J,Q={})=>{let Z=`${Tu}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+zC},b59={setCwd:(J=z59())=>`${Tu}50;CurrentDir=${J}${zC}`,annotation(J,Q={}){let Z=`${Tu}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+zC}};var r71=P6(fZ6(),1);function hV(J,Q,{target:Z="stdout",...X}={}){if(!r71.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return a71.link(J,Q)}hV.isSupported=r71.default.stdout;hV.stderr=(J,Q,Z={})=>hV(J,Q,{target:"stderr",...Z});hV.stderr.isSupported=r71.default.stderr;W0();qq();class Ay1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Z])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1760198483-g276de5"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await $80(Q,this.configService)}catch(Q){l.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}W0();class s71 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class zQ{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function hZ6(J){if(J instanceof s71)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof zQ)return{title:"Info",description:J.message,type:"info"};return l.warn("Unknown error type encountered",{name:J.name,message:J.message,stack:J.stack}),{title:"Error",description:J.message||"An unexpected error occurred.",type:"error"}}var lV=null,aX9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(lV)return Error("Already connected. Use /disconnect first to reconnect.");let{connectedClientsService:Z}=J;await Z.start({clientId:J.clientId,currentThreadID:J.worker.thread.id});let Y=Z.getCurrentStatus().clientID||"unknown",{connectBackground:K}=await Promise.resolve().then(() => (kb1(),LJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{lV=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});lV=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{lV=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,W=new URL(`/clients/${Y}/${U}`,z).toString(),F=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => P6(Bf1(),1))).toString(W,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){l.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:F,qrCode:H});else return new zQ(`Continue at ${F}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!lV)return new zQ("Not connected to Amp web interface");try{lV.disconnect();let Z=lV.clientID;return lV=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new zQ(`Disconnected from Amp web interface
|
5874
5874
|
Client ID: ${Z}
|
5875
5875
|
Server will clean up automatically within 60 seconds`)}catch(Z){return Error(`Failed to disconnect: ${Z.message}`)}}}};class Df1{configService;commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=iC(),Q){this.configService=Q;this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Z)=>this.latestCustom=Z),this.telemetrySubmitter=new Ay1(async()=>{try{return(await this.configService.getLatest()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}},this.configService),this.configService.config.pipe(I0((Z)=>Z.settings["internal.modes"]),U8()).subscribe((Z)=>{this._initBaseCommands(Z??!1)})}_initBaseCommands(J){if(this.commands={...rX9},process.env.AMP_CONNECT==="1")Object.assign(this.commands,aX9);if(J)Object.assign(this.commands,sX9)}async execute(J,Q,Z=[],X){this.telemetrySubmitter.submit(J).catch((G)=>{l.debug("Failed to submit command telemetry",G)});let Y=this.commands[J];if(Y)return Y.execute(Q,Z);let K=this.latestCustom.find((G)=>G.name===J),q=await Hy1(J,Z,this.customRegistry,{signal:X});if(q.success)if(K?.kind==="markdown"){Q.editorDispatch({type:"set-input",input:q.output});return}else{Q.worker.handle({type:"user:message",message:{content:[{type:"text",text:q.output}]}});return}return Error(q.error??`Command '${J}' failed`)}query(J,Q,Z){let X=J.toLowerCase(),Y=Object.values(this.commands).filter((q)=>q.name.toLowerCase().includes(X)).filter((q)=>{if(!Q||!q.isVisible)return!0;return q.isVisible(Q,Z)}),K=this.latestCustom.filter((q)=>q.available&&q.name.toLowerCase().includes(X)).map((q)=>({name:q.name,description:"Custom command",requiresArgs:q.kind==="executable",execute:(G,z)=>this.execute(q.name,G,z??[])}));return[...Y,...K]}async cleanup(){await this.telemetrySubmitter.dispose()}get(J){let Q=this.commands[J];if(Q)return Q;let Z=this.latestCustom.find((X)=>X.name===J);return{name:J,description:"Custom command",requiresArgs:Z?.kind==="executable",execute:(X,Y)=>this.execute(J,X,Y??[])}}}var rX9={"generate-agent-file":{name:"generate-agent-file",description:`Generate an ${T5} file in the current workspace`,execute:async(J,Q)=>{J.worker.handle({type:"user:message",message:{content:[{type:"text",text:y80}]}});return}},compact:{name:"compact",description:"Compact the thread. Optional: /compact [message] to queue a message after compaction",execute:async(J,Q)=>{if(J.thread.messages.length===0)return new s71;if(Q&&Q.length>0){let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}try{await J.worker.summarizeThread(new AbortController().signal)}catch(Z){return Z instanceof Error?Z:Error("Failed to compact thread")}}},editor:{name:"editor",description:"Open $EDITOR to write a prompt",launchesWindow:!0,execute:async(J,Q)=>{try{let Z=process.env.EDITOR||process.env.VISUAL||"nano",X=await lX9(aY6.join(cX9(),"amp-edit-")),Y=aY6.join(X,"message.amp.md");nY6(`${Z} "${Y}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let q=(await iX9(Y,"utf-8")).trim();if(q)J.editorDispatch({type:"set-input",input:q})}catch(K){if(K?.code==="ENOENT")return;return l.error("Failed to read temporary file",K),Error("Failed to read editor content")}try{await nX9(Y),await dX9(X)}catch(K){l.warn("Failed to clean up temporary file",K)}return}catch(Z){return l.error("Failed to open editor",Z),Error("Failed to open editor")}}},help:{name:"help",description:"Show help and hotkeys",execute:async(J,Q)=>{J.openHelp();return}},permissions:{name:"permissions",description:"Edit permission rules in $EDITOR, or `/permissions off|on` to toggle for this session",launchesWindow:!0,execute:async(J,Q)=>{if(Q&&Q.length>0){let Y=Q[0]?.trim().toLowerCase();switch(Y){case"on":try{return oU("dangerouslyAllowAll",!1),new zQ("Amp is now following permissions rules for this session")}catch(K){return l.error("Failed to set dangerously allow all setting",K),Error("Failed to enable permissions for this session")}case"off":try{return oU("dangerouslyAllowAll",!0),new zQ("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(K){return l.error("Failed to set dangerously allow all setting",K),Error("Failed to disable permissions for this session")}case"edit":break;default:return Error(`Invalid option: ${Y}. Use: on, off, or edit (or no argument for edit)`)}}let Z=await qC();if(Z===null)return Error("No editor found, please set $EDITOR to edit permissions");let X="";try{let Y={stdin:process.stdin,stdout:process.stdout,stderr:{write:(K)=>{return X=K.toString(),!0}},exit:(K)=>{if(K!==0)throw l.error("editPermissions exited with status",K),Error(X)},settingsFile:J.settingsFilePath,resolveEditor:qC};await c71(Y);return}catch(Y){l.error("failed to open permissions editor:",Y);let K=Y instanceof Error?`: ${Y.message}`:"";return Error(`Failed to open ${Z}${K}`)}finally{process.stdout.write("\x1B[?25l")}}},new:{name:"new",description:"Start a new thread",execute:async(J,Q)=>{try{await J.startNewThread();return}catch(Z){return l.error("Failed to start new thread",Z),Error("Failed to start new thread")}},isVisible:(J)=>J.messages.length!==0},continue:{name:"continue",description:"Continue an existing thread",requiresArgs:!1,requiresPicker:!0,execute:async(J,Q)=>{try{if(Q&&Q.length>0){let Z=Q[0]?.trim();if(!Z)return Error("Invalid thread ID provided");return await J.switchToThread(Z),new zQ(`Switched to existing thread: ${Z}`)}await J.pickAndContinueThread();return}catch(Z){return l.error("Failed to continue thread",Z),Error("Failed to continue thread")}}},queue:{name:"queue",description:"Queue a message to send when inference completes. If no inference running, sends immediately.",requiresArgs:!0,execute:async(J,Q)=>{if(!Q||Q.length===0)return Error("Queue command requires a message argument. Usage: /queue <message>");let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}},dequeue:{name:"dequeue",description:"Dequeue all messages and restore them to the prompt editor",execute:async(J,Q)=>{let Z=J.thread.queuedMessages??[];if(Z.length===0)return;let Y=Z.map((K)=>{return K.queuedMessage.content.filter((G)=>G.type==="text").map((G)=>G.text).join("").trim()}).filter(Boolean).join(`
|
5876
5876
|
`).trim();await J.worker.handle({type:"user:message-queue:discard"}),J.editorDispatch({type:"set-input",input:Y})},isVisible:(J)=>(J.queuedMessages?.length??0)>0},share:{name:"share",description:"Set thread visibility - `/share private|workspace|group|public`",execute:async(J,Q)=>{let{thread:Z,threadSyncService:X,ampURL:Y}=J;if(!Q||Q.length===0)return Error("Please specify a visibility option: private, workspace, group, or public");let K=ik(new URL(Y),Z.id).toString(),G=`Thread URL: ${hV(K,K,{fallback:()=>K})}`,z=Q[0]?.trim().toLowerCase(),U;switch(z){case"private":U={visibility:"private",sharedGroupIDs:[]};break;case"workspace":U={visibility:"thread_workspace_shared"};break;case"group":U={visibility:"private",sharedGroupIDs:[],shareWithAllCreatorGroups:!0};break;case"public":U={visibility:"public"};break;default:return Error(`Invalid visibility option: ${z}. Use: private, workspace, group, or public`)}try{return await X.updateThreadMeta(Z.id,U),new zQ(`${G}
|
@@ -6072,7 +6072,7 @@ ${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTr
|
|
6072
6072
|
`),J.stdout.write(`Thread: ${H}
|
6073
6073
|
`),J.stdout.write(`Continue this thread with: amp threads continue ${W}
|
6074
6074
|
`)}}function pU6(J){return J==="smart"?k1.rgb(3,197,97):J==="fast"?k1.rgb(228,180,2):J==="free"?k1.rgb(59,91,143):pW9(J)}function pW9(J){let Q=0;for(let Y=0;Y<J.length;Y++){let K=J.charCodeAt(Y);Q=(Q<<5)-Q+K,Q=Q&Q}let Z=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Z.length;return k1.index(Z[X])}xf1();if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){X4.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
6075
|
-
`)}var im1=lm1.join(wc1||lm1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function nW9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function eH(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")oU("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new $2("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${G8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")oU("experimental.agentMode",Q.agentMode)}var aW9=A0.union([A0.object({command:A0.string(),args:A0.array(A0.string()).optional(),env:A0.record(A0.string(),A0.string()).optional()}).strict(),A0.object({url:A0.string()}).strict()]),rW9=A0.record(A0.string(),aW9);async function am1(J){try{await cW9(lm1.dirname(im1),{recursive:!0}),await lW9(im1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function sW9(){try{return(await rU6(im1,"utf-8")).trim()}catch(J){return null}}async function oW9(J){let Q;try{Q=JSON.parse(J)}catch(Z){throw Error(`Failed to parse --mcp-config as JSON: ${Z instanceof Error?Z.message:String(Z)}`)}try{return rW9.parse(Q)}catch(Z){if(Z instanceof A0.ZodError){let X=Z.issues.map((Y)=>`${Y.path.join(".")}: ${Y.message}`).join(", ");throw Error(`Invalid MCP server configuration: ${X}`)}throw Error(`Failed to validate MCP server configuration: ${String(Z)}`)}}function tW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z)||{},Y={};if(typeof X==="object")for(let[K,q]of Object.entries(X))Y[K]={...q,_target:"global"};for(let[K,q]of Object.entries(Q))Y[K]={...q,_target:"workspace"};return Y}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var iU6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??N5,description:`Custom settings file path (overrides the default location ${N5})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(l).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${wb1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:OG(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:Jy1(),hidden:!0,description:(J)=>J?"Enable IDE connection. When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:bd}],nU6=(J)=>("deprecated"in J)&&J.deprecated===!0,eW9=(J)=>("hidden"in J)&&J.hidden===!0,JF9=(J)=>("default"in J),QF9=(J)=>("default"in J)?J.default:void 0;function ZF9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new $2(_K.unknownCommand(Z),1,q)}}var sU6=null;function Zs2(){return sU6}function _J1(J){return{...J,getThreadEnvironment:V71,vfs:A20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new X_(J.fileSystem),generateThreadTitle:mq0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var rm1=P0.file(iW9.homedir()),oU6=process.env.XDG_CONFIG_HOME?P0.file(process.env.XDG_CONFIG_HOME):d0.joinPath(rm1,".config");async function JB(J,Q){Vi1("0.0.
|
6075
|
+
`)}var im1=lm1.join(wc1||lm1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function nW9(J){process.emitWarning=function(Q,Z,X,Y){let K=typeof Q==="string"?Q:Q.message||String(Q),q=Z||"Warning",G=!1;J.warn(K,{name:q,code:X})}}function eH(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")oU("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new $2("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${G8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")oU("experimental.agentMode",Q.agentMode)}var aW9=A0.union([A0.object({command:A0.string(),args:A0.array(A0.string()).optional(),env:A0.record(A0.string(),A0.string()).optional()}).strict(),A0.object({url:A0.string()}).strict()]),rW9=A0.record(A0.string(),aW9);async function am1(J){try{await cW9(lm1.dirname(im1),{recursive:!0}),await lW9(im1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function sW9(){try{return(await rU6(im1,"utf-8")).trim()}catch(J){return null}}async function oW9(J){let Q;try{Q=JSON.parse(J)}catch(Z){throw Error(`Failed to parse --mcp-config as JSON: ${Z instanceof Error?Z.message:String(Z)}`)}try{return rW9.parse(Q)}catch(Z){if(Z instanceof A0.ZodError){let X=Z.issues.map((Y)=>`${Y.path.join(".")}: ${Y.message}`).join(", ");throw Error(`Invalid MCP server configuration: ${X}`)}throw Error(`Failed to validate MCP server configuration: ${String(Z)}`)}}function tW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z)||{},Y={};if(typeof X==="object")for(let[K,q]of Object.entries(X))Y[K]={...q,_target:"global"};for(let[K,q]of Object.entries(Q))Y[K]={...q,_target:"workspace"};return Y}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var iU6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??N5,description:`Custom settings file path (overrides the default location ${N5})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(l).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${wb1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:OG(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:Jy1(),hidden:!0,description:(J)=>J?"Enable IDE connection. When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:bd}],nU6=(J)=>("deprecated"in J)&&J.deprecated===!0,eW9=(J)=>("hidden"in J)&&J.hidden===!0,JF9=(J)=>("default"in J),QF9=(J)=>("default"in J)?J.default:void 0;function ZF9(J,Q){let Z=Q.args[0],X=Q.commands.map((K)=>K.name());if(Z&&!Z.includes(" ")&&Z.length<30&&!/[./\\]/.test(Z)){let K=X.filter((G)=>Z.includes(G)||G.includes(Z)),q="Run amp --help for a list of available commands.";if(K.length>0)q=`Did you mean: ${K.join(", ")}? Or run amp --help for all commands.`;throw new $2(_K.unknownCommand(Z),1,q)}}var sU6=null;function Zs2(){return sU6}function _J1(J){return{...J,getThreadEnvironment:V71,vfs:A20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new X_(J.fileSystem),generateThreadTitle:mq0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var rm1=P0.file(iW9.homedir()),oU6=process.env.XDG_CONFIG_HOME?P0.file(process.env.XDG_CONFIG_HOME):d0.joinPath(rm1,".config");async function JB(J,Q){Vi1("0.0.1760198483-g276de5");let Z=_Z1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:e1.of([P0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:rm1,userConfigDir:oU6}),X=await Z.getLatest();l.debug("Global configuration initialized",{settingsKeys:Object.keys(X.settings)});let Y=sn(YO({configService:Z})),K=r90({configService:Z,toolService:Y}),q=Lw0(Y,f9,Ie).catch((A)=>{l.warn("Toolbox registration failed, continuing anyway:",A)}),G=K.initialized.catch((A)=>{l.warn("MCP service initialization failed, continuing anyway:",A)});if(J.executeMode)await Promise.all([G,q]);if(Q.jetbrains)GO("JetBrains");else if(Q.ide&&Jy1())GO("VS Code");else if(Q.ide&&wQ6())GO("Neovim");N96(Y,{configService:Z});let z,U=T7.status.pipe(I0((A)=>Boolean(A.connected&&A.authenticated)),U8()).subscribe((A)=>{if(A){if(!z)z=Y.registerTool(lr)}else z?.dispose(),z=void 0}),W;if(!J.executeMode)W=new v71(process.cwd(),{},!0);else W=new class extends v71{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(i2.write(`No API key found. Starting login flow...
|
6076
6076
|
`),!await XF9(J))await nR(),process.exit(1)}let F=await $20({isDevelopment:!1}),H=new RH1(F),B=new LH1(F,Z,{lazy:!0}),M=Q.notifications!==void 0?Q.notifications:!J.executeMode,V=A96({playNotificationSound:async(A)=>{if(M){L96(A);let R=kf1(),w=_f1();if((!R||w)&&X.settings["notifications.system.enabled"]!==!1){if(A==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(A==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:H,configService:Z});l.info("Starting Amp background services");let N=k20({threadService:H,threadHistoryService:B,configService:Z,isExtensionDevelopment:!1}),L={configService:Z,toolService:Y,mcpService:K,threadService:H,threadHistoryService:B,threadSyncService:N,threadStorage:F,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:W,notificationService:V,fileSystem:Q.jetbrains||Q.ide?V20:f9};return{...L,async asyncDispose(){await L.mcpService.dispose(),await L.threadService.asyncDispose(),L.configService.unsubscribe(),L.toolService.dispose(),L.fuzzyServer.dispose(),L.threadSyncService.dispose(),L.settingsStorage[Symbol.dispose](),U.unsubscribe(),z?.dispose()}}}async function XF9(J){if(!J.executeMode){if(!await zy1("Would you like to log in to Amp? [(y)es, (n)o]: "))return i2.write(`Login cancelled. Run the command again to retry.
|
6077
6077
|
`),!1}return await tU6(J)}async function tU6(J){let Q=dW9(32).toString("hex"),Z=await Gy1(J.ampURL,Q);try{await gU(Z)}catch(Y){l.error("Failed to open browser",{error:Y})}let X=await Gy1(J.ampURL,Q,!1);i2.write(`If your browser did not open automatically, visit:
|
6078
6078
|
|
@@ -6082,12 +6082,12 @@ ${G8.blue.bold(X)}
|
|
6082
6082
|
Login successful! You can now use the Amp CLI.
|
6083
6083
|
`),!0}catch(Y){return l.error("Login failed",{error:Y}),X4.write(`
|
6084
6084
|
Login failed: ${Y instanceof Error?Y.message:String(Y)}
|
6085
|
-
`),!1}}function YF9(){let J=new bm().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((F)=>{if(F.code==="commander.help"||F.code==="commander.version"||F.exitCode===0)rR(),process.exit(0);let H=F.originalError??F;wJ6(H)}),J.option("-V, --version","output the version number",()=>{i2.write(`0.0.
|
6086
|
-
`),process.exit(0)}),J.addHelpText("after",LQ6()),J.configureHelp({formatHelp:AQ6}),J.command("logout").description("Log out by removing stored API key").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await zF9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await GF9(M,await ab1(B,M.settings))});let Q=async(F,H,B)=>{_Z1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([P0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:rm1,userConfigDir:oU6});let M={...H,executeMode:!1};await nm1(M,{...F,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await aU6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await MF9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);if(H.pick)await Q(M,V,B);else await DF9(M,V,F,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);await BF9(M,V,F,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await aU6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);await HF9(M,V,F,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);await FF9(M,V,F,B)}),LZ6(J,async(F,H)=>{let B=await zY(H);eH(F,H);let M=await JB(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,cleanupTerminal:rR,asyncDispose:M.asyncDispose.bind(M)}}),aQ6(J),uQ6(J,async(F)=>{let H=await zY(F);return{settings:H.settings,getThreadDeps:async(B)=>{eH(B,F);let M=await JB(H,F);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);eH(H,B);let V=await JB(M,B);try{await vb1(V,V.configService,{})}finally{await V.asyncDispose(),await rR()}});let X=new bm().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(F)=>{await Zy1(F.force||!1,F.verbose||!1,"0.0.
|
6085
|
+
`),!1}}function YF9(){let J=new bm().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((F)=>{if(F.code==="commander.help"||F.code==="commander.version"||F.exitCode===0)rR(),process.exit(0);let H=F.originalError??F;wJ6(H)}),J.option("-V, --version","output the version number",()=>{i2.write(`0.0.1760198483-g276de5 (released 2025-10-11T16:06:19.266Z)
|
6086
|
+
`),process.exit(0)}),J.addHelpText("after",LQ6()),J.configureHelp({formatHelp:AQ6}),J.command("logout").description("Log out by removing stored API key").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await zF9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await GF9(M,await ab1(B,M.settings))});let Q=async(F,H,B)=>{_Z1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([P0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:rm1,userConfigDir:oU6});let M={...H,executeMode:!1};await nm1(M,{...F,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await aU6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await MF9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);if(H.pick)await Q(M,V,B);else await DF9(M,V,F,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);await BF9(M,V,F,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);await aU6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);await HF9(M,V,F,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(F,H,B)=>{let M=B.optsWithGlobals(),V=await zY(M);await FF9(M,V,F,B)}),LZ6(J,async(F,H)=>{let B=await zY(H);eH(F,H);let M=await JB(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,cleanupTerminal:rR,asyncDispose:M.asyncDispose.bind(M)}}),aQ6(J),uQ6(J,async(F)=>{let H=await zY(F);return{settings:H.settings,getThreadDeps:async(B)=>{eH(B,F);let M=await JB(H,F);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(F,H)=>{let B=H.optsWithGlobals(),M=await zY(B);eH(H,B);let V=await JB(M,B);try{await vb1(V,V.configService,{})}finally{await V.asyncDispose(),await rR()}});let X=new bm().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(F)=>{await Zy1(F.force||!1,F.verbose||!1,"0.0.1760198483-g276de5"),process.exit()});J.addCommand(X,{hidden:!0});function Y(F,H,B){let V=typeof F.description==="string"?F.description:B===void 0?F.description(!0):F.description(B),N=new EV(H,V),L=QF9(F);if(L)N.default(L);if(N.hidden=eW9(F)||nU6(F),"choices"in F)N.choices([...F.choices]);return N}for(let F of iU6)switch(F.type){case"flag":{J.addOption(Y(F,`--${F.long}`)),J.addOption(Y(F,`--no-${F.long}`,!1));break}case"switch":{J.addOption(Y(F,`--${F.long}`,!0));break}default:{J.addOption(Y(F,`--${F.long} <value>`));break}}let K=new EV("-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);if(J.addOption(K),process.env.AMP_CLI_REMOTE){let F=new EV("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1);J.addOption(F)}let q=new EV("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1);J.addOption(q);let G=new EV("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(G);let z=new EV("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(z),process.env.AMP_CONNECT==="1"){let F=new EV("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(F)}J.action(async(F,H)=>{let B=F,M=await zY(B);if(Object.keys(B).forEach((V)=>{let N=iU6.find((L)=>L.name===V);if(N&&nU6(N)&&!JF9(N))X4.write(G8.yellow(`Warning: '--${V}' flag is deprecated
|
6087
6087
|
`))}),H.args.length>0)ZF9(M,H);await nm1(M,B,H)});let U=new bm("doctor").summary("Generate support bundle").description("Generate a support bundle for troubleshooting issues. This collects logs, configuration, and system information into a file that can be shared with Amp support for debugging.").option("--output-dir <path>","Directory to save the support bundle",process.cwd()).option("--include-full-logs","Include full log history",!1).allowUnknownOption(!1).action(async(F)=>{await WF9(F.outputDir,F.includeFullLogs)});J.addCommand(U);let W=new bm("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(F)=>{await UF9(F.version)});return J.addCommand(W),J}async function kJ1(J,Q){let{thread:Z,visibility:X}=Q,Y=Z?.id??rK(),K=_J1(J);if(Z)await J.threadStorage.set(Y,Z);let q=await fJ.getOrCreateForThread(K,Y);if(X)await J.threadSyncService.updateThreadMeta(Y,p71(X));let G=J.threadService.observe(Y).subscribe(async(z)=>{if(c7(z,"assistant"))await am1(Y),G.unsubscribe()});return await q.resume(),q}async function nm1(J,Q,Z){let X=u71(Q);if(X instanceof Error)zX(X.message);let Y,K=null;if(Q.streamJsonInput)Y="";else if(typeof Q.execute==="string"){Y=Q.execute;let R=(await Uy1()).trimEnd();if(R)K=R}else Y=(await Uy1()).trimEnd();if(Q.remote&&!J.executeMode)throw new $2("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new $2("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new $2("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new $2("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.stats&&!J.executeMode)throw new $2("The --stats flag requires --execute mode",1,'Use: amp --execute "your message" --stats');if(Q.streamJsonInput&&typeof Q.execute==="string"&&Q.execute.trim()!=="")throw new $2("Do not provide a message argument when using --stream-json-input",1,`Supply messages via stdin JSONL instead: echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"your message"}]}}' | amp --execute --stream-json --stream-json-input`);if(J.executeMode&&Y===""&&!Q.streamJsonInput)throw new $2("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"
|
6088
6088
|
Or pipe via stdin: echo "your message" | amp --execute`);eH(Z,Q);let q=await JB(J,Q);sU6=q;let G=_J1(q),z=async(R)=>{let w=await rU6(R,"utf-8"),O=JSON.parse(w);if(!XW(O.id))throw new $2(_K.invalidThreadId);return kJ1(q,{visibility:X,thread:O})},U=async(R)=>{if(!XW(R))throw new $2(_K.invalidThreadId);let w=await q.threadService.get(R)??void 0;return kJ1(q,{visibility:X,thread:w})},W=async()=>{try{if(Q.threadId)return U(Q.threadId);else return kJ1(q,{visibility:X})}catch(R){if(R instanceof $2)throw R;throw await j71(R,Q.threadId),Error("handleError should have called process.exit()")}},F=async()=>{return kJ1(q,{visibility:X})};if(Q.format==="jsonl")X4.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
6089
|
-
`),await nR(),process.exit(1);if(J.executeMode&&Q.remote)await rQ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await W();if(J.executeMode)await vJ6(H,H.threadID,Y,K,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await fa1();let R=await OO({jetbrainsOnly:Q.jetbrains});if(R.length===0)if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall");else T7.sendStatus({enabled:!0,connected:!1,authenticated:!1});else if(R.length===1){let w=R[0];if(w)T7.selectConfig(w),await T7.start(w,!1).catch((O)=>{l.error("Failed to start IDE client",{error:O})})}else B=!0}let V=Ky1("0.0.
|
6090
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=!1,X=process.stdout.isTTY&&process.stderr.isTTY,Y=await yU(J.settingsFile),K=fU({...J,settingsFile:Y,getHook:process.env.AMP_URL?(z,U)=>{if(z==="url")return Promise.resolve(process.env.AMP_URL);return U()}:void 0});if(await oQ6(K),await tQ6(K),J.mcpConfig){let z=await oW9(J.mcpConfig);K=tW9(K,z)}let q=await K.get("url","global");if(!q)q=qZ;if(!qB(q))l.info("Targeting custom Amp server",{ampURL:q});if(K=dc1(K),await K.get("debug.httpLogging"))mc1();return{executeMode:Q,streamJsonMode:Z,isTTY:X,ampURL:q,settings:K,secrets:sQ6(await ab1(J,K))}}function KF9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function qF9(){let J=KF9(process.argv);if(XJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),nW9(l),l.info("Starting Amp CLI.",{version:"0.0.
|
6089
|
+
`),await nR(),process.exit(1);if(J.executeMode&&Q.remote)await rQ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await W();if(J.executeMode)await vJ6(H,H.threadID,Y,K,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let B=!1,M=!1;if(Q.jetbrains||Q.ide){await fa1();let R=await OO({jetbrainsOnly:Q.jetbrains});if(R.length===0)if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall");else T7.sendStatus({enabled:!0,connected:!1,authenticated:!1});else if(R.length===1){let w=R[0];if(w)T7.selectConfig(w),await T7.start(w,!1).catch((O)=>{l.error("Failed to start IDE client",{error:O})})}else B=!0}let V=Ky1("0.0.1760198483-g276de5",q.settingsStorage),N=e1.of([P0.file(process.cwd())]),L=iC(void 0,N);if(Y)H.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}});let A=await q.configService.getLatest();await lU6({stdout:process.stdout,history:new bb1,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadSyncService:q.threadSyncService,threadID:H.threadID,worker:H,workerDeps:G,configService:q.configService,internalAPIClient:_J,ampURL:J.ampURL,startNewThread:F,pickAndContinueThread:async()=>{l.info("Thread picker requested - not yet implemented in TUI")},switchToThread:U,ideClient:T7,connectedClientsService:new fd,commandRegistry:L,showJetBrainsInstaller:M,showIdePicker:B,startWithPicker:Q.startWithPicker,updateService:V,debugWidgetTree:Q.debugWidgetTree,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,freeTui:"freeTui"in Q?Boolean(Q.freeTui):!1}),await q.asyncDispose(),process.exit(0)}async function zY(J){if(J.interactive)X4.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
6090
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=!1,X=process.stdout.isTTY&&process.stderr.isTTY,Y=await yU(J.settingsFile),K=fU({...J,settingsFile:Y,getHook:process.env.AMP_URL?(z,U)=>{if(z==="url")return Promise.resolve(process.env.AMP_URL);return U()}:void 0});if(await oQ6(K),await tQ6(K),J.mcpConfig){let z=await oW9(J.mcpConfig);K=tW9(K,z)}let q=await K.get("url","global");if(!q)q=qZ;if(!qB(q))l.info("Targeting custom Amp server",{ampURL:q});if(K=dc1(K),await K.get("debug.httpLogging"))mc1();return{executeMode:Q,streamJsonMode:Z,isTTY:X,ampURL:q,settings:K,secrets:sQ6(await ab1(J,K))}}function KF9(J){let Q={};for(let Z=0;Z<J.length;Z++){let X=J[Z];if(X?.startsWith("--")){let K=X.slice(2).replace(/-([a-z])/g,(G,z)=>z.toUpperCase()),q=J[Z+1];if(q&&!q.startsWith("--"))Q[K]=q,Z++}}return Q}async function qF9(){let J=KF9(process.argv);if(XJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),nW9(l),l.info("Starting Amp CLI.",{version:"0.0.1760198483-g276de5",buildTimestamp:"2025-10-11T16:06:19.266Z",buildType:"'release'"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new $2(_K.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await YF9().parseAsync(process.argv)}qF9().catch(j71);async function GF9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),i2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
6091
6091
|
`);else if(!qB(J.ampURL))i2.write(`Logging in to ${new URL(J.ampURL).hostname}
|
6092
6092
|
`);let Z=process.env.AMP_API_KEY;if(Z)i2.write(`API key found in environment variable, storing...
|
6093
6093
|
`),await Q.set("apiKey",Z,J.ampURL),i2.write(`API key successfully stored.
|
@@ -6103,7 +6103,7 @@ Or pipe via stdin: echo "your message" | amp --execute`);eH(Z,Q);let q=await JB(
|
|
6103
6103
|
`));try{let Q;if(J)Q=J,X4.write(G8.blue(`Updating to version ${J}...
|
6104
6104
|
`)),await YC(J),X4.write(G8.green(`✓ Successfully updated to version ${J}
|
6105
6105
|
`));else{X4.write(G8.blue(`Checking for updates...
|
6106
|
-
`));let{hasUpdate:X,latestVersion:Y}=await kj("0.0.
|
6106
|
+
`));let{hasUpdate:X,latestVersion:Y}=await kj("0.0.1760198483-g276de5");if(!X)X4.write(G8.green(`✓ Amp CLI is already up to date.
|
6107
6107
|
`)),process.exit(0);if(!Y)X4.write(G8.yellow("[WARN] could not find latest version")),process.exit(0);Q=Y,X4.write(G8.blue(`Updating to version ${Y}...
|
6108
6108
|
`)),await YC(Y),X4.write(G8.green(`✓ Successfully updated to version ${Y}
|
6109
6109
|
`))}let Z=await eR(Q);if(Z.warning)X4.write(`
|
package/package.json
CHANGED