@netlify/agent-runner-cli 2.18.0-smtp.0 → 2.18.0-smtp.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin-local.js CHANGED
@@ -396,7 +396,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
396
396
  `,LF:`
397
397
  `,concatBytes:y8},Pgt=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Cgt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Pgt};import{Buffer as kgt}from"buffer";var iIe=(t,e)=>t?void 0:Ngt.bind(void 0,e),Ngt=function*(t,e){if(typeof e!="string"&&!Wr(e)&&!kgt.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},oIe=(t,e)=>t?$gt.bind(void 0,e):Dgt.bind(void 0,e),$gt=function*(t,e){sIe(t,e),yield e},Dgt=function*(t,e){if(sIe(t,e),typeof e!="string"&&!Wr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},sIe=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
398
398
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
399
- if (condition) { yield value; }`)};import{Buffer as Mgt}from"buffer";import{StringDecoder as Lgt}from"string_decoder";var rL=(t,e,r)=>{if(r)return;if(t)return{transform:Ugt.bind(void 0,new TextEncoder)};let n=new Lgt(e);return{transform:Fgt.bind(void 0,n),final:zgt.bind(void 0,n)}},Ugt=function*(t,e){Mgt.isBuffer(e)?yield Iu(e):typeof e=="string"?yield t.encode(e):yield e},Fgt=function*(t,e){yield Wr(e)?t.write(e):e},zgt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as aIe}from"util";var v8=aIe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),nL=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=qgt}=e[r];for await(let i of n(t))yield*nL(i,e,r+1)},cIe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*jgt(r,Number(e),t)},jgt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*nL(n,r,e+1)},uIe=aIe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),qgt=function*(t){yield t};var E8=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},lIe=(t,e)=>[...e.flatMap(r=>[...am(r,t,0)]),...xR(t)],am=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Vgt}=e[r];for(let i of n(t))yield*am(i,e,r+1)},xR=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Bgt(r,Number(e),t)},Bgt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*am(n,r,e+1)},Vgt=function*(t){yield t};var b8=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=fIe(t,s,o),u=sm(e),l=sm(r),d=u?v8.bind(void 0,nL,a):E8.bind(void 0,am),f=u||l?v8.bind(void 0,cIe,a):E8.bind(void 0,xR),p=u||l?uIe.bind(void 0,a):void 0;return{stream:new Ggt({writableObjectMode:n,writableHighWaterMark:dIe(n),readableObjectMode:i,readableHighWaterMark:dIe(i),transform(h,_,y){d([h,c,0],this,y)},flush(h){f([c],this,h)},destroy:p})}},iL=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=fIe(s,r,a);t=lIe(c,t)}return t},fIe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:iIe(n,a)},rL(r,s,n),tL(r,o,n,c),{transform:t,final:e},{transform:oIe(i,a)},nIe({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var pIe=(t,e)=>{for(let r of Hgt(t))Wgt(t,r,e)},Hgt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Wgt=(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 ${Sd[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Kgt(a,n));r.input=_R(s)},Kgt=(t,e)=>{let r=iL(t,e,"utf8",!0);return Ygt(r),_R(r)},Ygt=t=>{let e=t.find(r=>typeof r!="string"&&!Wr(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 Qgt,appendFileSync as e_t}from"fs";var oL=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ny(r,n)&&!vo.has(e)&&Zgt(n)&&(t.some(({type:i,value:o})=>i==="native"&&Jgt.has(o))||t.every(({type:i})=>is.has(i))),Zgt=t=>t===1||t===2,Jgt=new Set(["pipe","overlapped"]),mIe=async(t,e,r,n)=>{for await(let i of t)Xgt(e)||gIe(i,r,n)},hIe=(t,e,r)=>{for(let n of t)gIe(n,e,r)},Xgt=t=>t._readableState.pipes.length>0,gIe=(t,e,r)=>{let n=SM(t);gc({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var _Ie=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,u)=>t_t({result:c,fileDescriptors:t,fdNumber:u,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},t_t=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:u,stripFinalNewline:l,maxBuffer:d})=>{if(t===null)return;let f=yxe(t,o,d),p=Iu(f),{stdioItems:m,objectMode:h}=e[r],_=r_t([p],m,c,n),{serializedResult:y,finalResult:b=y}=n_t({chunks:_,objectMode:h,encoding:c,lines:u,stripFinalNewline:l,fdNumber:r});i_t({serializedResult:y,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let T=a[r]?b:void 0;try{return n.error===void 0&&o_t(y,m,i),T}catch(S){return n.error=S,T}},r_t=(t,e,r,n)=>{try{return iL(t,e,r,!1)}catch(i){return n.error=i,t}},n_t=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:_R(t)};let s=kTe(t,r);return n[o]?{serializedResult:s,finalResult:S8(s,!i[o],e)}:{serializedResult:s}},i_t=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!oL({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=S8(t,!1,s);try{hIe(a,e,n)}catch(c){r.error??=c}},o_t=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>QM.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?e_t(n,t):(r.add(o),Qgt(n,t))}};var yIe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Cu(e,r,"all")]:Array.isArray(e)?[Cu(t,r,"all"),...e]:Wr(t)&&Wr(e)?I5([t,e]):`${t}${e}`};import{once as w8}from"events";var SIe=async(t,e)=>{let[r,n]=await s_t(t);return e.isForcefullyTerminated??=!1,[r,n]},s_t=async t=>{let[e,r]=await Promise.allSettled([w8(t,"spawn"),w8(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?vIe(t):r.value},vIe=async t=>{try{return await w8(t,"exit")}catch{return vIe(t)}},EIe=async t=>{let[e,r]=await t;if(!a_t(e,r)&&T8(e,r))throw new _a;return[e,r]},a_t=(t,e)=>t===void 0&&e===void 0,T8=(t,e)=>t!==0||e!==null;var bIe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=c_t(t,e,r),s=o?.code==="ETIMEDOUT",a=_xe(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},c_t=(t,e,r)=>t!==void 0?t:T8(e,r)?new _a:void 0;var wIe=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=l_t(t,e,r),d=p_t({file:n,commandArguments:i,options:u,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:l,startTime:a});return By(d,c,u)},l_t=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EM(t,e,r),a=d_t(r),{file:c,commandArguments:u,options:l}=jM(t,e,a);f_t(l);let d=Qxe(l,s);return{file:c,commandArguments:u,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},d_t=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,f_t=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&sL("ipcInput"),t&&sL("ipc: true"),r&&sL("detached: true"),n&&sL("cancelSignal")},sL=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},p_t=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=m_t({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:u,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p}=bIe(c,r),{output:m,error:h=u}=_Ie({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),_=m.map((b,T)=>Cu(b,r,T)),y=Cu(yIe(m,r),r,"all");return g_t({error:h,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},m_t=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{pIe(o,r);let a=h_t(r);return u_t(...qM(t,e,a))}catch(a){return qy({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},h_t=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:YM(e)}),g_t=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:u,startTime:l})=>t===void 0?ZM({command:c,escapedCommand:u,stdio:o,all:s,ipcOutput:[],options:a,startTime:l}):RR({error:t,command:c,escapedCommand:u,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as nSt}from"events";import{spawn as iSt}from"child_process";import IIe from"process";import{once as A8,on as __t}from"events";var TIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(My({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:DM(t)}),y_t({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),y_t=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{CM(e,i);let o=yd(t,e,r),s=new AbortController;try{return await Promise.race([S_t(o,n,s),v_t(o,r,s),E_t(o,r,s)])}catch(a){throw Ly(t),a}finally{s.abort(),kM(e,i)}},S_t=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await A8(t,"message",{signal:r});return n}for await(let[n]of __t(t,"message",{signal:r}))if(e(n))return n},v_t=async(t,e,{signal:r})=>{await A8(t,"disconnect",{signal:r}),lRe(e)},E_t=async(t,e,{signal:r})=>{let[n]=await A8(t,"strict:error",{signal:r});throw IM(n,e)};import{once as RIe,on as b_t}from"events";var xIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>R8({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),R8=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{My({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:DM(t)}),CM(e,o);let s=yd(t,e,r),a=new AbortController,c={};return w_t(t,s,a),T_t({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),A_t({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},w_t=async(t,e,r)=>{try{await RIe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},T_t=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await RIe(t,"strict:error",{signal:r.signal});n.error=IM(i,e),r.abort()}catch{}},A_t=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of b_t(r,"message",{signal:o.signal}))AIe(s),yield c}catch{AIe(s)}finally{o.abort(),kM(e,a),n||Ly(t),i&&await t}},AIe=({error:t})=>{if(t)throw t};var OIe=(t,{ipc:e})=>{Object.assign(t,CIe(t,!1,e))},PIe=()=>{let t=IIe,e=!0,r=IIe.channel!==void 0;return{...CIe(t,e,r),getCancelSignal:LRe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},CIe=(t,e,r)=>({sendMessage:FM.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:TIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:xIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as R_t}from"child_process";import{PassThrough as x_t,Readable as I_t,Writable as O_t,Duplex as P_t}from"stream";var kIe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{g8(n);let a=new R_t;C_t(a,n),Object.assign(a,{readable:k_t,writable:N_t,duplex:$_t});let c=qy({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),u=D_t(c,s,i);return{subprocess:a,promise:u}},C_t=(t,e)=>{let r=IR(),n=IR(),i=IR(),o=Array.from({length:e.length-3},IR),s=IR(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},IR=()=>{let t=new x_t;return t.end(),t},k_t=()=>new I_t({read(){}}),N_t=()=>new O_t({write(){}}),$_t=()=>new P_t({read(){},write(){}}),D_t=async(t,e,r)=>By(t,e,r);import{createReadStream as NIe,createWriteStream as $Ie}from"fs";import{Buffer as M_t}from"buffer";import{Readable as OR,Writable as L_t,Duplex as U_t}from"stream";var MIe=(t,e)=>eL(F_t,t,e,!1),PR=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Sd[t]}.`)},DIe={fileNumber:PR,generator:b8,asyncGenerator:b8,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:U_t.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},F_t={input:{...DIe,fileUrl:({value:t})=>({stream:NIe(t)}),filePath:({value:{file:t}})=>({stream:NIe(t)}),webStream:({value:t})=>({stream:OR.fromWeb(t)}),iterable:({value:t})=>({stream:OR.from(t)}),asyncIterable:({value:t})=>({stream:OR.from(t)}),string:({value:t})=>({stream:OR.from(t)}),uint8Array:({value:t})=>({stream:OR.from(M_t.from(t))})},output:{...DIe,fileUrl:({value:t})=>({stream:$Ie(t)}),filePath:({value:{file:t,append:e}})=>({stream:$Ie(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:L_t.fromWeb(t)}),iterable:PR,asyncIterable:PR,string:PR,uint8Array:PR}};import{on as z_t,once as LIe}from"events";import{PassThrough as j_t,getDefaultHighWaterMark as q_t}from"stream";import{finished as zIe}from"stream/promises";function cm(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)I8(i);let e=t.some(({readableObjectMode:i})=>i),r=B_t(t,e),n=new x8({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var B_t=(t,e)=>{if(t.length===0)return q_t(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},x8=class extends j_t{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(I8(e),this.#e.has(e))return;this.#e.add(e),this.#n??=V_t(this,this.#e,this.#o);let r=W_t({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(I8(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)}},V_t=async(t,e,r)=>{aL(t,UIe);let n=new AbortController;try{await Promise.race([G_t(t,n),H_t(t,e,r,n)])}finally{n.abort(),aL(t,-UIe)}},G_t=async(t,{signal:e})=>{try{await zIe(t,{signal:e,cleanup:!0})}catch(r){throw jIe(t,r),r}},H_t=async(t,e,r,{signal:n})=>{for await(let[i]of z_t(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},I8=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},W_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{aL(t,FIe);let a=new AbortController;try{await Promise.race([K_t(o,e,a),Y_t({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Z_t({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),aL(t,-FIe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?O8(t):J_t(t))},K_t=async(t,e,{signal:r})=>{try{await t,r.aborted||O8(e)}catch(n){r.aborted||jIe(e,n)}},Y_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await zIe(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;qIe(s)?i.add(e):BIe(t,s)}},Z_t=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await LIe(t,i,{signal:o}),!t.readable)return LIe(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},J_t=t=>{t.writable&&t.end()},jIe=(t,e)=>{qIe(e)?O8(t):BIe(t,e)},qIe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",O8=t=>{(t.readable||t.writable)&&t.destroy()},BIe=(t,e)=>{t.destroyed||(t.once("error",X_t),t.destroy(e))},X_t=()=>{},aL=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},UIe=2,FIe=1;import{finished as VIe}from"stream/promises";var Gy=(t,e)=>{t.pipe(e),Q_t(t,e),eyt(t,e)},Q_t=async(t,e)=>{if(!(ga(t)||ga(e))){try{await VIe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}P8(e)}},P8=t=>{t.writable&&t.end()},eyt=async(t,e)=>{if(!(ga(t)||ga(e))){try{await VIe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}C8(t)}},C8=t=>{t.readable&&t.destroy()};var GIe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>is.has(c)))tyt(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!is.has(c)))nyt({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:cm(o);Gy(s,i)}},tyt=(t,e,r,n)=>{r==="output"?Gy(t.stdio[n],e):Gy(e,t.stdio[n]);let i=ryt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},ryt=["stdin","stdout","stderr"],nyt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;iyt(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},iyt=(t,{signal:e})=>{ga(t)&&im(t,oyt,e)},oyt=2;import{addAbortListener as cyt}from"events";var um=[];um.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&um.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&um.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var cL=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",k8=Symbol.for("signal-exit emitter"),N8=globalThis,syt=Object.defineProperty.bind(Object),$8=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(N8[k8])return N8[k8];syt(N8,k8,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},uL=class{},ayt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),D8=class extends uL{onExit(){return()=>{}}load(){}unload(){}},M8=class extends uL{#e=L8.platform==="win32"?"SIGINT":"SIGHUP";#r=new $8;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of um)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!cL(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of um)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,um.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return cL(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&cL(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)}},L8=globalThis.process,{onExit:HIe,load:Jmr,unload:Xmr}=ayt(cL(L8)?new M8(L8):new D8);var WIe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=HIe(()=>{t.kill()});cyt(n,()=>{i()})};var YIe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=vM(),{destination:s,destinationStream:a,destinationError:c,from:u,unpipeSignal:l}=uyt(r,n,i),{sourceStream:d,sourceError:f}=dyt(t,u),{options:p,fileDescriptors:m}=yc.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:m,startTime:o}},uyt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=lyt(t,e,...r),a=PM(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},lyt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(KIe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||R5(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=lM(r,...n);return{destination:e(KIe)(i,o,s),pipeOptions:s}}if(yc.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}`)},KIe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),dyt=(t,e)=>{try{return{sourceStream:Uy(t,e)}}catch(r){return{sourceError:r}}};var JIe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=fyt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw U8({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},fyt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return C8(t),n;if(e!==void 0)return P8(r),e},U8=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>qy({error:t,command:ZIe,escapedCommand:ZIe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),ZIe="source.pipe(destination)";var XIe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as pyt}from"stream/promises";var QIe=(t,e,r)=>{let n=lL.has(e)?hyt(t,e):myt(t,e);return im(t,_yt,r.signal),im(e,yyt,r.signal),gyt(e),n},myt=(t,e)=>{let r=cm([t]);return Gy(r,e),lL.set(e,r),r},hyt=(t,e)=>{let r=lL.get(e);return r.add(t),r},gyt=async t=>{try{await pyt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}lL.delete(t)},lL=new WeakMap,_yt=2,yyt=1;import{aborted as Syt}from"util";var eOe=(t,e)=>t===void 0?[]:[vyt(t,e)],vyt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Syt(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw U8({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var dL=(t,...e)=>{if(xr(e[0]))return dL.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=YIe(t,...e),i=Eyt({...n,destination:r});return i.pipe=dL.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Eyt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:u})=>{let l=byt(t,i);JIe({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let f=QIe(e,o,d);return await Promise.race([XIe(l),...eOe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{d.abort()}},byt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as Oyt}from"timers/promises";import{on as wyt}from"events";import{getDefaultHighWaterMark as Tyt}from"stream";var fL=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Ayt(e,s),rOe({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Ayt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},F8=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Ryt(e,s,t);let a=t.readableObjectMode&&!o;return rOe({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Ryt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},rOe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=wyt(t,"data",{signal:e.signal,highWaterMark:tOe,highWatermark:tOe});return xyt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},z8=Tyt(!0),tOe=z8,xyt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Iyt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*am(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*xR(a)}},Iyt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[rL(t,r,!e),tL(t,i,!n,{})].filter(Boolean);var nOe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:u,streamInfo:l})=>{let d=Pyt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:u,streamInfo:l});if(!i){await Promise.all([Cyt(t),d]);return}let f=_8(c,r),p=F8({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([kyt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Pyt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!oL({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=F8({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await mIe(a,t,r,o)},Cyt=async t=>{await Oyt(),t.readableFlowing===null&&t.resume()},kyt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await HM(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await WM(r,{maxBuffer:o})):await jy(r,{maxBuffer:o})}catch(a){return iOe(mxe({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},j8=async t=>{try{return await t}catch(e){return iOe(e)}},iOe=({bufferedData:t})=>PTe(t)?new Uint8Array(t):t;import{finished as Nyt}from"stream/promises";var CR=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=$yt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Nyt(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Lyt(a,e,r,n)}finally{s.abort()}},$yt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Dyt(t,r,n),n},Dyt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Myt(e,r),n.call(t,...i)}},Myt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Lyt=(t,e,r,n)=>{if(!Uyt(t,e,r,n))throw t},Uyt=(t,e,r,n=!0)=>r.propagating?oOe(t)||pL(t):(r.propagating=!0,q8(r,e)===n?oOe(t):pL(t)),q8=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",pL=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oOe=t=>t?.code==="EPIPE";var sOe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,u)=>B8({stream:c,fdNumber:u,encoding:e,buffer:r[u],maxBuffer:n[u],lines:i[u],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),B8=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:u})=>{if(!t)return;let l=CR(t,e,u);if(q8(u,e)){await l;return}let[d]=await Promise.all([nOe({stream:t,onStreamEnd:l,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:u}),l]);return d};var aOe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?cm([t,e].filter(Boolean)):void 0,cOe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>B8({...Fyt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:zyt(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Fyt=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},zyt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as jyt}from"events";var uOe=t=>Ny(t,"ipc"),lOe=(t,e)=>{let r=SM(t);gc({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var dOe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=uOe(o),a=Ou(e,"ipc"),c=Ou(r,"ipc");for await(let u of R8({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(hxe(t,i,c),i.push(u)),s&&lOe(u,o);return i},fOe=async(t,e)=>(await Promise.allSettled([t]),e);var pOe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:u,ipc:l,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:_,controller:y})=>{let b=SIe(t,f),T={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:b,propagating:!1},S=sOe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),E=cOe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),v=[],R=dOe({subprocess:t,buffer:r,maxBuffer:n,ipc:l,ipcOutput:v,verboseInfo:p}),P=qyt(h,t,T),O=Byt(m,T);try{return await Promise.race([Promise.all([{},EIe(b),Promise.all(S),E,R,WRe(t,d),...P,...O]),_,Vyt(t,y),...qRe(t,o,f,y),...uRe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:y}),...zRe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},b,Promise.all(S.map(A=>j8(A))),j8(E),fOe(R,v),Promise.allSettled(P),Promise.allSettled(O)])}},qyt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:CR(n,i,r)),Byt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Sa(o,{checkOpen:!1})&&!ga(o)).map(({type:i,value:o,stream:s=o})=>CR(s,n,e,{isSameDirection:is.has(i),stopOnExit:i==="native"}))),Vyt=async(t,{signal:e})=>{let[r]=await jyt(t,"error",{signal:e});throw r};var mOe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),kR=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_c();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Hy=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 Gyt}from"stream";import{callbackify as Hyt}from"util";import{finished as hOe}from"stream/promises";var V8=async t=>{if(t!==void 0)try{await G8(t)}catch{}},gOe=async t=>{if(t!==void 0)try{await H8(t)}catch{}},G8=async t=>{await hOe(t,{cleanup:!0,readable:!1,writable:!0})},H8=async t=>{await hOe(t,{cleanup:!0,readable:!0,writable:!1})},mL=async(t,e)=>{if(await t,e)throw e},hL=(t,e,r)=>{r&&!pL(r)?t.destroy(r):e&&t.destroy()};var _Oe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||vo.has(r),{subprocessStdout:a,waitReadableDestroy:c}=W8(t,n,e),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=K8(a,s),{read:f,onStdoutDataDone:p}=Y8({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Gyt({read:f,destroy:Hyt(J8.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:u});return Z8({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},W8=(t,e,r)=>{let n=Uy(t,e),i=kR(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},K8=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:z8},Y8=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_c(),s=fL({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Wyt(this,s,o)},onStdoutDataDone:o}},Wyt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},Z8=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await H8(t),await n,await V8(i),await e,r.readable&&r.push(null)}catch(o){await V8(i),yOe(r,o)}},J8=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Hy(r,e)&&(yOe(t,n),await mL(e,n))},yOe=(t,e)=>{hL(t,t.readable,e)};import{Writable as Kyt}from"stream";import{callbackify as SOe}from"util";var vOe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=X8(t,r,e),s=new Kyt({...Q8(n,t,i),destroy:SOe(tZ.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return eZ(n,s),s},X8=(t,e,r)=>{let n=PM(t,e),i=kR(r,n,"writableFinal"),o=kR(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},Q8=(t,e,r)=>({write:Yyt.bind(void 0,t),final:SOe(Zyt.bind(void 0,t,e,r))}),Yyt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Zyt=async(t,e,r)=>{await Hy(r,e)&&(t.writable&&t.end(),await e)},eZ=async(t,e,r)=>{try{await G8(t),e.writable&&e.end()}catch(n){await gOe(r),EOe(e,n)}},tZ=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Hy(r,e),await Hy(n,e)&&(EOe(t,i),await mL(e,i))},EOe=(t,e)=>{hL(t,t.writable,e)};import{Duplex as Jyt}from"stream";import{callbackify as Xyt}from"util";var bOe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||vo.has(r),{subprocessStdout:c,waitReadableDestroy:u}=W8(t,n,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=X8(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=K8(c,a),{read:_,onStdoutDataDone:y}=Y8({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new Jyt({read:_,...Q8(l,t,d),destroy:Xyt(Qyt.bind(void 0,{subprocessStdout:c,subprocessStdin:l,subprocess:t,waitReadableDestroy:u,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:m,writableObjectMode:l.writableObjectMode,encoding:p});return Z8({subprocessStdout:c,onStdoutDataDone:y,readable:b,subprocess:t,subprocessStdin:l}),eZ(l,b,c),b},Qyt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([J8({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),tZ({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var rZ=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||vo.has(e),s=Uy(t,r),a=fL({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return eSt(a,s,t)},eSt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var wOe=(t,{encoding:e})=>{let r=mOe();t.readable=_Oe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=vOe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=bOe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=rZ.bind(void 0,t,e),t[Symbol.asyncIterator]=rZ.bind(void 0,t,e,{})};var TOe=(t,e)=>{for(let[r,n]of rSt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},tSt=(async()=>{})().constructor.prototype,rSt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(tSt,t)]);var AOe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=oSt(t,e,r),{subprocess:f,promise:p}=aSt({file:i,commandArguments:o,options:l,startTime:c,verboseInfo:u,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=dL.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),TOe(f,p),yc.set(f,{options:l,fileDescriptors:d}),f},oSt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EM(t,e,r),{file:a,commandArguments:c,options:u}=jM(t,e,r),l=sSt(u),d=MIe(l,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},sSt=({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}},aSt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=iSt(...qM(t,e,r))}catch(m){return kIe({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let u=new AbortController;nSt(Number.POSITIVE_INFINITY,u.signal);let l=[...c.stdio];GIe(c,a,u),WIe(c,r,u);let d={},f=_c();c.kill=aRe.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:u}),c.all=aOe(c,r),wOe(c,r),OIe(c,r);let p=cSt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:l,command:o,escapedCommand:s,context:d,onInternalError:f,controller:u});return{subprocess:c,promise:p}},cSt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:u,controller:l})=>{let[d,[f,p],m,h,_]=await pOe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:u,controller:l});l.abort(),u.resolve();let y=m.map((S,E)=>Cu(S,e,E)),b=Cu(h,e,"all"),T=uSt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:b,ipcOutput:_,context:c,options:e,command:s,escapedCommand:a,startTime:r});return By(T,n,e)},uSt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:u,startTime:l})=>"error"in t?RR({error:t.error,command:c,escapedCommand:u,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Sc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:l,isSync:!1}):ZM({command:c,escapedCommand:u,stdio:n,all:i,ipcOutput:o,options:a,startTime:l});var gL=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,lSt(n,t[n],i)]));return{...t,...r}},lSt=(t,e,r)=>dSt.has(t)&&xr(e)&&xr(r)?{...e,...r}:r,dSt=new Set(["env",...k5]);var vd=(t,e,r,n)=>{let i=(s,a,c)=>vd(s,a,r,c),o=(...s)=>fSt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},fSt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(xr(o))return i(t,gL(r,o),n);let{file:a,commandArguments:c,options:u,isSync:l}=pSt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return l?wIe(a,c,u):AOe(a,c,u,i)},pSt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=MTe(e)?LTe(e,r):[e,...r],[s,a,c]=lM(...o),u=gL(gL(n,i),c),{file:l=s,commandArguments:d=a,options:f=u,isSync:p=!1}=t({file:s,commandArguments:a,options:u});return{file:l,commandArguments:d,options:f,isSync:p}};var ROe=({file:t,commandArguments:e})=>IOe(t,e),xOe=({file:t,commandArguments:e})=>({...IOe(t,e),isSync:!0}),IOe=(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]=mSt(t);return{file:r,commandArguments:n}},mSt=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(hSt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},hSt=/ +/g;var OOe=(t,e,r)=>{t.sync=e(gSt,r),t.s=t.sync},POe=({options:t})=>COe(t),gSt=({options:t})=>({...COe(t),isSync:!0}),COe=t=>({options:{..._St(t),...t}}),_St=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kOe={preferLocal:!0};var NOe=vd(()=>({})),j_r=vd(()=>({isSync:!0})),$Oe=vd(ROe),q_r=vd(xOe),B_r=vd(VRe),V_r=vd(POe,{},kOe,OOe),{sendMessage:G_r,getOneMessage:H_r,getEachMessage:W_r,getCancelSignal:K_r}=PIe();var DOe=!1,MOe,ySt=t=>{MOe??=t},LOe=t=>{DOe=!0,ySt(t)},Kn=()=>DOe,ku=()=>MOe,UOe=t=>{switch(t){case"SIGTERM":case"SIGINT":return t;case void 0:return"interrupted";default:return}};var NR=null,FOe=t=>(NR&&NR.destroy(),NR=new os({totalAllowedTime:t}),NR),zOe=()=>NR;var os=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&&Kn())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((l,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),u="success";try{return await xk({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}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var jOe={name:"@netlify/agent-runner-cli",type:"module",version:"2.18.0-smtp.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","build:bundle":"tsup --no-dts",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:bundle 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:antigravity":"vitest run test/integration/antigravity.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",prompts:"LOG=0 vitest run --config vitest.prompts.config.js","site:build":"npm run prompts && node site/build.mjs","site:dev":"npm run site:build && netlify dev --dir site/dist",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","@grpc/grpc-js":"1.14.7","@netlify/axis":"^1.21.0","@netlify/eslint-config-node":"^7.0.1","@netlify/skills":"1.8.0","@opentelemetry/sdk-trace-base":"2.9.0","@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.3","@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","@opentelemetry/otlp-transformer":"0.218.0",execa:"^9.6.1",fastify:"5.12.6",minimist:"^1.2.8",openai:"7.31.0",zod:"^4.4.3"}};var bSt=vSt(import.meta.url),wSt=Nu.dirname(bSt),TSt=ESt(import.meta.url),Wy=ce("shell"),nZ=new Set,qOe={preferLocal:!0},Et=(t,e,r)=>{let[n,i]=ASt(e,r),o={...qOe,...i},s=NOe(t,n,o);VOe(s,o),WOe(s);let a=r?.idleTimeout;return a&&a>0&&HOe(s,a),s},BOe=(t,e)=>{let r={...qOe,...e},n=$Oe(t,r);return VOe(n,r),WOe(n),e?.idleTimeout&&e.idleTimeout>0&&HOe(n,e.idleTimeout),n},ASt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},VOe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||Ec.env.NETLIFY_LOCAL_QUIET==="true")return;if(Ec.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new nT).pipe(Ec.stdout),t.stderr?.pipe(new nT).pipe(Ec.stderr);return}t.stdout?.pipe(Ec.stdout),t.stderr?.pipe(Ec.stderr)},iZ=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ec.kill(-t.pid,e),Wy.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Wy.error("Error killing process:",r),!1}},GOe=t=>iZ(t,"SIGKILL"),HOe=(t,e)=>{let r=null,n=()=>{Wy.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),iZ(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Wy.log(`Force killing idle process ${t.pid}`),GOe(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},WOe=t=>{nZ.add(t);let e=zOe();if(e){let r=e.onTimesUp(()=>{Wy.log(`Global timer expired, killing process ${t.pid}`),iZ(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Wy.log(`Force killing process ${t.pid} after timeout`),GOe(t))},5e3)});t.on("exit",()=>{nZ.delete(t),r()}),t.on("error",()=>{nZ.delete(t),r()})}};function yL(t,e){return!!va(t,e)}function va(t,e){if(!Ec.env.NETLIFY_LOCAL_MODE)try{let i=TSt.resolve(jOe.name),o=Nu.dirname(i);for(;o!==Nu.dirname(o);){let s=Nu.dirname(o);if(Nu.basename(s)==="node_modules"){let a=Nu.join(s,".bin",e);if(_L.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(Ec.env.NODE_PATH){let i=Nu.join(Ec.env.NODE_PATH,".bin",e);if(_L.existsSync(i))return i}let r=Nu.join(t,"node_modules",".bin",e);if(_L.existsSync(r))return r;let n=Nu.join(wSt,"..","node_modules",".bin",e);if(_L.existsSync(n))return n}var Ky=ce("repo"),tPe="runner-diffs-",oZ=t=>`${tPe}${t}-`,rPe=async t=>{let e=vL.tmpdir(),r;try{r=await Yn.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(tPe)&&!n.startsWith(oZ(t))).map(n=>Yn.rm(Eo.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},KOe=async t=>{let e=RSt("sha256");for await(let r of xSt(t))e.update(r);return e.digest("hex")},YOe=async(t,e)=>t.size===e.size&&await KOe(t.path)===await KOe(e.path),nPe=/.. (.+)?\.log$/,ISt=[nPe],OSt=1,ZOe=/^<<<<<<<( |$)/m,JOe=t=>{let e=t.split(`
399
+ if (condition) { yield value; }`)};import{Buffer as Mgt}from"buffer";import{StringDecoder as Lgt}from"string_decoder";var rL=(t,e,r)=>{if(r)return;if(t)return{transform:Ugt.bind(void 0,new TextEncoder)};let n=new Lgt(e);return{transform:Fgt.bind(void 0,n),final:zgt.bind(void 0,n)}},Ugt=function*(t,e){Mgt.isBuffer(e)?yield Iu(e):typeof e=="string"?yield t.encode(e):yield e},Fgt=function*(t,e){yield Wr(e)?t.write(e):e},zgt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as aIe}from"util";var v8=aIe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),nL=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=qgt}=e[r];for await(let i of n(t))yield*nL(i,e,r+1)},cIe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*jgt(r,Number(e),t)},jgt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*nL(n,r,e+1)},uIe=aIe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),qgt=function*(t){yield t};var E8=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},lIe=(t,e)=>[...e.flatMap(r=>[...am(r,t,0)]),...xR(t)],am=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Vgt}=e[r];for(let i of n(t))yield*am(i,e,r+1)},xR=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Bgt(r,Number(e),t)},Bgt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*am(n,r,e+1)},Vgt=function*(t){yield t};var b8=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=fIe(t,s,o),u=sm(e),l=sm(r),d=u?v8.bind(void 0,nL,a):E8.bind(void 0,am),f=u||l?v8.bind(void 0,cIe,a):E8.bind(void 0,xR),p=u||l?uIe.bind(void 0,a):void 0;return{stream:new Ggt({writableObjectMode:n,writableHighWaterMark:dIe(n),readableObjectMode:i,readableHighWaterMark:dIe(i),transform(h,_,y){d([h,c,0],this,y)},flush(h){f([c],this,h)},destroy:p})}},iL=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=fIe(s,r,a);t=lIe(c,t)}return t},fIe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:iIe(n,a)},rL(r,s,n),tL(r,o,n,c),{transform:t,final:e},{transform:oIe(i,a)},nIe({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var pIe=(t,e)=>{for(let r of Hgt(t))Wgt(t,r,e)},Hgt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Wgt=(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 ${Sd[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Kgt(a,n));r.input=_R(s)},Kgt=(t,e)=>{let r=iL(t,e,"utf8",!0);return Ygt(r),_R(r)},Ygt=t=>{let e=t.find(r=>typeof r!="string"&&!Wr(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 Qgt,appendFileSync as e_t}from"fs";var oL=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ny(r,n)&&!vo.has(e)&&Zgt(n)&&(t.some(({type:i,value:o})=>i==="native"&&Jgt.has(o))||t.every(({type:i})=>is.has(i))),Zgt=t=>t===1||t===2,Jgt=new Set(["pipe","overlapped"]),mIe=async(t,e,r,n)=>{for await(let i of t)Xgt(e)||gIe(i,r,n)},hIe=(t,e,r)=>{for(let n of t)gIe(n,e,r)},Xgt=t=>t._readableState.pipes.length>0,gIe=(t,e,r)=>{let n=SM(t);gc({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var _Ie=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,u)=>t_t({result:c,fileDescriptors:t,fdNumber:u,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},t_t=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:u,stripFinalNewline:l,maxBuffer:d})=>{if(t===null)return;let f=yxe(t,o,d),p=Iu(f),{stdioItems:m,objectMode:h}=e[r],_=r_t([p],m,c,n),{serializedResult:y,finalResult:b=y}=n_t({chunks:_,objectMode:h,encoding:c,lines:u,stripFinalNewline:l,fdNumber:r});i_t({serializedResult:y,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let T=a[r]?b:void 0;try{return n.error===void 0&&o_t(y,m,i),T}catch(S){return n.error=S,T}},r_t=(t,e,r,n)=>{try{return iL(t,e,r,!1)}catch(i){return n.error=i,t}},n_t=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:_R(t)};let s=kTe(t,r);return n[o]?{serializedResult:s,finalResult:S8(s,!i[o],e)}:{serializedResult:s}},i_t=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!oL({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=S8(t,!1,s);try{hIe(a,e,n)}catch(c){r.error??=c}},o_t=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>QM.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?e_t(n,t):(r.add(o),Qgt(n,t))}};var yIe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Cu(e,r,"all")]:Array.isArray(e)?[Cu(t,r,"all"),...e]:Wr(t)&&Wr(e)?I5([t,e]):`${t}${e}`};import{once as w8}from"events";var SIe=async(t,e)=>{let[r,n]=await s_t(t);return e.isForcefullyTerminated??=!1,[r,n]},s_t=async t=>{let[e,r]=await Promise.allSettled([w8(t,"spawn"),w8(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?vIe(t):r.value},vIe=async t=>{try{return await w8(t,"exit")}catch{return vIe(t)}},EIe=async t=>{let[e,r]=await t;if(!a_t(e,r)&&T8(e,r))throw new _a;return[e,r]},a_t=(t,e)=>t===void 0&&e===void 0,T8=(t,e)=>t!==0||e!==null;var bIe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=c_t(t,e,r),s=o?.code==="ETIMEDOUT",a=_xe(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},c_t=(t,e,r)=>t!==void 0?t:T8(e,r)?new _a:void 0;var wIe=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=l_t(t,e,r),d=p_t({file:n,commandArguments:i,options:u,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:l,startTime:a});return By(d,c,u)},l_t=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EM(t,e,r),a=d_t(r),{file:c,commandArguments:u,options:l}=jM(t,e,a);f_t(l);let d=Qxe(l,s);return{file:c,commandArguments:u,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},d_t=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,f_t=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&sL("ipcInput"),t&&sL("ipc: true"),r&&sL("detached: true"),n&&sL("cancelSignal")},sL=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},p_t=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=m_t({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:u,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p}=bIe(c,r),{output:m,error:h=u}=_Ie({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),_=m.map((b,T)=>Cu(b,r,T)),y=Cu(yIe(m,r),r,"all");return g_t({error:h,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},m_t=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{pIe(o,r);let a=h_t(r);return u_t(...qM(t,e,a))}catch(a){return qy({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},h_t=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:YM(e)}),g_t=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:u,startTime:l})=>t===void 0?ZM({command:c,escapedCommand:u,stdio:o,all:s,ipcOutput:[],options:a,startTime:l}):RR({error:t,command:c,escapedCommand:u,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as nSt}from"events";import{spawn as iSt}from"child_process";import IIe from"process";import{once as A8,on as __t}from"events";var TIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(My({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:DM(t)}),y_t({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),y_t=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{CM(e,i);let o=yd(t,e,r),s=new AbortController;try{return await Promise.race([S_t(o,n,s),v_t(o,r,s),E_t(o,r,s)])}catch(a){throw Ly(t),a}finally{s.abort(),kM(e,i)}},S_t=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await A8(t,"message",{signal:r});return n}for await(let[n]of __t(t,"message",{signal:r}))if(e(n))return n},v_t=async(t,e,{signal:r})=>{await A8(t,"disconnect",{signal:r}),lRe(e)},E_t=async(t,e,{signal:r})=>{let[n]=await A8(t,"strict:error",{signal:r});throw IM(n,e)};import{once as RIe,on as b_t}from"events";var xIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>R8({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),R8=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{My({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:DM(t)}),CM(e,o);let s=yd(t,e,r),a=new AbortController,c={};return w_t(t,s,a),T_t({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),A_t({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},w_t=async(t,e,r)=>{try{await RIe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},T_t=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await RIe(t,"strict:error",{signal:r.signal});n.error=IM(i,e),r.abort()}catch{}},A_t=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of b_t(r,"message",{signal:o.signal}))AIe(s),yield c}catch{AIe(s)}finally{o.abort(),kM(e,a),n||Ly(t),i&&await t}},AIe=({error:t})=>{if(t)throw t};var OIe=(t,{ipc:e})=>{Object.assign(t,CIe(t,!1,e))},PIe=()=>{let t=IIe,e=!0,r=IIe.channel!==void 0;return{...CIe(t,e,r),getCancelSignal:LRe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},CIe=(t,e,r)=>({sendMessage:FM.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:TIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:xIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as R_t}from"child_process";import{PassThrough as x_t,Readable as I_t,Writable as O_t,Duplex as P_t}from"stream";var kIe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{g8(n);let a=new R_t;C_t(a,n),Object.assign(a,{readable:k_t,writable:N_t,duplex:$_t});let c=qy({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),u=D_t(c,s,i);return{subprocess:a,promise:u}},C_t=(t,e)=>{let r=IR(),n=IR(),i=IR(),o=Array.from({length:e.length-3},IR),s=IR(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},IR=()=>{let t=new x_t;return t.end(),t},k_t=()=>new I_t({read(){}}),N_t=()=>new O_t({write(){}}),$_t=()=>new P_t({read(){},write(){}}),D_t=async(t,e,r)=>By(t,e,r);import{createReadStream as NIe,createWriteStream as $Ie}from"fs";import{Buffer as M_t}from"buffer";import{Readable as OR,Writable as L_t,Duplex as U_t}from"stream";var MIe=(t,e)=>eL(F_t,t,e,!1),PR=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Sd[t]}.`)},DIe={fileNumber:PR,generator:b8,asyncGenerator:b8,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:U_t.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},F_t={input:{...DIe,fileUrl:({value:t})=>({stream:NIe(t)}),filePath:({value:{file:t}})=>({stream:NIe(t)}),webStream:({value:t})=>({stream:OR.fromWeb(t)}),iterable:({value:t})=>({stream:OR.from(t)}),asyncIterable:({value:t})=>({stream:OR.from(t)}),string:({value:t})=>({stream:OR.from(t)}),uint8Array:({value:t})=>({stream:OR.from(M_t.from(t))})},output:{...DIe,fileUrl:({value:t})=>({stream:$Ie(t)}),filePath:({value:{file:t,append:e}})=>({stream:$Ie(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:L_t.fromWeb(t)}),iterable:PR,asyncIterable:PR,string:PR,uint8Array:PR}};import{on as z_t,once as LIe}from"events";import{PassThrough as j_t,getDefaultHighWaterMark as q_t}from"stream";import{finished as zIe}from"stream/promises";function cm(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)I8(i);let e=t.some(({readableObjectMode:i})=>i),r=B_t(t,e),n=new x8({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var B_t=(t,e)=>{if(t.length===0)return q_t(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},x8=class extends j_t{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(I8(e),this.#e.has(e))return;this.#e.add(e),this.#n??=V_t(this,this.#e,this.#o);let r=W_t({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(I8(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)}},V_t=async(t,e,r)=>{aL(t,UIe);let n=new AbortController;try{await Promise.race([G_t(t,n),H_t(t,e,r,n)])}finally{n.abort(),aL(t,-UIe)}},G_t=async(t,{signal:e})=>{try{await zIe(t,{signal:e,cleanup:!0})}catch(r){throw jIe(t,r),r}},H_t=async(t,e,r,{signal:n})=>{for await(let[i]of z_t(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},I8=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},W_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{aL(t,FIe);let a=new AbortController;try{await Promise.race([K_t(o,e,a),Y_t({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Z_t({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),aL(t,-FIe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?O8(t):J_t(t))},K_t=async(t,e,{signal:r})=>{try{await t,r.aborted||O8(e)}catch(n){r.aborted||jIe(e,n)}},Y_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await zIe(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;qIe(s)?i.add(e):BIe(t,s)}},Z_t=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await LIe(t,i,{signal:o}),!t.readable)return LIe(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},J_t=t=>{t.writable&&t.end()},jIe=(t,e)=>{qIe(e)?O8(t):BIe(t,e)},qIe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",O8=t=>{(t.readable||t.writable)&&t.destroy()},BIe=(t,e)=>{t.destroyed||(t.once("error",X_t),t.destroy(e))},X_t=()=>{},aL=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},UIe=2,FIe=1;import{finished as VIe}from"stream/promises";var Gy=(t,e)=>{t.pipe(e),Q_t(t,e),eyt(t,e)},Q_t=async(t,e)=>{if(!(ga(t)||ga(e))){try{await VIe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}P8(e)}},P8=t=>{t.writable&&t.end()},eyt=async(t,e)=>{if(!(ga(t)||ga(e))){try{await VIe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}C8(t)}},C8=t=>{t.readable&&t.destroy()};var GIe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>is.has(c)))tyt(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!is.has(c)))nyt({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:cm(o);Gy(s,i)}},tyt=(t,e,r,n)=>{r==="output"?Gy(t.stdio[n],e):Gy(e,t.stdio[n]);let i=ryt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},ryt=["stdin","stdout","stderr"],nyt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;iyt(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},iyt=(t,{signal:e})=>{ga(t)&&im(t,oyt,e)},oyt=2;import{addAbortListener as cyt}from"events";var um=[];um.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&um.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&um.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var cL=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",k8=Symbol.for("signal-exit emitter"),N8=globalThis,syt=Object.defineProperty.bind(Object),$8=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(N8[k8])return N8[k8];syt(N8,k8,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},uL=class{},ayt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),D8=class extends uL{onExit(){return()=>{}}load(){}unload(){}},M8=class extends uL{#e=L8.platform==="win32"?"SIGINT":"SIGHUP";#r=new $8;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of um)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!cL(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of um)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,um.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return cL(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&cL(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)}},L8=globalThis.process,{onExit:HIe,load:Jmr,unload:Xmr}=ayt(cL(L8)?new M8(L8):new D8);var WIe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=HIe(()=>{t.kill()});cyt(n,()=>{i()})};var YIe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=vM(),{destination:s,destinationStream:a,destinationError:c,from:u,unpipeSignal:l}=uyt(r,n,i),{sourceStream:d,sourceError:f}=dyt(t,u),{options:p,fileDescriptors:m}=yc.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:m,startTime:o}},uyt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=lyt(t,e,...r),a=PM(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},lyt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(KIe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||R5(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=lM(r,...n);return{destination:e(KIe)(i,o,s),pipeOptions:s}}if(yc.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}`)},KIe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),dyt=(t,e)=>{try{return{sourceStream:Uy(t,e)}}catch(r){return{sourceError:r}}};var JIe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=fyt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw U8({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},fyt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return C8(t),n;if(e!==void 0)return P8(r),e},U8=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>qy({error:t,command:ZIe,escapedCommand:ZIe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),ZIe="source.pipe(destination)";var XIe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as pyt}from"stream/promises";var QIe=(t,e,r)=>{let n=lL.has(e)?hyt(t,e):myt(t,e);return im(t,_yt,r.signal),im(e,yyt,r.signal),gyt(e),n},myt=(t,e)=>{let r=cm([t]);return Gy(r,e),lL.set(e,r),r},hyt=(t,e)=>{let r=lL.get(e);return r.add(t),r},gyt=async t=>{try{await pyt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}lL.delete(t)},lL=new WeakMap,_yt=2,yyt=1;import{aborted as Syt}from"util";var eOe=(t,e)=>t===void 0?[]:[vyt(t,e)],vyt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Syt(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw U8({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var dL=(t,...e)=>{if(xr(e[0]))return dL.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=YIe(t,...e),i=Eyt({...n,destination:r});return i.pipe=dL.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Eyt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:u})=>{let l=byt(t,i);JIe({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let f=QIe(e,o,d);return await Promise.race([XIe(l),...eOe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{d.abort()}},byt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as Oyt}from"timers/promises";import{on as wyt}from"events";import{getDefaultHighWaterMark as Tyt}from"stream";var fL=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Ayt(e,s),rOe({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Ayt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},F8=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Ryt(e,s,t);let a=t.readableObjectMode&&!o;return rOe({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Ryt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},rOe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=wyt(t,"data",{signal:e.signal,highWaterMark:tOe,highWatermark:tOe});return xyt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},z8=Tyt(!0),tOe=z8,xyt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Iyt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*am(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*xR(a)}},Iyt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[rL(t,r,!e),tL(t,i,!n,{})].filter(Boolean);var nOe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:u,streamInfo:l})=>{let d=Pyt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:u,streamInfo:l});if(!i){await Promise.all([Cyt(t),d]);return}let f=_8(c,r),p=F8({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([kyt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Pyt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!oL({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=F8({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await mIe(a,t,r,o)},Cyt=async t=>{await Oyt(),t.readableFlowing===null&&t.resume()},kyt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await HM(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await WM(r,{maxBuffer:o})):await jy(r,{maxBuffer:o})}catch(a){return iOe(mxe({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},j8=async t=>{try{return await t}catch(e){return iOe(e)}},iOe=({bufferedData:t})=>PTe(t)?new Uint8Array(t):t;import{finished as Nyt}from"stream/promises";var CR=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=$yt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Nyt(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Lyt(a,e,r,n)}finally{s.abort()}},$yt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Dyt(t,r,n),n},Dyt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Myt(e,r),n.call(t,...i)}},Myt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Lyt=(t,e,r,n)=>{if(!Uyt(t,e,r,n))throw t},Uyt=(t,e,r,n=!0)=>r.propagating?oOe(t)||pL(t):(r.propagating=!0,q8(r,e)===n?oOe(t):pL(t)),q8=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",pL=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oOe=t=>t?.code==="EPIPE";var sOe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,u)=>B8({stream:c,fdNumber:u,encoding:e,buffer:r[u],maxBuffer:n[u],lines:i[u],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),B8=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:u})=>{if(!t)return;let l=CR(t,e,u);if(q8(u,e)){await l;return}let[d]=await Promise.all([nOe({stream:t,onStreamEnd:l,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:u}),l]);return d};var aOe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?cm([t,e].filter(Boolean)):void 0,cOe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>B8({...Fyt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:zyt(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Fyt=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},zyt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as jyt}from"events";var uOe=t=>Ny(t,"ipc"),lOe=(t,e)=>{let r=SM(t);gc({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var dOe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=uOe(o),a=Ou(e,"ipc"),c=Ou(r,"ipc");for await(let u of R8({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(hxe(t,i,c),i.push(u)),s&&lOe(u,o);return i},fOe=async(t,e)=>(await Promise.allSettled([t]),e);var pOe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:u,ipc:l,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:_,controller:y})=>{let b=SIe(t,f),T={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:b,propagating:!1},S=sOe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),E=cOe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),v=[],R=dOe({subprocess:t,buffer:r,maxBuffer:n,ipc:l,ipcOutput:v,verboseInfo:p}),P=qyt(h,t,T),O=Byt(m,T);try{return await Promise.race([Promise.all([{},EIe(b),Promise.all(S),E,R,WRe(t,d),...P,...O]),_,Vyt(t,y),...qRe(t,o,f,y),...uRe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:y}),...zRe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},b,Promise.all(S.map(A=>j8(A))),j8(E),fOe(R,v),Promise.allSettled(P),Promise.allSettled(O)])}},qyt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:CR(n,i,r)),Byt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Sa(o,{checkOpen:!1})&&!ga(o)).map(({type:i,value:o,stream:s=o})=>CR(s,n,e,{isSameDirection:is.has(i),stopOnExit:i==="native"}))),Vyt=async(t,{signal:e})=>{let[r]=await jyt(t,"error",{signal:e});throw r};var mOe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),kR=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_c();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Hy=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 Gyt}from"stream";import{callbackify as Hyt}from"util";import{finished as hOe}from"stream/promises";var V8=async t=>{if(t!==void 0)try{await G8(t)}catch{}},gOe=async t=>{if(t!==void 0)try{await H8(t)}catch{}},G8=async t=>{await hOe(t,{cleanup:!0,readable:!1,writable:!0})},H8=async t=>{await hOe(t,{cleanup:!0,readable:!0,writable:!1})},mL=async(t,e)=>{if(await t,e)throw e},hL=(t,e,r)=>{r&&!pL(r)?t.destroy(r):e&&t.destroy()};var _Oe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||vo.has(r),{subprocessStdout:a,waitReadableDestroy:c}=W8(t,n,e),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=K8(a,s),{read:f,onStdoutDataDone:p}=Y8({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Gyt({read:f,destroy:Hyt(J8.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:u});return Z8({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},W8=(t,e,r)=>{let n=Uy(t,e),i=kR(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},K8=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:z8},Y8=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_c(),s=fL({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Wyt(this,s,o)},onStdoutDataDone:o}},Wyt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},Z8=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await H8(t),await n,await V8(i),await e,r.readable&&r.push(null)}catch(o){await V8(i),yOe(r,o)}},J8=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Hy(r,e)&&(yOe(t,n),await mL(e,n))},yOe=(t,e)=>{hL(t,t.readable,e)};import{Writable as Kyt}from"stream";import{callbackify as SOe}from"util";var vOe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=X8(t,r,e),s=new Kyt({...Q8(n,t,i),destroy:SOe(tZ.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return eZ(n,s),s},X8=(t,e,r)=>{let n=PM(t,e),i=kR(r,n,"writableFinal"),o=kR(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},Q8=(t,e,r)=>({write:Yyt.bind(void 0,t),final:SOe(Zyt.bind(void 0,t,e,r))}),Yyt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Zyt=async(t,e,r)=>{await Hy(r,e)&&(t.writable&&t.end(),await e)},eZ=async(t,e,r)=>{try{await G8(t),e.writable&&e.end()}catch(n){await gOe(r),EOe(e,n)}},tZ=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Hy(r,e),await Hy(n,e)&&(EOe(t,i),await mL(e,i))},EOe=(t,e)=>{hL(t,t.writable,e)};import{Duplex as Jyt}from"stream";import{callbackify as Xyt}from"util";var bOe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||vo.has(r),{subprocessStdout:c,waitReadableDestroy:u}=W8(t,n,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=X8(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=K8(c,a),{read:_,onStdoutDataDone:y}=Y8({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new Jyt({read:_,...Q8(l,t,d),destroy:Xyt(Qyt.bind(void 0,{subprocessStdout:c,subprocessStdin:l,subprocess:t,waitReadableDestroy:u,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:m,writableObjectMode:l.writableObjectMode,encoding:p});return Z8({subprocessStdout:c,onStdoutDataDone:y,readable:b,subprocess:t,subprocessStdin:l}),eZ(l,b,c),b},Qyt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([J8({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),tZ({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var rZ=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||vo.has(e),s=Uy(t,r),a=fL({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return eSt(a,s,t)},eSt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var wOe=(t,{encoding:e})=>{let r=mOe();t.readable=_Oe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=vOe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=bOe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=rZ.bind(void 0,t,e),t[Symbol.asyncIterator]=rZ.bind(void 0,t,e,{})};var TOe=(t,e)=>{for(let[r,n]of rSt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},tSt=(async()=>{})().constructor.prototype,rSt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(tSt,t)]);var AOe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=oSt(t,e,r),{subprocess:f,promise:p}=aSt({file:i,commandArguments:o,options:l,startTime:c,verboseInfo:u,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=dL.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),TOe(f,p),yc.set(f,{options:l,fileDescriptors:d}),f},oSt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=EM(t,e,r),{file:a,commandArguments:c,options:u}=jM(t,e,r),l=sSt(u),d=MIe(l,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},sSt=({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}},aSt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=iSt(...qM(t,e,r))}catch(m){return kIe({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let u=new AbortController;nSt(Number.POSITIVE_INFINITY,u.signal);let l=[...c.stdio];GIe(c,a,u),WIe(c,r,u);let d={},f=_c();c.kill=aRe.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:u}),c.all=aOe(c,r),wOe(c,r),OIe(c,r);let p=cSt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:l,command:o,escapedCommand:s,context:d,onInternalError:f,controller:u});return{subprocess:c,promise:p}},cSt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:u,controller:l})=>{let[d,[f,p],m,h,_]=await pOe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:u,controller:l});l.abort(),u.resolve();let y=m.map((S,E)=>Cu(S,e,E)),b=Cu(h,e,"all"),T=uSt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:b,ipcOutput:_,context:c,options:e,command:s,escapedCommand:a,startTime:r});return By(T,n,e)},uSt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:u,startTime:l})=>"error"in t?RR({error:t.error,command:c,escapedCommand:u,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Sc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:l,isSync:!1}):ZM({command:c,escapedCommand:u,stdio:n,all:i,ipcOutput:o,options:a,startTime:l});var gL=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,lSt(n,t[n],i)]));return{...t,...r}},lSt=(t,e,r)=>dSt.has(t)&&xr(e)&&xr(r)?{...e,...r}:r,dSt=new Set(["env",...k5]);var vd=(t,e,r,n)=>{let i=(s,a,c)=>vd(s,a,r,c),o=(...s)=>fSt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},fSt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(xr(o))return i(t,gL(r,o),n);let{file:a,commandArguments:c,options:u,isSync:l}=pSt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return l?wIe(a,c,u):AOe(a,c,u,i)},pSt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=MTe(e)?LTe(e,r):[e,...r],[s,a,c]=lM(...o),u=gL(gL(n,i),c),{file:l=s,commandArguments:d=a,options:f=u,isSync:p=!1}=t({file:s,commandArguments:a,options:u});return{file:l,commandArguments:d,options:f,isSync:p}};var ROe=({file:t,commandArguments:e})=>IOe(t,e),xOe=({file:t,commandArguments:e})=>({...IOe(t,e),isSync:!0}),IOe=(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]=mSt(t);return{file:r,commandArguments:n}},mSt=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(hSt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},hSt=/ +/g;var OOe=(t,e,r)=>{t.sync=e(gSt,r),t.s=t.sync},POe=({options:t})=>COe(t),gSt=({options:t})=>({...COe(t),isSync:!0}),COe=t=>({options:{..._St(t),...t}}),_St=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kOe={preferLocal:!0};var NOe=vd(()=>({})),j_r=vd(()=>({isSync:!0})),$Oe=vd(ROe),q_r=vd(xOe),B_r=vd(VRe),V_r=vd(POe,{},kOe,OOe),{sendMessage:G_r,getOneMessage:H_r,getEachMessage:W_r,getCancelSignal:K_r}=PIe();var DOe=!1,MOe,ySt=t=>{MOe??=t},LOe=t=>{DOe=!0,ySt(t)},Kn=()=>DOe,ku=()=>MOe,UOe=t=>{switch(t){case"SIGTERM":case"SIGINT":return t;case void 0:return"interrupted";default:return}};var NR=null,FOe=t=>(NR&&NR.destroy(),NR=new os({totalAllowedTime:t}),NR),zOe=()=>NR;var os=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&&Kn())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((l,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),u="success";try{return await xk({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}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var jOe={name:"@netlify/agent-runner-cli",type:"module",version:"2.18.0-smtp.1",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup","build:bundle":"tsup --no-dts",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:bundle 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:antigravity":"vitest run test/integration/antigravity.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",prompts:"LOG=0 vitest run --config vitest.prompts.config.js","site:build":"npm run prompts && node site/build.mjs","site:dev":"npm run site:build && netlify dev --dir site/dist",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","@grpc/grpc-js":"1.14.7","@netlify/axis":"^1.21.0","@netlify/eslint-config-node":"^7.0.1","@netlify/skills":"1.8.0","@opentelemetry/sdk-trace-base":"2.9.0","@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.3","@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","@opentelemetry/otlp-transformer":"0.218.0",execa:"^9.6.1",fastify:"5.12.6",minimist:"^1.2.8",openai:"7.31.0",zod:"^4.4.3"}};var bSt=vSt(import.meta.url),wSt=Nu.dirname(bSt),TSt=ESt(import.meta.url),Wy=ce("shell"),nZ=new Set,qOe={preferLocal:!0},Et=(t,e,r)=>{let[n,i]=ASt(e,r),o={...qOe,...i},s=NOe(t,n,o);VOe(s,o),WOe(s);let a=r?.idleTimeout;return a&&a>0&&HOe(s,a),s},BOe=(t,e)=>{let r={...qOe,...e},n=$Oe(t,r);return VOe(n,r),WOe(n),e?.idleTimeout&&e.idleTimeout>0&&HOe(n,e.idleTimeout),n},ASt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},VOe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||Ec.env.NETLIFY_LOCAL_QUIET==="true")return;if(Ec.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new nT).pipe(Ec.stdout),t.stderr?.pipe(new nT).pipe(Ec.stderr);return}t.stdout?.pipe(Ec.stdout),t.stderr?.pipe(Ec.stderr)},iZ=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ec.kill(-t.pid,e),Wy.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Wy.error("Error killing process:",r),!1}},GOe=t=>iZ(t,"SIGKILL"),HOe=(t,e)=>{let r=null,n=()=>{Wy.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),iZ(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Wy.log(`Force killing idle process ${t.pid}`),GOe(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},WOe=t=>{nZ.add(t);let e=zOe();if(e){let r=e.onTimesUp(()=>{Wy.log(`Global timer expired, killing process ${t.pid}`),iZ(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Wy.log(`Force killing process ${t.pid} after timeout`),GOe(t))},5e3)});t.on("exit",()=>{nZ.delete(t),r()}),t.on("error",()=>{nZ.delete(t),r()})}};function yL(t,e){return!!va(t,e)}function va(t,e){if(!Ec.env.NETLIFY_LOCAL_MODE)try{let i=TSt.resolve(jOe.name),o=Nu.dirname(i);for(;o!==Nu.dirname(o);){let s=Nu.dirname(o);if(Nu.basename(s)==="node_modules"){let a=Nu.join(s,".bin",e);if(_L.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(Ec.env.NODE_PATH){let i=Nu.join(Ec.env.NODE_PATH,".bin",e);if(_L.existsSync(i))return i}let r=Nu.join(t,"node_modules",".bin",e);if(_L.existsSync(r))return r;let n=Nu.join(wSt,"..","node_modules",".bin",e);if(_L.existsSync(n))return n}var Ky=ce("repo"),tPe="runner-diffs-",oZ=t=>`${tPe}${t}-`,rPe=async t=>{let e=vL.tmpdir(),r;try{r=await Yn.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(tPe)&&!n.startsWith(oZ(t))).map(n=>Yn.rm(Eo.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},KOe=async t=>{let e=RSt("sha256");for await(let r of xSt(t))e.update(r);return e.digest("hex")},YOe=async(t,e)=>t.size===e.size&&await KOe(t.path)===await KOe(e.path),nPe=/.. (.+)?\.log$/,ISt=[nPe],OSt=1,ZOe=/^<<<<<<<( |$)/m,JOe=t=>{let e=t.split(`
400
400
  `).reduce((r,n)=>{if(!n)return r;let[i,o,,...s]=n,a=s.join(""),c=i.trim(),u=o.trim();return r[a]?r[a].change=u:r[a]={filePath:a,stage:c,change:u},r},{});return Object.values(e)},PSt=t=>t instanceof Error&&String(t.stderr??"").includes("No such remote"),XOe=t=>{let e=t instanceof Error?t.message:String(t),r=String(t?.stderr??"").trim();return Pn(r?`${e}: ${r}`:e)},CSt=t=>/Authentication failed|returned error: 401/.test(String(t?.stderr??"")),QOe=t=>t.pathname.replace(/\/+$/,"").replace(/\.git$/,""),kSt=(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&&QOe(n)===QOe(r)&&n.password!==""}catch{return!1}},ePe={stdin:"pipe",stdout:"pipe",stderr:"pipe",stripFinalNewline:!1},SL=500,$R=class extends Error{constructor(r,n){super(n instanceof Error?n.message:String(n));this.step=r;this.cause=n}},Zn=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(),o=new Set(n.changedFiles),s=(await this.listIndexEntries(n.deletedFiles,{cwd:i})).filter(({filePath:a})=>!o.has(a));return await this.unstageFiles(n.changedFiles,{cwd:i}),s.length>0&&await Yn.writeFile(await this.getSetupMetadataPath(),JSON.stringify(s)),{rewrittenFileCount:n.rewrittenFileCount}}catch(n){throw new $R(r,n)}}run(e,r={}){return Et("git",e,{cwd:this.cwd,...r,env:{...r.env,NETLIFY_INTERNAL_GIT:"1"}})}async commitAndCreateDiffs({config:e,isRetry:r}){Ky.info("Getting runner diffs");let n=await this.hasAgentChanges(),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!r){let u=JOe(o);await this.discardSetupOnlyChanges(u)}Ky.info("Changes after processing"),await this.getStatus();let s=await this.getIgnoredPathspecs(o);if(await this.stageFiles(s),await this.excludeUnchangedSetupDescendants(),i=await this.hasStagedChanges(),!i)return{hasChanges:!1,ignored:s};await this.run(["commit","-m","Agent runner [skip ci]"]);let a=await Yn.mkdtemp(Eo.join(vL.tmpdir(),oZ(e.sessionId))),c=await this.writeDiffFiles({config:e,diffDir:a,target:{commit:"HEAD"},ignored:s});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(`
401
401
  `).filter(i=>ISt.some(s=>s instanceof RegExp?s.test(i):i===s)?!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 Yn.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(`
402
402
  `)})}async stageBuildSetup(){await Yn.rm(await this.getSetupMetadataPath(),{force:!0});let e=await this.getIgnoredPathspecs();await this.stageFiles(e)}async unstageSetupResolvedConflicts(e){let r=await this.getRoot(),{stdout:n}=await this.run(["diff","--no-relative","--name-only","-z","--text",`-G${ZOe.source}`,e,"HEAD"],{cwd:r,stdout:"pipe"}),i=String(n??"").split("\0").filter(Boolean),o=[];for(let s of i){let a=await Yn.readFile(Eo.join(r,s),"utf8").catch(()=>{});a!==void 0&&!ZOe.test(a)&&o.push(s)}return await this.unstageFiles(o,{cwd:r}),o}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 Eo.resolve(e,String(r).trim())}),this.setupMetadataPath}async listIndexEntries(e,r){let n=[];for(let i=0;i<e.length;i+=SL){let o=e.slice(i,i+SL).map(a=>`:(literal)${a}`),{stdout:s}=await this.run(["ls-files","--stage","-z","--",...o],{...ePe,...r});for(let a of String(s??"").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 Yn.readFile(await this.getSetupMetadataPath(),"utf8"))}catch(a){if(a.code==="ENOENT")return;throw a}let i={cwd:await this.getRoot(),env:e},o=new Map((await this.listIndexEntries(r.map(({filePath:a})=>a),i)).map(({filePath:a,entry:c})=>[a,c])),s=r.filter(({filePath:a,entry:c})=>o.get(a)===c);s.length!==0&&await this.run(["update-index","--force-remove","-z","--stdin"],{...i,input:s.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(`
@@ -703,7 +703,7 @@ ${b}`:b;if(T.length>5e5&&y){let S=KFe.join(u,`agent-task-context-${jMt()}.md`);a
703
703
  `)}};var ZFe=ce("session_manager"),see=null;var qMt,aee,BMt=0,VMt,GMt;var cee=()=>qMt,uee=()=>see!==null,JFe=()=>BMt,XFe=()=>GMt,QFe=()=>VMt,lee=async(t,e)=>{if(!ze().idleTimeoutEnabled||!t||t===e)return;let r=lE[t];if(r)try{await r.clean(),ZFe.info(`Wiped previous agent state (${t}) on switch to ${e}`)}catch(n){ZFe.warn(`Failed to clean previous agent ${t} on switch`,{error:n?.message||n})}finally{aee=void 0}},UF=t=>{aee=t};var eze=t=>{let e=t.previousSession?.nativeSessionId;return!!e&&e===aee},tze=async()=>{if(see)try{await see}catch{}};var rze=t=>{let e=t.previousSession;return e?e.agent!==t.runner?{viable:!1,outcome:"agent_switch"}:e.nativeSessionId?{viable:!0,outcome:"resumed"}:{viable:!1,outcome:"missing_native_session_id"}:{viable:!1,outcome:"not_eligible"}};import{randomUUID as HMt}from"crypto";var CE=ce("interactions"),nze="question",ize="authorization",oze="setup_request",WMt=["answered","skipped","dismissed"],KMt=({setupRequest:t,authorization:e,questions:r})=>t?{type:oze,payload:{setup_request_id:t.setupRequestId},category:W.SetupRequest}:e?{type:ize,payload:{...e},category:W.Authorization}:{type:nze,payload:r,category:W.Question},fee=async(t,e,r)=>{let{setupRequest:n}=e,i=n?.refId??HMt(),{type:o,payload:s,category:a}=KMt(e);return await Br(t.id,t.sessionId,{state:"await_input",interactions:{[i]:{type:o,status:"pending",payload:s}},steps:[{id:i,refId:i,category:a}],...r?.diffFields,...r?.nativeSessionId?{native_session_id:r.nativeSessionId}:{},...r?.nativeSessionS3Key?{native_session_s3_key:r.nativeSessionS3Key}:{}}),i},pee=(t,e,r)=>{if(t.setupRequest){CE.log("Agent paused on a setup request; session set to await_input",{sessionId:e,refId:r,setupRequestId:t.setupRequest.setupRequestId}),Y.inc("inference.pending_setup_request",1);return}if(t.authorization){CE.log("Agent paused on a service authorization; session set to await_input",{sessionId:e,refId:r,service:t.authorization.service}),Y.inc("inference.pending_authorization",1);return}let n=t.questions?.length??0;CE.log("Agent paused on a question; session set to await_input",{sessionId:e,refId:r,questionCount:n}),Y.inc("inference.pending_question",1),Y.distribution("inference.questions_per_ask",n)},sze=async(t,e)=>{try{let r=await Uhe(t);return{satisfied:r.satisfied,items:r.items??[]}}catch(r){CE.warn("Failed to fetch a setup request for the resume",{refId:e,setupRequestId:t,error:r?.message}),Y.inc("inference.setup_request_fetch_failed",1);return}},mee=async t=>{let e;try{e=await yp(t.id,t.sessionId)}catch(s){return CE.warn("Failed to fetch session for the full answer fold",{error:s?.message}),Y.inc("inference.answer_fetch_failed",1),null}let r=e?.interactions;if(!r)return[];let n=[],i=new Set,o=async(s,a)=>{if(!(!a||i.has(s))&&(i.add(s),!!WMt.includes(a.status??""))){if(a.type===oze){let c=a.payload??{};if(!c.setup_request_id)return;let u=await sze(c.setup_request_id,s);n.push({refId:s,questions:[],responses:[],setupRequest:{completed:a.status==="answered",skipped:a.status==="skipped"},...a.instruction?{instruction:a.instruction}:{},...u?{setupOutcome:u}:{}});return}if(a.type===ize){let c=a.payload??{};n.push({refId:s,questions:[],responses:[],authorization:{service:c.service,granted:a.status==="answered"}});return}a.type===nze&&n.push({refId:s,questions:a.payload??[],responses:a.response??[],...a.instruction?{instruction:a.instruction}:{}})}};for(let s of e?.steps??[])s?.refId&&await o(s.refId,r[s.refId]);for(let[s,a]of Object.entries(r))await o(s,a);return n},hee=async(t,e)=>{let r;try{r=await yp(t.id,t.sessionId)}catch(o){return CE.warn("Failed to fetch session for the setup request outcome",{error:o?.message}),Y.inc("inference.setup_request_session_fetch_failed",1),e}let n=r?.interactions?.[e.refId]?.payload;if(!n?.setup_request_id)return e;let i=await sze(n.setup_request_id,e.refId);return i?{...e,setupOutcome:i}:e},gee=()=>({counted:!1});var YMt=(t,e)=>{if(e==null)return"skipped";let r=new Set(t.options?.map(o=>o.label)??[]),i=(Array.isArray(e)?e:[e]).filter(o=>r.has(o)).length;return i===0?"free_text":i===1?"option":"multi_select"},_ee=t=>{let e=0;t.questions.forEach((r,n)=>{let i=YMt(r,t.responses[n]);i==="skipped"&&(e+=1),Y.inc("interaction.answer_kind",1,{kind:i})}),Y.distribution("interaction.questions_skipped",e),t.instruction?.trim()&&Y.inc("interaction.override_instruction",1),t.setupRequest?.skipped&&Y.inc("interaction.setup_request_skipped",1)},aze=t=>{let e=!1,r=t.flatMap(o=>o.questions.map((s,a)=>{let c=o.responses[a];c==null&&(e=!0);let u=c==null?"(skipped)":Array.isArray(c)?c.join(", "):c;return{question:s.question,answer:u}})),n=t.filter(o=>!o.setupRequest).map(o=>o.instruction?.trim()).filter(o=>!!o).join(`
704
704
 
705
705
  `),i=e&&!n?'A "(skipped)" answer means the user chose not to answer; proceed with your best judgment there.':"";return r.length?APe(r,{skipNote:i,overrideInstruction:n||void 0}):""};var cze=t=>{let e=t.map(r=>r.authorization).filter(r=>!!r).map(r=>r.granted?`- ${r.service} is now authorized. Its tools are available to you.`:`- The user declined to authorize ${r.service}. Continue without it and do not request authorization for ${r.service} again in this run.`);return e.length?["## Service authorization","",...e].join(`
706
- `):""};var ZMt="At least one target must be required. Mark the context the task actually needs this in as required, and drop the item entirely if the task works without it everywhere.",kE=(t,e)=>Ae.array(Ae.object({name:t,required:Ae.boolean().default(!0).describe("Set false only if the task is genuinely complete without it in that context. Every item needs at least one required target.")})).min(1).refine(r=>r.some(n=>n.required),{message:ZMt}).describe(e),Ns=Ae.string().min(1).describe("One sentence, shown to the user next to the field: what you are building and why it needs this."),uze=t=>Ae.array(t).min(1).max(10).describe("Everything this project is missing for the task. Send them in one call, not one call per item");var lze=Ae.strictObject({kind:Ae.literal("identity_signup_settings"),reason:Ns,proposed:Ae.strictObject({disable_signup:Ae.boolean().describe("True for invite-only registration; false to allow visitors to sign up."),autoconfirm:Ae.boolean().describe("True to allow login without email confirmation; false to require it.")})}),dze=t=>t.kind==="identity_signup_settings";var fze=Ae.strictObject({kind:Ae.literal("identity_provider"),reason:Ns,provider:Ae.enum(["google","github","gitlab","bitbucket"]),operation:Ae.enum(["enable","remove","use_defaults"]).describe("Enable or remove a login provider while preserving stored credentials. Only use_defaults explicitly enables the provider and removes custom credentials in favor of Netlify defaults.")}),pze=t=>t.kind==="identity_provider";var JMt=t=>{let e=`disable_signup=${t.proposed.disable_signup}, autoconfirm=${t.proposed.autoconfirm}`;switch(t.state){case"applied":return`- Netlify applied and verified the approved Identity signup settings: ${e}. Check whether this solved the user's problem and continue the task.`;case"satisfied":return`- Identity signup settings already match the proposal: ${e}. They were configured elsewhere; this approval did not apply them. Check whether this solved the user's problem and continue the task.`;case"declined":return"- The user declined to change Identity signup settings. Netlify did not apply this proposal. Continue with the existing settings and do not request the same change again in this run.";case"failed":return`- The Identity signup settings request failed.${t.result?` ${t.result}`:""} Do not assume the proposal was applied. Read the current settings before relying on them and do not retry the change without a new approval.`;default:return"- The Identity signup settings approval has not finished. Do not assume the proposal was applied or apply it yourself."}},XMt=t=>{switch(t.state){case"applied":return"- Netlify reset Identity outgoing email to its defaults and verified the result. The custom SMTP credentials and sender were removed. Check whether this solved the email delivery problem and continue the task.";case"satisfied":return"- Identity outgoing email already uses Netlify defaults. This request did not reset it. Check whether this solved the email delivery problem and continue the task.";case"declined":return"- The user declined the Identity email reset. Netlify did not change email settings. Continue with the existing settings and do not request the same reset again in this run.";case"failed":return`- The Identity email reset failed.${t.result?` ${t.result}`:""} Do not assume email settings changed. Read the current settings before relying on them and do not retry without a new approval.`;default:return"- The Identity email reset approval has not finished. Do not assume settings changed or reset them yourself."}},QMt=t=>{let e=`${t.provider} (${t.operation})`;switch(t.state){case"applied":return`- Netlify applied and verified the approved Identity provider change: ${e}. This verifies saved configuration, not a completed login. Check the supported login flow before reporting that login works.`;case"satisfied":return`- Identity provider ${t.provider} already matches the proposal. This request did not apply the change. Check the supported login flow before reporting that login works.`;case"declined":return`- The user declined the Identity provider change: ${e}. Netlify did not change provider settings. Continue with the existing settings and do not request the same change again in this run.`;case"failed":return`- The Identity provider change failed: ${e}.${t.result?` ${t.result}`:""} Do not assume settings changed. Read the current settings before relying on them and do not retry without a new approval.`;default:return`- The Identity provider approval has not finished: ${e}. Do not assume settings changed or apply the change yourself.`}},mze=t=>t.flatMap(e=>dze(e)?[JMt(e)]:e.kind==="identity_email_reset"?[XMt(e)]:pze(e)?[QMt(e)]:[]);var hze=["production","deploy-preview","branch-deploy","dev"],gze=["exist","change"],_ze=Ae.object({kind:Ae.literal("env_var"),reason:Ns,key:Ae.string().min(1).regex(/^[A-Za-z_][A-Za-z0-9_]*$/).describe("The variable name exactly as the code reads it, e.g. STRIPE_SECRET_KEY."),secret:Ae.boolean().default(!0).describe("True for anything that must not be shown again once set: API keys, tokens, passwords."),mode:Ae.enum(gze).default("exist").describe('"exist" when the key just needs a value: the user is asked only when nothing is set. "change" when a value is set but must be replaced, because it is revoked, expired, rotated, or wrong for this task. Only "change" asks the user to replace a value that is already there.'),targets:kE(Ae.enum(hze),"The deploy contexts the task actually needs this in. Do not list contexts the task does not touch.")}),FF=t=>t.kind==="env_var";var yze=["full_name","email","roles"],Sze=Ae.object({kind:Ae.literal("identity_user"),reason:Ns,user_id:Ae.string().min(1).describe("The id of the Identity user to change, exactly as Identity returns it."),proposed:Ae.object({full_name:Ae.string().min(1).optional(),email:Ae.string().min(1).optional(),roles:Ae.array(Ae.string().min(1)).optional().describe("Every role the user should end up with, not only the ones you are adding.")}).describe("The value you are proposing for each field you ask about. The user sees these filled in and can change them before saving, so propose your best guess rather than leaving a field out."),targets:kE(Ae.enum(yze),"The fields the task actually needs changed. Do not list fields the task does not depend on.")}),zF=t=>t.kind==="identity_user";var vze=["admin_email","host","port","user"],Eze=Ae.strictObject({kind:Ae.literal("identity_smtp"),reason:Ns,proposed:Ae.strictObject({admin_email:Ae.string().min(1).optional().describe("The address Identity sends from, e.g. noreply@example.com."),host:Ae.string().min(1).optional().describe("The SMTP host of the provider, e.g. smtp.sendgrid.net."),port:Ae.number().int().min(1).max(65535).optional().describe("The SMTP port, e.g. 587."),user:Ae.string().min(1).optional().describe("The SMTP username.")}).describe("The value you are proposing for each field you ask about. The user sees these filled in and can change them before saving. Propose your best guess based on what the user is asking for or leave the field blank if it is unclear. There is no password field: the user types the SMTP password in themselves and it is never sent to you."),targets:kE(Ae.enum(vze),"The outgoing email settings the task actually needs. Do not list settings the task does not depend on, and do not ask for the password: the user supplies it via the Netlify UI alongside these settings.")}),jF=t=>t.kind==="identity_smtp";var bze=Ae.strictObject({kind:Ae.literal("identity_email_reset"),reason:Ns});var eLt=Ae.discriminatedUnion("kind",[_ze,Sze,Eze,lze,bze,fze]),tLt={items:uze(eLt)},X2r=Ae.object(tLt);var yee=t=>t.map(e=>e.name).join(", "),NE=t=>t.map(e=>`\`${e.name}\``).join(", "),See="Do not raise a setup request for a skipped value again in this run. Carry on without it: where the code needs the value, use mock or sample data, or a clearly labelled placeholder, behind a check for the variable so the real value takes over once it is set. In your summary, say what is mocked and which variables to set to make it real.",rLt="Do not raise a setup request for an Identity user again in this run as the user skipped. Carry on with the Identity user exactly as it reads now, and say in your summary what you left unchanged.",nLt="Do not raise a setup request for Identity outgoing email again in this run as the user skipped. Carry on with the outgoing email settings exactly as they read now, and say in your summary what you left unconfigured.",iLt="A configured setting holds whatever the user saved, which need not be what you proposed: they can edit the values before saving. Read the outgoing email settings back from Identity rather than assuming your proposed values are in place. The SMTP password was never sent to you and cannot be read back.",oLt="An updated field holds whatever the user saved, which need not be what you proposed: they can edit the values before saving. Read the user back from Identity rather than assuming your proposed values are in place.",sLt=t=>FF(t)||zF(t)||jF(t),aLt=(t,e)=>{let r=t.targets.filter(o=>o.state==="satisfied"),n=t.targets.filter(o=>o.state==="missing");if(!r.length)return`- \`${t.key}\` was not set. Continue without it and do not assume a value exists.`;if(!n.length)return`- \`${t.key}\` is now set for ${yee(r)}.`;let i=e?" The user skipped setting the rest.":"";return`- \`${t.key}\` is now set for ${yee(r)}, but not for ${yee(n)}. Anything that reads it will fail there.${i}`},cLt=(t,e)=>{let r=t.targets.filter(s=>s.state==="satisfied"),n=t.targets.filter(s=>s.state==="missing"),i=`The Identity user \`${t.user_id}\``;if(!r.length)return`- ${i} was not changed. Continue without the change and do not assume any field was updated.`;if(!n.length)return`- ${i} was updated: ${NE(r)}.`;let o=e?" The user skipped the rest.":"";return`- ${i} was updated: ${NE(r)}, but ${NE(n)} still reads as it did before.${o}`},uLt=(t,e)=>{let r=t.targets.filter(o=>o.state==="satisfied"),n=t.targets.filter(o=>o.state==="missing");if(!r.length)return"- Identity outgoing email was not configured. Identity is still sending from its default address: continue without it and do not assume any setting changed.";if(!n.length)return`- Identity outgoing email is now configured: ${NE(r)}.`;let i=e?" The user skipped the rest.":"";return`- Identity outgoing email is now configured: ${NE(r)}, but ${NE(n)} still reads as it did before.${i}`},lLt={match:FF,skippedId:t=>t.key,line:(t,e)=>aLt(t,e),skippedSummary:t=>`- The user skipped setting ${t.map(e=>`\`${e}\``).join(", ")}. They don't have the value, or don't want to configure it yet.`,leftMissingGuidance:See,reportedNotes:t=>t.some(e=>e.secret)?["Values marked secret can be used but never read back: do not echo one, write it into a file or a command, or commit it. Setting a secret turns on secret scanning of the build output, so an inlined value fails the next deploy."]:[]},dLt={match:zF,skippedId:t=>t.user_id,line:(t,e)=>cLt(t,e),skippedSummary:t=>`- The user skipped changing the Identity ${t.length>1?"users":"user"} ${t.map(e=>`\`${e}\``).join(", ")}. Proceed with the record as it stands.`,leftMissingGuidance:rLt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[oLt]:[]},fLt={match:jF,skippedId:t=>t.kind,line:(t,e)=>uLt(t,e),skippedSummary:()=>"- The user skipped configuring Identity outgoing email. Proceed with the settings as they stand.",leftMissingGuidance:nLt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[iLt]:[]},pLt=[lLt,dLt,fLt],wze=t=>{let e=t.flatMap(({item:i,skipped:o})=>sLt(i)?[{item:i,skipped:o}]:[]),r=[],n=new Set;for(let i of pLt){let o=[],s=[],a=!1;for(let{item:c,skipped:u}of e.filter(l=>i.match(l.item))){if(!c.targets.some(d=>d.state==="satisfied")&&u){o.push(i.skippedId(c));continue}s.push(c),a||=u&&c.targets.some(d=>d.state==="missing"),r.push(i.line(c,u))}o.length&&r.push(i.skippedSummary(o)),(o.length||a)&&n.add(i.leftMissingGuidance),i.reportedNotes(s).forEach(c=>n.add(c))}return{lines:r,guidance:n}};var Tze=t=>{let e=[],r=[];for(let{setupRequest:u,setupOutcome:l}of t)for(let d of l?.items??[])switch(d.interaction){case"input":e.push({item:d,skipped:!!u?.skipped});break;case"approval":r.push(d);break}let n=wze(e),i=[...mze(r),...n.lines],o=n.guidance,s=t.filter(u=>u.setupRequest).map(u=>u.instruction?.trim()).filter(u=>!!u),a=t.some(({setupRequest:u,setupOutcome:l})=>u&&!u.skipped&&!l),c=t.some(({setupRequest:u,setupOutcome:l})=>u?.skipped&&!l);return!i.length&&!s.length&&!a&&!c?"":(c&&(i.push("- The user skipped a setup request in this run, and Netlify could not report which values it covered."),o.add(See)),a&&i.push("- A setup request in this run finished, but Netlify could not report what it configured. Check with the `netlify` CLI before assuming any value is set."),["## Project setup","",...i,...[...o,...s].flatMap(u=>["",u])].join(`
706
+ `):""};var ZMt="At least one target must be required. Mark the context the task actually needs this in as required, and drop the item entirely if the task works without it everywhere.",kE=(t,e)=>Ae.array(Ae.object({name:t,required:Ae.boolean().default(!0).describe("Set false only if the task is genuinely complete without it in that context. Every item needs at least one required target.")})).min(1).refine(r=>r.some(n=>n.required),{message:ZMt}).describe(e),Ns=Ae.string().min(1).describe("One sentence, shown to the user next to the field: what you are building and why it needs this."),uze=t=>Ae.array(t).min(1).max(10).describe("Everything this project is missing for the task. Send them in one call, not one call per item");var lze=Ae.strictObject({kind:Ae.literal("identity_signup_settings"),reason:Ns,proposed:Ae.strictObject({disable_signup:Ae.boolean().describe("True for invite-only registration; false to allow visitors to sign up."),autoconfirm:Ae.boolean().describe("True to allow login without email confirmation; false to require it.")})}),dze=t=>t.kind==="identity_signup_settings";var fze=Ae.strictObject({kind:Ae.literal("identity_provider"),reason:Ns,provider:Ae.enum(["google","github","gitlab","bitbucket"]),operation:Ae.enum(["enable","remove","use_defaults"]).describe("Enable or remove a login provider while preserving stored credentials. Only use_defaults explicitly enables the provider and removes custom credentials in favor of Netlify defaults.")}),pze=t=>t.kind==="identity_provider";var JMt=t=>{let e=`disable_signup=${t.proposed.disable_signup}, autoconfirm=${t.proposed.autoconfirm}`;switch(t.state){case"applied":return`- Netlify applied and verified the approved Identity signup settings: ${e}. Check whether this solved the user's problem and continue the task.`;case"satisfied":return`- Identity signup settings already match the proposal: ${e}. They were configured elsewhere; this approval did not apply them. Check whether this solved the user's problem and continue the task.`;case"declined":return"- The user declined to change Identity signup settings. Netlify did not apply this proposal. Continue with the existing settings and do not request the same change again in this run.";case"failed":return`- The Identity signup settings request failed.${t.result?` ${t.result}`:""} Do not assume the proposal was applied. Read the current settings before relying on them and do not retry the change without a new approval.`;default:return"- The Identity signup settings approval has not finished. Do not assume the proposal was applied or apply it yourself."}},XMt=t=>{switch(t.state){case"applied":return"- Netlify reset Identity outgoing email to its defaults and verified the result. The custom SMTP credentials and sender were removed. Check whether this solved the email delivery problem and continue the task.";case"satisfied":return"- Identity outgoing email already uses Netlify defaults. This request did not reset it. Check whether this solved the email delivery problem and continue the task.";case"declined":return"- The user declined the Identity email reset. Netlify did not change email settings. Continue with the existing settings and do not request the same reset again in this run.";case"failed":return`- The Identity email reset failed.${t.result?` ${t.result}`:""} Do not assume email settings changed. Read the current settings before relying on them and do not retry without a new approval.`;default:return"- The Identity email reset approval has not finished. Do not assume settings changed or reset them yourself."}},QMt=t=>{let e=`${t.provider} (${t.operation})`;switch(t.state){case"applied":return`- Netlify applied and verified the approved Identity provider change: ${e}. This verifies saved configuration, not a completed login. Check the supported login flow before reporting that login works.`;case"satisfied":return`- Identity provider ${t.provider} already matches the proposal. This request did not apply the change. Check the supported login flow before reporting that login works.`;case"declined":return`- The user declined the Identity provider change: ${e}. Netlify did not change provider settings. Continue with the existing settings and do not request the same change again in this run.`;case"failed":return`- The Identity provider change failed: ${e}.${t.result?` ${t.result}`:""} Do not assume settings changed. Read the current settings before relying on them and do not retry without a new approval.`;default:return`- The Identity provider approval has not finished: ${e}. Do not assume settings changed or apply the change yourself.`}},mze=t=>t.flatMap(e=>dze(e)?[JMt(e)]:e.kind==="identity_email_reset"?[XMt(e)]:pze(e)?[QMt(e)]:[]);var hze=["production","deploy-preview","branch-deploy","dev"],gze=["exist","change"],_ze=Ae.object({kind:Ae.literal("env_var"),reason:Ns,key:Ae.string().min(1).regex(/^[A-Za-z_][A-Za-z0-9_]*$/).describe("The variable name exactly as the code reads it, e.g. STRIPE_SECRET_KEY."),secret:Ae.boolean().default(!0).describe("True for anything that must not be shown again once set: API keys, tokens, passwords."),mode:Ae.enum(gze).default("exist").describe('"exist" when the key just needs a value: the user is asked only when nothing is set. "change" when a value is set but must be replaced, because it is revoked, expired, rotated, or wrong for this task. Only "change" asks the user to replace a value that is already there.'),targets:kE(Ae.enum(hze),"The deploy contexts the task actually needs this in. Do not list contexts the task does not touch.")}),FF=t=>t.kind==="env_var";var yze=["full_name","email","roles"],Sze=Ae.object({kind:Ae.literal("identity_user"),reason:Ns,user_id:Ae.string().min(1).describe("The id of the Identity user to change, exactly as Identity returns it."),proposed:Ae.object({full_name:Ae.string().min(1).optional(),email:Ae.string().min(1).optional(),roles:Ae.array(Ae.string().min(1)).optional().describe("Every role the user should end up with, not only the ones you are adding.")}).describe("The value you are proposing for each field you ask about. The user sees these filled in and can change them before saving, so propose your best guess rather than leaving a field out."),targets:kE(Ae.enum(yze),"The fields the task actually needs changed. Do not list fields the task does not depend on.")}),zF=t=>t.kind==="identity_user";var vze=["admin_email","host","port","user"],Eze=Ae.strictObject({kind:Ae.literal("identity_smtp"),reason:Ns,proposed:Ae.strictObject({admin_email:Ae.string().min(1).optional().describe("The address Identity sends from, e.g. noreply@example.com."),host:Ae.string().min(1).optional().describe("The SMTP host of the provider, e.g. smtp.sendgrid.net."),port:Ae.number().int().min(1).max(65535).optional().describe("The SMTP port, e.g. 587."),user:Ae.string().min(1).optional().describe("The SMTP username.")}).describe("The value you are proposing for each field you ask about. The user sees these filled in and can change them before saving. Propose your best guess based on what the user is asking for or leave the field blank if it is unclear. There is no password field: the user types the SMTP password in themselves and it is never sent to you."),targets:kE(Ae.enum(vze),"The outgoing email settings the task actually needs. Do not list settings the task does not depend on, and do not ask for the password: the user supplies it via the Netlify UI alongside these settings.")}),jF=t=>t.kind==="identity_smtp";var bze=Ae.strictObject({kind:Ae.literal("identity_email_reset"),reason:Ns});var eLt=Ae.discriminatedUnion("kind",[_ze,Sze,Eze,lze,bze,fze]),tLt={items:uze(eLt)},X2r=Ae.object(tLt);var yee=t=>t.map(e=>e.name).join(", "),NE=t=>t.map(e=>`\`${e.name}\``).join(", "),See="Do not raise a setup request for a skipped value again in this run. Carry on without it: where the code needs the value, use mock or sample data, or a clearly labelled placeholder, behind a check for the variable so the real value takes over once it is set. In your summary, say what is mocked and which variables to set to make it real.",rLt="Do not raise a setup request for an Identity user again in this run as the user skipped. Carry on with the Identity user exactly as it reads now, and say in your summary what you left unchanged.",nLt="Do not raise a setup request for Identity outgoing email again in this run as the user skipped. Carry on with the outgoing email settings exactly as they read now, and say in your summary what you left unconfigured.",iLt="A configured setting holds whatever the user saved, which need not be what you proposed: they can edit the values before saving. Read them back from the project's Identity service instance \u2014 `GET /api/v1/sites/$SITE_ID/services/identity/instances/$IDENTITY_ID`, where `$IDENTITY_ID` is the project's `identity_instance_id`, with the settings at `config.config.smtp` \u2014 rather than assuming your proposed values are in place, and rather than raising another setup request to find out. The SMTP password is never returned by that read and cannot be checked.",oLt="An updated field holds whatever the user saved, which need not be what you proposed: they can edit the values before saving. Read the user back from Identity rather than assuming your proposed values are in place.",sLt=t=>FF(t)||zF(t)||jF(t),aLt=(t,e)=>{let r=t.targets.filter(o=>o.state==="satisfied"),n=t.targets.filter(o=>o.state==="missing");if(!r.length)return`- \`${t.key}\` was not set. Continue without it and do not assume a value exists.`;if(!n.length)return`- \`${t.key}\` is now set for ${yee(r)}.`;let i=e?" The user skipped setting the rest.":"";return`- \`${t.key}\` is now set for ${yee(r)}, but not for ${yee(n)}. Anything that reads it will fail there.${i}`},cLt=(t,e)=>{let r=t.targets.filter(s=>s.state==="satisfied"),n=t.targets.filter(s=>s.state==="missing"),i=`The Identity user \`${t.user_id}\``;if(!r.length)return`- ${i} was not changed. Continue without the change and do not assume any field was updated.`;if(!n.length)return`- ${i} was updated: ${NE(r)}.`;let o=e?" The user skipped the rest.":"";return`- ${i} was updated: ${NE(r)}, but ${NE(n)} still reads as it did before.${o}`},uLt=(t,e)=>{let r=t.targets.filter(o=>o.state==="satisfied"),n=t.targets.filter(o=>o.state==="missing");if(!r.length)return"- Identity outgoing email was not configured. Identity is still sending from its default address: continue without it and do not assume any setting changed.";if(!n.length)return`- Identity outgoing email is now configured: ${NE(r)}.`;let i=e?" The user skipped the rest.":"";return`- Identity outgoing email is now configured: ${NE(r)}, but ${NE(n)} still reads as it did before.${i}`},lLt={match:FF,skippedId:t=>t.key,line:(t,e)=>aLt(t,e),skippedSummary:t=>`- The user skipped setting ${t.map(e=>`\`${e}\``).join(", ")}. They don't have the value, or don't want to configure it yet.`,leftMissingGuidance:See,reportedNotes:t=>t.some(e=>e.secret)?["Values marked secret can be used but never read back: do not echo one, write it into a file or a command, or commit it. Setting a secret turns on secret scanning of the build output, so an inlined value fails the next deploy."]:[]},dLt={match:zF,skippedId:t=>t.user_id,line:(t,e)=>cLt(t,e),skippedSummary:t=>`- The user skipped changing the Identity ${t.length>1?"users":"user"} ${t.map(e=>`\`${e}\``).join(", ")}. Proceed with the record as it stands.`,leftMissingGuidance:rLt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[oLt]:[]},fLt={match:jF,skippedId:t=>t.kind,line:(t,e)=>uLt(t,e),skippedSummary:()=>"- The user skipped configuring Identity outgoing email. Proceed with the settings as they stand.",leftMissingGuidance:nLt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[iLt]:[]},pLt=[lLt,dLt,fLt],wze=t=>{let e=t.flatMap(({item:i,skipped:o})=>sLt(i)?[{item:i,skipped:o}]:[]),r=[],n=new Set;for(let i of pLt){let o=[],s=[],a=!1;for(let{item:c,skipped:u}of e.filter(l=>i.match(l.item))){if(!c.targets.some(d=>d.state==="satisfied")&&u){o.push(i.skippedId(c));continue}s.push(c),a||=u&&c.targets.some(d=>d.state==="missing"),r.push(i.line(c,u))}o.length&&r.push(i.skippedSummary(o)),(o.length||a)&&n.add(i.leftMissingGuidance),i.reportedNotes(s).forEach(c=>n.add(c))}return{lines:r,guidance:n}};var Tze=t=>{let e=[],r=[];for(let{setupRequest:u,setupOutcome:l}of t)for(let d of l?.items??[])switch(d.interaction){case"input":e.push({item:d,skipped:!!u?.skipped});break;case"approval":r.push(d);break}let n=wze(e),i=[...mze(r),...n.lines],o=n.guidance,s=t.filter(u=>u.setupRequest).map(u=>u.instruction?.trim()).filter(u=>!!u),a=t.some(({setupRequest:u,setupOutcome:l})=>u&&!u.skipped&&!l),c=t.some(({setupRequest:u,setupOutcome:l})=>u?.skipped&&!l);return!i.length&&!s.length&&!a&&!c?"":(c&&(i.push("- The user skipped a setup request in this run, and Netlify could not report which values it covered."),o.add(See)),a&&i.push("- A setup request in this run finished, but Netlify could not report what it configured. Check with the `netlify` CLI before assuming any value is set."),["## Project setup","",...i,...[...o,...s].flatMap(u=>["",u])].join(`
707
707
  `))};var Aze=(t,e)=>[t,aze(e),cze(e),Tze(e)].filter(Boolean).join(`
708
708
 
709
709
  `);var mLt=new Set(["claude","codex","opencode","antigravity","muse"]),Rze="The agent has already started on this work but ran into networking errors trying to complete it. Please continue from where it left off (you can use git commands to see what's currently changed thus far) and do not start over.",Ize=t=>mLt.has(t),hLt=t=>Ize(t)?Rze:`<important> ${Rze} Here is the full prompt for context: </important>`,gLt=async({buildErrors:t,contextPrefix:e,...r})=>{if(Ize(r.config.runner))return YFe({...r,buildErrors:t,contextPrefix:e});let{prompt:n}=await WFe({...r,buildErrorContext:_Lt(t)});return{prompt:`${e||""}