@netlify/agent-runner-cli 1.152.0-EX-2670.1 → 1.152.0

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/bin-local.js CHANGED
@@ -99,7 +99,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
99
99
  `,LF:`
100
100
  `,concatBytes:xL},bLe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},TLe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:bLe};import{Buffer as ALe}from"buffer";var jte=(t,e)=>t?void 0:xLe.bind(void 0,e),xLe=function*(t,e){if(typeof e!="string"&&!Bt(e)&&!ALe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},zte=(t,e)=>t?wLe.bind(void 0,e):RLe.bind(void 0,e),wLe=function*(t,e){Gte(t,e),yield e},RLe=function*(t,e){if(Gte(t,e),typeof e!="string"&&!Bt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},Gte=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
101
101
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
102
- if (condition) { yield value; }`)};import{Buffer as ILe}from"buffer";import{StringDecoder as CLe}from"string_decoder";var ax=(t,e,r)=>{if(r)return;if(t)return{transform:PLe.bind(void 0,new TextEncoder)};let n=new CLe(e);return{transform:OLe.bind(void 0,n),final:NLe.bind(void 0,n)}},PLe=function*(t,e){ILe.isBuffer(e)?yield ms(e):typeof e=="string"?yield t.encode(e):yield e},OLe=function*(t,e){yield Bt(e)?t.write(e):e},NLe=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as qte}from"util";var RL=qte(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=MLe}=e[r];for await(let i of n(t))yield*cx(i,e,r+1)},Vte=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*kLe(r,Number(e),t)},kLe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cx(n,r,e+1)},Hte=qte(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),MLe=function*(t){yield t};var IL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Wte=(t,e)=>[...e.flatMap(r=>[...Cl(r,t,0)]),...x_(t)],Cl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=LLe}=e[r];for(let i of n(t))yield*Cl(i,e,r+1)},x_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*DLe(r,Number(e),t)},DLe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Cl(n,r,e+1)},LLe=function*(t){yield t};var CL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Kte(t,s,o),l=Il(e),u=Il(r),d=l?RL.bind(void 0,cx,a):IL.bind(void 0,Cl),f=l||u?RL.bind(void 0,Vte,a):IL.bind(void 0,x_),p=l||u?Hte.bind(void 0,a):void 0;return{stream:new $Le({writableObjectMode:n,writableHighWaterMark:Yte(n),readableObjectMode:i,readableHighWaterMark:Yte(i),transform(m,E,b){d([m,c,0],this,b)},flush(m){f([c],this,m)},destroy:p})}},lx=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=Kte(s,r,a);t=Wte(c,t)}return t},Kte=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:jte(n,a)},ax(r,s,n),sx(r,o,n,c),{transform:t,final:e},{transform:zte(i,a)},Bte({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Zte=(t,e)=>{for(let r of ULe(t))FLe(t,r,e)},ULe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),FLe=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>BLe(a,n));r.input=m_(s)},BLe=(t,e)=>{let r=lx(t,e,"utf8",!0);return jLe(r),m_(r)},jLe=t=>{let e=t.find(r=>typeof r!="string"&&!Bt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as VLe,appendFileSync as HLe}from"fs";var ux=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&nf(r,n)&&!gn.has(e)&&zLe(n)&&(t.some(({type:i,value:o})=>i==="native"&&GLe.has(o))||t.every(({type:i})=>Yn.has(i))),zLe=t=>t===1||t===2,GLe=new Set(["pipe","overlapped"]),Jte=async(t,e,r,n)=>{for await(let i of t)qLe(e)||Qte(i,r,n)},Xte=(t,e,r)=>{for(let n of t)Qte(n,e,r)},qLe=t=>t._readableState.pipes.length>0,Qte=(t,e,r)=>{let n=AA(t);po({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var ere=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>WLe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},WLe=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=tte(t,o,d),p=ms(f),{stdioItems:h,objectMode:m}=e[r],E=YLe([p],h,c,n),{serializedResult:b,finalResult:v=b}=KLe({chunks:E,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});ZLe({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?v:void 0;try{return n.error===void 0&&JLe(b,h,i),A}catch(_){return n.error=_,A}},YLe=(t,e,r,n)=>{try{return lx(t,e,r,!1)}catch(i){return n.error=i,t}},KLe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:m_(t)};let s=mQ(t,r);return n[o]?{serializedResult:s,finalResult:wL(s,!i[o],e)}:{serializedResult:s}},ZLe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!ux({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wL(t,!1,s);try{Xte(a,e,n)}catch(c){r.error??=c}},JLe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>ix.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?HLe(n,t):(r.add(o),VLe(n,t))}};var tre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ys(e,r,"all")]:Array.isArray(e)?[ys(t,r,"all"),...e]:Bt(t)&&Bt(e)?DD([t,e]):`${t}${e}`};import{once as PL}from"events";var rre=async(t,e)=>{let[r,n]=await XLe(t);return e.isForcefullyTerminated??=!1,[r,n]},XLe=async t=>{let[e,r]=await Promise.allSettled([PL(t,"spawn"),PL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?nre(t):r.value},nre=async t=>{try{return await PL(t,"exit")}catch{return nre(t)}},ire=async t=>{let[e,r]=await t;if(!QLe(e,r)&&OL(e,r))throw new Ii;return[e,r]},QLe=(t,e)=>t===void 0&&e===void 0,OL=(t,e)=>t!==0||e!==null;var ore=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=e$e(t,e,r),s=o?.code==="ETIMEDOUT",a=ete(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},e$e=(t,e,r)=>t!==void 0?t:OL(e,r)?new Ii:void 0;var sre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=r$e(t,e,r),d=o$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return hf(d,c,l)},r$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=wA(t,e,r),a=n$e(r),{file:c,commandArguments:l,options:u}=HA(t,e,a);i$e(u);let d=Lte(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},n$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,i$e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&dx("ipcInput"),t&&dx("ipc: true"),r&&dx("detached: true"),n&&dx("cancelSignal")},dx=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},o$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=s$e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=ore(c,r),{output:h,error:m=l}=ere({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),E=h.map((v,A)=>ys(v,r,A)),b=ys(tre(h,r),r,"all");return c$e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:E,all:b,options:r,command:n,escapedCommand:i,startTime:a})},s$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Zte(o,r);let a=a$e(r);return t$e(...WA(t,e,a))}catch(a){return pf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},a$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ex(e)}),c$e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?tx({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):A_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as K1e}from"events";import{spawn as Z1e}from"child_process";import dre from"process";import{once as NL,on as l$e}from"events";var are=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(af({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:BA(t)}),u$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),u$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{LA(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([d$e(o,n,s),f$e(o,r,s),p$e(o,r,s)])}catch(a){throw cf(t),a}finally{s.abort(),$A(e,i)}},d$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await NL(t,"message",{signal:r});return n}for await(let[n]of l$e(t,"message",{signal:r}))if(e(n))return n},f$e=async(t,e,{signal:r})=>{await NL(t,"disconnect",{signal:r}),W7(e)},p$e=async(t,e,{signal:r})=>{let[n]=await NL(t,"strict:error",{signal:r});throw kA(n,e)};import{once as lre,on as h$e}from"events";var ure=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>kL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),kL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{af({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:BA(t)}),LA(e,o);let s=ka(t,e,r),a=new AbortController,c={};return m$e(t,s,a),g$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),_$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},m$e=async(t,e,r)=>{try{await lre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},g$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await lre(t,"strict:error",{signal:r.signal});n.error=kA(i,e),r.abort()}catch{}},_$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of h$e(r,"message",{signal:o.signal}))cre(s),yield c}catch{cre(s)}finally{o.abort(),$A(e,a),n||cf(t),i&&await t}},cre=({error:t})=>{if(t)throw t};var fre=(t,{ipc:e})=>{Object.assign(t,hre(t,!1,e))},pre=()=>{let t=dre,e=!0,r=dre.channel!==void 0;return{...hre(t,e,r),getCancelSignal:Eee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},hre=(t,e,r)=>({sendMessage:qA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:are.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:ure.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as y$e}from"child_process";import{PassThrough as S$e,Readable as E$e,Writable as v$e,Duplex as b$e}from"stream";var mre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{TL(n);let a=new y$e;T$e(a,n),Object.assign(a,{readable:A$e,writable:x$e,duplex:w$e});let c=pf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=R$e(c,s,i);return{subprocess:a,promise:l}},T$e=(t,e)=>{let r=w_(),n=w_(),i=w_(),o=Array.from({length:e.length-3},w_),s=w_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},w_=()=>{let t=new S$e;return t.end(),t},A$e=()=>new E$e({read(){}}),x$e=()=>new v$e({write(){}}),w$e=()=>new b$e({read(){},write(){}}),R$e=async(t,e,r)=>hf(t,e,r);import{createReadStream as gre,createWriteStream as _re}from"fs";import{Buffer as I$e}from"buffer";import{Readable as R_,Writable as C$e,Duplex as P$e}from"stream";var Sre=(t,e)=>ox(O$e,t,e,!1),I_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},yre={fileNumber:I_,generator:CL,asyncGenerator:CL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:P$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},O$e={input:{...yre,fileUrl:({value:t})=>({stream:gre(t)}),filePath:({value:{file:t}})=>({stream:gre(t)}),webStream:({value:t})=>({stream:R_.fromWeb(t)}),iterable:({value:t})=>({stream:R_.from(t)}),asyncIterable:({value:t})=>({stream:R_.from(t)}),string:({value:t})=>({stream:R_.from(t)}),uint8Array:({value:t})=>({stream:R_.from(I$e.from(t))})},output:{...yre,fileUrl:({value:t})=>({stream:_re(t)}),filePath:({value:{file:t,append:e}})=>({stream:_re(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:I_,asyncIterable:I_,string:I_,uint8Array:I_}};import{on as N$e,once as Ere}from"events";import{PassThrough as k$e,getDefaultHighWaterMark as M$e}from"stream";import{finished as Tre}from"stream/promises";function Pl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)DL(i);let e=t.some(({readableObjectMode:i})=>i),r=D$e(t,e),n=new ML({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var D$e=(t,e)=>{if(t.length===0)return M$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},ML=class extends k$e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(DL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=L$e(this,this.#e,this.#o);let r=F$e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(DL(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},L$e=async(t,e,r)=>{fx(t,vre);let n=new AbortController;try{await Promise.race([$$e(t,n),U$e(t,e,r,n)])}finally{n.abort(),fx(t,-vre)}},$$e=async(t,{signal:e})=>{try{await Tre(t,{signal:e,cleanup:!0})}catch(r){throw Are(t,r),r}},U$e=async(t,e,r,{signal:n})=>{for await(let[i]of N$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},DL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},F$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{fx(t,bre);let a=new AbortController;try{await Promise.race([B$e(o,e,a),j$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),z$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),fx(t,-bre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?LL(t):G$e(t))},B$e=async(t,e,{signal:r})=>{try{await t,r.aborted||LL(e)}catch(n){r.aborted||Are(e,n)}},j$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Tre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;xre(s)?i.add(e):wre(t,s)}},z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Ere(t,i,{signal:o}),!t.readable)return Ere(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},G$e=t=>{t.writable&&t.end()},Are=(t,e)=>{xre(e)?LL(t):wre(t,e)},xre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",LL=t=>{(t.readable||t.writable)&&t.destroy()},wre=(t,e)=>{t.destroyed||(t.once("error",q$e),t.destroy(e))},q$e=()=>{},fx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},vre=2,bre=1;import{finished as Rre}from"stream/promises";var gf=(t,e)=>{t.pipe(e),V$e(t,e),H$e(t,e)},V$e=async(t,e)=>{if(!(Ri(t)||Ri(e))){try{await Rre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}$L(e)}},$L=t=>{t.writable&&t.end()},H$e=async(t,e)=>{if(!(Ri(t)||Ri(e))){try{await Rre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}UL(t)}},UL=t=>{t.readable&&t.destroy()};var Ire=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Yn.has(c)))W$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Yn.has(c)))K$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Pl(o);gf(s,i)}},W$e=(t,e,r,n)=>{r==="output"?gf(t.stdio[n],e):gf(e,t.stdio[n]);let i=Y$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Y$e=["stdin","stdout","stderr"],K$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Z$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Z$e=(t,{signal:e})=>{Ri(t)&&wl(t,J$e,e)},J$e=2;import{addAbortListener as e1e}from"events";var Ol=[];Ol.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ol.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ol.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var px=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",FL=Symbol.for("signal-exit emitter"),BL=globalThis,X$e=Object.defineProperty.bind(Object),jL=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(BL[FL])return BL[FL];X$e(BL,FL,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},hx=class{},Q$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),zL=class extends hx{onExit(){return()=>{}}load(){}unload(){}},GL=class extends hx{#e=qL.platform==="win32"?"SIGINT":"SIGHUP";#r=new jL;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ol)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!px(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ol)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ol.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return px(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&px(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},qL=globalThis.process,{onExit:Cre,load:TSt,unload:ASt}=Q$e(px(qL)?new GL(qL):new zL);var Pre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Cre(()=>{t.kill()});e1e(n,()=>{i()})};var Nre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=xA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=t1e(r,n,i),{sourceStream:d,sourceError:f}=n1e(t,l),{options:p,fileDescriptors:h}=mo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},t1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=r1e(t,e,...r),a=DA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},r1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ore,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||kD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=mA(r,...n);return{destination:e(Ore)(i,o,s),pipeOptions:s}}if(mo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ore=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),n1e=(t,e)=>{try{return{sourceStream:lf(t,e)}}catch(r){return{sourceError:r}}};var Mre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=i1e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VL({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},i1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return UL(t),n;if(e!==void 0)return $L(r),e},VL=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>pf({error:t,command:kre,escapedCommand:kre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),kre="source.pipe(destination)";var Dre=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as o1e}from"stream/promises";var Lre=(t,e,r)=>{let n=mx.has(e)?a1e(t,e):s1e(t,e);return wl(t,l1e,r.signal),wl(e,u1e,r.signal),c1e(e),n},s1e=(t,e)=>{let r=Pl([t]);return gf(r,e),mx.set(e,r),r},a1e=(t,e)=>{let r=mx.get(e);return r.add(t),r},c1e=async t=>{try{await o1e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}mx.delete(t)},mx=new WeakMap,l1e=2,u1e=1;import{aborted as d1e}from"util";var $re=(t,e)=>t===void 0?[]:[f1e(t,e)],f1e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await d1e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VL({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var gx=(t,...e)=>{if(Pt(e[0]))return gx.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Nre(t,...e),i=p1e({...n,destination:r});return i.pipe=gx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},p1e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=h1e(t,i);Mre({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Lre(e,o,d);return await Promise.race([Dre(u),...$re(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},h1e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as v1e}from"timers/promises";import{on as m1e}from"events";import{getDefaultHighWaterMark as g1e}from"stream";var _x=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return _1e(e,s),Fre({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},_1e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},HL=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;y1e(e,s,t);let a=t.readableObjectMode&&!o;return Fre({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},y1e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Fre=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=m1e(t,"data",{signal:e.signal,highWaterMark:Ure,highWatermark:Ure});return S1e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},WL=g1e(!0),Ure=WL,S1e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=E1e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Cl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*x_(a)}},E1e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[ax(t,r,!e),sx(t,i,!n,{})].filter(Boolean);var Bre=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=b1e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([T1e(t),d]);return}let f=AL(c,r),p=HL({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([A1e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},b1e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!ux({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=HL({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Jte(a,t,r,o)},T1e=async t=>{await v1e(),t.readableFlowing===null&&t.resume()},A1e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await JA(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await XA(r,{maxBuffer:o})):await ff(r,{maxBuffer:o})}catch(a){return jre(Jee({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YL=async t=>{try{return await t}catch(e){return jre(e)}},jre=({bufferedData:t})=>pQ(t)?new Uint8Array(t):t;import{finished as x1e}from"stream/promises";var C_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=w1e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],x1e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C1e(a,e,r,n)}finally{s.abort()}},w1e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&R1e(t,r,n),n},R1e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{I1e(e,r),n.call(t,...i)}},I1e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C1e=(t,e,r,n)=>{if(!P1e(t,e,r,n))throw t},P1e=(t,e,r,n=!0)=>r.propagating?zre(t)||yx(t):(r.propagating=!0,KL(r,e)===n?zre(t):yx(t)),KL=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",yx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",zre=t=>t?.code==="EPIPE";var Gre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>ZL({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),ZL=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=C_(t,e,l);if(KL(l,e)){await u;return}let[d]=await Promise.all([Bre({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var qre=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pl([t,e].filter(Boolean)):void 0,Vre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>ZL({...O1e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:N1e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),O1e=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},N1e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as k1e}from"events";var Hre=t=>nf(t,"ipc"),Wre=(t,e)=>{let r=AA(t);po({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Yre=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Hre(o),a=gs(e,"ipc"),c=gs(r,"ipc");for await(let l of kL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Xee(t,i,c),i.push(l)),s&&Wre(l,o);return i},Kre=async(t,e)=>(await Promise.allSettled([t]),e);var Zre=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:E,controller:b})=>{let v=rre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},_=Gre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=Vre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),C=[],O=Yre({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:C,verboseInfo:p}),P=M1e(m,t,A),I=D1e(h,A);try{return await Promise.race([Promise.all([{},ire(v),Promise.all(_),R,O,Pee(t,d),...P,...I]),E,L1e(t,b),...xee(t,o,f,b),...H7({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...Tee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(U){return f.terminationReason??="other",Promise.all([{error:U},v,Promise.all(_.map(y=>YL(y))),YL(R),Kre(O,C),Promise.allSettled(P),Promise.allSettled(I)])}},M1e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:C_(n,i,r)),D1e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Pi(o,{checkOpen:!1})&&!Ri(o)).map(({type:i,value:o,stream:s=o})=>C_(s,n,e,{isSameDirection:Yn.has(i),stopOnExit:i==="native"}))),L1e=async(t,{signal:e})=>{let[r]=await k1e(t,"error",{signal:e});throw r};var Jre=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),P_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ho();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},_f=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as $1e}from"stream";import{callbackify as U1e}from"util";import{finished as Xre}from"stream/promises";var JL=async t=>{if(t!==void 0)try{await XL(t)}catch{}},Qre=async t=>{if(t!==void 0)try{await QL(t)}catch{}},XL=async t=>{await Xre(t,{cleanup:!0,readable:!1,writable:!0})},QL=async t=>{await Xre(t,{cleanup:!0,readable:!0,writable:!1})},Sx=async(t,e)=>{if(await t,e)throw e},Ex=(t,e,r)=>{r&&!yx(r)?t.destroy(r):e&&t.destroy()};var ene=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||gn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=e$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=t$(a,s),{read:f,onStdoutDataDone:p}=r$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new $1e({read:f,destroy:U1e(i$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return n$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},e$=(t,e,r)=>{let n=lf(t,e),i=P_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},t$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:WL},r$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ho(),s=_x({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){F1e(this,s,o)},onStdoutDataDone:o}},F1e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},n$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await QL(t),await n,await JL(i),await e,r.readable&&r.push(null)}catch(o){await JL(i),tne(r,o)}},i$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await _f(r,e)&&(tne(t,n),await Sx(e,n))},tne=(t,e)=>{Ex(t,t.readable,e)};import{Writable as B1e}from"stream";import{callbackify as rne}from"util";var nne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=o$(t,r,e),s=new B1e({...s$(n,t,i),destroy:rne(c$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return a$(n,s),s},o$=(t,e,r)=>{let n=DA(t,e),i=P_(r,n,"writableFinal"),o=P_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},s$=(t,e,r)=>({write:j1e.bind(void 0,t),final:rne(z1e.bind(void 0,t,e,r))}),j1e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},z1e=async(t,e,r)=>{await _f(r,e)&&(t.writable&&t.end(),await e)},a$=async(t,e,r)=>{try{await XL(t),e.writable&&e.end()}catch(n){await Qre(r),ine(e,n)}},c$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await _f(r,e),await _f(n,e)&&(ine(t,i),await Sx(e,i))},ine=(t,e)=>{Ex(t,t.writable,e)};import{Duplex as G1e}from"stream";import{callbackify as q1e}from"util";var one=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||gn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=e$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=o$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=t$(c,a),{read:E,onStdoutDataDone:b}=r$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),v=new G1e({read:E,...s$(u,t,d),destroy:q1e(V1e.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return n$({subprocessStdout:c,onStdoutDataDone:b,readable:v,subprocess:t,subprocessStdin:u}),a$(u,v,c),v},V1e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([i$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),c$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var l$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||gn.has(e),s=lf(t,r),a=_x({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return H1e(a,s,t)},H1e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var sne=(t,{encoding:e})=>{let r=Jre();t.readable=ene.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=nne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=one.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=l$.bind(void 0,t,e),t[Symbol.asyncIterator]=l$.bind(void 0,t,e,{})};var ane=(t,e)=>{for(let[r,n]of Y1e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},W1e=(async()=>{})().constructor.prototype,Y1e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(W1e,t)]);var cne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=J1e(t,e,r),{subprocess:f,promise:p}=Q1e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=gx.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),ane(f,p),mo.set(f,{options:u,fileDescriptors:d}),f},J1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=wA(t,e,r),{file:a,commandArguments:c,options:l}=HA(t,e,r),u=X1e(l),d=Sre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},X1e=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Q1e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Z1e(...WA(t,e,r))}catch(h){return mre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;K1e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Ire(c,a,l),Pre(c,r,l);let d={},f=ho();c.kill=q7.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=qre(c,r),sne(c,r),fre(c,r);let p=eUe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},eUe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,E]=await Zre({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=h.map((_,R)=>ys(_,e,R)),v=ys(m,e,"all"),A=tUe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:v,ipcOutput:E,context:c,options:e,command:s,escapedCommand:a,startTime:r});return hf(A,n,e)},tUe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?A_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof go,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):tx({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var vx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,rUe(n,t[n],i)]));return{...t,...r}},rUe=(t,e,r)=>nUe.has(t)&&Pt(e)&&Pt(r)?{...e,...r}:r,nUe=new Set(["env",...FD]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>iUe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},iUe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Pt(o))return i(t,vx(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=oUe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?sre(a,c,l):cne(a,c,l,i)},oUe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=SQ(e)?EQ(e,r):[e,...r],[s,a,c]=mA(...o),l=vx(vx(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var lne=({file:t,commandArguments:e})=>dne(t,e),une=({file:t,commandArguments:e})=>({...dne(t,e),isSync:!0}),dne=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=sUe(t);return{file:r,commandArguments:n}},sUe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(aUe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},aUe=/ +/g;var fne=(t,e,r)=>{t.sync=e(cUe,r),t.s=t.sync},pne=({options:t})=>hne(t),cUe=({options:t})=>({...hne(t),isSync:!0}),hne=t=>({options:{...lUe(t),...t}}),lUe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},mne={preferLocal:!0};var gne=Da(()=>({})),pbt=Da(()=>({isSync:!0})),_ne=Da(lne),hbt=Da(une),mbt=Da(Ree),gbt=Da(pne,{},mne,fne),{sendMessage:_bt,getOneMessage:ybt,getEachMessage:Sbt,getCancelSignal:Ebt}=pre();var yne=!1,Sne=()=>{yne=!0},yo=()=>yne;var O_=null,Ene=t=>(O_&&O_.destroy(),O_=new Ss({totalAllowedTime:t}),O_),vne=()=>O_;var Ss=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&yo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await cA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var bne={name:"@netlify/agent-runner-cli",type:"module",version:"1.152.0-EX-2670.1",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.4","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var pUe=dUe(import.meta.url),hUe=Es.dirname(pUe),mUe=fUe(import.meta.url),yf=de("shell"),u$=new Set,Tne={preferLocal:!0},cr=(t,e,r)=>{let[n,i]=gUe(e,r),o={...Tne,...i},s=gne(t,n,o);xne(s,o),Ine(s);let a=r?.idleTimeout;return a&&a>0&&Rne(s,a),s},Ane=(t,e)=>{let r={...Tne,...e},n=_ne(t,r);return xne(n,r),Ine(n),e?.idleTimeout&&e.idleTimeout>0&&Rne(n,e.idleTimeout),n},gUe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},xne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(vs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new o_).pipe(vs.stdout),t.stderr?.pipe(new o_).pipe(vs.stderr);return}t.stdout?.pipe(vs.stdout),t.stderr?.pipe(vs.stderr)},d$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(vs.kill(-t.pid,e),yf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return yf.error("Error killing process:",r),!1}},wne=t=>d$(t,"SIGKILL"),Rne=(t,e)=>{let r=null,n=()=>{yf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),d$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(yf.log(`Force killing idle process ${t.pid}`),wne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},Ine=t=>{u$.add(t);let e=vne();if(e){let r=e.onTimesUp(()=>{yf.log(`Global timer expired, killing process ${t.pid}`),d$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(yf.log(`Force killing process ${t.pid} after timeout`),wne(t))},5e3)});t.on("exit",()=>{u$.delete(t),r()}),t.on("error",()=>{u$.delete(t),r()})}};function Tx(t,e){return!!Oi(t,e)}function Oi(t,e){if(!vs.env.NETLIFY_LOCAL_MODE)try{let i=mUe.resolve(bne.name),o=Es.dirname(i);for(;o!==Es.dirname(o);){let s=Es.dirname(o);if(Es.basename(s)==="node_modules"){let a=Es.join(s,".bin",e);if(bx.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(vs.env.NODE_PATH){let i=Es.join(vs.env.NODE_PATH,".bin",e);if(bx.existsSync(i))return i}let r=Es.join(t,"node_modules",".bin",e);if(bx.existsSync(r))return r;let n=Es.join(hUe,"..","node_modules",".bin",e);if(bx.existsSync(n))return n}var _Ue=de("utils"),yUe=t=>new Promise(e=>{setTimeout(e,t)});var f$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ax=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await yUe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},La=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},Cne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):_Ue.error("Could not parse JSON",n))}},SUe=t=>t.charAt(0).toUpperCase()+t.slice(1),So=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():SUe(e)).join(" ");function bs(t,e){e&&t.log(`Skill invoked: ${e}`)}var xx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Pne=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var p$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},EUe=1e4,h$=(t,e=EUe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as vUe}from"crypto";import{createReadStream as bUe}from"fs";import wx from"fs/promises";import Dne from"os";import Rx from"path";var One=de("repo"),Lne="runner-diffs-",$ne=t=>`${Lne}${t}-`,Une=async t=>{let e=Dne.tmpdir(),r;try{r=await wx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Lne)&&!n.startsWith($ne(t))).map(n=>wx.rm(Rx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>cr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Ix=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{One.info("Getting runner diffs");let n=await AUe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=wUe(o);await RUe(h,r)}One.info("Changes after processing"),await g$(r);let s=await _$(o,r);if(await m$(s,r),i=await xUe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await wx.mkdtemp(Rx.join(Dne.tmpdir(),$ne(t.sessionId))),c=async({from:h,to:m,fileName:E,binary:b})=>{let v=Rx.join(a,E);await Xr([...b?["diff",h,m,"--binary"]:["diff",h,m],`--output=${v}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:_}=await wx.stat(v);return{path:v,size:_}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Mne(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await kne(d,h)||(f=h)}await Mne(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await kne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Nne=async t=>{let e=vUe("sha256");for await(let r of bUe(t))e.update(r);return e.digest("hex")},kne=async(t,e)=>t.size===e.size&&await Nne(t.path)===await Nne(e.path),Mne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},m$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},g$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},Fne=/.. (.+)?\.log$/,TUe=[Fne],AUe=async(t=process.cwd())=>{let e=await g$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
102
+ if (condition) { yield value; }`)};import{Buffer as ILe}from"buffer";import{StringDecoder as CLe}from"string_decoder";var ax=(t,e,r)=>{if(r)return;if(t)return{transform:PLe.bind(void 0,new TextEncoder)};let n=new CLe(e);return{transform:OLe.bind(void 0,n),final:NLe.bind(void 0,n)}},PLe=function*(t,e){ILe.isBuffer(e)?yield ms(e):typeof e=="string"?yield t.encode(e):yield e},OLe=function*(t,e){yield Bt(e)?t.write(e):e},NLe=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as qte}from"util";var RL=qte(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=MLe}=e[r];for await(let i of n(t))yield*cx(i,e,r+1)},Vte=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*kLe(r,Number(e),t)},kLe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cx(n,r,e+1)},Hte=qte(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),MLe=function*(t){yield t};var IL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Wte=(t,e)=>[...e.flatMap(r=>[...Cl(r,t,0)]),...x_(t)],Cl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=LLe}=e[r];for(let i of n(t))yield*Cl(i,e,r+1)},x_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*DLe(r,Number(e),t)},DLe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Cl(n,r,e+1)},LLe=function*(t){yield t};var CL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Kte(t,s,o),l=Il(e),u=Il(r),d=l?RL.bind(void 0,cx,a):IL.bind(void 0,Cl),f=l||u?RL.bind(void 0,Vte,a):IL.bind(void 0,x_),p=l||u?Hte.bind(void 0,a):void 0;return{stream:new $Le({writableObjectMode:n,writableHighWaterMark:Yte(n),readableObjectMode:i,readableHighWaterMark:Yte(i),transform(m,E,b){d([m,c,0],this,b)},flush(m){f([c],this,m)},destroy:p})}},lx=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=Kte(s,r,a);t=Wte(c,t)}return t},Kte=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:jte(n,a)},ax(r,s,n),sx(r,o,n,c),{transform:t,final:e},{transform:zte(i,a)},Bte({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Zte=(t,e)=>{for(let r of ULe(t))FLe(t,r,e)},ULe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),FLe=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>BLe(a,n));r.input=m_(s)},BLe=(t,e)=>{let r=lx(t,e,"utf8",!0);return jLe(r),m_(r)},jLe=t=>{let e=t.find(r=>typeof r!="string"&&!Bt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as VLe,appendFileSync as HLe}from"fs";var ux=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&nf(r,n)&&!gn.has(e)&&zLe(n)&&(t.some(({type:i,value:o})=>i==="native"&&GLe.has(o))||t.every(({type:i})=>Yn.has(i))),zLe=t=>t===1||t===2,GLe=new Set(["pipe","overlapped"]),Jte=async(t,e,r,n)=>{for await(let i of t)qLe(e)||Qte(i,r,n)},Xte=(t,e,r)=>{for(let n of t)Qte(n,e,r)},qLe=t=>t._readableState.pipes.length>0,Qte=(t,e,r)=>{let n=AA(t);po({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var ere=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>WLe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},WLe=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=tte(t,o,d),p=ms(f),{stdioItems:h,objectMode:m}=e[r],E=YLe([p],h,c,n),{serializedResult:b,finalResult:v=b}=KLe({chunks:E,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});ZLe({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?v:void 0;try{return n.error===void 0&&JLe(b,h,i),A}catch(_){return n.error=_,A}},YLe=(t,e,r,n)=>{try{return lx(t,e,r,!1)}catch(i){return n.error=i,t}},KLe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:m_(t)};let s=mQ(t,r);return n[o]?{serializedResult:s,finalResult:wL(s,!i[o],e)}:{serializedResult:s}},ZLe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!ux({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wL(t,!1,s);try{Xte(a,e,n)}catch(c){r.error??=c}},JLe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>ix.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?HLe(n,t):(r.add(o),VLe(n,t))}};var tre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ys(e,r,"all")]:Array.isArray(e)?[ys(t,r,"all"),...e]:Bt(t)&&Bt(e)?DD([t,e]):`${t}${e}`};import{once as PL}from"events";var rre=async(t,e)=>{let[r,n]=await XLe(t);return e.isForcefullyTerminated??=!1,[r,n]},XLe=async t=>{let[e,r]=await Promise.allSettled([PL(t,"spawn"),PL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?nre(t):r.value},nre=async t=>{try{return await PL(t,"exit")}catch{return nre(t)}},ire=async t=>{let[e,r]=await t;if(!QLe(e,r)&&OL(e,r))throw new Ii;return[e,r]},QLe=(t,e)=>t===void 0&&e===void 0,OL=(t,e)=>t!==0||e!==null;var ore=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=e$e(t,e,r),s=o?.code==="ETIMEDOUT",a=ete(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},e$e=(t,e,r)=>t!==void 0?t:OL(e,r)?new Ii:void 0;var sre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=r$e(t,e,r),d=o$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return hf(d,c,l)},r$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=wA(t,e,r),a=n$e(r),{file:c,commandArguments:l,options:u}=HA(t,e,a);i$e(u);let d=Lte(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},n$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,i$e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&dx("ipcInput"),t&&dx("ipc: true"),r&&dx("detached: true"),n&&dx("cancelSignal")},dx=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},o$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=s$e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=ore(c,r),{output:h,error:m=l}=ere({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),E=h.map((v,A)=>ys(v,r,A)),b=ys(tre(h,r),r,"all");return c$e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:E,all:b,options:r,command:n,escapedCommand:i,startTime:a})},s$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Zte(o,r);let a=a$e(r);return t$e(...WA(t,e,a))}catch(a){return pf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},a$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ex(e)}),c$e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?tx({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):A_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as K1e}from"events";import{spawn as Z1e}from"child_process";import dre from"process";import{once as NL,on as l$e}from"events";var are=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(af({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:BA(t)}),u$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),u$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{LA(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([d$e(o,n,s),f$e(o,r,s),p$e(o,r,s)])}catch(a){throw cf(t),a}finally{s.abort(),$A(e,i)}},d$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await NL(t,"message",{signal:r});return n}for await(let[n]of l$e(t,"message",{signal:r}))if(e(n))return n},f$e=async(t,e,{signal:r})=>{await NL(t,"disconnect",{signal:r}),W7(e)},p$e=async(t,e,{signal:r})=>{let[n]=await NL(t,"strict:error",{signal:r});throw kA(n,e)};import{once as lre,on as h$e}from"events";var ure=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>kL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),kL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{af({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:BA(t)}),LA(e,o);let s=ka(t,e,r),a=new AbortController,c={};return m$e(t,s,a),g$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),_$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},m$e=async(t,e,r)=>{try{await lre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},g$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await lre(t,"strict:error",{signal:r.signal});n.error=kA(i,e),r.abort()}catch{}},_$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of h$e(r,"message",{signal:o.signal}))cre(s),yield c}catch{cre(s)}finally{o.abort(),$A(e,a),n||cf(t),i&&await t}},cre=({error:t})=>{if(t)throw t};var fre=(t,{ipc:e})=>{Object.assign(t,hre(t,!1,e))},pre=()=>{let t=dre,e=!0,r=dre.channel!==void 0;return{...hre(t,e,r),getCancelSignal:Eee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},hre=(t,e,r)=>({sendMessage:qA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:are.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:ure.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as y$e}from"child_process";import{PassThrough as S$e,Readable as E$e,Writable as v$e,Duplex as b$e}from"stream";var mre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{TL(n);let a=new y$e;T$e(a,n),Object.assign(a,{readable:A$e,writable:x$e,duplex:w$e});let c=pf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=R$e(c,s,i);return{subprocess:a,promise:l}},T$e=(t,e)=>{let r=w_(),n=w_(),i=w_(),o=Array.from({length:e.length-3},w_),s=w_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},w_=()=>{let t=new S$e;return t.end(),t},A$e=()=>new E$e({read(){}}),x$e=()=>new v$e({write(){}}),w$e=()=>new b$e({read(){},write(){}}),R$e=async(t,e,r)=>hf(t,e,r);import{createReadStream as gre,createWriteStream as _re}from"fs";import{Buffer as I$e}from"buffer";import{Readable as R_,Writable as C$e,Duplex as P$e}from"stream";var Sre=(t,e)=>ox(O$e,t,e,!1),I_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},yre={fileNumber:I_,generator:CL,asyncGenerator:CL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:P$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},O$e={input:{...yre,fileUrl:({value:t})=>({stream:gre(t)}),filePath:({value:{file:t}})=>({stream:gre(t)}),webStream:({value:t})=>({stream:R_.fromWeb(t)}),iterable:({value:t})=>({stream:R_.from(t)}),asyncIterable:({value:t})=>({stream:R_.from(t)}),string:({value:t})=>({stream:R_.from(t)}),uint8Array:({value:t})=>({stream:R_.from(I$e.from(t))})},output:{...yre,fileUrl:({value:t})=>({stream:_re(t)}),filePath:({value:{file:t,append:e}})=>({stream:_re(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:I_,asyncIterable:I_,string:I_,uint8Array:I_}};import{on as N$e,once as Ere}from"events";import{PassThrough as k$e,getDefaultHighWaterMark as M$e}from"stream";import{finished as Tre}from"stream/promises";function Pl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)DL(i);let e=t.some(({readableObjectMode:i})=>i),r=D$e(t,e),n=new ML({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var D$e=(t,e)=>{if(t.length===0)return M$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},ML=class extends k$e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(DL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=L$e(this,this.#e,this.#o);let r=F$e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(DL(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},L$e=async(t,e,r)=>{fx(t,vre);let n=new AbortController;try{await Promise.race([$$e(t,n),U$e(t,e,r,n)])}finally{n.abort(),fx(t,-vre)}},$$e=async(t,{signal:e})=>{try{await Tre(t,{signal:e,cleanup:!0})}catch(r){throw Are(t,r),r}},U$e=async(t,e,r,{signal:n})=>{for await(let[i]of N$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},DL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},F$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{fx(t,bre);let a=new AbortController;try{await Promise.race([B$e(o,e,a),j$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),z$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),fx(t,-bre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?LL(t):G$e(t))},B$e=async(t,e,{signal:r})=>{try{await t,r.aborted||LL(e)}catch(n){r.aborted||Are(e,n)}},j$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Tre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;xre(s)?i.add(e):wre(t,s)}},z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Ere(t,i,{signal:o}),!t.readable)return Ere(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},G$e=t=>{t.writable&&t.end()},Are=(t,e)=>{xre(e)?LL(t):wre(t,e)},xre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",LL=t=>{(t.readable||t.writable)&&t.destroy()},wre=(t,e)=>{t.destroyed||(t.once("error",q$e),t.destroy(e))},q$e=()=>{},fx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},vre=2,bre=1;import{finished as Rre}from"stream/promises";var gf=(t,e)=>{t.pipe(e),V$e(t,e),H$e(t,e)},V$e=async(t,e)=>{if(!(Ri(t)||Ri(e))){try{await Rre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}$L(e)}},$L=t=>{t.writable&&t.end()},H$e=async(t,e)=>{if(!(Ri(t)||Ri(e))){try{await Rre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}UL(t)}},UL=t=>{t.readable&&t.destroy()};var Ire=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Yn.has(c)))W$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Yn.has(c)))K$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Pl(o);gf(s,i)}},W$e=(t,e,r,n)=>{r==="output"?gf(t.stdio[n],e):gf(e,t.stdio[n]);let i=Y$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Y$e=["stdin","stdout","stderr"],K$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Z$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Z$e=(t,{signal:e})=>{Ri(t)&&wl(t,J$e,e)},J$e=2;import{addAbortListener as e1e}from"events";var Ol=[];Ol.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ol.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ol.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var px=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",FL=Symbol.for("signal-exit emitter"),BL=globalThis,X$e=Object.defineProperty.bind(Object),jL=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(BL[FL])return BL[FL];X$e(BL,FL,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},hx=class{},Q$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),zL=class extends hx{onExit(){return()=>{}}load(){}unload(){}},GL=class extends hx{#e=qL.platform==="win32"?"SIGINT":"SIGHUP";#r=new jL;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ol)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!px(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ol)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ol.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return px(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&px(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},qL=globalThis.process,{onExit:Cre,load:TSt,unload:ASt}=Q$e(px(qL)?new GL(qL):new zL);var Pre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Cre(()=>{t.kill()});e1e(n,()=>{i()})};var Nre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=xA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=t1e(r,n,i),{sourceStream:d,sourceError:f}=n1e(t,l),{options:p,fileDescriptors:h}=mo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},t1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=r1e(t,e,...r),a=DA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},r1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ore,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||kD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=mA(r,...n);return{destination:e(Ore)(i,o,s),pipeOptions:s}}if(mo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ore=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),n1e=(t,e)=>{try{return{sourceStream:lf(t,e)}}catch(r){return{sourceError:r}}};var Mre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=i1e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VL({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},i1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return UL(t),n;if(e!==void 0)return $L(r),e},VL=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>pf({error:t,command:kre,escapedCommand:kre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),kre="source.pipe(destination)";var Dre=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as o1e}from"stream/promises";var Lre=(t,e,r)=>{let n=mx.has(e)?a1e(t,e):s1e(t,e);return wl(t,l1e,r.signal),wl(e,u1e,r.signal),c1e(e),n},s1e=(t,e)=>{let r=Pl([t]);return gf(r,e),mx.set(e,r),r},a1e=(t,e)=>{let r=mx.get(e);return r.add(t),r},c1e=async t=>{try{await o1e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}mx.delete(t)},mx=new WeakMap,l1e=2,u1e=1;import{aborted as d1e}from"util";var $re=(t,e)=>t===void 0?[]:[f1e(t,e)],f1e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await d1e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VL({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var gx=(t,...e)=>{if(Pt(e[0]))return gx.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Nre(t,...e),i=p1e({...n,destination:r});return i.pipe=gx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},p1e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=h1e(t,i);Mre({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Lre(e,o,d);return await Promise.race([Dre(u),...$re(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},h1e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as v1e}from"timers/promises";import{on as m1e}from"events";import{getDefaultHighWaterMark as g1e}from"stream";var _x=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return _1e(e,s),Fre({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},_1e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},HL=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;y1e(e,s,t);let a=t.readableObjectMode&&!o;return Fre({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},y1e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Fre=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=m1e(t,"data",{signal:e.signal,highWaterMark:Ure,highWatermark:Ure});return S1e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},WL=g1e(!0),Ure=WL,S1e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=E1e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Cl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*x_(a)}},E1e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[ax(t,r,!e),sx(t,i,!n,{})].filter(Boolean);var Bre=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=b1e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([T1e(t),d]);return}let f=AL(c,r),p=HL({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([A1e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},b1e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!ux({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=HL({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Jte(a,t,r,o)},T1e=async t=>{await v1e(),t.readableFlowing===null&&t.resume()},A1e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await JA(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await XA(r,{maxBuffer:o})):await ff(r,{maxBuffer:o})}catch(a){return jre(Jee({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YL=async t=>{try{return await t}catch(e){return jre(e)}},jre=({bufferedData:t})=>pQ(t)?new Uint8Array(t):t;import{finished as x1e}from"stream/promises";var C_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=w1e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],x1e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C1e(a,e,r,n)}finally{s.abort()}},w1e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&R1e(t,r,n),n},R1e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{I1e(e,r),n.call(t,...i)}},I1e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C1e=(t,e,r,n)=>{if(!P1e(t,e,r,n))throw t},P1e=(t,e,r,n=!0)=>r.propagating?zre(t)||yx(t):(r.propagating=!0,KL(r,e)===n?zre(t):yx(t)),KL=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",yx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",zre=t=>t?.code==="EPIPE";var Gre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>ZL({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),ZL=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=C_(t,e,l);if(KL(l,e)){await u;return}let[d]=await Promise.all([Bre({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var qre=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pl([t,e].filter(Boolean)):void 0,Vre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>ZL({...O1e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:N1e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),O1e=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},N1e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as k1e}from"events";var Hre=t=>nf(t,"ipc"),Wre=(t,e)=>{let r=AA(t);po({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Yre=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Hre(o),a=gs(e,"ipc"),c=gs(r,"ipc");for await(let l of kL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Xee(t,i,c),i.push(l)),s&&Wre(l,o);return i},Kre=async(t,e)=>(await Promise.allSettled([t]),e);var Zre=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:E,controller:b})=>{let v=rre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},_=Gre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=Vre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),C=[],O=Yre({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:C,verboseInfo:p}),P=M1e(m,t,A),I=D1e(h,A);try{return await Promise.race([Promise.all([{},ire(v),Promise.all(_),R,O,Pee(t,d),...P,...I]),E,L1e(t,b),...xee(t,o,f,b),...H7({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...Tee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(U){return f.terminationReason??="other",Promise.all([{error:U},v,Promise.all(_.map(y=>YL(y))),YL(R),Kre(O,C),Promise.allSettled(P),Promise.allSettled(I)])}},M1e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:C_(n,i,r)),D1e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Pi(o,{checkOpen:!1})&&!Ri(o)).map(({type:i,value:o,stream:s=o})=>C_(s,n,e,{isSameDirection:Yn.has(i),stopOnExit:i==="native"}))),L1e=async(t,{signal:e})=>{let[r]=await k1e(t,"error",{signal:e});throw r};var Jre=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),P_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ho();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},_f=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as $1e}from"stream";import{callbackify as U1e}from"util";import{finished as Xre}from"stream/promises";var JL=async t=>{if(t!==void 0)try{await XL(t)}catch{}},Qre=async t=>{if(t!==void 0)try{await QL(t)}catch{}},XL=async t=>{await Xre(t,{cleanup:!0,readable:!1,writable:!0})},QL=async t=>{await Xre(t,{cleanup:!0,readable:!0,writable:!1})},Sx=async(t,e)=>{if(await t,e)throw e},Ex=(t,e,r)=>{r&&!yx(r)?t.destroy(r):e&&t.destroy()};var ene=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||gn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=e$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=t$(a,s),{read:f,onStdoutDataDone:p}=r$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new $1e({read:f,destroy:U1e(i$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return n$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},e$=(t,e,r)=>{let n=lf(t,e),i=P_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},t$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:WL},r$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ho(),s=_x({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){F1e(this,s,o)},onStdoutDataDone:o}},F1e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},n$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await QL(t),await n,await JL(i),await e,r.readable&&r.push(null)}catch(o){await JL(i),tne(r,o)}},i$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await _f(r,e)&&(tne(t,n),await Sx(e,n))},tne=(t,e)=>{Ex(t,t.readable,e)};import{Writable as B1e}from"stream";import{callbackify as rne}from"util";var nne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=o$(t,r,e),s=new B1e({...s$(n,t,i),destroy:rne(c$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return a$(n,s),s},o$=(t,e,r)=>{let n=DA(t,e),i=P_(r,n,"writableFinal"),o=P_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},s$=(t,e,r)=>({write:j1e.bind(void 0,t),final:rne(z1e.bind(void 0,t,e,r))}),j1e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},z1e=async(t,e,r)=>{await _f(r,e)&&(t.writable&&t.end(),await e)},a$=async(t,e,r)=>{try{await XL(t),e.writable&&e.end()}catch(n){await Qre(r),ine(e,n)}},c$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await _f(r,e),await _f(n,e)&&(ine(t,i),await Sx(e,i))},ine=(t,e)=>{Ex(t,t.writable,e)};import{Duplex as G1e}from"stream";import{callbackify as q1e}from"util";var one=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||gn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=e$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=o$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=t$(c,a),{read:E,onStdoutDataDone:b}=r$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),v=new G1e({read:E,...s$(u,t,d),destroy:q1e(V1e.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return n$({subprocessStdout:c,onStdoutDataDone:b,readable:v,subprocess:t,subprocessStdin:u}),a$(u,v,c),v},V1e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([i$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),c$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var l$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||gn.has(e),s=lf(t,r),a=_x({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return H1e(a,s,t)},H1e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var sne=(t,{encoding:e})=>{let r=Jre();t.readable=ene.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=nne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=one.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=l$.bind(void 0,t,e),t[Symbol.asyncIterator]=l$.bind(void 0,t,e,{})};var ane=(t,e)=>{for(let[r,n]of Y1e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},W1e=(async()=>{})().constructor.prototype,Y1e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(W1e,t)]);var cne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=J1e(t,e,r),{subprocess:f,promise:p}=Q1e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=gx.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),ane(f,p),mo.set(f,{options:u,fileDescriptors:d}),f},J1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=wA(t,e,r),{file:a,commandArguments:c,options:l}=HA(t,e,r),u=X1e(l),d=Sre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},X1e=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Q1e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Z1e(...WA(t,e,r))}catch(h){return mre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;K1e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Ire(c,a,l),Pre(c,r,l);let d={},f=ho();c.kill=q7.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=qre(c,r),sne(c,r),fre(c,r);let p=eUe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},eUe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,E]=await Zre({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=h.map((_,R)=>ys(_,e,R)),v=ys(m,e,"all"),A=tUe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:v,ipcOutput:E,context:c,options:e,command:s,escapedCommand:a,startTime:r});return hf(A,n,e)},tUe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?A_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof go,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):tx({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var vx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,rUe(n,t[n],i)]));return{...t,...r}},rUe=(t,e,r)=>nUe.has(t)&&Pt(e)&&Pt(r)?{...e,...r}:r,nUe=new Set(["env",...FD]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>iUe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},iUe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Pt(o))return i(t,vx(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=oUe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?sre(a,c,l):cne(a,c,l,i)},oUe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=SQ(e)?EQ(e,r):[e,...r],[s,a,c]=mA(...o),l=vx(vx(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var lne=({file:t,commandArguments:e})=>dne(t,e),une=({file:t,commandArguments:e})=>({...dne(t,e),isSync:!0}),dne=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=sUe(t);return{file:r,commandArguments:n}},sUe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(aUe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},aUe=/ +/g;var fne=(t,e,r)=>{t.sync=e(cUe,r),t.s=t.sync},pne=({options:t})=>hne(t),cUe=({options:t})=>({...hne(t),isSync:!0}),hne=t=>({options:{...lUe(t),...t}}),lUe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},mne={preferLocal:!0};var gne=Da(()=>({})),pbt=Da(()=>({isSync:!0})),_ne=Da(lne),hbt=Da(une),mbt=Da(Ree),gbt=Da(pne,{},mne,fne),{sendMessage:_bt,getOneMessage:ybt,getEachMessage:Sbt,getCancelSignal:Ebt}=pre();var yne=!1,Sne=()=>{yne=!0},yo=()=>yne;var O_=null,Ene=t=>(O_&&O_.destroy(),O_=new Ss({totalAllowedTime:t}),O_),vne=()=>O_;var Ss=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&yo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await cA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var bne={name:"@netlify/agent-runner-cli",type:"module",version:"1.152.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.4","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var pUe=dUe(import.meta.url),hUe=Es.dirname(pUe),mUe=fUe(import.meta.url),yf=de("shell"),u$=new Set,Tne={preferLocal:!0},cr=(t,e,r)=>{let[n,i]=gUe(e,r),o={...Tne,...i},s=gne(t,n,o);xne(s,o),Ine(s);let a=r?.idleTimeout;return a&&a>0&&Rne(s,a),s},Ane=(t,e)=>{let r={...Tne,...e},n=_ne(t,r);return xne(n,r),Ine(n),e?.idleTimeout&&e.idleTimeout>0&&Rne(n,e.idleTimeout),n},gUe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},xne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(vs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new o_).pipe(vs.stdout),t.stderr?.pipe(new o_).pipe(vs.stderr);return}t.stdout?.pipe(vs.stdout),t.stderr?.pipe(vs.stderr)},d$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(vs.kill(-t.pid,e),yf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return yf.error("Error killing process:",r),!1}},wne=t=>d$(t,"SIGKILL"),Rne=(t,e)=>{let r=null,n=()=>{yf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),d$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(yf.log(`Force killing idle process ${t.pid}`),wne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},Ine=t=>{u$.add(t);let e=vne();if(e){let r=e.onTimesUp(()=>{yf.log(`Global timer expired, killing process ${t.pid}`),d$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(yf.log(`Force killing process ${t.pid} after timeout`),wne(t))},5e3)});t.on("exit",()=>{u$.delete(t),r()}),t.on("error",()=>{u$.delete(t),r()})}};function Tx(t,e){return!!Oi(t,e)}function Oi(t,e){if(!vs.env.NETLIFY_LOCAL_MODE)try{let i=mUe.resolve(bne.name),o=Es.dirname(i);for(;o!==Es.dirname(o);){let s=Es.dirname(o);if(Es.basename(s)==="node_modules"){let a=Es.join(s,".bin",e);if(bx.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(vs.env.NODE_PATH){let i=Es.join(vs.env.NODE_PATH,".bin",e);if(bx.existsSync(i))return i}let r=Es.join(t,"node_modules",".bin",e);if(bx.existsSync(r))return r;let n=Es.join(hUe,"..","node_modules",".bin",e);if(bx.existsSync(n))return n}var _Ue=de("utils"),yUe=t=>new Promise(e=>{setTimeout(e,t)});var f$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ax=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await yUe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},La=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},Cne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):_Ue.error("Could not parse JSON",n))}},SUe=t=>t.charAt(0).toUpperCase()+t.slice(1),So=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():SUe(e)).join(" ");function bs(t,e){e&&t.log(`Skill invoked: ${e}`)}var xx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Pne=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var p$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},EUe=1e4,h$=(t,e=EUe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as vUe}from"crypto";import{createReadStream as bUe}from"fs";import wx from"fs/promises";import Dne from"os";import Rx from"path";var One=de("repo"),Lne="runner-diffs-",$ne=t=>`${Lne}${t}-`,Une=async t=>{let e=Dne.tmpdir(),r;try{r=await wx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Lne)&&!n.startsWith($ne(t))).map(n=>wx.rm(Rx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>cr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Ix=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{One.info("Getting runner diffs");let n=await AUe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=wUe(o);await RUe(h,r)}One.info("Changes after processing"),await g$(r);let s=await _$(o,r);if(await m$(s,r),i=await xUe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await wx.mkdtemp(Rx.join(Dne.tmpdir(),$ne(t.sessionId))),c=async({from:h,to:m,fileName:E,binary:b})=>{let v=Rx.join(a,E);await Xr([...b?["diff",h,m,"--binary"]:["diff",h,m],`--output=${v}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:_}=await wx.stat(v);return{path:v,size:_}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Mne(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await kne(d,h)||(f=h)}await Mne(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await kne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Nne=async t=>{let e=vUe("sha256");for await(let r of bUe(t))e.update(r);return e.digest("hex")},kne=async(t,e)=>t.size===e.size&&await Nne(t.path)===await Nne(e.path),Mne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},m$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},g$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},Fne=/.. (.+)?\.log$/,TUe=[Fne],AUe=async(t=process.cwd())=>{let e=await g$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
103
103
  `).filter(i=>TUe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},xUe=async(t=process.cwd())=>{try{return await Xr(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},N_=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},Bne=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},_$=async(t,e=process.cwd())=>{t||=await g$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
104
104
  `).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${Rx.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(Fne)?.[1];o&&n.push(`:!${o}.log`)}),n},jne=async(t=process.cwd())=>{await Xr(["reset","--hard","HEAD"],{cwd:t})},zne=async(t=process.cwd())=>{let e=await Xr(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
105
105
  `).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},wUe=t=>{let e=t.split(`
package/dist/bin.js CHANGED
@@ -584,7 +584,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
584
584
  `,LF:`
585
585
  `,concatBytes:a3},Cyt=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Nyt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Cyt};import{Buffer as kyt}from"buffer";var Qbe=(t,e)=>t?void 0:$yt.bind(void 0,e),$yt=function*(t,e){if(typeof e!="string"&&!Cr(e)&&!kyt.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},eTe=(t,e)=>t?Lyt.bind(void 0,e):Dyt.bind(void 0,e),Lyt=function*(t,e){tTe(t,e),yield e},Dyt=function*(t,e){if(tTe(t,e),typeof e!="string"&&!Cr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},tTe=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
586
586
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
587
- if (condition) { yield value; }`)};import{Buffer as Myt}from"buffer";import{StringDecoder as Uyt}from"string_decoder";var _C=(t,e,r)=>{if(r)return;if(t)return{transform:Fyt.bind(void 0,new TextEncoder)};let n=new Uyt(e);return{transform:jyt.bind(void 0,n),final:qyt.bind(void 0,n)}},Fyt=function*(t,e){Myt.isBuffer(e)?yield Ec(e):typeof e=="string"?yield t.encode(e):yield e},jyt=function*(t,e){yield Cr(e)?t.write(e):e},qyt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as rTe}from"util";var l3=rTe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),yC=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zyt}=e[r];for await(let i of n(t))yield*yC(i,e,r+1)},nTe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Byt(r,Number(e),t)},Byt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*yC(n,r,e+1)},iTe=rTe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),zyt=function*(t){yield t};var u3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},sTe=(t,e)=>[...e.flatMap(r=>[...Uf(r,t,0)]),...Hb(t)],Uf=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Hyt}=e[r];for(let i of n(t))yield*Uf(i,e,r+1)},Hb=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Vyt(r,Number(e),t)},Vyt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Uf(n,r,e+1)},Hyt=function*(t){yield t};var d3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=aTe(t,o,s),l=Mf(e),u=Mf(r),d=l?l3.bind(void 0,yC,a):u3.bind(void 0,Uf),f=l||u?l3.bind(void 0,nTe,a):u3.bind(void 0,Hb),p=l||u?iTe.bind(void 0,a):void 0;return{stream:new Gyt({writableObjectMode:n,writableHighWaterMark:oTe(n),readableObjectMode:i,readableHighWaterMark:oTe(i),transform(m,_,S){d([m,c,0],this,S)},flush(m){f([c],this,m)},destroy:p})}},SC=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=aTe(o,r,a);t=sTe(c,t)}return t},aTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:Qbe(n,a)},_C(r,o,n),gC(r,s,n,c),{transform:t,final:e},{transform:eTe(i,a)},Xbe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var cTe=(t,e)=>{for(let r of Wyt(t))Yyt(t,r,e)},Wyt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Yyt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${bu[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>Kyt(a,n));r.input=Lb(o)},Kyt=(t,e)=>{let r=SC(t,e,"utf8",!0);return Jyt(r),Lb(r)},Jyt=t=>{let e=t.find(r=>typeof r!="string"&&!Cr(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as eSt,appendFileSync as tSt}from"fs";var EC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Cg(r,n)&&!Fi.has(e)&&Zyt(n)&&(t.some(({type:i,value:s})=>i==="native"&&Xyt.has(s))||t.every(({type:i})=>vs.has(i))),Zyt=t=>t===1||t===2,Xyt=new Set(["pipe","overlapped"]),lTe=async(t,e,r,n)=>{for await(let i of t)Qyt(e)||dTe(i,r,n)},uTe=(t,e,r)=>{for(let n of t)dTe(n,e,r)},Qyt=t=>t._readableState.pipes.length>0,dTe=(t,e,r)=>{let n=$P(t);ra({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var fTe=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>rSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},rSt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=pbe(t,s,d),p=Ec(f),{stdioItems:h,objectMode:m}=e[r],_=nSt([p],h,c,n),{serializedResult:S,finalResult:E=S}=iSt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});sSt({serializedResult:S,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let y=a[r]?E:void 0;try{return n.error===void 0&&oSt(S,h,i),y}catch(g){return n.error=g,y}},nSt=(t,e,r,n)=>{try{return SC(t,e,r,!1)}catch(i){return n.error=i,t}},iSt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Lb(t)};let o=xSe(t,r);return n[s]?{serializedResult:o,finalResult:c3(o,!i[s],e)}:{serializedResult:o}},sSt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!EC({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=c3(t,!1,o);try{uTe(a,e,n)}catch(c){r.error??=c}},oSt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>hC.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?tSt(n,t):(r.add(s),eSt(n,t))}};var pTe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Tc(e,r,"all")]:Array.isArray(e)?[Tc(t,r,"all"),...e]:Cr(t)&&Cr(e)?_6([t,e]):`${t}${e}`};import{once as f3}from"events";var hTe=async(t,e)=>{let[r,n]=await aSt(t);return e.isForcefullyTerminated??=!1,[r,n]},aSt=async t=>{let[e,r]=await Promise.allSettled([f3(t,"spawn"),f3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?mTe(t):r.value},mTe=async t=>{try{return await f3(t,"exit")}catch{return mTe(t)}},gTe=async t=>{let[e,r]=await t;if(!cSt(e,r)&&p3(e,r))throw new to;return[e,r]},cSt=(t,e)=>t===void 0&&e===void 0,p3=(t,e)=>t!==0||e!==null;var _Te=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=lSt(t,e,r),o=s?.code==="ETIMEDOUT",a=fbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},lSt=(t,e,r)=>t!==void 0?t:p3(e,r)?new to:void 0;var yTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=dSt(t,e,r),d=hSt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return qg(d,c,l)},dSt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=DP(t,e,r),a=fSt(r),{file:c,commandArguments:l,options:u}=rC(t,e,a);pSt(u);let d=Ybe(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},fSt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,pSt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&vC("ipcInput"),t&&vC("ipc: true"),r&&vC("detached: true"),n&&vC("cancelSignal")},vC=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},hSt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=mSt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=_Te(c,r),{output:h,error:m=l}=fTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((E,y)=>Tc(E,r,y)),S=Tc(pTe(h,r),r,"all");return _St({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:S,options:r,command:n,escapedCommand:i,startTime:a})},mSt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{cTe(s,r);let a=gSt(r);return uSt(...nC(t,e,a))}catch(a){return jg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},gSt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:uC(e)}),_St=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?dC({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):Vb({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as ivt}from"events";import{spawn as svt}from"child_process";import TTe from"process";import{once as h3,on as ySt}from"events";var STe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>($g({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:JP(t)}),SSt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),SSt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{GP(e,i);let s=vu(t,e,r),o=new AbortController;try{return await Promise.race([ESt(s,n,o),vSt(s,r,o),bSt(s,r,o)])}catch(a){throw Lg(t),a}finally{o.abort(),WP(e,i)}},ESt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await h3(t,"message",{signal:r});return n}for await(let[n]of ySt(t,"message",{signal:r}))if(e(n))return n},vSt=async(t,e,{signal:r})=>{await h3(t,"disconnect",{signal:r}),sve(e)},bSt=async(t,e,{signal:r})=>{let[n]=await h3(t,"strict:error",{signal:r});throw zP(n,e)};import{once as vTe,on as TSt}from"events";var bTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>m3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),m3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{$g({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:JP(t)}),GP(e,s);let o=vu(t,e,r),a=new AbortController,c={};return wSt(t,o,a),ASt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),RSt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},wSt=async(t,e,r)=>{try{await vTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},ASt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await vTe(t,"strict:error",{signal:r.signal});n.error=zP(i,e),r.abort()}catch{}},RSt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of TSt(r,"message",{signal:s.signal}))ETe(o),yield c}catch{ETe(o)}finally{s.abort(),WP(e,a),n||Lg(t),i&&await t}},ETe=({error:t})=>{if(t)throw t};var wTe=(t,{ipc:e})=>{Object.assign(t,RTe(t,!1,e))},ATe=()=>{let t=TTe,e=!0,r=TTe.channel!==void 0;return{...RTe(t,e,r),getCancelSignal:Nve.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},RTe=(t,e,r)=>({sendMessage:eC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:STe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:bTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as xSt}from"child_process";import{PassThrough as ISt,Readable as OSt,Writable as PSt,Duplex as CSt}from"stream";var xTe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{s3(n);let a=new xSt;NSt(a,n),Object.assign(a,{readable:kSt,writable:$St,duplex:LSt});let c=jg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=DSt(c,o,i);return{subprocess:a,promise:l}},NSt=(t,e)=>{let r=Gb(),n=Gb(),i=Gb(),s=Array.from({length:e.length-3},Gb),o=Gb(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},Gb=()=>{let t=new ISt;return t.end(),t},kSt=()=>new OSt({read(){}}),$St=()=>new PSt({write(){}}),LSt=()=>new CSt({read(){},write(){}}),DSt=async(t,e,r)=>qg(t,e,r);import{createReadStream as ITe,createWriteStream as OTe}from"fs";import{Buffer as MSt}from"buffer";import{Readable as Wb,Writable as USt,Duplex as FSt}from"stream";var CTe=(t,e)=>mC(jSt,t,e,!1),Yb=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${bu[t]}.`)},PTe={fileNumber:Yb,generator:d3,asyncGenerator:d3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:FSt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},jSt={input:{...PTe,fileUrl:({value:t})=>({stream:ITe(t)}),filePath:({value:{file:t}})=>({stream:ITe(t)}),webStream:({value:t})=>({stream:Wb.fromWeb(t)}),iterable:({value:t})=>({stream:Wb.from(t)}),asyncIterable:({value:t})=>({stream:Wb.from(t)}),string:({value:t})=>({stream:Wb.from(t)}),uint8Array:({value:t})=>({stream:Wb.from(MSt.from(t))})},output:{...PTe,fileUrl:({value:t})=>({stream:OTe(t)}),filePath:({value:{file:t,append:e}})=>({stream:OTe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:USt.fromWeb(t)}),iterable:Yb,asyncIterable:Yb,string:Yb,uint8Array:Yb}};import{on as qSt,once as NTe}from"events";import{PassThrough as BSt,getDefaultHighWaterMark as zSt}from"stream";import{finished as LTe}from"stream/promises";function Ff(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)_3(i);let e=t.some(({readableObjectMode:i})=>i),r=VSt(t,e),n=new g3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var VSt=(t,e)=>{if(t.length===0)return zSt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},g3=class extends BSt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(_3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=HSt(this,this.#e,this.#s);let r=YSt({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(_3(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},HSt=async(t,e,r)=>{bC(t,kTe);let n=new AbortController;try{await Promise.race([GSt(t,n),WSt(t,e,r,n)])}finally{n.abort(),bC(t,-kTe)}},GSt=async(t,{signal:e})=>{try{await LTe(t,{signal:e,cleanup:!0})}catch(r){throw DTe(t,r),r}},WSt=async(t,e,r,{signal:n})=>{for await(let[i]of qSt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},_3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},YSt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{bC(t,$Te);let a=new AbortController;try{await Promise.race([KSt(s,e,a),JSt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),ZSt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),bC(t,-$Te)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?y3(t):XSt(t))},KSt=async(t,e,{signal:r})=>{try{await t,r.aborted||y3(e)}catch(n){r.aborted||DTe(e,n)}},JSt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await LTe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;MTe(o)?i.add(e):UTe(t,o)}},ZSt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await NTe(t,i,{signal:s}),!t.readable)return NTe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},XSt=t=>{t.writable&&t.end()},DTe=(t,e)=>{MTe(e)?y3(t):UTe(t,e)},MTe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",y3=t=>{(t.readable||t.writable)&&t.destroy()},UTe=(t,e)=>{t.destroyed||(t.once("error",QSt),t.destroy(e))},QSt=()=>{},bC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},kTe=2,$Te=1;import{finished as FTe}from"stream/promises";var zg=(t,e)=>{t.pipe(e),eEt(t,e),tEt(t,e)},eEt=async(t,e)=>{if(!(eo(t)||eo(e))){try{await FTe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}S3(e)}},S3=t=>{t.writable&&t.end()},tEt=async(t,e)=>{if(!(eo(t)||eo(e))){try{await FTe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}E3(t)}},E3=t=>{t.readable&&t.destroy()};var jTe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>vs.has(c)))rEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!vs.has(c)))iEt({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Ff(s);zg(o,i)}},rEt=(t,e,r,n)=>{r==="output"?zg(t.stdio[n],e):zg(e,t.stdio[n]);let i=nEt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},nEt=["stdin","stdout","stderr"],iEt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;sEt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},sEt=(t,{signal:e})=>{eo(t)&&Lf(t,oEt,e)},oEt=2;import{addAbortListener as lEt}from"events";var jf=[];jf.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&jf.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jf.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var TC=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",v3=Symbol.for("signal-exit emitter"),b3=globalThis,aEt=Object.defineProperty.bind(Object),T3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(b3[v3])return b3[v3];aEt(b3,v3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},wC=class{},cEt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),w3=class extends wC{onExit(){return()=>{}}load(){}unload(){}},A3=class extends wC{#e=R3.platform==="win32"?"SIGINT":"SIGHUP";#r=new T3;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of jf)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!TC(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of jf)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,jf.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return TC(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&TC(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},R3=globalThis.process,{onExit:qTe,load:Ncr,unload:kcr}=cEt(TC(R3)?new A3(R3):new w3);var BTe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=qTe(()=>{t.kill()});lEt(n,()=>{i()})};var VTe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=LP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=uEt(r,n,i),{sourceStream:d,sourceError:f}=fEt(t,l),{options:p,fileDescriptors:h}=ia.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},uEt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=dEt(t,e,...r),a=HP(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},dEt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(zTe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||m6(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=AP(r,...n);return{destination:e(zTe)(i,s,o),pipeOptions:o}}if(ia.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},zTe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),fEt=(t,e)=>{try{return{sourceStream:Dg(t,e)}}catch(r){return{sourceError:r}}};var GTe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=pEt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw x3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},pEt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return E3(t),n;if(e!==void 0)return S3(r),e},x3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>jg({error:t,command:HTe,escapedCommand:HTe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),HTe="source.pipe(destination)";var WTe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as hEt}from"stream/promises";var YTe=(t,e,r)=>{let n=AC.has(e)?gEt(t,e):mEt(t,e);return Lf(t,yEt,r.signal),Lf(e,SEt,r.signal),_Et(e),n},mEt=(t,e)=>{let r=Ff([t]);return zg(r,e),AC.set(e,r),r},gEt=(t,e)=>{let r=AC.get(e);return r.add(t),r},_Et=async t=>{try{await hEt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}AC.delete(t)},AC=new WeakMap,yEt=2,SEt=1;import{aborted as EEt}from"util";var KTe=(t,e)=>t===void 0?[]:[vEt(t,e)],vEt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await EEt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw x3({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var RC=(t,...e)=>{if(mr(e[0]))return RC.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=VTe(t,...e),i=bEt({...n,destination:r});return i.pipe=RC.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},bEt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=TEt(t,i);GTe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=YTe(e,s,d);return await Promise.race([WTe(u),...KTe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},TEt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as PEt}from"timers/promises";import{on as wEt}from"events";import{getDefaultHighWaterMark as AEt}from"stream";var xC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return REt(e,o),ZTe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},REt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},I3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;xEt(e,o,t);let a=t.readableObjectMode&&!s;return ZTe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},xEt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},ZTe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=wEt(t,"data",{signal:e.signal,highWaterMark:JTe,highWatermark:JTe});return IEt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},O3=AEt(!0),JTe=O3,IEt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=OEt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*Uf(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Hb(a)}},OEt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[_C(t,r,!e),gC(t,i,!n,{})].filter(Boolean);var XTe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=CEt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([NEt(t),d]);return}let f=o3(c,r),p=I3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([kEt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},CEt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!EC({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=I3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await lTe(a,t,r,s)},NEt=async t=>{await PEt(),t.readableFlowing===null&&t.resume()},kEt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await aC(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await cC(r,{maxBuffer:s})):await Fg(r,{maxBuffer:s})}catch(a){return QTe(lbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},P3=async t=>{try{return await t}catch(e){return QTe(e)}},QTe=({bufferedData:t})=>ASe(t)?new Uint8Array(t):t;import{finished as $Et}from"stream/promises";var Kb=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=LEt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],$Et(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||UEt(a,e,r,n)}finally{o.abort()}},LEt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&DEt(t,r,n),n},DEt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{MEt(e,r),n.call(t,...i)}},MEt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},UEt=(t,e,r,n)=>{if(!FEt(t,e,r,n))throw t},FEt=(t,e,r,n=!0)=>r.propagating?ewe(t)||IC(t):(r.propagating=!0,C3(r,e)===n?ewe(t):IC(t)),C3=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",IC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ewe=t=>t?.code==="EPIPE";var twe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>N3({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),N3=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=Kb(t,e,l);if(C3(l,e)){await u;return}let[d]=await Promise.all([XTe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var rwe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ff([t,e].filter(Boolean)):void 0,nwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>N3({...jEt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:qEt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),jEt=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},qEt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as BEt}from"events";var iwe=t=>Cg(t,"ipc"),swe=(t,e)=>{let r=$P(t);ra({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var owe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=iwe(s),a=vc(e,"ipc"),c=vc(r,"ipc");for await(let l of m3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(ube(t,i,c),i.push(l)),o&&swe(l,s);return i},awe=async(t,e)=>(await Promise.allSettled([t]),e);var cwe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:S})=>{let E=hTe(t,f),y={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:E,propagating:!1},g=twe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),w=nwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),P=[],x=owe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),A=zEt(m,t,y),O=VEt(h,y);try{return await Promise.race([Promise.all([{},gTe(E),Promise.all(g),w,x,Bve(t,d),...A,...O]),_,HEt(t,S),...Mve(t,s,f,S),...ive({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:S}),...Lve({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:S})])}catch(R){return f.terminationReason??="other",Promise.all([{error:R},E,Promise.all(g.map(b=>P3(b))),P3(w),awe(x,P),Promise.allSettled(A),Promise.allSettled(O)])}},zEt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Kb(n,i,r)),VEt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>no(s,{checkOpen:!1})&&!eo(s)).map(({type:i,value:s,stream:o=s})=>Kb(o,n,e,{isSameDirection:vs.has(i),stopOnExit:i==="native"}))),HEt=async(t,{signal:e})=>{let[r]=await BEt(t,"error",{signal:e});throw r};var lwe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Jb=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=na();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Vg=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as GEt}from"stream";import{callbackify as WEt}from"util";import{finished as uwe}from"stream/promises";var k3=async t=>{if(t!==void 0)try{await $3(t)}catch{}},dwe=async t=>{if(t!==void 0)try{await L3(t)}catch{}},$3=async t=>{await uwe(t,{cleanup:!0,readable:!1,writable:!0})},L3=async t=>{await uwe(t,{cleanup:!0,readable:!0,writable:!1})},OC=async(t,e)=>{if(await t,e)throw e},PC=(t,e,r)=>{r&&!IC(r)?t.destroy(r):e&&t.destroy()};var fwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||Fi.has(r),{subprocessStdout:a,waitReadableDestroy:c}=D3(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=M3(a,o),{read:f,onStdoutDataDone:p}=U3({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new GEt({read:f,destroy:WEt(j3.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return F3({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},D3=(t,e,r)=>{let n=Dg(t,e),i=Jb(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},M3=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:O3},U3=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=na(),o=xC({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){YEt(this,o,s)},onStdoutDataDone:s}},YEt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},F3=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await L3(t),await n,await k3(i),await e,r.readable&&r.push(null)}catch(s){await k3(i),pwe(r,s)}},j3=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Vg(r,e)&&(pwe(t,n),await OC(e,n))},pwe=(t,e)=>{PC(t,t.readable,e)};import{Writable as KEt}from"stream";import{callbackify as hwe}from"util";var mwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=q3(t,r,e),o=new KEt({...B3(n,t,i),destroy:hwe(V3.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return z3(n,o),o},q3=(t,e,r)=>{let n=HP(t,e),i=Jb(r,n,"writableFinal"),s=Jb(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},B3=(t,e,r)=>({write:JEt.bind(void 0,t),final:hwe(ZEt.bind(void 0,t,e,r))}),JEt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},ZEt=async(t,e,r)=>{await Vg(r,e)&&(t.writable&&t.end(),await e)},z3=async(t,e,r)=>{try{await $3(t),e.writable&&e.end()}catch(n){await dwe(r),gwe(e,n)}},V3=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Vg(r,e),await Vg(n,e)&&(gwe(t,i),await OC(e,i))},gwe=(t,e)=>{PC(t,t.writable,e)};import{Duplex as XEt}from"stream";import{callbackify as QEt}from"util";var _we=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||Fi.has(r),{subprocessStdout:c,waitReadableDestroy:l}=D3(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=q3(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=M3(c,a),{read:_,onStdoutDataDone:S}=U3({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),E=new XEt({read:_,...B3(u,t,d),destroy:QEt(evt.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return F3({subprocessStdout:c,onStdoutDataDone:S,readable:E,subprocess:t,subprocessStdin:u}),z3(u,E,c),E},evt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([j3({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),V3({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var H3=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||Fi.has(e),o=Dg(t,r),a=xC({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return tvt(a,o,t)},tvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var ywe=(t,{encoding:e})=>{let r=lwe();t.readable=fwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=mwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=_we.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=H3.bind(void 0,t,e),t[Symbol.asyncIterator]=H3.bind(void 0,t,e,{})};var Swe=(t,e)=>{for(let[r,n]of nvt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},rvt=(async()=>{})().constructor.prototype,nvt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(rvt,t)]);var Ewe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=ovt(t,e,r),{subprocess:f,promise:p}=cvt({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=RC.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Swe(f,p),ia.set(f,{options:u,fileDescriptors:d}),f},ovt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=DP(t,e,r),{file:a,commandArguments:c,options:l}=rC(t,e,r),u=avt(l),d=CTe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},avt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},cvt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=svt(...nC(t,e,r))}catch(h){return xTe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;ivt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];jTe(c,a,l),BTe(c,r,l);let d={},f=na();c.kill=rve.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=rwe(c,r),ywe(c,r),wTe(c,r);let p=lvt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},lvt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,_]=await cwe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let S=h.map((g,w)=>Tc(g,e,w)),E=Tc(m,e,"all"),y=uvt({errorInfo:d,exitCode:f,signal:p,stdio:S,all:E,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return qg(y,n,e)},uvt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Vb({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof sa,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):dC({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var CC=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,dvt(n,t[n],i)]));return{...t,...r}},dvt=(t,e,r)=>fvt.has(t)&&mr(e)&&mr(r)?{...e,...r}:r,fvt=new Set(["env",...v6]);var Tu=(t,e,r,n)=>{let i=(o,a,c)=>Tu(o,a,r,c),s=(...o)=>pvt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},pvt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(mr(s))return i(t,CC(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=hvt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?yTe(a,c,l):Ewe(a,c,l,i)},hvt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=CSe(e)?NSe(e,r):[e,...r],[o,a,c]=AP(...s),l=CC(CC(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var vwe=({file:t,commandArguments:e})=>Twe(t,e),bwe=({file:t,commandArguments:e})=>({...Twe(t,e),isSync:!0}),Twe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=mvt(t);return{file:r,commandArguments:n}},mvt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(gvt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},gvt=/ +/g;var wwe=(t,e,r)=>{t.sync=e(_vt,r),t.s=t.sync},Awe=({options:t})=>Rwe(t),_vt=({options:t})=>({...Rwe(t),isSync:!0}),Rwe=t=>({options:{...yvt(t),...t}}),yvt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},xwe={preferLocal:!0};var Iwe=Tu(()=>({})),bdr=Tu(()=>({isSync:!0})),Owe=Tu(vwe),Tdr=Tu(bwe),wdr=Tu(Fve),Adr=Tu(Awe,{},xwe,wwe),{sendMessage:Rdr,getOneMessage:xdr,getEachMessage:Idr,getCancelSignal:Odr}=ATe();import{Transform as Svt}from"stream";var Evt=["NETLIFY_AI_GATEWAY_KEY"];function vvt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,...Evt])]}function bvt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function Tvt(){let e=vvt().map(r=>process.env[r]).filter(r=>!(!r||bvt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function bs(t){if(typeof t!="string")return t;let e=Tvt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(wvt(n),"g");r=r.replace(i,"******")}),r}function wvt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Zb=class extends Svt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=bs(i);n(null,s)}},NC=Symbol("maskedWrite");function Pwe(){if(process.env.NETLIFY_MASK_LOGS!=="false"){if(!process.stdout.write[NC]){let e=process.stdout.write.bind(process.stdout),r=function(n,i,s){let o=typeof n=="string"?bs(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[NC]=!0,process.stdout.write=r}if(!process.stderr.write[NC]){let e=process.stderr.write.bind(process.stderr),r=function(n,i,s){let o=typeof n=="string"?bs(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[NC]=!0,process.stderr.write=r}}}var Cwe=!1,Nwe=()=>{Cwe=!0},Si=()=>Cwe;var Xb=null,kwe=t=>(Xb&&Xb.destroy(),Xb=new wc({totalAllowedTime:t}),Xb),$we=()=>Xb;var wc=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&Si())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await TP({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{be.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Lwe={name:"@netlify/agent-runner-cli",type:"module",version:"1.152.0-EX-2670.1",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.4","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var Ivt=Rvt(import.meta.url),Ovt=Ac.dirname(Ivt),Pvt=xvt(import.meta.url),Hg=Ee("shell"),G3=new Set,Dwe={preferLocal:!0},Gn=(t,e,r)=>{let[n,i]=Cvt(e,r),s={...Dwe,...i},o=Iwe(t,n,s);Uwe(o,s),qwe(o);let a=r?.idleTimeout;return a&&a>0&&jwe(o,a),o},Mwe=(t,e)=>{let r={...Dwe,...e},n=Owe(t,r);return Uwe(n,r),qwe(n),e?.idleTimeout&&e.idleTimeout>0&&jwe(n,e.idleTimeout),n},Cvt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Uwe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Rc.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new Zb).pipe(Rc.stdout),t.stderr?.pipe(new Zb).pipe(Rc.stderr);return}t.stdout?.pipe(Rc.stdout),t.stderr?.pipe(Rc.stderr)},W3=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Rc.kill(-t.pid,e),Hg.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Hg.error("Error killing process:",r),!1}},Fwe=t=>W3(t,"SIGKILL"),jwe=(t,e)=>{let r=null,n=()=>{Hg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),W3(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Hg.log(`Force killing idle process ${t.pid}`),Fwe(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},qwe=t=>{G3.add(t);let e=$we();if(e){let r=e.onTimesUp(()=>{Hg.log(`Global timer expired, killing process ${t.pid}`),W3(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Hg.log(`Force killing process ${t.pid} after timeout`),Fwe(t))},5e3)});t.on("exit",()=>{G3.delete(t),r()}),t.on("error",()=>{G3.delete(t),r()})}};function aa(t,e){if(!Rc.env.NETLIFY_LOCAL_MODE)try{let i=Pvt.resolve(Lwe.name),s=Ac.dirname(i);for(;s!==Ac.dirname(s);){let o=Ac.dirname(s);if(Ac.basename(o)==="node_modules"){let a=Ac.join(o,".bin",e);if(kC.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Rc.env.NODE_PATH){let i=Ac.join(Rc.env.NODE_PATH,".bin",e);if(kC.existsSync(i))return i}let r=Ac.join(t,"node_modules",".bin",e);if(kC.existsSync(r))return r;let n=Ac.join(Ovt,"..","node_modules",".bin",e);if(kC.existsSync(n))return n}import JL from"process";import{fileURLToPath as G$t}from"url";import{createRequire as W$t}from"module";import ZL from"path";var Nvt="__netlify__getTracer",kvt="__netlify__shutdownTracers",gt=(t,e)=>globalThis[Nvt]?.(t,e),Bwe=async()=>globalThis[kvt]?.();function qf(t,e,r,n,i){let s=typeof n=="function"?n:typeof r=="function"?r:i;if(!s)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,s):s()}import{setTimeout as j$t}from"timers/promises";Ne();import twt from"process";Ne();var nbt=(t,e)=>{e.recordException(t),e.setStatus({code:In.ERROR})};var Oc=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=L0e(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>D0e(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=L0e(r,n,i),c=this._tracer.startSpan(e,s,o);return D0e(c,s,a)}};function L0e(t,e,r){let n,i,s;return!e&&!r?s=t:r?(n=t,i=e,s=r):(n=t,s=e),n=n??{},i=i??Ut.active(),{opts:n,ctx:i,fn:s}}function D0e(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:nbt,s=o=>{throw i(o,t),t.end(),o};try{let o=r(t);return typeof o?.then=="function"?o.then(a=>(t.end(),a),s):(t.end(),o)}catch(o){throw s(o)}}Ne();var Xg=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var xW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=G0e(e),n._asyncAttributesPending=e.filter(([i,s])=>Xg(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(Xg(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=G0e(this._rawAttributes),this._schemaUrl=ibt(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,Xg(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&ae.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(Xg(n)){ae.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=sbt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function IW(t,e){return xW.FromAttributeList(Object.entries(t),e)}function G0e(t){return t.map(([e,r])=>Xg(r)?[e,r.catch(n=>{ae.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function ibt(t){if(typeof t=="string"||t===void 0)return t;ae.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function sbt(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;ae.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Ne();var uT=class{emit(e){}enabled(){return!1}},W0e=new uT;var dT=Symbol.for("io.opentelemetry.js.api.logs"),Qg=globalThis;function Y0e(t,e,r){return n=>n===t?e:r}var OW=1;var PW=class{getLogger(e,r,n){return new uT}},rN=new PW;var nN=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):W0e}};var fT=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new nN(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:rN}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var iN=class t{constructor(){this._proxyLoggerProvider=new fT}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Qg[dT]?this.getLoggerProvider():(Qg[dT]=Y0e(OW,e,rN),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Qg[dT])===null||e===void 0?void 0:e.call(Qg,OW))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Qg[dT],this._proxyLoggerProvider=new fT}};var K0e=iN.getInstance();function J0e(t,e,r,n){for(let i=0,s=t.length;i<s;i++){let o=t[i];e&&o.setTracerProvider(e),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function Z0e(t){t.forEach(e=>e.disable())}function CW(t){let e=t.tracerProvider||zt.getTracerProvider(),r=t.meterProvider||lT.getMeterProvider(),n=t.loggerProvider||K0e.getLoggerProvider(),i=t.instrumentations?.flat()??[];return J0e(i,e,r,n),()=>{Z0e(i)}}$c();var pk=Ln(kY(),1);Ne();$c();var HIe=t=>{throw TypeError(t)},MY=(t,e,r)=>e.has(t)||HIe("Cannot "+r),fk=(t,e,r)=>(MY(t,e,"read from private field"),r?r.call(t):e.get(t)),$Y=(t,e,r)=>e.has(t)?HIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),BIe=(t,e,r,n)=>(MY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ewt=(t,e,r)=>(MY(t,e,"access private method"),r),zIe="__netlify__getTracer",rwt="__netlify__shutdownTracers",nwt="__nfOTLPTrace",NT,kT,DY,GIe,iwt=class{constructor(){$Y(this,DY),$Y(this,NT),$Y(this,kT),BIe(this,NT,new i_(ewt(this,DY,GIe),this)),BIe(this,kT,ae.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(fk(this,kT).debug(`export ${t.length.toString()} spans`),fk(this,NT).isCalled){e({code:Yn.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(nwt,JSON.stringify(swt(t))),e({code:Yn.SUCCESS})}shutdown(){return fk(this,NT).call()}};NT=new WeakMap;kT=new WeakMap;DY=new WeakSet;GIe=function(){return fk(this,kT).debug("Shutting down"),Promise.resolve()};function swt(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:dk(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||io.SERVER,startTimeUnixNano:LY(e.startTime),endTimeUnixNano:LY(e.endTime),attributes:dk(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:LY(n.time),attributes:dk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:dk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function dk(t){return Object.keys(t).map(e=>WIe(e,t[e]))}function WIe(t,e){return{key:t,value:YIe(e)}}function YIe(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(YIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>WIe(r,n))}}:{}}function LY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var VIe={name:"@netlify/otel",version:"6.0.4",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^4.4.7",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.7.1","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},KIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,zIe))return;let e=twt.version.slice(1),r=IW({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[owt()],i=new pk.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new kc});let s=t.instrumentations??[];CW({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,zIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new Oc(zt.getTracer(a,c)):new Oc(zt.getTracer(VIe.name,VIe.version))}}),Object.defineProperty(globalThis,rwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},owt=()=>new pk.SimpleSpanProcessor(new iwt);Ne();$c();var $T=Ln(kY(),1);Ne();import*as hk from"diagnostics_channel";var JIe=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?In.ERROR:In.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],s=n.some(a=>r.includes(a.toString())),o={};if(s)return o;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?o[d]="REDACTED":o[d]=l.toString()}return o}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof Oc?t:new Oc(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){hk.subscribe(t,e);let r=()=>hk.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:io.CLIENT},Ut.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:In.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var cDe=Ln(oDe(),1);var YL=Ee("tracing"),aDe=8e3,q$t=5e3,Ww=async(t=q$t)=>{try{await Promise.race([Bwe(),j$t(t)])}catch(e){YL.warn("Failed to flush tracers on shutdown",e)}},lDe=async(t,e,r)=>{if(!gt()){let n=[new $T.SimpleSpanProcessor(new vJ),new $T.SimpleSpanProcessor(new cDe.OTLPTraceExporter({url:r.exporterUrl}))];await KIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new JIe({skipHeaders:!0})]})}return r.traceparent?(Wn.setGlobalPropagator(new kc),Wn.extract(Ut.active(),{traceparent:r.traceparent,isRemote:!0})):Ut.active()};function Ht(t,e,r){return YL.log(`\u23F3 TRACE: ${e} starting...`),qf(t,e,r)}var vJ=class{export(e,r){for(let n of e)this.logSpan(n);r({code:1})}async shutdown(){}forceFlush(){return Promise.resolve()}logSpan(e){let r=(e.endTime[0]-e.startTime[0])*1e3+(e.endTime[1]-e.startTime[1])/1e6,n=e.attributes,i=[];for(let[a,c]of Object.entries(n))a.includes("duration")&&typeof c=="number"?i.push(`${a}=${c.toFixed(2)}ms`):i.push(`${a}=${c}`);let s=e.status?.code===2?"\u274C":"\u2705",o=i.length>0?` [${i.join(", ")}]`:"";YL.log(`${s} TRACE: ${e.name} completed in ${r.toFixed(2)}ms${o}`),e.status?.code===2&&e.status.message&&YL.log(` \u274C Error: ${e.status.message}`)}};function bJ(){return rt().captureLlmContentEnabled}function uDe(t){return t.includes("claude")?"anthropic":t.includes("codex")?"openai":t.includes("gemini")?"google":t.includes("opencode")?"opencode":t}function KL(t,e,r){let n={role:t,parts:[{type:"text",content:bs(e)}]};return r&&(n.finish_reason=r),JSON.stringify([n])}function dDe(t,e,r,n){if(!t.length)return;let i=gt();if(!i)return;let s=bJ(),o=Math.max(1,(n-r)/t.length);t.forEach((a,c)=>{let l=Math.min(n,r+c*o),u=Math.min(n,l+o),d=a.title||a.type||`step-${a.id??c}`,f=a.type==="tool_use"||a.type==="tool_result",p=a.message?a.message.length>aDe?`${a.message.slice(0,aDe)}\u2026`:a.message:void 0;i.startSpan(d,{startTime:l,attributes:{"gen_ai.capability.name":e,"gen_ai.step.name":d,"gen_ai.operation.name":f?"execute_tool":"chat",...f?{"gen_ai.tool.name":d}:{},"spark.step.id":a.id??-1,...a.type?{"spark.step.type":a.type}:{},...a.category?{"spark.step.category":a.category}:{},...a.groupId?{"spark.step.group_id":a.groupId}:{},...a.parentGroupId?{"spark.step.parent_group_id":a.parentGroupId}:{},...s&&p?f?{"gen_ai.tool.call.result":bs(p)}:{"gen_ai.output.messages":KL("assistant",p)}:{}}}).end(u)})}import{readdir as B$t,rm as z$t}from"fs/promises";import{join as V$t}from"path";async function fDe(t,e=[]){let n=(await B$t(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>z$t(V$t(t,i),{recursive:!0,force:!0})))}var H$t=700,pDe=t=>t.mode==="create"&&(t.accountType===Tl||t.enforcedAICreditsRemaining!=null&&t.enforcedAICreditsRemaining<=H$t);var Y$t=ZL.dirname(G$t(import.meta.url)),hDe=W$t(import.meta.url),K$t=ZL.resolve(Y$t,"scripts/scaffold.js"),J$t="scripts/scaffold.js",Z$t=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,TJ=t=>{if(t.length>=2){let e=t[0],r=t[t.length-1];if(e==='"'&&r==='"'||e==="'"&&r==="'")return t.slice(1,-1)}return t},X$t=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),Q$t=t=>{let e=TJ(t);return e==="node"||e.endsWith("/node")},tl=t=>{if(typeof t!="string")return!1;let e=t.match(Z$t)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&X$t(TJ(e[r]));)r+=1;if(r>=e.length||!Q$t(e[r]))return!1;let n=e[r+1];return n?TJ(n).includes(J$t):!1},uy=Ee("create_stage"),mDe="Do not run local validation or dev-server commands to check your work \u2014 specifically `tsc`, `npx tsc`, `vite build`, `vite dev`, or any equivalent build/start/test command. The build pipeline installs and validates the project automatically after your edits. Verify your changes by reading the files you edited.",eLt=`${mDe}
587
+ if (condition) { yield value; }`)};import{Buffer as Myt}from"buffer";import{StringDecoder as Uyt}from"string_decoder";var _C=(t,e,r)=>{if(r)return;if(t)return{transform:Fyt.bind(void 0,new TextEncoder)};let n=new Uyt(e);return{transform:jyt.bind(void 0,n),final:qyt.bind(void 0,n)}},Fyt=function*(t,e){Myt.isBuffer(e)?yield Ec(e):typeof e=="string"?yield t.encode(e):yield e},jyt=function*(t,e){yield Cr(e)?t.write(e):e},qyt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as rTe}from"util";var l3=rTe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),yC=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zyt}=e[r];for await(let i of n(t))yield*yC(i,e,r+1)},nTe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Byt(r,Number(e),t)},Byt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*yC(n,r,e+1)},iTe=rTe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),zyt=function*(t){yield t};var u3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},sTe=(t,e)=>[...e.flatMap(r=>[...Uf(r,t,0)]),...Hb(t)],Uf=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Hyt}=e[r];for(let i of n(t))yield*Uf(i,e,r+1)},Hb=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Vyt(r,Number(e),t)},Vyt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Uf(n,r,e+1)},Hyt=function*(t){yield t};var d3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=aTe(t,o,s),l=Mf(e),u=Mf(r),d=l?l3.bind(void 0,yC,a):u3.bind(void 0,Uf),f=l||u?l3.bind(void 0,nTe,a):u3.bind(void 0,Hb),p=l||u?iTe.bind(void 0,a):void 0;return{stream:new Gyt({writableObjectMode:n,writableHighWaterMark:oTe(n),readableObjectMode:i,readableHighWaterMark:oTe(i),transform(m,_,S){d([m,c,0],this,S)},flush(m){f([c],this,m)},destroy:p})}},SC=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=aTe(o,r,a);t=sTe(c,t)}return t},aTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:Qbe(n,a)},_C(r,o,n),gC(r,s,n,c),{transform:t,final:e},{transform:eTe(i,a)},Xbe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var cTe=(t,e)=>{for(let r of Wyt(t))Yyt(t,r,e)},Wyt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Yyt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${bu[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>Kyt(a,n));r.input=Lb(o)},Kyt=(t,e)=>{let r=SC(t,e,"utf8",!0);return Jyt(r),Lb(r)},Jyt=t=>{let e=t.find(r=>typeof r!="string"&&!Cr(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as eSt,appendFileSync as tSt}from"fs";var EC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Cg(r,n)&&!Fi.has(e)&&Zyt(n)&&(t.some(({type:i,value:s})=>i==="native"&&Xyt.has(s))||t.every(({type:i})=>vs.has(i))),Zyt=t=>t===1||t===2,Xyt=new Set(["pipe","overlapped"]),lTe=async(t,e,r,n)=>{for await(let i of t)Qyt(e)||dTe(i,r,n)},uTe=(t,e,r)=>{for(let n of t)dTe(n,e,r)},Qyt=t=>t._readableState.pipes.length>0,dTe=(t,e,r)=>{let n=$P(t);ra({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var fTe=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>rSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},rSt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=pbe(t,s,d),p=Ec(f),{stdioItems:h,objectMode:m}=e[r],_=nSt([p],h,c,n),{serializedResult:S,finalResult:E=S}=iSt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});sSt({serializedResult:S,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let y=a[r]?E:void 0;try{return n.error===void 0&&oSt(S,h,i),y}catch(g){return n.error=g,y}},nSt=(t,e,r,n)=>{try{return SC(t,e,r,!1)}catch(i){return n.error=i,t}},iSt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Lb(t)};let o=xSe(t,r);return n[s]?{serializedResult:o,finalResult:c3(o,!i[s],e)}:{serializedResult:o}},sSt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!EC({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=c3(t,!1,o);try{uTe(a,e,n)}catch(c){r.error??=c}},oSt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>hC.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?tSt(n,t):(r.add(s),eSt(n,t))}};var pTe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Tc(e,r,"all")]:Array.isArray(e)?[Tc(t,r,"all"),...e]:Cr(t)&&Cr(e)?_6([t,e]):`${t}${e}`};import{once as f3}from"events";var hTe=async(t,e)=>{let[r,n]=await aSt(t);return e.isForcefullyTerminated??=!1,[r,n]},aSt=async t=>{let[e,r]=await Promise.allSettled([f3(t,"spawn"),f3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?mTe(t):r.value},mTe=async t=>{try{return await f3(t,"exit")}catch{return mTe(t)}},gTe=async t=>{let[e,r]=await t;if(!cSt(e,r)&&p3(e,r))throw new to;return[e,r]},cSt=(t,e)=>t===void 0&&e===void 0,p3=(t,e)=>t!==0||e!==null;var _Te=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=lSt(t,e,r),o=s?.code==="ETIMEDOUT",a=fbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},lSt=(t,e,r)=>t!==void 0?t:p3(e,r)?new to:void 0;var yTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=dSt(t,e,r),d=hSt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return qg(d,c,l)},dSt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=DP(t,e,r),a=fSt(r),{file:c,commandArguments:l,options:u}=rC(t,e,a);pSt(u);let d=Ybe(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},fSt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,pSt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&vC("ipcInput"),t&&vC("ipc: true"),r&&vC("detached: true"),n&&vC("cancelSignal")},vC=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},hSt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=mSt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=_Te(c,r),{output:h,error:m=l}=fTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((E,y)=>Tc(E,r,y)),S=Tc(pTe(h,r),r,"all");return _St({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:S,options:r,command:n,escapedCommand:i,startTime:a})},mSt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{cTe(s,r);let a=gSt(r);return uSt(...nC(t,e,a))}catch(a){return jg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},gSt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:uC(e)}),_St=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?dC({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):Vb({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as ivt}from"events";import{spawn as svt}from"child_process";import TTe from"process";import{once as h3,on as ySt}from"events";var STe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>($g({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:JP(t)}),SSt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),SSt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{GP(e,i);let s=vu(t,e,r),o=new AbortController;try{return await Promise.race([ESt(s,n,o),vSt(s,r,o),bSt(s,r,o)])}catch(a){throw Lg(t),a}finally{o.abort(),WP(e,i)}},ESt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await h3(t,"message",{signal:r});return n}for await(let[n]of ySt(t,"message",{signal:r}))if(e(n))return n},vSt=async(t,e,{signal:r})=>{await h3(t,"disconnect",{signal:r}),sve(e)},bSt=async(t,e,{signal:r})=>{let[n]=await h3(t,"strict:error",{signal:r});throw zP(n,e)};import{once as vTe,on as TSt}from"events";var bTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>m3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),m3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{$g({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:JP(t)}),GP(e,s);let o=vu(t,e,r),a=new AbortController,c={};return wSt(t,o,a),ASt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),RSt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},wSt=async(t,e,r)=>{try{await vTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},ASt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await vTe(t,"strict:error",{signal:r.signal});n.error=zP(i,e),r.abort()}catch{}},RSt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of TSt(r,"message",{signal:s.signal}))ETe(o),yield c}catch{ETe(o)}finally{s.abort(),WP(e,a),n||Lg(t),i&&await t}},ETe=({error:t})=>{if(t)throw t};var wTe=(t,{ipc:e})=>{Object.assign(t,RTe(t,!1,e))},ATe=()=>{let t=TTe,e=!0,r=TTe.channel!==void 0;return{...RTe(t,e,r),getCancelSignal:Nve.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},RTe=(t,e,r)=>({sendMessage:eC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:STe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:bTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as xSt}from"child_process";import{PassThrough as ISt,Readable as OSt,Writable as PSt,Duplex as CSt}from"stream";var xTe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{s3(n);let a=new xSt;NSt(a,n),Object.assign(a,{readable:kSt,writable:$St,duplex:LSt});let c=jg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=DSt(c,o,i);return{subprocess:a,promise:l}},NSt=(t,e)=>{let r=Gb(),n=Gb(),i=Gb(),s=Array.from({length:e.length-3},Gb),o=Gb(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},Gb=()=>{let t=new ISt;return t.end(),t},kSt=()=>new OSt({read(){}}),$St=()=>new PSt({write(){}}),LSt=()=>new CSt({read(){},write(){}}),DSt=async(t,e,r)=>qg(t,e,r);import{createReadStream as ITe,createWriteStream as OTe}from"fs";import{Buffer as MSt}from"buffer";import{Readable as Wb,Writable as USt,Duplex as FSt}from"stream";var CTe=(t,e)=>mC(jSt,t,e,!1),Yb=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${bu[t]}.`)},PTe={fileNumber:Yb,generator:d3,asyncGenerator:d3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:FSt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},jSt={input:{...PTe,fileUrl:({value:t})=>({stream:ITe(t)}),filePath:({value:{file:t}})=>({stream:ITe(t)}),webStream:({value:t})=>({stream:Wb.fromWeb(t)}),iterable:({value:t})=>({stream:Wb.from(t)}),asyncIterable:({value:t})=>({stream:Wb.from(t)}),string:({value:t})=>({stream:Wb.from(t)}),uint8Array:({value:t})=>({stream:Wb.from(MSt.from(t))})},output:{...PTe,fileUrl:({value:t})=>({stream:OTe(t)}),filePath:({value:{file:t,append:e}})=>({stream:OTe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:USt.fromWeb(t)}),iterable:Yb,asyncIterable:Yb,string:Yb,uint8Array:Yb}};import{on as qSt,once as NTe}from"events";import{PassThrough as BSt,getDefaultHighWaterMark as zSt}from"stream";import{finished as LTe}from"stream/promises";function Ff(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)_3(i);let e=t.some(({readableObjectMode:i})=>i),r=VSt(t,e),n=new g3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var VSt=(t,e)=>{if(t.length===0)return zSt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},g3=class extends BSt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(_3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=HSt(this,this.#e,this.#s);let r=YSt({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(_3(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},HSt=async(t,e,r)=>{bC(t,kTe);let n=new AbortController;try{await Promise.race([GSt(t,n),WSt(t,e,r,n)])}finally{n.abort(),bC(t,-kTe)}},GSt=async(t,{signal:e})=>{try{await LTe(t,{signal:e,cleanup:!0})}catch(r){throw DTe(t,r),r}},WSt=async(t,e,r,{signal:n})=>{for await(let[i]of qSt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},_3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},YSt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{bC(t,$Te);let a=new AbortController;try{await Promise.race([KSt(s,e,a),JSt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),ZSt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),bC(t,-$Te)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?y3(t):XSt(t))},KSt=async(t,e,{signal:r})=>{try{await t,r.aborted||y3(e)}catch(n){r.aborted||DTe(e,n)}},JSt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await LTe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;MTe(o)?i.add(e):UTe(t,o)}},ZSt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await NTe(t,i,{signal:s}),!t.readable)return NTe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},XSt=t=>{t.writable&&t.end()},DTe=(t,e)=>{MTe(e)?y3(t):UTe(t,e)},MTe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",y3=t=>{(t.readable||t.writable)&&t.destroy()},UTe=(t,e)=>{t.destroyed||(t.once("error",QSt),t.destroy(e))},QSt=()=>{},bC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},kTe=2,$Te=1;import{finished as FTe}from"stream/promises";var zg=(t,e)=>{t.pipe(e),eEt(t,e),tEt(t,e)},eEt=async(t,e)=>{if(!(eo(t)||eo(e))){try{await FTe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}S3(e)}},S3=t=>{t.writable&&t.end()},tEt=async(t,e)=>{if(!(eo(t)||eo(e))){try{await FTe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}E3(t)}},E3=t=>{t.readable&&t.destroy()};var jTe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>vs.has(c)))rEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!vs.has(c)))iEt({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Ff(s);zg(o,i)}},rEt=(t,e,r,n)=>{r==="output"?zg(t.stdio[n],e):zg(e,t.stdio[n]);let i=nEt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},nEt=["stdin","stdout","stderr"],iEt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;sEt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},sEt=(t,{signal:e})=>{eo(t)&&Lf(t,oEt,e)},oEt=2;import{addAbortListener as lEt}from"events";var jf=[];jf.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&jf.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jf.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var TC=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",v3=Symbol.for("signal-exit emitter"),b3=globalThis,aEt=Object.defineProperty.bind(Object),T3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(b3[v3])return b3[v3];aEt(b3,v3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},wC=class{},cEt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),w3=class extends wC{onExit(){return()=>{}}load(){}unload(){}},A3=class extends wC{#e=R3.platform==="win32"?"SIGINT":"SIGHUP";#r=new T3;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of jf)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!TC(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of jf)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,jf.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return TC(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&TC(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},R3=globalThis.process,{onExit:qTe,load:Ncr,unload:kcr}=cEt(TC(R3)?new A3(R3):new w3);var BTe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=qTe(()=>{t.kill()});lEt(n,()=>{i()})};var VTe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=LP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=uEt(r,n,i),{sourceStream:d,sourceError:f}=fEt(t,l),{options:p,fileDescriptors:h}=ia.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},uEt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=dEt(t,e,...r),a=HP(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},dEt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(zTe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||m6(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=AP(r,...n);return{destination:e(zTe)(i,s,o),pipeOptions:o}}if(ia.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},zTe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),fEt=(t,e)=>{try{return{sourceStream:Dg(t,e)}}catch(r){return{sourceError:r}}};var GTe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=pEt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw x3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},pEt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return E3(t),n;if(e!==void 0)return S3(r),e},x3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>jg({error:t,command:HTe,escapedCommand:HTe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),HTe="source.pipe(destination)";var WTe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as hEt}from"stream/promises";var YTe=(t,e,r)=>{let n=AC.has(e)?gEt(t,e):mEt(t,e);return Lf(t,yEt,r.signal),Lf(e,SEt,r.signal),_Et(e),n},mEt=(t,e)=>{let r=Ff([t]);return zg(r,e),AC.set(e,r),r},gEt=(t,e)=>{let r=AC.get(e);return r.add(t),r},_Et=async t=>{try{await hEt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}AC.delete(t)},AC=new WeakMap,yEt=2,SEt=1;import{aborted as EEt}from"util";var KTe=(t,e)=>t===void 0?[]:[vEt(t,e)],vEt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await EEt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw x3({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var RC=(t,...e)=>{if(mr(e[0]))return RC.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=VTe(t,...e),i=bEt({...n,destination:r});return i.pipe=RC.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},bEt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=TEt(t,i);GTe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=YTe(e,s,d);return await Promise.race([WTe(u),...KTe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},TEt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as PEt}from"timers/promises";import{on as wEt}from"events";import{getDefaultHighWaterMark as AEt}from"stream";var xC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return REt(e,o),ZTe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},REt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},I3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;xEt(e,o,t);let a=t.readableObjectMode&&!s;return ZTe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},xEt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},ZTe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=wEt(t,"data",{signal:e.signal,highWaterMark:JTe,highWatermark:JTe});return IEt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},O3=AEt(!0),JTe=O3,IEt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=OEt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*Uf(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Hb(a)}},OEt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[_C(t,r,!e),gC(t,i,!n,{})].filter(Boolean);var XTe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=CEt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([NEt(t),d]);return}let f=o3(c,r),p=I3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([kEt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},CEt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!EC({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=I3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await lTe(a,t,r,s)},NEt=async t=>{await PEt(),t.readableFlowing===null&&t.resume()},kEt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await aC(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await cC(r,{maxBuffer:s})):await Fg(r,{maxBuffer:s})}catch(a){return QTe(lbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},P3=async t=>{try{return await t}catch(e){return QTe(e)}},QTe=({bufferedData:t})=>ASe(t)?new Uint8Array(t):t;import{finished as $Et}from"stream/promises";var Kb=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=LEt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],$Et(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||UEt(a,e,r,n)}finally{o.abort()}},LEt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&DEt(t,r,n),n},DEt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{MEt(e,r),n.call(t,...i)}},MEt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},UEt=(t,e,r,n)=>{if(!FEt(t,e,r,n))throw t},FEt=(t,e,r,n=!0)=>r.propagating?ewe(t)||IC(t):(r.propagating=!0,C3(r,e)===n?ewe(t):IC(t)),C3=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",IC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ewe=t=>t?.code==="EPIPE";var twe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>N3({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),N3=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=Kb(t,e,l);if(C3(l,e)){await u;return}let[d]=await Promise.all([XTe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var rwe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ff([t,e].filter(Boolean)):void 0,nwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>N3({...jEt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:qEt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),jEt=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},qEt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as BEt}from"events";var iwe=t=>Cg(t,"ipc"),swe=(t,e)=>{let r=$P(t);ra({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var owe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=iwe(s),a=vc(e,"ipc"),c=vc(r,"ipc");for await(let l of m3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(ube(t,i,c),i.push(l)),o&&swe(l,s);return i},awe=async(t,e)=>(await Promise.allSettled([t]),e);var cwe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:S})=>{let E=hTe(t,f),y={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:E,propagating:!1},g=twe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),w=nwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),P=[],x=owe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),A=zEt(m,t,y),O=VEt(h,y);try{return await Promise.race([Promise.all([{},gTe(E),Promise.all(g),w,x,Bve(t,d),...A,...O]),_,HEt(t,S),...Mve(t,s,f,S),...ive({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:S}),...Lve({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:S})])}catch(R){return f.terminationReason??="other",Promise.all([{error:R},E,Promise.all(g.map(b=>P3(b))),P3(w),awe(x,P),Promise.allSettled(A),Promise.allSettled(O)])}},zEt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Kb(n,i,r)),VEt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>no(s,{checkOpen:!1})&&!eo(s)).map(({type:i,value:s,stream:o=s})=>Kb(o,n,e,{isSameDirection:vs.has(i),stopOnExit:i==="native"}))),HEt=async(t,{signal:e})=>{let[r]=await BEt(t,"error",{signal:e});throw r};var lwe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Jb=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=na();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Vg=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as GEt}from"stream";import{callbackify as WEt}from"util";import{finished as uwe}from"stream/promises";var k3=async t=>{if(t!==void 0)try{await $3(t)}catch{}},dwe=async t=>{if(t!==void 0)try{await L3(t)}catch{}},$3=async t=>{await uwe(t,{cleanup:!0,readable:!1,writable:!0})},L3=async t=>{await uwe(t,{cleanup:!0,readable:!0,writable:!1})},OC=async(t,e)=>{if(await t,e)throw e},PC=(t,e,r)=>{r&&!IC(r)?t.destroy(r):e&&t.destroy()};var fwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||Fi.has(r),{subprocessStdout:a,waitReadableDestroy:c}=D3(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=M3(a,o),{read:f,onStdoutDataDone:p}=U3({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new GEt({read:f,destroy:WEt(j3.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return F3({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},D3=(t,e,r)=>{let n=Dg(t,e),i=Jb(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},M3=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:O3},U3=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=na(),o=xC({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){YEt(this,o,s)},onStdoutDataDone:s}},YEt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},F3=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await L3(t),await n,await k3(i),await e,r.readable&&r.push(null)}catch(s){await k3(i),pwe(r,s)}},j3=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Vg(r,e)&&(pwe(t,n),await OC(e,n))},pwe=(t,e)=>{PC(t,t.readable,e)};import{Writable as KEt}from"stream";import{callbackify as hwe}from"util";var mwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=q3(t,r,e),o=new KEt({...B3(n,t,i),destroy:hwe(V3.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return z3(n,o),o},q3=(t,e,r)=>{let n=HP(t,e),i=Jb(r,n,"writableFinal"),s=Jb(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},B3=(t,e,r)=>({write:JEt.bind(void 0,t),final:hwe(ZEt.bind(void 0,t,e,r))}),JEt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},ZEt=async(t,e,r)=>{await Vg(r,e)&&(t.writable&&t.end(),await e)},z3=async(t,e,r)=>{try{await $3(t),e.writable&&e.end()}catch(n){await dwe(r),gwe(e,n)}},V3=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Vg(r,e),await Vg(n,e)&&(gwe(t,i),await OC(e,i))},gwe=(t,e)=>{PC(t,t.writable,e)};import{Duplex as XEt}from"stream";import{callbackify as QEt}from"util";var _we=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||Fi.has(r),{subprocessStdout:c,waitReadableDestroy:l}=D3(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=q3(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=M3(c,a),{read:_,onStdoutDataDone:S}=U3({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),E=new XEt({read:_,...B3(u,t,d),destroy:QEt(evt.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return F3({subprocessStdout:c,onStdoutDataDone:S,readable:E,subprocess:t,subprocessStdin:u}),z3(u,E,c),E},evt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([j3({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),V3({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var H3=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||Fi.has(e),o=Dg(t,r),a=xC({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return tvt(a,o,t)},tvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var ywe=(t,{encoding:e})=>{let r=lwe();t.readable=fwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=mwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=_we.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=H3.bind(void 0,t,e),t[Symbol.asyncIterator]=H3.bind(void 0,t,e,{})};var Swe=(t,e)=>{for(let[r,n]of nvt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},rvt=(async()=>{})().constructor.prototype,nvt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(rvt,t)]);var Ewe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=ovt(t,e,r),{subprocess:f,promise:p}=cvt({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=RC.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Swe(f,p),ia.set(f,{options:u,fileDescriptors:d}),f},ovt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=DP(t,e,r),{file:a,commandArguments:c,options:l}=rC(t,e,r),u=avt(l),d=CTe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},avt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},cvt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=svt(...nC(t,e,r))}catch(h){return xTe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;ivt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];jTe(c,a,l),BTe(c,r,l);let d={},f=na();c.kill=rve.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=rwe(c,r),ywe(c,r),wTe(c,r);let p=lvt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},lvt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,_]=await cwe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let S=h.map((g,w)=>Tc(g,e,w)),E=Tc(m,e,"all"),y=uvt({errorInfo:d,exitCode:f,signal:p,stdio:S,all:E,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return qg(y,n,e)},uvt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Vb({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof sa,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):dC({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var CC=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,dvt(n,t[n],i)]));return{...t,...r}},dvt=(t,e,r)=>fvt.has(t)&&mr(e)&&mr(r)?{...e,...r}:r,fvt=new Set(["env",...v6]);var Tu=(t,e,r,n)=>{let i=(o,a,c)=>Tu(o,a,r,c),s=(...o)=>pvt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},pvt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(mr(s))return i(t,CC(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=hvt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?yTe(a,c,l):Ewe(a,c,l,i)},hvt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=CSe(e)?NSe(e,r):[e,...r],[o,a,c]=AP(...s),l=CC(CC(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var vwe=({file:t,commandArguments:e})=>Twe(t,e),bwe=({file:t,commandArguments:e})=>({...Twe(t,e),isSync:!0}),Twe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=mvt(t);return{file:r,commandArguments:n}},mvt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(gvt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},gvt=/ +/g;var wwe=(t,e,r)=>{t.sync=e(_vt,r),t.s=t.sync},Awe=({options:t})=>Rwe(t),_vt=({options:t})=>({...Rwe(t),isSync:!0}),Rwe=t=>({options:{...yvt(t),...t}}),yvt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},xwe={preferLocal:!0};var Iwe=Tu(()=>({})),bdr=Tu(()=>({isSync:!0})),Owe=Tu(vwe),Tdr=Tu(bwe),wdr=Tu(Fve),Adr=Tu(Awe,{},xwe,wwe),{sendMessage:Rdr,getOneMessage:xdr,getEachMessage:Idr,getCancelSignal:Odr}=ATe();import{Transform as Svt}from"stream";var Evt=["NETLIFY_AI_GATEWAY_KEY"];function vvt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,...Evt])]}function bvt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function Tvt(){let e=vvt().map(r=>process.env[r]).filter(r=>!(!r||bvt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function bs(t){if(typeof t!="string")return t;let e=Tvt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(wvt(n),"g");r=r.replace(i,"******")}),r}function wvt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Zb=class extends Svt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=bs(i);n(null,s)}},NC=Symbol("maskedWrite");function Pwe(){if(process.env.NETLIFY_MASK_LOGS!=="false"){if(!process.stdout.write[NC]){let e=process.stdout.write.bind(process.stdout),r=function(n,i,s){let o=typeof n=="string"?bs(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[NC]=!0,process.stdout.write=r}if(!process.stderr.write[NC]){let e=process.stderr.write.bind(process.stderr),r=function(n,i,s){let o=typeof n=="string"?bs(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[NC]=!0,process.stderr.write=r}}}var Cwe=!1,Nwe=()=>{Cwe=!0},Si=()=>Cwe;var Xb=null,kwe=t=>(Xb&&Xb.destroy(),Xb=new wc({totalAllowedTime:t}),Xb),$we=()=>Xb;var wc=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&Si())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await TP({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{be.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Lwe={name:"@netlify/agent-runner-cli",type:"module",version:"1.152.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.4","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var Ivt=Rvt(import.meta.url),Ovt=Ac.dirname(Ivt),Pvt=xvt(import.meta.url),Hg=Ee("shell"),G3=new Set,Dwe={preferLocal:!0},Gn=(t,e,r)=>{let[n,i]=Cvt(e,r),s={...Dwe,...i},o=Iwe(t,n,s);Uwe(o,s),qwe(o);let a=r?.idleTimeout;return a&&a>0&&jwe(o,a),o},Mwe=(t,e)=>{let r={...Dwe,...e},n=Owe(t,r);return Uwe(n,r),qwe(n),e?.idleTimeout&&e.idleTimeout>0&&jwe(n,e.idleTimeout),n},Cvt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Uwe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Rc.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new Zb).pipe(Rc.stdout),t.stderr?.pipe(new Zb).pipe(Rc.stderr);return}t.stdout?.pipe(Rc.stdout),t.stderr?.pipe(Rc.stderr)},W3=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Rc.kill(-t.pid,e),Hg.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Hg.error("Error killing process:",r),!1}},Fwe=t=>W3(t,"SIGKILL"),jwe=(t,e)=>{let r=null,n=()=>{Hg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),W3(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Hg.log(`Force killing idle process ${t.pid}`),Fwe(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},qwe=t=>{G3.add(t);let e=$we();if(e){let r=e.onTimesUp(()=>{Hg.log(`Global timer expired, killing process ${t.pid}`),W3(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Hg.log(`Force killing process ${t.pid} after timeout`),Fwe(t))},5e3)});t.on("exit",()=>{G3.delete(t),r()}),t.on("error",()=>{G3.delete(t),r()})}};function aa(t,e){if(!Rc.env.NETLIFY_LOCAL_MODE)try{let i=Pvt.resolve(Lwe.name),s=Ac.dirname(i);for(;s!==Ac.dirname(s);){let o=Ac.dirname(s);if(Ac.basename(o)==="node_modules"){let a=Ac.join(o,".bin",e);if(kC.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Rc.env.NODE_PATH){let i=Ac.join(Rc.env.NODE_PATH,".bin",e);if(kC.existsSync(i))return i}let r=Ac.join(t,"node_modules",".bin",e);if(kC.existsSync(r))return r;let n=Ac.join(Ovt,"..","node_modules",".bin",e);if(kC.existsSync(n))return n}import JL from"process";import{fileURLToPath as G$t}from"url";import{createRequire as W$t}from"module";import ZL from"path";var Nvt="__netlify__getTracer",kvt="__netlify__shutdownTracers",gt=(t,e)=>globalThis[Nvt]?.(t,e),Bwe=async()=>globalThis[kvt]?.();function qf(t,e,r,n,i){let s=typeof n=="function"?n:typeof r=="function"?r:i;if(!s)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,s):s()}import{setTimeout as j$t}from"timers/promises";Ne();import twt from"process";Ne();var nbt=(t,e)=>{e.recordException(t),e.setStatus({code:In.ERROR})};var Oc=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=L0e(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>D0e(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=L0e(r,n,i),c=this._tracer.startSpan(e,s,o);return D0e(c,s,a)}};function L0e(t,e,r){let n,i,s;return!e&&!r?s=t:r?(n=t,i=e,s=r):(n=t,s=e),n=n??{},i=i??Ut.active(),{opts:n,ctx:i,fn:s}}function D0e(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:nbt,s=o=>{throw i(o,t),t.end(),o};try{let o=r(t);return typeof o?.then=="function"?o.then(a=>(t.end(),a),s):(t.end(),o)}catch(o){throw s(o)}}Ne();var Xg=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var xW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=G0e(e),n._asyncAttributesPending=e.filter(([i,s])=>Xg(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(Xg(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=G0e(this._rawAttributes),this._schemaUrl=ibt(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,Xg(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&ae.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(Xg(n)){ae.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=sbt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function IW(t,e){return xW.FromAttributeList(Object.entries(t),e)}function G0e(t){return t.map(([e,r])=>Xg(r)?[e,r.catch(n=>{ae.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function ibt(t){if(typeof t=="string"||t===void 0)return t;ae.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function sbt(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;ae.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Ne();var uT=class{emit(e){}enabled(){return!1}},W0e=new uT;var dT=Symbol.for("io.opentelemetry.js.api.logs"),Qg=globalThis;function Y0e(t,e,r){return n=>n===t?e:r}var OW=1;var PW=class{getLogger(e,r,n){return new uT}},rN=new PW;var nN=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):W0e}};var fT=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new nN(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:rN}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var iN=class t{constructor(){this._proxyLoggerProvider=new fT}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Qg[dT]?this.getLoggerProvider():(Qg[dT]=Y0e(OW,e,rN),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Qg[dT])===null||e===void 0?void 0:e.call(Qg,OW))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Qg[dT],this._proxyLoggerProvider=new fT}};var K0e=iN.getInstance();function J0e(t,e,r,n){for(let i=0,s=t.length;i<s;i++){let o=t[i];e&&o.setTracerProvider(e),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function Z0e(t){t.forEach(e=>e.disable())}function CW(t){let e=t.tracerProvider||zt.getTracerProvider(),r=t.meterProvider||lT.getMeterProvider(),n=t.loggerProvider||K0e.getLoggerProvider(),i=t.instrumentations?.flat()??[];return J0e(i,e,r,n),()=>{Z0e(i)}}$c();var pk=Ln(kY(),1);Ne();$c();var HIe=t=>{throw TypeError(t)},MY=(t,e,r)=>e.has(t)||HIe("Cannot "+r),fk=(t,e,r)=>(MY(t,e,"read from private field"),r?r.call(t):e.get(t)),$Y=(t,e,r)=>e.has(t)?HIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),BIe=(t,e,r,n)=>(MY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ewt=(t,e,r)=>(MY(t,e,"access private method"),r),zIe="__netlify__getTracer",rwt="__netlify__shutdownTracers",nwt="__nfOTLPTrace",NT,kT,DY,GIe,iwt=class{constructor(){$Y(this,DY),$Y(this,NT),$Y(this,kT),BIe(this,NT,new i_(ewt(this,DY,GIe),this)),BIe(this,kT,ae.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(fk(this,kT).debug(`export ${t.length.toString()} spans`),fk(this,NT).isCalled){e({code:Yn.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(nwt,JSON.stringify(swt(t))),e({code:Yn.SUCCESS})}shutdown(){return fk(this,NT).call()}};NT=new WeakMap;kT=new WeakMap;DY=new WeakSet;GIe=function(){return fk(this,kT).debug("Shutting down"),Promise.resolve()};function swt(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:dk(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||io.SERVER,startTimeUnixNano:LY(e.startTime),endTimeUnixNano:LY(e.endTime),attributes:dk(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:LY(n.time),attributes:dk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:dk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function dk(t){return Object.keys(t).map(e=>WIe(e,t[e]))}function WIe(t,e){return{key:t,value:YIe(e)}}function YIe(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(YIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>WIe(r,n))}}:{}}function LY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var VIe={name:"@netlify/otel",version:"6.0.4",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^4.4.7",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.7.1","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},KIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,zIe))return;let e=twt.version.slice(1),r=IW({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[owt()],i=new pk.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new kc});let s=t.instrumentations??[];CW({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,zIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new Oc(zt.getTracer(a,c)):new Oc(zt.getTracer(VIe.name,VIe.version))}}),Object.defineProperty(globalThis,rwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},owt=()=>new pk.SimpleSpanProcessor(new iwt);Ne();$c();var $T=Ln(kY(),1);Ne();import*as hk from"diagnostics_channel";var JIe=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?In.ERROR:In.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],s=n.some(a=>r.includes(a.toString())),o={};if(s)return o;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?o[d]="REDACTED":o[d]=l.toString()}return o}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof Oc?t:new Oc(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){hk.subscribe(t,e);let r=()=>hk.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:io.CLIENT},Ut.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:In.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var cDe=Ln(oDe(),1);var YL=Ee("tracing"),aDe=8e3,q$t=5e3,Ww=async(t=q$t)=>{try{await Promise.race([Bwe(),j$t(t)])}catch(e){YL.warn("Failed to flush tracers on shutdown",e)}},lDe=async(t,e,r)=>{if(!gt()){let n=[new $T.SimpleSpanProcessor(new vJ),new $T.SimpleSpanProcessor(new cDe.OTLPTraceExporter({url:r.exporterUrl}))];await KIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new JIe({skipHeaders:!0})]})}return r.traceparent?(Wn.setGlobalPropagator(new kc),Wn.extract(Ut.active(),{traceparent:r.traceparent,isRemote:!0})):Ut.active()};function Ht(t,e,r){return YL.log(`\u23F3 TRACE: ${e} starting...`),qf(t,e,r)}var vJ=class{export(e,r){for(let n of e)this.logSpan(n);r({code:1})}async shutdown(){}forceFlush(){return Promise.resolve()}logSpan(e){let r=(e.endTime[0]-e.startTime[0])*1e3+(e.endTime[1]-e.startTime[1])/1e6,n=e.attributes,i=[];for(let[a,c]of Object.entries(n))a.includes("duration")&&typeof c=="number"?i.push(`${a}=${c.toFixed(2)}ms`):i.push(`${a}=${c}`);let s=e.status?.code===2?"\u274C":"\u2705",o=i.length>0?` [${i.join(", ")}]`:"";YL.log(`${s} TRACE: ${e.name} completed in ${r.toFixed(2)}ms${o}`),e.status?.code===2&&e.status.message&&YL.log(` \u274C Error: ${e.status.message}`)}};function bJ(){return rt().captureLlmContentEnabled}function uDe(t){return t.includes("claude")?"anthropic":t.includes("codex")?"openai":t.includes("gemini")?"google":t.includes("opencode")?"opencode":t}function KL(t,e,r){let n={role:t,parts:[{type:"text",content:bs(e)}]};return r&&(n.finish_reason=r),JSON.stringify([n])}function dDe(t,e,r,n){if(!t.length)return;let i=gt();if(!i)return;let s=bJ(),o=Math.max(1,(n-r)/t.length);t.forEach((a,c)=>{let l=Math.min(n,r+c*o),u=Math.min(n,l+o),d=a.title||a.type||`step-${a.id??c}`,f=a.type==="tool_use"||a.type==="tool_result",p=a.message?a.message.length>aDe?`${a.message.slice(0,aDe)}\u2026`:a.message:void 0;i.startSpan(d,{startTime:l,attributes:{"gen_ai.capability.name":e,"gen_ai.step.name":d,"gen_ai.operation.name":f?"execute_tool":"chat",...f?{"gen_ai.tool.name":d}:{},"spark.step.id":a.id??-1,...a.type?{"spark.step.type":a.type}:{},...a.category?{"spark.step.category":a.category}:{},...a.groupId?{"spark.step.group_id":a.groupId}:{},...a.parentGroupId?{"spark.step.parent_group_id":a.parentGroupId}:{},...s&&p?f?{"gen_ai.tool.call.result":bs(p)}:{"gen_ai.output.messages":KL("assistant",p)}:{}}}).end(u)})}import{readdir as B$t,rm as z$t}from"fs/promises";import{join as V$t}from"path";async function fDe(t,e=[]){let n=(await B$t(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>z$t(V$t(t,i),{recursive:!0,force:!0})))}var H$t=700,pDe=t=>t.mode==="create"&&(t.accountType===Tl||t.enforcedAICreditsRemaining!=null&&t.enforcedAICreditsRemaining<=H$t);var Y$t=ZL.dirname(G$t(import.meta.url)),hDe=W$t(import.meta.url),K$t=ZL.resolve(Y$t,"scripts/scaffold.js"),J$t="scripts/scaffold.js",Z$t=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,TJ=t=>{if(t.length>=2){let e=t[0],r=t[t.length-1];if(e==='"'&&r==='"'||e==="'"&&r==="'")return t.slice(1,-1)}return t},X$t=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),Q$t=t=>{let e=TJ(t);return e==="node"||e.endsWith("/node")},tl=t=>{if(typeof t!="string")return!1;let e=t.match(Z$t)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&X$t(TJ(e[r]));)r+=1;if(r>=e.length||!Q$t(e[r]))return!1;let n=e[r+1];return n?TJ(n).includes(J$t):!1},uy=Ee("create_stage"),mDe="Do not run local validation or dev-server commands to check your work \u2014 specifically `tsc`, `npx tsc`, `vite build`, `vite dev`, or any equivalent build/start/test command. The build pipeline installs and validates the project automatically after your edits. Verify your changes by reading the files you edited.",eLt=`${mDe}
588
588
 
589
589
  Commands that generate or modify project files are fine to run when the task requires them \u2014 for example \`drizzle-kit generate\` to write a database migration after a schema change, or other code-generation utilities documented in the skills.`,tLt=`${mDe}
590
590
 
package/dist/index.js CHANGED
@@ -98,7 +98,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
98
98
  `,LF:`
99
99
  `,concatBytes:SL},oLe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},aLe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:oLe};import{Buffer as cLe}from"buffer";var Pte=(t,e)=>t?void 0:lLe.bind(void 0,e),lLe=function*(t,e){if(typeof e!="string"&&!Bt(e)&&!cLe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Ote=(t,e)=>t?uLe.bind(void 0,e):dLe.bind(void 0,e),uLe=function*(t,e){Nte(t,e),yield e},dLe=function*(t,e){if(Nte(t,e),typeof e!="string"&&!Bt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},Nte=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
100
100
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
101
- if (condition) { yield value; }`)};import{Buffer as fLe}from"buffer";import{StringDecoder as pLe}from"string_decoder";var rx=(t,e,r)=>{if(r)return;if(t)return{transform:hLe.bind(void 0,new TextEncoder)};let n=new pLe(e);return{transform:mLe.bind(void 0,n),final:gLe.bind(void 0,n)}},hLe=function*(t,e){fLe.isBuffer(e)?yield fo(e):typeof e=="string"?yield t.encode(e):yield e},mLe=function*(t,e){yield Bt(e)?t.write(e):e},gLe=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kte}from"util";var vL=kte(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),nx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=yLe}=e[r];for await(let i of n(t))yield*nx(i,e,r+1)},Mte=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_Le(r,Number(e),t)},_Le=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*nx(n,r,e+1)},Dte=kte(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),yLe=function*(t){yield t};var bL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Lte=(t,e)=>[...e.flatMap(r=>[...wl(r,t,0)]),...b_(t)],wl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=ELe}=e[r];for(let i of n(t))yield*wl(i,e,r+1)},b_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*SLe(r,Number(e),t)},SLe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*wl(n,r,e+1)},ELe=function*(t){yield t};var TL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=Ute(t,o,s),l=xl(e),u=xl(r),d=l?vL.bind(void 0,nx,a):bL.bind(void 0,wl),f=l||u?vL.bind(void 0,Mte,a):bL.bind(void 0,b_),p=l||u?Dte.bind(void 0,a):void 0;return{stream:new vLe({writableObjectMode:n,writableHighWaterMark:$te(n),readableObjectMode:i,readableHighWaterMark:$te(i),transform(m,E,T){d([m,c,0],this,T)},flush(m){f([c],this,m)},destroy:p})}},ix=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=Ute(o,r,a);t=Lte(c,t)}return t},Ute=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:Pte(n,a)},rx(r,o,n),tx(r,s,n,c),{transform:t,final:e},{transform:Ote(i,a)},Cte({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var Fte=(t,e)=>{for(let r of bLe(t))TLe(t,r,e)},bLe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),TLe=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Oa[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>ALe(a,n));r.input=f_(o)},ALe=(t,e)=>{let r=ix(t,e,"utf8",!0);return xLe(r),f_(r)},xLe=t=>{let e=t.find(r=>typeof r!="string"&&!Bt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as CLe,appendFileSync as PLe}from"fs";var sx=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&ef(r,n)&&!hn.has(e)&&wLe(n)&&(t.some(({type:i,value:s})=>i==="native"&&RLe.has(s))||t.every(({type:i})=>Vn.has(i))),wLe=t=>t===1||t===2,RLe=new Set(["pipe","overlapped"]),Bte=async(t,e,r,n)=>{for await(let i of t)ILe(e)||zte(i,r,n)},jte=(t,e,r)=>{for(let n of t)zte(n,e,r)},ILe=t=>t._readableState.pipes.length>0,zte=(t,e,r)=>{let n=SA(t);cs({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Gte=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>OLe({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},OLe=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=qee(t,s,d),p=fo(f),{stdioItems:h,objectMode:m}=e[r],E=NLe([p],h,c,n),{serializedResult:T,finalResult:v=T}=kLe({chunks:E,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});MLe({serializedResult:T,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?v:void 0;try{return n.error===void 0&&DLe(T,h,i),A}catch(S){return n.error=S,A}},NLe=(t,e,r,n)=>{try{return ix(t,e,r,!1)}catch(i){return n.error=i,t}},kLe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:f_(t)};let o=iQ(t,r);return n[s]?{serializedResult:o,finalResult:EL(o,!i[s],e)}:{serializedResult:o}},MLe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!sx({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=EL(t,!1,o);try{jte(a,e,n)}catch(c){r.error??=c}},DLe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>QA.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?PLe(n,t):(r.add(s),CLe(n,t))}};var qte=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,mo(e,r,"all")]:Array.isArray(e)?[mo(t,r,"all"),...e]:Bt(t)&&Bt(e)?CD([t,e]):`${t}${e}`};import{once as AL}from"events";var Vte=async(t,e)=>{let[r,n]=await LLe(t);return e.isForcefullyTerminated??=!1,[r,n]},LLe=async t=>{let[e,r]=await Promise.allSettled([AL(t,"spawn"),AL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Hte(t):r.value},Hte=async t=>{try{return await AL(t,"exit")}catch{return Hte(t)}},Wte=async t=>{let[e,r]=await t;if(!$Le(e,r)&&xL(e,r))throw new xi;return[e,r]},$Le=(t,e)=>t===void 0&&e===void 0,xL=(t,e)=>t!==0||e!==null;var Yte=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=ULe(t,e,r),o=s?.code==="ETIMEDOUT",a=Gee(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},ULe=(t,e,r)=>t!==void 0?t:xL(e,r)?new xi:void 0;var Kte=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=BLe(t,e,r),d=GLe({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return df(d,c,l)},BLe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=vA(t,e,r),a=jLe(r),{file:c,commandArguments:l,options:u}=jA(t,e,a);zLe(u);let d=xte(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},jLe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,zLe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&ox("ipcInput"),t&&ox("ipc: true"),r&&ox("detached: true"),n&&ox("cancelSignal")},ox=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},GLe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=qLe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Yte(c,r),{output:h,error:m=l}=Gte({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),E=h.map((v,A)=>mo(v,r,A)),T=mo(qte(h,r),r,"all");return HLe({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:E,all:T,options:r,command:n,escapedCommand:i,startTime:a})},qLe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{Fte(s,r);let a=VLe(r);return FLe(...zA(t,e,a))}catch(a){return uf({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},VLe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:KA(e)}),HLe=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?ZA({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):v_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as k1e}from"events";import{spawn as M1e}from"child_process";import ere from"process";import{once as wL,on as WLe}from"events";var Zte=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(nf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:DA(t)}),YLe({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),YLe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{OA(e,i);let s=Pa(t,e,r),o=new AbortController;try{return await Promise.race([KLe(s,n,o),ZLe(s,r,o),JLe(s,r,o)])}catch(a){throw sf(t),a}finally{o.abort(),NA(e,i)}},KLe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await wL(t,"message",{signal:r});return n}for await(let[n]of WLe(t,"message",{signal:r}))if(e(n))return n},ZLe=async(t,e,{signal:r})=>{await wL(t,"disconnect",{signal:r}),L7(e)},JLe=async(t,e,{signal:r})=>{let[n]=await wL(t,"strict:error",{signal:r});throw IA(n,e)};import{once as Xte,on as XLe}from"events";var Qte=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>RL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),RL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{nf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:DA(t)}),OA(e,s);let o=Pa(t,e,r),a=new AbortController,c={};return QLe(t,o,a),e$e({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),t$e({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},QLe=async(t,e,r)=>{try{await Xte(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},e$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Xte(t,"strict:error",{signal:r.signal});n.error=IA(i,e),r.abort()}catch{}},t$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of XLe(r,"message",{signal:s.signal}))Jte(o),yield c}catch{Jte(o)}finally{s.abort(),NA(e,a),n||sf(t),i&&await t}},Jte=({error:t})=>{if(t)throw t};var tre=(t,{ipc:e})=>{Object.assign(t,nre(t,!1,e))},rre=()=>{let t=ere,e=!0,r=ere.channel!==void 0;return{...nre(t,e,r),getCancelSignal:lee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nre=(t,e,r)=>({sendMessage:FA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Zte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Qte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as r$e}from"child_process";import{PassThrough as n$e,Readable as i$e,Writable as s$e,Duplex as o$e}from"stream";var ire=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{_L(n);let a=new r$e;a$e(a,n),Object.assign(a,{readable:c$e,writable:l$e,duplex:u$e});let c=uf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=d$e(c,o,i);return{subprocess:a,promise:l}},a$e=(t,e)=>{let r=T_(),n=T_(),i=T_(),s=Array.from({length:e.length-3},T_),o=T_(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},T_=()=>{let t=new n$e;return t.end(),t},c$e=()=>new i$e({read(){}}),l$e=()=>new s$e({write(){}}),u$e=()=>new o$e({read(){},write(){}}),d$e=async(t,e,r)=>df(t,e,r);import{createReadStream as sre,createWriteStream as ore}from"fs";import{Buffer as f$e}from"buffer";import{Readable as A_,Writable as p$e,Duplex as h$e}from"stream";var cre=(t,e)=>ex(m$e,t,e,!1),x_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Oa[t]}.`)},are={fileNumber:x_,generator:TL,asyncGenerator:TL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:h$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},m$e={input:{...are,fileUrl:({value:t})=>({stream:sre(t)}),filePath:({value:{file:t}})=>({stream:sre(t)}),webStream:({value:t})=>({stream:A_.fromWeb(t)}),iterable:({value:t})=>({stream:A_.from(t)}),asyncIterable:({value:t})=>({stream:A_.from(t)}),string:({value:t})=>({stream:A_.from(t)}),uint8Array:({value:t})=>({stream:A_.from(f$e.from(t))})},output:{...are,fileUrl:({value:t})=>({stream:ore(t)}),filePath:({value:{file:t,append:e}})=>({stream:ore(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:p$e.fromWeb(t)}),iterable:x_,asyncIterable:x_,string:x_,uint8Array:x_}};import{on as g$e,once as lre}from"events";import{PassThrough as _$e,getDefaultHighWaterMark as y$e}from"stream";import{finished as fre}from"stream/promises";function Rl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)CL(i);let e=t.some(({readableObjectMode:i})=>i),r=S$e(t,e),n=new IL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var S$e=(t,e)=>{if(t.length===0)return y$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},IL=class extends _$e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(CL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=E$e(this,this.#e,this.#s);let r=T$e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(CL(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},E$e=async(t,e,r)=>{ax(t,ure);let n=new AbortController;try{await Promise.race([v$e(t,n),b$e(t,e,r,n)])}finally{n.abort(),ax(t,-ure)}},v$e=async(t,{signal:e})=>{try{await fre(t,{signal:e,cleanup:!0})}catch(r){throw pre(t,r),r}},b$e=async(t,e,r,{signal:n})=>{for await(let[i]of g$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},CL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},T$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{ax(t,dre);let a=new AbortController;try{await Promise.race([A$e(s,e,a),x$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),w$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),ax(t,-dre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?PL(t):R$e(t))},A$e=async(t,e,{signal:r})=>{try{await t,r.aborted||PL(e)}catch(n){r.aborted||pre(e,n)}},x$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await fre(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;hre(o)?i.add(e):mre(t,o)}},w$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await lre(t,i,{signal:s}),!t.readable)return lre(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},R$e=t=>{t.writable&&t.end()},pre=(t,e)=>{hre(e)?PL(t):mre(t,e)},hre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",PL=t=>{(t.readable||t.writable)&&t.destroy()},mre=(t,e)=>{t.destroyed||(t.once("error",I$e),t.destroy(e))},I$e=()=>{},ax=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},ure=2,dre=1;import{finished as gre}from"stream/promises";var pf=(t,e)=>{t.pipe(e),C$e(t,e),P$e(t,e)},C$e=async(t,e)=>{if(!(Ai(t)||Ai(e))){try{await gre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}OL(e)}},OL=t=>{t.writable&&t.end()},P$e=async(t,e)=>{if(!(Ai(t)||Ai(e))){try{await gre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}NL(t)}},NL=t=>{t.readable&&t.destroy()};var _re=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>Vn.has(c)))O$e(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!Vn.has(c)))k$e({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Rl(s);pf(o,i)}},O$e=(t,e,r,n)=>{r==="output"?pf(t.stdio[n],e):pf(e,t.stdio[n]);let i=N$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},N$e=["stdin","stdout","stderr"],k$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;M$e(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},M$e=(t,{signal:e})=>{Ai(t)&&Tl(t,D$e,e)},D$e=2;import{addAbortListener as U$e}from"events";var Il=[];Il.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Il.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Il.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var cx=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",kL=Symbol.for("signal-exit emitter"),ML=globalThis,L$e=Object.defineProperty.bind(Object),DL=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ML[kL])return ML[kL];L$e(ML,kL,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},lx=class{},$$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),LL=class extends lx{onExit(){return()=>{}}load(){}unload(){}},$L=class extends lx{#e=UL.platform==="win32"?"SIGINT":"SIGHUP";#r=new DL;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Il)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!cx(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of Il)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Il.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return cx(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&cx(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},UL=globalThis.process,{onExit:yre,load:oSt,unload:aSt}=$$e(cx(UL)?new $L(UL):new LL);var Sre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=yre(()=>{t.kill()});U$e(n,()=>{i()})};var vre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=EA(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=F$e(r,n,i),{sourceStream:d,sourceError:f}=j$e(t,l),{options:p,fileDescriptors:h}=us.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},F$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=B$e(t,e,...r),a=PA(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},B$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ere,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||RD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=uA(r,...n);return{destination:e(Ere)(i,s,o),pipeOptions:o}}if(us.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ere=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),j$e=(t,e)=>{try{return{sourceStream:of(t,e)}}catch(r){return{sourceError:r}}};var Tre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=z$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FL({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},z$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return NL(t),n;if(e!==void 0)return OL(r),e},FL=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>uf({error:t,command:bre,escapedCommand:bre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),bre="source.pipe(destination)";var Are=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as G$e}from"stream/promises";var xre=(t,e,r)=>{let n=ux.has(e)?V$e(t,e):q$e(t,e);return Tl(t,W$e,r.signal),Tl(e,Y$e,r.signal),H$e(e),n},q$e=(t,e)=>{let r=Rl([t]);return pf(r,e),ux.set(e,r),r},V$e=(t,e)=>{let r=ux.get(e);return r.add(t),r},H$e=async t=>{try{await G$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}ux.delete(t)},ux=new WeakMap,W$e=2,Y$e=1;import{aborted as K$e}from"util";var wre=(t,e)=>t===void 0?[]:[Z$e(t,e)],Z$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await K$e(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw FL({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var dx=(t,...e)=>{if(Pt(e[0]))return dx.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vre(t,...e),i=J$e({...n,destination:r});return i.pipe=dx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},J$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=X$e(t,i);Tre({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=xre(e,s,d);return await Promise.race([Are(u),...wre(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},X$e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as s1e}from"timers/promises";import{on as Q$e}from"events";import{getDefaultHighWaterMark as e1e}from"stream";var fx=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return t1e(e,o),Ire({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},t1e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},BL=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;r1e(e,o,t);let a=t.readableObjectMode&&!s;return Ire({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},r1e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ire=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=Q$e(t,"data",{signal:e.signal,highWaterMark:Rre,highWatermark:Rre});return n1e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},jL=e1e(!0),Rre=jL,n1e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=i1e({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*wl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*b_(a)}},i1e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[rx(t,r,!e),tx(t,i,!n,{})].filter(Boolean);var Cre=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=o1e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([a1e(t),d]);return}let f=yL(c,r),p=BL({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([c1e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},o1e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!sx({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=BL({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Bte(a,t,r,s)},a1e=async t=>{await s1e(),t.readableFlowing===null&&t.resume()},c1e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await HA(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await WA(r,{maxBuffer:s})):await lf(r,{maxBuffer:s})}catch(a){return Pre(Bee({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},zL=async t=>{try{return await t}catch(e){return Pre(e)}},Pre=({bufferedData:t})=>rQ(t)?new Uint8Array(t):t;import{finished as l1e}from"stream/promises";var w_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=u1e(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],l1e(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||p1e(a,e,r,n)}finally{o.abort()}},u1e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&d1e(t,r,n),n},d1e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{f1e(e,r),n.call(t,...i)}},f1e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},p1e=(t,e,r,n)=>{if(!h1e(t,e,r,n))throw t},h1e=(t,e,r,n=!0)=>r.propagating?Ore(t)||px(t):(r.propagating=!0,GL(r,e)===n?Ore(t):px(t)),GL=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",px=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Ore=t=>t?.code==="EPIPE";var Nre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>qL({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),qL=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=w_(t,e,l);if(GL(l,e)){await u;return}let[d]=await Promise.all([Cre({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var kre=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Rl([t,e].filter(Boolean)):void 0,Mre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>qL({...m1e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:g1e(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),m1e=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},g1e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as _1e}from"events";var Dre=t=>ef(t,"ipc"),Lre=(t,e)=>{let r=SA(t);cs({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var $re=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=Dre(s),a=po(e,"ipc"),c=po(r,"ipc");for await(let l of RL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(jee(t,i,c),i.push(l)),o&&Lre(l,s);return i},Ure=async(t,e)=>(await Promise.allSettled([t]),e);var Fre=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:E,controller:T})=>{let v=Vte(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},S=Nre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=Mre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),P=[],L=$re({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),I=y1e(m,t,A),O=S1e(h,A);try{return await Promise.race([Promise.all([{},Wte(v),Promise.all(S),R,L,See(t,d),...I,...O]),E,E1e(t,T),...hee(t,s,f,T),...D7({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:T}),...fee({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:T})])}catch(j){return f.terminationReason??="other",Promise.all([{error:j},v,Promise.all(S.map(_=>zL(_))),zL(R),Ure(L,P),Promise.allSettled(I),Promise.allSettled(O)])}},y1e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:w_(n,i,r)),S1e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>Ri(s,{checkOpen:!1})&&!Ai(s)).map(({type:i,value:s,stream:o=s})=>w_(o,n,e,{isSameDirection:Vn.has(i),stopOnExit:i==="native"}))),E1e=async(t,{signal:e})=>{let[r]=await _1e(t,"error",{signal:e});throw r};var Bre=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),R_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=ls();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},hf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as v1e}from"stream";import{callbackify as b1e}from"util";import{finished as jre}from"stream/promises";var VL=async t=>{if(t!==void 0)try{await HL(t)}catch{}},zre=async t=>{if(t!==void 0)try{await WL(t)}catch{}},HL=async t=>{await jre(t,{cleanup:!0,readable:!1,writable:!0})},WL=async t=>{await jre(t,{cleanup:!0,readable:!0,writable:!1})},hx=async(t,e)=>{if(await t,e)throw e},mx=(t,e,r)=>{r&&!px(r)?t.destroy(r):e&&t.destroy()};var Gre=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||hn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=YL(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=KL(a,o),{read:f,onStdoutDataDone:p}=ZL({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new v1e({read:f,destroy:b1e(XL.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return JL({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},YL=(t,e,r)=>{let n=of(t,e),i=R_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},KL=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:jL},ZL=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=ls(),o=fx({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){T1e(this,o,s)},onStdoutDataDone:s}},T1e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},JL=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await WL(t),await n,await VL(i),await e,r.readable&&r.push(null)}catch(s){await VL(i),qre(r,s)}},XL=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await hf(r,e)&&(qre(t,n),await hx(e,n))},qre=(t,e)=>{mx(t,t.readable,e)};import{Writable as A1e}from"stream";import{callbackify as Vre}from"util";var Hre=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=QL(t,r,e),o=new A1e({...e$(n,t,i),destroy:Vre(r$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return t$(n,o),o},QL=(t,e,r)=>{let n=PA(t,e),i=R_(r,n,"writableFinal"),s=R_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},e$=(t,e,r)=>({write:x1e.bind(void 0,t),final:Vre(w1e.bind(void 0,t,e,r))}),x1e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},w1e=async(t,e,r)=>{await hf(r,e)&&(t.writable&&t.end(),await e)},t$=async(t,e,r)=>{try{await HL(t),e.writable&&e.end()}catch(n){await zre(r),Wre(e,n)}},r$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await hf(r,e),await hf(n,e)&&(Wre(t,i),await hx(e,i))},Wre=(t,e)=>{mx(t,t.writable,e)};import{Duplex as R1e}from"stream";import{callbackify as I1e}from"util";var Yre=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||hn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=YL(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=QL(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=KL(c,a),{read:E,onStdoutDataDone:T}=ZL({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new R1e({read:E,...e$(u,t,d),destroy:I1e(C1e.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return JL({subprocessStdout:c,onStdoutDataDone:T,readable:v,subprocess:t,subprocessStdin:u}),t$(u,v,c),v},C1e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([XL({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),r$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var n$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||hn.has(e),o=of(t,r),a=fx({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return P1e(a,o,t)},P1e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kre=(t,{encoding:e})=>{let r=Bre();t.readable=Gre.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Hre.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Yre.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=n$.bind(void 0,t,e),t[Symbol.asyncIterator]=n$.bind(void 0,t,e,{})};var Zre=(t,e)=>{for(let[r,n]of N1e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},O1e=(async()=>{})().constructor.prototype,N1e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(O1e,t)]);var Jre=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=D1e(t,e,r),{subprocess:f,promise:p}=$1e({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=dx.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Zre(f,p),us.set(f,{options:u,fileDescriptors:d}),f},D1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=vA(t,e,r),{file:a,commandArguments:c,options:l}=jA(t,e,r),u=L1e(l),d=cre(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},L1e=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},$1e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=M1e(...zA(t,e,r))}catch(h){return ire({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;k1e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_re(c,a,l),Sre(c,r,l);let d={},f=ls();c.kill=k7.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kre(c,r),Kre(c,r),tre(c,r);let p=U1e({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},U1e=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,E]=await Fre({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let T=h.map((S,R)=>mo(S,e,R)),v=mo(m,e,"all"),A=F1e({errorInfo:d,exitCode:f,signal:p,stdio:T,all:v,ipcOutput:E,context:c,options:e,command:o,escapedCommand:a,startTime:r});return df(A,n,e)},F1e=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?v_({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ds,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):ZA({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var gx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,B1e(n,t[n],i)]));return{...t,...r}},B1e=(t,e,r)=>j1e.has(t)&&Pt(e)&&Pt(r)?{...e,...r}:r,j1e=new Set(["env",...kD]);var Na=(t,e,r,n)=>{let i=(o,a,c)=>Na(o,a,r,c),s=(...o)=>z1e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},z1e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(Pt(s))return i(t,gx(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=G1e({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?Kte(a,c,l):Jre(a,c,l,i)},G1e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=cQ(e)?lQ(e,r):[e,...r],[o,a,c]=uA(...s),l=gx(gx(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Xre=({file:t,commandArguments:e})=>ene(t,e),Qre=({file:t,commandArguments:e})=>({...ene(t,e),isSync:!0}),ene=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=q1e(t);return{file:r,commandArguments:n}},q1e=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(V1e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},V1e=/ +/g;var tne=(t,e,r)=>{t.sync=e(H1e,r),t.s=t.sync},rne=({options:t})=>nne(t),H1e=({options:t})=>({...nne(t),isSync:!0}),nne=t=>({options:{...W1e(t),...t}}),W1e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},ine={preferLocal:!0};var sne=Na(()=>({})),Zvt=Na(()=>({isSync:!0})),one=Na(Xre),Jvt=Na(Qre),Xvt=Na(gee),Qvt=Na(rne,{},ine,tne),{sendMessage:ebt,getOneMessage:tbt,getEachMessage:rbt,getCancelSignal:nbt}=rre();var ane=!1,cne=()=>{ane=!0},ps=()=>ane;var I_=null,lne=t=>(I_&&I_.destroy(),I_=new go({totalAllowedTime:t}),I_),une=()=>I_;var go=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&ps())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await nA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var dne={name:"@netlify/agent-runner-cli",type:"module",version:"1.152.0-EX-2670.1",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.4","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var J1e=K1e(import.meta.url),X1e=_o.dirname(J1e),Q1e=Z1e(import.meta.url),mf=pe("shell"),i$=new Set,fne={preferLocal:!0},kr=(t,e,r)=>{let[n,i]=eUe(e,r),s={...fne,...i},o=sne(t,n,s);hne(o,s),_ne(o);let a=r?.idleTimeout;return a&&a>0&&gne(o,a),o},pne=(t,e)=>{let r={...fne,...e},n=one(t,r);return hne(n,r),_ne(n),e?.idleTimeout&&e.idleTimeout>0&&gne(n,e.idleTimeout),n},eUe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},hne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(yo.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new r_).pipe(yo.stdout),t.stderr?.pipe(new r_).pipe(yo.stderr);return}t.stdout?.pipe(yo.stdout),t.stderr?.pipe(yo.stderr)},s$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(yo.kill(-t.pid,e),mf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return mf.error("Error killing process:",r),!1}},mne=t=>s$(t,"SIGKILL"),gne=(t,e)=>{let r=null,n=()=>{mf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),s$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(mf.log(`Force killing idle process ${t.pid}`),mne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},_ne=t=>{i$.add(t);let e=une();if(e){let r=e.onTimesUp(()=>{mf.log(`Global timer expired, killing process ${t.pid}`),s$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(mf.log(`Force killing process ${t.pid} after timeout`),mne(t))},5e3)});t.on("exit",()=>{i$.delete(t),r()}),t.on("error",()=>{i$.delete(t),r()})}};function hs(t,e){if(!yo.env.NETLIFY_LOCAL_MODE)try{let i=Q1e.resolve(dne.name),s=_o.dirname(i);for(;s!==_o.dirname(s);){let o=_o.dirname(s);if(_o.basename(o)==="node_modules"){let a=_o.join(o,".bin",e);if(_x.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(yo.env.NODE_PATH){let i=_o.join(yo.env.NODE_PATH,".bin",e);if(_x.existsSync(i))return i}let r=_o.join(t,"node_modules",".bin",e);if(_x.existsSync(r))return r;let n=_o.join(X1e,"..","node_modules",".bin",e);if(_x.existsSync(n))return n}var tUe=pe("utils"),rUe=t=>new Promise(e=>{setTimeout(e,t)});var o$=t=>{try{return new URL(t).hostname||null}catch{return null}},yx=(t,e=3e3)=>{let r=!1,n=null,i=[],s=null,o=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return s=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await rUe(e),!n)return r=!1,s=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return o.flush=async()=>{if((r||n)&&s)return await s,o.flush()},o.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},o},ka=(t,e,r=!1)=>{let n=null,i=null,s=null,o=function(...a){i=a,s=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(s,i),i=null,s=null)},e),c&&(t.apply(s,i),i=null,s=null)};return o.cancel=()=>{clearTimeout(n),n=null,i=null,s=null},o.flush=()=>{if(n){clearTimeout(n);let a=i,c=s;n=null,i=null,s=null,t.apply(c,a)}},o},yne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):tUe.error("Could not parse JSON",n))}},nUe=t=>t.charAt(0).toUpperCase()+t.slice(1),ms=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():nUe(e)).join(" ");function So(t,e){e&&t.log(`Skill invoked: ${e}`)}var Sx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Sne=(t,e,r=!1)=>{if(r)return;let n=60,i=55,s=".netlify.app",o="agent-",a=6;if(!e)return`${o}${t.slice(0,a)}`;let c=`--${e}${s}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=o.length+a){let u=Math.min(l-o.length,t.length);return`${o}${t.slice(0,u)}`}return t.slice(0,l)};var a$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},iUe=1e4,c$=(t,e=iUe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as sUe}from"crypto";import{createReadStream as oUe}from"fs";import Ex from"fs/promises";import Ane from"os";import vx from"path";var Ene=pe("repo"),xne="runner-diffs-",wne=t=>`${xne}${t}-`,Rne=async t=>{let e=Ane.tmpdir(),r;try{r=await Ex.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(xne)&&!n.startsWith(wne(t))).map(n=>Ex.rm(vx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Kr=(t,e={})=>kr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),bx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Ene.info("Getting runner diffs");let n=await cUe(r),{hasChanges:i}=n,{status:s}=n;if(!i)return{hasChanges:!1};if(!e){let h=uUe(s);await dUe(h,r)}Ene.info("Changes after processing"),await u$(r);let o=await f$(s,r);if(await l$(o,r),i=await lUe(r),!i)return{hasChanges:!1,ignored:o};await Kr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Ex.mkdtemp(vx.join(Ane.tmpdir(),wne(t.sessionId))),c=async({from:h,to:m,fileName:E,binary:T})=>{let v=vx.join(a,E);await Kr([...T?["diff",h,m,"--binary"]:["diff",h,m],`--output=${v}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Ex.stat(v);return{path:v,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Tne(r),{hasChanges:!1,ignored:o};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await bne(d,h)||(f=h)}await Tne(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:o};return await bne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},vne=async t=>{let e=sUe("sha256");for await(let r of oUe(t))e.update(r);return e.digest("hex")},bne=async(t,e)=>t.size===e.size&&await vne(t.path)===await vne(e.path),Tne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Kr(["reset","--soft","HEAD~1"],{cwd:t})},l$=async(t=[],e=process.cwd())=>{await Kr(["add",".",...t],{cwd:e})},u$=async(t=process.cwd())=>{let e=await Kr(["status","-s"],{cwd:t});return String(e.stdout??"")},Ine=/.. (.+)?\.log$/,aUe=[Ine],cUe=async(t=process.cwd())=>{let e=await u$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
101
+ if (condition) { yield value; }`)};import{Buffer as fLe}from"buffer";import{StringDecoder as pLe}from"string_decoder";var rx=(t,e,r)=>{if(r)return;if(t)return{transform:hLe.bind(void 0,new TextEncoder)};let n=new pLe(e);return{transform:mLe.bind(void 0,n),final:gLe.bind(void 0,n)}},hLe=function*(t,e){fLe.isBuffer(e)?yield fo(e):typeof e=="string"?yield t.encode(e):yield e},mLe=function*(t,e){yield Bt(e)?t.write(e):e},gLe=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kte}from"util";var vL=kte(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),nx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=yLe}=e[r];for await(let i of n(t))yield*nx(i,e,r+1)},Mte=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_Le(r,Number(e),t)},_Le=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*nx(n,r,e+1)},Dte=kte(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),yLe=function*(t){yield t};var bL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Lte=(t,e)=>[...e.flatMap(r=>[...wl(r,t,0)]),...b_(t)],wl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=ELe}=e[r];for(let i of n(t))yield*wl(i,e,r+1)},b_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*SLe(r,Number(e),t)},SLe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*wl(n,r,e+1)},ELe=function*(t){yield t};var TL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=Ute(t,o,s),l=xl(e),u=xl(r),d=l?vL.bind(void 0,nx,a):bL.bind(void 0,wl),f=l||u?vL.bind(void 0,Mte,a):bL.bind(void 0,b_),p=l||u?Dte.bind(void 0,a):void 0;return{stream:new vLe({writableObjectMode:n,writableHighWaterMark:$te(n),readableObjectMode:i,readableHighWaterMark:$te(i),transform(m,E,T){d([m,c,0],this,T)},flush(m){f([c],this,m)},destroy:p})}},ix=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=Ute(o,r,a);t=Lte(c,t)}return t},Ute=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:Pte(n,a)},rx(r,o,n),tx(r,s,n,c),{transform:t,final:e},{transform:Ote(i,a)},Cte({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var Fte=(t,e)=>{for(let r of bLe(t))TLe(t,r,e)},bLe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),TLe=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Oa[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>ALe(a,n));r.input=f_(o)},ALe=(t,e)=>{let r=ix(t,e,"utf8",!0);return xLe(r),f_(r)},xLe=t=>{let e=t.find(r=>typeof r!="string"&&!Bt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as CLe,appendFileSync as PLe}from"fs";var sx=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&ef(r,n)&&!hn.has(e)&&wLe(n)&&(t.some(({type:i,value:s})=>i==="native"&&RLe.has(s))||t.every(({type:i})=>Vn.has(i))),wLe=t=>t===1||t===2,RLe=new Set(["pipe","overlapped"]),Bte=async(t,e,r,n)=>{for await(let i of t)ILe(e)||zte(i,r,n)},jte=(t,e,r)=>{for(let n of t)zte(n,e,r)},ILe=t=>t._readableState.pipes.length>0,zte=(t,e,r)=>{let n=SA(t);cs({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Gte=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>OLe({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},OLe=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=qee(t,s,d),p=fo(f),{stdioItems:h,objectMode:m}=e[r],E=NLe([p],h,c,n),{serializedResult:T,finalResult:v=T}=kLe({chunks:E,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});MLe({serializedResult:T,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?v:void 0;try{return n.error===void 0&&DLe(T,h,i),A}catch(S){return n.error=S,A}},NLe=(t,e,r,n)=>{try{return ix(t,e,r,!1)}catch(i){return n.error=i,t}},kLe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:f_(t)};let o=iQ(t,r);return n[s]?{serializedResult:o,finalResult:EL(o,!i[s],e)}:{serializedResult:o}},MLe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!sx({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=EL(t,!1,o);try{jte(a,e,n)}catch(c){r.error??=c}},DLe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>QA.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?PLe(n,t):(r.add(s),CLe(n,t))}};var qte=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,mo(e,r,"all")]:Array.isArray(e)?[mo(t,r,"all"),...e]:Bt(t)&&Bt(e)?CD([t,e]):`${t}${e}`};import{once as AL}from"events";var Vte=async(t,e)=>{let[r,n]=await LLe(t);return e.isForcefullyTerminated??=!1,[r,n]},LLe=async t=>{let[e,r]=await Promise.allSettled([AL(t,"spawn"),AL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Hte(t):r.value},Hte=async t=>{try{return await AL(t,"exit")}catch{return Hte(t)}},Wte=async t=>{let[e,r]=await t;if(!$Le(e,r)&&xL(e,r))throw new xi;return[e,r]},$Le=(t,e)=>t===void 0&&e===void 0,xL=(t,e)=>t!==0||e!==null;var Yte=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=ULe(t,e,r),o=s?.code==="ETIMEDOUT",a=Gee(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},ULe=(t,e,r)=>t!==void 0?t:xL(e,r)?new xi:void 0;var Kte=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=BLe(t,e,r),d=GLe({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return df(d,c,l)},BLe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=vA(t,e,r),a=jLe(r),{file:c,commandArguments:l,options:u}=jA(t,e,a);zLe(u);let d=xte(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},jLe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,zLe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&ox("ipcInput"),t&&ox("ipc: true"),r&&ox("detached: true"),n&&ox("cancelSignal")},ox=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},GLe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=qLe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Yte(c,r),{output:h,error:m=l}=Gte({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),E=h.map((v,A)=>mo(v,r,A)),T=mo(qte(h,r),r,"all");return HLe({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:E,all:T,options:r,command:n,escapedCommand:i,startTime:a})},qLe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{Fte(s,r);let a=VLe(r);return FLe(...zA(t,e,a))}catch(a){return uf({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},VLe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:KA(e)}),HLe=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?ZA({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):v_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as k1e}from"events";import{spawn as M1e}from"child_process";import ere from"process";import{once as wL,on as WLe}from"events";var Zte=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(nf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:DA(t)}),YLe({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),YLe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{OA(e,i);let s=Pa(t,e,r),o=new AbortController;try{return await Promise.race([KLe(s,n,o),ZLe(s,r,o),JLe(s,r,o)])}catch(a){throw sf(t),a}finally{o.abort(),NA(e,i)}},KLe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await wL(t,"message",{signal:r});return n}for await(let[n]of WLe(t,"message",{signal:r}))if(e(n))return n},ZLe=async(t,e,{signal:r})=>{await wL(t,"disconnect",{signal:r}),L7(e)},JLe=async(t,e,{signal:r})=>{let[n]=await wL(t,"strict:error",{signal:r});throw IA(n,e)};import{once as Xte,on as XLe}from"events";var Qte=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>RL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),RL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{nf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:DA(t)}),OA(e,s);let o=Pa(t,e,r),a=new AbortController,c={};return QLe(t,o,a),e$e({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),t$e({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},QLe=async(t,e,r)=>{try{await Xte(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},e$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Xte(t,"strict:error",{signal:r.signal});n.error=IA(i,e),r.abort()}catch{}},t$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of XLe(r,"message",{signal:s.signal}))Jte(o),yield c}catch{Jte(o)}finally{s.abort(),NA(e,a),n||sf(t),i&&await t}},Jte=({error:t})=>{if(t)throw t};var tre=(t,{ipc:e})=>{Object.assign(t,nre(t,!1,e))},rre=()=>{let t=ere,e=!0,r=ere.channel!==void 0;return{...nre(t,e,r),getCancelSignal:lee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nre=(t,e,r)=>({sendMessage:FA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Zte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Qte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as r$e}from"child_process";import{PassThrough as n$e,Readable as i$e,Writable as s$e,Duplex as o$e}from"stream";var ire=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{_L(n);let a=new r$e;a$e(a,n),Object.assign(a,{readable:c$e,writable:l$e,duplex:u$e});let c=uf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=d$e(c,o,i);return{subprocess:a,promise:l}},a$e=(t,e)=>{let r=T_(),n=T_(),i=T_(),s=Array.from({length:e.length-3},T_),o=T_(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},T_=()=>{let t=new n$e;return t.end(),t},c$e=()=>new i$e({read(){}}),l$e=()=>new s$e({write(){}}),u$e=()=>new o$e({read(){},write(){}}),d$e=async(t,e,r)=>df(t,e,r);import{createReadStream as sre,createWriteStream as ore}from"fs";import{Buffer as f$e}from"buffer";import{Readable as A_,Writable as p$e,Duplex as h$e}from"stream";var cre=(t,e)=>ex(m$e,t,e,!1),x_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Oa[t]}.`)},are={fileNumber:x_,generator:TL,asyncGenerator:TL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:h$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},m$e={input:{...are,fileUrl:({value:t})=>({stream:sre(t)}),filePath:({value:{file:t}})=>({stream:sre(t)}),webStream:({value:t})=>({stream:A_.fromWeb(t)}),iterable:({value:t})=>({stream:A_.from(t)}),asyncIterable:({value:t})=>({stream:A_.from(t)}),string:({value:t})=>({stream:A_.from(t)}),uint8Array:({value:t})=>({stream:A_.from(f$e.from(t))})},output:{...are,fileUrl:({value:t})=>({stream:ore(t)}),filePath:({value:{file:t,append:e}})=>({stream:ore(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:p$e.fromWeb(t)}),iterable:x_,asyncIterable:x_,string:x_,uint8Array:x_}};import{on as g$e,once as lre}from"events";import{PassThrough as _$e,getDefaultHighWaterMark as y$e}from"stream";import{finished as fre}from"stream/promises";function Rl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)CL(i);let e=t.some(({readableObjectMode:i})=>i),r=S$e(t,e),n=new IL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var S$e=(t,e)=>{if(t.length===0)return y$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},IL=class extends _$e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(CL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=E$e(this,this.#e,this.#s);let r=T$e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(CL(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},E$e=async(t,e,r)=>{ax(t,ure);let n=new AbortController;try{await Promise.race([v$e(t,n),b$e(t,e,r,n)])}finally{n.abort(),ax(t,-ure)}},v$e=async(t,{signal:e})=>{try{await fre(t,{signal:e,cleanup:!0})}catch(r){throw pre(t,r),r}},b$e=async(t,e,r,{signal:n})=>{for await(let[i]of g$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},CL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},T$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{ax(t,dre);let a=new AbortController;try{await Promise.race([A$e(s,e,a),x$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),w$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),ax(t,-dre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?PL(t):R$e(t))},A$e=async(t,e,{signal:r})=>{try{await t,r.aborted||PL(e)}catch(n){r.aborted||pre(e,n)}},x$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await fre(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;hre(o)?i.add(e):mre(t,o)}},w$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await lre(t,i,{signal:s}),!t.readable)return lre(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},R$e=t=>{t.writable&&t.end()},pre=(t,e)=>{hre(e)?PL(t):mre(t,e)},hre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",PL=t=>{(t.readable||t.writable)&&t.destroy()},mre=(t,e)=>{t.destroyed||(t.once("error",I$e),t.destroy(e))},I$e=()=>{},ax=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},ure=2,dre=1;import{finished as gre}from"stream/promises";var pf=(t,e)=>{t.pipe(e),C$e(t,e),P$e(t,e)},C$e=async(t,e)=>{if(!(Ai(t)||Ai(e))){try{await gre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}OL(e)}},OL=t=>{t.writable&&t.end()},P$e=async(t,e)=>{if(!(Ai(t)||Ai(e))){try{await gre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}NL(t)}},NL=t=>{t.readable&&t.destroy()};var _re=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>Vn.has(c)))O$e(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!Vn.has(c)))k$e({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Rl(s);pf(o,i)}},O$e=(t,e,r,n)=>{r==="output"?pf(t.stdio[n],e):pf(e,t.stdio[n]);let i=N$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},N$e=["stdin","stdout","stderr"],k$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;M$e(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},M$e=(t,{signal:e})=>{Ai(t)&&Tl(t,D$e,e)},D$e=2;import{addAbortListener as U$e}from"events";var Il=[];Il.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Il.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Il.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var cx=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",kL=Symbol.for("signal-exit emitter"),ML=globalThis,L$e=Object.defineProperty.bind(Object),DL=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ML[kL])return ML[kL];L$e(ML,kL,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},lx=class{},$$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),LL=class extends lx{onExit(){return()=>{}}load(){}unload(){}},$L=class extends lx{#e=UL.platform==="win32"?"SIGINT":"SIGHUP";#r=new DL;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Il)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!cx(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of Il)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Il.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return cx(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&cx(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},UL=globalThis.process,{onExit:yre,load:oSt,unload:aSt}=$$e(cx(UL)?new $L(UL):new LL);var Sre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=yre(()=>{t.kill()});U$e(n,()=>{i()})};var vre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=EA(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=F$e(r,n,i),{sourceStream:d,sourceError:f}=j$e(t,l),{options:p,fileDescriptors:h}=us.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},F$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=B$e(t,e,...r),a=PA(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},B$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ere,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||RD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=uA(r,...n);return{destination:e(Ere)(i,s,o),pipeOptions:o}}if(us.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ere=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),j$e=(t,e)=>{try{return{sourceStream:of(t,e)}}catch(r){return{sourceError:r}}};var Tre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=z$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FL({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},z$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return NL(t),n;if(e!==void 0)return OL(r),e},FL=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>uf({error:t,command:bre,escapedCommand:bre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),bre="source.pipe(destination)";var Are=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as G$e}from"stream/promises";var xre=(t,e,r)=>{let n=ux.has(e)?V$e(t,e):q$e(t,e);return Tl(t,W$e,r.signal),Tl(e,Y$e,r.signal),H$e(e),n},q$e=(t,e)=>{let r=Rl([t]);return pf(r,e),ux.set(e,r),r},V$e=(t,e)=>{let r=ux.get(e);return r.add(t),r},H$e=async t=>{try{await G$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}ux.delete(t)},ux=new WeakMap,W$e=2,Y$e=1;import{aborted as K$e}from"util";var wre=(t,e)=>t===void 0?[]:[Z$e(t,e)],Z$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await K$e(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw FL({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var dx=(t,...e)=>{if(Pt(e[0]))return dx.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vre(t,...e),i=J$e({...n,destination:r});return i.pipe=dx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},J$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=X$e(t,i);Tre({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=xre(e,s,d);return await Promise.race([Are(u),...wre(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},X$e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as s1e}from"timers/promises";import{on as Q$e}from"events";import{getDefaultHighWaterMark as e1e}from"stream";var fx=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return t1e(e,o),Ire({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},t1e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},BL=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;r1e(e,o,t);let a=t.readableObjectMode&&!s;return Ire({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},r1e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ire=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=Q$e(t,"data",{signal:e.signal,highWaterMark:Rre,highWatermark:Rre});return n1e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},jL=e1e(!0),Rre=jL,n1e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=i1e({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*wl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*b_(a)}},i1e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[rx(t,r,!e),tx(t,i,!n,{})].filter(Boolean);var Cre=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=o1e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([a1e(t),d]);return}let f=yL(c,r),p=BL({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([c1e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},o1e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!sx({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=BL({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Bte(a,t,r,s)},a1e=async t=>{await s1e(),t.readableFlowing===null&&t.resume()},c1e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await HA(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await WA(r,{maxBuffer:s})):await lf(r,{maxBuffer:s})}catch(a){return Pre(Bee({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},zL=async t=>{try{return await t}catch(e){return Pre(e)}},Pre=({bufferedData:t})=>rQ(t)?new Uint8Array(t):t;import{finished as l1e}from"stream/promises";var w_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=u1e(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],l1e(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||p1e(a,e,r,n)}finally{o.abort()}},u1e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&d1e(t,r,n),n},d1e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{f1e(e,r),n.call(t,...i)}},f1e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},p1e=(t,e,r,n)=>{if(!h1e(t,e,r,n))throw t},h1e=(t,e,r,n=!0)=>r.propagating?Ore(t)||px(t):(r.propagating=!0,GL(r,e)===n?Ore(t):px(t)),GL=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",px=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Ore=t=>t?.code==="EPIPE";var Nre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>qL({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),qL=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=w_(t,e,l);if(GL(l,e)){await u;return}let[d]=await Promise.all([Cre({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var kre=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Rl([t,e].filter(Boolean)):void 0,Mre=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>qL({...m1e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:g1e(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),m1e=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},g1e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as _1e}from"events";var Dre=t=>ef(t,"ipc"),Lre=(t,e)=>{let r=SA(t);cs({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var $re=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=Dre(s),a=po(e,"ipc"),c=po(r,"ipc");for await(let l of RL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(jee(t,i,c),i.push(l)),o&&Lre(l,s);return i},Ure=async(t,e)=>(await Promise.allSettled([t]),e);var Fre=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:E,controller:T})=>{let v=Vte(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},S=Nre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=Mre({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),P=[],L=$re({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),I=y1e(m,t,A),O=S1e(h,A);try{return await Promise.race([Promise.all([{},Wte(v),Promise.all(S),R,L,See(t,d),...I,...O]),E,E1e(t,T),...hee(t,s,f,T),...D7({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:T}),...fee({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:T})])}catch(j){return f.terminationReason??="other",Promise.all([{error:j},v,Promise.all(S.map(_=>zL(_))),zL(R),Ure(L,P),Promise.allSettled(I),Promise.allSettled(O)])}},y1e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:w_(n,i,r)),S1e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>Ri(s,{checkOpen:!1})&&!Ai(s)).map(({type:i,value:s,stream:o=s})=>w_(o,n,e,{isSameDirection:Vn.has(i),stopOnExit:i==="native"}))),E1e=async(t,{signal:e})=>{let[r]=await _1e(t,"error",{signal:e});throw r};var Bre=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),R_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=ls();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},hf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as v1e}from"stream";import{callbackify as b1e}from"util";import{finished as jre}from"stream/promises";var VL=async t=>{if(t!==void 0)try{await HL(t)}catch{}},zre=async t=>{if(t!==void 0)try{await WL(t)}catch{}},HL=async t=>{await jre(t,{cleanup:!0,readable:!1,writable:!0})},WL=async t=>{await jre(t,{cleanup:!0,readable:!0,writable:!1})},hx=async(t,e)=>{if(await t,e)throw e},mx=(t,e,r)=>{r&&!px(r)?t.destroy(r):e&&t.destroy()};var Gre=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||hn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=YL(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=KL(a,o),{read:f,onStdoutDataDone:p}=ZL({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new v1e({read:f,destroy:b1e(XL.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return JL({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},YL=(t,e,r)=>{let n=of(t,e),i=R_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},KL=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:jL},ZL=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=ls(),o=fx({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){T1e(this,o,s)},onStdoutDataDone:s}},T1e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},JL=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await WL(t),await n,await VL(i),await e,r.readable&&r.push(null)}catch(s){await VL(i),qre(r,s)}},XL=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await hf(r,e)&&(qre(t,n),await hx(e,n))},qre=(t,e)=>{mx(t,t.readable,e)};import{Writable as A1e}from"stream";import{callbackify as Vre}from"util";var Hre=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=QL(t,r,e),o=new A1e({...e$(n,t,i),destroy:Vre(r$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return t$(n,o),o},QL=(t,e,r)=>{let n=PA(t,e),i=R_(r,n,"writableFinal"),s=R_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},e$=(t,e,r)=>({write:x1e.bind(void 0,t),final:Vre(w1e.bind(void 0,t,e,r))}),x1e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},w1e=async(t,e,r)=>{await hf(r,e)&&(t.writable&&t.end(),await e)},t$=async(t,e,r)=>{try{await HL(t),e.writable&&e.end()}catch(n){await zre(r),Wre(e,n)}},r$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await hf(r,e),await hf(n,e)&&(Wre(t,i),await hx(e,i))},Wre=(t,e)=>{mx(t,t.writable,e)};import{Duplex as R1e}from"stream";import{callbackify as I1e}from"util";var Yre=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||hn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=YL(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=QL(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=KL(c,a),{read:E,onStdoutDataDone:T}=ZL({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new R1e({read:E,...e$(u,t,d),destroy:I1e(C1e.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return JL({subprocessStdout:c,onStdoutDataDone:T,readable:v,subprocess:t,subprocessStdin:u}),t$(u,v,c),v},C1e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([XL({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),r$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var n$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||hn.has(e),o=of(t,r),a=fx({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return P1e(a,o,t)},P1e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kre=(t,{encoding:e})=>{let r=Bre();t.readable=Gre.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Hre.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Yre.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=n$.bind(void 0,t,e),t[Symbol.asyncIterator]=n$.bind(void 0,t,e,{})};var Zre=(t,e)=>{for(let[r,n]of N1e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},O1e=(async()=>{})().constructor.prototype,N1e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(O1e,t)]);var Jre=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=D1e(t,e,r),{subprocess:f,promise:p}=$1e({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=dx.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Zre(f,p),us.set(f,{options:u,fileDescriptors:d}),f},D1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=vA(t,e,r),{file:a,commandArguments:c,options:l}=jA(t,e,r),u=L1e(l),d=cre(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},L1e=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},$1e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=M1e(...zA(t,e,r))}catch(h){return ire({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;k1e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_re(c,a,l),Sre(c,r,l);let d={},f=ls();c.kill=k7.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kre(c,r),Kre(c,r),tre(c,r);let p=U1e({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},U1e=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,E]=await Fre({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let T=h.map((S,R)=>mo(S,e,R)),v=mo(m,e,"all"),A=F1e({errorInfo:d,exitCode:f,signal:p,stdio:T,all:v,ipcOutput:E,context:c,options:e,command:o,escapedCommand:a,startTime:r});return df(A,n,e)},F1e=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?v_({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ds,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):ZA({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var gx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,B1e(n,t[n],i)]));return{...t,...r}},B1e=(t,e,r)=>j1e.has(t)&&Pt(e)&&Pt(r)?{...e,...r}:r,j1e=new Set(["env",...kD]);var Na=(t,e,r,n)=>{let i=(o,a,c)=>Na(o,a,r,c),s=(...o)=>z1e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},z1e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(Pt(s))return i(t,gx(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=G1e({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?Kte(a,c,l):Jre(a,c,l,i)},G1e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=cQ(e)?lQ(e,r):[e,...r],[o,a,c]=uA(...s),l=gx(gx(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Xre=({file:t,commandArguments:e})=>ene(t,e),Qre=({file:t,commandArguments:e})=>({...ene(t,e),isSync:!0}),ene=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=q1e(t);return{file:r,commandArguments:n}},q1e=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(V1e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},V1e=/ +/g;var tne=(t,e,r)=>{t.sync=e(H1e,r),t.s=t.sync},rne=({options:t})=>nne(t),H1e=({options:t})=>({...nne(t),isSync:!0}),nne=t=>({options:{...W1e(t),...t}}),W1e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},ine={preferLocal:!0};var sne=Na(()=>({})),Zvt=Na(()=>({isSync:!0})),one=Na(Xre),Jvt=Na(Qre),Xvt=Na(gee),Qvt=Na(rne,{},ine,tne),{sendMessage:ebt,getOneMessage:tbt,getEachMessage:rbt,getCancelSignal:nbt}=rre();var ane=!1,cne=()=>{ane=!0},ps=()=>ane;var I_=null,lne=t=>(I_&&I_.destroy(),I_=new go({totalAllowedTime:t}),I_),une=()=>I_;var go=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&ps())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await nA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var dne={name:"@netlify/agent-runner-cli",type:"module",version:"1.152.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.4","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var J1e=K1e(import.meta.url),X1e=_o.dirname(J1e),Q1e=Z1e(import.meta.url),mf=pe("shell"),i$=new Set,fne={preferLocal:!0},kr=(t,e,r)=>{let[n,i]=eUe(e,r),s={...fne,...i},o=sne(t,n,s);hne(o,s),_ne(o);let a=r?.idleTimeout;return a&&a>0&&gne(o,a),o},pne=(t,e)=>{let r={...fne,...e},n=one(t,r);return hne(n,r),_ne(n),e?.idleTimeout&&e.idleTimeout>0&&gne(n,e.idleTimeout),n},eUe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},hne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(yo.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new r_).pipe(yo.stdout),t.stderr?.pipe(new r_).pipe(yo.stderr);return}t.stdout?.pipe(yo.stdout),t.stderr?.pipe(yo.stderr)},s$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(yo.kill(-t.pid,e),mf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return mf.error("Error killing process:",r),!1}},mne=t=>s$(t,"SIGKILL"),gne=(t,e)=>{let r=null,n=()=>{mf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),s$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(mf.log(`Force killing idle process ${t.pid}`),mne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},_ne=t=>{i$.add(t);let e=une();if(e){let r=e.onTimesUp(()=>{mf.log(`Global timer expired, killing process ${t.pid}`),s$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(mf.log(`Force killing process ${t.pid} after timeout`),mne(t))},5e3)});t.on("exit",()=>{i$.delete(t),r()}),t.on("error",()=>{i$.delete(t),r()})}};function hs(t,e){if(!yo.env.NETLIFY_LOCAL_MODE)try{let i=Q1e.resolve(dne.name),s=_o.dirname(i);for(;s!==_o.dirname(s);){let o=_o.dirname(s);if(_o.basename(o)==="node_modules"){let a=_o.join(o,".bin",e);if(_x.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(yo.env.NODE_PATH){let i=_o.join(yo.env.NODE_PATH,".bin",e);if(_x.existsSync(i))return i}let r=_o.join(t,"node_modules",".bin",e);if(_x.existsSync(r))return r;let n=_o.join(X1e,"..","node_modules",".bin",e);if(_x.existsSync(n))return n}var tUe=pe("utils"),rUe=t=>new Promise(e=>{setTimeout(e,t)});var o$=t=>{try{return new URL(t).hostname||null}catch{return null}},yx=(t,e=3e3)=>{let r=!1,n=null,i=[],s=null,o=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return s=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await rUe(e),!n)return r=!1,s=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return o.flush=async()=>{if((r||n)&&s)return await s,o.flush()},o.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},o},ka=(t,e,r=!1)=>{let n=null,i=null,s=null,o=function(...a){i=a,s=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(s,i),i=null,s=null)},e),c&&(t.apply(s,i),i=null,s=null)};return o.cancel=()=>{clearTimeout(n),n=null,i=null,s=null},o.flush=()=>{if(n){clearTimeout(n);let a=i,c=s;n=null,i=null,s=null,t.apply(c,a)}},o},yne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):tUe.error("Could not parse JSON",n))}},nUe=t=>t.charAt(0).toUpperCase()+t.slice(1),ms=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():nUe(e)).join(" ");function So(t,e){e&&t.log(`Skill invoked: ${e}`)}var Sx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Sne=(t,e,r=!1)=>{if(r)return;let n=60,i=55,s=".netlify.app",o="agent-",a=6;if(!e)return`${o}${t.slice(0,a)}`;let c=`--${e}${s}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=o.length+a){let u=Math.min(l-o.length,t.length);return`${o}${t.slice(0,u)}`}return t.slice(0,l)};var a$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},iUe=1e4,c$=(t,e=iUe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as sUe}from"crypto";import{createReadStream as oUe}from"fs";import Ex from"fs/promises";import Ane from"os";import vx from"path";var Ene=pe("repo"),xne="runner-diffs-",wne=t=>`${xne}${t}-`,Rne=async t=>{let e=Ane.tmpdir(),r;try{r=await Ex.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(xne)&&!n.startsWith(wne(t))).map(n=>Ex.rm(vx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Kr=(t,e={})=>kr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),bx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Ene.info("Getting runner diffs");let n=await cUe(r),{hasChanges:i}=n,{status:s}=n;if(!i)return{hasChanges:!1};if(!e){let h=uUe(s);await dUe(h,r)}Ene.info("Changes after processing"),await u$(r);let o=await f$(s,r);if(await l$(o,r),i=await lUe(r),!i)return{hasChanges:!1,ignored:o};await Kr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Ex.mkdtemp(vx.join(Ane.tmpdir(),wne(t.sessionId))),c=async({from:h,to:m,fileName:E,binary:T})=>{let v=vx.join(a,E);await Kr([...T?["diff",h,m,"--binary"]:["diff",h,m],`--output=${v}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Ex.stat(v);return{path:v,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Tne(r),{hasChanges:!1,ignored:o};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await bne(d,h)||(f=h)}await Tne(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:o};return await bne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},vne=async t=>{let e=sUe("sha256");for await(let r of oUe(t))e.update(r);return e.digest("hex")},bne=async(t,e)=>t.size===e.size&&await vne(t.path)===await vne(e.path),Tne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Kr(["reset","--soft","HEAD~1"],{cwd:t})},l$=async(t=[],e=process.cwd())=>{await Kr(["add",".",...t],{cwd:e})},u$=async(t=process.cwd())=>{let e=await Kr(["status","-s"],{cwd:t});return String(e.stdout??"")},Ine=/.. (.+)?\.log$/,aUe=[Ine],cUe=async(t=process.cwd())=>{let e=await u$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
102
102
  `).filter(i=>aUe.some(o=>o instanceof RegExp?o.test(i):i===o)?!1:i[1]?.trim()!=="")).length!==0,status:e}},lUe=async(t=process.cwd())=>{try{return await Kr(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},d$=async(t=process.cwd())=>{let{stdout:e}=await Kr(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},Cne=async(t=process.cwd())=>{let{stdout:e}=await Kr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},f$=async(t,e=process.cwd())=>{t||=await u$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
103
103
  `).forEach(i=>{r.forEach(o=>{let a=i===`?? ${o}`,c=i.startsWith(`?? ${o}/`)||i.startsWith(`?? ${o}${vx.sep}`);(a||c)&&n.push(`:!${o}`)});let s=i.match(Ine)?.[1];s&&n.push(`:!${s}.log`)}),n},Pne=async(t=process.cwd())=>{await Kr(["reset","--hard","HEAD"],{cwd:t})},One=async(t=process.cwd())=>{let e=await Kr(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
104
104
  `).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},uUe=t=>{let e=t.split(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/agent-runner-cli",
3
3
  "type": "module",
4
- "version": "1.152.0-EX-2670.1",
4
+ "version": "1.152.0",
5
5
  "description": "CLI tool for running Netlify agents",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",