@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/index.js
CHANGED
|
@@ -395,7 +395,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
|
395
395
|
`,LF:`
|
|
396
396
|
`,concatBytes:i8},ngt=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},igt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:ngt};import{Buffer as ogt}from"buffer";var Lxe=(t,e)=>t?void 0:sgt.bind(void 0,e),sgt=function*(t,e){if(typeof e!="string"&&!Hr(e)&&!ogt.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Uxe=(t,e)=>t?agt.bind(void 0,e):cgt.bind(void 0,e),agt=function*(t,e){Fxe(t,e),yield e},cgt=function*(t,e){if(Fxe(t,e),typeof e!="string"&&!Hr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},Fxe=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
|
|
397
397
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
398
|
-
if (condition) { yield value; }`)};import{Buffer as ugt}from"buffer";import{StringDecoder as lgt}from"string_decoder";var WM=(t,e,r)=>{if(r)return;if(t)return{transform:dgt.bind(void 0,new TextEncoder)};let n=new lgt(e);return{transform:fgt.bind(void 0,n),final:pgt.bind(void 0,n)}},dgt=function*(t,e){ugt.isBuffer(e)?yield wu(e):typeof e=="string"?yield t.encode(e):yield e},fgt=function*(t,e){yield Hr(e)?t.write(e):e},pgt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as zxe}from"util";var s8=zxe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),KM=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=hgt}=e[r];for await(let i of n(t))yield*KM(i,e,r+1)},jxe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*mgt(r,Number(e),t)},mgt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*KM(n,r,e+1)},qxe=zxe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),hgt=function*(t){yield t};var a8=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Bxe=(t,e)=>[...e.flatMap(r=>[...rm(r,t,0)]),...SR(t)],rm=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=_gt}=e[r];for(let i of n(t))yield*rm(i,e,r+1)},SR=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*ggt(r,Number(e),t)},ggt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*rm(n,r,e+1)},_gt=function*(t){yield t};var c8=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Gxe(t,s,o),u=tm(e),l=tm(r),d=u?s8.bind(void 0,KM,a):a8.bind(void 0,rm),f=u||l?s8.bind(void 0,jxe,a):a8.bind(void 0,SR),p=u||l?qxe.bind(void 0,a):void 0;return{stream:new ygt({writableObjectMode:n,writableHighWaterMark:Vxe(n),readableObjectMode:i,readableHighWaterMark:Vxe(i),transform(h,_,y){d([h,c,0],this,y)},flush(h){f([c],this,h)},destroy:p})}},YM=(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=Gxe(s,r,a);t=Bxe(c,t)}return t},Gxe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Lxe(n,a)},WM(r,s,n),HM(r,o,n,c),{transform:t,final:e},{transform:Uxe(i,a)},Mxe({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Hxe=(t,e)=>{for(let r of Sgt(t))vgt(t,r,e)},Sgt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),vgt=(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 ${md[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>bgt(a,n));r.input=uR(s)},bgt=(t,e)=>{let r=YM(t,e,"utf8",!0);return Egt(r),uR(r)},Egt=t=>{let e=t.find(r=>typeof r!="string"&&!Hr(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 Rgt,appendFileSync as xgt}from"fs";var ZM=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ry(r,n)&&!_o.has(e)&&wgt(n)&&(t.some(({type:i,value:o})=>i==="native"&&Tgt.has(o))||t.every(({type:i})=>ts.has(i))),wgt=t=>t===1||t===2,Tgt=new Set(["pipe","overlapped"]),Wxe=async(t,e,r,n)=>{for await(let i of t)Agt(e)||Yxe(i,r,n)},Kxe=(t,e,r)=>{for(let n of t)Yxe(n,e,r)},Agt=t=>t._readableState.pipes.length>0,Yxe=(t,e,r)=>{let n=lM(t);dc({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Zxe=({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)=>Igt({result:c,fileDescriptors:t,fdNumber:u,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Igt=({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=XRe(t,o,d),p=wu(f),{stdioItems:m,objectMode:h}=e[r],_=Ogt([p],m,c,n),{serializedResult:y,finalResult:v=y}=Pgt({chunks:_,objectMode:h,encoding:c,lines:u,stripFinalNewline:l,fdNumber:r});Cgt({serializedResult:y,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let T=a[r]?v:void 0;try{return n.error===void 0&&kgt(y,m,i),T}catch(b){return n.error=b,T}},Ogt=(t,e,r,n)=>{try{return YM(t,e,r,!1)}catch(i){return n.error=i,t}},Pgt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:uR(t)};let s=dTe(t,r);return n[o]?{serializedResult:s,finalResult:o8(s,!i[o],e)}:{serializedResult:s}},Cgt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!ZM({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=o8(t,!1,s);try{Kxe(a,e,n)}catch(c){r.error??=c}},kgt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>VM.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?xgt(n,t):(r.add(o),Rgt(n,t))}};var Xxe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ru(e,r,"all")]:Array.isArray(e)?[Ru(t,r,"all"),...e]:Hr(t)&&Hr(e)?m5([t,e]):`${t}${e}`};import{once as u8}from"events";var Jxe=async(t,e)=>{let[r,n]=await Ngt(t);return e.isForcefullyTerminated??=!1,[r,n]},Ngt=async t=>{let[e,r]=await Promise.allSettled([u8(t,"spawn"),u8(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Qxe(t):r.value},Qxe=async t=>{try{return await u8(t,"exit")}catch{return Qxe(t)}},eIe=async t=>{let[e,r]=await t;if(!$gt(e,r)&&l8(e,r))throw new pa;return[e,r]},$gt=(t,e)=>t===void 0&&e===void 0,l8=(t,e)=>t!==0||e!==null;var tIe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Dgt(t,e,r),s=o?.code==="ETIMEDOUT",a=ZRe(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Dgt=(t,e,r)=>t!==void 0?t:l8(e,r)?new pa:void 0;var rIe=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=Lgt(t,e,r),d=zgt({file:n,commandArguments:i,options:u,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:l,startTime:a});return My(d,c,u)},Lgt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=fM(t,e,r),a=Ugt(r),{file:c,commandArguments:u,options:l}=kM(t,e,a);Fgt(l);let d=kxe(l,s);return{file:c,commandArguments:u,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},Ugt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Fgt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&XM("ipcInput"),t&&XM("ipc: true"),r&&XM("detached: true"),n&&XM("cancelSignal")},XM=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},zgt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=jgt({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}=tIe(c,r),{output:m,error:h=u}=Zxe({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),_=m.map((v,T)=>Ru(v,r,T)),y=Ru(Xxe(m,r),r,"all");return Bgt({error:h,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},jgt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Hxe(o,r);let a=qgt(r);return Mgt(...NM(t,e,a))}catch(a){return Dy({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},qgt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:zM(e)}),Bgt=({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?jM({command:c,escapedCommand:u,stdio:o,all:s,ipcOutput:[],options:a,startTime:l}):yR({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 Pyt}from"events";import{spawn as Cyt}from"child_process";import aIe from"process";import{once as d8,on as Vgt}from"events";var nIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Oy({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:RM(t)}),Ggt({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Ggt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{EM(e,i);let o=pd(t,e,r),s=new AbortController;try{return await Promise.race([Hgt(o,n,s),Wgt(o,r,s),Kgt(o,r,s)])}catch(a){throw Py(t),a}finally{s.abort(),wM(e,i)}},Hgt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await d8(t,"message",{signal:r});return n}for await(let[n]of Vgt(t,"message",{signal:r}))if(e(n))return n},Wgt=async(t,e,{signal:r})=>{await d8(t,"disconnect",{signal:r}),BAe(e)},Kgt=async(t,e,{signal:r})=>{let[n]=await d8(t,"strict:error",{signal:r});throw SM(n,e)};import{once as oIe,on as Ygt}from"events";var sIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>f8({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),f8=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Oy({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:RM(t)}),EM(e,o);let s=pd(t,e,r),a=new AbortController,c={};return Zgt(t,s,a),Xgt({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Jgt({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Zgt=async(t,e,r)=>{try{await oIe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Xgt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await oIe(t,"strict:error",{signal:r.signal});n.error=SM(i,e),r.abort()}catch{}},Jgt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of Ygt(r,"message",{signal:o.signal}))iIe(s),yield c}catch{iIe(s)}finally{o.abort(),wM(e,a),n||Py(t),i&&await t}},iIe=({error:t})=>{if(t)throw t};var cIe=(t,{ipc:e})=>{Object.assign(t,lIe(t,!1,e))},uIe=()=>{let t=aIe,e=!0,r=aIe.channel!==void 0;return{...lIe(t,e,r),getCancelSignal:gRe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},lIe=(t,e,r)=>({sendMessage:PM.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:nIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:sIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Qgt}from"child_process";import{PassThrough as e_t,Readable as t_t,Writable as r_t,Duplex as n_t}from"stream";var dIe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{r8(n);let a=new Qgt;i_t(a,n),Object.assign(a,{readable:o_t,writable:s_t,duplex:a_t});let c=Dy({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),u=c_t(c,s,i);return{subprocess:a,promise:u}},i_t=(t,e)=>{let r=vR(),n=vR(),i=vR(),o=Array.from({length:e.length-3},vR),s=vR(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},vR=()=>{let t=new e_t;return t.end(),t},o_t=()=>new t_t({read(){}}),s_t=()=>new r_t({write(){}}),a_t=()=>new n_t({read(){},write(){}}),c_t=async(t,e,r)=>My(t,e,r);import{createReadStream as fIe,createWriteStream as pIe}from"fs";import{Buffer as u_t}from"buffer";import{Readable as bR,Writable as l_t,Duplex as d_t}from"stream";var hIe=(t,e)=>GM(f_t,t,e,!1),ER=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${md[t]}.`)},mIe={fileNumber:ER,generator:c8,asyncGenerator:c8,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:d_t.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},f_t={input:{...mIe,fileUrl:({value:t})=>({stream:fIe(t)}),filePath:({value:{file:t}})=>({stream:fIe(t)}),webStream:({value:t})=>({stream:bR.fromWeb(t)}),iterable:({value:t})=>({stream:bR.from(t)}),asyncIterable:({value:t})=>({stream:bR.from(t)}),string:({value:t})=>({stream:bR.from(t)}),uint8Array:({value:t})=>({stream:bR.from(u_t.from(t))})},output:{...mIe,fileUrl:({value:t})=>({stream:pIe(t)}),filePath:({value:{file:t,append:e}})=>({stream:pIe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:l_t.fromWeb(t)}),iterable:ER,asyncIterable:ER,string:ER,uint8Array:ER}};import{on as p_t,once as gIe}from"events";import{PassThrough as m_t,getDefaultHighWaterMark as h_t}from"stream";import{finished as SIe}from"stream/promises";function nm(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)m8(i);let e=t.some(({readableObjectMode:i})=>i),r=g_t(t,e),n=new p8({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var g_t=(t,e)=>{if(t.length===0)return h_t(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},p8=class extends m_t{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(m8(e),this.#e.has(e))return;this.#e.add(e),this.#n??=__t(this,this.#e,this.#o);let r=v_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(m8(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)}},__t=async(t,e,r)=>{JM(t,_Ie);let n=new AbortController;try{await Promise.race([y_t(t,n),S_t(t,e,r,n)])}finally{n.abort(),JM(t,-_Ie)}},y_t=async(t,{signal:e})=>{try{await SIe(t,{signal:e,cleanup:!0})}catch(r){throw vIe(t,r),r}},S_t=async(t,e,r,{signal:n})=>{for await(let[i]of p_t(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},m8=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},v_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{JM(t,yIe);let a=new AbortController;try{await Promise.race([b_t(o,e,a),E_t({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),w_t({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),JM(t,-yIe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?h8(t):T_t(t))},b_t=async(t,e,{signal:r})=>{try{await t,r.aborted||h8(e)}catch(n){r.aborted||vIe(e,n)}},E_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await SIe(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;bIe(s)?i.add(e):EIe(t,s)}},w_t=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await gIe(t,i,{signal:o}),!t.readable)return gIe(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},T_t=t=>{t.writable&&t.end()},vIe=(t,e)=>{bIe(e)?h8(t):EIe(t,e)},bIe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",h8=t=>{(t.readable||t.writable)&&t.destroy()},EIe=(t,e)=>{t.destroyed||(t.once("error",A_t),t.destroy(e))},A_t=()=>{},JM=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},_Ie=2,yIe=1;import{finished as wIe}from"stream/promises";var Uy=(t,e)=>{t.pipe(e),R_t(t,e),x_t(t,e)},R_t=async(t,e)=>{if(!(fa(t)||fa(e))){try{await wIe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}g8(e)}},g8=t=>{t.writable&&t.end()},x_t=async(t,e)=>{if(!(fa(t)||fa(e))){try{await wIe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}_8(t)}},_8=t=>{t.readable&&t.destroy()};var TIe=(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})=>ts.has(c)))I_t(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!ts.has(c)))P_t({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]:nm(o);Uy(s,i)}},I_t=(t,e,r,n)=>{r==="output"?Uy(t.stdio[n],e):Uy(e,t.stdio[n]);let i=O_t[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},O_t=["stdin","stdout","stderr"],P_t=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;C_t(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},C_t=(t,{signal:e})=>{fa(t)&&Qp(t,k_t,e)},k_t=2;import{addAbortListener as D_t}from"events";var im=[];im.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&im.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&im.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var QM=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",y8=Symbol.for("signal-exit emitter"),S8=globalThis,N_t=Object.defineProperty.bind(Object),v8=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(S8[y8])return S8[y8];N_t(S8,y8,{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}},eL=class{},$_t=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),b8=class extends eL{onExit(){return()=>{}}load(){}unload(){}},E8=class extends eL{#e=w8.platform==="win32"?"SIGINT":"SIGHUP";#r=new v8;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of im)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(!QM(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 im)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,im.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 QM(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"&&QM(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)}},w8=globalThis.process,{onExit:AIe,load:Imr,unload:Omr}=$_t(QM(w8)?new E8(w8):new b8);var RIe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=AIe(()=>{t.kill()});D_t(n,()=>{i()})};var IIe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=dM(),{destination:s,destinationStream:a,destinationError:c,from:u,unpipeSignal:l}=M_t(r,n,i),{sourceStream:d,sourceError:f}=U_t(t,u),{options:p,fileDescriptors:m}=pc.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:m,startTime:o}},M_t=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=L_t(t,e,...r),a=bM(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},L_t=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(xIe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||f5(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]=tM(r,...n);return{destination:e(xIe)(i,o,s),pipeOptions:s}}if(pc.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}`)},xIe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),U_t=(t,e)=>{try{return{sourceStream:Cy(t,e)}}catch(r){return{sourceError:r}}};var PIe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=F_t({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw T8({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},F_t=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return _8(t),n;if(e!==void 0)return g8(r),e},T8=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Dy({error:t,command:OIe,escapedCommand:OIe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),OIe="source.pipe(destination)";var CIe=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 z_t}from"stream/promises";var kIe=(t,e,r)=>{let n=tL.has(e)?q_t(t,e):j_t(t,e);return Qp(t,V_t,r.signal),Qp(e,G_t,r.signal),B_t(e),n},j_t=(t,e)=>{let r=nm([t]);return Uy(r,e),tL.set(e,r),r},q_t=(t,e)=>{let r=tL.get(e);return r.add(t),r},B_t=async t=>{try{await z_t(t,{cleanup:!0,readable:!1,writable:!0})}catch{}tL.delete(t)},tL=new WeakMap,V_t=2,G_t=1;import{aborted as H_t}from"util";var NIe=(t,e)=>t===void 0?[]:[W_t(t,e)],W_t=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await H_t(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw T8({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var rL=(t,...e)=>{if(Rr(e[0]))return rL.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=IIe(t,...e),i=K_t({...n,destination:r});return i.pipe=rL.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},K_t=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:u})=>{let l=Y_t(t,i);PIe({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let f=kIe(e,o,d);return await Promise.race([CIe(l),...NIe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{d.abort()}},Y_t=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as ryt}from"timers/promises";import{on as Z_t}from"events";import{getDefaultHighWaterMark as X_t}from"stream";var nL=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return J_t(e,s),DIe({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},J_t=async(t,e)=>{try{await t}catch{}finally{e.abort()}},A8=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Q_t(e,s,t);let a=t.readableObjectMode&&!o;return DIe({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Q_t=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},DIe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Z_t(t,"data",{signal:e.signal,highWaterMark:$Ie,highWatermark:$Ie});return eyt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},R8=X_t(!0),$Ie=R8,eyt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=tyt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*rm(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*SR(a)}},tyt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[WM(t,r,!e),HM(t,i,!n,{})].filter(Boolean);var MIe=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=nyt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:u,streamInfo:l});if(!i){await Promise.all([iyt(t),d]);return}let f=n8(c,r),p=A8({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([oyt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},nyt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!ZM({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=A8({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Wxe(a,t,r,o)},iyt=async t=>{await ryt(),t.readableFlowing===null&&t.resume()},oyt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await LM(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await UM(r,{maxBuffer:o})):await $y(r,{maxBuffer:o})}catch(a){return LIe(WRe({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},x8=async t=>{try{return await t}catch(e){return LIe(e)}},LIe=({bufferedData:t})=>uTe(t)?new Uint8Array(t):t;import{finished as syt}from"stream/promises";var wR=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=ayt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],syt(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||lyt(a,e,r,n)}finally{s.abort()}},ayt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&cyt(t,r,n),n},cyt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{uyt(e,r),n.call(t,...i)}},uyt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},lyt=(t,e,r,n)=>{if(!dyt(t,e,r,n))throw t},dyt=(t,e,r,n=!0)=>r.propagating?UIe(t)||iL(t):(r.propagating=!0,I8(r,e)===n?UIe(t):iL(t)),I8=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",iL=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",UIe=t=>t?.code==="EPIPE";var FIe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,u)=>O8({stream:c,fdNumber:u,encoding:e,buffer:r[u],maxBuffer:n[u],lines:i[u],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),O8=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=wR(t,e,u);if(I8(u,e)){await l;return}let[d]=await Promise.all([MIe({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 zIe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?nm([t,e].filter(Boolean)):void 0,jIe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>O8({...fyt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:pyt(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}},pyt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as myt}from"events";var qIe=t=>Ry(t,"ipc"),BIe=(t,e)=>{let r=lM(t);dc({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var VIe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=qIe(o),a=Tu(e,"ipc"),c=Tu(r,"ipc");for await(let u of f8({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(KRe(t,i,c),i.push(u)),s&&BIe(u,o);return i},GIe=async(t,e)=>(await Promise.allSettled([t]),e);var HIe=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 v=Jxe(t,f),T={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:v,propagating:!1},b=FIe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),E=jIe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),S=[],I=VIe({subprocess:t,buffer:r,maxBuffer:n,ipc:l,ipcOutput:S,verboseInfo:p}),P=hyt(h,t,T),O=gyt(m,T);try{return await Promise.race([Promise.all([{},eIe(v),Promise.all(b),E,I,RRe(t,d),...P,...O]),_,_yt(t,y),...bRe(t,o,f,y),...qAe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:y}),...SRe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},v,Promise.all(b.map(A=>x8(A))),x8(E),GIe(I,S),Promise.allSettled(P),Promise.allSettled(O)])}},hyt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:wR(n,i,r)),gyt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ha(o,{checkOpen:!1})&&!fa(o)).map(({type:i,value:o,stream:s=o})=>wR(s,n,e,{isSameDirection:ts.has(i),stopOnExit:i==="native"}))),_yt=async(t,{signal:e})=>{let[r]=await myt(t,"error",{signal:e});throw r};var WIe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),TR=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=fc();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Fy=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 yyt}from"stream";import{callbackify as Syt}from"util";import{finished as KIe}from"stream/promises";var P8=async t=>{if(t!==void 0)try{await C8(t)}catch{}},YIe=async t=>{if(t!==void 0)try{await k8(t)}catch{}},C8=async t=>{await KIe(t,{cleanup:!0,readable:!1,writable:!0})},k8=async t=>{await KIe(t,{cleanup:!0,readable:!0,writable:!1})},oL=async(t,e)=>{if(await t,e)throw e},sL=(t,e,r)=>{r&&!iL(r)?t.destroy(r):e&&t.destroy()};var ZIe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_o.has(r),{subprocessStdout:a,waitReadableDestroy:c}=N8(t,n,e),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=$8(a,s),{read:f,onStdoutDataDone:p}=D8({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new yyt({read:f,destroy:Syt(L8.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:u});return M8({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},N8=(t,e,r)=>{let n=Cy(t,e),i=TR(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},$8=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:R8},D8=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=fc(),s=nL({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){vyt(this,s,o)},onStdoutDataDone:o}},vyt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},M8=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await k8(t),await n,await P8(i),await e,r.readable&&r.push(null)}catch(o){await P8(i),XIe(r,o)}},L8=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Fy(r,e)&&(XIe(t,n),await oL(e,n))},XIe=(t,e)=>{sL(t,t.readable,e)};import{Writable as byt}from"stream";import{callbackify as JIe}from"util";var QIe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=U8(t,r,e),s=new byt({...F8(n,t,i),destroy:JIe(j8.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return z8(n,s),s},U8=(t,e,r)=>{let n=bM(t,e),i=TR(r,n,"writableFinal"),o=TR(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},F8=(t,e,r)=>({write:Eyt.bind(void 0,t),final:JIe(wyt.bind(void 0,t,e,r))}),Eyt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},wyt=async(t,e,r)=>{await Fy(r,e)&&(t.writable&&t.end(),await e)},z8=async(t,e,r)=>{try{await C8(t),e.writable&&e.end()}catch(n){await YIe(r),eOe(e,n)}},j8=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Fy(r,e),await Fy(n,e)&&(eOe(t,i),await oL(e,i))},eOe=(t,e)=>{sL(t,t.writable,e)};import{Duplex as Tyt}from"stream";import{callbackify as Ayt}from"util";var tOe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||_o.has(r),{subprocessStdout:c,waitReadableDestroy:u}=N8(t,n,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=U8(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=$8(c,a),{read:_,onStdoutDataDone:y}=D8({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),v=new Tyt({read:_,...F8(l,t,d),destroy:Ayt(Ryt.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 M8({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:l}),z8(l,v,c),v},Ryt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([L8({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),j8({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var q8=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||_o.has(e),s=Cy(t,r),a=nL({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return xyt(a,s,t)},xyt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var rOe=(t,{encoding:e})=>{let r=WIe();t.readable=ZIe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=QIe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=tOe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=q8.bind(void 0,t,e),t[Symbol.asyncIterator]=q8.bind(void 0,t,e,{})};var nOe=(t,e)=>{for(let[r,n]of Oyt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Iyt=(async()=>{})().constructor.prototype,Oyt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Iyt,t)]);var iOe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=kyt(t,e,r),{subprocess:f,promise:p}=$yt({file:i,commandArguments:o,options:l,startTime:c,verboseInfo:u,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=rL.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),nOe(f,p),pc.set(f,{options:l,fileDescriptors:d}),f},kyt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=fM(t,e,r),{file:a,commandArguments:c,options:u}=kM(t,e,r),l=Nyt(u),d=hIe(l,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},Nyt=({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}},$yt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Cyt(...NM(t,e,r))}catch(m){return dIe({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let u=new AbortController;Pyt(Number.POSITIVE_INFINITY,u.signal);let l=[...c.stdio];TIe(c,a,u),RIe(c,r,u);let d={},f=fc();c.kill=zAe.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:u}),c.all=zIe(c,r),rOe(c,r),cIe(c,r);let p=Dyt({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}},Dyt=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 HIe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:u,controller:l});l.abort(),u.resolve();let y=m.map((b,E)=>Ru(b,e,E)),v=Ru(h,e,"all"),T=Myt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:v,ipcOutput:_,context:c,options:e,command:s,escapedCommand:a,startTime:r});return My(T,n,e)},Myt=({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?yR({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 mc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:l,isSync:!1}):jM({command:c,escapedCommand:u,stdio:n,all:i,ipcOutput:o,options:a,startTime:l});var aL=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Lyt(n,t[n],i)]));return{...t,...r}},Lyt=(t,e,r)=>Uyt.has(t)&&Rr(e)&&Rr(r)?{...e,...r}:r,Uyt=new Set(["env",...y5]);var hd=(t,e,r,n)=>{let i=(s,a,c)=>hd(s,a,r,c),o=(...s)=>Fyt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Fyt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Rr(o))return i(t,aL(r,o),n);let{file:a,commandArguments:c,options:u,isSync:l}=zyt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return l?rIe(a,c,u):iOe(a,c,u,i)},zyt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hTe(e)?gTe(e,r):[e,...r],[s,a,c]=tM(...o),u=aL(aL(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 oOe=({file:t,commandArguments:e})=>aOe(t,e),sOe=({file:t,commandArguments:e})=>({...aOe(t,e),isSync:!0}),aOe=(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]=jyt(t);return{file:r,commandArguments:n}},jyt=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(qyt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},qyt=/ +/g;var cOe=(t,e,r)=>{t.sync=e(Byt,r),t.s=t.sync},uOe=({options:t})=>lOe(t),Byt=({options:t})=>({...lOe(t),isSync:!0}),lOe=t=>({options:{...Vyt(t),...t}}),Vyt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},dOe={preferLocal:!0};var fOe=hd(()=>({})),y_r=hd(()=>({isSync:!0})),pOe=hd(oOe),S_r=hd(sOe),v_r=hd(wRe),b_r=hd(uOe,{},dOe,cOe),{sendMessage:E_r,getOneMessage:w_r,getEachMessage:T_r,getCancelSignal:A_r}=uIe();var mOe=!1,hOe,Gyt=t=>{hOe??=t},gOe=t=>{mOe=!0,Gyt(t)},Gn=()=>mOe,xu=()=>hOe,_Oe=t=>{switch(t){case"SIGTERM":case"SIGINT":return t;case void 0:return"interrupted";default:return}};var AR=null,yOe=t=>(AR&&AR.destroy(),AR=new rs({totalAllowedTime:t}),AR),SOe=()=>AR;var rs=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&&Gn())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 Sk({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 vOe={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 Yyt=Wyt(import.meta.url),Zyt=Iu.dirname(Yyt),Xyt=Kyt(import.meta.url),zy=ce("shell"),B8=new Set,bOe={preferLocal:!0},Et=(t,e,r)=>{let[n,i]=Jyt(e,r),o={...bOe,...i},s=fOe(t,n,o);wOe(s,o),ROe(s);let a=r?.idleTimeout;return a&&a>0&&AOe(s,a),s},EOe=(t,e)=>{let r={...bOe,...e},n=pOe(t,r);return wOe(n,r),ROe(n),e?.idleTimeout&&e.idleTimeout>0&&AOe(n,e.idleTimeout),n},Jyt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},wOe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||gc.env.NETLIFY_LOCAL_QUIET==="true")return;if(gc.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new Yw).pipe(gc.stdout),t.stderr?.pipe(new Yw).pipe(gc.stderr);return}t.stdout?.pipe(gc.stdout),t.stderr?.pipe(gc.stderr)},V8=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(gc.kill(-t.pid,e),zy.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return zy.error("Error killing process:",r),!1}},TOe=t=>V8(t,"SIGKILL"),AOe=(t,e)=>{let r=null,n=()=>{zy.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),V8(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(zy.log(`Force killing idle process ${t.pid}`),TOe(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)},ROe=t=>{B8.add(t);let e=SOe();if(e){let r=e.onTimesUp(()=>{zy.log(`Global timer expired, killing process ${t.pid}`),V8(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(zy.log(`Force killing process ${t.pid} after timeout`),TOe(t))},5e3)});t.on("exit",()=>{B8.delete(t),r()}),t.on("error",()=>{B8.delete(t),r()})}};function _c(t,e){if(!gc.env.NETLIFY_LOCAL_MODE)try{let i=Xyt.resolve(vOe.name),o=Iu.dirname(i);for(;o!==Iu.dirname(o);){let s=Iu.dirname(o);if(Iu.basename(s)==="node_modules"){let a=Iu.join(s,".bin",e);if(cL.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(gc.env.NODE_PATH){let i=Iu.join(gc.env.NODE_PATH,".bin",e);if(cL.existsSync(i))return i}let r=Iu.join(t,"node_modules",".bin",e);if(cL.existsSync(r))return r;let n=Iu.join(Zyt,"..","node_modules",".bin",e);if(cL.existsSync(n))return n}var jy=ce("repo"),$Oe="runner-diffs-",G8=t=>`${$Oe}${t}-`,DOe=async t=>{let e=lL.tmpdir(),r;try{r=await Hn.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith($Oe)&&!n.startsWith(G8(t))).map(n=>Hn.rm(yo.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},xOe=async t=>{let e=Qyt("sha256");for await(let r of eSt(t))e.update(r);return e.digest("hex")},IOe=async(t,e)=>t.size===e.size&&await xOe(t.path)===await xOe(e.path),MOe=/.. (.+)?\.log$/,tSt=[MOe],rSt=1,OOe=/^<<<<<<<( |$)/m,POe=t=>{let e=t.split(`
|
|
398
|
+
if (condition) { yield value; }`)};import{Buffer as ugt}from"buffer";import{StringDecoder as lgt}from"string_decoder";var WM=(t,e,r)=>{if(r)return;if(t)return{transform:dgt.bind(void 0,new TextEncoder)};let n=new lgt(e);return{transform:fgt.bind(void 0,n),final:pgt.bind(void 0,n)}},dgt=function*(t,e){ugt.isBuffer(e)?yield wu(e):typeof e=="string"?yield t.encode(e):yield e},fgt=function*(t,e){yield Hr(e)?t.write(e):e},pgt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as zxe}from"util";var s8=zxe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),KM=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=hgt}=e[r];for await(let i of n(t))yield*KM(i,e,r+1)},jxe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*mgt(r,Number(e),t)},mgt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*KM(n,r,e+1)},qxe=zxe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),hgt=function*(t){yield t};var a8=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Bxe=(t,e)=>[...e.flatMap(r=>[...rm(r,t,0)]),...SR(t)],rm=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=_gt}=e[r];for(let i of n(t))yield*rm(i,e,r+1)},SR=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*ggt(r,Number(e),t)},ggt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*rm(n,r,e+1)},_gt=function*(t){yield t};var c8=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Gxe(t,s,o),u=tm(e),l=tm(r),d=u?s8.bind(void 0,KM,a):a8.bind(void 0,rm),f=u||l?s8.bind(void 0,jxe,a):a8.bind(void 0,SR),p=u||l?qxe.bind(void 0,a):void 0;return{stream:new ygt({writableObjectMode:n,writableHighWaterMark:Vxe(n),readableObjectMode:i,readableHighWaterMark:Vxe(i),transform(h,_,y){d([h,c,0],this,y)},flush(h){f([c],this,h)},destroy:p})}},YM=(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=Gxe(s,r,a);t=Bxe(c,t)}return t},Gxe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Lxe(n,a)},WM(r,s,n),HM(r,o,n,c),{transform:t,final:e},{transform:Uxe(i,a)},Mxe({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Hxe=(t,e)=>{for(let r of Sgt(t))vgt(t,r,e)},Sgt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),vgt=(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 ${md[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>bgt(a,n));r.input=uR(s)},bgt=(t,e)=>{let r=YM(t,e,"utf8",!0);return Egt(r),uR(r)},Egt=t=>{let e=t.find(r=>typeof r!="string"&&!Hr(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 Rgt,appendFileSync as xgt}from"fs";var ZM=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ry(r,n)&&!_o.has(e)&&wgt(n)&&(t.some(({type:i,value:o})=>i==="native"&&Tgt.has(o))||t.every(({type:i})=>ts.has(i))),wgt=t=>t===1||t===2,Tgt=new Set(["pipe","overlapped"]),Wxe=async(t,e,r,n)=>{for await(let i of t)Agt(e)||Yxe(i,r,n)},Kxe=(t,e,r)=>{for(let n of t)Yxe(n,e,r)},Agt=t=>t._readableState.pipes.length>0,Yxe=(t,e,r)=>{let n=lM(t);dc({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Zxe=({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)=>Igt({result:c,fileDescriptors:t,fdNumber:u,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Igt=({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=XRe(t,o,d),p=wu(f),{stdioItems:m,objectMode:h}=e[r],_=Ogt([p],m,c,n),{serializedResult:y,finalResult:v=y}=Pgt({chunks:_,objectMode:h,encoding:c,lines:u,stripFinalNewline:l,fdNumber:r});Cgt({serializedResult:y,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let T=a[r]?v:void 0;try{return n.error===void 0&&kgt(y,m,i),T}catch(b){return n.error=b,T}},Ogt=(t,e,r,n)=>{try{return YM(t,e,r,!1)}catch(i){return n.error=i,t}},Pgt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:uR(t)};let s=dTe(t,r);return n[o]?{serializedResult:s,finalResult:o8(s,!i[o],e)}:{serializedResult:s}},Cgt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!ZM({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=o8(t,!1,s);try{Kxe(a,e,n)}catch(c){r.error??=c}},kgt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>VM.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?xgt(n,t):(r.add(o),Rgt(n,t))}};var Xxe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ru(e,r,"all")]:Array.isArray(e)?[Ru(t,r,"all"),...e]:Hr(t)&&Hr(e)?m5([t,e]):`${t}${e}`};import{once as u8}from"events";var Jxe=async(t,e)=>{let[r,n]=await Ngt(t);return e.isForcefullyTerminated??=!1,[r,n]},Ngt=async t=>{let[e,r]=await Promise.allSettled([u8(t,"spawn"),u8(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Qxe(t):r.value},Qxe=async t=>{try{return await u8(t,"exit")}catch{return Qxe(t)}},eIe=async t=>{let[e,r]=await t;if(!$gt(e,r)&&l8(e,r))throw new pa;return[e,r]},$gt=(t,e)=>t===void 0&&e===void 0,l8=(t,e)=>t!==0||e!==null;var tIe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Dgt(t,e,r),s=o?.code==="ETIMEDOUT",a=ZRe(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Dgt=(t,e,r)=>t!==void 0?t:l8(e,r)?new pa:void 0;var rIe=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=Lgt(t,e,r),d=zgt({file:n,commandArguments:i,options:u,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:l,startTime:a});return My(d,c,u)},Lgt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=fM(t,e,r),a=Ugt(r),{file:c,commandArguments:u,options:l}=kM(t,e,a);Fgt(l);let d=kxe(l,s);return{file:c,commandArguments:u,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},Ugt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Fgt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&XM("ipcInput"),t&&XM("ipc: true"),r&&XM("detached: true"),n&&XM("cancelSignal")},XM=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},zgt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=jgt({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}=tIe(c,r),{output:m,error:h=u}=Zxe({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),_=m.map((v,T)=>Ru(v,r,T)),y=Ru(Xxe(m,r),r,"all");return Bgt({error:h,exitCode:l,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},jgt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Hxe(o,r);let a=qgt(r);return Mgt(...NM(t,e,a))}catch(a){return Dy({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},qgt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:zM(e)}),Bgt=({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?jM({command:c,escapedCommand:u,stdio:o,all:s,ipcOutput:[],options:a,startTime:l}):yR({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 Pyt}from"events";import{spawn as Cyt}from"child_process";import aIe from"process";import{once as d8,on as Vgt}from"events";var nIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Oy({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:RM(t)}),Ggt({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Ggt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{EM(e,i);let o=pd(t,e,r),s=new AbortController;try{return await Promise.race([Hgt(o,n,s),Wgt(o,r,s),Kgt(o,r,s)])}catch(a){throw Py(t),a}finally{s.abort(),wM(e,i)}},Hgt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await d8(t,"message",{signal:r});return n}for await(let[n]of Vgt(t,"message",{signal:r}))if(e(n))return n},Wgt=async(t,e,{signal:r})=>{await d8(t,"disconnect",{signal:r}),BAe(e)},Kgt=async(t,e,{signal:r})=>{let[n]=await d8(t,"strict:error",{signal:r});throw SM(n,e)};import{once as oIe,on as Ygt}from"events";var sIe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>f8({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),f8=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Oy({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:RM(t)}),EM(e,o);let s=pd(t,e,r),a=new AbortController,c={};return Zgt(t,s,a),Xgt({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Jgt({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Zgt=async(t,e,r)=>{try{await oIe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Xgt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await oIe(t,"strict:error",{signal:r.signal});n.error=SM(i,e),r.abort()}catch{}},Jgt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of Ygt(r,"message",{signal:o.signal}))iIe(s),yield c}catch{iIe(s)}finally{o.abort(),wM(e,a),n||Py(t),i&&await t}},iIe=({error:t})=>{if(t)throw t};var cIe=(t,{ipc:e})=>{Object.assign(t,lIe(t,!1,e))},uIe=()=>{let t=aIe,e=!0,r=aIe.channel!==void 0;return{...lIe(t,e,r),getCancelSignal:gRe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},lIe=(t,e,r)=>({sendMessage:PM.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:nIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:sIe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Qgt}from"child_process";import{PassThrough as e_t,Readable as t_t,Writable as r_t,Duplex as n_t}from"stream";var dIe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{r8(n);let a=new Qgt;i_t(a,n),Object.assign(a,{readable:o_t,writable:s_t,duplex:a_t});let c=Dy({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),u=c_t(c,s,i);return{subprocess:a,promise:u}},i_t=(t,e)=>{let r=vR(),n=vR(),i=vR(),o=Array.from({length:e.length-3},vR),s=vR(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},vR=()=>{let t=new e_t;return t.end(),t},o_t=()=>new t_t({read(){}}),s_t=()=>new r_t({write(){}}),a_t=()=>new n_t({read(){},write(){}}),c_t=async(t,e,r)=>My(t,e,r);import{createReadStream as fIe,createWriteStream as pIe}from"fs";import{Buffer as u_t}from"buffer";import{Readable as bR,Writable as l_t,Duplex as d_t}from"stream";var hIe=(t,e)=>GM(f_t,t,e,!1),ER=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${md[t]}.`)},mIe={fileNumber:ER,generator:c8,asyncGenerator:c8,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:d_t.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},f_t={input:{...mIe,fileUrl:({value:t})=>({stream:fIe(t)}),filePath:({value:{file:t}})=>({stream:fIe(t)}),webStream:({value:t})=>({stream:bR.fromWeb(t)}),iterable:({value:t})=>({stream:bR.from(t)}),asyncIterable:({value:t})=>({stream:bR.from(t)}),string:({value:t})=>({stream:bR.from(t)}),uint8Array:({value:t})=>({stream:bR.from(u_t.from(t))})},output:{...mIe,fileUrl:({value:t})=>({stream:pIe(t)}),filePath:({value:{file:t,append:e}})=>({stream:pIe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:l_t.fromWeb(t)}),iterable:ER,asyncIterable:ER,string:ER,uint8Array:ER}};import{on as p_t,once as gIe}from"events";import{PassThrough as m_t,getDefaultHighWaterMark as h_t}from"stream";import{finished as SIe}from"stream/promises";function nm(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)m8(i);let e=t.some(({readableObjectMode:i})=>i),r=g_t(t,e),n=new p8({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var g_t=(t,e)=>{if(t.length===0)return h_t(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},p8=class extends m_t{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(m8(e),this.#e.has(e))return;this.#e.add(e),this.#n??=__t(this,this.#e,this.#o);let r=v_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(m8(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)}},__t=async(t,e,r)=>{JM(t,_Ie);let n=new AbortController;try{await Promise.race([y_t(t,n),S_t(t,e,r,n)])}finally{n.abort(),JM(t,-_Ie)}},y_t=async(t,{signal:e})=>{try{await SIe(t,{signal:e,cleanup:!0})}catch(r){throw vIe(t,r),r}},S_t=async(t,e,r,{signal:n})=>{for await(let[i]of p_t(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},m8=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},v_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{JM(t,yIe);let a=new AbortController;try{await Promise.race([b_t(o,e,a),E_t({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),w_t({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),JM(t,-yIe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?h8(t):T_t(t))},b_t=async(t,e,{signal:r})=>{try{await t,r.aborted||h8(e)}catch(n){r.aborted||vIe(e,n)}},E_t=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await SIe(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;bIe(s)?i.add(e):EIe(t,s)}},w_t=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await gIe(t,i,{signal:o}),!t.readable)return gIe(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},T_t=t=>{t.writable&&t.end()},vIe=(t,e)=>{bIe(e)?h8(t):EIe(t,e)},bIe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",h8=t=>{(t.readable||t.writable)&&t.destroy()},EIe=(t,e)=>{t.destroyed||(t.once("error",A_t),t.destroy(e))},A_t=()=>{},JM=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},_Ie=2,yIe=1;import{finished as wIe}from"stream/promises";var Uy=(t,e)=>{t.pipe(e),R_t(t,e),x_t(t,e)},R_t=async(t,e)=>{if(!(fa(t)||fa(e))){try{await wIe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}g8(e)}},g8=t=>{t.writable&&t.end()},x_t=async(t,e)=>{if(!(fa(t)||fa(e))){try{await wIe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}_8(t)}},_8=t=>{t.readable&&t.destroy()};var TIe=(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})=>ts.has(c)))I_t(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!ts.has(c)))P_t({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]:nm(o);Uy(s,i)}},I_t=(t,e,r,n)=>{r==="output"?Uy(t.stdio[n],e):Uy(e,t.stdio[n]);let i=O_t[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},O_t=["stdin","stdout","stderr"],P_t=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;C_t(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},C_t=(t,{signal:e})=>{fa(t)&&Qp(t,k_t,e)},k_t=2;import{addAbortListener as D_t}from"events";var im=[];im.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&im.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&im.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var QM=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",y8=Symbol.for("signal-exit emitter"),S8=globalThis,N_t=Object.defineProperty.bind(Object),v8=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(S8[y8])return S8[y8];N_t(S8,y8,{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}},eL=class{},$_t=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),b8=class extends eL{onExit(){return()=>{}}load(){}unload(){}},E8=class extends eL{#e=w8.platform==="win32"?"SIGINT":"SIGHUP";#r=new v8;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of im)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(!QM(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 im)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,im.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 QM(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"&&QM(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)}},w8=globalThis.process,{onExit:AIe,load:Imr,unload:Omr}=$_t(QM(w8)?new E8(w8):new b8);var RIe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=AIe(()=>{t.kill()});D_t(n,()=>{i()})};var IIe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=dM(),{destination:s,destinationStream:a,destinationError:c,from:u,unpipeSignal:l}=M_t(r,n,i),{sourceStream:d,sourceError:f}=U_t(t,u),{options:p,fileDescriptors:m}=pc.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:m,startTime:o}},M_t=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=L_t(t,e,...r),a=bM(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},L_t=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(xIe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||f5(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]=tM(r,...n);return{destination:e(xIe)(i,o,s),pipeOptions:s}}if(pc.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}`)},xIe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),U_t=(t,e)=>{try{return{sourceStream:Cy(t,e)}}catch(r){return{sourceError:r}}};var PIe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=F_t({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw T8({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},F_t=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return _8(t),n;if(e!==void 0)return g8(r),e},T8=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Dy({error:t,command:OIe,escapedCommand:OIe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),OIe="source.pipe(destination)";var CIe=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 z_t}from"stream/promises";var kIe=(t,e,r)=>{let n=tL.has(e)?q_t(t,e):j_t(t,e);return Qp(t,V_t,r.signal),Qp(e,G_t,r.signal),B_t(e),n},j_t=(t,e)=>{let r=nm([t]);return Uy(r,e),tL.set(e,r),r},q_t=(t,e)=>{let r=tL.get(e);return r.add(t),r},B_t=async t=>{try{await z_t(t,{cleanup:!0,readable:!1,writable:!0})}catch{}tL.delete(t)},tL=new WeakMap,V_t=2,G_t=1;import{aborted as H_t}from"util";var NIe=(t,e)=>t===void 0?[]:[W_t(t,e)],W_t=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await H_t(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw T8({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var rL=(t,...e)=>{if(Rr(e[0]))return rL.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=IIe(t,...e),i=K_t({...n,destination:r});return i.pipe=rL.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},K_t=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:u})=>{let l=Y_t(t,i);PIe({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let f=kIe(e,o,d);return await Promise.race([CIe(l),...NIe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{d.abort()}},Y_t=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as ryt}from"timers/promises";import{on as Z_t}from"events";import{getDefaultHighWaterMark as X_t}from"stream";var nL=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return J_t(e,s),DIe({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},J_t=async(t,e)=>{try{await t}catch{}finally{e.abort()}},A8=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Q_t(e,s,t);let a=t.readableObjectMode&&!o;return DIe({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Q_t=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},DIe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Z_t(t,"data",{signal:e.signal,highWaterMark:$Ie,highWatermark:$Ie});return eyt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},R8=X_t(!0),$Ie=R8,eyt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=tyt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*rm(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*SR(a)}},tyt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[WM(t,r,!e),HM(t,i,!n,{})].filter(Boolean);var MIe=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=nyt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:u,streamInfo:l});if(!i){await Promise.all([iyt(t),d]);return}let f=n8(c,r),p=A8({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([oyt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},nyt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!ZM({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=A8({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Wxe(a,t,r,o)},iyt=async t=>{await ryt(),t.readableFlowing===null&&t.resume()},oyt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await LM(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await UM(r,{maxBuffer:o})):await $y(r,{maxBuffer:o})}catch(a){return LIe(WRe({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},x8=async t=>{try{return await t}catch(e){return LIe(e)}},LIe=({bufferedData:t})=>uTe(t)?new Uint8Array(t):t;import{finished as syt}from"stream/promises";var wR=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=ayt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],syt(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||lyt(a,e,r,n)}finally{s.abort()}},ayt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&cyt(t,r,n),n},cyt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{uyt(e,r),n.call(t,...i)}},uyt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},lyt=(t,e,r,n)=>{if(!dyt(t,e,r,n))throw t},dyt=(t,e,r,n=!0)=>r.propagating?UIe(t)||iL(t):(r.propagating=!0,I8(r,e)===n?UIe(t):iL(t)),I8=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",iL=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",UIe=t=>t?.code==="EPIPE";var FIe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,u)=>O8({stream:c,fdNumber:u,encoding:e,buffer:r[u],maxBuffer:n[u],lines:i[u],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),O8=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=wR(t,e,u);if(I8(u,e)){await l;return}let[d]=await Promise.all([MIe({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 zIe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?nm([t,e].filter(Boolean)):void 0,jIe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>O8({...fyt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:pyt(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}},pyt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as myt}from"events";var qIe=t=>Ry(t,"ipc"),BIe=(t,e)=>{let r=lM(t);dc({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var VIe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=qIe(o),a=Tu(e,"ipc"),c=Tu(r,"ipc");for await(let u of f8({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(KRe(t,i,c),i.push(u)),s&&BIe(u,o);return i},GIe=async(t,e)=>(await Promise.allSettled([t]),e);var HIe=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 v=Jxe(t,f),T={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:v,propagating:!1},b=FIe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),E=jIe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:u,verboseInfo:p,streamInfo:T}),S=[],I=VIe({subprocess:t,buffer:r,maxBuffer:n,ipc:l,ipcOutput:S,verboseInfo:p}),P=hyt(h,t,T),O=gyt(m,T);try{return await Promise.race([Promise.all([{},eIe(v),Promise.all(b),E,I,RRe(t,d),...P,...O]),_,_yt(t,y),...bRe(t,o,f,y),...qAe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:y}),...SRe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},v,Promise.all(b.map(A=>x8(A))),x8(E),GIe(I,S),Promise.allSettled(P),Promise.allSettled(O)])}},hyt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:wR(n,i,r)),gyt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ha(o,{checkOpen:!1})&&!fa(o)).map(({type:i,value:o,stream:s=o})=>wR(s,n,e,{isSameDirection:ts.has(i),stopOnExit:i==="native"}))),_yt=async(t,{signal:e})=>{let[r]=await myt(t,"error",{signal:e});throw r};var WIe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),TR=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=fc();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Fy=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 yyt}from"stream";import{callbackify as Syt}from"util";import{finished as KIe}from"stream/promises";var P8=async t=>{if(t!==void 0)try{await C8(t)}catch{}},YIe=async t=>{if(t!==void 0)try{await k8(t)}catch{}},C8=async t=>{await KIe(t,{cleanup:!0,readable:!1,writable:!0})},k8=async t=>{await KIe(t,{cleanup:!0,readable:!0,writable:!1})},oL=async(t,e)=>{if(await t,e)throw e},sL=(t,e,r)=>{r&&!iL(r)?t.destroy(r):e&&t.destroy()};var ZIe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_o.has(r),{subprocessStdout:a,waitReadableDestroy:c}=N8(t,n,e),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=$8(a,s),{read:f,onStdoutDataDone:p}=D8({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new yyt({read:f,destroy:Syt(L8.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:u});return M8({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},N8=(t,e,r)=>{let n=Cy(t,e),i=TR(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},$8=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:R8},D8=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=fc(),s=nL({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){vyt(this,s,o)},onStdoutDataDone:o}},vyt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},M8=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await k8(t),await n,await P8(i),await e,r.readable&&r.push(null)}catch(o){await P8(i),XIe(r,o)}},L8=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Fy(r,e)&&(XIe(t,n),await oL(e,n))},XIe=(t,e)=>{sL(t,t.readable,e)};import{Writable as byt}from"stream";import{callbackify as JIe}from"util";var QIe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=U8(t,r,e),s=new byt({...F8(n,t,i),destroy:JIe(j8.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return z8(n,s),s},U8=(t,e,r)=>{let n=bM(t,e),i=TR(r,n,"writableFinal"),o=TR(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},F8=(t,e,r)=>({write:Eyt.bind(void 0,t),final:JIe(wyt.bind(void 0,t,e,r))}),Eyt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},wyt=async(t,e,r)=>{await Fy(r,e)&&(t.writable&&t.end(),await e)},z8=async(t,e,r)=>{try{await C8(t),e.writable&&e.end()}catch(n){await YIe(r),eOe(e,n)}},j8=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Fy(r,e),await Fy(n,e)&&(eOe(t,i),await oL(e,i))},eOe=(t,e)=>{sL(t,t.writable,e)};import{Duplex as Tyt}from"stream";import{callbackify as Ayt}from"util";var tOe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||_o.has(r),{subprocessStdout:c,waitReadableDestroy:u}=N8(t,n,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=U8(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=$8(c,a),{read:_,onStdoutDataDone:y}=D8({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),v=new Tyt({read:_,...F8(l,t,d),destroy:Ayt(Ryt.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 M8({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:l}),z8(l,v,c),v},Ryt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([L8({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),j8({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var q8=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||_o.has(e),s=Cy(t,r),a=nL({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return xyt(a,s,t)},xyt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var rOe=(t,{encoding:e})=>{let r=WIe();t.readable=ZIe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=QIe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=tOe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=q8.bind(void 0,t,e),t[Symbol.asyncIterator]=q8.bind(void 0,t,e,{})};var nOe=(t,e)=>{for(let[r,n]of Oyt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Iyt=(async()=>{})().constructor.prototype,Oyt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Iyt,t)]);var iOe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=kyt(t,e,r),{subprocess:f,promise:p}=$yt({file:i,commandArguments:o,options:l,startTime:c,verboseInfo:u,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=rL.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),nOe(f,p),pc.set(f,{options:l,fileDescriptors:d}),f},kyt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=fM(t,e,r),{file:a,commandArguments:c,options:u}=kM(t,e,r),l=Nyt(u),d=hIe(l,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:l,fileDescriptors:d}},Nyt=({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}},$yt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Cyt(...NM(t,e,r))}catch(m){return dIe({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let u=new AbortController;Pyt(Number.POSITIVE_INFINITY,u.signal);let l=[...c.stdio];TIe(c,a,u),RIe(c,r,u);let d={},f=fc();c.kill=zAe.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:u}),c.all=zIe(c,r),rOe(c,r),cIe(c,r);let p=Dyt({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}},Dyt=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 HIe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:u,controller:l});l.abort(),u.resolve();let y=m.map((b,E)=>Ru(b,e,E)),v=Ru(h,e,"all"),T=Myt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:v,ipcOutput:_,context:c,options:e,command:s,escapedCommand:a,startTime:r});return My(T,n,e)},Myt=({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?yR({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 mc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:l,isSync:!1}):jM({command:c,escapedCommand:u,stdio:n,all:i,ipcOutput:o,options:a,startTime:l});var aL=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Lyt(n,t[n],i)]));return{...t,...r}},Lyt=(t,e,r)=>Uyt.has(t)&&Rr(e)&&Rr(r)?{...e,...r}:r,Uyt=new Set(["env",...y5]);var hd=(t,e,r,n)=>{let i=(s,a,c)=>hd(s,a,r,c),o=(...s)=>Fyt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Fyt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Rr(o))return i(t,aL(r,o),n);let{file:a,commandArguments:c,options:u,isSync:l}=zyt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return l?rIe(a,c,u):iOe(a,c,u,i)},zyt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hTe(e)?gTe(e,r):[e,...r],[s,a,c]=tM(...o),u=aL(aL(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 oOe=({file:t,commandArguments:e})=>aOe(t,e),sOe=({file:t,commandArguments:e})=>({...aOe(t,e),isSync:!0}),aOe=(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]=jyt(t);return{file:r,commandArguments:n}},jyt=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(qyt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},qyt=/ +/g;var cOe=(t,e,r)=>{t.sync=e(Byt,r),t.s=t.sync},uOe=({options:t})=>lOe(t),Byt=({options:t})=>({...lOe(t),isSync:!0}),lOe=t=>({options:{...Vyt(t),...t}}),Vyt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},dOe={preferLocal:!0};var fOe=hd(()=>({})),y_r=hd(()=>({isSync:!0})),pOe=hd(oOe),S_r=hd(sOe),v_r=hd(wRe),b_r=hd(uOe,{},dOe,cOe),{sendMessage:E_r,getOneMessage:w_r,getEachMessage:T_r,getCancelSignal:A_r}=uIe();var mOe=!1,hOe,Gyt=t=>{hOe??=t},gOe=t=>{mOe=!0,Gyt(t)},Gn=()=>mOe,xu=()=>hOe,_Oe=t=>{switch(t){case"SIGTERM":case"SIGINT":return t;case void 0:return"interrupted";default:return}};var AR=null,yOe=t=>(AR&&AR.destroy(),AR=new rs({totalAllowedTime:t}),AR),SOe=()=>AR;var rs=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&&Gn())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 Sk({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 vOe={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 Yyt=Wyt(import.meta.url),Zyt=Iu.dirname(Yyt),Xyt=Kyt(import.meta.url),zy=ce("shell"),B8=new Set,bOe={preferLocal:!0},Et=(t,e,r)=>{let[n,i]=Jyt(e,r),o={...bOe,...i},s=fOe(t,n,o);wOe(s,o),ROe(s);let a=r?.idleTimeout;return a&&a>0&&AOe(s,a),s},EOe=(t,e)=>{let r={...bOe,...e},n=pOe(t,r);return wOe(n,r),ROe(n),e?.idleTimeout&&e.idleTimeout>0&&AOe(n,e.idleTimeout),n},Jyt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},wOe=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||gc.env.NETLIFY_LOCAL_QUIET==="true")return;if(gc.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new Yw).pipe(gc.stdout),t.stderr?.pipe(new Yw).pipe(gc.stderr);return}t.stdout?.pipe(gc.stdout),t.stderr?.pipe(gc.stderr)},V8=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(gc.kill(-t.pid,e),zy.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return zy.error("Error killing process:",r),!1}},TOe=t=>V8(t,"SIGKILL"),AOe=(t,e)=>{let r=null,n=()=>{zy.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),V8(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(zy.log(`Force killing idle process ${t.pid}`),TOe(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)},ROe=t=>{B8.add(t);let e=SOe();if(e){let r=e.onTimesUp(()=>{zy.log(`Global timer expired, killing process ${t.pid}`),V8(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(zy.log(`Force killing process ${t.pid} after timeout`),TOe(t))},5e3)});t.on("exit",()=>{B8.delete(t),r()}),t.on("error",()=>{B8.delete(t),r()})}};function _c(t,e){if(!gc.env.NETLIFY_LOCAL_MODE)try{let i=Xyt.resolve(vOe.name),o=Iu.dirname(i);for(;o!==Iu.dirname(o);){let s=Iu.dirname(o);if(Iu.basename(s)==="node_modules"){let a=Iu.join(s,".bin",e);if(cL.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(gc.env.NODE_PATH){let i=Iu.join(gc.env.NODE_PATH,".bin",e);if(cL.existsSync(i))return i}let r=Iu.join(t,"node_modules",".bin",e);if(cL.existsSync(r))return r;let n=Iu.join(Zyt,"..","node_modules",".bin",e);if(cL.existsSync(n))return n}var jy=ce("repo"),$Oe="runner-diffs-",G8=t=>`${$Oe}${t}-`,DOe=async t=>{let e=lL.tmpdir(),r;try{r=await Hn.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith($Oe)&&!n.startsWith(G8(t))).map(n=>Hn.rm(yo.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},xOe=async t=>{let e=Qyt("sha256");for await(let r of eSt(t))e.update(r);return e.digest("hex")},IOe=async(t,e)=>t.size===e.size&&await xOe(t.path)===await xOe(e.path),MOe=/.. (.+)?\.log$/,tSt=[MOe],rSt=1,OOe=/^<<<<<<<( |$)/m,POe=t=>{let e=t.split(`
|
|
399
399
|
`).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)},nSt=t=>t instanceof Error&&String(t.stderr??"").includes("No such remote"),COe=t=>{let e=t instanceof Error?t.message:String(t),r=String(t?.stderr??"").trim();return On(r?`${e}: ${r}`:e)},iSt=t=>/Authentication failed|returned error: 401/.test(String(t?.stderr??"")),kOe=t=>t.pathname.replace(/\/+$/,"").replace(/\.git$/,""),oSt=(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&&kOe(n)===kOe(r)&&n.password!==""}catch{return!1}},NOe={stdin:"pipe",stdout:"pipe",stderr:"pipe",stripFinalNewline:!1},uL=500,RR=class extends Error{constructor(r,n){super(n instanceof Error?n.message:String(n));this.step=r;this.cause=n}},Bi=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 Hn.writeFile(await this.getSetupMetadataPath(),JSON.stringify(s)),{rewrittenFileCount:n.rewrittenFileCount}}catch(n){throw new RR(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}){jy.info("Getting runner diffs");let n=await this.hasAgentChanges(),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!r){let u=POe(o);await this.discardSetupOnlyChanges(u)}jy.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 Hn.mkdtemp(yo.join(lL.tmpdir(),G8(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(`
|
|
400
400
|
`).filter(i=>tSt.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 Hn.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(`
|
|
401
401
|
`)})}async stageBuildSetup(){await Hn.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${OOe.source}`,e,"HEAD"],{cwd:r,stdout:"pipe"}),i=String(n??"").split("\0").filter(Boolean),o=[];for(let s of i){let a=await Hn.readFile(yo.join(r,s),"utf8").catch(()=>{});a!==void 0&&!OOe.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 yo.resolve(e,String(r).trim())}),this.setupMetadataPath}async listIndexEntries(e,r){let n=[];for(let i=0;i<e.length;i+=uL){let o=e.slice(i,i+uL).map(a=>`:(literal)${a}`),{stdout:s}=await this.run(["ls-files","--stage","-z","--",...o],{...NOe,...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 Hn.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(`
|
|
@@ -702,7 +702,7 @@ ${v}`:v;if(T.length>5e5&&y){let b=xFe.join(u,`agent-task-context-${mMt()}.md`);a
|
|
|
702
702
|
`)}};var OFe=ce("session_manager"),H7=null;var hMt,W7,gMt=0,_Mt,yMt;var K7=()=>hMt,Y7=()=>H7!==null,PFe=()=>gMt,CFe=()=>yMt,kFe=()=>_Mt,Z7=async(t,e)=>{if(!ze().idleTimeoutEnabled||!t||t===e)return;let r=nb[t];if(r)try{await r.clean(),OFe.info(`Wiped previous agent state (${t}) on switch to ${e}`)}catch(n){OFe.warn(`Failed to clean previous agent ${t} on switch`,{error:n?.message||n})}finally{W7=void 0}},IF=t=>{W7=t};var NFe=t=>{let e=t.previousSession?.nativeSessionId;return!!e&&e===W7},$Fe=async()=>{if(H7)try{await H7}catch{}};var DFe=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 vMt}from"crypto";var Tb=ce("interactions"),MFe="question",LFe="authorization",UFe="setup_request",bMt=["answered","skipped","dismissed"],EMt=({setupRequest:t,authorization:e,questions:r})=>t?{type:UFe,payload:{setup_request_id:t.setupRequestId},category:W.SetupRequest}:e?{type:LFe,payload:{...e},category:W.Authorization}:{type:MFe,payload:r,category:W.Question},X7=async(t,e,r)=>{let{setupRequest:n}=e,i=n?.refId??vMt(),{type:o,payload:s,category:a}=EMt(e);return await qr(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},J7=(t,e,r)=>{if(t.setupRequest){Tb.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){Tb.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;Tb.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)},FFe=async(t,e)=>{try{let r=await _he(t);return{satisfied:r.satisfied,items:r.items??[]}}catch(r){Tb.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}},Q7=async t=>{let e;try{e=await pp(t.id,t.sessionId)}catch(s){return Tb.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),!!bMt.includes(a.status??""))){if(a.type===UFe){let c=a.payload??{};if(!c.setup_request_id)return;let u=await FFe(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===LFe){let c=a.payload??{};n.push({refId:s,questions:[],responses:[],authorization:{service:c.service,granted:a.status==="answered"}});return}a.type===MFe&&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},eee=async(t,e)=>{let r;try{r=await pp(t.id,t.sessionId)}catch(o){return Tb.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 FFe(n.setup_request_id,e.refId);return i?{...e,setupOutcome:i}:e},tee=()=>({counted:!1});var wMt=(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"},ree=t=>{let e=0;t.questions.forEach((r,n)=>{let i=wMt(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)},zFe=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(`
|
|
703
703
|
|
|
704
704
|
`),i=e&&!n?'A "(skipped)" answer means the user chose not to answer; proceed with your best judgment there.':"";return r.length?iPe(r,{skipNote:i,overrideInstruction:n||void 0}):""};var jFe=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(`
|
|
705
|
-
`):""};var TMt="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.",Ab=(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:TMt}).describe(e),Ps=Ae.string().min(1).describe("One sentence, shown to the user next to the field: what you are building and why it needs this."),qFe=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 BFe=Ae.strictObject({kind:Ae.literal("identity_signup_settings"),reason:Ps,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.")})}),VFe=t=>t.kind==="identity_signup_settings";var GFe=Ae.strictObject({kind:Ae.literal("identity_provider"),reason:Ps,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.")}),HFe=t=>t.kind==="identity_provider";var AMt=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."}},RMt=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."}},xMt=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.`}},WFe=t=>t.flatMap(e=>VFe(e)?[AMt(e)]:e.kind==="identity_email_reset"?[RMt(e)]:HFe(e)?[xMt(e)]:[]);var KFe=["production","deploy-preview","branch-deploy","dev"],YFe=["exist","change"],ZFe=Ae.object({kind:Ae.literal("env_var"),reason:Ps,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(YFe).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:Ab(Ae.enum(KFe),"The deploy contexts the task actually needs this in. Do not list contexts the task does not touch.")}),OF=t=>t.kind==="env_var";var XFe=["full_name","email","roles"],JFe=Ae.object({kind:Ae.literal("identity_user"),reason:Ps,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:Ab(Ae.enum(XFe),"The fields the task actually needs changed. Do not list fields the task does not depend on.")}),PF=t=>t.kind==="identity_user";var QFe=["admin_email","host","port","user"],eze=Ae.strictObject({kind:Ae.literal("identity_smtp"),reason:Ps,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:Ab(Ae.enum(QFe),"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.")}),CF=t=>t.kind==="identity_smtp";var tze=Ae.strictObject({kind:Ae.literal("identity_email_reset"),reason:Ps});var IMt=Ae.discriminatedUnion("kind",[ZFe,JFe,eze,BFe,tze,GFe]),OMt={items:qFe(IMt)},O2r=Ae.object(OMt);var nee=t=>t.map(e=>e.name).join(", "),Rb=t=>t.map(e=>`\`${e.name}\``).join(", "),iee="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.",PMt="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.",CMt="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.",kMt="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.",NMt="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.",$Mt=t=>OF(t)||PF(t)||CF(t),DMt=(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 ${nee(r)}.`;let i=e?" The user skipped setting the rest.":"";return`- \`${t.key}\` is now set for ${nee(r)}, but not for ${nee(n)}. Anything that reads it will fail there.${i}`},MMt=(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: ${Rb(r)}.`;let o=e?" The user skipped the rest.":"";return`- ${i} was updated: ${Rb(r)}, but ${Rb(n)} still reads as it did before.${o}`},LMt=(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: ${Rb(r)}.`;let i=e?" The user skipped the rest.":"";return`- Identity outgoing email is now configured: ${Rb(r)}, but ${Rb(n)} still reads as it did before.${i}`},UMt={match:OF,skippedId:t=>t.key,line:(t,e)=>DMt(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:iee,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."]:[]},FMt={match:PF,skippedId:t=>t.user_id,line:(t,e)=>MMt(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:PMt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[NMt]:[]},zMt={match:CF,skippedId:t=>t.kind,line:(t,e)=>LMt(t,e),skippedSummary:()=>"- The user skipped configuring Identity outgoing email. Proceed with the settings as they stand.",leftMissingGuidance:CMt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[kMt]:[]},jMt=[UMt,FMt,zMt],rze=t=>{let e=t.flatMap(({item:i,skipped:o})=>$Mt(i)?[{item:i,skipped:o}]:[]),r=[],n=new Set;for(let i of jMt){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 nze=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=rze(e),i=[...WFe(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(iee)),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(`
|
|
705
|
+
`):""};var TMt="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.",Ab=(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:TMt}).describe(e),Ps=Ae.string().min(1).describe("One sentence, shown to the user next to the field: what you are building and why it needs this."),qFe=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 BFe=Ae.strictObject({kind:Ae.literal("identity_signup_settings"),reason:Ps,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.")})}),VFe=t=>t.kind==="identity_signup_settings";var GFe=Ae.strictObject({kind:Ae.literal("identity_provider"),reason:Ps,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.")}),HFe=t=>t.kind==="identity_provider";var AMt=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."}},RMt=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."}},xMt=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.`}},WFe=t=>t.flatMap(e=>VFe(e)?[AMt(e)]:e.kind==="identity_email_reset"?[RMt(e)]:HFe(e)?[xMt(e)]:[]);var KFe=["production","deploy-preview","branch-deploy","dev"],YFe=["exist","change"],ZFe=Ae.object({kind:Ae.literal("env_var"),reason:Ps,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(YFe).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:Ab(Ae.enum(KFe),"The deploy contexts the task actually needs this in. Do not list contexts the task does not touch.")}),OF=t=>t.kind==="env_var";var XFe=["full_name","email","roles"],JFe=Ae.object({kind:Ae.literal("identity_user"),reason:Ps,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:Ab(Ae.enum(XFe),"The fields the task actually needs changed. Do not list fields the task does not depend on.")}),PF=t=>t.kind==="identity_user";var QFe=["admin_email","host","port","user"],eze=Ae.strictObject({kind:Ae.literal("identity_smtp"),reason:Ps,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:Ab(Ae.enum(QFe),"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.")}),CF=t=>t.kind==="identity_smtp";var tze=Ae.strictObject({kind:Ae.literal("identity_email_reset"),reason:Ps});var IMt=Ae.discriminatedUnion("kind",[ZFe,JFe,eze,BFe,tze,GFe]),OMt={items:qFe(IMt)},O2r=Ae.object(OMt);var nee=t=>t.map(e=>e.name).join(", "),Rb=t=>t.map(e=>`\`${e.name}\``).join(", "),iee="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.",PMt="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.",CMt="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.",kMt="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.",NMt="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.",$Mt=t=>OF(t)||PF(t)||CF(t),DMt=(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 ${nee(r)}.`;let i=e?" The user skipped setting the rest.":"";return`- \`${t.key}\` is now set for ${nee(r)}, but not for ${nee(n)}. Anything that reads it will fail there.${i}`},MMt=(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: ${Rb(r)}.`;let o=e?" The user skipped the rest.":"";return`- ${i} was updated: ${Rb(r)}, but ${Rb(n)} still reads as it did before.${o}`},LMt=(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: ${Rb(r)}.`;let i=e?" The user skipped the rest.":"";return`- Identity outgoing email is now configured: ${Rb(r)}, but ${Rb(n)} still reads as it did before.${i}`},UMt={match:OF,skippedId:t=>t.key,line:(t,e)=>DMt(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:iee,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."]:[]},FMt={match:PF,skippedId:t=>t.user_id,line:(t,e)=>MMt(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:PMt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[NMt]:[]},zMt={match:CF,skippedId:t=>t.kind,line:(t,e)=>LMt(t,e),skippedSummary:()=>"- The user skipped configuring Identity outgoing email. Proceed with the settings as they stand.",leftMissingGuidance:CMt,reportedNotes:t=>t.some(e=>e.targets.some(r=>r.state==="satisfied"))?[kMt]:[]},jMt=[UMt,FMt,zMt],rze=t=>{let e=t.flatMap(({item:i,skipped:o})=>$Mt(i)?[{item:i,skipped:o}]:[]),r=[],n=new Set;for(let i of jMt){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 nze=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=rze(e),i=[...WFe(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(iee)),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
706
|
`))};var ize=(t,e)=>[t,zFe(e),jFe(e),nze(e)].filter(Boolean).join(`
|
|
707
707
|
|
|
708
708
|
`);var qMt=new Set(["claude","codex","opencode","antigravity","muse"]),oze="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.",aze=t=>qMt.has(t),BMt=t=>aze(t)?oze:`<important> ${oze} Here is the full prompt for context: </important>`,VMt=async({buildErrors:t,contextPrefix:e,...r})=>{if(aze(r.config.runner))return IFe({...r,buildErrors:t,contextPrefix:e});let{prompt:n}=await RFe({...r,buildErrorContext:GMt(t)});return{prompt:`${e||""}
|
|
@@ -126,6 +126,6 @@ ${JU}
|
|
|
126
126
|
2. Write or update .netlify/results.md as a standalone summary in past tense: what changed, and what was left unfinished. Assume the reader has no prior context.
|
|
127
127
|
3. ${Ky}
|
|
128
128
|
|
|
129
|
-
${Gy(KU)}`;var HU="NETLIFY_FF_",YU="models",Ne=e=>e==="true"||e==="1",XU=(e,t)=>{let n=Number(e);return Number.isFinite(n)&&n>0?n:t},Cs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Pz=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0,Ez=e=>{if(!e)return{};try{let t=JSON.parse(e);return Cs(t)?t:{}}catch{return{}}},Nz=e=>{let t={};for(let[n,i]of Object.entries(e))Pz(i)&&(t[n]=i);return t},QU=e=>{let t={};for(let[n,i]of Object.entries(Ez(e)))Cs(i)&&(t[n]=Nz(i));return t},e6=e=>{let{[YU]:t,...n}=e,i=Cs(t)?t:{},o=[...new Set([...Object.keys(n),...Object.keys(i)])].map(a=>{let s=n[a],c=i[a];return[a,{agent:Pz(s)?s:void 0,models:Cs(c)?Nz(c):{}}]});return Object.fromEntries(o.filter(([,a])=>a.agent!==void 0||Object.keys(a.models??{}).length>0))},t6=e=>{let t={};for(let[n,i]of Object.entries(Ez(e)))Cs(i)&&(t[n]=e6(i));return t};var Oz=()=>{let e={};for(let[t,n]of Object.entries(WU.env))t.startsWith(HU)&&n!==void 0&&(e[t]=n);return{byokEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_BYOK_ENABLED),idleTimeoutEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_IDLE_TIMEOUT),coldResumeFromS3Enabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_COLD_RESUME_FROM_S3),creditWrapUpEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP),creditWrapUpNormalEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP_NORMAL),creditInterruptEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_INTERRUPT),creditWrapUpReserve:XU(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP_RESERVE,100),creditWrapUpReserveByModeAgentAndModel:t6(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP_RESERVE_PER_MODEL),budgetCreditThresholds:QU(e.NETLIFY_FF_AGENT_RUNNER_BUDGET_CONSTRAINED_CREDIT_THRESHOLDS),warmNativeResumeEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_WARM_NATIVE_RESUME),aiFnV1GuardrailEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_AI_FN_V1_GUARDRAIL),catalogModelDefaultsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CATALOG_MODEL_DEFAULTS),migrationDriftBlocksDeployEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_MIGRATION_DRIFT_BLOCKS_DEPLOY),connectionsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CONNECTIONS_ENABLED),setupRequestsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_SETUP_REQUESTS),identityCapabilitiesAndConfigsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_IDENTITY_CAPABILITIES_AND_CONFIGS),createAskFirstEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREATE_ASK_FIRST),studioExperienceEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_STUDIO_EXPERIENCE),captureLlmContentEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CAPTURE_LLM_CONTENT),skillVariations:Object.entries(e).filter(([t,n])=>t.startsWith("NETLIFY_FF_AGENT_RUNNER_SKILL_")&&Ne(n)).map(([t])=>t.replace("NETLIFY_FF_AGENT_RUNNER_SKILL_","").toLowerCase()),modelVersionOverrides:{codex:e.NETLIFY_FF_AGENT_RUNNER_CODEX_VERSION,claude:e.NETLIFY_FF_AGENT_RUNNER_CLAUDE_VERSION,gemini:e.NETLIFY_FF_AGENT_RUNNER_GEMINI_VERSION,opencode:e.NETLIFY_FF_AGENT_RUNNER_OPENCODE_VERSION,antigravity:e.NETLIFY_FF_AGENT_RUNNER_ANTIGRAVITY_VERSION,muse:e.NETLIFY_FF_AGENT_RUNNER_MUSE_VERSION},opencodeDefaultModel:e.NETLIFY_FF_AGENT_RUNNER_OPENCODE_DEFAULT_MODEL||void 0,antigravityEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_ANTIGRAVITY_ENABLED),museEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_MUSE_ENABLED),repoComplexityEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_REPO_COMPLEXITY),prReviewCommentsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_PR_REVIEW_COMMENTS),raw:e}};import{renameSync as r6,writeFileSync as n6}from"fs";import bf from"process";var Wy=(e,t)=>{let n=`${e}.partial`;n6(n,JSON.stringify(t)),r6(n,e)},Hy=()=>new Promise(()=>{}),Rz=()=>{let e=()=>bf.exit(0);bf.stdin.on("close",e),bf.stdin.on("end",e)},jz=()=>{console.log=console.error,console.info=console.error,console.debug=console.error},Us=(e,t=bf.argv)=>{let n=t.indexOf(e);return n===-1?void 0:t[n+1]};var Br="netlify_interactions";var Zs="request_project_setup",Az="--questions-file",Yy="netlify_connections",Xy="request_service_authorization";var Dz="--runner-id",Cz="--session-id";var Uz="--setup-file",Qy=(e,t)=>`mcp__${e}__${t}`,e_=(e,t)=>`mcp_${e}_${t}`,t_=(e,t)=>`${e}_${t}`,SK=Qy(Br,"ask"),IK=e_(Br,"ask"),zK=t_(Br,"ask"),TK=Qy(Yy,Xy),PK=e_(Yy,Xy),EK=t_(Yy,Xy),NK=Qy(Br,Zs),OK=e_(Br,Zs),RK=t_(Br,Zs);var i6="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.",mo=(e,t)=>D.array(D.object({name:e,required:D.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(n=>n.some(i=>i.required),{message:i6}).describe(t),Pt=D.string().min(1).describe("One sentence, shown to the user next to the field: what you are building and why it needs this."),r_=e=>D.array(e).min(1).max(10).describe("Everything this project is missing for the task. Send them in one call, not one call per item");var Zz=["production","deploy-preview","branch-deploy","dev"],Lz=["exist","change"],n_=D.object({kind:D.literal("env_var"),reason:Pt,key:D.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:D.boolean().default(!0).describe("True for anything that must not be shown again once set: API keys, tokens, passwords."),mode:D.enum(Lz).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:mo(D.enum(Zz),"The deploy contexts the task actually needs this in. Do not list contexts the task does not touch.")});var Mz=e=>{if(!e.some(n=>n.name==="production"&&n.required))return e;let t=e.find(n=>n.name==="deploy-preview");return t?e.map(n=>n===t?{...n,required:!0}:n):[...e,{name:"deploy-preview",required:!0}]},Vz=(e,t)=>({kind:e.kind,reason:e.reason,config:{key:e.key,secret:e.secret,mode:e.mode},targets:Mz(t)});var Fz=["full_name","email","roles"],qz=D.object({kind:D.literal("identity_user"),reason:Pt,user_id:D.string().min(1).describe("The id of the Identity user to change, exactly as Identity returns it."),proposed:D.object({full_name:D.string().min(1).optional(),email:D.string().min(1).optional(),roles:D.array(D.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:mo(D.enum(Fz),"The fields the task actually needs changed. Do not list fields the task does not depend on.")});var Bz=(e,t)=>({kind:e.kind,reason:e.reason,config:{user_id:e.user_id,proposed:e.proposed},targets:t});var Jz=["admin_email","host","port","user"],Kz=D.strictObject({kind:D.literal("identity_smtp"),reason:Pt,proposed:D.strictObject({admin_email:D.string().min(1).optional().describe("The address Identity sends from, e.g. noreply@example.com."),host:D.string().min(1).optional().describe("The SMTP host of the provider, e.g. smtp.sendgrid.net."),port:D.number().int().min(1).max(65535).optional().describe("The SMTP port, e.g. 587."),user:D.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:mo(D.enum(Jz),"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.")});var Gz=(e,t)=>({kind:e.kind,reason:e.reason,config:{proposed:e.proposed},targets:t});var Wz=D.strictObject({kind:D.literal("identity_signup_settings"),reason:Pt,proposed:D.strictObject({disable_signup:D.boolean().describe("True for invite-only registration; false to allow visitors to sign up."),autoconfirm:D.boolean().describe("True to allow login without email confirmation; false to require it.")})});var Hz=e=>({kind:e.kind,reason:e.reason,config:{proposed:e.proposed}});var Yz=D.strictObject({kind:D.literal("identity_email_reset"),reason:Pt}),Xz=e=>({kind:e.kind,reason:e.reason,config:{}});var Qz=D.strictObject({kind:D.literal("identity_provider"),reason:Pt,provider:D.enum(["google","github","gitlab","bitbucket"]),operation:D.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.")});var e0=e=>({kind:e.kind,reason:e.reason,config:{provider:e.provider,operation:e.operation}});var t0=D.discriminatedUnion("kind",[n_,qz,Kz,Wz,Yz,Qz]),o6={items:r_(t0)},f3=D.object(o6),r0=e=>({items:r_(e?t0:D.discriminatedUnion("kind",[n_]))}),a6=e=>e?'an environment variable (`kind: "env_var"`), or a detail on one of its Identity users (`kind: "identity_user"`, for a name, email or roles the task depends on), or the Identity outgoing email settings (`kind: "identity_smtp"`, for the address Identity sends from and the SMTP server it sends through), or approval to change Identity signup settings (`kind: "identity_signup_settings"`, for signup and email confirmation), or to restore default Identity email delivery (`kind: "identity_email_reset"`), or to enable, remove, or switch an Identity login provider to Netlify defaults (`kind: "identity_provider"`)':'an environment variable (`kind: "env_var"`)',s6=e=>e?" For Identity outgoing email, propose every setting you can work out \u2014 the sender address, and the host, port and username of the SMTP provider \u2014 and target only the ones the task depends on. There is no password field: the user supplies the SMTP password themselves and it never reaches you, so do not ask for it, propose one, or send the user anywhere else to set it. The run resumes once they save, and a setting reads as configured because they changed it, not because it matches what you proposed.":"",c6=e=>e?" For Identity signup settings approvals, read the current Identity settings first and propose both booleans, preserving any setting the task does not need changed. Explain why approval is needed. Do not include targets or current settings. Netlify applies the proposed change after the user approves; do not apply it yourself. After resuming, use the reported outcome to check whether the change solved the task. For `identity_email_reset`, send only kind and reason. Netlify shows the custom SMTP server and sender that will be removed, including any loss of the exception for existing custom SMTP settings on an ineligible plan. Do not request, read, or send SMTP credentials. Netlify resets delivery only after approval and verifies the result. For `identity_provider`, send kind, reason, provider and operation. Enable and remove preserve stored credentials. Use `use_defaults` only when the user intends to remove custom credentials and enable Netlify defaults; this is a separate displayed change requiring approval. Never request, read, or send provider secrets. New custom credentials require secure guided input, not this operation. Netlify checks provider availability and resolved capabilities, applies only the approved change, and reads back the result. Do not apply the change yourself or claim login was tested from configuration readback alone.":"",n0=e=>`Ask the user to configure something this project needs: ${a6(e)}. Check what is already configured first with the \`netlify\` CLI, then raise only what is genuinely missing or wrong. For environment variables, use \`mode: "exist"\` when any configured value will do, \`mode: "change"\` when a value is set but is wrong for this task. If nothing needs setting, nothing is asked of the user and nothing is configured: this returns straight away and you continue on the values already there. If something does, your run pauses while the user supplies it and then resumes automatically, so do not design around the gap or leave the work unfinished. Never end a run by telling the user to go and set something up themselves: raise it here instead, while the run can still act on it. Do NOT ask the user to supply values you can derive, generate, or read from the repo, or for a variable the code does not read. For a service that is not connected, use \`request_service_authorization\`.`+s6(e)+c6(e),i0=e=>{let t=e.items.filter(c=>c.kind==="env_var"),n=e.items.filter(c=>c.kind==="identity_user"),i=e.items.filter(c=>c.kind==="identity_signup_settings"),r=e.items.filter(c=>c.kind==="identity_email_reset"),o=e.items.filter(c=>c.kind==="identity_provider"),a=[...i.map(()=>"Identity signup settings already matched the proposal"),...r.map(()=>"Identity outgoing email already used Netlify defaults"),...o.map(({provider:c})=>`Identity provider ${c} already matched the requested change`),t.length?`${t.map(({key:c})=>`\`${c}\``).join(", ")} already had a value in every context you asked about`:"",...n.map(({user_id:c,targets:u})=>`the Identity user \`${c}\` already had the ${u.map(({name:l})=>`\`${l}\``).join(", ")} you proposed`)].filter(Boolean),s=t.length?' If they told you a value was missing, say plainly that it is still set, because they are working from something that is not true of this project. If an existing value is the one that needs replacing, raise it again with mode: "change", which is satisfied only once they replace it.':"";return`Nothing was asked of the user and nothing changed: ${a.join("; ")}, and this run is continuing on what is already there. Do not tell the user you requested anything, or that any of it is now set or configured.`+s},u6={env_var:Vz,identity_user:Bz,identity_smtp:Gz},l6={identity_signup_settings:Hz,identity_email_reset:Xz,identity_provider:e0},d6=e=>{if(!("targets"in e)){let i=l6[e.kind];return i(e)}let t=e.targets.map(({name:i,required:r})=>({name:i,required:r})),n=u6[e.kind];return n(e,t)},o0=(e,{interactionRefId:t,runnerId:n,sessionId:i})=>({requester_kind:"agent_run",agent_runner_id:n,agent_runner_session_id:i,interaction_ref_id:t,items:e.items.map(d6)});var i_=new mf({name:Br,version:"1.0.0"}),a0=Us(Az),s0=Us(Uz),c0=Us(Dz),u0=Us(Cz),l0=ho.env.NETLIFY_SITE_ID||ho.env.SITE_ID,m6=(e,t)=>{ho.stderr.write(`[interactions-mcp] ${e}${t?` ${JSON.stringify(t)}`:""}
|
|
129
|
+
${Gy(KU)}`;var HU="NETLIFY_FF_",YU="models",Ne=e=>e==="true"||e==="1",XU=(e,t)=>{let n=Number(e);return Number.isFinite(n)&&n>0?n:t},Cs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Pz=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0,Ez=e=>{if(!e)return{};try{let t=JSON.parse(e);return Cs(t)?t:{}}catch{return{}}},Nz=e=>{let t={};for(let[n,i]of Object.entries(e))Pz(i)&&(t[n]=i);return t},QU=e=>{let t={};for(let[n,i]of Object.entries(Ez(e)))Cs(i)&&(t[n]=Nz(i));return t},e6=e=>{let{[YU]:t,...n}=e,i=Cs(t)?t:{},o=[...new Set([...Object.keys(n),...Object.keys(i)])].map(a=>{let s=n[a],c=i[a];return[a,{agent:Pz(s)?s:void 0,models:Cs(c)?Nz(c):{}}]});return Object.fromEntries(o.filter(([,a])=>a.agent!==void 0||Object.keys(a.models??{}).length>0))},t6=e=>{let t={};for(let[n,i]of Object.entries(Ez(e)))Cs(i)&&(t[n]=e6(i));return t};var Oz=()=>{let e={};for(let[t,n]of Object.entries(WU.env))t.startsWith(HU)&&n!==void 0&&(e[t]=n);return{byokEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_BYOK_ENABLED),idleTimeoutEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_IDLE_TIMEOUT),coldResumeFromS3Enabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_COLD_RESUME_FROM_S3),creditWrapUpEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP),creditWrapUpNormalEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP_NORMAL),creditInterruptEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_INTERRUPT),creditWrapUpReserve:XU(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP_RESERVE,100),creditWrapUpReserveByModeAgentAndModel:t6(e.NETLIFY_FF_AGENT_RUNNER_CREDIT_WRAPUP_RESERVE_PER_MODEL),budgetCreditThresholds:QU(e.NETLIFY_FF_AGENT_RUNNER_BUDGET_CONSTRAINED_CREDIT_THRESHOLDS),warmNativeResumeEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_WARM_NATIVE_RESUME),aiFnV1GuardrailEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_AI_FN_V1_GUARDRAIL),catalogModelDefaultsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CATALOG_MODEL_DEFAULTS),migrationDriftBlocksDeployEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_MIGRATION_DRIFT_BLOCKS_DEPLOY),connectionsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CONNECTIONS_ENABLED),setupRequestsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_SETUP_REQUESTS),identityCapabilitiesAndConfigsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_IDENTITY_CAPABILITIES_AND_CONFIGS),createAskFirstEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CREATE_ASK_FIRST),studioExperienceEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_STUDIO_EXPERIENCE),captureLlmContentEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_CAPTURE_LLM_CONTENT),skillVariations:Object.entries(e).filter(([t,n])=>t.startsWith("NETLIFY_FF_AGENT_RUNNER_SKILL_")&&Ne(n)).map(([t])=>t.replace("NETLIFY_FF_AGENT_RUNNER_SKILL_","").toLowerCase()),modelVersionOverrides:{codex:e.NETLIFY_FF_AGENT_RUNNER_CODEX_VERSION,claude:e.NETLIFY_FF_AGENT_RUNNER_CLAUDE_VERSION,gemini:e.NETLIFY_FF_AGENT_RUNNER_GEMINI_VERSION,opencode:e.NETLIFY_FF_AGENT_RUNNER_OPENCODE_VERSION,antigravity:e.NETLIFY_FF_AGENT_RUNNER_ANTIGRAVITY_VERSION,muse:e.NETLIFY_FF_AGENT_RUNNER_MUSE_VERSION},opencodeDefaultModel:e.NETLIFY_FF_AGENT_RUNNER_OPENCODE_DEFAULT_MODEL||void 0,antigravityEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_ANTIGRAVITY_ENABLED),museEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_MUSE_ENABLED),repoComplexityEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_REPO_COMPLEXITY),prReviewCommentsEnabled:Ne(e.NETLIFY_FF_AGENT_RUNNER_PR_REVIEW_COMMENTS),raw:e}};import{renameSync as r6,writeFileSync as n6}from"fs";import bf from"process";var Wy=(e,t)=>{let n=`${e}.partial`;n6(n,JSON.stringify(t)),r6(n,e)},Hy=()=>new Promise(()=>{}),Rz=()=>{let e=()=>bf.exit(0);bf.stdin.on("close",e),bf.stdin.on("end",e)},jz=()=>{console.log=console.error,console.info=console.error,console.debug=console.error},Us=(e,t=bf.argv)=>{let n=t.indexOf(e);return n===-1?void 0:t[n+1]};var Br="netlify_interactions";var Zs="request_project_setup",Az="--questions-file",Yy="netlify_connections",Xy="request_service_authorization";var Dz="--runner-id",Cz="--session-id";var Uz="--setup-file",Qy=(e,t)=>`mcp__${e}__${t}`,e_=(e,t)=>`mcp_${e}_${t}`,t_=(e,t)=>`${e}_${t}`,SK=Qy(Br,"ask"),IK=e_(Br,"ask"),zK=t_(Br,"ask"),TK=Qy(Yy,Xy),PK=e_(Yy,Xy),EK=t_(Yy,Xy),NK=Qy(Br,Zs),OK=e_(Br,Zs),RK=t_(Br,Zs);var i6="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.",mo=(e,t)=>D.array(D.object({name:e,required:D.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(n=>n.some(i=>i.required),{message:i6}).describe(t),Pt=D.string().min(1).describe("One sentence, shown to the user next to the field: what you are building and why it needs this."),r_=e=>D.array(e).min(1).max(10).describe("Everything this project is missing for the task. Send them in one call, not one call per item");var Zz=["production","deploy-preview","branch-deploy","dev"],Lz=["exist","change"],n_=D.object({kind:D.literal("env_var"),reason:Pt,key:D.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:D.boolean().default(!0).describe("True for anything that must not be shown again once set: API keys, tokens, passwords."),mode:D.enum(Lz).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:mo(D.enum(Zz),"The deploy contexts the task actually needs this in. Do not list contexts the task does not touch.")});var Mz=e=>{if(!e.some(n=>n.name==="production"&&n.required))return e;let t=e.find(n=>n.name==="deploy-preview");return t?e.map(n=>n===t?{...n,required:!0}:n):[...e,{name:"deploy-preview",required:!0}]},Vz=(e,t)=>({kind:e.kind,reason:e.reason,config:{key:e.key,secret:e.secret,mode:e.mode},targets:Mz(t)});var Fz=["full_name","email","roles"],qz=D.object({kind:D.literal("identity_user"),reason:Pt,user_id:D.string().min(1).describe("The id of the Identity user to change, exactly as Identity returns it."),proposed:D.object({full_name:D.string().min(1).optional(),email:D.string().min(1).optional(),roles:D.array(D.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:mo(D.enum(Fz),"The fields the task actually needs changed. Do not list fields the task does not depend on.")});var Bz=(e,t)=>({kind:e.kind,reason:e.reason,config:{user_id:e.user_id,proposed:e.proposed},targets:t});var Jz=["admin_email","host","port","user"],Kz=D.strictObject({kind:D.literal("identity_smtp"),reason:Pt,proposed:D.strictObject({admin_email:D.string().min(1).optional().describe("The address Identity sends from, e.g. noreply@example.com."),host:D.string().min(1).optional().describe("The SMTP host of the provider, e.g. smtp.sendgrid.net."),port:D.number().int().min(1).max(65535).optional().describe("The SMTP port, e.g. 587."),user:D.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:mo(D.enum(Jz),"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.")});var Gz=(e,t)=>({kind:e.kind,reason:e.reason,config:{proposed:e.proposed},targets:t});var Wz=D.strictObject({kind:D.literal("identity_signup_settings"),reason:Pt,proposed:D.strictObject({disable_signup:D.boolean().describe("True for invite-only registration; false to allow visitors to sign up."),autoconfirm:D.boolean().describe("True to allow login without email confirmation; false to require it.")})});var Hz=e=>({kind:e.kind,reason:e.reason,config:{proposed:e.proposed}});var Yz=D.strictObject({kind:D.literal("identity_email_reset"),reason:Pt}),Xz=e=>({kind:e.kind,reason:e.reason,config:{}});var Qz=D.strictObject({kind:D.literal("identity_provider"),reason:Pt,provider:D.enum(["google","github","gitlab","bitbucket"]),operation:D.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.")});var e0=e=>({kind:e.kind,reason:e.reason,config:{provider:e.provider,operation:e.operation}});var t0=D.discriminatedUnion("kind",[n_,qz,Kz,Wz,Yz,Qz]),o6={items:r_(t0)},f3=D.object(o6),r0=e=>({items:r_(e?t0:D.discriminatedUnion("kind",[n_]))}),a6=e=>e?'an environment variable (`kind: "env_var"`), or a detail on one of its Identity users (`kind: "identity_user"`, for a name, email or roles the task depends on), or the Identity outgoing email settings (`kind: "identity_smtp"`, for the address Identity sends from and the SMTP server it sends through), or approval to change Identity signup settings (`kind: "identity_signup_settings"`, for signup and email confirmation), or to restore default Identity email delivery (`kind: "identity_email_reset"`), or to enable, remove, or switch an Identity login provider to Netlify defaults (`kind: "identity_provider"`)':'an environment variable (`kind: "env_var"`)',s6=e=>e?" For Identity outgoing email, the `netlify` CLI cannot read the current settings: check them with `GET /api/v1/sites/$SITE_ID/services/identity/instances/$IDENTITY_ID` (the project's `identity_instance_id`), where they are at `config.config.smtp`. Propose every setting you can work out \u2014 the sender address, and the host, port and username of the SMTP provider \u2014 and target only the ones the task depends on. There is no password field: the user supplies the SMTP password themselves and it never reaches you, so do not ask for it, propose one, or send the user anywhere else to set it. The run resumes once they save, and a setting reads as configured because they changed it, not because it matches what you proposed.":"",c6=e=>e?" For Identity signup settings approvals, read the current Identity settings first and propose both booleans, preserving any setting the task does not need changed. Explain why approval is needed. Do not include targets or current settings. Netlify applies the proposed change after the user approves; do not apply it yourself. After resuming, use the reported outcome to check whether the change solved the task. For `identity_email_reset`, send only kind and reason. Netlify shows the custom SMTP server and sender that will be removed, including any loss of the exception for existing custom SMTP settings on an ineligible plan. Do not request, read, or send SMTP credentials. Netlify resets delivery only after approval and verifies the result. For `identity_provider`, send kind, reason, provider and operation. Enable and remove preserve stored credentials. Use `use_defaults` only when the user intends to remove custom credentials and enable Netlify defaults; this is a separate displayed change requiring approval. Never request, read, or send provider secrets. New custom credentials require secure guided input, not this operation. Netlify checks provider availability and resolved capabilities, applies only the approved change, and reads back the result. Do not apply the change yourself or claim login was tested from configuration readback alone.":"",n0=e=>`Ask the user to configure something this project needs: ${a6(e)}. Check what is already configured first with the \`netlify\` CLI, then raise only what is genuinely missing or wrong. For environment variables, use \`mode: "exist"\` when any configured value will do, \`mode: "change"\` when a value is set but is wrong for this task. If nothing needs setting, nothing is asked of the user and nothing is configured: this returns straight away and you continue on the values already there. If something does, your run pauses while the user supplies it and then resumes automatically, so do not design around the gap or leave the work unfinished. Never end a run by telling the user to go and set something up themselves: raise it here instead, while the run can still act on it. Do NOT ask the user to supply values you can derive, generate, or read from the repo, or for a variable the code does not read. For a service that is not connected, use \`request_service_authorization\`.`+s6(e)+c6(e),i0=e=>{let t=e.items.filter(c=>c.kind==="env_var"),n=e.items.filter(c=>c.kind==="identity_user"),i=e.items.filter(c=>c.kind==="identity_signup_settings"),r=e.items.filter(c=>c.kind==="identity_email_reset"),o=e.items.filter(c=>c.kind==="identity_provider"),a=[...i.map(()=>"Identity signup settings already matched the proposal"),...r.map(()=>"Identity outgoing email already used Netlify defaults"),...o.map(({provider:c})=>`Identity provider ${c} already matched the requested change`),t.length?`${t.map(({key:c})=>`\`${c}\``).join(", ")} already had a value in every context you asked about`:"",...n.map(({user_id:c,targets:u})=>`the Identity user \`${c}\` already had the ${u.map(({name:l})=>`\`${l}\``).join(", ")} you proposed`)].filter(Boolean),s=t.length?' If they told you a value was missing, say plainly that it is still set, because they are working from something that is not true of this project. If an existing value is the one that needs replacing, raise it again with mode: "change", which is satisfied only once they replace it.':"";return`Nothing was asked of the user and nothing changed: ${a.join("; ")}, and this run is continuing on what is already there. Do not tell the user you requested anything, or that any of it is now set or configured.`+s},u6={env_var:Vz,identity_user:Bz,identity_smtp:Gz},l6={identity_signup_settings:Hz,identity_email_reset:Xz,identity_provider:e0},d6=e=>{if(!("targets"in e)){let i=l6[e.kind];return i(e)}let t=e.targets.map(({name:i,required:r})=>({name:i,required:r})),n=u6[e.kind];return n(e,t)},o0=(e,{interactionRefId:t,runnerId:n,sessionId:i})=>({requester_kind:"agent_run",agent_runner_id:n,agent_runner_session_id:i,interaction_ref_id:t,items:e.items.map(d6)});var i_=new mf({name:Br,version:"1.0.0"}),a0=Us(Az),s0=Us(Uz),c0=Us(Dz),u0=Us(Cz),l0=ho.env.NETLIFY_SITE_ID||ho.env.SITE_ID,m6=(e,t)=>{ho.stderr.write(`[interactions-mcp] ${e}${t?` ${JSON.stringify(t)}`:""}
|
|
130
130
|
`)};jz();wz({constants:{NETLIFY_API_HOST:ho.env.NETLIFY_API_HOST||"api.netlify.com",NETLIFY_API_TOKEN:ho.env.NETLIFY_AUTH_TOKEN||ho.env.NETLIFY_API_TOKEN}});i_.registerTool("ask",{description:zz,inputSchema:By},e=>(a0&&Wy(a0,e),Hy()));var xf=(e,t=!1)=>({content:[{type:"text",text:e}],...t?{isError:!0}:{}});if(s0){let{identityCapabilitiesAndConfigsEnabled:e}=Oz();i_.registerTool(Zs,{description:n0(e),inputSchema:r0(e)},async t=>{if(!l0)return xf("No project id available, so this project cannot be checked.",!0);let n=p6(),i;try{i=await Sz(l0,o0(t,{interactionRefId:n,runnerId:c0,sessionId:u0}),c0,u0)}catch(o){return xf(`Could not raise the setup request: ${o?.message}`,!0)}if(m6("setup request created",{id:i?.id,satisfied:i?.satisfied,items:t.items.length}),i?.satisfied)return xf(i0(t));let r=String(i?.id??"");return r?(Wy(s0,{refId:n,setupRequestId:r}),Hy()):xf("Could not raise the setup request: the API returned no request id.",!0)})}Rz();await i_.connect(new gf);
|
|
131
131
|
//# sourceMappingURL=interactions-mcp-server.js.map
|
|
@@ -313,6 +313,24 @@ Replace the example path with the installed location of this skill. The script c
|
|
|
313
313
|
Identity enablement before deploying. Do not ask the user to enable Identity in the Netlify UI. Registration settings,
|
|
314
314
|
external providers, and other Identity configuration can still be managed in the dashboard.
|
|
315
315
|
|
|
316
|
+
### Read the project's Identity configuration
|
|
317
|
+
|
|
318
|
+
You can read the project's Identity settings — registration preferences, external providers, email templates and the
|
|
319
|
+
outgoing email (SMTP) settings — through the service-instance route. Read `$IDENTITY_ID` as described below, then:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
curl -s -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
|
|
323
|
+
"https://api.netlify.com/api/v1/sites/$SITE_ID/services/identity/instances/$IDENTITY_ID"
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
The settings are under `config.config`; outgoing email is at `config.config.smtp` (`admin_email`, `host`, `port`,
|
|
327
|
+
`user`). Secrets are filtered out of this response: the SMTP password is never returned, so you cannot check whether one
|
|
328
|
+
is set or whether it is correct. Use this read to find out what is already configured instead of raising a setup request
|
|
329
|
+
to discover it.
|
|
330
|
+
|
|
331
|
+
Note the route: `/services/identity/instances/$IDENTITY_ID`, not `/identity/$IDENTITY_ID`. The latter is the
|
|
332
|
+
administration endpoint and returns 401 for you.
|
|
333
|
+
|
|
316
334
|
### Look up one user's account
|
|
317
335
|
|
|
318
336
|
When the user reports that a specific person can't sign up or log in, read that person's Identity account with the
|
package/package.json
CHANGED