@netlify/agent-runner-cli 2.6.2-PAW-837.0 → 2.7.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/index.js CHANGED
@@ -384,7 +384,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
384
384
  `,LF:`
385
385
  `,concatBytes:_Y},Mct=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},$ct={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Mct};import{Buffer as Lct}from"buffer";var swe=(t,e)=>t?void 0:Uct.bind(void 0,e),Uct=function*(t,e){if(typeof e!="string"&&!Fr(e)&&!Lct.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},owe=(t,e)=>t?Fct.bind(void 0,e):zct.bind(void 0,e),Fct=function*(t,e){awe(t,e),yield e},zct=function*(t,e){if(awe(t,e),typeof e!="string"&&!Fr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},awe=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
386
386
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
387
- if (condition) { yield value; }`)};import{Buffer as jct}from"buffer";import{StringDecoder as qct}from"string_decoder";var LD=(t,e,r)=>{if(r)return;if(t)return{transform:Bct.bind(void 0,new TextEncoder)};let n=new qct(e);return{transform:Vct.bind(void 0,n),final:Gct.bind(void 0,n)}},Bct=function*(t,e){jct.isBuffer(e)?yield iu(e):typeof e=="string"?yield t.encode(e):yield e},Vct=function*(t,e){yield Fr(e)?t.write(e):e},Gct=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as cwe}from"util";var SY=cwe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),UD=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Wct}=e[r];for await(let i of n(t))yield*UD(i,e,r+1)},uwe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Hct(r,Number(e),t)},Hct=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*UD(n,r,e+1)},lwe=cwe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Wct=function*(t){yield t};var vY=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dwe=(t,e)=>[...e.flatMap(r=>[...bp(r,t,0)]),...LT(t)],bp=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Yct}=e[r];for(let i of n(t))yield*bp(i,e,r+1)},LT=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Kct(r,Number(e),t)},Kct=function*(t,e,r){if(t!==void 0)for(let n of t())yield*bp(n,r,e+1)},Yct=function*(t){yield t};var EY=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=pwe(t,o,s),u=Ep(e),l=Ep(r),d=u?SY.bind(void 0,UD,a):vY.bind(void 0,bp),f=u||l?SY.bind(void 0,uwe,a):vY.bind(void 0,LT),p=u||l?lwe.bind(void 0,a):void 0;return{stream:new Zct({writableObjectMode:n,writableHighWaterMark:fwe(n),readableObjectMode:i,readableHighWaterMark:fwe(i),transform(m,_,y){d([m,c,0],this,y)},flush(m){f([c],this,m)},destroy:p})}},FD=(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=pwe(o,r,a);t=dwe(c,t)}return t},pwe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:swe(n,a)},LD(r,o,n),$D(r,s,n,c),{transform:t,final:e},{transform:owe(i,a)},iwe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var hwe=(t,e)=>{for(let r of Jct(t))Qct(t,r,e)},Jct=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Qct=(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 ${Bl[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>Xct(a,n));r.input=xT(o)},Xct=(t,e)=>{let r=FD(t,e,"utf8",!0);return eut(r),xT(r)},eut=t=>{let e=t.find(r=>typeof r!="string"&&!Fr(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 iut,appendFileSync as sut}from"fs";var zD=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&T_(r,n)&&!os.has(e)&&tut(n)&&(t.some(({type:i,value:s})=>i==="native"&&rut.has(s))||t.every(({type:i})=>Vs.has(i))),tut=t=>t===1||t===2,rut=new Set(["pipe","overlapped"]),mwe=async(t,e,r,n)=>{for await(let i of t)nut(e)||_we(i,r,n)},gwe=(t,e,r)=>{for(let n of t)_we(n,e,r)},nut=t=>t._readableState.pipes.length>0,_we=(t,e,r)=>{let n=eD(t);Ga({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var ywe=({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,u)=>out({result:c,fileDescriptors:t,fdNumber:u,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},out=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:u,stripFinalNewline:l,maxBuffer:d})=>{if(t===null)return;let f=Sbe(t,s,d),p=iu(f),{stdioItems:h,objectMode:m}=e[r],_=aut([p],h,c,n),{serializedResult:y,finalResult:w=y}=cut({chunks:_,objectMode:m,encoding:c,lines:u,stripFinalNewline:l,fdNumber:r});uut({serializedResult:y,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let x=a[r]?w:void 0;try{return n.error===void 0&&lut(y,h,i),x}catch(S){return n.error=S,x}},aut=(t,e,r,n)=>{try{return FD(t,e,r,!1)}catch(i){return n.error=i,t}},cut=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:xT(t)};let o=NSe(t,r);return n[s]?{serializedResult:o,finalResult:yY(o,!i[s],e)}:{serializedResult:o}},uut=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!zD({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=yY(t,!1,o);try{gwe(a,e,n)}catch(c){r.error??=c}},lut=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>DD.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?sut(n,t):(r.add(s),iut(n,t))}};var Swe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,au(e,r,"all")]:Array.isArray(e)?[au(t,r,"all"),...e]:Fr(t)&&Fr(e)?xK([t,e]):`${t}${e}`};import{once as bY}from"events";var vwe=async(t,e)=>{let[r,n]=await dut(t);return e.isForcefullyTerminated??=!1,[r,n]},dut=async t=>{let[e,r]=await Promise.allSettled([bY(t,"spawn"),bY(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Ewe(t):r.value},Ewe=async t=>{try{return await bY(t,"exit")}catch{return Ewe(t)}},bwe=async t=>{let[e,r]=await t;if(!fut(e,r)&&wY(e,r))throw new Zo;return[e,r]},fut=(t,e)=>t===void 0&&e===void 0,wY=(t,e)=>t!==0||e!==null;var wwe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=put(t,e,r),o=s?.code==="ETIMEDOUT",a=ybe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},put=(t,e,r)=>t!==void 0?t:wY(e,r)?new Zo:void 0;var Twe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=mut(t,e,r),d=yut({file:n,commandArguments:i,options:u,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:l,startTime:a});return D_(d,c,u)},mut=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=rD(t,e,r),a=gut(r),{file:c,commandArguments:u,options:l}=bD(t,e,a);_ut(l);let d=ewe(l,o);return{file:c,commandArguments:u,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},gut=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,_ut=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&jD("ipcInput"),t&&jD("ipc: true"),r&&jD("detached: true"),n&&jD("cancelSignal")},jD=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},yut=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=Sut({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:u,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p}=wwe(c,r),{output:h,error:m=u}=ywe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((w,x)=>au(w,r,x)),y=au(Swe(h,r),r,"all");return Eut({error:m,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},Sut=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{hwe(s,r);let a=vut(r);return hut(...wD(t,e,a))}catch(a){return N_({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},vut=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:PD(e)}),Eut=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:u,startTime:l})=>t===void 0?CD({command:c,escapedCommand:u,stdio:s,all:o,ipcOutput:[],options:a,startTime:l}):$T({error:t,command:c,escapedCommand:u,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as cdt}from"events";import{spawn as udt}from"child_process";import Iwe from"process";import{once as TY,on as but}from"events";var Awe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(x_({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:gD(t)}),wut({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),wut=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{fD(e,i);let s=ql(t,e,r),o=new AbortController;try{return await Promise.race([Tut(s,n,o),Aut(s,r,o),Rut(s,r,o)])}catch(a){throw O_(t),a}finally{o.abort(),pD(e,i)}},Tut=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await TY(t,"message",{signal:r});return n}for await(let[n]of but(t,"message",{signal:r}))if(e(n))return n},Aut=async(t,e,{signal:r})=>{await TY(t,"disconnect",{signal:r}),dEe(e)},Rut=async(t,e,{signal:r})=>{let[n]=await TY(t,"strict:error",{signal:r});throw uD(n,e)};import{once as xwe,on as xut}from"events";var Owe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>AY({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),AY=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{x_({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:gD(t)}),fD(e,s);let o=ql(t,e,r),a=new AbortController,c={};return Out(t,o,a),Iut({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),Put({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},Out=async(t,e,r)=>{try{await xwe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Iut=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await xwe(t,"strict:error",{signal:r.signal});n.error=uD(i,e),r.abort()}catch{}},Put=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of xut(r,"message",{signal:s.signal}))Rwe(o),yield c}catch{Rwe(o)}finally{s.abort(),pD(e,a),n||O_(t),i&&await t}},Rwe=({error:t})=>{if(t)throw t};var Pwe=(t,{ipc:e})=>{Object.assign(t,kwe(t,!1,e))},Cwe=()=>{let t=Iwe,e=!0,r=Iwe.channel!==void 0;return{...kwe(t,e,r),getCancelSignal:UEe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},kwe=(t,e,r)=>({sendMessage:vD.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Awe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Owe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Cut}from"child_process";import{PassThrough as kut,Readable as Nut,Writable as Dut,Duplex as Mut}from"stream";var Nwe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{mY(n);let a=new Cut;$ut(a,n),Object.assign(a,{readable:Lut,writable:Uut,duplex:Fut});let c=N_({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),u=zut(c,o,i);return{subprocess:a,promise:u}},$ut=(t,e)=>{let r=UT(),n=UT(),i=UT(),s=Array.from({length:e.length-3},UT),o=UT(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},UT=()=>{let t=new kut;return t.end(),t},Lut=()=>new Nut({read(){}}),Uut=()=>new Dut({write(){}}),Fut=()=>new Mut({read(){},write(){}}),zut=async(t,e,r)=>D_(t,e,r);import{createReadStream as Dwe,createWriteStream as Mwe}from"fs";import{Buffer as jut}from"buffer";import{Readable as FT,Writable as qut,Duplex as But}from"stream";var Lwe=(t,e)=>MD(Vut,t,e,!1),zT=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Bl[t]}.`)},$we={fileNumber:zT,generator:EY,asyncGenerator:EY,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:But.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Vut={input:{...$we,fileUrl:({value:t})=>({stream:Dwe(t)}),filePath:({value:{file:t}})=>({stream:Dwe(t)}),webStream:({value:t})=>({stream:FT.fromWeb(t)}),iterable:({value:t})=>({stream:FT.from(t)}),asyncIterable:({value:t})=>({stream:FT.from(t)}),string:({value:t})=>({stream:FT.from(t)}),uint8Array:({value:t})=>({stream:FT.from(jut.from(t))})},output:{...$we,fileUrl:({value:t})=>({stream:Mwe(t)}),filePath:({value:{file:t,append:e}})=>({stream:Mwe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:qut.fromWeb(t)}),iterable:zT,asyncIterable:zT,string:zT,uint8Array:zT}};import{on as Gut,once as Uwe}from"events";import{PassThrough as Hut,getDefaultHighWaterMark as Wut}from"stream";import{finished as jwe}from"stream/promises";function wp(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)xY(i);let e=t.some(({readableObjectMode:i})=>i),r=Kut(t,e),n=new RY({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Kut=(t,e)=>{if(t.length===0)return Wut(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},RY=class extends Hut{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(xY(e),this.#e.has(e))return;this.#e.add(e),this.#n??=Yut(this,this.#e,this.#s);let r=Qut({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(xY(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)}},Yut=async(t,e,r)=>{qD(t,Fwe);let n=new AbortController;try{await Promise.race([Zut(t,n),Jut(t,e,r,n)])}finally{n.abort(),qD(t,-Fwe)}},Zut=async(t,{signal:e})=>{try{await jwe(t,{signal:e,cleanup:!0})}catch(r){throw qwe(t,r),r}},Jut=async(t,e,r,{signal:n})=>{for await(let[i]of Gut(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},xY=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Qut=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{qD(t,zwe);let a=new AbortController;try{await Promise.race([Xut(s,e,a),elt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),tlt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),qD(t,-zwe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OY(t):rlt(t))},Xut=async(t,e,{signal:r})=>{try{await t,r.aborted||OY(e)}catch(n){r.aborted||qwe(e,n)}},elt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await jwe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;Bwe(o)?i.add(e):Vwe(t,o)}},tlt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await Uwe(t,i,{signal:s}),!t.readable)return Uwe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},rlt=t=>{t.writable&&t.end()},qwe=(t,e)=>{Bwe(e)?OY(t):Vwe(t,e)},Bwe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OY=t=>{(t.readable||t.writable)&&t.destroy()},Vwe=(t,e)=>{t.destroyed||(t.once("error",nlt),t.destroy(e))},nlt=()=>{},qD=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Fwe=2,zwe=1;import{finished as Gwe}from"stream/promises";var $_=(t,e)=>{t.pipe(e),ilt(t,e),slt(t,e)},ilt=async(t,e)=>{if(!(Yo(t)||Yo(e))){try{await Gwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}IY(e)}},IY=t=>{t.writable&&t.end()},slt=async(t,e)=>{if(!(Yo(t)||Yo(e))){try{await Gwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}PY(t)}},PY=t=>{t.readable&&t.destroy()};var Hwe=(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)))olt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!Vs.has(c)))clt({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]:wp(s);$_(o,i)}},olt=(t,e,r,n)=>{r==="output"?$_(t.stdio[n],e):$_(e,t.stdio[n]);let i=alt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},alt=["stdin","stdout","stderr"],clt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;ult(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},ult=(t,{signal:e})=>{Yo(t)&&Sp(t,llt,e)},llt=2;import{addAbortListener as plt}from"events";var Tp=[];Tp.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Tp.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Tp.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var BD=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",CY=Symbol.for("signal-exit emitter"),kY=globalThis,dlt=Object.defineProperty.bind(Object),NY=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(kY[CY])return kY[CY];dlt(kY,CY,{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}},VD=class{},flt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),DY=class extends VD{onExit(){return()=>{}}load(){}unload(){}},MY=class extends VD{#e=$Y.platform==="win32"?"SIGINT":"SIGHUP";#r=new NY;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Tp)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(!BD(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 Tp)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,Tp.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 BD(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"&&BD(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)}},$Y=globalThis.process,{onExit:Wwe,load:dsr,unload:fsr}=flt(BD($Y)?new MY($Y):new DY);var Kwe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Wwe(()=>{t.kill()});plt(n,()=>{i()})};var Zwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=tD(),{destination:o,destinationStream:a,destinationError:c,from:u,unpipeSignal:l}=hlt(r,n,i),{sourceStream:d,sourceError:f}=glt(t,u),{options:p,fileDescriptors:h}=Wa.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:h,startTime:s}},hlt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=mlt(t,e,...r),a=dD(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},mlt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ywe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||AK(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]=GN(r,...n);return{destination:e(Ywe)(i,s,o),pipeOptions:o}}if(Wa.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}`)},Ywe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),glt=(t,e)=>{try{return{sourceStream:I_(t,e)}}catch(r){return{sourceError:r}}};var Qwe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=_lt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw LY({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},_lt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return PY(t),n;if(e!==void 0)return IY(r),e},LY=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>N_({error:t,command:Jwe,escapedCommand:Jwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Jwe="source.pipe(destination)";var Xwe=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 ylt}from"stream/promises";var eTe=(t,e,r)=>{let n=GD.has(e)?vlt(t,e):Slt(t,e);return Sp(t,blt,r.signal),Sp(e,wlt,r.signal),Elt(e),n},Slt=(t,e)=>{let r=wp([t]);return $_(r,e),GD.set(e,r),r},vlt=(t,e)=>{let r=GD.get(e);return r.add(t),r},Elt=async t=>{try{await ylt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}GD.delete(t)},GD=new WeakMap,blt=2,wlt=1;import{aborted as Tlt}from"util";var tTe=(t,e)=>t===void 0?[]:[Alt(t,e)],Alt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await Tlt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw LY({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var HD=(t,...e)=>{if(vr(e[0]))return HD.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Zwe(t,...e),i=Rlt({...n,destination:r});return i.pipe=HD.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Rlt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:u})=>{let l=xlt(t,i);Qwe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let f=eTe(e,s,d);return await Promise.race([Xwe(l),...tTe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{d.abort()}},xlt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as Dlt}from"timers/promises";import{on as Olt}from"events";import{getDefaultHighWaterMark as Ilt}from"stream";var WD=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return Plt(e,o),nTe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},Plt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},UY=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;Clt(e,o,t);let a=t.readableObjectMode&&!s;return nTe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Clt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nTe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=Olt(t,"data",{signal:e.signal,highWaterMark:rTe,highWatermark:rTe});return klt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},FY=Ilt(!0),rTe=FY,klt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=Nlt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*bp(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*LT(a)}},Nlt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[LD(t,r,!e),$D(t,i,!n,{})].filter(Boolean);var iTe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:u,streamInfo:l})=>{let d=Mlt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:u,streamInfo:l});if(!i){await Promise.all([$lt(t),d]);return}let f=gY(c,r),p=UY({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([Llt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},Mlt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!zD({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=UY({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await mwe(a,t,r,s)},$lt=async t=>{await Dlt(),t.readableFlowing===null&&t.resume()},Llt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await xD(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await OD(r,{maxBuffer:s})):await k_(r,{maxBuffer:s})}catch(a){return sTe(mbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},zY=async t=>{try{return await t}catch(e){return sTe(e)}},sTe=({bufferedData:t})=>CSe(t)?new Uint8Array(t):t;import{finished as Ult}from"stream/promises";var jT=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=Flt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Ult(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||qlt(a,e,r,n)}finally{o.abort()}},Flt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&zlt(t,r,n),n},zlt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{jlt(e,r),n.call(t,...i)}},jlt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},qlt=(t,e,r,n)=>{if(!Blt(t,e,r,n))throw t},Blt=(t,e,r,n=!0)=>r.propagating?oTe(t)||KD(t):(r.propagating=!0,jY(r,e)===n?oTe(t):KD(t)),jY=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",KD=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oTe=t=>t?.code==="EPIPE";var aTe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,u)=>qY({stream:c,fdNumber:u,encoding:e,buffer:r[u],maxBuffer:n[u],lines:i[u],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),qY=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:u})=>{if(!t)return;let l=jT(t,e,u);if(jY(u,e)){await l;return}let[d]=await Promise.all([iTe({stream:t,onStreamEnd:l,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:u}),l]);return d};var cTe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?wp([t,e].filter(Boolean)):void 0,uTe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>qY({...Vlt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Glt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Vlt=({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}},Glt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Hlt}from"events";var lTe=t=>T_(t,"ipc"),dTe=(t,e)=>{let r=eD(t);Ga({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var fTe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=lTe(s),a=su(e,"ipc"),c=su(r,"ipc");for await(let u of AY({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(gbe(t,i,c),i.push(u)),o&&dTe(u,s);return i},pTe=async(t,e)=>(await Promise.allSettled([t]),e);var hTe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:u,ipc:l,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:y})=>{let w=vwe(t,f),x={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:w,propagating:!1},S=aTe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:x}),v=uTe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:x}),E=[],I=fTe({subprocess:t,buffer:r,maxBuffer:n,ipc:l,ipcOutput:E,verboseInfo:p}),C=Wlt(m,t,x),O=Klt(h,x);try{return await Promise.race([Promise.all([{},bwe(w),Promise.all(S),v,I,KEe(t,d),...C,...O]),_,Ylt(t,y),...BEe(t,s,f,y),...lEe({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...jEe({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},w,Promise.all(S.map(T=>zY(T))),zY(v),pTe(I,E),Promise.allSettled(C),Promise.allSettled(O)])}},Wlt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:jT(n,i,r)),Klt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>Qo(s,{checkOpen:!1})&&!Yo(s)).map(({type:i,value:s,stream:o=s})=>jT(o,n,e,{isSameDirection:Vs.has(i),stopOnExit:i==="native"}))),Ylt=async(t,{signal:e})=>{let[r]=await Hlt(t,"error",{signal:e});throw r};var mTe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),qT=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=Ha();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},L_=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 Zlt}from"stream";import{callbackify as Jlt}from"util";import{finished as gTe}from"stream/promises";var BY=async t=>{if(t!==void 0)try{await VY(t)}catch{}},_Te=async t=>{if(t!==void 0)try{await GY(t)}catch{}},VY=async t=>{await gTe(t,{cleanup:!0,readable:!1,writable:!0})},GY=async t=>{await gTe(t,{cleanup:!0,readable:!0,writable:!1})},YD=async(t,e)=>{if(await t,e)throw e},ZD=(t,e,r)=>{r&&!KD(r)?t.destroy(r):e&&t.destroy()};var yTe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||os.has(r),{subprocessStdout:a,waitReadableDestroy:c}=HY(t,n,e),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=WY(a,o),{read:f,onStdoutDataDone:p}=KY({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new Zlt({read:f,destroy:Jlt(ZY.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:u});return YY({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},HY=(t,e,r)=>{let n=I_(t,e),i=qT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},WY=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:FY},KY=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=Ha(),o=WD({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Qlt(this,o,s)},onStdoutDataDone:s}},Qlt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},YY=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await GY(t),await n,await BY(i),await e,r.readable&&r.push(null)}catch(s){await BY(i),STe(r,s)}},ZY=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await L_(r,e)&&(STe(t,n),await YD(e,n))},STe=(t,e)=>{ZD(t,t.readable,e)};import{Writable as Xlt}from"stream";import{callbackify as vTe}from"util";var ETe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=JY(t,r,e),o=new Xlt({...QY(n,t,i),destroy:vTe(e9.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return XY(n,o),o},JY=(t,e,r)=>{let n=dD(t,e),i=qT(r,n,"writableFinal"),s=qT(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},QY=(t,e,r)=>({write:edt.bind(void 0,t),final:vTe(tdt.bind(void 0,t,e,r))}),edt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},tdt=async(t,e,r)=>{await L_(r,e)&&(t.writable&&t.end(),await e)},XY=async(t,e,r)=>{try{await VY(t),e.writable&&e.end()}catch(n){await _Te(r),bTe(e,n)}},e9=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await L_(r,e),await L_(n,e)&&(bTe(t,i),await YD(e,i))},bTe=(t,e)=>{ZD(t,t.writable,e)};import{Duplex as rdt}from"stream";import{callbackify as ndt}from"util";var wTe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||os.has(r),{subprocessStdout:c,waitReadableDestroy:u}=HY(t,n,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=JY(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=WY(c,a),{read:_,onStdoutDataDone:y}=KY({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),w=new rdt({read:_,...QY(l,t,d),destroy:ndt(idt.bind(void 0,{subprocessStdout:c,subprocessStdin:l,subprocess:t,waitReadableDestroy:u,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:h,writableObjectMode:l.writableObjectMode,encoding:p});return YY({subprocessStdout:c,onStdoutDataDone:y,readable:w,subprocess:t,subprocessStdin:l}),XY(l,w,c),w},idt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([ZY({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),e9({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var t9=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||os.has(e),o=I_(t,r),a=WD({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return sdt(a,o,t)},sdt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var TTe=(t,{encoding:e})=>{let r=mTe();t.readable=yTe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=ETe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=wTe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=t9.bind(void 0,t,e),t[Symbol.asyncIterator]=t9.bind(void 0,t,e,{})};var ATe=(t,e)=>{for(let[r,n]of adt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},odt=(async()=>{})().constructor.prototype,adt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(odt,t)]);var RTe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=ldt(t,e,r),{subprocess:f,promise:p}=fdt({file:i,commandArguments:s,options:l,startTime:c,verboseInfo:u,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=HD.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),ATe(f,p),Wa.set(f,{options:l,fileDescriptors:d}),f},ldt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=rD(t,e,r),{file:a,commandArguments:c,options:u}=bD(t,e,r),l=ddt(u),d=Lwe(l,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},ddt=({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}},fdt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=udt(...wD(t,e,r))}catch(h){return Nwe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let u=new AbortController;cdt(Number.POSITIVE_INFINITY,u.signal);let l=[...c.stdio];Hwe(c,a,u),Kwe(c,r,u);let d={},f=Ha();c.kill=cEe.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:u}),c.all=cTe(c,r),TTe(c,r),Pwe(c,r);let p=pdt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:l,command:s,escapedCommand:o,context:d,onInternalError:f,controller:u});return{subprocess:c,promise:p}},pdt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:u,controller:l})=>{let[d,[f,p],h,m,_]=await hTe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:u,controller:l});l.abort(),u.resolve();let y=h.map((S,v)=>au(S,e,v)),w=au(m,e,"all"),x=hdt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:w,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return D_(x,n,e)},hdt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:u,startTime:l})=>"error"in t?$T({error:t.error,command:c,escapedCommand:u,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ka,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:l,isSync:!1}):CD({command:c,escapedCommand:u,stdio:n,all:i,ipcOutput:s,options:a,startTime:l});var JD=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,mdt(n,t[n],i)]));return{...t,...r}},mdt=(t,e,r)=>gdt.has(t)&&vr(e)&&vr(r)?{...e,...r}:r,gdt=new Set(["env",...CK]);var Vl=(t,e,r,n)=>{let i=(o,a,c)=>Vl(o,a,r,c),s=(...o)=>_dt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},_dt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(vr(s))return i(t,JD(r,s),n);let{file:a,commandArguments:c,options:u,isSync:l}=ydt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return l?Twe(a,c,u):RTe(a,c,u,i)},ydt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=LSe(e)?USe(e,r):[e,...r],[o,a,c]=GN(...s),u=JD(JD(n,i),c),{file:l=o,commandArguments:d=a,options:f=u,isSync:p=!1}=t({file:o,commandArguments:a,options:u});return{file:l,commandArguments:d,options:f,isSync:p}};var xTe=({file:t,commandArguments:e})=>ITe(t,e),OTe=({file:t,commandArguments:e})=>({...ITe(t,e),isSync:!0}),ITe=(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]=Sdt(t);return{file:r,commandArguments:n}},Sdt=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(vdt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},vdt=/ +/g;var PTe=(t,e,r)=>{t.sync=e(Edt,r),t.s=t.sync},CTe=({options:t})=>kTe(t),Edt=({options:t})=>({...kTe(t),isSync:!0}),kTe=t=>({options:{...bdt(t),...t}}),bdt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},NTe={preferLocal:!0};var DTe=Vl(()=>({})),ncr=Vl(()=>({isSync:!0})),MTe=Vl(xTe),icr=Vl(OTe),scr=Vl(GEe),ocr=Vl(CTe,{},NTe,PTe),{sendMessage:acr,getOneMessage:ccr,getEachMessage:ucr,getCancelSignal:lcr}=Cwe();var $Te=!1,LTe,wdt=t=>{LTe??=t},UTe=t=>{$Te=!0,wdt(t)},Nn=()=>$Te,cu=()=>LTe,FTe=t=>{switch(t){case"SIGTERM":case"SIGINT":return t;case void 0:return"interrupted";default:return}};var BT=null,zTe=t=>(BT&&BT.destroy(),BT=new Gs({totalAllowedTime:t}),BT),jTe=()=>BT;var Gs=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&&Nn())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((l,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),u="success";try{return await MC({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(l){throw u="failure",l}finally{Y.timing("stage.duration",Date.now()-c,{stage:e,outcome:u}),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 qTe={name:"@netlify/agent-runner-cli",type:"module",version:"2.6.2-PAW-837.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:{prebuild:"rm -rf dist",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" "!src/lib/__fixtures__/**"',"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" "!src/lib/__fixtures__/**"',"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:opencode":"vitest run test/integration/opencode.test.ts","test:integration:muse":"vitest run test/integration/muse.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},engines:{node:">=22"},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.21.0","@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.295","@anthropic-ai/sdk":"^0.134.0","@google/gemini-cli":"0.63.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.2.2","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.162.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.12.5",minimist:"^1.2.8",openai:"7.31.0",zod:"^4.4.3"}};var xdt=Adt(import.meta.url),Odt=uu.dirname(xdt),Idt=Rdt(import.meta.url),U_=re("shell"),r9=new Set,BTe={preferLocal:!0},_t=(t,e,r)=>{let[n,i]=Pdt(e,r),s={...BTe,...i},o=DTe(t,n,s);GTe(o,s),KTe(o);let a=r?.idleTimeout;return a&&a>0&&WTe(o,a),o},VTe=(t,e)=>{let r={...BTe,...e},n=MTe(t,r);return GTe(n,r),KTe(n),e?.idleTimeout&&e.idleTimeout>0&&WTe(n,e.idleTimeout),n},Pdt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},GTe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||Za.env.NETLIFY_LOCAL_QUIET==="true")return;if(Za.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new Cb).pipe(Za.stdout),t.stderr?.pipe(new Cb).pipe(Za.stderr);return}t.stdout?.pipe(Za.stdout),t.stderr?.pipe(Za.stderr)},n9=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Za.kill(-t.pid,e),U_.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return U_.error("Error killing process:",r),!1}},HTe=t=>n9(t,"SIGKILL"),WTe=(t,e)=>{let r=null,n=()=>{U_.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),n9(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(U_.log(`Force killing idle process ${t.pid}`),HTe(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)},KTe=t=>{r9.add(t);let e=jTe();if(e){let r=e.onTimesUp(()=>{U_.log(`Global timer expired, killing process ${t.pid}`),n9(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(U_.log(`Force killing process ${t.pid} after timeout`),HTe(t))},5e3)});t.on("exit",()=>{r9.delete(t),r()}),t.on("error",()=>{r9.delete(t),r()})}};function Hs(t,e){if(!Za.env.NETLIFY_LOCAL_MODE)try{let i=Idt.resolve(qTe.name),s=uu.dirname(i);for(;s!==uu.dirname(s);){let o=uu.dirname(s);if(uu.basename(o)==="node_modules"){let a=uu.join(o,".bin",e);if(QD.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Za.env.NODE_PATH){let i=uu.join(Za.env.NODE_PATH,".bin",e);if(QD.existsSync(i))return i}let r=uu.join(t,"node_modules",".bin",e);if(QD.existsSync(r))return r;let n=uu.join(Odt,"..","node_modules",".bin",e);if(QD.existsSync(n))return n}var F_=re("repo"),tAe="runner-diffs-",i9=t=>`${tAe}${t}-`,rAe=async t=>{let e=eM.tmpdir(),r;try{r=await ii.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(tAe)&&!n.startsWith(i9(t))).map(n=>ii.rm(Ws.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},YTe=async t=>{let e=Cdt("sha256");for await(let r of kdt(t))e.update(r);return e.digest("hex")},ZTe=async(t,e)=>t.size===e.size&&await YTe(t.path)===await YTe(e.path),nAe=/.. (.+)?\.log$/,Ndt=[nAe],Ddt=1,JTe=t=>{let e=t.split(`
387
+ if (condition) { yield value; }`)};import{Buffer as jct}from"buffer";import{StringDecoder as qct}from"string_decoder";var LD=(t,e,r)=>{if(r)return;if(t)return{transform:Bct.bind(void 0,new TextEncoder)};let n=new qct(e);return{transform:Vct.bind(void 0,n),final:Gct.bind(void 0,n)}},Bct=function*(t,e){jct.isBuffer(e)?yield iu(e):typeof e=="string"?yield t.encode(e):yield e},Vct=function*(t,e){yield Fr(e)?t.write(e):e},Gct=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as cwe}from"util";var SY=cwe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),UD=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Wct}=e[r];for await(let i of n(t))yield*UD(i,e,r+1)},uwe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Hct(r,Number(e),t)},Hct=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*UD(n,r,e+1)},lwe=cwe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Wct=function*(t){yield t};var vY=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dwe=(t,e)=>[...e.flatMap(r=>[...bp(r,t,0)]),...LT(t)],bp=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Yct}=e[r];for(let i of n(t))yield*bp(i,e,r+1)},LT=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Kct(r,Number(e),t)},Kct=function*(t,e,r){if(t!==void 0)for(let n of t())yield*bp(n,r,e+1)},Yct=function*(t){yield t};var EY=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=pwe(t,o,s),u=Ep(e),l=Ep(r),d=u?SY.bind(void 0,UD,a):vY.bind(void 0,bp),f=u||l?SY.bind(void 0,uwe,a):vY.bind(void 0,LT),p=u||l?lwe.bind(void 0,a):void 0;return{stream:new Zct({writableObjectMode:n,writableHighWaterMark:fwe(n),readableObjectMode:i,readableHighWaterMark:fwe(i),transform(m,_,y){d([m,c,0],this,y)},flush(m){f([c],this,m)},destroy:p})}},FD=(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=pwe(o,r,a);t=dwe(c,t)}return t},pwe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:swe(n,a)},LD(r,o,n),$D(r,s,n,c),{transform:t,final:e},{transform:owe(i,a)},iwe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var hwe=(t,e)=>{for(let r of Jct(t))Qct(t,r,e)},Jct=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Qct=(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 ${Bl[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>Xct(a,n));r.input=xT(o)},Xct=(t,e)=>{let r=FD(t,e,"utf8",!0);return eut(r),xT(r)},eut=t=>{let e=t.find(r=>typeof r!="string"&&!Fr(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 iut,appendFileSync as sut}from"fs";var zD=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&T_(r,n)&&!os.has(e)&&tut(n)&&(t.some(({type:i,value:s})=>i==="native"&&rut.has(s))||t.every(({type:i})=>Vs.has(i))),tut=t=>t===1||t===2,rut=new Set(["pipe","overlapped"]),mwe=async(t,e,r,n)=>{for await(let i of t)nut(e)||_we(i,r,n)},gwe=(t,e,r)=>{for(let n of t)_we(n,e,r)},nut=t=>t._readableState.pipes.length>0,_we=(t,e,r)=>{let n=eD(t);Ga({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var ywe=({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,u)=>out({result:c,fileDescriptors:t,fdNumber:u,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},out=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:u,stripFinalNewline:l,maxBuffer:d})=>{if(t===null)return;let f=Sbe(t,s,d),p=iu(f),{stdioItems:h,objectMode:m}=e[r],_=aut([p],h,c,n),{serializedResult:y,finalResult:w=y}=cut({chunks:_,objectMode:m,encoding:c,lines:u,stripFinalNewline:l,fdNumber:r});uut({serializedResult:y,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let x=a[r]?w:void 0;try{return n.error===void 0&&lut(y,h,i),x}catch(S){return n.error=S,x}},aut=(t,e,r,n)=>{try{return FD(t,e,r,!1)}catch(i){return n.error=i,t}},cut=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:xT(t)};let o=NSe(t,r);return n[s]?{serializedResult:o,finalResult:yY(o,!i[s],e)}:{serializedResult:o}},uut=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!zD({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=yY(t,!1,o);try{gwe(a,e,n)}catch(c){r.error??=c}},lut=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>DD.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?sut(n,t):(r.add(s),iut(n,t))}};var Swe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,au(e,r,"all")]:Array.isArray(e)?[au(t,r,"all"),...e]:Fr(t)&&Fr(e)?xK([t,e]):`${t}${e}`};import{once as bY}from"events";var vwe=async(t,e)=>{let[r,n]=await dut(t);return e.isForcefullyTerminated??=!1,[r,n]},dut=async t=>{let[e,r]=await Promise.allSettled([bY(t,"spawn"),bY(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Ewe(t):r.value},Ewe=async t=>{try{return await bY(t,"exit")}catch{return Ewe(t)}},bwe=async t=>{let[e,r]=await t;if(!fut(e,r)&&wY(e,r))throw new Zo;return[e,r]},fut=(t,e)=>t===void 0&&e===void 0,wY=(t,e)=>t!==0||e!==null;var wwe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=put(t,e,r),o=s?.code==="ETIMEDOUT",a=ybe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},put=(t,e,r)=>t!==void 0?t:wY(e,r)?new Zo:void 0;var Twe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=mut(t,e,r),d=yut({file:n,commandArguments:i,options:u,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:l,startTime:a});return D_(d,c,u)},mut=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=rD(t,e,r),a=gut(r),{file:c,commandArguments:u,options:l}=bD(t,e,a);_ut(l);let d=ewe(l,o);return{file:c,commandArguments:u,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},gut=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,_ut=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&jD("ipcInput"),t&&jD("ipc: true"),r&&jD("detached: true"),n&&jD("cancelSignal")},jD=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},yut=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=Sut({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:u,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p}=wwe(c,r),{output:h,error:m=u}=ywe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((w,x)=>au(w,r,x)),y=au(Swe(h,r),r,"all");return Eut({error:m,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},Sut=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{hwe(s,r);let a=vut(r);return hut(...wD(t,e,a))}catch(a){return N_({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},vut=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:PD(e)}),Eut=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:u,startTime:l})=>t===void 0?CD({command:c,escapedCommand:u,stdio:s,all:o,ipcOutput:[],options:a,startTime:l}):$T({error:t,command:c,escapedCommand:u,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as cdt}from"events";import{spawn as udt}from"child_process";import Iwe from"process";import{once as TY,on as but}from"events";var Awe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(x_({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:gD(t)}),wut({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),wut=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{fD(e,i);let s=ql(t,e,r),o=new AbortController;try{return await Promise.race([Tut(s,n,o),Aut(s,r,o),Rut(s,r,o)])}catch(a){throw O_(t),a}finally{o.abort(),pD(e,i)}},Tut=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await TY(t,"message",{signal:r});return n}for await(let[n]of but(t,"message",{signal:r}))if(e(n))return n},Aut=async(t,e,{signal:r})=>{await TY(t,"disconnect",{signal:r}),dEe(e)},Rut=async(t,e,{signal:r})=>{let[n]=await TY(t,"strict:error",{signal:r});throw uD(n,e)};import{once as xwe,on as xut}from"events";var Owe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>AY({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),AY=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{x_({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:gD(t)}),fD(e,s);let o=ql(t,e,r),a=new AbortController,c={};return Out(t,o,a),Iut({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),Put({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},Out=async(t,e,r)=>{try{await xwe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Iut=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await xwe(t,"strict:error",{signal:r.signal});n.error=uD(i,e),r.abort()}catch{}},Put=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of xut(r,"message",{signal:s.signal}))Rwe(o),yield c}catch{Rwe(o)}finally{s.abort(),pD(e,a),n||O_(t),i&&await t}},Rwe=({error:t})=>{if(t)throw t};var Pwe=(t,{ipc:e})=>{Object.assign(t,kwe(t,!1,e))},Cwe=()=>{let t=Iwe,e=!0,r=Iwe.channel!==void 0;return{...kwe(t,e,r),getCancelSignal:UEe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},kwe=(t,e,r)=>({sendMessage:vD.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Awe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Owe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Cut}from"child_process";import{PassThrough as kut,Readable as Nut,Writable as Dut,Duplex as Mut}from"stream";var Nwe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{mY(n);let a=new Cut;$ut(a,n),Object.assign(a,{readable:Lut,writable:Uut,duplex:Fut});let c=N_({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),u=zut(c,o,i);return{subprocess:a,promise:u}},$ut=(t,e)=>{let r=UT(),n=UT(),i=UT(),s=Array.from({length:e.length-3},UT),o=UT(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},UT=()=>{let t=new kut;return t.end(),t},Lut=()=>new Nut({read(){}}),Uut=()=>new Dut({write(){}}),Fut=()=>new Mut({read(){},write(){}}),zut=async(t,e,r)=>D_(t,e,r);import{createReadStream as Dwe,createWriteStream as Mwe}from"fs";import{Buffer as jut}from"buffer";import{Readable as FT,Writable as qut,Duplex as But}from"stream";var Lwe=(t,e)=>MD(Vut,t,e,!1),zT=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Bl[t]}.`)},$we={fileNumber:zT,generator:EY,asyncGenerator:EY,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:But.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Vut={input:{...$we,fileUrl:({value:t})=>({stream:Dwe(t)}),filePath:({value:{file:t}})=>({stream:Dwe(t)}),webStream:({value:t})=>({stream:FT.fromWeb(t)}),iterable:({value:t})=>({stream:FT.from(t)}),asyncIterable:({value:t})=>({stream:FT.from(t)}),string:({value:t})=>({stream:FT.from(t)}),uint8Array:({value:t})=>({stream:FT.from(jut.from(t))})},output:{...$we,fileUrl:({value:t})=>({stream:Mwe(t)}),filePath:({value:{file:t,append:e}})=>({stream:Mwe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:qut.fromWeb(t)}),iterable:zT,asyncIterable:zT,string:zT,uint8Array:zT}};import{on as Gut,once as Uwe}from"events";import{PassThrough as Hut,getDefaultHighWaterMark as Wut}from"stream";import{finished as jwe}from"stream/promises";function wp(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)xY(i);let e=t.some(({readableObjectMode:i})=>i),r=Kut(t,e),n=new RY({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Kut=(t,e)=>{if(t.length===0)return Wut(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},RY=class extends Hut{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(xY(e),this.#e.has(e))return;this.#e.add(e),this.#n??=Yut(this,this.#e,this.#s);let r=Qut({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(xY(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)}},Yut=async(t,e,r)=>{qD(t,Fwe);let n=new AbortController;try{await Promise.race([Zut(t,n),Jut(t,e,r,n)])}finally{n.abort(),qD(t,-Fwe)}},Zut=async(t,{signal:e})=>{try{await jwe(t,{signal:e,cleanup:!0})}catch(r){throw qwe(t,r),r}},Jut=async(t,e,r,{signal:n})=>{for await(let[i]of Gut(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},xY=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Qut=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{qD(t,zwe);let a=new AbortController;try{await Promise.race([Xut(s,e,a),elt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),tlt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),qD(t,-zwe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OY(t):rlt(t))},Xut=async(t,e,{signal:r})=>{try{await t,r.aborted||OY(e)}catch(n){r.aborted||qwe(e,n)}},elt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await jwe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;Bwe(o)?i.add(e):Vwe(t,o)}},tlt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await Uwe(t,i,{signal:s}),!t.readable)return Uwe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},rlt=t=>{t.writable&&t.end()},qwe=(t,e)=>{Bwe(e)?OY(t):Vwe(t,e)},Bwe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OY=t=>{(t.readable||t.writable)&&t.destroy()},Vwe=(t,e)=>{t.destroyed||(t.once("error",nlt),t.destroy(e))},nlt=()=>{},qD=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Fwe=2,zwe=1;import{finished as Gwe}from"stream/promises";var $_=(t,e)=>{t.pipe(e),ilt(t,e),slt(t,e)},ilt=async(t,e)=>{if(!(Yo(t)||Yo(e))){try{await Gwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}IY(e)}},IY=t=>{t.writable&&t.end()},slt=async(t,e)=>{if(!(Yo(t)||Yo(e))){try{await Gwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}PY(t)}},PY=t=>{t.readable&&t.destroy()};var Hwe=(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)))olt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!Vs.has(c)))clt({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]:wp(s);$_(o,i)}},olt=(t,e,r,n)=>{r==="output"?$_(t.stdio[n],e):$_(e,t.stdio[n]);let i=alt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},alt=["stdin","stdout","stderr"],clt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;ult(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},ult=(t,{signal:e})=>{Yo(t)&&Sp(t,llt,e)},llt=2;import{addAbortListener as plt}from"events";var Tp=[];Tp.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Tp.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Tp.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var BD=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",CY=Symbol.for("signal-exit emitter"),kY=globalThis,dlt=Object.defineProperty.bind(Object),NY=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(kY[CY])return kY[CY];dlt(kY,CY,{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}},VD=class{},flt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),DY=class extends VD{onExit(){return()=>{}}load(){}unload(){}},MY=class extends VD{#e=$Y.platform==="win32"?"SIGINT":"SIGHUP";#r=new NY;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Tp)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(!BD(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 Tp)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,Tp.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 BD(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"&&BD(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)}},$Y=globalThis.process,{onExit:Wwe,load:dsr,unload:fsr}=flt(BD($Y)?new MY($Y):new DY);var Kwe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Wwe(()=>{t.kill()});plt(n,()=>{i()})};var Zwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=tD(),{destination:o,destinationStream:a,destinationError:c,from:u,unpipeSignal:l}=hlt(r,n,i),{sourceStream:d,sourceError:f}=glt(t,u),{options:p,fileDescriptors:h}=Wa.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:h,startTime:s}},hlt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=mlt(t,e,...r),a=dD(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},mlt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ywe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||AK(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]=GN(r,...n);return{destination:e(Ywe)(i,s,o),pipeOptions:o}}if(Wa.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}`)},Ywe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),glt=(t,e)=>{try{return{sourceStream:I_(t,e)}}catch(r){return{sourceError:r}}};var Qwe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=_lt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw LY({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},_lt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return PY(t),n;if(e!==void 0)return IY(r),e},LY=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>N_({error:t,command:Jwe,escapedCommand:Jwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Jwe="source.pipe(destination)";var Xwe=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 ylt}from"stream/promises";var eTe=(t,e,r)=>{let n=GD.has(e)?vlt(t,e):Slt(t,e);return Sp(t,blt,r.signal),Sp(e,wlt,r.signal),Elt(e),n},Slt=(t,e)=>{let r=wp([t]);return $_(r,e),GD.set(e,r),r},vlt=(t,e)=>{let r=GD.get(e);return r.add(t),r},Elt=async t=>{try{await ylt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}GD.delete(t)},GD=new WeakMap,blt=2,wlt=1;import{aborted as Tlt}from"util";var tTe=(t,e)=>t===void 0?[]:[Alt(t,e)],Alt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await Tlt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw LY({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var HD=(t,...e)=>{if(vr(e[0]))return HD.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Zwe(t,...e),i=Rlt({...n,destination:r});return i.pipe=HD.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Rlt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:u})=>{let l=xlt(t,i);Qwe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let f=eTe(e,s,d);return await Promise.race([Xwe(l),...tTe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{d.abort()}},xlt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as Dlt}from"timers/promises";import{on as Olt}from"events";import{getDefaultHighWaterMark as Ilt}from"stream";var WD=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return Plt(e,o),nTe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},Plt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},UY=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;Clt(e,o,t);let a=t.readableObjectMode&&!s;return nTe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Clt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nTe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=Olt(t,"data",{signal:e.signal,highWaterMark:rTe,highWatermark:rTe});return klt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},FY=Ilt(!0),rTe=FY,klt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=Nlt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*bp(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*LT(a)}},Nlt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[LD(t,r,!e),$D(t,i,!n,{})].filter(Boolean);var iTe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:u,streamInfo:l})=>{let d=Mlt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:u,streamInfo:l});if(!i){await Promise.all([$lt(t),d]);return}let f=gY(c,r),p=UY({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([Llt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},Mlt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!zD({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=UY({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await mwe(a,t,r,s)},$lt=async t=>{await Dlt(),t.readableFlowing===null&&t.resume()},Llt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await xD(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await OD(r,{maxBuffer:s})):await k_(r,{maxBuffer:s})}catch(a){return sTe(mbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},zY=async t=>{try{return await t}catch(e){return sTe(e)}},sTe=({bufferedData:t})=>CSe(t)?new Uint8Array(t):t;import{finished as Ult}from"stream/promises";var jT=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=Flt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Ult(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||qlt(a,e,r,n)}finally{o.abort()}},Flt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&zlt(t,r,n),n},zlt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{jlt(e,r),n.call(t,...i)}},jlt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},qlt=(t,e,r,n)=>{if(!Blt(t,e,r,n))throw t},Blt=(t,e,r,n=!0)=>r.propagating?oTe(t)||KD(t):(r.propagating=!0,jY(r,e)===n?oTe(t):KD(t)),jY=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",KD=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oTe=t=>t?.code==="EPIPE";var aTe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,u)=>qY({stream:c,fdNumber:u,encoding:e,buffer:r[u],maxBuffer:n[u],lines:i[u],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),qY=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:u})=>{if(!t)return;let l=jT(t,e,u);if(jY(u,e)){await l;return}let[d]=await Promise.all([iTe({stream:t,onStreamEnd:l,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:u}),l]);return d};var cTe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?wp([t,e].filter(Boolean)):void 0,uTe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>qY({...Vlt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Glt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Vlt=({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}},Glt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Hlt}from"events";var lTe=t=>T_(t,"ipc"),dTe=(t,e)=>{let r=eD(t);Ga({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var fTe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=lTe(s),a=su(e,"ipc"),c=su(r,"ipc");for await(let u of AY({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(gbe(t,i,c),i.push(u)),o&&dTe(u,s);return i},pTe=async(t,e)=>(await Promise.allSettled([t]),e);var hTe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:u,ipc:l,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:y})=>{let w=vwe(t,f),x={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:w,propagating:!1},S=aTe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:x}),v=uTe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:x}),E=[],I=fTe({subprocess:t,buffer:r,maxBuffer:n,ipc:l,ipcOutput:E,verboseInfo:p}),C=Wlt(m,t,x),O=Klt(h,x);try{return await Promise.race([Promise.all([{},bwe(w),Promise.all(S),v,I,KEe(t,d),...C,...O]),_,Ylt(t,y),...BEe(t,s,f,y),...lEe({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...jEe({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},w,Promise.all(S.map(T=>zY(T))),zY(v),pTe(I,E),Promise.allSettled(C),Promise.allSettled(O)])}},Wlt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:jT(n,i,r)),Klt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>Qo(s,{checkOpen:!1})&&!Yo(s)).map(({type:i,value:s,stream:o=s})=>jT(o,n,e,{isSameDirection:Vs.has(i),stopOnExit:i==="native"}))),Ylt=async(t,{signal:e})=>{let[r]=await Hlt(t,"error",{signal:e});throw r};var mTe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),qT=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=Ha();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},L_=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 Zlt}from"stream";import{callbackify as Jlt}from"util";import{finished as gTe}from"stream/promises";var BY=async t=>{if(t!==void 0)try{await VY(t)}catch{}},_Te=async t=>{if(t!==void 0)try{await GY(t)}catch{}},VY=async t=>{await gTe(t,{cleanup:!0,readable:!1,writable:!0})},GY=async t=>{await gTe(t,{cleanup:!0,readable:!0,writable:!1})},YD=async(t,e)=>{if(await t,e)throw e},ZD=(t,e,r)=>{r&&!KD(r)?t.destroy(r):e&&t.destroy()};var yTe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||os.has(r),{subprocessStdout:a,waitReadableDestroy:c}=HY(t,n,e),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=WY(a,o),{read:f,onStdoutDataDone:p}=KY({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new Zlt({read:f,destroy:Jlt(ZY.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:u});return YY({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},HY=(t,e,r)=>{let n=I_(t,e),i=qT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},WY=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:FY},KY=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=Ha(),o=WD({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Qlt(this,o,s)},onStdoutDataDone:s}},Qlt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},YY=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await GY(t),await n,await BY(i),await e,r.readable&&r.push(null)}catch(s){await BY(i),STe(r,s)}},ZY=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await L_(r,e)&&(STe(t,n),await YD(e,n))},STe=(t,e)=>{ZD(t,t.readable,e)};import{Writable as Xlt}from"stream";import{callbackify as vTe}from"util";var ETe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=JY(t,r,e),o=new Xlt({...QY(n,t,i),destroy:vTe(e9.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return XY(n,o),o},JY=(t,e,r)=>{let n=dD(t,e),i=qT(r,n,"writableFinal"),s=qT(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},QY=(t,e,r)=>({write:edt.bind(void 0,t),final:vTe(tdt.bind(void 0,t,e,r))}),edt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},tdt=async(t,e,r)=>{await L_(r,e)&&(t.writable&&t.end(),await e)},XY=async(t,e,r)=>{try{await VY(t),e.writable&&e.end()}catch(n){await _Te(r),bTe(e,n)}},e9=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await L_(r,e),await L_(n,e)&&(bTe(t,i),await YD(e,i))},bTe=(t,e)=>{ZD(t,t.writable,e)};import{Duplex as rdt}from"stream";import{callbackify as ndt}from"util";var wTe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||os.has(r),{subprocessStdout:c,waitReadableDestroy:u}=HY(t,n,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=JY(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=WY(c,a),{read:_,onStdoutDataDone:y}=KY({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),w=new rdt({read:_,...QY(l,t,d),destroy:ndt(idt.bind(void 0,{subprocessStdout:c,subprocessStdin:l,subprocess:t,waitReadableDestroy:u,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:h,writableObjectMode:l.writableObjectMode,encoding:p});return YY({subprocessStdout:c,onStdoutDataDone:y,readable:w,subprocess:t,subprocessStdin:l}),XY(l,w,c),w},idt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([ZY({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),e9({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var t9=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||os.has(e),o=I_(t,r),a=WD({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return sdt(a,o,t)},sdt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var TTe=(t,{encoding:e})=>{let r=mTe();t.readable=yTe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=ETe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=wTe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=t9.bind(void 0,t,e),t[Symbol.asyncIterator]=t9.bind(void 0,t,e,{})};var ATe=(t,e)=>{for(let[r,n]of adt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},odt=(async()=>{})().constructor.prototype,adt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(odt,t)]);var RTe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=ldt(t,e,r),{subprocess:f,promise:p}=fdt({file:i,commandArguments:s,options:l,startTime:c,verboseInfo:u,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=HD.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),ATe(f,p),Wa.set(f,{options:l,fileDescriptors:d}),f},ldt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=rD(t,e,r),{file:a,commandArguments:c,options:u}=bD(t,e,r),l=ddt(u),d=Lwe(l,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},ddt=({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}},fdt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=udt(...wD(t,e,r))}catch(h){return Nwe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let u=new AbortController;cdt(Number.POSITIVE_INFINITY,u.signal);let l=[...c.stdio];Hwe(c,a,u),Kwe(c,r,u);let d={},f=Ha();c.kill=cEe.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:u}),c.all=cTe(c,r),TTe(c,r),Pwe(c,r);let p=pdt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:l,command:s,escapedCommand:o,context:d,onInternalError:f,controller:u});return{subprocess:c,promise:p}},pdt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:u,controller:l})=>{let[d,[f,p],h,m,_]=await hTe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:u,controller:l});l.abort(),u.resolve();let y=h.map((S,v)=>au(S,e,v)),w=au(m,e,"all"),x=hdt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:w,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return D_(x,n,e)},hdt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:u,startTime:l})=>"error"in t?$T({error:t.error,command:c,escapedCommand:u,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ka,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:l,isSync:!1}):CD({command:c,escapedCommand:u,stdio:n,all:i,ipcOutput:s,options:a,startTime:l});var JD=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,mdt(n,t[n],i)]));return{...t,...r}},mdt=(t,e,r)=>gdt.has(t)&&vr(e)&&vr(r)?{...e,...r}:r,gdt=new Set(["env",...CK]);var Vl=(t,e,r,n)=>{let i=(o,a,c)=>Vl(o,a,r,c),s=(...o)=>_dt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},_dt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(vr(s))return i(t,JD(r,s),n);let{file:a,commandArguments:c,options:u,isSync:l}=ydt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return l?Twe(a,c,u):RTe(a,c,u,i)},ydt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=LSe(e)?USe(e,r):[e,...r],[o,a,c]=GN(...s),u=JD(JD(n,i),c),{file:l=o,commandArguments:d=a,options:f=u,isSync:p=!1}=t({file:o,commandArguments:a,options:u});return{file:l,commandArguments:d,options:f,isSync:p}};var xTe=({file:t,commandArguments:e})=>ITe(t,e),OTe=({file:t,commandArguments:e})=>({...ITe(t,e),isSync:!0}),ITe=(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]=Sdt(t);return{file:r,commandArguments:n}},Sdt=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(vdt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},vdt=/ +/g;var PTe=(t,e,r)=>{t.sync=e(Edt,r),t.s=t.sync},CTe=({options:t})=>kTe(t),Edt=({options:t})=>({...kTe(t),isSync:!0}),kTe=t=>({options:{...bdt(t),...t}}),bdt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},NTe={preferLocal:!0};var DTe=Vl(()=>({})),ncr=Vl(()=>({isSync:!0})),MTe=Vl(xTe),icr=Vl(OTe),scr=Vl(GEe),ocr=Vl(CTe,{},NTe,PTe),{sendMessage:acr,getOneMessage:ccr,getEachMessage:ucr,getCancelSignal:lcr}=Cwe();var $Te=!1,LTe,wdt=t=>{LTe??=t},UTe=t=>{$Te=!0,wdt(t)},Nn=()=>$Te,cu=()=>LTe,FTe=t=>{switch(t){case"SIGTERM":case"SIGINT":return t;case void 0:return"interrupted";default:return}};var BT=null,zTe=t=>(BT&&BT.destroy(),BT=new Gs({totalAllowedTime:t}),BT),jTe=()=>BT;var Gs=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&&Nn())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((l,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),u="success";try{return await MC({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(l){throw u="failure",l}finally{Y.timing("stage.duration",Date.now()-c,{stage:e,outcome:u}),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 qTe={name:"@netlify/agent-runner-cli",type:"module",version:"2.7.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:{prebuild:"rm -rf dist",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" "!src/lib/__fixtures__/**"',"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" "!src/lib/__fixtures__/**"',"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:opencode":"vitest run test/integration/opencode.test.ts","test:integration:muse":"vitest run test/integration/muse.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},engines:{node:">=22"},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.21.0","@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.295","@anthropic-ai/sdk":"^0.134.0","@google/gemini-cli":"0.63.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.2.2","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.162.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.12.5",minimist:"^1.2.8",openai:"7.31.0",zod:"^4.4.3"}};var xdt=Adt(import.meta.url),Odt=uu.dirname(xdt),Idt=Rdt(import.meta.url),U_=re("shell"),r9=new Set,BTe={preferLocal:!0},_t=(t,e,r)=>{let[n,i]=Pdt(e,r),s={...BTe,...i},o=DTe(t,n,s);GTe(o,s),KTe(o);let a=r?.idleTimeout;return a&&a>0&&WTe(o,a),o},VTe=(t,e)=>{let r={...BTe,...e},n=MTe(t,r);return GTe(n,r),KTe(n),e?.idleTimeout&&e.idleTimeout>0&&WTe(n,e.idleTimeout),n},Pdt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},GTe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||Za.env.NETLIFY_LOCAL_QUIET==="true")return;if(Za.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new Cb).pipe(Za.stdout),t.stderr?.pipe(new Cb).pipe(Za.stderr);return}t.stdout?.pipe(Za.stdout),t.stderr?.pipe(Za.stderr)},n9=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Za.kill(-t.pid,e),U_.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return U_.error("Error killing process:",r),!1}},HTe=t=>n9(t,"SIGKILL"),WTe=(t,e)=>{let r=null,n=()=>{U_.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),n9(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(U_.log(`Force killing idle process ${t.pid}`),HTe(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)},KTe=t=>{r9.add(t);let e=jTe();if(e){let r=e.onTimesUp(()=>{U_.log(`Global timer expired, killing process ${t.pid}`),n9(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(U_.log(`Force killing process ${t.pid} after timeout`),HTe(t))},5e3)});t.on("exit",()=>{r9.delete(t),r()}),t.on("error",()=>{r9.delete(t),r()})}};function Hs(t,e){if(!Za.env.NETLIFY_LOCAL_MODE)try{let i=Idt.resolve(qTe.name),s=uu.dirname(i);for(;s!==uu.dirname(s);){let o=uu.dirname(s);if(uu.basename(o)==="node_modules"){let a=uu.join(o,".bin",e);if(QD.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Za.env.NODE_PATH){let i=uu.join(Za.env.NODE_PATH,".bin",e);if(QD.existsSync(i))return i}let r=uu.join(t,"node_modules",".bin",e);if(QD.existsSync(r))return r;let n=uu.join(Odt,"..","node_modules",".bin",e);if(QD.existsSync(n))return n}var F_=re("repo"),tAe="runner-diffs-",i9=t=>`${tAe}${t}-`,rAe=async t=>{let e=eM.tmpdir(),r;try{r=await ii.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(tAe)&&!n.startsWith(i9(t))).map(n=>ii.rm(Ws.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},YTe=async t=>{let e=Cdt("sha256");for await(let r of kdt(t))e.update(r);return e.digest("hex")},ZTe=async(t,e)=>t.size===e.size&&await YTe(t.path)===await YTe(e.path),nAe=/.. (.+)?\.log$/,Ndt=[nAe],Ddt=1,JTe=t=>{let e=t.split(`
388
388
  `).reduce((r,n)=>{if(!n)return r;let[i,s,,...o]=n,a=o.join(""),c=i.trim(),u=s.trim();return r[a]?r[a].change=u:r[a]={filePath:a,stage:c,change:u},r},{});return Object.values(e)},Mdt=t=>t instanceof Error&&String(t.stderr??"").includes("No such remote"),QTe=t=>{let e=t instanceof Error?t.message:String(t),r=String(t?.stderr??"").trim();return _n(r?`${e}: ${r}`:e)},$dt=t=>/Authentication failed|returned error: 401/.test(String(t?.stderr??"")),XTe=t=>t.pathname.replace(/\/+$/,"").replace(/\.git$/,""),Ldt=(t,e)=>{try{let r=new URL(t),n=new URL(e);return["https:","http:"].includes(n.protocol)&&n.protocol===r.protocol&&n.host===r.host&&XTe(n)===XTe(r)&&n.password!==""}catch{return!1}},eAe={stdin:"pipe",stdout:"pipe",stderr:"pipe",stripFinalNewline:!1},XD=500,VT=class extends Error{constructor(r,n){super(n instanceof Error?n.message:String(n));this.step=r;this.cause=n}},Pi=class{constructor(e=process.cwd()){this.cwd=e}getRoot(){return this.root??=this.run(["rev-parse","--show-toplevel"],{stdout:"pipe"}).then(({stdout:e})=>String(e).trim()),this.root}async restorePausedWork(e){let r="restore";try{let n=await this.restorePausedFiles(e);r="stage",await this.stageBuildSetup();let i=await this.getRoot(),s=new Set(n.changedFiles),o=(await this.listIndexEntries(n.deletedFiles,{cwd:i})).filter(({filePath:a})=>!s.has(a));return await this.unstageFiles(n.changedFiles,{cwd:i}),o.length>0&&await ii.writeFile(await this.getSetupMetadataPath(),JSON.stringify(o)),{rewrittenFileCount:n.rewrittenFileCount}}catch(n){throw new VT(r,n)}}run(e,r={}){return _t("git",e,{cwd:this.cwd,...r,env:{...r.env,NETLIFY_INTERNAL_GIT:"1"}})}async commitAndCreateDiffs({config:e,isRetry:r}){F_.info("Getting runner diffs");let n=await this.hasAgentChanges(),{hasChanges:i}=n,{status:s}=n;if(!i)return{hasChanges:!1};if(!r){let u=JTe(s);await this.discardSetupOnlyChanges(u)}F_.info("Changes after processing"),await this.getStatus();let o=await this.getIgnoredPathspecs(s);if(await this.stageFiles(o),await this.excludeUnchangedSetupDescendants(),i=await this.hasStagedChanges(),!i)return{hasChanges:!1,ignored:o};await this.run(["commit","-m","Agent runner [skip ci]"]);let a=await ii.mkdtemp(Ws.join(eM.tmpdir(),i9(e.sessionId))),c=await this.writeDiffFiles({config:e,diffDir:a,target:{commit:"HEAD"},ignored:o});return await this.rollbackIfLocal(),c.hasChanges&&Y.distribution("diff.size",(c.diffBinary??c.diff).size,{phase:"final"}),c}async getStatus(){let e=await this.run(["-c","status.relativePaths=true","status","-s"]);return String(e.stdout??"")}async hasAgentChanges(){let e=await this.getStatus();return{hasChanges:(e.trim().length===0?[]:e.split(`
389
389
  `).filter(i=>Ndt.some(o=>o instanceof RegExp?o.test(i):i===o)?!1:i[1]?.trim()!=="")).length!==0,status:e}}async getCurrentCommitSha(){let{stdout:e}=await this.run(["rev-parse","HEAD"]);return String(e??"").trim()}async reset(){await this.run(["reset","--hard","HEAD"]),await ii.rm(await this.getSetupMetadataPath(),{force:!0})}async discardSetupOnlyChanges(e){let r=e.filter(n=>n.stage&&!n.change).map(n=>n.filePath);r.length!==0&&await this.run(["restore","--staged","--worktree","--pathspec-from-file=-"],{input:r.join(`
390
390
  `)})}async stageBuildSetup(){await ii.rm(await this.getSetupMetadataPath(),{force:!0});let e=await this.getIgnoredPathspecs();await this.stageFiles(e)}getSetupMetadataPath(){return this.setupMetadataPath??=this.getRoot().then(async e=>{let{stdout:r}=await this.run(["rev-parse","--git-path","netlify-agent-runner-setup.json"],{cwd:e,stdout:"pipe"});return Ws.resolve(e,String(r).trim())}),this.setupMetadataPath}async listIndexEntries(e,r){let n=[];for(let i=0;i<e.length;i+=XD){let s=e.slice(i,i+XD).map(a=>`:(literal)${a}`),{stdout:o}=await this.run(["ls-files","--stage","-z","--",...s],{...eAe,...r});for(let a of String(o??"").split("\0").filter(Boolean))n.push({filePath:a.slice(a.indexOf(" ")+1),entry:a})}return n}async excludeUnchangedSetupDescendants(e){let r;try{r=JSON.parse(await ii.readFile(await this.getSetupMetadataPath(),"utf8"))}catch(a){if(a.code==="ENOENT")return;throw a}let i={cwd:await this.getRoot(),env:e},s=new Map((await this.listIndexEntries(r.map(({filePath:a})=>a),i)).map(({filePath:a,entry:c})=>[a,c])),o=r.filter(({filePath:a,entry:c})=>s.get(a)===c);o.length!==0&&await this.run(["update-index","--force-remove","-z","--stdin"],{...i,input:o.map(({filePath:a})=>a).join("\0")})}async getIgnoredPathspecs(e){e||=await this.getStatus();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 e.split(`
@@ -601,7 +601,7 @@ ${Oe.trim()}
601
601
  \`\`\``:Oe.trim()),Ke==="error"&&Le&&(dn=dn?`${dn}
602
602
 
603
603
  *Command failed*`:`*Command failed: ${Le.trim()}*`),ge({title:vt,message:dn,category:Wi,...Ye},!0);break}case"step_finish":{Ee();let ne=X.part?.tokens;ne&&(_={input_tokens:(_?.input_tokens??0)+(ne.input??0),output_tokens:(_?.output_tokens??0)+(ne.output??0),reasoning_output_tokens:(_?.reasoning_output_tokens??0)+(ne.reasoning??0),cache_creation_input_tokens:(_?.cache_creation_input_tokens??0)+(ne.cache?.write??0),cache_read_input_tokens:(_?.cache_read_input_tokens??0)+(ne.cache?.read??0)}),X.part?.cost!=null&&(y=(y??0)+X.part.cost);break}case"error":{Ee();let xe=X.error?.data?.message??X.error?.message??X.part?.state?.error??(X.error?JSON.stringify(X.error).slice(0,500):"unknown error");m=m?`${m}
604
- ${xe}`:xe;break}default:X.type&&!te.has(X.type)&&(te.add(X.type),kd.log(`Unhandled opencode event type: ${X.type}`))}});let j=!1;await se.catch(ee=>{j=Ks(ee,o),Ee();let X=Qa({catchError:ee,runCmd:se,error:m,result:h??We,runnerName:fL});m=X.error,h=X.result}),me?.stop(),de?.stop(),he?.stop(),await I?.remove(),await C?.remove(),await O?.remove(),await k.close();let F=Date.now()-M;Ee(),fe.close(),le.flush();let q=j;if(q&&(m=void 0),!m&&!h&&We&&(h=We),_&&ks(_,v?{model:v}:{}),S)return{steps:N,duration:F,agentSessionId:p,resolvedModel:v,effort:f,resolvedProviderEffort:E,usage:_,costUsd:y,toolErrorCount:w,toolCallCount:x,pendingInteraction:S};let{providerFailure:W,classification:V}=Ni({error:m});return{steps:N,duration:F,result:await Di({initialResult:h,agentName:fL,hasError:!!m}),error:Mi({error:m,agentName:fL}),isRetryableError:V?.retryable??$i(m),isProviderUnavailableError:V?.providerFault??Li(m),...W?{providerFailure:W}:{},agentSessionId:p,resolvedModel:v,effort:f,resolvedProviderEffort:E,usage:_,costUsd:y,toolErrorCount:w,toolCallCount:x,...q?{aborted:!0}:{}}}var bvt=()=>Nd.join(UPe.homedir(),".config","opencode"),jPe=()=>{let t=pL.env.XDG_DATA_HOME,e=t&&Nd.isAbsolute(t)?t:Nd.join(UPe.homedir(),".local","share");return Nd.join(e,"opencode")},qPe=async()=>{let t=[bvt(),jPe()];await Promise.all(t.map(e=>RR.rm(e,{recursive:!0,force:!0})))},BPe={baseDir:jPe(),include:["opencode.db","opencode.db-shm","opencode.db-wal"]};import qr from"fs/promises";import OR from"os";import ls from"path";import YPe from"process";import Nvt from"readline";import wvt from"crypto";import Tvt from"os";import xR from"path";import Dd from"fs";var VPe=re("antigravity_install"),v8="1.3.3";var Avt={"agy_cli_linux_x64.tar.gz":"8ee3ca32574c431285efbf4d4732f7f8d53e959370bc4a61646e4fa496f7f2b6","agy_cli_linux_x64_musl.tar.gz":"db8d000171e52d125a7bf2f4dbdbb60dd5ed095ab6edaab12cddf4e168e03dda","agy_cli_linux_arm64.tar.gz":"a9d23fe1d7e5c8471881ab37723571a8d3f24e6ecace8fe082f8c0c8d90f41ca","agy_cli_linux_arm64_musl.tar.gz":"36e59c992adfca49f834b993896338636e41e14b50202bb99c732a1e8594e956","agy_cli_mac_x64.tar.gz":"78547d90bfd1559a87ba63e941f9332a0d1889d2de415da337dedec8dc9aa239","agy_cli_mac_arm64.tar.gz":"c39926f3312e87eaa56d750658cf442669d0a716f49319d06369be7fa80520eb"},hL={"gemini-3.8-flash":["low","medium","high"],"gemini-3.7-flash":["low","medium","high"],"gemini-3.6-flash":["low","medium","high"],"gemini-3.1-pro":["low","high"]},E8={"gemini-3.1-pro":"gemini-3.1-pro-preview"},Rvt="https://github.com/google-antigravity/antigravity-cli/releases/download",xvt=6e4,Ovt=async(t,e=xvt)=>{let r=new AbortController,n,i,s=()=>{clearTimeout(i),i=setTimeout(()=>{r.abort(),n?.cancel().catch(()=>{})},e)};s();try{let o=await fetch(t,{signal:r.signal});if(!o.ok||!o.body)throw new Error(`Failed to download Antigravity CLI from ${t}: ${o.status} ${o.statusText}`);n=o.body.getReader();let a=[];for(let c=await n.read();!c.done;c=await n.read())a.push(c.value),s();if(r.signal.aborted)throw r.signal.reason;return Buffer.concat(a)}catch(o){throw r.signal.aborted?new Error(`Antigravity CLI download stalled: no data for ${e/1e3}s from ${t}`):o}finally{clearTimeout(i)}},Ivt=()=>xR.join(Tvt.homedir(),".netlify-agent-runner","antigravity",v8),Pvt=()=>!process.report?.getReport()?.header?.glibcVersionRuntime,Cvt=(t=process.platform,e=process.arch,r=t==="linux"&&Pvt())=>{let n={x64:"x64",arm64:"arm64"}[e];if(!n)throw new Error(`Antigravity CLI has no build for CPU architecture ${e}`);if(t==="darwin")return`agy_cli_mac_${n}.tar.gz`;if(t==="linux")return`agy_cli_linux_${n}${r?"_musl":""}.tar.gz`;throw new Error(`Antigravity CLI has no build for platform ${t}`)},GPe=async()=>{let t=Ivt(),e=xR.join(t,"agy");if(Dd.existsSync(e))return e;let r=Cvt(),n=`${Rvt}/${v8}/${r}`;Dd.mkdirSync(t,{recursive:!0});let i=Dd.mkdtempSync(xR.join(t,"staging-"));VPe.log(`Installing Antigravity CLI ${v8} (${r}) on demand`);let s=Date.now();try{let a=await Ovt(n),c=wvt.createHash("sha256").update(a).digest("hex");if(c!==Avt[r])throw new Error(`Antigravity CLI ${r} failed its checksum check (got sha256 ${c})`);let u=xR.join(i,r);Dd.writeFileSync(u,a),await _t("tar",["-xzf",u,"-C",i,"antigravity"]);let l=xR.join(i,"antigravity");if(!Dd.existsSync(l))throw new Error(`Antigravity CLI binary not found after extracting ${r}`);Dd.chmodSync(l,493),Dd.renameSync(l,e)}finally{Dd.rmSync(i,{recursive:!0,force:!0})}let o=Date.now()-s;return Y.timing("antigravity.install_duration",o),VPe.log(`Installed Antigravity CLI in ${o}ms`),e};var HPe={view_file:{name:"Read file",category:K.FileRead},write_to_file:{name:"Edit file",category:K.FileWrite},replace_file_content:{name:"Edit file",category:K.FileWrite},run_command:{name:"Run command",category:K.RunCommand},read_url_content:{name:"Fetch web",category:K.Web},search_web:{name:"Search web",category:K.Web},manage_task:{name:"Manage command",category:K.RunCommand},invoke_subagent:{name:"Run subagent",category:K.Task},define_subagent:{name:"Define subagent",category:K.Task},manage_subagents:{name:"Manage subagents",category:K.Task},send_message:{name:"Message agent",category:K.Task},schedule:{name:"Schedule",category:K.Task},list_resources:{name:"List resources",category:K.Explore},read_resource:{name:"Read resource",category:K.Explore}};var Cu=re("runner_antigravity"),mc="Antigravity CLI",WPe="gemini",Dvt="gemini-3.8-flash",Mvt="medium",$vt="24h",Lvt=(t,e)=>hL[t]?.includes(e)?e:(Cu.log(`${t} has no '${e}' effort; using low`),"low"),yL=()=>ls.join(OR.homedir(),".gemini","antigravity-cli"),_L=()=>ls.join(OR.homedir(),".gemini","config","rules","netlify-agent-runner.md"),Uvt=async t=>{let e=_L();await qr.mkdir(ls.dirname(e),{recursive:!0});let r=`---
604
+ ${xe}`:xe;break}default:X.type&&!te.has(X.type)&&(te.add(X.type),kd.log(`Unhandled opencode event type: ${X.type}`))}});let j=!1;await se.catch(ee=>{j=Ks(ee,o),Ee();let X=Qa({catchError:ee,runCmd:se,error:m,result:h??We,runnerName:fL});m=X.error,h=X.result}),me?.stop(),de?.stop(),he?.stop(),await I?.remove(),await C?.remove(),await O?.remove(),await k.close();let F=Date.now()-M;Ee(),fe.close(),le.flush();let q=j;if(q&&(m=void 0),!m&&!h&&We&&(h=We),_&&ks(_,v?{model:v}:{}),S)return{steps:N,duration:F,agentSessionId:p,resolvedModel:v,effort:f,resolvedProviderEffort:E,usage:_,costUsd:y,toolErrorCount:w,toolCallCount:x,pendingInteraction:S};let{providerFailure:W,classification:V}=Ni({error:m});return{steps:N,duration:F,result:await Di({initialResult:h,agentName:fL,hasError:!!m}),error:Mi({error:m,agentName:fL}),isRetryableError:V?.retryable??$i(m),isProviderUnavailableError:V?.providerFault??Li(m),...W?{providerFailure:W}:{},agentSessionId:p,resolvedModel:v,effort:f,resolvedProviderEffort:E,usage:_,costUsd:y,toolErrorCount:w,toolCallCount:x,...q?{aborted:!0}:{}}}var bvt=()=>Nd.join(UPe.homedir(),".config","opencode"),jPe=()=>{let t=pL.env.XDG_DATA_HOME,e=t&&Nd.isAbsolute(t)?t:Nd.join(UPe.homedir(),".local","share");return Nd.join(e,"opencode")},qPe=async()=>{let t=[bvt(),jPe()];await Promise.all(t.map(e=>RR.rm(e,{recursive:!0,force:!0})))},BPe={baseDir:jPe(),include:["opencode.db","opencode.db-shm","opencode.db-wal"]};import qr from"fs/promises";import OR from"os";import ls from"path";import YPe from"process";import Nvt from"readline";import wvt from"crypto";import Tvt from"os";import xR from"path";import Dd from"fs";var VPe=re("antigravity_install"),v8="1.4.4";var Avt={"agy_cli_linux_x64.tar.gz":"9ae4f7f0667a2868e15bb9ad93819ff7527c7187f12d12e3b5191137c726287b","agy_cli_linux_x64_musl.tar.gz":"f85f39bf74b6ff5f7f45da768ba52b39318a7e528811df65f394995959cbcc2c","agy_cli_linux_arm64.tar.gz":"57a96abbc94745a5faf4f24e878766a1882b9aa4c4b83ba567717d8206745f5a","agy_cli_linux_arm64_musl.tar.gz":"4900f50954ad6fb3747c2d80fe29b5986ae861d0f8ea04c2a5bd9cb1781507dc","agy_cli_mac_x64.tar.gz":"12c96c065ac50d36e087c1fda1bba8d6fb4fa7af232d1ef2a44499c2481a52bf","agy_cli_mac_arm64.tar.gz":"85482aa8969300183f71c9653d9f581248fba7f506342a8eb087f3d2503203bd"},hL={"gemini-4-argon":["low","medium","high"],"gemini-3.8-flash":["low","medium","high"],"gemini-3.7-flash":["low","medium","high"],"gemini-3.6-flash":["low","medium","high"],"gemini-3.1-pro":["low","high"]},E8={"gemini-3.1-pro":"gemini-3.1-pro-preview"},Rvt="https://github.com/google-antigravity/antigravity-cli/releases/download",xvt=6e4,Ovt=async(t,e=xvt)=>{let r=new AbortController,n,i,s=()=>{clearTimeout(i),i=setTimeout(()=>{r.abort(),n?.cancel().catch(()=>{})},e)};s();try{let o=await fetch(t,{signal:r.signal});if(!o.ok||!o.body)throw new Error(`Failed to download Antigravity CLI from ${t}: ${o.status} ${o.statusText}`);n=o.body.getReader();let a=[];for(let c=await n.read();!c.done;c=await n.read())a.push(c.value),s();if(r.signal.aborted)throw r.signal.reason;return Buffer.concat(a)}catch(o){throw r.signal.aborted?new Error(`Antigravity CLI download stalled: no data for ${e/1e3}s from ${t}`):o}finally{clearTimeout(i)}},Ivt=()=>xR.join(Tvt.homedir(),".netlify-agent-runner","antigravity",v8),Pvt=()=>!process.report?.getReport()?.header?.glibcVersionRuntime,Cvt=(t=process.platform,e=process.arch,r=t==="linux"&&Pvt())=>{let n={x64:"x64",arm64:"arm64"}[e];if(!n)throw new Error(`Antigravity CLI has no build for CPU architecture ${e}`);if(t==="darwin")return`agy_cli_mac_${n}.tar.gz`;if(t==="linux")return`agy_cli_linux_${n}${r?"_musl":""}.tar.gz`;throw new Error(`Antigravity CLI has no build for platform ${t}`)},GPe=async()=>{let t=Ivt(),e=xR.join(t,"agy");if(Dd.existsSync(e))return e;let r=Cvt(),n=`${Rvt}/${v8}/${r}`;Dd.mkdirSync(t,{recursive:!0});let i=Dd.mkdtempSync(xR.join(t,"staging-"));VPe.log(`Installing Antigravity CLI ${v8} (${r}) on demand`);let s=Date.now();try{let a=await Ovt(n),c=wvt.createHash("sha256").update(a).digest("hex");if(c!==Avt[r])throw new Error(`Antigravity CLI ${r} failed its checksum check (got sha256 ${c})`);let u=xR.join(i,r);Dd.writeFileSync(u,a),await _t("tar",["-xzf",u,"-C",i,"antigravity"]);let l=xR.join(i,"antigravity");if(!Dd.existsSync(l))throw new Error(`Antigravity CLI binary not found after extracting ${r}`);Dd.chmodSync(l,493),Dd.renameSync(l,e)}finally{Dd.rmSync(i,{recursive:!0,force:!0})}let o=Date.now()-s;return Y.timing("antigravity.install_duration",o),VPe.log(`Installed Antigravity CLI in ${o}ms`),e};var HPe={view_file:{name:"Read file",category:K.FileRead},write_to_file:{name:"Edit file",category:K.FileWrite},replace_file_content:{name:"Edit file",category:K.FileWrite},run_command:{name:"Run command",category:K.RunCommand},read_url_content:{name:"Fetch web",category:K.Web},search_web:{name:"Search web",category:K.Web},manage_task:{name:"Manage command",category:K.RunCommand},invoke_subagent:{name:"Run subagent",category:K.Task},define_subagent:{name:"Define subagent",category:K.Task},manage_subagents:{name:"Manage subagents",category:K.Task},send_message:{name:"Message agent",category:K.Task},schedule:{name:"Schedule",category:K.Task},list_resources:{name:"List resources",category:K.Explore},read_resource:{name:"Read resource",category:K.Explore}};var Cu=re("runner_antigravity"),mc="Antigravity CLI",WPe="gemini",Dvt="gemini-3.8-flash",Mvt="medium",$vt="24h",Lvt=(t,e)=>hL[t]?.includes(e)?e:(Cu.log(`${t} has no '${e}' effort; using low`),"low"),yL=()=>ls.join(OR.homedir(),".gemini","antigravity-cli"),_L=()=>ls.join(OR.homedir(),".gemini","config","rules","netlify-agent-runner.md"),Uvt=async t=>{let e=_L();await qr.mkdir(ls.dirname(e),{recursive:!0});let r=`---
605
605
  trigger: always_on
606
606
  description: Netlify agent runner platform instructions
607
607
  ---
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/agent-runner-cli",
3
3
  "type": "module",
4
- "version": "2.6.2-PAW-837.0",
4
+ "version": "2.7.0",
5
5
  "description": "CLI tool for running Netlify agents",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -47,7 +47,6 @@ const baseEnv = {
47
47
  NETLIFY_AGENT_RUNNER_SESSION_ID: 'smoke',
48
48
  NETLIFY_AGENT_RUNNER_ID: 'smoke',
49
49
  NETLIFY_TEAM_ID: 'smoke',
50
- NETLIFY_AGENT_RUNNER_PROMPT: 'smoke test — no real work',
51
50
  NETLIFY_AGENT_RUNNER_MODE: 'normal',
52
51
  NETLIFY_AGENT_RUNNER_HAS_REPO: '0',
53
52
  }
@@ -63,8 +62,9 @@ const runBundle = (label, extraEnv, { readyRe, timeoutMs }) =>
63
62
  const child = spawn(process.execPath, [binPath], {
64
63
  cwd: root,
65
64
  env: { ...baseEnv, ...extraEnv },
66
- stdio: ['ignore', 'pipe', 'pipe'],
65
+ stdio: ['pipe', 'pipe', 'pipe'],
67
66
  })
67
+ child.stdin.end(JSON.stringify({ prompt: 'smoke test', context: [] }))
68
68
  let out = ''
69
69
  let reason = 'exit'
70
70
  let hardKill