@sourcegraph/amp 0.0.1755947693-gcb6e03 → 0.0.1755949506-g7b2878
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 +4 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
@@ -4689,7 +4689,7 @@ ${J}
|
|
4689
4689
|
|
4690
4690
|
Command:
|
4691
4691
|
|
4692
|
-
${yf("\t",f??"(unknown)")}`}await Z(_);return}}}catch(b){E1.error("Error in status subscription",{error:b}),await Z(nc1(b))}}),P=D.threadService.observe(Q).subscribe(async(S)=>{try{Y=S;while(N<S.messages.length){let k=S.messages[N];if(!k||k.role!=="user"){N++;continue}if(!DM2(k.content))break;if(!L.has(k)){let f=JEA(k,z);await Ar(f),L.add(k)}N++}let b=S.messages.filter((k)=>k.role==="assistant"&&k.state.type!=="streaming");for(let k=V;k<b.length;k++){let f=b[k];if(!f)continue;let g=zM2(),v=BEA(f,g,z);await Ar(v),X++}V=b.length;let u=zEA(S.messages),_=q7(S,"assistant");if(u>I&&_&<(_))await Z()}catch(b){E1.error("Error in thread subscription",{error:b}),await Z(nc1(b))}})})}catch(M){throw E(),M}}async function KEA(A,Q,B,J,D,z){if(z)return GEA({worker:A,threadID:Q,userInput:B,stdinInput:J,dependencies:D});let G=XEA(A.thread.messages),X=[{type:"text",text:B}];if(J)X.unshift({type:"text",text:`Input received on stdin:
|
4692
|
+
${yf("\t",f??"(unknown)")}`}await Z(_);return}}}catch(b){E1.error("Error in status subscription",{error:b}),await Z(nc1(b))}}),P=D.threadService.observe(Q).subscribe(async(S)=>{try{Y=S;while(N<S.messages.length){let k=S.messages[N];if(!k||k.role!=="user"){N++;continue}if(!DM2(k.content))break;if(!L.has(k)){let f=JEA(k,z);await Ar(f),L.add(k)}N++}let b=S.messages.filter((k)=>k.role==="assistant"&&k.state.type!=="streaming");for(let k=V;k<b.length;k++){let f=b[k];if(!f)continue;let g=zM2(),v=BEA(f,g,z);await Ar(v),X++}V=b.length;let u=zEA(S.messages),_=q7(S,"assistant");if(u>I&&_&&_.state.type!=="streaming"&<(_))await Z()}catch(b){E1.error("Error in thread subscription",{error:b}),await Z(nc1(b))}})})}catch(M){throw E(),M}}async function KEA(A,Q,B,J,D,z){if(z)return GEA({worker:A,threadID:Q,userInput:B,stdinInput:J,dependencies:D});let G=XEA(A.thread.messages),X=[{type:"text",text:B}];if(J)X.unshift({type:"text",text:`Input received on stdin:
|
4693
4693
|
\`\`\`
|
4694
4694
|
${J}
|
4695
4695
|
\`\`\``});return await A.handle({type:"user:message",message:{content:X}}),new Promise((K,Y)=>{let q=!1,Z=setInterval(()=>{},1000),U=()=>{if(!q)q=!0,clearInterval(Z),F.unsubscribe(),E.unsubscribe(),A.dispose(),E1.debug("Syncing thread before shutting down",{threadID:Q}),D.threadSyncService.sync().then(()=>{K()}).catch((M)=>{E1.error("Error syncing thread",{error:M}),Y(M)})},F=A.status.subscribe((M)=>{if(M.state==="active"&&M.ephemeralError)E1.error("error",{error:M.ephemeralError}),process.stderr.write("Error: "+GM2(M.ephemeralError)+`
|
@@ -5065,7 +5065,7 @@ allow ${z}${G?` ${G}`:""}`}let J={stdin:process.stdin,stdout:process.stdout,stde
|
|
5065
5065
|
${U}`;if(B==="pnpm"&&U.includes("Unable to find the global bin directory"))F+=`
|
5066
5066
|
|
5067
5067
|
Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
|
5068
|
-
npm install -g @sourcegraph/amp`;G(new Error(F))}},error:(Z)=>{if(!Y)Y=!0,G(new Error(`Failed to spawn ${B}: ${Z.message}`))},complete:()=>{if(!Y)Y=!0,z()}})})}var Ti1=Ri1.join(U00||Ri1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function tn8(A,Q){let B={};if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")B.dangerouslyAllowAll=Q.dangerouslyAllowAll;if(A.getOptionValueSourceWithGlobals("tryGpt5")==="cli")B.gpt5=Q.tryGpt5;if(A.getOptionValueSourceWithGlobals("blend")==="cli")B["internal.blend"]=Q.blend;return B}function Dj(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")uY("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("tryGpt5")==="cli")uY("gpt5",Q.tryGpt5);if(A.getOptionValueSourceWithGlobals("blend")==="cli")uY("internal.blend",Q.blend)}var ZC2=j6.union([j6.object({command:j6.string(),args:j6.array(j6.string()).optional(),env:j6.record(j6.string(),j6.string()).optional()}).strict(),j6.object({url:j6.string()}).strict()]),UC2=j6.record(j6.string(),ZC2);async function $i1(A){try{await KC2(Ri1.dirname(Ti1),{recursive:!0}),await YC2(Ti1,A,"utf-8")}catch(Q){E1.debug("Failed to save last thread ID",Q)}}async function HC2(){try{return(await PNA(Ti1,"utf-8")).trim()}catch(A){return null}}async function FC2(A){let Q;try{Q=JSON.parse(A)}catch(B){throw new Error(`Failed to parse --mcp-config as JSON: ${B instanceof Error?B.message:String(B)}`)}try{return UC2.parse(Q)}catch(B){if(B instanceof j6.ZodError){let J=B.issues.map((D)=>`${D.path.join(".")}: ${D.message}`).join(", ");throw new Error(`Invalid MCP server configuration: ${J}`)}throw new Error(`Failed to validate MCP server configuration: ${String(B)}`)}}function EC2(A,Q){return{...A,async get(B){if(B==="mcpServers"){let J=await A.get(B)||{},D={};if(typeof J==="object")for(let[z,G]of Object.entries(J))D[z]={...G,_target:"global"};for(let[z,G]of Object.entries(Q))D[z]={...G,_target:"workspace"};return D}return A.get(B)},async keys(){let B=await A.keys();if(!B.includes("mcpServers"))B.push("mcpServers");return B},[Symbol.dispose](){A[Symbol.dispose]()}}}async function MC2(A){let Q=await pz(`/api/threads/${A}`);if(!Q.ok){let B=await Q.text();if(Q.status===404||B.includes("not found"))throw new FB(bX.threadNotFound(A));throw new FB(`Failed to load thread ${A}`,1,`Use 'amp threads share ${A} --support' to share this with the Amp team if this persists.`)}return await Q.json()}var jNA=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} sound notifications (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)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??xX,description:`Custom settings file path (overrides the default location ${xX})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(E1).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:"Set log file location"},{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:xR(),description:(A)=>A?"Enable JetBrains integration. You must start Amp in the same directory as your JetBrains project. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration.",hidden:!0},{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:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"Try GPT-5 as the primary agent model (limited time; see https://ampcode.com/news/gpt-5)"},{name:"blend",long:"blend",type:"option",description:"Internal blend mode configuration",choices:["alloy-random"],hidden:!0}],TNA=(A)=>("deprecated"in A)&&A.deprecated===!0,WC2=(A)=>("hidden"in A)&&A.hidden===!0,wC2=(A)=>("default"in A),IC2=(A)=>("default"in A)?A.default:void 0;function NC2(A,Q){let B=Q.args[0],J=Q.commands.map((z)=>z.name());if(B&&!B.includes(" ")&&B.length<30&&!/[./\\]/.test(B)){let z=J.filter((X)=>B.includes(X)||X.includes(B)),G="Run amp --help for a list of available commands.";if(z.length>0)G=`Did you mean: ${z.join(", ")}? Or run amp --help for all commands.`;throw new FB(bX.unknownCommand(B),1,G)}}function bX1(A){return{...A,getThreadEnvironment:sBA,vfs:V40({os:H11}),fileChangeTrackerStorage:new zh(H11),generateThreadTitle:a01,internalAPIClient:ZK}}var _i1=O6.file(qC2.homedir()),SNA=process.env.XDG_CONFIG_HOME?O6.file(process.env.XDG_CONFIG_HOME):q6.joinPath(_i1,".config");async function zj(A,Q,B=!1){uo1("0.0.
|
5068
|
+
npm install -g @sourcegraph/amp`;G(new Error(F))}},error:(Z)=>{if(!Y)Y=!0,G(new Error(`Failed to spawn ${B}: ${Z.message}`))},complete:()=>{if(!Y)Y=!0,z()}})})}var Ti1=Ri1.join(U00||Ri1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function tn8(A,Q){let B={};if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")B.dangerouslyAllowAll=Q.dangerouslyAllowAll;if(A.getOptionValueSourceWithGlobals("tryGpt5")==="cli")B.gpt5=Q.tryGpt5;if(A.getOptionValueSourceWithGlobals("blend")==="cli")B["internal.blend"]=Q.blend;return B}function Dj(A,Q){if(A.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")uY("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(A.getOptionValueSourceWithGlobals("tryGpt5")==="cli")uY("gpt5",Q.tryGpt5);if(A.getOptionValueSourceWithGlobals("blend")==="cli")uY("internal.blend",Q.blend)}var ZC2=j6.union([j6.object({command:j6.string(),args:j6.array(j6.string()).optional(),env:j6.record(j6.string(),j6.string()).optional()}).strict(),j6.object({url:j6.string()}).strict()]),UC2=j6.record(j6.string(),ZC2);async function $i1(A){try{await KC2(Ri1.dirname(Ti1),{recursive:!0}),await YC2(Ti1,A,"utf-8")}catch(Q){E1.debug("Failed to save last thread ID",Q)}}async function HC2(){try{return(await PNA(Ti1,"utf-8")).trim()}catch(A){return null}}async function FC2(A){let Q;try{Q=JSON.parse(A)}catch(B){throw new Error(`Failed to parse --mcp-config as JSON: ${B instanceof Error?B.message:String(B)}`)}try{return UC2.parse(Q)}catch(B){if(B instanceof j6.ZodError){let J=B.issues.map((D)=>`${D.path.join(".")}: ${D.message}`).join(", ");throw new Error(`Invalid MCP server configuration: ${J}`)}throw new Error(`Failed to validate MCP server configuration: ${String(B)}`)}}function EC2(A,Q){return{...A,async get(B){if(B==="mcpServers"){let J=await A.get(B)||{},D={};if(typeof J==="object")for(let[z,G]of Object.entries(J))D[z]={...G,_target:"global"};for(let[z,G]of Object.entries(Q))D[z]={...G,_target:"workspace"};return D}return A.get(B)},async keys(){let B=await A.keys();if(!B.includes("mcpServers"))B.push("mcpServers");return B},[Symbol.dispose](){A[Symbol.dispose]()}}}async function MC2(A){let Q=await pz(`/api/threads/${A}`);if(!Q.ok){let B=await Q.text();if(Q.status===404||B.includes("not found"))throw new FB(bX.threadNotFound(A));throw new FB(`Failed to load thread ${A}`,1,`Use 'amp threads share ${A} --support' to share this with the Amp team if this persists.`)}return await Q.json()}var jNA=[{name:"notifications",long:"notifications",type:"flag",description:(A)=>`${A?"Enable":"Disable"} sound notifications (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)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??xX,description:`Custom settings file path (overrides the default location ${xX})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(E1).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:"Set log file location"},{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:xR(),description:(A)=>A?"Enable JetBrains integration. You must start Amp in the same directory as your JetBrains project. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration.",hidden:!0},{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:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"Try GPT-5 as the primary agent model (limited time; see https://ampcode.com/news/gpt-5)"},{name:"blend",long:"blend",type:"option",description:"Internal blend mode configuration",choices:["alloy-random"],hidden:!0}],TNA=(A)=>("deprecated"in A)&&A.deprecated===!0,WC2=(A)=>("hidden"in A)&&A.hidden===!0,wC2=(A)=>("default"in A),IC2=(A)=>("default"in A)?A.default:void 0;function NC2(A,Q){let B=Q.args[0],J=Q.commands.map((z)=>z.name());if(B&&!B.includes(" ")&&B.length<30&&!/[./\\]/.test(B)){let z=J.filter((X)=>B.includes(X)||X.includes(B)),G="Run amp --help for a list of available commands.";if(z.length>0)G=`Did you mean: ${z.join(", ")}? Or run amp --help for all commands.`;throw new FB(bX.unknownCommand(B),1,G)}}function bX1(A){return{...A,getThreadEnvironment:sBA,vfs:V40({os:H11}),fileChangeTrackerStorage:new zh(H11),generateThreadTitle:a01,internalAPIClient:ZK}}var _i1=O6.file(qC2.homedir()),SNA=process.env.XDG_CONFIG_HOME?O6.file(process.env.XDG_CONFIG_HOME):q6.joinPath(_i1,".config");async function zj(A,Q,B=!1){uo1("0.0.1755949506-g7b2878"),po1(Q.jetbrains);let J=fZ1({storage:A.settings,secretStorage:A.secrets,workspaceRoots:XA.of([O6.file(process.cwd())]),defaultAmpURL:A.ampURL,defaultCacheDirectory:Lp1,homeDir:_i1,userConfigDir:SNA}),D=await t8();E1.debug("Global configuration initialized",{hasCacheDirectory:!!D.settings.cacheDirectory,settingsKeys:Object.keys(D.settings)});let z=q11(us()),G=c90({configService:J,toolService:z});if(process.env.AMP_TOOLBOX)qO0(z,H11,E81);try{await G.initialized}catch(I){E1.warn("Failed to wait for MCP servers, continuing anyway:",I)}if(Q.jetbrains)try{E1.debug("ide-client",{terminalEmulator:process.env.TERMINAL_EMULATOR}),await GK.start()}catch(I){let N=I instanceof Error?I.message:String(I);CD(`Failed to connect to JetBrains IDE: ${N}`)}let X=D.settings["experimental.reviewTool"]??!1,K=D.settings["experimental.tools"]??[];l2A(z,!1,X,K,Q.jetbrains);let Y;if(!A.executeMode)Y=new az1(process.cwd(),{},!0);else Y=new class extends az1{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await A.secrets.get("apiKey",A.ampURL)){if(y4.write(`No API key found. Starting login flow...
|
5069
5069
|
`),!await VC2(A))process.exit(1)}let q=R40(),Z=new dw1(q),U=new uw1(q),F=new J31(Z),E=Q.notifications!==void 0?Q.notifications:!A.executeMode,M=a2A({playNotificationSound:async(I)=>{if(E){if(i2A(I),!(B?yd1():DwA())&&D.settings["notifications.system.enabled"]!==!1){if(I==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(I==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:Z});E1.info("Starting Amp background services");let W=kK0({threadService:Z,threadHistoryService:U,isExtensionDevelopment:!1}),w={configService:J,toolService:z,mcpService:G,threadService:Z,threadHistoryService:U,threadSummaryService:F,threadSyncService:W,threadStorage:q,secretStorage:A.secrets,settingsStorage:A.settings,fuzzyServer:Y,notificationService:M};return{...w,async dispose(){await w.mcpService.dispose(),w.configService.unsubscribe(),w.toolService.dispose(),w.fuzzyServer.dispose(),w.threadSyncService.dispose(),w.settingsStorage[Symbol.dispose]()}}}async function VC2(A){if(!A.executeMode){if(await QG1("Would you like to log in to Amp?",["(y)es","(n)o"])!="y")return y4.write(`Login cancelled. Run the command again to retry.
|
5070
5070
|
`),!1}return await vNA(A)}async function vNA(A){let Q=XC2(32).toString("hex"),B=await bEA(A.ampURL,Q);y4.write(`If your browser doesn't open automatically, visit:
|
5071
5071
|
|
@@ -5079,7 +5079,7 @@ ${J0.blue.bold(B)}
|
|
5079
5079
|
Login successful! You can now use the Amp CLI.
|
5080
5080
|
`),!0}catch(J){return D7.write(`
|
5081
5081
|
Login failed: ${J instanceof Error?J.message:String(J)}
|
5082
|
-
`),!1}}function OC2(A){let Q=A.outputHelp.bind(A);A.outputHelp=function(B){let J="",D=this.configureOutput();if(this.configureOutput({writeOut:(z)=>{J+=z},writeErr:(z)=>{J+=z}}),typeof B==="function")B(J);else Q(B);this.configureOutput(D),mEA(J)}}function kNA(A){OC2(A);for(let Q of A.commands)kNA(Q)}function CC2(){let A=new SJ1().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, team)").configureOutput({writeErr:()=>{}});A.exitOverride((K)=>{if(K.code==="commander.help"||K.code==="commander.version"||K.exitCode===0)Hf(),process.exit(0);let Y=K.originalError??K;Pa(Y)}),A.option("-V, --version","output the version number",()=>{y4.write(`0.0.
|
5082
|
+
`),!1}}function OC2(A){let Q=A.outputHelp.bind(A);A.outputHelp=function(B){let J="",D=this.configureOutput();if(this.configureOutput({writeOut:(z)=>{J+=z},writeErr:(z)=>{J+=z}}),typeof B==="function")B(J);else Q(B);this.configureOutput(D),mEA(J)}}function kNA(A){OC2(A);for(let Q of A.commands)kNA(Q)}function CC2(){let A=new SJ1().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, team)").configureOutput({writeErr:()=>{}});A.exitOverride((K)=>{if(K.code==="commander.help"||K.code==="commander.version"||K.exitCode===0)Hf(),process.exit(0);let Y=K.originalError??K;Pa(Y)}),A.option("-V, --version","output the version number",()=>{y4.write(`0.0.1755949506-g7b2878 (released 2025-08-23T11:49:38.892Z)
|
5083
5083
|
`),process.exit(0)}),A.addHelpText("after",vEA()),A.configureHelp({formatHelp:kEA}),A.command("logout").description("Log out by removing stored API key").action(async(K,Y)=>{let q=Y.optsWithGlobals(),Z=await PZ(q);await TC2(Z)}),A.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(K,Y)=>{let q=Y.optsWithGlobals(),Z=await PZ(q);await jC2(Z)});let Q=A.command("threads").alias("t").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(K,Y)=>{let q=Y.optsWithGlobals(),Z=await PZ(q);await _NA(q,Z,Y)});Q.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, team)").action(async(K,Y)=>{let q=Y.optsWithGlobals(),Z=await PZ(q);await kC2(q,Z,Y)}),Q.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(K,Y,q)=>{let Z=q.optsWithGlobals(),U=await PZ(Z);if(Y.pick){fZ1({storage:U.settings,secretStorage:U.secrets,workspaceRoots:XA.of([O6.file(process.cwd())]),defaultAmpURL:U.ampURL,homeDir:_i1,userConfigDir:SNA});let F=await fC2();if(F)await $NA(Z,U,F,q);else process.exit(0)}else await $NA(Z,U,K,q)}),Q.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(K,Y,q)=>{let Z=q.optsWithGlobals(),U=await PZ(Z);await vC2(Z,U,K,q)}),Q.command("list").alias("l").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(K,Y)=>{let q=Y.optsWithGlobals(),Z=await PZ(q);await _NA(q,Z,Y)}),Q.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, team) 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, team)").option("--support","Share thread with Amp support for debugging").action(async(K,Y,q)=>{let Z=q.optsWithGlobals(),U=await PZ(Z);await SC2(Z,U,K,q,Y.support)}),Q.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(K,Y,q)=>{let Z=q.optsWithGlobals(),U=await PZ(Z);await PC2(Z,U,K,q)}),QMA(A,async(K,Y)=>{let q=await PZ(Y);Dj(K,Y);let Z=await zj(q,Y,!1);return{context:q,mcpService:Z.mcpService,toolService:Z.toolService,cleanupTerminal:Hf,dispose:Z.dispose.bind(Z)}}),aEA(A);function B(K,Y,q){let U=typeof K.description==="string"?K.description:q===void 0?K.description(!0):K.description(q),F=new ci(Y,U),E=IC2(K);if(E)F.default(E);return F.hidden=WC2(K)||TNA(K),F}for(let K of jNA)switch(K.type){case"flag":{A.addOption(B(K,`--${K.long}`)),A.addOption(B(K,`--no-${K.long}`,!1));break}case"switch":{A.addOption(B(K,`--${K.long}`,!0));break}default:{A.addOption(B(K,`--${K.long} <value>`));break}}let J=new ci("-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);A.addOption(J);let D=new ci("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1).hideHelp(!0);A.addOption(D);let z=new ci("--tui","Launch experimental TUI interface").hideHelp();A.addOption(z),A.action(async(K,Y)=>{let q=K,Z=await PZ(q);if(Object.keys(q).forEach((U)=>{if(U==="format"&&K.format==="jsonl"){D7.write(J0.yellow(`jsonl format is deprecated. Version "0.0.1753194394-g45962a" is required to use jsonl format.
|
5084
5084
|
`));return}let F=jNA.find((E)=>E.name===U);if(F&&TNA(F)&&!wC2(F))D7.write(J0.yellow(`Warning: '--${U}' flag is deprecated
|
5085
5085
|
`))}),Y.args.length>0)NC2(Z,Y);await fNA(Z,q,Y)});let G=new SJ1("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(K)=>{await _C2(K.outputDir,K.includeFullLogs)});A.addCommand(G);let X=new SJ1("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(K)=>{await $C2(K.version)});return A.addCommand(X),kNA(A),A}async function yX1(A,Q,B){let{thread:J,visibility:D}=B,z=J?.id??$F(),G=bX1(Q);if(J)await Q.threadStorage.set(z,J);let X=await lD.getOrCreateForThread(G,z);if(D)await Q.threadSyncService.updateThreadMeta(z,tz1(D));let K=Q.threadService.observe(z).subscribe(async(Y)=>{if(q7(Y,"assistant"))await $i1(z),K.unsubscribe()});return await X.resume(),X}async function fNA(A,Q,B){let J=process.stdin,D=oz1(Q);if(D instanceof Error)CD(D.message);let z,G=null;if(typeof Q.execute==="string"){z=Q.execute;let M=(await Fd1()).trimEnd();if(M)G=M}else z=(await Fd1()).trimEnd();if(Q.streamJson&&!A.executeMode)throw new FB("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(A.executeMode&&z==="")throw new FB("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"
|
@@ -5099,7 +5099,7 @@ Or pipe via stdin: echo "your message" | amp --execute`);if(z!==""&&!A.executeMo
|
|
5099
5099
|
`);process.exit(0)}async function $C2(A){try{if(A)D7.write(J0.blue(`Updating to version ${A}...
|
5100
5100
|
`)),await Li1(A),D7.write(J0.green(`✓ Successfully updated to version ${A}
|
5101
5101
|
`));else{D7.write(J0.blue(`Checking for updates...
|
5102
|
-
`));let Q=await M11("0.0.
|
5102
|
+
`));let Q=await M11("0.0.1755949506-g7b2878");if(!Q.hasUpdate)D7.write(J0.green(`✓ Amp CLI is already up to date.
|
5103
5103
|
`)),process.exit(0);D7.write(J0.blue(`Updating to version ${Q.latestVersion}...
|
5104
5104
|
`)),await Li1(Q.latestVersion),D7.write(J0.green(`✓ Successfully updated to version ${Q.latestVersion}
|
5105
5105
|
`))}process.exit(0)}catch(Q){CD(Q instanceof Error?Q.message:String(Q))}}async function _C2(A,Q){try{D7.write(J0.green("Generating Amp support bundle...")+`
|
package/package.json
CHANGED