@sourcegraph/amp 0.0.1761091312-gbabab6 → 0.0.1761120158-gccd64f
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 +8 -8
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1984,7 +1984,7 @@ ${oE.map((J)=>`- **${J.id}** (${J.provider}): ${J.description}`).join(`
|
|
|
1984
1984
|
- Write code: { model: "${yr}", system: "You are a senior programmer who follows coding best practices.", message: "Write a function to calculate the sum of two numbers." }
|
|
1985
1985
|
- Write tests: { model: "gpt-4o", system: "You are a senior software test writer.", message: "Review the following code to flag possible bugs, performance, and security issues. Then write tests that cover both possible existing issues as well as cases we do not want to regress in the future." }
|
|
1986
1986
|
- Answer technical question: { model: "${r_}", system: "You are a detail-oriented senior engineer.", message: "Explain how this code works." }
|
|
1987
|
-
`,mw1={spec:{name:Vl1,description:aD8,inputSchema:{type:"object",properties:{model:{type:"string",description:"The model name to use"},system:{type:"string",description:"The system message to provide context and instructions"},message:{type:"string",description:"The user message to send to the model"},contextFiles:{type:"array",items:{type:"string"},description:"Optional array of file paths or URIs to include as context"}},required:["model","system","message"]},source:"builtin"},fn:Promise.resolve().then(() => (yR0(),bR0)).then(({nodeChatLLMTool:J})=>J)}});function hR0(J){let Q=atob(J),Z=new Uint8Array(Q.length);for(let Y=0;Y<Q.length;Y++)Z[Y]=Q.charCodeAt(Y);return new TextDecoder("utf-8").decode(Z)}var gR0;var mR0=B1(()=>{Aq();H8();gR0={spec:{name:XS,description:"Run CI/CD checks (typechecker, linter, formatter, linter, and tests) to validate the changes. Returns the success or failure status, plus the relevant log lines. If tree parameter is provided, checks will be run for that specific repository tree. Otherwise, checks will be run for the tree with the most changes or the first available tree.",inputSchema:{type:"object",properties:{tree:{type:"string",description:'URI of the specific tree/repository to run checks for (e.g., "file:///path/to/repo"). If not provided, will automatically select the most appropriate tree.'}},required:[],additionalProperties:!1},source:"builtin",meta:{disableTimeout:!0}},fn:DD({os:null,github:null,gitlab:null})}});var lR0={};w6(lR0,{nodeUndoEditTool:()=>GM8});import{writeFile as qM8}from"node:fs/promises";function zM8(J){if(typeof J!=="object"||J===null)throw Error("args must be an object. received instead: `"+JSON.stringify(J)+"`");if(typeof J.path!=="string")throw Error("path must be a string. received instead: `"+JSON.stringify(J.path)+"`")}var GM8=({args:J},{dir:Q,fileChangeTracker:Z})=>{return d6(async(X)=>{Jj(Q),zM8(J);let Y=TX(J.path);await YW(Y).acquire();try{let K=await Z.getLastEdit(Y);if(!K)return{status:"error",progress:{},error:{message:`No edit history found for file '${J.path}'.`}};let q=KW(K.newContent,K.oldContent,J.path),G=DV1(q);return await qM8(Y.fsPath,K.oldContent,{encoding:"utf-8",signal:X}),K.revert(),{status:"done",progress:{},result:G}}finally{YW(Y).release()}})};var iR0=B1(()=>{T0();Uz();r3();Us();CX()});var Sy;var tw1=B1(()=>{Sy={name:"mermaid",version:"11.6.0",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.0.4","@iconify/utils":"^2.1.33","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.11",dayjs:"^1.11.13",dompurify:"^3.2.4",katex:"^0.16.9",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^15.0.7",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.2","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",chokidar:"^4.0.3",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.0.2",jison:"^0.4.18","js-base64":"^3.7.7",jsdom:"^26.0.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.2",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.10","type-fest":"^4.35.0",typedoc:"^0.27.8","typedoc-plugin-markdown":"^4.4.2",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.0.2","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}}});var oM8,le,tM8,BO0,eM8,JV8,D=(J,Q)=>le(J,"name",{value:Q,configurable:!0}),J4=(J,Q)=>function(){return Q||(0,J[BO0(J)[0]])((Q={exports:{}}).exports,Q),Q.exports},nJ=(J,Q)=>{for(var Z in Q)le(J,Z,{get:Q[Z],enumerable:!0})},ew1=(J,Q,Z,X)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(let Y of BO0(Q))if(!JV8.call(J,Y)&&Y!==Z)le(J,Y,{get:()=>Q[Y],enumerable:!(X=tM8(Q,Y))||X.enumerable})}return J},vy=(J,Q,Z)=>(ew1(J,Q,"default"),Z&&ew1(Z,Q,"default")),Q4=(J,Q,Z)=>(Z=J!=null?oM8(eM8(J)):{},ew1(Q||!J||!J.__esModule?le(Z,"default",{value:J,enumerable:!0}):Z,J));var R6=B1(()=>{oM8=Object.create,le=Object.defineProperty,tM8=Object.getOwnPropertyDescriptor,BO0=Object.getOwnPropertyNames,eM8=Object.getPrototypeOf,JV8=Object.prototype.hasOwnProperty});var pj0={};w6(pj0,{default:()=>cN8});function pO0(J){return String(J).replace(qV8,(Q)=>KV8[Q])}function cO0(J){if(J.default)return J.default;var Q=J.type,Z=Array.isArray(Q)?Q[0]:Q;if(typeof Z!=="string")return Z.enum[0];switch(Z){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function lO0(J){for(var Q=0;Q<HR1.length;Q++){var Z=HR1[Q];for(var X=0;X<Z.blocks.length;X++){var Y=Z.blocks[X];if(J>=Y[0]&&J<=Y[1])return Z.name}}return null}function IR1(J){for(var Q=0;Q<X11.length;Q+=2)if(J>=X11[Q]&&J<=X11[Q+1])return!0;return!1}function iO0(J,Q){rz[J]=Q}function F11(J,Q,Z){if(!rz[Q])throw Error("Font metrics not found for font: "+Q+".");var X=J.charCodeAt(0),Y=rz[Q][X];if(!Y&&J[0]in MO0)X=MO0[J[0]].charCodeAt(0),Y=rz[Q][X];if(!Y&&Z==="text"){if(IR1(X))Y=rz[Q][77]}if(Y)return{depth:Y[0],height:Y[1],italic:Y[2],skew:Y[3],width:Y[4]}}function nO0(J){var Q;if(J>=5)Q=0;else if(J>=3)Q=1;else Q=2;if(!JR1[Q]){var Z=JR1[Q]={cssEmPerMu:ie.quad[Q]/18};for(var X in ie)if(ie.hasOwnProperty(X))Z[X]=ie[X][Q]}return JR1[Q]}function MR1(J){if(J instanceof QK)return J;else throw Error("Expected symbolNode but got "+String(J)+".")}function eO0(J){if(J instanceof uy)return J;else throw Error("Expected span<HtmlDomNode> but got "+String(J)+".")}function s(J,Q,Z,X,Y,K){if(Z4[J][Y]={font:Q,group:Z,replace:X},K&&X)Z4[J][X]=Z4[J][Y]}function W6(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:q}=J,G={type:Q,numArgs:X.numArgs,argTypes:X.argTypes,allowedInArgument:!!X.allowedInArgument,allowedInText:!!X.allowedInText,allowedInMath:X.allowedInMath===void 0?!0:X.allowedInMath,numOptionalArgs:X.numOptionalArgs||0,infix:!!X.infix,primitive:!!X.primitive,handler:Y};for(var z=0;z<Z.length;++z)Kj0[Z[z]]=G;if(Q){if(K)q11[Q]=K;if(q)G11[Q]=q}}function RM(J){var{type:Q,htmlBuilder:Z,mathmlBuilder:X}=J;W6({type:Q,names:[],props:{numArgs:0},handler(){throw Error("Should never be called.")},htmlBuilder:Z,mathmlBuilder:X})}function xy(J,Q){var Z=hW(["base"],J,Q),X=hW(["strut"]);if(X.style.height=s0(Z.height+Z.depth),Z.depth)X.style.verticalAlign=s0(-Z.depth);return Z.children.unshift(X),Z}function U11(J,Q){var Z=null;if(J.length===1&&J[0].type==="tag")Z=J[0].tag,J=J[0].body;var X=F5(J,Q,"root"),Y;if(X.length===2&&X[1].hasClass("tag"))Y=X.pop();var K=[],q=[];for(var G=0;G<X.length;G++)if(q.push(X[G]),X[G].hasClass("mbin")||X[G].hasClass("mrel")||X[G].hasClass("allowbreak")){var z=!1;while(G<X.length-1&&X[G+1].hasClass("mspace")&&!X[G+1].hasClass("newline"))if(G++,q.push(X[G]),X[G].hasClass("nobreak"))z=!0;if(!z)K.push(xy(q,Q)),q=[]}else if(X[G].hasClass("newline")){if(q.pop(),q.length>0)K.push(xy(q,Q)),q=[];K.push(X[G])}if(q.length>0)K.push(xy(q,Q));var U;if(Z)U=xy(F5(Z,Q,!0)),U.classes=["tag"],K.push(U);else if(Y)K.push(Y);var F=hW(["katex-html"],K);if(F.setAttribute("aria-hidden","true"),U){var W=U.children[0];if(W.style.height=s0(F.height+F.depth),F.depth)W.style.verticalAlign=s0(-F.depth)}return F}function CR1(J){return new my(J)}function LR1(J,Q,Z,X,Y){var K=bZ(J,Z),q;if(K.length===1&&K[0]instanceof eY&&X8.contains(["mrow","mtable"],K[0].type))q=K[0];else q=new f0.MathNode("mrow",K);var G=new f0.MathNode("annotation",[new f0.TextNode(Q)]);G.setAttribute("encoding","application/x-tex");var z=new f0.MathNode("semantics",[q,G]),U=new f0.MathNode("math",[z]);if(U.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),X)U.setAttribute("display","block");var F=Y?"katex":"katex-mathml";return Y0.makeSpan([F],[U])}function l8(J,Q){if(!J||J.type!==Q)throw Error("Expected node of type "+Q+", but got "+(J?"node of type "+J.type:String(J)));return J}function B11(J){var Q=py(J);if(!Q)throw Error("Expected node of symbol group type, but got "+(J?"node of type "+J.type:String(J)));return Q}function py(J){if(J&&(J.type==="atom"||vV8.hasOwnProperty(J.type)))return J;return null}function _R1(J,Q){var Z=F5(J.body,Q,!0);return zN8([J.mclass],Z,Q)}function xR1(J,Q){var Z,X=bZ(J.body,Q);if(J.mclass==="minner")Z=new f0.MathNode("mpadded",X);else if(J.mclass==="mord")if(J.isCharacterBox)Z=X[0],Z.type="mi";else Z=new f0.MathNode("mi",X);else{if(J.isCharacterBox)Z=X[0],Z.type="mo";else Z=new f0.MathNode("mo",X);if(J.mclass==="mbin")Z.attributes.lspace="0.22em",Z.attributes.rspace="0.22em";else if(J.mclass==="mpunct")Z.attributes.lspace="0em",Z.attributes.rspace="0.17em";else if(J.mclass==="mopen"||J.mclass==="mclose")Z.attributes.lspace="0em",Z.attributes.rspace="0em";else if(J.mclass==="minner")Z.attributes.lspace="0.0556em",Z.attributes.width="+0.1111em"}return Z}function Fj0(J,Q,Z){var X=UN8[J];switch(X){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return Z.callFunction(X,[Q[0]],[Q[1]]);case"\\uparrow":case"\\downarrow":{var Y=Z.callFunction("\\\\cdleft",[Q[0]],[]),K={type:"atom",text:X,mode:"math",family:"rel"},q=Z.callFunction("\\Big",[K],[]),G=Z.callFunction("\\\\cdright",[Q[1]],[]),z={type:"ordgroup",mode:"math",body:[Y,q,G]};return Z.callFunction("\\\\cdparent",[z],[])}case"\\\\cdlongequal":return Z.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var U={type:"textord",text:"\\Vert",mode:"math"};return Z.callFunction("\\Big",[U],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Wj0(J){var Q=[];J.gullet.beginGroup(),J.gullet.macros.set("\\cr","\\\\\\relax"),J.gullet.beginGroup();while(!0){Q.push(J.parseExpression(!1,"\\\\")),J.gullet.endGroup(),J.gullet.beginGroup();var Z=J.fetch().text;if(Z==="&"||Z==="\\\\")J.consume();else if(Z==="\\end"){if(Q[Q.length-1].length===0)Q.pop();break}else throw new l0("Expected \\\\ or \\cr or \\end",J.nextToken)}var X=[],Y=[X];for(var K=0;K<Q.length;K++){var q=Q[K],G=OO0();for(var z=0;z<q.length;z++)if(!jO0(q[z]))G.body.push(q[z]);else{X.push(G),z+=1;var U=B11(q[z]).text,F=[,,];if(F[0]={type:"ordgroup",mode:"math",body:[]},F[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(U)>-1);else if("<>AV".indexOf(U)>-1)for(var W=0;W<2;W++){var H=!0;for(var B=z+1;B<q.length;B++){if(FN8(q[B],U)){H=!1,z=B;break}if(jO0(q[B]))throw new l0("Missing a "+U+" character to complete a CD arrow.",q[B]);F[W].body.push(q[B])}if(H)throw new l0("Missing a "+U+" character to complete a CD arrow.",q[z])}else throw new l0('Expected one of "<>AV=|." after @',q[z]);var M=Fj0(U,F,J),V={type:"styling",body:[M],mode:"math",style:"display"};X.push(V),G=OO0()}if(K%2===0)X.push(G);else X.shift();X=[],Y.push(X)}J.gullet.endGroup(),J.gullet.endGroup();var N=Array(Y[0].length).fill({type:"align",align:"c",pregap:0.25,postgap:0.25});return{type:"array",mode:"math",body:Y,arraystretch:1,addJot:!0,rowGaps:[null],cols:N,colSeparationType:"CD",hLinesBeforeRow:Array(Y.length+1).fill([])}}function dy(J,Q){var Z=py(J);if(Z&&X8.contains(jN8,Z.text))return Z;else if(Z)throw new l0("Invalid delimiter '"+Z.text+"' after '"+Q.funcName+"'",J);else throw new l0("Invalid delimiter type '"+J.type+"'",J)}function RR1(J){if(!J.body)throw Error("Bug: The leftright ParseNode wasn't fully parsed.")}function eq(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:q}=J,G={type:Q,numArgs:X.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:Y};for(var z=0;z<Z.length;++z)$j0[Z[z]]=G;if(K)q11[Q]=K;if(q)G11[Q]=q}function j1(J,Q){Ej0[J]=Q}function OR1(J){var Q=[];J.consumeSpaces();var Z=J.fetch().text;if(Z==="\\relax")J.consume(),J.consumeSpaces(),Z=J.fetch().text;while(Z==="\\hline"||Z==="\\hdashline")J.consume(),Q.push(Z==="\\hdashline"),J.consumeSpaces(),Z=J.fetch().text;return Q}function V11(J){if(J.indexOf("ed")===-1)return J.indexOf("*")===-1}function uW(J,Q,Z){var{hskipBeforeAndAfter:X,addJot:Y,cols:K,arraystretch:q,colSeparationType:G,autoTag:z,singleRow:U,emptySingleRow:F,maxNumCols:W,leqno:H}=Q;if(J.gullet.beginGroup(),!U)J.gullet.macros.set("\\cr","\\\\\\relax");if(!q){var B=J.gullet.expandMacroAsText("\\arraystretch");if(B==null)q=1;else if(q=parseFloat(B),!q||q<0)throw new l0("Invalid \\arraystretch: "+B)}J.gullet.beginGroup();var M=[],V=[M],N=[],L=[],A=z!=null?[]:void 0;function w(){if(z)J.gullet.macros.set("\\@eqnsw","1",!0)}D(w,"beginRow");function R(){if(A)if(J.gullet.macros.get("\\df@tag"))A.push(J.subparse([new sz("\\df@tag")])),J.gullet.macros.set("\\df@tag",void 0,!0);else A.push(Boolean(z)&&J.gullet.macros.get("\\@eqnsw")==="1")}D(R,"endRow"),w(),L.push(OR1(J));while(!0){var O=J.parseExpression(!1,U?"\\end":"\\\\");if(J.gullet.endGroup(),J.gullet.beginGroup(),O={type:"ordgroup",mode:J.mode,body:O},Z)O={type:"styling",mode:J.mode,style:Z,body:[O]};M.push(O);var $=J.fetch().text;if($==="&"){if(W&&M.length===W)if(U||G)throw new l0("Too many tab characters: &",J.nextToken);else J.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.");J.consume()}else if($==="\\end"){if(R(),M.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(V.length>1||!F))V.pop();if(L.length<V.length+1)L.push([]);break}else if($==="\\\\"){J.consume();var j=void 0;if(J.gullet.future().text!==" ")j=J.parseSizeGroup(!0);N.push(j?j.value:null),R(),L.push(OR1(J)),M=[],V.push(M),w()}else throw new l0("Expected & or \\\\ or \\cr or \\end",J.nextToken)}return J.gullet.endGroup(),J.gullet.endGroup(),{type:"array",mode:J.mode,addJot:Y,arraystretch:q,body:V,cols:K,rowGaps:N,hskipBeforeAndAfter:X,hLinesBeforeRow:L,colSeparationType:G,tags:A,leqno:H}}function N11(J){if(J.slice(0,1)==="d")return"display";else return"text"}function mR1(J,Q,Z){var X=F5(J,Q,!1),Y=Q.sizeMultiplier/Z.sizeMultiplier;for(var K=0;K<X.length;K++){var q=X[K].classes.indexOf("sizing");if(q<0)Array.prototype.push.apply(X[K].classes,Q.sizingClasses(Z));else if(X[K].classes[q+1]==="reset-size"+Q.size)X[K].classes[q+1]="reset-size"+Z.size;X[K].height*=Y,X[K].depth*=Y}return Y0.makeFragment(X)}var oq,sz,l0,QV8,ZV8,XV8,YV8,KV8,qV8,dO0,GV8,zV8,UV8,X8,Z11,$R1,MM,ER1=0,Y11=1,eE=2,bW=3,hy=4,JK=5,JI=6,mQ=7,az,FV8,WV8,HV8,BV8,DV8,MV8,z8,HR1,X11,tE=80,VV8,NV8,LV8,AV8,wV8,RV8,OV8,jV8,$V8,DO0,EV8,my,rz,ie,MO0,JR1,IV8,VO0,NO0,aO0,BR1,PV8,rO0,f4,s0,LM,sO0,oO0,tO0,uy,PR1,TV8,CV8,QK,fW,AM,DR1,SV8,vV8,Z4,q1="math",_0="text",L1="main",g1="ams",E4="accent-token",L6="bin",uQ="close",QI="inner",G8="mathord",x7="op-token",oX="open",W11="punct",m1="rel",mW="spacing",s1="textord",Jj0,LO0='0123456789/@."',QR1,ne,AO0='0123456789!@*()-=+";:?/.,',ZR1,ae,K11="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ky,re,E8="",b4,aJ,_W,VM,VR1="ÐÞþ",_y,se,oe,wO0,kV8,H11,tq,_V8,xV8,bV8,yV8,fV8,TR1,xZ,Qj0,hV8,gV8,Zj0,mV8,uV8,pV8,dV8,te,Xj0,Yj0,cV8,Y0,y4,QA,xW,lV8,iV8,Kj0,q11,G11,z11,M7,hW,nV8,aV8,rV8,sV8,F5,RO0,qj0,oV8,NR1,gy,o9,eY,yy,tV8,f0,ZK,SR1,vR1,bZ,wM,a2,Gj0,zj0,eV8,JN8,QN8,ZN8,XN8,YN8,KN8,qN8,gW,kR1,Uj0,GN8,ee,zN8,D11,UN8,OO0,jO0,FN8,Hj0,Bj0,AR1,Dj0,WN8,Mj0,by,bR1,Vj0,HN8,BN8,Nj0,XR1,YR1,wR1=0.008,J11,DN8,MN8,Lj0,KR1=80,qR1=0.08,GR1,VN8,Aj0,NN8,wj0,fy,LN8,AN8,wN8,Rj0,RN8,Oj0,jj0,ON8,yW,$O0,jN8,yR1,fR1,$j0,Ej0,M11,oz,$N8,tz,Ij0,EO0,Pj0,Tj0,IO0,Cj0,hR1,gR1,PO0,TO0,Sj0,EN8,zR1,CO0,vj0,kj0,ZI,cy,IN8,PN8,_j0,TN8,SO0,CN8,vO0,SN8,xj0,UR1,FR1,kO0,_O0,xO0,vN8,bO0,yO0,NM,bj0=`[ \r
|
|
1987
|
+
`,mw1={spec:{name:Vl1,description:aD8,inputSchema:{type:"object",properties:{model:{type:"string",description:"The model name to use"},system:{type:"string",description:"The system message to provide context and instructions"},message:{type:"string",description:"The user message to send to the model"},contextFiles:{type:"array",items:{type:"string"},description:"Optional array of file paths or URIs to include as context"}},required:["model","system","message"]},source:"builtin"},fn:Promise.resolve().then(() => (yR0(),bR0)).then(({nodeChatLLMTool:J})=>J)}});function hR0(J){let Q=atob(J),Z=new Uint8Array(Q.length);for(let Y=0;Y<Q.length;Y++)Z[Y]=Q.charCodeAt(Y);return new TextDecoder("utf-8").decode(Z)}var gR0;var mR0=B1(()=>{Aq();H8();gR0={spec:{name:XS,description:"Run CI/CD checks (typechecker, linter, formatter, and tests) to validate the changes. Returns the success or failure status, plus the relevant log lines. If tree parameter is provided, checks will be run for that specific repository tree. Otherwise, checks will be run for the tree with the most changes or the first available tree.",inputSchema:{type:"object",properties:{tree:{type:"string",description:'URI of the specific tree/repository to run checks for (e.g., "file:///path/to/repo"). If not provided, will automatically select the most appropriate tree.'}},required:[],additionalProperties:!1},source:"builtin",meta:{disableTimeout:!0}},fn:DD({os:null,github:null,gitlab:null})}});var lR0={};w6(lR0,{nodeUndoEditTool:()=>GM8});import{writeFile as qM8}from"node:fs/promises";function zM8(J){if(typeof J!=="object"||J===null)throw Error("args must be an object. received instead: `"+JSON.stringify(J)+"`");if(typeof J.path!=="string")throw Error("path must be a string. received instead: `"+JSON.stringify(J.path)+"`")}var GM8=({args:J},{dir:Q,fileChangeTracker:Z})=>{return d6(async(X)=>{Jj(Q),zM8(J);let Y=TX(J.path);await YW(Y).acquire();try{let K=await Z.getLastEdit(Y);if(!K)return{status:"error",progress:{},error:{message:`No edit history found for file '${J.path}'.`}};let q=KW(K.newContent,K.oldContent,J.path),G=DV1(q);return await qM8(Y.fsPath,K.oldContent,{encoding:"utf-8",signal:X}),K.revert(),{status:"done",progress:{},result:G}}finally{YW(Y).release()}})};var iR0=B1(()=>{T0();Uz();r3();Us();CX()});var Sy;var tw1=B1(()=>{Sy={name:"mermaid",version:"11.6.0",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.0.4","@iconify/utils":"^2.1.33","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.11",dayjs:"^1.11.13",dompurify:"^3.2.4",katex:"^0.16.9",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^15.0.7",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.2","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",chokidar:"^4.0.3",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.0.2",jison:"^0.4.18","js-base64":"^3.7.7",jsdom:"^26.0.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.2",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.10","type-fest":"^4.35.0",typedoc:"^0.27.8","typedoc-plugin-markdown":"^4.4.2",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.0.2","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}}});var oM8,le,tM8,BO0,eM8,JV8,D=(J,Q)=>le(J,"name",{value:Q,configurable:!0}),J4=(J,Q)=>function(){return Q||(0,J[BO0(J)[0]])((Q={exports:{}}).exports,Q),Q.exports},nJ=(J,Q)=>{for(var Z in Q)le(J,Z,{get:Q[Z],enumerable:!0})},ew1=(J,Q,Z,X)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(let Y of BO0(Q))if(!JV8.call(J,Y)&&Y!==Z)le(J,Y,{get:()=>Q[Y],enumerable:!(X=tM8(Q,Y))||X.enumerable})}return J},vy=(J,Q,Z)=>(ew1(J,Q,"default"),Z&&ew1(Z,Q,"default")),Q4=(J,Q,Z)=>(Z=J!=null?oM8(eM8(J)):{},ew1(Q||!J||!J.__esModule?le(Z,"default",{value:J,enumerable:!0}):Z,J));var R6=B1(()=>{oM8=Object.create,le=Object.defineProperty,tM8=Object.getOwnPropertyDescriptor,BO0=Object.getOwnPropertyNames,eM8=Object.getPrototypeOf,JV8=Object.prototype.hasOwnProperty});var pj0={};w6(pj0,{default:()=>cN8});function pO0(J){return String(J).replace(qV8,(Q)=>KV8[Q])}function cO0(J){if(J.default)return J.default;var Q=J.type,Z=Array.isArray(Q)?Q[0]:Q;if(typeof Z!=="string")return Z.enum[0];switch(Z){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function lO0(J){for(var Q=0;Q<HR1.length;Q++){var Z=HR1[Q];for(var X=0;X<Z.blocks.length;X++){var Y=Z.blocks[X];if(J>=Y[0]&&J<=Y[1])return Z.name}}return null}function IR1(J){for(var Q=0;Q<X11.length;Q+=2)if(J>=X11[Q]&&J<=X11[Q+1])return!0;return!1}function iO0(J,Q){rz[J]=Q}function F11(J,Q,Z){if(!rz[Q])throw Error("Font metrics not found for font: "+Q+".");var X=J.charCodeAt(0),Y=rz[Q][X];if(!Y&&J[0]in MO0)X=MO0[J[0]].charCodeAt(0),Y=rz[Q][X];if(!Y&&Z==="text"){if(IR1(X))Y=rz[Q][77]}if(Y)return{depth:Y[0],height:Y[1],italic:Y[2],skew:Y[3],width:Y[4]}}function nO0(J){var Q;if(J>=5)Q=0;else if(J>=3)Q=1;else Q=2;if(!JR1[Q]){var Z=JR1[Q]={cssEmPerMu:ie.quad[Q]/18};for(var X in ie)if(ie.hasOwnProperty(X))Z[X]=ie[X][Q]}return JR1[Q]}function MR1(J){if(J instanceof QK)return J;else throw Error("Expected symbolNode but got "+String(J)+".")}function eO0(J){if(J instanceof uy)return J;else throw Error("Expected span<HtmlDomNode> but got "+String(J)+".")}function s(J,Q,Z,X,Y,K){if(Z4[J][Y]={font:Q,group:Z,replace:X},K&&X)Z4[J][X]=Z4[J][Y]}function W6(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:q}=J,G={type:Q,numArgs:X.numArgs,argTypes:X.argTypes,allowedInArgument:!!X.allowedInArgument,allowedInText:!!X.allowedInText,allowedInMath:X.allowedInMath===void 0?!0:X.allowedInMath,numOptionalArgs:X.numOptionalArgs||0,infix:!!X.infix,primitive:!!X.primitive,handler:Y};for(var z=0;z<Z.length;++z)Kj0[Z[z]]=G;if(Q){if(K)q11[Q]=K;if(q)G11[Q]=q}}function RM(J){var{type:Q,htmlBuilder:Z,mathmlBuilder:X}=J;W6({type:Q,names:[],props:{numArgs:0},handler(){throw Error("Should never be called.")},htmlBuilder:Z,mathmlBuilder:X})}function xy(J,Q){var Z=hW(["base"],J,Q),X=hW(["strut"]);if(X.style.height=s0(Z.height+Z.depth),Z.depth)X.style.verticalAlign=s0(-Z.depth);return Z.children.unshift(X),Z}function U11(J,Q){var Z=null;if(J.length===1&&J[0].type==="tag")Z=J[0].tag,J=J[0].body;var X=F5(J,Q,"root"),Y;if(X.length===2&&X[1].hasClass("tag"))Y=X.pop();var K=[],q=[];for(var G=0;G<X.length;G++)if(q.push(X[G]),X[G].hasClass("mbin")||X[G].hasClass("mrel")||X[G].hasClass("allowbreak")){var z=!1;while(G<X.length-1&&X[G+1].hasClass("mspace")&&!X[G+1].hasClass("newline"))if(G++,q.push(X[G]),X[G].hasClass("nobreak"))z=!0;if(!z)K.push(xy(q,Q)),q=[]}else if(X[G].hasClass("newline")){if(q.pop(),q.length>0)K.push(xy(q,Q)),q=[];K.push(X[G])}if(q.length>0)K.push(xy(q,Q));var U;if(Z)U=xy(F5(Z,Q,!0)),U.classes=["tag"],K.push(U);else if(Y)K.push(Y);var F=hW(["katex-html"],K);if(F.setAttribute("aria-hidden","true"),U){var W=U.children[0];if(W.style.height=s0(F.height+F.depth),F.depth)W.style.verticalAlign=s0(-F.depth)}return F}function CR1(J){return new my(J)}function LR1(J,Q,Z,X,Y){var K=bZ(J,Z),q;if(K.length===1&&K[0]instanceof eY&&X8.contains(["mrow","mtable"],K[0].type))q=K[0];else q=new f0.MathNode("mrow",K);var G=new f0.MathNode("annotation",[new f0.TextNode(Q)]);G.setAttribute("encoding","application/x-tex");var z=new f0.MathNode("semantics",[q,G]),U=new f0.MathNode("math",[z]);if(U.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),X)U.setAttribute("display","block");var F=Y?"katex":"katex-mathml";return Y0.makeSpan([F],[U])}function l8(J,Q){if(!J||J.type!==Q)throw Error("Expected node of type "+Q+", but got "+(J?"node of type "+J.type:String(J)));return J}function B11(J){var Q=py(J);if(!Q)throw Error("Expected node of symbol group type, but got "+(J?"node of type "+J.type:String(J)));return Q}function py(J){if(J&&(J.type==="atom"||vV8.hasOwnProperty(J.type)))return J;return null}function _R1(J,Q){var Z=F5(J.body,Q,!0);return zN8([J.mclass],Z,Q)}function xR1(J,Q){var Z,X=bZ(J.body,Q);if(J.mclass==="minner")Z=new f0.MathNode("mpadded",X);else if(J.mclass==="mord")if(J.isCharacterBox)Z=X[0],Z.type="mi";else Z=new f0.MathNode("mi",X);else{if(J.isCharacterBox)Z=X[0],Z.type="mo";else Z=new f0.MathNode("mo",X);if(J.mclass==="mbin")Z.attributes.lspace="0.22em",Z.attributes.rspace="0.22em";else if(J.mclass==="mpunct")Z.attributes.lspace="0em",Z.attributes.rspace="0.17em";else if(J.mclass==="mopen"||J.mclass==="mclose")Z.attributes.lspace="0em",Z.attributes.rspace="0em";else if(J.mclass==="minner")Z.attributes.lspace="0.0556em",Z.attributes.width="+0.1111em"}return Z}function Fj0(J,Q,Z){var X=UN8[J];switch(X){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return Z.callFunction(X,[Q[0]],[Q[1]]);case"\\uparrow":case"\\downarrow":{var Y=Z.callFunction("\\\\cdleft",[Q[0]],[]),K={type:"atom",text:X,mode:"math",family:"rel"},q=Z.callFunction("\\Big",[K],[]),G=Z.callFunction("\\\\cdright",[Q[1]],[]),z={type:"ordgroup",mode:"math",body:[Y,q,G]};return Z.callFunction("\\\\cdparent",[z],[])}case"\\\\cdlongequal":return Z.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var U={type:"textord",text:"\\Vert",mode:"math"};return Z.callFunction("\\Big",[U],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Wj0(J){var Q=[];J.gullet.beginGroup(),J.gullet.macros.set("\\cr","\\\\\\relax"),J.gullet.beginGroup();while(!0){Q.push(J.parseExpression(!1,"\\\\")),J.gullet.endGroup(),J.gullet.beginGroup();var Z=J.fetch().text;if(Z==="&"||Z==="\\\\")J.consume();else if(Z==="\\end"){if(Q[Q.length-1].length===0)Q.pop();break}else throw new l0("Expected \\\\ or \\cr or \\end",J.nextToken)}var X=[],Y=[X];for(var K=0;K<Q.length;K++){var q=Q[K],G=OO0();for(var z=0;z<q.length;z++)if(!jO0(q[z]))G.body.push(q[z]);else{X.push(G),z+=1;var U=B11(q[z]).text,F=[,,];if(F[0]={type:"ordgroup",mode:"math",body:[]},F[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(U)>-1);else if("<>AV".indexOf(U)>-1)for(var W=0;W<2;W++){var H=!0;for(var B=z+1;B<q.length;B++){if(FN8(q[B],U)){H=!1,z=B;break}if(jO0(q[B]))throw new l0("Missing a "+U+" character to complete a CD arrow.",q[B]);F[W].body.push(q[B])}if(H)throw new l0("Missing a "+U+" character to complete a CD arrow.",q[z])}else throw new l0('Expected one of "<>AV=|." after @',q[z]);var M=Fj0(U,F,J),V={type:"styling",body:[M],mode:"math",style:"display"};X.push(V),G=OO0()}if(K%2===0)X.push(G);else X.shift();X=[],Y.push(X)}J.gullet.endGroup(),J.gullet.endGroup();var N=Array(Y[0].length).fill({type:"align",align:"c",pregap:0.25,postgap:0.25});return{type:"array",mode:"math",body:Y,arraystretch:1,addJot:!0,rowGaps:[null],cols:N,colSeparationType:"CD",hLinesBeforeRow:Array(Y.length+1).fill([])}}function dy(J,Q){var Z=py(J);if(Z&&X8.contains(jN8,Z.text))return Z;else if(Z)throw new l0("Invalid delimiter '"+Z.text+"' after '"+Q.funcName+"'",J);else throw new l0("Invalid delimiter type '"+J.type+"'",J)}function RR1(J){if(!J.body)throw Error("Bug: The leftright ParseNode wasn't fully parsed.")}function eq(J){var{type:Q,names:Z,props:X,handler:Y,htmlBuilder:K,mathmlBuilder:q}=J,G={type:Q,numArgs:X.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:Y};for(var z=0;z<Z.length;++z)$j0[Z[z]]=G;if(K)q11[Q]=K;if(q)G11[Q]=q}function j1(J,Q){Ej0[J]=Q}function OR1(J){var Q=[];J.consumeSpaces();var Z=J.fetch().text;if(Z==="\\relax")J.consume(),J.consumeSpaces(),Z=J.fetch().text;while(Z==="\\hline"||Z==="\\hdashline")J.consume(),Q.push(Z==="\\hdashline"),J.consumeSpaces(),Z=J.fetch().text;return Q}function V11(J){if(J.indexOf("ed")===-1)return J.indexOf("*")===-1}function uW(J,Q,Z){var{hskipBeforeAndAfter:X,addJot:Y,cols:K,arraystretch:q,colSeparationType:G,autoTag:z,singleRow:U,emptySingleRow:F,maxNumCols:W,leqno:H}=Q;if(J.gullet.beginGroup(),!U)J.gullet.macros.set("\\cr","\\\\\\relax");if(!q){var B=J.gullet.expandMacroAsText("\\arraystretch");if(B==null)q=1;else if(q=parseFloat(B),!q||q<0)throw new l0("Invalid \\arraystretch: "+B)}J.gullet.beginGroup();var M=[],V=[M],N=[],L=[],A=z!=null?[]:void 0;function w(){if(z)J.gullet.macros.set("\\@eqnsw","1",!0)}D(w,"beginRow");function R(){if(A)if(J.gullet.macros.get("\\df@tag"))A.push(J.subparse([new sz("\\df@tag")])),J.gullet.macros.set("\\df@tag",void 0,!0);else A.push(Boolean(z)&&J.gullet.macros.get("\\@eqnsw")==="1")}D(R,"endRow"),w(),L.push(OR1(J));while(!0){var O=J.parseExpression(!1,U?"\\end":"\\\\");if(J.gullet.endGroup(),J.gullet.beginGroup(),O={type:"ordgroup",mode:J.mode,body:O},Z)O={type:"styling",mode:J.mode,style:Z,body:[O]};M.push(O);var $=J.fetch().text;if($==="&"){if(W&&M.length===W)if(U||G)throw new l0("Too many tab characters: &",J.nextToken);else J.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.");J.consume()}else if($==="\\end"){if(R(),M.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(V.length>1||!F))V.pop();if(L.length<V.length+1)L.push([]);break}else if($==="\\\\"){J.consume();var j=void 0;if(J.gullet.future().text!==" ")j=J.parseSizeGroup(!0);N.push(j?j.value:null),R(),L.push(OR1(J)),M=[],V.push(M),w()}else throw new l0("Expected & or \\\\ or \\cr or \\end",J.nextToken)}return J.gullet.endGroup(),J.gullet.endGroup(),{type:"array",mode:J.mode,addJot:Y,arraystretch:q,body:V,cols:K,rowGaps:N,hskipBeforeAndAfter:X,hLinesBeforeRow:L,colSeparationType:G,tags:A,leqno:H}}function N11(J){if(J.slice(0,1)==="d")return"display";else return"text"}function mR1(J,Q,Z){var X=F5(J,Q,!1),Y=Q.sizeMultiplier/Z.sizeMultiplier;for(var K=0;K<X.length;K++){var q=X[K].classes.indexOf("sizing");if(q<0)Array.prototype.push.apply(X[K].classes,Q.sizingClasses(Z));else if(X[K].classes[q+1]==="reset-size"+Q.size)X[K].classes[q+1]="reset-size"+Z.size;X[K].height*=Y,X[K].depth*=Y}return Y0.makeFragment(X)}var oq,sz,l0,QV8,ZV8,XV8,YV8,KV8,qV8,dO0,GV8,zV8,UV8,X8,Z11,$R1,MM,ER1=0,Y11=1,eE=2,bW=3,hy=4,JK=5,JI=6,mQ=7,az,FV8,WV8,HV8,BV8,DV8,MV8,z8,HR1,X11,tE=80,VV8,NV8,LV8,AV8,wV8,RV8,OV8,jV8,$V8,DO0,EV8,my,rz,ie,MO0,JR1,IV8,VO0,NO0,aO0,BR1,PV8,rO0,f4,s0,LM,sO0,oO0,tO0,uy,PR1,TV8,CV8,QK,fW,AM,DR1,SV8,vV8,Z4,q1="math",_0="text",L1="main",g1="ams",E4="accent-token",L6="bin",uQ="close",QI="inner",G8="mathord",x7="op-token",oX="open",W11="punct",m1="rel",mW="spacing",s1="textord",Jj0,LO0='0123456789/@."',QR1,ne,AO0='0123456789!@*()-=+";:?/.,',ZR1,ae,K11="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ky,re,E8="",b4,aJ,_W,VM,VR1="ÐÞþ",_y,se,oe,wO0,kV8,H11,tq,_V8,xV8,bV8,yV8,fV8,TR1,xZ,Qj0,hV8,gV8,Zj0,mV8,uV8,pV8,dV8,te,Xj0,Yj0,cV8,Y0,y4,QA,xW,lV8,iV8,Kj0,q11,G11,z11,M7,hW,nV8,aV8,rV8,sV8,F5,RO0,qj0,oV8,NR1,gy,o9,eY,yy,tV8,f0,ZK,SR1,vR1,bZ,wM,a2,Gj0,zj0,eV8,JN8,QN8,ZN8,XN8,YN8,KN8,qN8,gW,kR1,Uj0,GN8,ee,zN8,D11,UN8,OO0,jO0,FN8,Hj0,Bj0,AR1,Dj0,WN8,Mj0,by,bR1,Vj0,HN8,BN8,Nj0,XR1,YR1,wR1=0.008,J11,DN8,MN8,Lj0,KR1=80,qR1=0.08,GR1,VN8,Aj0,NN8,wj0,fy,LN8,AN8,wN8,Rj0,RN8,Oj0,jj0,ON8,yW,$O0,jN8,yR1,fR1,$j0,Ej0,M11,oz,$N8,tz,Ij0,EO0,Pj0,Tj0,IO0,Cj0,hR1,gR1,PO0,TO0,Sj0,EN8,zR1,CO0,vj0,kj0,ZI,cy,IN8,PN8,_j0,TN8,SO0,CN8,vO0,SN8,xj0,UR1,FR1,kO0,_O0,xO0,vN8,bO0,yO0,NM,bj0=`[ \r
|
|
1988
1988
|
]`,kN8="\\\\[a-zA-Z@]+",_N8="\\\\[^\uD800-\uDFFF]",xN8,bN8=`\\\\(
|
|
1989
1989
|
|[ \r ]+
|
|
1990
1990
|
?)[ \r ]*`,jR1="[̀-ͯ]",yN8,fN8,fO0,hN8,gN8,hO0,uR1,gO0,pR1,yj0,fj0,hj0,mN8,mO0,Q11,WR1,uO0,gj0,dR1,mj0,uN8,pN8,uj0,cR1,dN8,cN8;var dj0=B1(()=>{R6();oq=class J{static{D(this,"SourceLocation")}constructor(Q,Z,X){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=Q,this.start=Z,this.end=X}static range(Q,Z){if(!Z)return Q&&Q.loc;else if(!Q||!Q.loc||!Z.loc||Q.loc.lexer!==Z.loc.lexer)return null;else return new J(Q.loc.lexer,Q.loc.start,Z.loc.end)}},sz=class J{static{D(this,"Token")}constructor(Q,Z){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=Q,this.loc=Z}range(Q,Z){return new J(Z,oq.range(this,Q))}},l0=class J{static{D(this,"ParseError")}constructor(Q,Z){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var X="KaTeX parse error: "+Q,Y,K,q=Z&&Z.loc;if(q&&q.start<=q.end){var G=q.lexer.input;if(Y=q.start,K=q.end,Y===G.length)X+=" at end of input: ";else X+=" at position "+(Y+1)+": ";var z=G.slice(Y,K).replace(/[^]/g,"$&̲"),U;if(Y>15)U="…"+G.slice(Y-15,Y);else U=G.slice(0,Y);var F;if(K+15<G.length)F=G.slice(K,K+15)+"…";else F=G.slice(K);X+=U+z+F}var W=Error(X);if(W.name="ParseError",W.__proto__=J.prototype,W.position=Y,Y!=null&&K!=null)W.length=K-Y;return W.rawMessage=Q,W}};l0.prototype.__proto__=Error.prototype;QV8=D(function(Q,Z){return Q.indexOf(Z)!==-1},"contains"),ZV8=D(function(Q,Z){return Q===void 0?Z:Q},"deflt"),XV8=/([A-Z])/g,YV8=D(function(Q){return Q.replace(XV8,"-$1").toLowerCase()},"hyphenate"),KV8={"&":"&",">":">","<":"<",'"':""","'":"'"},qV8=/[&><"']/g;D(pO0,"escape");dO0=D(function J(Q){if(Q.type==="ordgroup")if(Q.body.length===1)return J(Q.body[0]);else return Q;else if(Q.type==="color")if(Q.body.length===1)return J(Q.body[0]);else return Q;else if(Q.type==="font")return J(Q.body);else return Q},"getBaseElem"),GV8=D(function(Q){var Z=dO0(Q);return Z.type==="mathord"||Z.type==="textord"||Z.type==="atom"},"isCharacterBox"),zV8=D(function(Q){if(!Q)throw Error("Expected non-null, but got "+String(Q));return Q},"assert"),UV8=D(function(Q){var Z=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(Q);if(!Z)return"_relative";if(Z[2]!==":")return null;if(!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(Z[1]))return null;return Z[1].toLowerCase()},"protocolFromUrl"),X8={contains:QV8,deflt:ZV8,escape:pO0,hyphenate:YV8,getBaseElem:dO0,isCharacterBox:GV8,protocolFromUrl:UV8},Z11={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:D((J)=>"#"+J,"cliProcessor")},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:D((J,Q)=>{return Q.push(J),Q},"cliProcessor")},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:D((J)=>Math.max(0,J),"processor"),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:D((J)=>Math.max(0,J),"processor"),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1000,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:D((J)=>Math.max(0,J),"processor"),cli:"-e, --max-expand <n>",cliProcessor:D((J)=>J==="Infinity"?1/0:parseInt(J),"cliProcessor")},globalGroup:{type:"boolean",cli:!1}};D(cO0,"getDefaultValue");$R1=class{static{D(this,"Settings")}constructor(J){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,J=J||{};for(var Q in Z11)if(Z11.hasOwnProperty(Q)){var Z=Z11[Q];this[Q]=J[Q]!==void 0?Z.processor?Z.processor(J[Q]):J[Q]:cO0(Z)}}reportNonstrict(J,Q,Z){var X=this.strict;if(typeof X==="function")X=X(J,Q,Z);if(!X||X==="ignore")return;else if(X===!0||X==="error")throw new l0("LaTeX-incompatible input and strict mode is set to 'error': "+(Q+" ["+J+"]"),Z);else if(X==="warn")typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(Q+" ["+J+"]"));else typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+X+"': "+Q+" ["+J+"]"))}useStrictBehavior(J,Q,Z){var X=this.strict;if(typeof X==="function")try{X=X(J,Q,Z)}catch(Y){X="error"}if(!X||X==="ignore")return!1;else if(X===!0||X==="error")return!0;else if(X==="warn")return typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(Q+" ["+J+"]")),!1;else return typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+X+"': "+Q+" ["+J+"]")),!1}isTrusted(J){if(J.url&&!J.protocol){var Q=X8.protocolFromUrl(J.url);if(Q==null)return!1;J.protocol=Q}var Z=typeof this.trust==="function"?this.trust(J):this.trust;return Boolean(Z)}},MM=class{static{D(this,"Style")}constructor(J,Q,Z){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=J,this.size=Q,this.cramped=Z}sup(){return az[FV8[this.id]]}sub(){return az[WV8[this.id]]}fracNum(){return az[HV8[this.id]]}fracDen(){return az[BV8[this.id]]}cramp(){return az[DV8[this.id]]}text(){return az[MV8[this.id]]}isTight(){return this.size>=2}},az=[new MM(ER1,0,!1),new MM(Y11,0,!0),new MM(eE,1,!1),new MM(bW,1,!0),new MM(hy,2,!1),new MM(JK,2,!0),new MM(JI,3,!1),new MM(mQ,3,!0)],FV8=[hy,JK,hy,JK,JI,mQ,JI,mQ],WV8=[JK,JK,JK,JK,mQ,mQ,mQ,mQ],HV8=[eE,bW,hy,JK,JI,mQ,JI,mQ],BV8=[bW,bW,JK,JK,mQ,mQ,mQ,mQ],DV8=[Y11,Y11,bW,bW,JK,JK,mQ,mQ],MV8=[ER1,Y11,eE,bW,eE,bW,eE,bW],z8={DISPLAY:az[ER1],TEXT:az[eE],SCRIPT:az[hy],SCRIPTSCRIPT:az[JI]},HR1=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];D(lO0,"scriptFromCodepoint");X11=[];HR1.forEach((J)=>J.blocks.forEach((Q)=>X11.push(...Q)));D(IR1,"supportedCodepoint");VV8=D(function(Q,Z){return"M95,"+(622+Q+Z)+`
|
|
@@ -6210,7 +6210,7 @@ See https://ampcode.com/manual#toolboxes`);return Q[0]||uR}function nZ6(J,Q){let
|
|
|
6210
6210
|
`;async function oZ6(J,Q,Z,X){let Y=performance.now(),K=[...a_(lM1(J)),{role:"user",parts:[{text:i59.replace("{USER_GOAL}",Q)}]}],q=await C$(fr,K,[],J,Z,X,{responseMimeType:"application/json",responseJsonSchema:M0.toJSONSchema(sZ6)}),G=sZ6.parse(JSON.parse(q.message.text??"")),z=performance.now()-Y;return l.debug("Thread handoff prepared",{threadId:J.id,goalLength:Q.length,instructionsLength:G.instructions.length,fileCount:G.relevantFiles.length,durationMs:Math.round(z)}),{instructions:G.instructions,relevantFiles:G.relevantFiles}}UL();H8();k6();function tZ6(J){let Q=J.trim();if(Q==="quit"||Q==="exit")return"/quit";return J}function eZ6(J,Q,Z){if(J.agentMode)return J.agentMode;if(Q?.agentMode){let X=Q.agentMode;if(X==="free"){if(Z?.canUseAmpFree??!1)return"free";return"smart"}return X}return"smart"}z0();lB();import n59 from"node:fs";import JX6 from"node:path";function QX6(J){let Q=J.trim().replace(/^["']|["']$/g,"");if(Q=Q.replace(/\\(.)/g,"$1"),!/\.(png|jpe?g|gif|webp)$/i.test(Q))return null;if(!JX6.isAbsolute(Q))return null;return l.debug("Extracted image path",{original:J,extracted:Q}),Q}function ZX6(J){try{let Q=JX6.extname(J).toLowerCase(),Z=_e1(Q);if(!Z)return l.warn("Unsupported image file extension",{ext:Q}),null;try{let X=n59.readFileSync(J);return a59(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 a59(J,Q){if(J.length>EF)return l.warn(`Image file too large: ${J.length} bytes (max: ${EF})`),null;return{type:"image",source:{type:"base64",data:J.toString("base64"),mediaType:Q}}}import{execSync as PK6}from"node:child_process";import{rmdir as pY9}from"node:fs/promises";import{tmpdir as dY9}from"node:os";import TK6 from"node:path";aO();z0();import{spawn as r59}from"node:child_process";import{promises as s59}from"node:fs";function XX6(J){return J.kind==="executable"}function YX6(J){return J.kind==="markdown"}var lH=50000,KX6=300000;async function Iy1(J,Q,Z,X={}){let{timeoutMs:Y=KX6,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}),YX6(q))return await o59(q,Q);else if(XX6(q))return await t59(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 o59(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Z=await s59.readFile(J.filePath,"utf8");return{success:!0,output:(Z.length>lH?Z.slice(0,lH)+`
|
|
6211
6211
|
... (output truncated at ${lH} characters)`:Z).trim(),exitCode:0}}catch(Z){return{success:!1,output:"",error:Z instanceof Error?Z.message:"Failed to read markdown file"}}}async function t59(J,Q,Z=KX6,X){return new Promise((Y)=>{let[K,q]=e59(J,Q);l.debug("Spawning command",{spawnCommand:K,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Z});let G=Ce1(X),z=!1,U=setTimeout(()=>{z=!0,G.abort(),l.warn("Command execution timed out",{commandName:J.name,timeoutMs:Z})},Z),F=r59(K,q,{stdio:["pipe","pipe","pipe"],signal:G.signal,detached:!0}),W=[],H=[],B=0;F.stdout?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=lH)W.push(V);else{let N=lH-(B-V.length);if(N>0)W.push(V.slice(0,N))}}),F.stderr?.on("data",(M)=>{let V=M.toString();if(B+=V.length,B<=lH)H.push(V);else{let N=lH-(B-V.length);if(N>0)H.push(V.slice(0,N))}}),F.on("close",(M)=>{if(clearTimeout(U),z){Y({success:!1,output:W.join(""),error:`Command timed out after ${Z}ms`,exitCode:void 0});return}if(G.signal.aborted){Y({success:!1,output:W.join(""),error:"The command was aborted",exitCode:M??void 0});return}let V=M===0||M===1,N=W.join(""),L=H.join(""),A=N;if(!V&&!N.trim()&&L.trim())A=L;else if(L.trim())A+=N?`
|
|
6212
6212
|
${L}`:L;if(B>lH)A+=`
|
|
6213
|
-
... (output truncated at ${lH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),F.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:W.join(""),error:V})})})}function e59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return QJ9(Z,X?[...X]:null,Y,Q);else return JJ9(Z,X?[...X]:null,Y,Q)}function JJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function QJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}z0();Tj();U2();IB();vY();hF();k6();T0();import{mkdtemp as cY9,readFile as lY9,unlink as iY9,writeFile as RR2}from"fs/promises";var H51={};w6(H51,{scrollUp:()=>RJ9,scrollDown:()=>OJ9,link:()=>TJ9,image:()=>CJ9,iTerm:()=>SJ9,exitAlternativeScreen:()=>IJ9,eraseUp:()=>wJ9,eraseStartLine:()=>LJ9,eraseScreen:()=>Py1,eraseLines:()=>VJ9,eraseLine:()=>UX6,eraseEndLine:()=>NJ9,eraseDown:()=>AJ9,enterAlternativeScreen:()=>EJ9,cursorUp:()=>GX6,cursorTo:()=>YJ9,cursorShow:()=>MJ9,cursorSavePosition:()=>UJ9,cursorRestorePosition:()=>FJ9,cursorPrevLine:()=>BJ9,cursorNextLine:()=>HJ9,cursorMove:()=>KJ9,cursorLeft:()=>zX6,cursorHide:()=>DJ9,cursorGetPosition:()=>WJ9,cursorForward:()=>GJ9,cursorDown:()=>qJ9,cursorBackward:()=>zJ9,clearTerminal:()=>$J9,clearScreen:()=>jJ9,beep:()=>PJ9});import Ty1 from"node:process";var W51=globalThis.window?.document!==void 0,RA2=globalThis.process?.versions?.node!==void 0,OA2=globalThis.process?.versions?.bun!==void 0,jA2=globalThis.Deno?.version?.deno!==void 0,$A2=globalThis.process?.versions?.electron!==void 0,EA2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,IA2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,PA2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,TA2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,CA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,_u=globalThis.navigator?.userAgentData?.platform,SA2=_u==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",vA2=_u==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",kA2=_u==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",_A2=_u==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),xA2=_u==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var N2="\x1B[",bu="\x1B]",WC="\x07",xu=";",qX6=!W51&&Ty1.env.TERM_PROGRAM==="Apple_Terminal",ZJ9=!W51&&Ty1.platform==="win32",XJ9=W51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Ty1.cwd,YJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return N2+(J+1)+"G";return N2+(Q+1)+xu+(J+1)+"H"},KJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=N2+-J+"D";else if(J>0)Z+=N2+J+"C";if(Q<0)Z+=N2+-Q+"A";else if(Q>0)Z+=N2+Q+"B";return Z},GX6=(J=1)=>N2+J+"A",qJ9=(J=1)=>N2+J+"B",GJ9=(J=1)=>N2+J+"C",zJ9=(J=1)=>N2+J+"D",zX6=N2+"G",UJ9=qX6?"\x1B7":N2+"s",FJ9=qX6?"\x1B8":N2+"u",WJ9=N2+"6n",HJ9=N2+"E",BJ9=N2+"F",DJ9=N2+"?25l",MJ9=N2+"?25h",VJ9=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=UX6+(Z<J-1?GX6():"");if(J)Q+=zX6;return Q},NJ9=N2+"K",LJ9=N2+"1K",UX6=N2+"2K",AJ9=N2+"J",wJ9=N2+"1J",Py1=N2+"2J",RJ9=N2+"S",OJ9=N2+"T",jJ9="\x1Bc",$J9=ZJ9?`${Py1}${N2}0f`:`${Py1}${N2}3J${N2}H`,EJ9=N2+"?1049h",IJ9=N2+"?1049l",PJ9=WC,TJ9=(J,Q)=>[bu,"8",xu,xu,Q,WC,J,bu,"8",xu,xu,WC].join(""),CJ9=(J,Q={})=>{let Z=`${bu}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+WC},SJ9={setCwd:(J=XJ9())=>`${bu}50;CurrentDir=${J}${WC}`,annotation(J,Q={}){let Z=`${bu}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+WC}};var B51=g6(VX6(),1);function aV(J,Q,{target:Z="stdout",...X}={}){if(!B51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return H51.link(J,Q)}aV.isSupported=B51.default.stdout;aV.stderr=(J,Q,Z={})=>aV(J,Q,{target:"stderr",...Z});aV.stderr.isSupported=B51.default.stderr;z0();vY();class _y1{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.1761091312-gbabab6"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await en(Q,this.configService)}catch(Q){l.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}import{execFile as M51}from"node:child_process";import{platform as xy1}from"node:os";import{promisify as xJ9}from"node:util";var D51=xJ9(M51),bJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,yJ9="\x1B]52;c;?\x1B\\",fJ9="\x1B]52;p;?\x1B\\";class NX6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await D51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=M51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=M51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=M51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery(yJ9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await D51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await D51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await D51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(fJ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(xy1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(xy1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=bJ9(Z);process.stdout.write(X);return}if(xy1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var WY=new NX6;z0();class V51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class c7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function LX6(J){if(J instanceof V51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof c7)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 QN=null,nY9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(QN)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(() => (db1(),uJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{QN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});QN=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{QN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,F=new URL(`/threads/${U}`,z).toString(),W=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => g6(Tf1(),1))).toString(F,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){l.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:W,qrCode:H});else return new c7(`Continue at ${W}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!QN)return new c7("Not connected to Amp web interface");try{QN.disconnect();let Z=QN.clientID;return QN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new c7(`Disconnected from Amp web interface
|
|
6213
|
+
... (output truncated at ${lH} characters)`;Y({success:V,output:A.trim(),error:!V?L.trim()||"Command failed":void 0,exitCode:M??void 0})}),F.on("error",(M)=>{clearTimeout(U);let V=M.message;if(z)V=`Command timed out after ${Z}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")V="The command was aborted";Y({success:!1,output:W.join(""),error:V})})})}function e59(J,Q){let{filePath:Z,interpreter:X,extension:Y}=J;if(process.platform==="win32")return QJ9(Z,X?[...X]:null,Y,Q);else return JJ9(Z,X?[...X]:null,Y,Q)}function JJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function QJ9(J,Q,Z,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Z.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}z0();Tj();U2();IB();vY();hF();k6();T0();import{mkdtemp as cY9,readFile as lY9,unlink as iY9,writeFile as RR2}from"fs/promises";var H51={};w6(H51,{scrollUp:()=>RJ9,scrollDown:()=>OJ9,link:()=>TJ9,image:()=>CJ9,iTerm:()=>SJ9,exitAlternativeScreen:()=>IJ9,eraseUp:()=>wJ9,eraseStartLine:()=>LJ9,eraseScreen:()=>Py1,eraseLines:()=>VJ9,eraseLine:()=>UX6,eraseEndLine:()=>NJ9,eraseDown:()=>AJ9,enterAlternativeScreen:()=>EJ9,cursorUp:()=>GX6,cursorTo:()=>YJ9,cursorShow:()=>MJ9,cursorSavePosition:()=>UJ9,cursorRestorePosition:()=>FJ9,cursorPrevLine:()=>BJ9,cursorNextLine:()=>HJ9,cursorMove:()=>KJ9,cursorLeft:()=>zX6,cursorHide:()=>DJ9,cursorGetPosition:()=>WJ9,cursorForward:()=>GJ9,cursorDown:()=>qJ9,cursorBackward:()=>zJ9,clearTerminal:()=>$J9,clearScreen:()=>jJ9,beep:()=>PJ9});import Ty1 from"node:process";var W51=globalThis.window?.document!==void 0,RA2=globalThis.process?.versions?.node!==void 0,OA2=globalThis.process?.versions?.bun!==void 0,jA2=globalThis.Deno?.version?.deno!==void 0,$A2=globalThis.process?.versions?.electron!==void 0,EA2=globalThis.navigator?.userAgent?.includes("jsdom")===!0,IA2=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,PA2=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,TA2=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,CA2=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,_u=globalThis.navigator?.userAgentData?.platform,SA2=_u==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",vA2=_u==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",kA2=_u==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",_A2=_u==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),xA2=_u==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var N2="\x1B[",bu="\x1B]",WC="\x07",xu=";",qX6=!W51&&Ty1.env.TERM_PROGRAM==="Apple_Terminal",ZJ9=!W51&&Ty1.platform==="win32",XJ9=W51?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:Ty1.cwd,YJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");if(typeof Q!=="number")return N2+(J+1)+"G";return N2+(Q+1)+xu+(J+1)+"H"},KJ9=(J,Q)=>{if(typeof J!=="number")throw TypeError("The `x` argument is required");let Z="";if(J<0)Z+=N2+-J+"D";else if(J>0)Z+=N2+J+"C";if(Q<0)Z+=N2+-Q+"A";else if(Q>0)Z+=N2+Q+"B";return Z},GX6=(J=1)=>N2+J+"A",qJ9=(J=1)=>N2+J+"B",GJ9=(J=1)=>N2+J+"C",zJ9=(J=1)=>N2+J+"D",zX6=N2+"G",UJ9=qX6?"\x1B7":N2+"s",FJ9=qX6?"\x1B8":N2+"u",WJ9=N2+"6n",HJ9=N2+"E",BJ9=N2+"F",DJ9=N2+"?25l",MJ9=N2+"?25h",VJ9=(J)=>{let Q="";for(let Z=0;Z<J;Z++)Q+=UX6+(Z<J-1?GX6():"");if(J)Q+=zX6;return Q},NJ9=N2+"K",LJ9=N2+"1K",UX6=N2+"2K",AJ9=N2+"J",wJ9=N2+"1J",Py1=N2+"2J",RJ9=N2+"S",OJ9=N2+"T",jJ9="\x1Bc",$J9=ZJ9?`${Py1}${N2}0f`:`${Py1}${N2}3J${N2}H`,EJ9=N2+"?1049h",IJ9=N2+"?1049l",PJ9=WC,TJ9=(J,Q)=>[bu,"8",xu,xu,Q,WC,J,bu,"8",xu,xu,WC].join(""),CJ9=(J,Q={})=>{let Z=`${bu}1337;File=inline=1`;if(Q.width)Z+=`;width=${Q.width}`;if(Q.height)Z+=`;height=${Q.height}`;if(Q.preserveAspectRatio===!1)Z+=";preserveAspectRatio=0";return Z+":"+Buffer.from(J).toString("base64")+WC},SJ9={setCwd:(J=XJ9())=>`${bu}50;CurrentDir=${J}${WC}`,annotation(J,Q={}){let Z=`${bu}1337;`,X=Q.x!==void 0,Y=Q.y!==void 0;if((X||Y)&&!(X&&Y&&Q.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(J=J.replaceAll("|",""),Z+=Q.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",Q.length>0)Z+=(X?[J,Q.length,Q.x,Q.y]:[Q.length,J]).join("|");else Z+=J;return Z+WC}};var B51=g6(VX6(),1);function aV(J,Q,{target:Z="stdout",...X}={}){if(!B51.default[Z]){if(X.fallback===!1)return J;return typeof X.fallback==="function"?X.fallback(J,Q):`${J} (${Q})`}return H51.link(J,Q)}aV.isSupported=B51.default.stdout;aV.stderr=(J,Q,Z={})=>aV(J,Q,{target:"stderr",...Z});aV.stderr.isSupported=B51.default.stderr;z0();vY();class _y1{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.1761120158-gccd64f"},parameters:{metadata:{count:Z}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await en(Q,this.configService)}catch(Q){l.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}import{execFile as M51}from"node:child_process";import{platform as xy1}from"node:os";import{promisify as xJ9}from"node:util";var D51=xJ9(M51),bJ9=(J)=>`\x1B]52;c;${J}\x1B\\`,yJ9="\x1B]52;c;?\x1B\\",fJ9="\x1B]52;p;?\x1B\\";class NX6{capabilities=null;pendingReadPromise=null;readResolve=null;readTimeout=null;setCapabilities(J){this.capabilities=J}isOsc52Supported(){return this.capabilities?.osc52??!1}async commandExists(J){try{return await D51("which",[J]),!0}catch{return!1}}async writeToPbcopy(J){try{let Q=M51("pbcopy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`pbcopy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToWlCopy(J){try{let Q=M51("wl-copy");return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`wl-copy exited with code ${Y}`))})}),!0}catch{return!1}}async writeToXclip(J){try{let Q=M51("xclip",["-selection","clipboard"]);return Q.stdin?.write(J),Q.stdin?.end(),await new Promise((Z,X)=>{Q.on("close",(Y)=>{if(Y===0)Z();else X(Error(`xclip exited with code ${Y}`))})}),!0}catch{return!1}}async readFromOSC52WithQuery(J){if(!this.isOsc52Supported())return null;if(this.pendingReadPromise)return this.pendingReadPromise;this.pendingReadPromise=new Promise((Z)=>{this.readResolve=Z,this.readTimeout=setTimeout(()=>{this.readResolve=null,this.pendingReadPromise=null,Z(null)},2000),process.stdout.write(J)});let Q=await this.pendingReadPromise;return this.pendingReadPromise=null,Q}async readFromOSC52(){return this.readFromOSC52WithQuery(yJ9)}handleOSC52Response(J){if(this.readResolve&&this.readTimeout){clearTimeout(this.readTimeout),this.readTimeout=null;try{let Q=Buffer.from(J,"base64").toString("utf8");this.readResolve(Q)}catch{this.readResolve(null)}this.readResolve=null,this.pendingReadPromise=null}}async readFromPbpaste(){try{let{stdout:J}=await D51("pbpaste");return J}catch{return null}}async readFromWlPaste(J){try{let Q=["--no-newline"];if(J==="primary")Q.push("--primary");let{stdout:Z}=await D51("wl-paste",Q);return Z}catch{return null}}async readFromXclip(J){try{let{stdout:Q}=await D51("xclip",["-selection",J,"-o"]);return Q}catch{return null}}async readFromOSC52Primary(){return this.readFromOSC52WithQuery(fJ9)}async readText(){if(this.isOsc52Supported()){let Q=await this.readFromOSC52();if(Q!==null)return Q}if(xy1()==="darwin"){let Q=await this.readFromPbpaste();if(Q!==null)return Q}else{if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("clipboard");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("clipboard");if(Q!==null)return Q}}return null}async readPrimarySelection(){if(xy1()==="darwin")return this.readText();if(this.isOsc52Supported()){let Q=await this.readFromOSC52Primary();if(Q!==null)return Q}if(await this.commandExists("wl-paste")){let Q=await this.readFromWlPaste("primary");if(Q!==null)return Q}if(await this.commandExists("xclip")){let Q=await this.readFromXclip("primary");if(Q!==null)return Q}return null}async writeText(J){if(this.isOsc52Supported()){let Z=Buffer.from(J).toString("base64"),X=bJ9(Z);process.stdout.write(X);return}if(xy1()==="darwin"){if(await this.writeToPbcopy(J))return}else{if(await this.commandExists("wl-copy")&&await this.writeToWlCopy(J))return;if(await this.commandExists("xclip")&&await this.writeToXclip(J))return}}}var WY=new NX6;z0();class V51 extends Error{constructor(J="Thread has no messages to compact"){super(J);this.name="NoMessagesToCompactError"}}class c7{message;name;constructor(J){this.message=J;this.name="InformationMessage"}}function LX6(J){if(J instanceof V51)return{title:"Cannot compact thread",description:"Thread has no messages to compact.",type:"error"};if(J instanceof c7)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 QN=null,nY9={connect:{name:"connect",description:"Connect CLI to web interface for current thread access",execute:async(J,Q)=>{try{if(QN)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(() => (db1(),uJ6)),q=await K({worker:J.worker},J.configService,{clientId:J.clientId,onUserDisconnect:()=>{QN=null,Z.sendStatus({connected:!1,enabled:!1,errorMessage:"Disconnected by user via web interface"})}});QN=q,q.promise.then(()=>{Z.sendStatus({connected:!0,errorMessage:void 0})}).catch((M)=>{QN=null,Z.sendStatus({connected:!1,errorMessage:M.message})});let z=(await J.configService.getLatest()).settings.url,U=J.worker.thread.id,F=new URL(`/threads/${U}`,z).toString(),W=new URL("/clients",z).toString(),H="";try{H=await(await Promise.resolve().then(() => g6(Tf1(),1))).toString(F,{type:"utf8",margin:2,color:{dark:"#000000",light:"#FFFFFF"}})}catch(M){l.error("Failed to generate QR code:",M)}if((process.stdout.rows||24)>=30&&H&&J.onShowQRCodeOverlay)J.onShowQRCodeOverlay({url:W,qrCode:H});else return new c7(`Continue at ${W}`)}catch(Z){return J.connectedClientsService.sendStatus({connected:!1,errorMessage:Z.message}),Error(`Failed to start connection: ${Z.message}`)}}},disconnect:{name:"disconnect",description:"Disconnect from web interface",execute:async(J,Q)=>{if(!QN)return new c7("Not connected to Amp web interface");try{QN.disconnect();let Z=QN.clientID;return QN=null,J.connectedClientsService.sendStatus({connected:!1,enabled:!1,errorMessage:void 0}),new c7(`Disconnected from Amp web interface
|
|
6214
6214
|
Client ID: ${Z}
|
|
6215
6215
|
Server will clean up automatically within 60 seconds`)}catch(Z){return Error(`Failed to disconnect: ${Z.message}`)}}}};class Cf1{configService;commands;customRegistry;latestCustom=[];telemetrySubmitter;constructor(J=QS(),Q){this.configService=Q;this.customRegistry=J,this._initBaseCommands(!1),this.customRegistry.commands.subscribe((Z)=>this.latestCustom=Z),this.telemetrySubmitter=new _y1(async()=>{try{return(await this.configService.getLatest()).settings["experimental.cli.commandTelemetry.enabled"]===!0}catch{return!1}},this.configService),this.configService.config.pipe(C0((Z)=>NB(Z.settings)),t6()).subscribe((Z)=>{this._initBaseCommands(Z.length>1)})}_initBaseCommands(J){if(this.commands={...aY9},process.env.AMP_CONNECT==="1")Object.assign(this.commands,nY9);if(J)Object.assign(this.commands,rY9)}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 Iy1(J,Z,this.customRegistry,{signal:X});if(q.success)if(K?.kind==="markdown"){Q.editorDispatch({type:"set-input",input:q.output});return}else{Q.submitMessage(q.output);return}return Error(q.error??`Command '${J}' failed`)}query(J,Q,Z){let X=J.toLowerCase(),Y=Object.values(this.commands).filter((q)=>q.name.toLowerCase().includes(X)).filter((q)=>{if(!Q||!q.isVisible)return!0;return q.isVisible(Q,Z)}),K=this.latestCustom.filter((q)=>q.available&&q.name.toLowerCase().includes(X)).map((q)=>({name:q.name,description:"Custom command",requiresArgs:q.kind==="executable",execute:(G,z)=>this.execute(q.name,G,z??[])}));return[...Y,...K]}async cleanup(){await this.telemetrySubmitter.dispose()}get(J){let Q=this.commands[J];if(Q)return Q;let Z=this.latestCustom.find((X)=>X.name===J);return{name:J,description:"Custom command",requiresArgs:Z?.kind==="executable",execute:(X,Y)=>this.execute(J,X,Y??[])}}}var aY9={"generate-agent-file":{name:"generate-agent-file",description:`Generate an ${X5} file in the current workspace`,execute:async(J,Q)=>{let Z=await J.configService.getLatest(),X=gq(Z.settings),K=J.getInMemoryAgentModeOverride()??X;J.worker.handle({type:"user:message",message:{content:[{type:"text",text:W90}],agentMode:K}});return}},compact:{name:"compact",description:"Compact the thread. Optional: /compact [message] to queue a message after compaction",execute:async(J,Q)=>{if(J.thread.messages.length===0)return new V51;if(Q&&Q.length>0){let X=[{type:"text",text:Q.join(" ").trim()}],Y=J.takeImageAttachments?.()??[];if(Y.length>0)X.push(...Y);J.worker.handle({type:"user:message-queue:enqueue",message:{content:X}})}try{await J.worker.summarizeThread(new AbortController().signal)}catch(Z){return Z instanceof Error?Z:Error("Failed to compact thread")}},isVisible:(J)=>J.agentMode!=="free"},editor:{name:"editor",description:"Open $EDITOR to write a prompt",launchesWindow:!0,execute:async(J,Q)=>{try{let Z=process.env.EDITOR||process.env.VISUAL||"nano",X=await cY9(TK6.join(dY9(),"amp-edit-")),Y=TK6.join(X,"message.amp.md");PK6(`${Z} "${Y}"`,{stdio:"inherit"}),process.stdout.write("\x1B[?25l");try{let q=(await lY9(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 iY9(Y),await pY9(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 oG("dangerouslyAllowAll",!1),new c7("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 oG("dangerouslyAllowAll",!0),new c7("Permissions disabled for this session - you will NOT be asked for confirmation before Amp runs a command.")}catch(K){return l.error("Failed to set dangerously allow all setting",K),Error("Failed to disable permissions for this session")}case"edit":break;default:return Error(`Invalid option: ${Y}. Use: on, off, or edit (or no argument for edit)`)}}let Z=await UC();if(Z===null)return Error("No editor found, please set $EDITOR to edit permissions");let X="";try{let Y={stdin:process.stdin,stdout:process.stdout,stderr:{write:(K)=>{return X=K.toString(),!0}},exit:(K)=>{if(K!==0)throw l.error("editPermissions exited with status",K),Error(X)},settingsFile:J.settingsFilePath,resolveEditor:UC};await z51(Y);return}catch(Y){l.error("failed to open permissions editor:",Y);let K=Y instanceof Error?`: ${Y.message}`:"";return Error(`Failed to open ${Z}${K}`)}finally{process.stdout.write("\x1B[?25l")}}},new:{name:"new",description:"Start a new thread",execute:async(J,Q)=>{try{await J.startNewThread();return}catch(Z){return l.error("Failed to start new thread",Z),Error("Failed to start new thread")}},isVisible:(J)=>J.messages.length!==0},handoff:{name:"handoff",description:"Start new focused thread with relevant files and prompt: /handoff <your goal>",statusMessage:"Handing off...",requiresArgs:!0,execute:async()=>{return},isVisible:(J)=>J.messages.length!==0&&J.agentMode!=="free"},continue:{name:"continue",description:"Continue an existing thread",requiresArgs:!1,requiresPicker:!0,execute:async(J,Q)=>{try{if(Q&&Q.length>0){let Z=Q[0]?.trim();if(!Z)return Error("Invalid thread ID provided");return await J.switchToThread(Z),new c7(`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(`
|
|
6216
6216
|
`).trim();await J.worker.handle({type:"user:message-queue:discard"}),J.editorDispatch({type:"set-input",input:Y})},isVisible:(J)=>(J.queuedMessages?.length??0)>0},share:{name:"share",description:"Set thread visibility - `/share private|workspace|group|public`",execute:async(J,Q)=>{let{thread:Z,threadSyncService:X,ampURL:Y}=J;if(!Q||Q.length===0)return Error("Please specify a visibility option: private, workspace, group, or public");let K=Cj(new URL(Y),Z.id).toString(),G=`Thread URL: ${aV(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 c7(`${G}
|
|
@@ -6419,7 +6419,7 @@ ${Q}`),this.textController.clear(),this.textController.insertText(this.pendingTr
|
|
|
6419
6419
|
`),J.stdout.write(`Thread: ${H}
|
|
6420
6420
|
`),J.stdout.write(`Continue this thread with: amp threads continue ${F}
|
|
6421
6421
|
`)}}function Au1(J){return J==="smart"?k1.rgb(3,197,97):J==="fast"?k1.rgb(228,180,2):J==="free"?k1.rgb(0,184,255):bW9(J)}function bW9(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])}rf1();if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){n7.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
|
|
6422
|
-
`)}var Ru1=wu1.join(nc1||wu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function mW9(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 rK(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")oG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new u9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${D8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")oG("experimental.agentMode",Q.agentMode)}async function ju1(J){try{await fW9(wu1.dirname(Ru1),{recursive:!0}),await hW9(Ru1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function uW9(){try{return(await mF6(Ru1,"utf-8")).trim()}catch(J){return null}}function pW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return nl1("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var fF6=[{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??uK,description:`Custom settings file path (overrides the default location ${uK})`},{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 ${kb1})`},{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:pK(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:kd}],hF6=(J)=>("deprecated"in J)&&J.deprecated===!0,dW9=(J)=>("hidden"in J)&&J.hidden===!0,cW9=(J)=>("default"in J),lW9=(J)=>("default"in J)?J.default:void 0;function iW9(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 u9(mK.unknownCommand(Z),1,q)}}var uF6=null;function gt2(){return uF6}function up(J){return{...J,getThreadEnvironment:b71,vfs:r20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new D_(J.fileSystem),generateThreadTitle:WG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var $u1=R0.file(gW9.homedir()),pF6=process.env.XDG_CONFIG_HOME?R0.file(process.env.XDG_CONFIG_HOME):x0.joinPath($u1,".config");async function sK(J,Q){oi1("0.0.
|
|
6422
|
+
`)}var Ru1=wu1.join(nc1||wu1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function mW9(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 rK(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")oG("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("tryGpt5")==="cli")throw new u9("The --try-gpt5 flag has been removed.",1,`GPT-5 is now available as the oracle. Read why: ${D8.blue("https://ampcode.com/news/gpt-5-oracle")}`);if(J.getOptionValueSourceWithGlobals("agentMode")==="cli")oG("experimental.agentMode",Q.agentMode)}async function ju1(J){try{await fW9(wu1.dirname(Ru1),{recursive:!0}),await hW9(Ru1,J,"utf-8")}catch(Q){l.debug("Failed to save last thread ID",Q)}}async function uW9(){try{return(await mF6(Ru1,"utf-8")).trim()}catch(J){return null}}function pW9(J,Q){return{...J,async get(Z){if(Z==="mcpServers"){let X=await J.get(Z);return nl1("mcpServers",{global:X,workspace:Q})}return J.get(Z)},async keys(){let Z=await J.keys();if(!Z.includes("mcpServers"))Z.push("mcpServers");return Z},[Symbol.dispose](){J[Symbol.dispose]()}}}var fF6=[{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??uK,description:`Custom settings file path (overrides the default location ${uK})`},{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 ${kb1})`},{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:pK(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration."},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection."},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"tryGpt5",long:"try-gpt5",type:"switch",default:!1,description:"[DEPRECATED] Try GPT-5 as the primary agent model (see https://ampcode.com/news/gpt-5-oracle)",deprecated:!0},{name:"agentMode",long:"agent-mode",type:"option",description:"Set the experimental agent mode configuration",hidden:!0,choices:kd}],hF6=(J)=>("deprecated"in J)&&J.deprecated===!0,dW9=(J)=>("hidden"in J)&&J.hidden===!0,cW9=(J)=>("default"in J),lW9=(J)=>("default"in J)?J.default:void 0;function iW9(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 u9(mK.unknownCommand(Z),1,q)}}var uF6=null;function gt2(){return uF6}function up(J){return{...J,getThreadEnvironment:b71,vfs:r20({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new D_(J.fileSystem),generateThreadTitle:WG0,deleteThread:(Q)=>J.threadHistoryService.delete(Q)}}var $u1=R0.file(gW9.homedir()),pF6=process.env.XDG_CONFIG_HOME?R0.file(process.env.XDG_CONFIG_HOME):x0.joinPath($u1,".config");async function sK(J,Q){oi1("0.0.1761120158-gccd64f");let Z=QX1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:e1.of([R0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:$u1,userConfigDir:pF6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (tJ1(),oJ1));X(Z);let Y=await Z.getLatest();l.debug("Global configuration initialized",{settingsKeys:Object.keys(Y.settings)});let K=Ma(zO({configService:Z})),q=E20({configService:Z,toolService:K}),G=_R0(K,T9,de).catch((w)=>{l.warn("Toolbox registration failed, continuing anyway:",w)}),z=q.initialized.catch((w)=>{l.warn("MCP service initialization failed, continuing anyway:",w)});if(J.executeMode)await Promise.all([z,G]);if(Q.jetbrains)WO("JetBrains");else if(Q.ide&&nQ6())WO("VS Code");else if(Q.ide&&aQ6())WO("Neovim");if(J.executeMode)ti1(!0);g96(K,{configService:Z});let U,F=v5.status.pipe(C0((w)=>Boolean(w.connected&&w.authenticated)),t6()).subscribe((w)=>{if(w){if(!U)U=K.registerTool(zs)}else U?.dispose(),U=void 0}),W;if(!J.executeMode)W=new r71(process.cwd(),{},!0);else W=new class extends r71{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(x2.write(`No API key found. Starting login flow...
|
|
6423
6423
|
`),!await nW9(J))await tw(),process.exit(1)}let H=await J40({isDevelopment:!1}),B=new SH1(H),M=new PH1(H,Z,{lazy:!0}),V=Q.notifications!==void 0?Q.notifications:!J.executeMode,N=u96({playNotificationSound:async(w)=>{if(V){m96(w);let R=nf1(),O=af1();if((!R||O)&&Y.settings["notifications.system.enabled"]!==!1){if(w==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(w==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:B,configService:Z});l.info("Starting Amp background services");let L=K40({threadService:B,threadHistoryService:M,configService:Z,isExtensionDevelopment:!1}),A={configService:Z,toolService:K,mcpService:q,threadService:B,threadHistoryService:M,threadSyncService:L,threadStorage:H,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:W,notificationService:N,fileSystem:Q.jetbrains||Q.ide?i20:T9};return{...A,async asyncDispose(){await A.mcpService.dispose(),await A.threadService.asyncDispose(),A.configService.unsubscribe(),A.toolService.dispose(),A.fuzzyServer.dispose(),A.threadSyncService.dispose(),A.settingsStorage[Symbol.dispose](),F.unsubscribe(),U?.dispose()}}}async function nW9(J){if(!J.executeMode){if(!await Ay1("Would you like to log in to Amp? [(y)es, (n)o]: "))return x2.write(`Login cancelled. Run the command again to retry.
|
|
6424
6424
|
`),!1}return await dF6(J)}async function dF6(J){let Q=yW9(32).toString("hex"),Z=await Ly1(J.ampURL,Q);try{await cK(Z)}catch(Y){l.error("Failed to open browser",{error:Y})}let X=await Ly1(J.ampURL,Q,!1);x2.write(`If your browser did not open automatically, visit:
|
|
6425
6425
|
|
|
@@ -6429,12 +6429,12 @@ ${D8.blue.bold(X)}
|
|
|
6429
6429
|
Login successful! You can now use the Amp CLI.
|
|
6430
6430
|
`),!0}catch(Y){return l.error("Login failed",{error:Y}),n7.write(`
|
|
6431
6431
|
Login failed: ${Y instanceof Error?Y.message:String(Y)}
|
|
6432
|
-
`),!1}}function aW9(){let J=new q71().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)QR(),process.exit(0);let H=W.originalError??W;cJ6(H)}),J.option("-V, --version","output the version number",()=>{x2.write(`0.0.
|
|
6433
|
-
`),process.exit(0)}),J.addHelpText("after",cQ6()),J.configureHelp({formatHelp:lQ6}),J.command("logout").description("Log out by removing stored API key").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await tW9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await oW9(M,await qy1(B,M.settings))});let Q=async(W,H,B)=>{QX1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([R0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:$u1,userConfigDir:pF6});let M={...H,executeMode:!1};await Ou1(M,{...W,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await gF6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await qH9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);if(H.pick)await Q(M,V,B);else await KH9(M,V,W,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await YH9(M,V,W,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await gF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await XH9(M,V,W,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await JH9(M,V,W,B)}),Z.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(W,H,B,M)=>{let V=M.optsWithGlobals(),N=await FZ(V);await QH9(V,N,W,H,M)}),Z.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await ZH9(M,V,W,B)}),nZ6(J,async(W,H)=>{let B=await FZ(H);rK(W,H);let M=await sK(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:QR,asyncDispose:M.asyncDispose.bind(M)}}),OZ6(J),DZ6(J,async(W)=>{let H=await FZ(W);return{settings:H.settings,getThreadDeps:async(B)=>{rK(B,W);let M=await sK(H,W);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);rK(H,B);let V=await sK(M,B);try{await pb1(V,V.configService,{})}finally{await V.asyncDispose(),await QR()}});let X=new q71().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(W)=>{await By1(W.force||!1,W.verbose||!1,"0.0.
|
|
6432
|
+
`),!1}}function aW9(){let J=new q71().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((W)=>{if(W.code==="commander.help"||W.code==="commander.version"||W.exitCode===0)QR(),process.exit(0);let H=W.originalError??W;cJ6(H)}),J.option("-V, --version","output the version number",()=>{x2.write(`0.0.1761120158-gccd64f (released 2025-10-22T08:07:52.820Z)
|
|
6433
|
+
`),process.exit(0)}),J.addHelpText("after",cQ6()),J.configureHelp({formatHelp:lQ6}),J.command("logout").description("Log out by removing stored API key").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await tW9(M)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await oW9(M,await qy1(B,M.settings))});let Q=async(W,H,B)=>{QX1({storage:H.settings,secretStorage:H.secrets,workspaceRoots:e1.of([R0.file(process.cwd())]),defaultAmpURL:H.ampURL,homeDir:$u1,userConfigDir:pF6});let M={...H,executeMode:!1};await Ou1(M,{...W,startWithPicker:!0},B)},Z=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await gF6(B,M,H)});Z.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await qH9(B,M,H)}),Z.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. If no thread ID is provided, the most recently used thread will be continued.").option("--pick","Pick a thread interactively from a list").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);if(H.pick)await Q(M,V,B);else await KH9(M,V,W,B)}),Z.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await YH9(M,V,W,B)}),Z.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);await gF6(B,M,H)}),Z.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").option("--support","Share thread with Amp support for debugging").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await XH9(M,V,W,B,H.support)}),Z.command("compact <threadId>").alias("co").summary("Compact a thread").description("Compact a thread by creating a summary of the conversation history. This reduces the thread size while preserving the key information and context, making it more token efficient for future use.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await JH9(M,V,W,B)}),Z.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(W,H,B,M)=>{let V=M.optsWithGlobals(),N=await FZ(V);await QH9(V,N,W,H,M)}),Z.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(W,H,B)=>{let M=B.optsWithGlobals(),V=await FZ(M);await ZH9(M,V,W,B)}),nZ6(J,async(W,H)=>{let B=await FZ(H);rK(W,H);let M=await sK(B,H);return{context:B,mcpService:M.mcpService,toolService:M.toolService,configService:M.configService,cleanupTerminal:QR,asyncDispose:M.asyncDispose.bind(M)}}),OZ6(J),DZ6(J,async(W)=>{let H=await FZ(W);return{settings:H.settings,getThreadDeps:async(B)=>{rK(B,W);let M=await sK(H,W);return{mcpService:M.mcpService,asyncDispose:M.asyncDispose.bind(M)}}}}),J.command("connect").description("Connect CLI to web interface for multi-thread management").action(async(W,H)=>{let B=H.optsWithGlobals(),M=await FZ(B);rK(H,B);let V=await sK(M,B);try{await pb1(V,V.configService,{})}finally{await V.asyncDispose(),await QR()}});let X=new q71().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(W)=>{await By1(W.force||!1,W.verbose||!1,"0.0.1761120158-gccd64f"),process.exit()});J.addCommand(X,{hidden:!0});function Y(W,H,B){let V=typeof W.description==="string"?W.description:B===void 0?W.description(!0):W.description(B),N=new yV(H,V),L=lW9(W);if(L)N.default(L);if(N.hidden=dW9(W)||hF6(W),"choices"in W)N.choices([...W.choices]);return N}for(let W of fF6)switch(W.type){case"flag":{J.addOption(Y(W,`--${W.long}`)),J.addOption(Y(W,`--no-${W.long}`,!1));break}case"switch":{J.addOption(Y(W,`--${W.long}`,!0));break}default:{J.addOption(Y(W,`--${W.long} <value>`));break}}let K=new yV("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(K);let q=new yV("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(q);let G=new yV("--stream-json","When used with --execute, output in Claude Code compatible stream JSON format instead of plain text.").default(!1);J.addOption(G);let z=new yV("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(z);let U=new yV("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(U),process.env.AMP_CONNECT==="1"){let W=new yV("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(W)}J.action(async(W,H)=>{let B=W,M=await FZ(B);if(Object.keys(B).forEach((V)=>{let N=fF6.find((L)=>L.name===V);if(N&&hF6(N)&&!cW9(N))n7.write(D8.yellow(`Warning: '--${V}' flag is deprecated
|
|
6434
6434
|
`))}),H.args.length>0)iW9(M,H);await Ou1(M,B,H)});let F=new q71("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--version <version>","Update to a specific version").allowUnknownOption(!1).action(async(W)=>{await eW9(W.version)});return J.addCommand(F),J}async function eJ1(J,Q){let{thread:Z,visibility:X}=Q,Y=Z?.id??Gq(),K=up(J);if(Z)await J.threadStorage.set(Y,Z);let q=await m5.getOrCreateForThread(K,Y);if(X)await J.threadSyncService.updateThreadMeta(Y,q51(X));let G=J.threadService.observe(Y).subscribe(async(z)=>{if(r7(z,"assistant"))await ju1(Y),G.unsubscribe()});return await q.resume(),q}async function Ou1(J,Q,Z){let X=K51(Q);if(X instanceof Error)VQ(X.message);let Y,K=null;if(Q.streamJsonInput)Y="";else if(typeof Q.execute==="string"){Y=Q.execute;let R=(await Ry1()).trimEnd();if(R)K=R}else Y=(await Ry1()).trimEnd();if(Q.remote&&!J.executeMode)throw new u9("The -r/--remote flag currently only works with --execute mode",1,'Use: amp --remote --execute "your message"');if(Q.streamJson&&!J.executeMode)throw new u9("The --stream-json flag requires --execute mode",1,'Use: amp --execute "your message" --stream-json');if(Q.streamJsonInput&&!J.executeMode)throw new u9("The --stream-json-input flag requires --execute mode",1,"Use: amp --execute --stream-json --stream-json-input");if(Q.streamJsonInput&&!Q.streamJson)throw new u9("The --stream-json-input flag requires --stream-json",1,"Use: amp --execute --stream-json --stream-json-input");if((J.executeMode||Q.streamJson)&&Q.agentMode&&Q.agentMode!=="smart")throw new u9(`Execute mode is not permitted with --agent-mode '${Q.agentMode}'`,1);if(Q.stats&&!J.executeMode)throw new u9("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 u9("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 u9("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"
|
|
6435
6435
|
Or pipe via stdin: echo "your message" | amp --execute`);rK(Z,Q);let q=await sK(J,Q);uF6=q;let G=up(q),z=async(R)=>{let O=await mF6(R,"utf-8"),$=JSON.parse(O);if(!WF($.id))throw new u9(mK.invalidThreadId);return eJ1(q,{visibility:X,thread:$})},U=async(R)=>{if(!WF(R))throw new u9(mK.invalidThreadId);let O=await q.threadService.get(R)??void 0;if(l.info(`[fetchAndStartThread] Loaded thread ${R}, agentMode: ${O?.agentMode??"undefined"}`),O?.agentMode)l.info(`[fetchAndStartThread] Setting runtime override for agentMode to: ${O.agentMode}`),oG("experimental.agentMode",O.agentMode);else l.info("[fetchAndStartThread] No agentMode on thread, not setting override");return eJ1(q,{visibility:X,thread:O})},F=async()=>{try{if(Q.threadId)return U(Q.threadId);else return eJ1(q,{visibility:X})}catch(R){if(R instanceof u9)throw R;throw await u71(R,Q.threadId),Error("handleError should have called process.exit()")}},W=async()=>{return eJ1(q,{visibility:X})};if(Q.format==="jsonl")n7.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
|
|
6436
|
-
`),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await jZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await F();if(J.executeMode)await XQ6(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 Dr1();let R=await EO({jetbrainsOnly:Q.jetbrains});if(R.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(R.length===1){let O=R[0];if(O)v5.selectConfig(O)}else B=!0}let V=Vy1("0.0.
|
|
6437
|
-
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await cU({...J,getHook:process.env.AMP_URL?(q,G)=>{if(q==="url")return Promise.resolve(process.env.AMP_URL);return G()}:void 0});if(J.mcpConfig){let q=await MZ6(J.mcpConfig);X=pW9(X,q)}let Y=await X.get("url","global");if(!Y)Y=HZ;if(!LB(Y))l.info("Targeting custom Amp server",{ampURL:Y});if(X=Bl1(X),await X.get("debug.httpLogging"))Fl1();return{executeMode:Q,isTTY:Z,ampURL:Y,settings:X,secrets:$Z6(await qy1(J,X))}}function rW9(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 sW9(){let J=rW9(process.argv);if(EJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),mW9(l),l.info("Starting Amp CLI.",{version:"0.0.
|
|
6436
|
+
`),await tw(),process.exit(1);if(J.executeMode&&Q.remote)await jZ6(Y,K,q.configService),await q.asyncDispose(),process.exit(0);let H=await F();if(J.executeMode)await XQ6(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 Dr1();let R=await EO({jetbrainsOnly:Q.jetbrains});if(R.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(R.length===1){let O=R[0];if(O)v5.selectConfig(O)}else B=!0}let V=Vy1("0.0.1761120158-gccd64f",q.settingsStorage),N=e1.of([R0.file(process.cwd())]),L=QS(void 0,N);if(Y)H.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}});let A;try{A=await KJ.getUserFreeTierStatus({},{config:q.configService})}catch(R){A={ok:!1,error:R}}l.info("User free tier status:",A);let w=await PZ6();l.info("Loaded session state:",w),await yF6({stdout:process.stdout,history:new nb1,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadSyncService:q.threadSyncService,threadID:H.threadID,worker:H,workerDeps:G,configService:q.configService,internalAPIClient:KJ,ampURL:J.ampURL,startNewThread:W,pickAndContinueThread:async()=>{l.info("Thread picker requested - not yet implemented in TUI")},switchToThread:U,ideClient:v5,connectedClientsService:new Kc,commandRegistry:L,showJetBrainsInstaller:M,showIdePicker:B,startWithPicker:Q.startWithPicker,updateService:V,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:w,freeTierStatus:A.ok?A.result:void 0}),await q.asyncDispose(),process.exit(0)}async function FZ(J){if(J.interactive)n7.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
|
|
6437
|
+
`);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Z=process.stdout.isTTY&&process.stderr.isTTY,X=await cU({...J,getHook:process.env.AMP_URL?(q,G)=>{if(q==="url")return Promise.resolve(process.env.AMP_URL);return G()}:void 0});if(J.mcpConfig){let q=await MZ6(J.mcpConfig);X=pW9(X,q)}let Y=await X.get("url","global");if(!Y)Y=HZ;if(!LB(Y))l.info("Targeting custom Amp server",{ampURL:Y});if(X=Bl1(X),await X.get("debug.httpLogging"))Fl1();return{executeMode:Q,isTTY:Z,ampURL:Y,settings:X,secrets:$Z6(await qy1(J,X))}}function rW9(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 sW9(){let J=rW9(process.argv);if(EJ6({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),mW9(l),l.info("Starting Amp CLI.",{version:"0.0.1761120158-gccd64f",buildTimestamp:"2025-10-22T08:07:52.820Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new u9(mK.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await aW9().parseAsync(process.argv)}sW9().catch(u71);async function oW9(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),x2.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
|
|
6438
6438
|
`);else if(!LB(J.ampURL))x2.write(`Logging in to ${new URL(J.ampURL).hostname}
|
|
6439
6439
|
`);let Z=process.env.AMP_API_KEY;if(Z)x2.write(`API key found in environment variable, storing...
|
|
6440
6440
|
`),await Q.set("apiKey",Z,J.ampURL),x2.write(`API key successfully stored.
|
|
@@ -6450,7 +6450,7 @@ Or pipe via stdin: echo "your message" | amp --execute`);rK(Z,Q);let q=await sK(
|
|
|
6450
6450
|
`));try{let Q;if(J)Q=J,n7.write(D8.blue(`Updating to version ${J}...
|
|
6451
6451
|
`)),await GC(J),n7.write(D8.green(`✓ Successfully updated to version ${J}
|
|
6452
6452
|
`));else{n7.write(D8.blue(`Checking for updates...
|
|
6453
|
-
`));let{hasUpdate:X,latestVersion:Y}=await Z71("0.0.
|
|
6453
|
+
`));let{hasUpdate:X,latestVersion:Y}=await Z71("0.0.1761120158-gccd64f");if(!X)n7.write(D8.green(`✓ Amp CLI is already up to date.
|
|
6454
6454
|
`)),process.exit(0);if(!Y)n7.write(D8.yellow("[WARN] could not find latest version")),process.exit(0);Q=Y,n7.write(D8.blue(`Updating to version ${Y}...
|
|
6455
6455
|
`)),await GC(Y),n7.write(D8.green(`✓ Successfully updated to version ${Y}
|
|
6456
6456
|
`))}let Z=await KR(Q);if(Z.warning)n7.write(`
|
package/package.json
CHANGED