@maiaos/node 0.1.0-canary.69 → 0.1.0-canary.70
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.
|
@@ -235,7 +235,7 @@ DO UPDATE SET count = count + excluded.count`,Rmo="DELETE FROM integration_autho
|
|
|
235
235
|
plan_bytes, created_at, created_at_ms, expires_at, expires_at_ms
|
|
236
236
|
) VALUES (?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(...n)},fho=(e,t)=>{let r=QW(e,t);if(r!==void 0)return r;throw f("storage_corrupt","The integration plan was not persisted.")},hho=(e,t)=>{let r=`integration.plan.${t.integration}`,n=lho(t),o=QW(e,n.planId);if(o!==void 0)return uho(o,n),{method:r,plan:wxe(o,t.integration)};mho(e,t.recordedAt,n);let i=fho(e,n.planId);return{method:r,plan:wxe(i,t.integration)}},Elt=(e,t)=>Ky(e,{...t,method:`integration.plan.${t.integration}`},()=>hho(e,t)),_lt=(e,t)=>{let r=wp(t.planId,"The integration plan identifier"),n=QW(e,r);if(n?.integration===t.integration)return wxe(n,t.integration)}});var t$=q(()=>{"use strict";aTr();YW();pTr();hTr();HT();clt()});import{lstat as gho,realpath as yho}from"node:fs/promises";var gTr,yTr,Dxe,STr=q(()=>{"use strict";F();G();gTr=()=>f("repository_invalid","The repository authority changed at the process launch boundary."),yTr=s.fn("ProcessResourceManager.verifyDirectory")(function*(e,t){let[r,n]=yield*s.tryPromise({catch:gTr,try:()=>Promise.all([yho(e),gho(e,{bigint:!0})])}),o=typeof process.getuid!="function"||n.uid===BigInt(process.getuid());if(r!==e||!n.isDirectory()||n.isSymbolicLink()||!o||n.dev!==BigInt(t.device)||n.ino!==BigInt(t.inode))return yield*s.fail(gTr())}),Dxe=s.fn("ProcessResourceManager.verifyLaunchAuthority")(function*(e){if(e.owner.kind!=="interactive-terminal"&&e.owner.kind!=="execution-command")return;let t=e.repositoryAuthority;if(e.workingDirectory!==t?.rootPath)return yield*s.fail(f("repository_invalid","The managed process repository authority is unavailable."));yield*yTr(t.rootPath,{device:t.rootDevice,inode:t.rootInode}),yield*yTr(t.gitCommonDirectory,{device:t.gitCommonDevice,inode:t.gitCommonInode})})});import{userInfo as Sho}from"node:os";var Eho,_ho,vTr,ETr,Rho,_Tr,vho,RTr,Tho,Rlt,W8,$8,vlt=q(()=>{"use strict";Zi();F();G();Eho=16,_ho=2,vTr=(e,t)=>{if(e.uid!==t.uid&&e.uid!==0)return"foreign_owner";if((e.mode&_ho)!==0)return"writable_by_others";if((e.mode&Eho)!==0)return e.gid===t.privateGroupId?void 0:"writable_by_others"},ETr=e=>e.split(`
|
|
237
237
|
`).filter(t=>t.length>0).map(t=>t.split(":")),Rho=/^\d+$/u,_Tr=(e,t)=>e!==void 0&&Rho.test(e)&&Number(e)===t,vho=e=>{if(e.user.length===0)return;let t=ETr(e.group).filter(i=>_Tr(i[2],e.gid)),r=t[0],n=r?.[3]??"";return t.length!==1||r?.[0]!==e.user||n!==""&&n!==e.user||ETr(e.passwd).some(i=>_Tr(i[3],e.gid)&&i[0]!==e.user)?void 0:e.gid},RTr=(e,t)=>e.readFileString(t).pipe(s.option),Tho=s.fnUntraced(function*(e){let t=yield*s.try(()=>Sho().username).pipe(s.option),r=yield*ve.FileSystem,n=yield*RTr(r,"/etc/passwd"),o=yield*RTr(r,"/etc/group");if(B.isNone(t)||B.isNone(n)||B.isNone(o))return{};let i=vho({gid:e,group:o.value,passwd:n.value,user:t.value});return i===void 0?{}:{privateGroupId:i}}),Rlt=s.gen(function*(){if(typeof process.geteuid!="function"||typeof process.getegid!="function")return yield*s.fail(f("configuration_invalid","The vouch policy needs POSIX user ids, which this platform lacks."));let e=process.geteuid();return{...yield*Tho(process.getegid()),uid:e}}).pipe(s.provide(_r)),W8=["private_gid() {",' [ -n "$3" ] && [ -n "$4" ] || return 1',` u="$3" g="$4" awk -F: '$3 ~ /^[0-9]+$/ && $3 == ENVIRON["g"] + 0 { n++; if ($1 != ENVIRON["u"] "" || ($4 != "" && $4 != ENVIRON["u"] "")) bad = 1 } END { exit (n == 1 && !bad) ? 0 : 1 }' "$2" || return 1`,` u="$3" g="$4" awk -F: '$4 ~ /^[0-9]+$/ && $4 == ENVIRON["g"] + 0 && $1 != ENVIRON["u"] "" { bad = 1 } END { exit bad ? 1 : 0 }' "$1" || return 1`,` printf '%s' "$4"`,"}"].join(`
|
|
238
|
-
`),$8='user_writes_only() { { [ "$1" = "$uid" ] || [ "$1" = 0 ]; } && [ $(( 0$3 & 002 )) -eq 0 ] && { [ $(( 0$3 & 020 )) -eq 0 ] || { [ -n "$upg" ] && [ "$2" = "$upg" ]; }; }; }'});import{createHash as Iho,timingSafeEqual as xho}from"node:crypto";import{closeSync as Aho,constants as z8,fstatSync as xTr,lstatSync as bho,openSync as Cho,statfsSync as kho}from"node:fs";import{lstat as Mxe,open as ATr}from"node:fs/promises";import{isAbsolute as Tlt,resolve as Ilt}from"node:path";var who,Nho,bTr,Pho,Oho,Lho,CTr,TTr,Uxe,BT,kTr,pL,Dho,Mho,Uho,Fho,G8,Hho,Bho,qho,jho,Who,xlt,$ho,ITr,zho,Gho,wTr,Alt,NTr,Vho,Kho,PTr,Xho,Jho,OTr,Yho,Zho,Qho,ego,tgo,rgo,ngo,Xy,LTr,ogo,igo,V8,K8,Fxe,DTr=q(()=>{"use strict";Z();F();G();vlt();who=256*1024*1024,Nho=64*1024,bTr=/^[0-9a-f]{64}$/u,Pho=64,Oho=4095,Lho=new Set([ge.claudeCode,ge.maiaAgent,ge.pi,"codex"]),CTr=e=>{switch(e){case ge.claudeCode:return["claude-code-session"];case ge.maiaAgent:return["maia-agent-session"];case ge.pi:return["pi-session"];case"codex":return["codex-probe","codex-session"];case"pi-rpc":return["pi-rpc-probe","pi-rpc-session"];case"skills":return["skills-listing"];case"git":case"security":case"systemd-creds":case"terminal":return[]}},TTr="skills-listing-1",Uxe=e=>({adapter:"skills",adapterVersion:e.version,executablePath:e.interpreterPath,ownerKinds:["skills-listing"],sandboxPolicyRevision:TTr,sha256:e.interpreterSha256,vouchPolicyRevision:TTr}),BT=()=>f("transport_failed","The requested executable is not admitted by the vouch policy."),kTr=e=>({changedAtNanoseconds:e.ctimeNs,device:e.dev,inode:e.ino,modifiedAtNanoseconds:e.mtimeNs,size:e.size}),pL=(e,t)=>e.ctimeNs===t.changedAtNanoseconds&&e.dev===t.device&&e.ino===t.inode&&e.mtimeNs===t.modifiedAtNanoseconds&&e.size===t.size,Dho=e=>e.uid===0n?e.nlink>0n:e.nlink===1n,Mho=e=>`0${(Number(e.mode)&Oho).toString(8)}`,Uho=({adapter:e,path:t},r)=>{if(r.isSymbolicLink())return`${t}: a symbolic link; fix: approve the file it points to.`;if(!r.isFile())return`${t}: not a regular file.`;if(r.size===0n)return`${t}: an empty file.`;if(!Lho.has(e)&&r.size>BigInt(who))return`${t}: ${r.size.toString()} bytes, over the 256 MiB limit.`},Fho=(e,t,r)=>{let n=Uho(e,t);if(n!==void 0)return n;let{path:o}=e,i=Mho(t),a=vTr({gid:Number(t.gid),mode:Number(t.mode),uid:Number(t.uid)},r);if(a==="foreign_owner")return`${o}: mode ${i}, owner uid ${t.uid.toString()}, not this user (${String(r.uid)}) or root; fix: install it as this user.`;if(a==="writable_by_others")return`${o}: mode ${i}, gid ${t.gid.toString()}, writable by others or a shared group; fix: chmod go-w on it.`;if(!Dho(t))return`${o}: ${t.nlink.toString()} hard links; fix: approve a copy with one link.`;if((Number(t.mode)&Pho)===0)return`${o}: mode ${i}, not executable by its owner; fix: chmod u+x on it.`},G8=(e,t,r)=>{let n=Fho(e,t,r);if(n!==void 0)throw f("configuration_invalid",`The vouch policy refuses ${n}`)},Hho=(e,t)=>{let r=Buffer.from(t,"hex");return e.byteLength===r.byteLength&&xho(e,r)},Bho=(e,t)=>{switch(e.adapter){case"git":return t==="git-inspection";case"security":case"systemd-creds":return t==="secret-store";case"terminal":return t==="interactive-terminal";case ge.claudeCode:case ge.maiaAgent:case ge.pi:case"codex":case"pi-rpc":case"skills":return CTr(e.adapter).includes(t)}},qho=(e,t)=>{switch(e.adapter){case"git":return t.selectedTier==="vouched_runtime"||t.selectedTier==="hard_containment";case"security":return t.selectedTier==="vouched_runtime";case"skills":case"systemd-creds":return t.selectedTier==="hard_containment";case"terminal":return t.selectedTier==="local_user_interactive_terminal";case ge.claudeCode:case ge.maiaAgent:case ge.pi:case"codex":return t.selectedTier==="cooperative_multi_pgid"||t.selectedTier==="hard_containment";case"pi-rpc":return t.selectedTier==="cooperative_pi_rpc_conversation"}},jho=(e,t)=>{let r=t.find(n=>n.executablePath===e.executable&&n.ownerKinds.includes(e.owner.kind));if(r===void 0||!Bho(r,e.owner.kind)||!qho(r,e)||!Tlt(r.executablePath)||Ilt(r.executablePath)!==r.executablePath||!bTr.test(r.sha256)||r.adapterVersion.length===0||r.sandboxPolicyRevision.length===0||r.adapter==="pi-rpc"&&(r.conversationPolicyRevision===void 0||r.conversationPolicyRevision.length===0)||r.vouchPolicyRevision.length===0)throw BT();return r},Who=e=>{G8(e,e.openedMetadata,e.user);let t=kTr(e.openedMetadata);if(!pL(e.pathMetadata,t)||!pL(e.currentMetadata,t)||!Hho(e.digest,e.expectedDigest))throw BT();return t},xlt=new Map,$ho=new Set([16914836n,1481003842n,2435016766n,61267n]),ITr=new Map,zho=()=>{try{let e=Cho("/proc/self/exe",z8.O_RDONLY);try{return[xTr(e,{bigint:!0})]}finally{Aho(e)}}catch{return[]}},Gho=()=>{if(process.platform!=="linux")return[];let[e]=zho();if(e===void 0)return[];try{let{type:t}=kho("/proc/self/exe",{bigint:!0});return[{filesystemType:t,identity:e}]}catch{return[]}},wTr=()=>{let e=ITr.get("exe");if(e!==void 0)return[e];let t=Gho(),[r]=t;return r!==void 0&&ITr.set("exe",r),t},Alt=e=>[e.dev,e.ino,e.size,e.mode,e.uid,e.ctimeNs,e.mtimeNs].join(":"),NTr=e=>e.platform==="linux"&&e.adapter==="skills"&&e.running.some(({filesystemType:t,identity:r})=>$ho.has(t)&&e.metadata.dev===r.dev&&e.metadata.ino===r.ino),Vho=e=>NTr(e)&&e.remembered===Alt(e.metadata),Kho=(e,t,r)=>NTr({adapter:e,metadata:t,platform:process.platform,running:r}),PTr=({executablePath:e,sha256:t})=>`${e}\0${t}`,Xho=(e,t)=>{let{expectation:r,handle:n,pathMetadata:o,signal:i}=e;return Vho({adapter:r.adapter,metadata:o,platform:process.platform,remembered:xlt.get(PTr(r))??"",running:t})?Promise.resolve(Buffer.from(r.sha256,"hex")):OTr(n,o.size,i)},Jho=async e=>{let{expectation:t,handle:r,pathMetadata:n,user:o}=e,i=await Xho(e,wTr()),a=await r.stat({bigint:!0}),c=Who({adapter:t.adapter,currentMetadata:await Mxe(t.executablePath,{bigint:!0}),digest:i,expectedDigest:t.sha256,openedMetadata:a,path:t.executablePath,pathMetadata:n,user:o});return t.adapter==="skills"&&xlt.set(PTr(t),Alt(a)),c},OTr=async(e,t,r)=>{let n=Iho("sha256"),o=Buffer.allocUnsafe(Nho),i=Number(t),a=async c=>{if(c>=i)return;r.throwIfAborted();let{bytesRead:l}=await e.read(o,0,Math.min(o.byteLength,i-c),c);if(l<=0)throw BT();n.update(o.subarray(0,l)),await a(c+l)};return await a(0),r.throwIfAborted(),n.digest()},Yho=async(e,t)=>{let[r,n]=await Promise.all([e.handle.stat({bigint:!0}),Mxe(e.path,{bigint:!0})]);if(!pL(r,t)||!pL(n,t))throw BT()},Zho=(e,t,r)=>({device:t.device.toString(),inode:t.inode.toString(),path:e,sha256:r.toString("hex"),sizeBytes:t.size.toString()}),Qho=async e=>{let t=await e.handle.stat({bigint:!0});G8(e,t,e.user);let r=kTr(t);if(!pL(e.pathMetadata,r))throw BT();let n=await OTr(e.handle,t.size,e.signal);return await Yho(e,r),Kho(e.adapter,t,wTr())&&xlt.set(`${e.path}\0${n.toString("hex")}`,Alt(t)),Zho(e.path,r,n)},ego=async(e,t,r)=>{let{path:n}=e;if(!Tlt(n)||Ilt(n)!==n)throw BT();let o=await Mxe(n,{bigint:!0});G8(e,o,t);let i=await ATr(n,z8.O_RDONLY|z8.O_NOFOLLOW);try{return await Qho({...e,handle:i,pathMetadata:o,signal:r,user:t})}finally{await i.close()}},tgo=e=>({adapter:e.adapter,path:e.executablePath}),rgo=async(e,t,r)=>{let n=await Mxe(e.executablePath,{bigint:!0});G8(tgo(e),n,t);let o=await ATr(e.executablePath,z8.O_RDONLY|z8.O_NOFOLLOW);try{let i=await Jho({expectation:e,handle:o,pathMetadata:n,signal:r,user:t});return{handle:o,identity:i}}catch(i){throw await o.close(),i}},ngo=(e,t,r)=>({adapter:e.adapter,adapterVersion:e.adapterVersion,descriptor:t.handle.fd,identity:t.identity,path:e.executablePath,sandboxPolicyRevision:e.sandboxPolicyRevision,sha256:e.sha256,user:r,vouchPolicyRevision:e.vouchPolicyRevision}),Xy=s.fn("DarwinVouch.inspectTarget")(function*(e,t){let r=yield*Rlt;return yield*s.tryPromise({catch:n=>Le(n,"transport_failed","The requested executable is not admitted by the vouch policy."),try:n=>ego({adapter:t,path:e},r,n)})}),LTr=s.fnUntraced(function*(e){let t=yield*Rlt,r=yield*s.acquireRelease(s.tryPromise({catch:n=>Le(n,"transport_failed","The requested executable is not admitted by the vouch policy."),try:n=>rgo(e,t,n)}),({handle:n})=>s.promise(()=>n.close()).pipe(s.ignore));return ngo(e,r,t)}),ogo=e=>{let t=CTr(e.adapter);return e.ownerKinds.length>0&&e.ownerKinds.every(r=>t.includes(r))},igo=e=>ogo(e)&&Tlt(e.executablePath)&&Ilt(e.executablePath)===e.executablePath&&bTr.test(e.sha256)&&e.adapterVersion.length>0&&e.sandboxPolicyRevision.length>0&&(e.adapter!=="pi-rpc"||e.conversationPolicyRevision!==void 0&&e.conversationPolicyRevision.length>0)&&e.vouchPolicyRevision.length>0,V8=s.fnUntraced(function*(e){return igo(e)?yield*LTr(e):yield*s.fail(BT())}),K8=e=>{try{let t=xTr(e.descriptor,{bigint:!0}),r=bho(e.path,{bigint:!0});if(!pL(t,e.identity)||!pL(r,e.identity))throw BT();G8(e,t,e.user)}catch(t){throw Le(t,"transport_failed","The requested executable is not admitted by the vouch policy.")}},Fxe=s.fnUntraced(function*(e,t){let r=yield*s.try({catch:()=>BT(),try:()=>jho(e,t)});return yield*LTr(r)})});import{createHash as sgo,randomUUID as ago}from"node:crypto";var blt,MTr,iC,Clt,Hxe,Bxe,UTr=q(()=>{"use strict";F();G();blt=new WeakMap,MTr=()=>f("authentication_failed","The Invocation attachment launch authorization is invalid."),iC=e=>`process_${sgo("sha256").update(JSON.stringify({commandId:e.commandId,kind:e.kind,sessionId:e.sessionId,taskId:e.taskId,terminalId:e.terminalId,workspaceId:e.workspaceId})).digest("hex")}`,Clt=e=>{let t=iC(e.owner),r=Object.freeze({attachmentId:e.attachmentId,...e.parentProcessOwnerId===void 0?{}:{parentProcessOwnerId:e.parentProcessOwnerId},processOwnerId:t,slotId:`invocation-slot-${ago().replaceAll("-","")}`});return blt.set(r,{lease:e.lease,processOwnerId:t,state:"available"}),r},Hxe=(e,t)=>{let r=blt.get(e),n=iC(t);return r?.state!=="available"||r.processOwnerId!==n||e.processOwnerId!==n?s.fail(MTr()):s.void},Bxe=s.fn("ProcessResourceManager.consumeInvocationAttachmentLease")(function*(e,t){let r=blt.get(e),n=iC(t);return r?.state!=="available"||r.processOwnerId!==n?yield*s.fail(MTr()):(r.state="consumed",r.lease)})});import{mkdtemp as cgo,open as dgo,rmdir as FTr,unlink as HTr}from"node:fs/promises";import{tmpdir as lgo}from"node:os";import{join as BTr}from"node:path";var ugo,qTr,klt,wlt,pgo,Nlt,jTr=q(()=>{"use strict";F();G();ugo=32,qTr=e=>Le(e,"transport_failed","The protected Invocation attachment handle could not be created."),klt=()=>{},wlt=e=>e.close().catch(klt),pgo=async e=>{let t=Buffer.from(e),r=await cgo(BTr(lgo(),"maia-ic1-")),n=BTr(r,"attachment");try{let o=await dgo(n,"wx+",384);try{return await o.write(t,0,t.byteLength,0),await HTr(n),await FTr(r),o}catch(i){throw await wlt(o),i}}finally{t.fill(0),await HTr(n).catch(klt),await FTr(r).catch(klt)}},Nlt=s.fn("ProcessResourceManager.openInvocationAttachmentNativeLease")(function*(e){return e.byteLength!==ugo?yield*s.fail(qTr(new Error("credential size invalid"))):yield*s.acquireRelease(s.tryPromise({catch:qTr,try:()=>pgo(e)}),t=>s.promise(()=>wlt(t)).pipe(s.asVoid)).pipe(s.map(t=>({close:s.promise(()=>wlt(t)).pipe(s.asVoid),descriptor:t.fd})))})});import{createHash as KTr}from"node:crypto";import{closeSync as XTr,constants as WTr,existsSync as mgo,fstatSync as Mlt,lstatSync as fgo,openSync as hgo,readdirSync as ggo,readFileSync as ygo,readSync as Sgo,realpathSync as JTr}from"node:fs";import{builtinModules as $Tr}from"node:module";import{dirname as Olt,isAbsolute as YTr,join as sC,relative as Ego,resolve as ZTr,sep as Ult}from"node:path";var jxe,Wxe,_go,zTr,Rgo,vgo,Flt,QTr,GTr,eIr,aC,r$,os,tIr,rIr,Tgo,$xe,Igo,Gxe,fL,X8,xgo,Ago,Vxe,zxe,nIr,oIr,iIr,Hlt,bgo,Cgo,kgo,sIr,wgo,aIr,Llt,cIr,mL,Ngo,Pgo,Ogo,Lgo,Dgo,dIr,Mgo,Ugo,Fgo,Hgo,Bgo,qgo,lIr,jgo,Wgo,$go,zgo,Ggo,Kxe,Dlt,Plt,VTr,Xxe,Blt,Vgo,Kgo,qlt,qxe,J8,uIr=q(()=>{"use strict";G();jxe="@maiaos/agent",Wxe="dist/managed-worker/main.js",_go="maia-agent-worker",zTr=["README.md","dist"],Rgo="dist/managed-worker/main.meta.json",vgo=["bin","engines","exports","files","imports","name","piConfig","type"],Flt="package.json",QTr="24.22.1",GTr=/^[0-9a-f]{64}$/u,eIr=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,aC=Object.freeze({maximumFileBytes:32*1024*1024,maximumFiles:4096,maximumInterpreterBytes:256*1024*1024,maximumPathBytes:4096,maximumTotalBytes:64*1024*1024}),r$=()=>f("transport_failed","The packaged managed Pi worker artifact is invalid."),os=()=>{throw r$()},tIr=e=>{try{return e()}catch(t){if(t instanceof lt)throw t;return os()}},rIr=e=>KTr("sha256").update(e).digest("hex"),Tgo=e=>e.length>0&&!e.includes("\0")&&Buffer.byteLength(e,"utf8")<=aC.maximumPathBytes&&YTr(e)&&ZTr(e)===e,$xe=e=>Tgo(e)?e:os(),Igo=e=>e.isFile()?"file":e.isDirectory()?"directory":e.isSymbolicLink()?"symlink":os(),Gxe=e=>Object.freeze({changedAtNanoseconds:e.ctimeNs,device:e.dev,groupId:e.gid,inode:e.ino,linkCount:e.nlink,mode:Number(e.mode),modifiedAtNanoseconds:e.mtimeNs,size:e.size,type:Igo(e),userId:e.uid}),fL=e=>Gxe(fgo(e,{bigint:!0})),X8=(e,t)=>e.changedAtNanoseconds===t.changedAtNanoseconds&&e.device===t.device&&e.groupId===t.groupId&&e.inode===t.inode&&e.linkCount===t.linkCount&&e.mode===t.mode&&e.modifiedAtNanoseconds===t.modifiedAtNanoseconds&&e.size===t.size&&e.type===t.type&&e.userId===t.userId,xgo=(e,t)=>{let r=fL(e),n=typeof process.getuid=="function"?process.getuid():void 0,o=n===void 0||r.userId===0n||r.userId===BigInt(n);return X8(t,r)&&o&&(t.mode&18)===0},Ago={package:"A path of the managed Pi worker package is writable by group or others; reinstall under umask 022 or remove group and other write access.",runtime:"The Node.js runtime is writable by group or others; use a Node.js installation that only you or root can write."},Vxe=(e,t,r="package")=>{if(!xgo(e,t))throw(t.mode&18)===0?r$():f("path_invalid",Ago[r])},zxe=(e,t,{allowSelectedSymlink:r,kind:n="package"})=>{let o=$xe(e),i=fL(o);if(i.type!==t&&!(r&&i.type==="symlink"))return os();let a=$xe(JTr.native(o)),c=fL(a);return c.type!==t?os():(Vxe(a,c,n),Object.freeze({nofollow:Object.freeze({identity:i,path:o}),realpath:Object.freeze({identity:c,path:a})}))},nIr=(e,t,r)=>{let n=fL(e);return n.type!=="file"||n.linkCount!==1n||n.size<0n||n.size>BigInt(t)?os():(Vxe(e,n,r),n)},oIr=e=>{let t=Gxe(Mlt(e.descriptor,{bigint:!0}));(!X8(e.before,e.opened)||e.byteCount!==Number(e.opened.size)||!X8(e.opened,t)||!X8(e.opened,fL(e.path)))&&os()},iIr=e=>hgo(e,WTr.O_RDONLY|(process.platform==="win32"?0:WTr.O_NOFOLLOW)),Hlt=(e,t,r="package")=>{let n=nIr(e,t,r),o=iIr(e);try{let i=Gxe(Mlt(o,{bigint:!0})),a=ygo(o),c=a.byteLength;return oIr({before:n,byteCount:c,descriptor:o,opened:i,path:e}),Object.freeze({bytes:a,identity:i,sha256:rIr(a)})}finally{XTr(o)}},bgo=1024*1024,Cgo=(e,t,r=bgo)=>{let n=KTr("sha256"),o=Buffer.allocUnsafe(r);return{byteCount:Array.from({length:Math.ceil(t/r)+1},(c,l)=>l*r).reduce((c,l)=>{let u=Sgo(e,o,0,r,l);return c+u>t?os():(n.update(o.subarray(0,u)),c+u)},0),sha256:n.digest("hex")}},kgo=(e,t,r)=>{let n=nIr(e,t,r),o=iIr(e);try{let i=Gxe(Mlt(o,{bigint:!0})),{byteCount:a,sha256:c}=Cgo(o,Number(i.size));return oIr({before:n,byteCount:a,descriptor:o,opened:i,path:e}),Object.freeze({identity:i,sha256:c})}finally{XTr(o)}},sIr=e=>{let t=e.split(Ult).join("/"),r=t.split("/");return t.length===0||t.startsWith("/")||t.includes("\\")||t.includes("\0")||r.some(n=>n.length===0||n==="."||n==="..")?os():t},wgo=(e,t)=>{let r=Ego(e,t);return r===""||r===".."||r.startsWith(`..${Ult}`)||YTr(r)?os():sIr(r)},aIr=(e,t,r)=>{e.observations.push({identity:r,path:t}),e.observations.length>aC.maximumFiles*2&&os()},Llt=(e,t,r)=>{let n=Hlt(t,aC.maximumFileBytes);aIr(r,t,n.identity),r.totalBytes+=n.bytes.byteLength,(r.entries.length>=aC.maximumFiles||r.totalBytes>aC.maximumTotalBytes)&&os(),r.entries.push(Object.freeze({byteCount:n.bytes.byteLength,executable:(n.identity.mode&73)!==0,relativePath:wgo(e,t),sha256:n.sha256}))},cIr=(e,t,r)=>{let n=fL(t);n.type!=="directory"&&os(),Vxe(t,n),aIr(r,t,n),ggo(t).toSorted().forEach(o=>{sIr(o);let i=sC(t,o),a=fL(i);a.type==="directory"?cIr(e,i,r):a.type==="file"?Llt(e,i,r):os()})},mL=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ngo=e=>Array.isArray(e),Pgo=new Set([...$Tr,...$Tr.map(e=>`node:${e}`)]),Ogo=e=>{let t=Hlt(sC(e,Rgo),aC.maximumFileBytes).bytes.toString("utf8"),r=JSON.parse(t);if(!mL(r))throw r$();let n=Reflect.get(r,"outputs");if(!mL(n))throw r$();Object.values(n).flatMap(a=>{if(!mL(a))throw r$();let c=Reflect.get(a,"imports");if(!Ngo(c))throw r$();return c}).some(a=>!mL(a)||typeof a.path!="string"||typeof a.external!="boolean"||a.external&&!Pgo.has(a.path))&&os()},Lgo=e=>{if(!mL(e)||!mL(e.exports)||!mL(e.bin))return os();let t=e.files;return e.name!==jxe||typeof e.version!="string"||!eIr.test(e.version)||e.exports["./managed-worker"]!==`./${Wxe}`||e.bin[_go]!==`./${Wxe}`||!Array.isArray(t)||t.length!==zTr.length||!zTr.every(r=>t.includes(r))?os():{loading:Object.fromEntries(vgo.map(r=>[r,e[r]])),name:jxe,version:e.version}},Dgo=e=>Lgo(JSON.parse(Hlt(sC(e,Flt),aC.maximumFileBytes).bytes.toString("utf8"))),dIr=(e,t)=>e===t||Olt(e)===e?os():mgo(sC(e,"package.json"))?e:dIr(Olt(e),t),Mgo=e=>dIr(Olt(e),ZTr(e,Ult)),Ugo=e=>{e.forEach(({identity:t,path:r})=>{Vxe(r,t)})},Fgo=(e,t)=>e.relativePath<t.relativePath?-1:e.relativePath>t.relativePath?1:0,Hgo=(e,t)=>rIr(JSON.stringify({entries:e.filter(({relativePath:r})=>r!==Flt),manifest:t.loading})),Bgo=e=>{let t={entries:[],observations:[],totalBytes:0};Llt(e,sC(e,Flt),t),Llt(e,sC(e,"README.md"),t),cIr(e,sC(e,"dist"),t);let r=Object.freeze(t.entries.toSorted(Fgo)),n=Dgo(e);Ogo(e),Ugo(t.observations);let o=Object.freeze([...t.observations]);return Object.freeze({entries:r,observations:o,packageClosureSha256:Hgo(r,n),packageName:n.name,packageVersion:n.version})},qgo=e=>{if(process.versions.node!==QTr)return os();let t=zxe(e,"file",{allowSelectedSymlink:!0,kind:"runtime"}),r=zxe(process.execPath,"file",{allowSelectedSymlink:!0,kind:"runtime"});if(t.realpath.path!==r.realpath.path)return os();let n=kgo(t.realpath.path,aC.maximumInterpreterBytes,"runtime");return X8(n.identity,t.realpath.identity)?{binding:t,sha256:n.sha256}:os()},lIr=e=>e.packageName===jxe&&eIr.test(e.packageVersion)&>r.test(e.entrySha256)&>r.test(e.packageClosureSha256),jgo=e=>{let t=$xe(e),r=zxe(t,"file",{allowSelectedSymlink:!0}),n=$xe(JTr.native(Mgo(r.realpath.path))),o=zxe(n,"directory",{allowSelectedSymlink:!1}),i=sC(n,...Wxe.split("/"));if(r.realpath.path!==i)return os();let a=Bgo(n),c=a.entries.find(({relativePath:l})=>l===Wxe);return c===void 0?os():{closure:a,entry:r,entryRecord:c,packageRoot:o,packageRootPath:n,selectedEntryPath:t}},Wgo=e=>({entrySha256:e.entryRecord.sha256,packageClosureSha256:e.closure.packageClosureSha256,packageName:e.closure.packageName,packageVersion:e.closure.packageVersion}),$go=(e,t)=>e.entrySha256===t.entrySha256&&e.packageClosureSha256===t.packageClosureSha256&&e.packageName===t.packageName&&e.packageVersion===t.packageVersion,zgo=(e,t)=>{(!lIr(e)||t!==void 0&&!$go(e,t))&&os()},Ggo=e=>Object.freeze({...e.releaseIdentity,closurePhysicalIdentities:e.inspected.closure.observations,entries:e.inspected.closure.entries,entryPath:e.inspected.entry.realpath.path,entryPhysicalIdentity:e.inspected.entry,interpreterPath:e.interpreter.binding.realpath.path,interpreterPhysicalIdentity:e.interpreter.binding,interpreterSha256:e.interpreter.sha256,interpreterVersion:QTr,packageRootPath:e.inspected.packageRootPath,packageRootPhysicalIdentity:e.inspected.packageRoot,selectedEntryPath:e.inspected.selectedEntryPath,selectedInterpreterPath:e.selectedInterpreterPath}),Kxe=e=>tIr(()=>{let t=jgo(e.entryPath),r=Wgo(t);zgo(r,e.expectedRelease);let n=e.interpreterPath??process.execPath,o=qgo(n);return Ggo({inspected:t,interpreter:o,releaseIdentity:r,selectedInterpreterPath:n})}),Dlt=e=>({...e,changedAtNanoseconds:e.changedAtNanoseconds.toString(),device:e.device.toString(),groupId:e.groupId.toString(),inode:e.inode.toString(),linkCount:e.linkCount.toString(),modifiedAtNanoseconds:e.modifiedAtNanoseconds.toString(),size:e.size.toString(),userId:e.userId.toString()}),Plt=e=>({nofollow:{identity:Dlt(e.nofollow.identity),path:e.nofollow.path},realpath:{identity:Dlt(e.realpath.identity),path:e.realpath.path}}),VTr=e=>JSON.stringify({...e,closurePhysicalIdentities:e.closurePhysicalIdentities.map(({identity:t,path:r})=>({identity:Dlt(t),path:r})),entryPhysicalIdentity:Plt(e.entryPhysicalIdentity),interpreterPhysicalIdentity:Plt(e.interpreterPhysicalIdentity),packageRootPhysicalIdentity:Plt(e.packageRootPhysicalIdentity)}),Xxe=e=>{tIr(()=>{let t=Kxe({entryPath:e.selectedEntryPath,expectedRelease:{entrySha256:e.entrySha256,packageClosureSha256:e.packageClosureSha256,packageName:e.packageName,packageVersion:e.packageVersion},interpreterPath:e.selectedInterpreterPath});if(VTr(t)!==VTr(e))return os()})},Blt=e=>Object.freeze({entrySha256:e.entrySha256,packageClosureSha256:e.packageClosureSha256,packageName:e.packageName,packageVersion:e.packageVersion}),Vgo=["MAIA_NODE_MANAGED_PI_WORKER_CLOSURE_SHA256","MAIA_NODE_MANAGED_PI_WORKER_ENTRY_SHA256","MAIA_NODE_MANAGED_PI_WORKER_PACKAGE_NAME","MAIA_NODE_MANAGED_PI_WORKER_PACKAGE_VERSION"],Kgo=e=>JSON.stringify(e)??"undefined",qlt=e=>Object.fromEntries(Vgo.map((t,r)=>[t,Kgo([e?.packageClosureSha256,e?.entrySha256,e?.packageName,e?.packageVersion][r])])),qxe=e=>{try{return e()}catch(t){if(t instanceof ReferenceError)return;throw t}},J8=()=>{let e=[qxe(()=>"46c90bb11a15acec3441bd4212bf416ff5280cf60a769d2ecbac4ae5b6e53a28"),qxe(()=>"7174f15101ef045ba1a60eaa433881fb8df4e5381c5d58cca41470d68271852a"),qxe(()=>"@maiaos/agent"),qxe(()=>"0.1.0-canary.69")];if(e.every(a=>a===void 0))return;let[t,r,n,o]=e,i={entrySha256:r,packageClosureSha256:t,packageName:n,packageVersion:o};return typeof r!="string"||typeof t!="string"||n!==jxe||typeof o!="string"||!lIr(i)?os():Object.freeze(i)}});import{isAbsolute as Xgo,resolve as Jgo}from"node:path";var pIr,Ygo,Zgo,Y8,Qgo,eyo,tyo,Jxe,mIr=q(()=>{"use strict";ns();pIr=([e],[t])=>e<t?-1:e>t?1:0,Ygo=(e,t)=>{let r=Object.entries(e).toSorted(pIr),n=Object.entries(t).toSorted(pIr);return r.length===n.length&&r.every(([o,i],a)=>n[a]?.[0]===o&&n[a]?.[1]===i)},Zgo=(e,t)=>e.kind===t.kind&&e.commandId===t.commandId&&e.sessionId===t.sessionId&&e.taskId===t.taskId&&e.terminalId===t.terminalId&&e.workspaceId===t.workspaceId,Y8=(e,t)=>e.executable===t.executable&&e.workingDirectory===t.workingDirectory&&e.standardInput===t.standardInput&&e.arguments_.length===t.arguments_.length&&e.arguments_.every((r,n)=>t.arguments_[n]===r)&&Ygo(e.environment,t.environment)&&Zgo(e.owner,t.owner)&&e.limits.maximumCpuTimeMilliseconds===t.limits.maximumCpuTimeMilliseconds&&e.limits.maximumMemoryBytes===t.limits.maximumMemoryBytes&&e.limits.maximumProcessCount===t.limits.maximumProcessCount&&e.limits.maximumWallTimeMilliseconds===t.limits.maximumWallTimeMilliseconds&&e.streamLimits.maximumDataChunkBytes===t.streamLimits.maximumDataChunkBytes&&e.streamLimits.maximumPendingInputBytes===t.streamLimits.maximumPendingInputBytes&&e.streamLimits.maximumPendingOutputBytes===t.streamLimits.maximumPendingOutputBytes&&e.interactiveTerminal===void 0&&t.interactiveTerminal===void 0&&e.repositoryAuthority===void 0&&t.repositoryAuthority===void 0,Qgo=e=>e.interpreterVersion==="24.22.1"&&e.packageName==="@maiaos/agent"&&/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.test(e.packageVersion)&&[e.entryPath,e.interpreterPath].every(t=>Xgo(t)&&Jgo(t)===t)&&[e.entrySha256,e.interpreterSha256,e.packageClosureSha256].every(t=>/^[0-9a-f]{64}$/u.test(t)),eyo=e=>{let t=Object.keys(e).toSorted();return t.length===2&&t[0]==="LANG"&&t[1]==="LC_ALL"&&e.LANG==="C"&&e.LC_ALL==="C"},tyo=(e,t)=>{let r=Km(e.launchRequest);return r.state==="valid"&&t.owner.kind==="pi-managed-session"&&t.owner.commandId!==void 0&&t.owner.sessionId!==void 0&&t.owner.workspaceId!==void 0&&Qgo(e.artifact)&&e.artifact.interpreterPath===t.executable&&t.arguments_.length===1&&t.arguments_[0]===e.artifact.entryPath&&t.standardInput==="pipe"&&eyo(t.environment)&&Y8(r.request,t)},Jxe=(e,t)=>{if(e.owner.kind!=="pi-managed-session")return;let r=t?.managedPi;return r!==void 0&&tyo(r,e)?r:void 0}});import{dirname as fIr,isAbsolute as hIr,join as Z8,normalize as ryo,relative as nyo,resolve as oyo,sep as iyo}from"node:path";var Q8,C_,Dl,syo,ayo,Ko,or,cyo,dyo,lyo,uyo,Ah,Yxe,eZ,jlt,pyo,myo,fyo,hyo,gyo,yyo,Syo,Eyo,n$,Wlt=q(()=>{"use strict";F();Q8="24.22.1",C_="1.0.0",Dl={exitDrainDeadline:"1 second",maximumInputRecordBytes:64*1024,maximumMessageEndRecords:16,maximumOutputRecordBytes:1024*1024,maximumOutputRecordsPerChunk:4096,maximumOutstandingRequests:8,maximumPendingInputBytes:128*1024,maximumPendingInputRecords:8,maximumPromptBytes:48*1024,maximumRequestIdBytes:128,maximumStderrBytes:64*1024,maximumStdoutBytes:16*1024*1024,requestDeadline:"10 seconds"},syo=d.Literals(["command_rejected","cleanup_unknown","input_limit_exceeded","invalid_request","lifecycle_invalid","output_limit_exceeded","prompt_acceptance_unknown","protocol_invalid","request_outcome_unknown","runtime_exited","saturated","transport_failed"]),ayo=d.TaggedError,Ko=class extends ayo("@maiaos/node/pi-rpc-failure")("PiRpcFailure",{message:d.String,reason:syo}){},or=(e,t)=>new Ko({message:t,reason:e}),cyo=/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/u,dyo=/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u,lyo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,uyo=/^[0-9a-f]{64}$/u,Ah=e=>{throw or("invalid_request",e)},Yxe=(e,t,r)=>e.length===0||e.includes("\0")||Buffer.byteLength(e,"utf8")>r?Ah(`The Pi RPC ${t} is invalid.`):e,eZ=(e,t)=>(Yxe(e,t,4096),!hIr(e)||ryo(e)!==e||oyo(e)!==e?Ah(`The Pi RPC ${t} must be an absolute normalized path.`):e),jlt=(e,t)=>uyo.test(e)?e:Ah(`The Pi RPC ${t} must be a lowercase SHA-256.`),pyo=e=>(Yxe(e,"session id",128),cyo.test(e)?e:Ah("The Pi RPC session id is invalid.")),myo=(e,t)=>{let r=nyo(e,t);return r.length>0&&r!==".."&&!r.startsWith(`..${iyo}`)&&!hIr(r)},fyo=e=>e.interpreterVersion!==Q8?Ah(`Pi RPC requires the exact Node ${Q8} interpreter.`):(eZ(e.interpreterPath,"interpreter path"),eZ(e.entryPath,"entry path"),jlt(e.interpreterSha256,"interpreter digest"),jlt(e.entrySha256,"entry digest"),jlt(e.packageClosureSha256,"package-closure digest"),Yxe(e.packageName,"package name",214),Yxe(e.packageVersion,"package version",128),dyo.test(e.packageName)?lyo.test(e.packageVersion)?Object.freeze({...e}):Ah("The Pi RPC package version is invalid."):Ah("The Pi RPC package name is invalid.")),hyo=(e,t)=>{let r=Z8(e,"harness","pi-rpc",t);return{agentDirectory:Z8(r,"agent"),homeDirectory:Z8(r,"home"),sessionDirectory:Z8(r,"sessions"),temporaryDirectory:Z8(r,"tmp")}},gyo=(e,t,r)=>{if(e.kind==="fresh"&&e.sessionFile===void 0)return{kind:"fresh",sessionId:r};if(e.sessionFile===void 0)return Ah("The Pi RPC session file is missing.");let n=eZ(e.sessionFile,e.kind==="fresh"?"prepared fresh session file":"resume session file");return(fIr(n)!==t.sessionDirectory||!myo(t.sessionDirectory,n)||!n.endsWith(".jsonl"))&&Ah("The Pi RPC resume file must be an exact file in its node-private session directory."),{kind:e.kind,sessionFile:n,sessionId:r}},yyo=(e,t,r)=>{let n;if(t.kind==="fresh"&&t.sessionFile===void 0)n=["--session-id",t.sessionId];else{if(t.sessionFile===void 0)return Ah("The Pi RPC session file is missing.");n=["--session",t.sessionFile]}return Object.freeze([e.entryPath,"--mode","rpc","--session-dir",r,...n,"--no-tools","--no-extensions","--no-skills","--no-prompt-templates","--no-themes","--no-context-files","--no-approve","--offline"])},Syo=e=>Object.freeze({HOME:e.homeDirectory,LANG:"C",LC_ALL:"C",NO_COLOR:"1",NODE_DISABLE_COMPILE_CACHE:"1",PI_CODING_AGENT_DIR:e.agentDirectory,PI_CODING_AGENT_SESSION_DIR:e.sessionDirectory,PI_OFFLINE:"1",PI_TELEMETRY:"0",TMPDIR:e.temporaryDirectory}),Eyo=e=>{let t=eZ(e.nodePrivateRoot,"node-private root");fIr(t)===t&&Ah("The Pi RPC node-private root cannot be a filesystem root.");let r=eZ(e.workingDirectory,"working directory"),n=pyo(e.activation.sessionId),o=hyo(t,n);return{activation:gyo(e.activation,o,n),paths:o,workingDirectory:r}},n$=e=>{let t=fyo(e.artifact),{activation:r,paths:n,workingDirectory:o}=Eyo(e);return r.sessionFile!==void 0&&t.packageVersion!==C_&&Ah(`Pi RPC persistent sessions require the exact ${C_} package format.`),Object.freeze({activation:r,...n,arguments_:yyo(t,r,n.sessionDirectory),artifact:t,environment:Syo(n),executable:t.interpreterPath,workingDirectory:o})}});var o$,$lt=q(()=>{"use strict";o$=(e,t)=>e===t?0:e<t?-1:1});import{createHash as _yo}from"node:crypto";import{closeSync as Ryo,constants as gIr,existsSync as vyo,fstatSync as yIr,lstatSync as EIr,openSync as Tyo,readdirSync as _Ir,readFileSync as Iyo,realpathSync as Xlt}from"node:fs";import{dirname as zlt,isAbsolute as RIr,join as Jlt,normalize as xyo,relative as Ayo,resolve as Ylt,sep as Glt}from"node:path";var byo,Cyo,kyo,qT,wyo,Nyo,vIr,ji,Pyo,TIr,Zxe,Oyo,Vlt,hL,k_,Qxe,Klt,Lyo,eAe,Zlt,Qlt,IIr,Dyo,SIr,xIr,Myo,Uyo,Fyo,Hyo,Byo,AIr,bIr,qyo,jyo,Wyo,$yo,zyo,Gyo,Vyo,Kyo,Xyo,Jyo,jT,CIr=q(()=>{"use strict";F();Wlt();$lt();byo="@earendil-works/pi-coding-agent",Cyo=/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u,kyo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,qT=Object.freeze({maximumExcludedBinEntries:256,maximumFileBytes:16*1024*1024,maximumFiles:16384,maximumFilesystemEntries:16384,maximumInterpreterBytes:256*1024*1024,maximumManifestBytes:8*1024*1024,maximumPathBytes:4096,maximumTotalBytes:256*1024*1024}),wyo=d.Struct({bin:d.Struct({pi:d.String}),name:d.String,version:d.String}),Nyo=d.decodeUnknownSync(d.fromJsonString(wyo)),vIr=()=>or("invalid_request","The selected Pi RPC artifact is invalid."),ji=()=>{throw vIr()},Pyo=e=>{try{return e()}catch(t){throw t instanceof Ko?t:vIr()}},TIr=e=>_yo("sha256").update(e).digest("hex"),Zxe=e=>e.length===0||e.includes("\0")||Buffer.byteLength(e,"utf8")>qT.maximumPathBytes||!RIr(e)||xyo(e)!==e||Ylt(e)!==e?ji():e,Oyo=e=>e.isFile()?"file":e.isDirectory()?"directory":e.isSymbolicLink()?"symlink":ji(),Vlt=e=>Object.freeze({changedAtNanoseconds:e.ctimeNs,device:e.dev,inode:e.ino,linkCount:e.nlink,mode:Number(e.mode),modifiedAtNanoseconds:e.mtimeNs,size:e.size,type:Oyo(e)}),hL=(e,t)=>e.changedAtNanoseconds===t.changedAtNanoseconds&&e.device===t.device&&e.inode===t.inode&&e.linkCount===t.linkCount&&e.mode===t.mode&&e.modifiedAtNanoseconds===t.modifiedAtNanoseconds&&e.size===t.size&&e.type===t.type,k_=e=>Vlt(EIr(e,{bigint:!0})),Qxe=(e,t,r)=>{let n=Zxe(e),o=k_(n);if(o.type!==t&&!(r&&o.type==="symlink"))return ji();let i=Zxe(Xlt.native(n)),a=k_(i);return a.type!==t?ji():Object.freeze({nofollow:Object.freeze({identity:o,path:n}),realpath:Object.freeze({identity:a,path:i})})},Klt=e=>{let t=k_(e.nofollow.path),r=Zxe(Xlt.native(e.nofollow.path)),n=k_(e.realpath.path);(r!==e.realpath.path||!hL(t,e.nofollow.identity)||!hL(n,e.realpath.identity))&&ji()},Lyo=e=>Buffer.from(e,"utf8").some(t=>t<=31||t===127),eAe=e=>{let t=e.split("/");return e.length===0||e.includes("\\")||e.startsWith("/")||Buffer.byteLength(e,"utf8")>qT.maximumPathBytes||Lyo(e)||t.some(r=>r.length===0||r==="."||r==="..")?ji():e},Zlt=(e,t)=>{let r=Ayo(e,t);return r.length===0||r===".."||r.startsWith(`..${Glt}`)||RIr(r)?ji():eAe(r.split(Glt).join("/"))},Qlt=(e,t,r)=>{IIr(e),e.observed.push({identity:r,path:t})},IIr=e=>{e.filesystemEntryCount+=1,e.filesystemEntryCount>qT.maximumFilesystemEntries&&ji()},Dyo=e=>{e.excludedBinEntryCount+=1,e.excludedBinEntryCount>qT.maximumExcludedBinEntries&&ji()},SIr=(e,t)=>{(e.type!=="file"||e.linkCount!==1n||e.size<0n||e.size>BigInt(t))&&ji()},xIr=(e,t)=>{let r=k_(e);SIr(r,t);let n=Tyo(e,gIr.O_RDONLY|gIr.O_NOFOLLOW);try{let o=Vlt(yIr(n,{bigint:!0}));SIr(o,t),hL(r,o)||ji();let i=Iyo(n),a=Vlt(yIr(n,{bigint:!0})),c=k_(e);return(i.byteLength!==Number(o.size)||!hL(o,a)||!hL(o,c))&&ji(),{bytes:i,identity:o,sha256:TIr(i)}}finally{Ryo(n)}},Myo=(e,t)=>o$(e.relativePath,t.relativePath),Uyo=(e,t,r)=>{t==="package.json"&&(e.state.packageManifestText=new TextDecoder("utf-8",{fatal:!0}).decode(r.bytes)),t===e.entryRelativePath&&(e.state.entrySha256=r.sha256)},Fyo=(e,t,r)=>{e.entries.push(Object.freeze({byteCount:r.bytes.byteLength,executable:(r.identity.mode&73)!==0,relativePath:t,sha256:r.sha256}))},Hyo=(e,t)=>{let r=Zlt(e.root,t),n=xIr(t,qT.maximumFileBytes);Qlt(e.state,t,n.identity),e.state.fileCount+=1,e.state.totalBytes+=n.bytes.byteLength,(e.state.fileCount>qT.maximumFiles||e.state.totalBytes>qT.maximumTotalBytes)&&ji(),Fyo(e.state,r,n),Uyo(e,r,n)},Byo=(e,t)=>{let r=Zlt(e,t);return r==="node_modules/.bin"||r.startsWith("node_modules/")&&r.endsWith("/node_modules/.bin")},AIr=(e,t)=>{let r=k_(t);r.type!=="directory"&&ji(),Qlt(e,t,r),_Ir(t).forEach(n=>{eAe(n);let o=Jlt(t,n),i=EIr(o,{bigint:!0});i.isDirectory()&&!i.isSymbolicLink()?AIr(e,o):(IIr(e),Dyo(e))})},bIr=(e,t)=>{let r=k_(t);r.type!=="directory"&&ji(),Qlt(e.state,t,r),_Ir(t).sort().forEach(o=>{eAe(o);let i=Jlt(t,o),a=k_(i);a.type==="directory"?Byo(e.root,i)?AIr(e.state,i):bIr(e,i):a.type==="file"?Hyo(e,i):ji()})},qyo=e=>{e.forEach(t=>{hL(k_(t.path),t.identity)||ji()})},jyo=()=>({entries:[],entrySha256:void 0,excludedBinEntryCount:0,fileCount:0,filesystemEntryCount:0,observed:[],packageManifestText:void 0,totalBytes:0}),Wyo=e=>{let t=Ylt(e,Glt),r=n=>vyo(Jlt(n,"package.json"))?n:n===t||zlt(n)===n?ji():r(zlt(n));return r(zlt(e))},$yo=(e,t,r)=>{if(e===void 0)return ji();let n=Nyo(e);if(n.name!==byo||!Cyo.test(n.name)||!kyo.test(n.version))return ji();let o=eAe(n.bin.pi.startsWith("./")?n.bin.pi.slice(2):n.bin.pi);return Ylt(t,o)!==r?ji():{name:n.name,version:n.version}},zyo=e=>{let t=JSON.stringify(e.map(({byteCount:n,executable:o,relativePath:i,sha256:a})=>({byteCount:n,executable:o,relativePath:i,sha256:a}))),r=Buffer.byteLength(t,"utf8");return r>qT.maximumManifestBytes&&ji(),{bytes:r,sha256:TIr(t)}},Gyo=e=>Object.freeze(e.entries.sort(Myo).map((t,r)=>Object.freeze({...t,ordinal:r}))),Vyo=(e,t)=>{let r=Zlt(e,t),n=jyo();bIr({entryRelativePath:r,root:e,state:n},e),qyo(n.observed);let o=Gyo(n),i=$yo(n.packageManifestText,e,t);if(n.entrySha256===void 0)return ji();let a=zyo(o);return{entries:o,entrySha256:n.entrySha256,excludedBinEntryCount:n.excludedBinEntryCount,fileCount:n.fileCount,manifestBytes:a.bytes,packageClosureSha256:a.sha256,packageName:i.name,packageVersion:i.version,totalBytes:n.totalBytes}},Kyo=e=>Object.freeze({closureSha256:e.closure.packageClosureSha256,entries:e.closure.entries,entryPath:e.entry.realpath.path,entryPhysicalIdentity:e.entry,entrySha256:e.closure.entrySha256,excludedBinEntryCount:e.closure.excludedBinEntryCount,fileCount:e.closure.fileCount,interpreterPath:e.interpreter.binding.realpath.path,interpreterPhysicalIdentity:e.interpreter.binding,interpreterSha256:e.interpreter.sha256,interpreterVersion:Q8,manifestBytes:e.closure.manifestBytes,packageClosureSha256:e.closure.packageClosureSha256,packageName:e.closure.packageName,packageRootPath:e.packageRootPath,packageRootPhysicalIdentity:e.packageRoot,packageVersion:e.closure.packageVersion,totalBytes:e.closure.totalBytes}),Xyo=e=>{process.versions.node!==Q8&&ji();let t=Qxe(e,"file",!0),r=Qxe(process.execPath,"file",!0);t.realpath.path!==r.realpath.path&&ji();let n=xIr(t.realpath.path,qT.maximumInterpreterBytes);return hL(n.identity,t.realpath.identity)||ji(),Klt(t),{binding:t,sha256:n.sha256}},Jyo=e=>{let t=Xyo(e.interpreterPath),r=Qxe(e.piExecutablePath,"file",!0),n=Zxe(Xlt.native(Wyo(r.realpath.path))),o=Qxe(n,"directory",!1);o.realpath.path!==n&&ji();let i=Vyo(n,r.realpath.path);return Klt(r),Klt(o),Kyo({closure:i,entry:r,interpreter:t,packageRoot:o,packageRootPath:n})},jT=e=>Pyo(()=>Jyo(e))});var bu=q(()=>{"use strict";CIr();Wlt();$lt()});import{dirname as Yyo,isAbsolute as tZ,resolve as rZ}from"node:path";var NIr,kIr,Zyo,Qyo,eSo,tSo,rSo,wIr,nSo,i$,oSo,iSo,sSo,aSo,tAe,PIr=q(()=>{"use strict";bu();ns();NIr=e=>(e.kind==="pi-rpc-probe"||e.kind==="pi-rpc-session")&&e.commandId!==void 0&&e.sessionId!==void 0,kIr=(e,t)=>e<t?-1:e>t?1:0,Zyo=(e,t)=>{let r=Object.entries(e).sort(([o],[i])=>kIr(o,i)),n=Object.entries(t).sort(([o],[i])=>kIr(o,i));return r.length===n.length&&r.every(([o,i],a)=>n[a]?.[0]===o&&n[a]?.[1]===i)},Qyo=(e,t)=>e.kind===t.kind&&e.commandId===t.commandId&&e.sessionId===t.sessionId&&e.taskId===t.taskId&&e.terminalId===t.terminalId&&e.workspaceId===t.workspaceId,eSo=(e,t)=>e.executable===t.executable&&e.workingDirectory===t.workingDirectory&&e.standardInput===t.standardInput&&e.arguments_.length===t.arguments_.length&&e.arguments_.every((r,n)=>t.arguments_[n]===r)&&Zyo(e.environment,t.environment)&&Qyo(e.owner,t.owner)&&e.limits.maximumCpuTimeMilliseconds===t.limits.maximumCpuTimeMilliseconds&&e.limits.maximumMemoryBytes===t.limits.maximumMemoryBytes&&e.limits.maximumProcessCount===t.limits.maximumProcessCount&&e.limits.maximumWallTimeMilliseconds===t.limits.maximumWallTimeMilliseconds&&e.streamLimits.maximumDataChunkBytes===t.streamLimits.maximumDataChunkBytes&&e.streamLimits.maximumPendingInputBytes===t.streamLimits.maximumPendingInputBytes&&e.streamLimits.maximumPendingOutputBytes===t.streamLimits.maximumPendingOutputBytes&&e.interactiveTerminal===void 0&&t.interactiveTerminal===void 0&&e.repositoryAuthority===void 0&&t.repositoryAuthority===void 0,tSo=e=>{let t=e.nativeSession.activation,r=t.sessionFile===void 0?["--session-id",e.nativeSession.id]:["--session",t.sessionFile];return[e.artifact.entryPath,"--mode","rpc","--session-dir",e.nativeSession.directory,...r,"--no-tools","--no-extensions","--no-skills","--no-prompt-templates","--no-themes","--no-context-files","--no-approve","--offline"]},rSo=(e,t)=>e.length===t.length&&e.every((r,n)=>t[n]===r),wIr=new Set(["HOME","LANG","LC_ALL","NODE_DISABLE_COMPILE_CACHE","NO_COLOR","PI_CODING_AGENT_DIR","PI_CODING_AGENT_SESSION_DIR","PI_OFFLINE","PI_TELEMETRY","TMPDIR"]),nSo=(e,t)=>{let r=e.environment,n=Object.keys(r);return n.length===wIr.size&&n.every(o=>wIr.has(o))&&r.LANG==="C"&&r.LC_ALL==="C"&&r.NODE_DISABLE_COMPILE_CACHE==="1"&&r.NO_COLOR==="1"&&r.PI_CODING_AGENT_SESSION_DIR===t&&r.PI_OFFLINE==="1"&&r.PI_TELEMETRY==="0"&&[r.HOME,r.PI_CODING_AGENT_DIR,r.TMPDIR].every(o=>o!==void 0&&tZ(o)&&rZ(o)===o)},i$=e=>e.length>0&&!e.includes("\0")&&Buffer.byteLength(e,"utf8")<=128,oSo=e=>e.interpreterVersion==="24.22.1"&&tZ(e.interpreterPath)&&rZ(e.interpreterPath)===e.interpreterPath&&tZ(e.entryPath)&&rZ(e.entryPath)===e.entryPath&&[e.interpreterSha256,e.entrySha256,e.packageClosureSha256].every(t=>/^[0-9a-f]{64}$/u.test(t))&&/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u.test(e.packageName)&&/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.test(e.packageVersion),iSo=e=>tZ(e.directory)&&rZ(e.directory)===e.directory&&/^(?:[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)$/u.test(e.id)&&(e.activation.sessionFile===void 0||tZ(e.activation.sessionFile)&&rZ(e.activation.sessionFile)===e.activation.sessionFile&&Yyo(e.activation.sessionFile)===e.directory),sSo=e=>{let{artifact:t,authorizationRevision:r,fenceId:n,nativeSession:o,permitId:i,policy:a}=e;return i$(r)&&i$(n)&&i$(i)&&oSo(t)&&iSo(o)&&i$(a.adapterVersion)&&i$(a.conversationPolicyRevision)&&i$(a.vouchPolicyRevision)},aSo=(e,t)=>{let r=Km(e.launchRequest);return r.state==="valid"&&NIr(t.owner)&&sSo(e)&&(t.owner.kind!=="pi-rpc-session"||e.nativeSession.activation.sessionFile!==void 0&&e.artifact.packageVersion===C_)&&e.launchRequest.owner.kind===t.owner.kind&&e.launchRequest.owner.commandId===t.owner.commandId&&e.launchRequest.owner.sessionId===t.owner.sessionId&&e.artifact.interpreterPath===t.executable&&rSo(t.arguments_,tSo(e))&&nSo(t,e.nativeSession.directory)&&eSo(r.request,t)},tAe=(e,t)=>{if(!NIr(e.owner))return;let r=t?.piRpc;return r!==void 0&&aSo(r,e)?r:void 0}});import{createHash as LIr}from"node:crypto";import{lstatSync as cSo}from"node:fs";import{dirname as s$,isAbsolute as dSo,join as cC,relative as DIr,sep as OIr}from"node:path";import{fileURLToPath as lSo}from"node:url";var a$,eut,uSo,pSo,gL,bh,mSo,fSo,rAe,WT,hSo,tut,MIr,UIr,gSo,ySo,SSo,ESo,FIr,_So,HIr,BIr,RSo,vSo,TSo,ISo,xSo,qIr,nAe,oAe,jIr=q(()=>{"use strict";F();G();a$="1.7.0",eut=Object.freeze({maximumEntries:4096,maximumFileBytes:8*1024*1024,maximumTotalBytes:16*1024*1024}),uSo=/\.(?:c?js|mjs|json)$/u,pSo=d.fromJsonString(d.Struct({bin:d.optionalKey(d.Unknown),dependencies:d.optionalKey(d.Record(d.String,d.Unknown)),name:d.optionalKey(d.Unknown),version:d.optionalKey(d.Unknown)})),gL=()=>f("transport_failed","The bundled Skills CLI does not match the package this Node was built with."),bh=s.fail(gL()),mSo=e=>{let t=process.getuid?.();return(t===void 0||Number(e.uid)===t||Number(e.uid)===0)&&(Number(e.mode)&18)===0},fSo=e=>e.isFile()?"file":e.isDirectory()?"directory":void 0,rAe=(e,t)=>s.try({catch:gL,try:()=>{let r=cSo(e,{bigint:!0}),n=fSo(r);if(n===void 0||t!==void 0&&n!==t||!mSo(r))throw gL();return{kind:n,size:r.size}}}),WT=(e,t)=>{let r=DIr(e,t);return r!==""&&!r.startsWith("..")&&!dSo(r)},hSo=1024*1024,tut=(e,t)=>{let r=cC(t,"package.json");return rAe(r,"file").pipe(s.filterOrFail(({size:n})=>n<=BigInt(hSo),gL),s.flatMap(()=>e.readFileString(r)),s.flatMap(d.decodeUnknownEffect(pSo)))},MIr=(e,t,r=t)=>e.fs.readDirectory(r).pipe(s.flatMap(n=>(e.closure.entries+=n.length,e.closure.entries>eut.maximumEntries?bh:s.forEach(n,o=>{let i=cC(r,o);return o==="node_modules"&&r===t?s.succeed([]):rAe(i).pipe(s.flatMap(({kind:a})=>a==="directory"?MIr(e,t,i):s.succeed([i])))}))),s.map(n=>n.flat())),UIr=(e,t,r)=>e.realPath(cC(t,"node_modules",r)).pipe(s.catch(()=>{let n=s$(t);return n===t?bh:UIr(e,n,r)})),gSo=(e,t,r)=>s.gen(function*(){let{closure:n,fs:o}=e,{size:i}=yield*rAe(r,"file");if(n.total+=Number(i),i>BigInt(eut.maximumFileBytes)||n.total>eut.maximumTotalBytes)return yield*bh;let a=yield*o.readFile(r);return n.hash.update(`${DIr(t,r)}\0${String(a.byteLength)}\0`),n.hash.update(LIr("sha256").update(a).digest()),r}),ySo=e=>Object.keys(e.dependencies??{}).toSorted(),SSo=(e,t)=>MIr(e,t).pipe(s.flatMap(r=>s.forEach(r.toSorted().filter(n=>uSo.test(n)),n=>gSo(e,t,n)))),ESo=(e,t)=>s.gen(function*(){let{closure:r,fs:n,prefix:o}=e;if(!WT(o,t))return yield*bh;r.seen.add(t),yield*rAe(t,"directory");let i=yield*tut(n,t);return r.hash.update(`${String(i.name)}@${String(i.version)}\0`),i}),FIr=(e,t)=>s.gen(function*(){if(e.closure.seen.has(t))return[];let r=yield*ESo(e,t),n=yield*SSo(e,t),o=yield*s.forEach(ySo(r),i=>UIr(e.fs,t,i).pipe(s.flatMap(a=>FIr(e,a))));return[...n,...o.flat()]}),_So="@maiaos/node",HIr=(e,t)=>tut(e,t).pipe(s.flatMap(r=>r.name===_So?s.succeed(t):bh),s.catch(()=>{let r=s$(t);return r===t?bh:HIr(e,r)})),BIr=(e,t)=>e.exists(cC(t,"pnpm-workspace.yaml")).pipe(s.flatMap(r=>{let n=s$(t);return r?s.succeed(t):n===t?bh:BIr(e,n)}),s.mapError(gL)),RSo=(e,t)=>s.gen(function*(){let r=yield*HIr(e,s$(t)),n=r.indexOf(`${OIr}node_modules${OIr}`),o=n>0?r.slice(0,n):yield*BIr(e,r);return{modules:n>0?s$(s$(r)):cC(r,"node_modules"),own:r,prefix:o}}),vSo=(e,t)=>{let{bin:r}=t,n=typeof r=="string"?r:r?.skills,o=typeof n=="string"?cC(e,n):"";return WT(e,o)?s.succeed(o):bh},TSo=(e,t)=>FIr(e,t).pipe(s.map(r=>({files:r,sha256:e.closure.hash.digest("hex")}))),ISo=(e,t)=>s.gen(function*(){let{modules:r,own:n,prefix:o}=yield*RSo(e,yield*e.realPath(lSo(t.fromUrl))),i=yield*e.realPath(cC(n,"node_modules","skills")).pipe(s.catch(()=>e.realPath(cC(r,"skills")))),a=yield*tut(e,i);return a.name!=="skills"||a.version!==a$?yield*bh:WT(o,i)?{entryPath:yield*e.realPath(yield*vSo(i,a)),prefix:o,root:i}:yield*bh}),xSo=(e,t)=>({closure:{entries:0,hash:LIr("sha256"),seen:new Set,total:0},fs:e,prefix:t}),qIr=e=>s.gen(function*(){let t=yield*ve.FileSystem,{entryPath:r,prefix:n,root:o}=yield*ISo(t,e),i=xSo(t,n),{files:a,sha256:c}=yield*TSo(i,o);return(yield*s.forEach(a,u=>t.realPath(u))).includes(r)?{closureSha256:c,entryPath:r,files:a,fromUrl:e.fromUrl,interpreterPath:yield*t.realPath(e.interpreterPath??process.execPath),packageRoot:o,version:a$}:yield*bh}),nAe=e=>qIr(e).pipe(s.mapError(gL)),oAe=e=>qIr({fromUrl:e.fromUrl,interpreterPath:e.interpreterPath}).pipe(s.mapError(gL),s.flatMap(t=>t.closureSha256===e.closureSha256&&t.entryPath===e.entryPath&&t.interpreterPath===e.interpreterPath&&t.packageRoot===e.packageRoot&&t.files.join("\0")===e.files.join("\0")?s.void:bh))});var dC,ASo,yL,$T,iAe,c$,WIr=q(()=>{"use strict";Z();t$();dC=Object.freeze(JW.map(({integration:e})=>e)),ASo=e=>kp(e).ownerKinds,yL=e=>dC.find(t=>ASo(t).includes(e)),$T=(e,t)=>{switch(t){case ge.claudeCode:return e?.claudeCode;case"codex":return e?.codex;case ge.maiaAgent:return e?.maiaAgent;case ge.pi:return e?.pi}},iAe=(e,t)=>{let r=Object.freeze(t);switch(e){case ge.claudeCode:return Object.freeze({claudeCode:r});case"codex":return Object.freeze({codex:r});case ge.maiaAgent:return Object.freeze({maiaAgent:r});case ge.pi:return Object.freeze({pi:r})}},c$=e=>dC.flatMap(t=>{let r=$T(e,t);return r===void 0?[]:[r]})});var $Ir={};Nn($Ir,{PRIVATE_GROUP_SHELL_FUNCTION:()=>W8,SKILLS_PACKAGE_VERSION:()=>a$,USER_WRITES_ONLY_SHELL_FUNCTION:()=>$8,consumeInvocationAttachmentNativeLease:()=>Bxe,embeddedManagedPiWorkerDefines:()=>qlt,insideDirectory:()=>WT,inspectDarwinVouchedTarget:()=>Xy,inspectManagedPiWorkerArtifact:()=>Kxe,inspectSkillsFiles:()=>nAe,invocationAttachmentProcessOwnerId:()=>iC,issueInvocationAttachmentLaunchAuthorization:()=>Clt,managedPiAuthorizationForRequest:()=>Jxe,openDarwinVouchedTarget:()=>Fxe,openInvocationAttachmentNativeLease:()=>Nlt,piRpcAuthorizationForRequest:()=>tAe,readEmbeddedManagedPiWorkerReleaseIdentity:()=>J8,releaseIdentityOf:()=>Blt,requireInvocationAttachmentLaunchAuthorization:()=>Hxe,retainDarwinVouchedAuthorizationTarget:()=>V8,sameRequest:()=>Y8,skillsVouchTarget:()=>Uxe,suppliedVendorLaunchAuthorizations:()=>c$,vendorIntegrationForOwner:()=>yL,vendorLaunchAuthorization:()=>$T,vendorLaunchAuthorizationGrant:()=>iAe,vendorLaunchIntegrations:()=>dC,verifyProcessLaunchAuthority:()=>Dxe,verifyResolvedManagedPiWorkerArtifact:()=>Xxe,verifyRetainedDarwinVouchedTargetPath:()=>K8,verifySkillsPackage:()=>oAe});var w_=q(()=>{"use strict";STr();DTr();UTr();jTr();uIr();mIr();PIr();vlt();jIr();WIr()});var YT=im((Fdc,zAr)=>{"use strict";var WAr=["nodebuffer","arraybuffer","fragments"],$Ar=typeof Blob<"u";$Ar&&WAr.push("blob");zAr.exports={BINARY_TYPES:WAr,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:$Ar,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var kZ=im((Hdc,qAe)=>{"use strict";var{EMPTY_BUFFER:kTo}=YT(),upt=Buffer[Symbol.species];function wTo(e,t){if(e.length===0)return kTo;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return n<t?new upt(r.buffer,r.byteOffset,n):r}function GAr(e,t,r,n,o){for(let i=0;i<o;i++)r[n+i]=e[i]^t[i&3]}function VAr(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function NTo(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function ppt(e){if(ppt.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new upt(e):ArrayBuffer.isView(e)?t=new upt(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),ppt.readOnly=!1),t}qAe.exports={concat:wTo,mask:GAr,toArrayBuffer:NTo,toBuffer:ppt,unmask:VAr};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Fa("bufferutil");qAe.exports.mask=function(t,r,n,o,i){i<48?GAr(t,r,n,o,i):e.mask(t,r,n,o,i)},qAe.exports.unmask=function(t,r){t.length<32?VAr(t,r):e.unmask(t,r)}}catch{}});var JAr=im((Bdc,XAr)=>{"use strict";var KAr=Symbol("kDone"),mpt=Symbol("kRun"),fpt=class{constructor(t){this[KAr]=()=>{this.pending--,this[mpt]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[mpt]()}[mpt](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[KAr])}}};XAr.exports=fpt});var x$=im((qdc,ebr)=>{"use strict";var wZ=Fa("zlib"),YAr=kZ(),PTo=JAr(),{kStatusCode:ZAr}=YT(),OTo=Buffer[Symbol.species],LTo=Buffer.from([0,0,255,255]),WAe=Symbol("permessage-deflate"),ZT=Symbol("total-length"),T$=Symbol("callback"),hC=Symbol("buffers"),I$=Symbol("error"),jAe,hpt=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!jAe){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;jAe=new PTo(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[T$];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&(typeof o.client_max_window_bits=="number"?r.clientMaxWindowBits>o.client_max_window_bits:!o.client_max_window_bits)));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){jAe.add(o=>{this._decompress(t,r,(i,a)=>{o(),n(i,a)})})}compress(t,r,n){jAe.add(o=>{this._compress(t,r,(i,a)=>{o(),n(i,a)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?wZ.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=wZ.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[WAe]=this,this._inflate[ZT]=0,this._inflate[hC]=[],this._inflate.on("error",MTo),this._inflate.on("data",QAr)}this._inflate[T$]=n,this._inflate.write(t),r&&this._inflate.write(LTo),this._inflate.flush(()=>{let i=this._inflate[I$];if(i){this._inflate.close(),this._inflate=null,n(i);return}let a=YAr.concat(this._inflate[hC],this._inflate[ZT]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ZT]=0,this._inflate[hC]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,a)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?wZ.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=wZ.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[ZT]=0,this._deflate[hC]=[],this._deflate.on("data",DTo)}this._deflate[T$]=n,this._deflate.write(t),this._deflate.flush(wZ.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=YAr.concat(this._deflate[hC],this._deflate[ZT]);r&&(i=new OTo(i.buffer,i.byteOffset,i.length-4)),this._deflate[T$]=null,this._deflate[ZT]=0,this._deflate[hC]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,i)})}};ebr.exports=hpt;function DTo(e){this[hC].push(e),this[ZT]+=e.length}function QAr(e){if(this[ZT]+=e.length,this[WAe]._maxPayload<1||this[ZT]<=this[WAe]._maxPayload){this[hC].push(e);return}this[I$]=new RangeError("Max payload size exceeded"),this[I$].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[I$][ZAr]=1009,this.removeListener("data",QAr),this.reset()}function MTo(e){if(this[WAe]._inflate=null,this[I$]){this[T$](this[I$]);return}e[ZAr]=1007,this[T$](e)}});var A$=im((jdc,$Ae)=>{"use strict";var{isUtf8:tbr}=Fa("buffer"),{hasBlob:UTo}=YT(),FTo=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function HTo(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function gpt(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function BTo(e){return UTo&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}$Ae.exports={isBlob:BTo,isValidStatusCode:HTo,isValidUTF8:gpt,tokenChars:FTo};if(tbr)$Ae.exports.isValidUTF8=function(e){return e.length<24?gpt(e):tbr(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Fa("utf-8-validate");$Ae.exports.isValidUTF8=function(t){return t.length<32?gpt(t):e(t)}}catch{}});var Rpt=im((Wdc,cbr)=>{"use strict";var{Writable:qTo}=Fa("stream"),rbr=x$(),{BINARY_TYPES:jTo,EMPTY_BUFFER:nbr,kStatusCode:WTo,kWebSocket:$To}=YT(),{concat:ypt,toArrayBuffer:zTo,unmask:GTo}=kZ(),{isValidStatusCode:VTo,isValidUTF8:obr}=A$(),zAe=Buffer[Symbol.species],Nh=0,ibr=1,sbr=2,abr=3,Spt=4,Ept=5,GAe=6,_pt=class extends qTo{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||jTo[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[$To]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Nh}_write(t,r,n){if(this._opcode===8&&this._state==Nh)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new zAe(n.buffer,n.byteOffset+t,n.length-t),new zAe(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new zAe(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Nh:this.getInfo(t);break;case ibr:this.getPayloadLength16(t);break;case sbr:this.getPayloadLength64(t);break;case abr:this.getMask();break;case Spt:this.getData(t);break;case Ept:case GAe:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[rbr.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=ibr:this._payloadLength===127?this._state=sbr:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=abr:this._state=Spt}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Spt}getData(t){let r=nbr;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&>o(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=Ept,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[rbr.extensionName].decompress(t,this._fin,(o,i)=>{if(o)return r(o);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}this._fragments.push(i)}this.dataMessage(r),this._state===Nh&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Nh;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=ypt(n,r):this._binaryType==="arraybuffer"?o=zTo(ypt(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Nh):(this._state=GAe,setImmediate(()=>{this.emit("message",o,!0),this._state=Nh,this.startLoop(t)}))}else{let o=ypt(n,r);if(!this._skipUTF8Validation&&!obr(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._state===Ept||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Nh):(this._state=GAe,setImmediate(()=>{this.emit("message",o,!1),this._state=Nh,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,nbr),this.end();else{let n=t.readUInt16BE(0);if(!VTo(n)){let i=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(i);return}let o=new zAe(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!obr(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(i);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Nh;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Nh):(this._state=GAe,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Nh,this.startLoop(r)}))}createError(t,r,n,o,i){this._loop=!1,this._errored=!0;let a=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=i,a[WTo]=o,a}};cbr.exports=_pt});var Ipt=im((zdc,ubr)=>{"use strict";var{Duplex:$dc}=Fa("stream"),{randomFillSync:KTo}=Fa("crypto"),{types:{isUint8Array:XTo}}=Fa("util"),dbr=x$(),{EMPTY_BUFFER:JTo,kWebSocket:YTo,NOOP:ZTo}=YT(),{isBlob:b$,isValidStatusCode:QTo}=A$(),{mask:lbr,toBuffer:wL}=kZ(),Ph=Symbol("kByteLength"),eIo=Buffer.alloc(4),VAe=8*1024,NL,C$=VAe,Zy=0,tIo=1,rIo=2,vpt=class e{constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Zy,this.onerror=ZTo,this[YTo]=void 0}static frame(t,r){let n,o=!1,i=2,a=!1;r.mask&&(n=r.maskBuffer||eIo,r.generateMask?r.generateMask(n):(C$===VAe&&(NL===void 0&&(NL=Buffer.alloc(VAe)),KTo(NL,0,VAe),C$=0),n[0]=NL[C$++],n[1]=NL[C$++],n[2]=NL[C$++],n[3]=NL[C$++]),a=(n[0]|n[1]|n[2]|n[3])===0,i=6);let c;typeof t=="string"?(!r.mask||a)&&r[Ph]!==void 0?c=r[Ph]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!a);let l=c;c>=65536?(i+=8,l=127):c>125&&(i+=2,l=126);let u=Buffer.allocUnsafe(o?c+i:i);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(c,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(c,4,6)),r.mask?(u[1]|=128,u[i-4]=n[0],u[i-3]=n[1],u[i-2]=n[2],u[i-1]=n[3],a?[u,t]:o?(lbr(t,n,u,i,c),[u]):(lbr(t,n,t,0,c),[u,t])):[u,t]}close(t,r,n,o){let i;if(t===void 0)i=JTo;else{if(typeof t!="number"||!QTo(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(i=Buffer.allocUnsafe(2+c),i.writeUInt16BE(t,0),typeof r=="string")i.write(r,2);else if(XTo(r))i.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let a={[Ph]:i.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Zy?this.enqueue([this.dispatch,i,!1,a,o]):this.sendFrame(e.frame(i,a),o)}ping(t,r,n){let o,i;if(typeof t=="string"?(o=Buffer.byteLength(t),i=!1):b$(t)?(o=t.size,i=!1):(t=wL(t),o=t.length,i=wL.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Ph]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};b$(t)?this._state!==Zy?this.enqueue([this.getBlobData,t,!1,a,n]):this.getBlobData(t,!1,a,n):this._state!==Zy?this.enqueue([this.dispatch,t,!1,a,n]):this.sendFrame(e.frame(t,a),n)}pong(t,r,n){let o,i;if(typeof t=="string"?(o=Buffer.byteLength(t),i=!1):b$(t)?(o=t.size,i=!1):(t=wL(t),o=t.length,i=wL.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Ph]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};b$(t)?this._state!==Zy?this.enqueue([this.getBlobData,t,!1,a,n]):this.getBlobData(t,!1,a,n):this._state!==Zy?this.enqueue([this.dispatch,t,!1,a,n]):this.sendFrame(e.frame(t,a),n)}send(t,r,n){let o=this._extensions[dbr.extensionName],i=r.binary?2:1,a=r.compress,c,l;typeof t=="string"?(c=Buffer.byteLength(t),l=!1):b$(t)?(c=t.size,l=!1):(t=wL(t),c=t.length,l=wL.readOnly),this._firstFragment?(this._firstFragment=!1,a&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=c>=o._threshold),this._compress=a):(a=!1,i=0),r.fin&&(this._firstFragment=!0);let u={[Ph]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:l,rsv1:a};b$(t)?this._state!==Zy?this.enqueue([this.getBlobData,t,this._compress,u,n]):this.getBlobData(t,this._compress,u,n):this._state!==Zy?this.enqueue([this.dispatch,t,this._compress,u,n]):this.dispatch(t,this._compress,u,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[Ph],this._state=rIo,t.arrayBuffer().then(i=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(Tpt,this,c,o);return}this._bufferedBytes-=n[Ph];let a=wL(i);r?this.dispatch(a,r,n,o):(this._state=Zy,this.sendFrame(e.frame(a,n),o),this.dequeue())}).catch(i=>{process.nextTick(nIo,this,i,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let i=this._extensions[dbr.extensionName];this._bufferedBytes+=n[Ph],this._state=tIo,i.compress(t,n.fin,(a,c)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Tpt(this,l,o);return}this._bufferedBytes-=n[Ph],this._state=Zy,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===Zy&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Ph],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Ph],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};ubr.exports=vpt;function Tpt(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],i=o[o.length-1];typeof i=="function"&&i(t)}}function nIo(e,t,r){Tpt(e,t,r),e.onerror(t)}});var _br=im((Gdc,Ebr)=>{"use strict";var{kForOnEventAttribute:NZ,kListener:xpt}=YT(),pbr=Symbol("kCode"),mbr=Symbol("kData"),fbr=Symbol("kError"),hbr=Symbol("kMessage"),gbr=Symbol("kReason"),k$=Symbol("kTarget"),ybr=Symbol("kType"),Sbr=Symbol("kWasClean"),QT=class{constructor(t){this[k$]=null,this[ybr]=t}get target(){return this[k$]}get type(){return this[ybr]}};Object.defineProperty(QT.prototype,"target",{enumerable:!0});Object.defineProperty(QT.prototype,"type",{enumerable:!0});var PL=class extends QT{constructor(t,r={}){super(t),this[pbr]=r.code===void 0?0:r.code,this[gbr]=r.reason===void 0?"":r.reason,this[Sbr]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[pbr]}get reason(){return this[gbr]}get wasClean(){return this[Sbr]}};Object.defineProperty(PL.prototype,"code",{enumerable:!0});Object.defineProperty(PL.prototype,"reason",{enumerable:!0});Object.defineProperty(PL.prototype,"wasClean",{enumerable:!0});var w$=class extends QT{constructor(t,r={}){super(t),this[fbr]=r.error===void 0?null:r.error,this[hbr]=r.message===void 0?"":r.message}get error(){return this[fbr]}get message(){return this[hbr]}};Object.defineProperty(w$.prototype,"error",{enumerable:!0});Object.defineProperty(w$.prototype,"message",{enumerable:!0});var PZ=class extends QT{constructor(t,r={}){super(t),this[mbr]=r.data===void 0?null:r.data}get data(){return this[mbr]}};Object.defineProperty(PZ.prototype,"data",{enumerable:!0});var oIo={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[NZ]&&o[xpt]===t&&!o[NZ])return;let n;if(e==="message")n=function(i,a){let c=new PZ("message",{data:a?i:i.toString()});c[k$]=this,KAe(t,this,c)};else if(e==="close")n=function(i,a){let c=new PL("close",{code:i,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[k$]=this,KAe(t,this,c)};else if(e==="error")n=function(i){let a=new w$("error",{error:i,message:i.message});a[k$]=this,KAe(t,this,a)};else if(e==="open")n=function(){let i=new QT("open");i[k$]=this,KAe(t,this,i)};else return;n[NZ]=!!r[NZ],n[xpt]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[xpt]===t&&!r[NZ]){this.removeListener(e,r);break}}};Ebr.exports={CloseEvent:PL,ErrorEvent:w$,Event:QT,EventTarget:oIo,MessageEvent:PZ};function KAe(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var XAe=im((Vdc,Rbr)=>{"use strict";var{tokenChars:OZ}=A$();function F_(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function iIo(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,i=!1,a,c,l=-1,u=-1,p=-1,h=0;for(;h<e.length;h++)if(u=e.charCodeAt(h),a===void 0)if(p===-1&&OZ[u]===1)l===-1&&(l=h);else if(h!==0&&(u===32||u===9))p===-1&&l!==-1&&(p=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);p===-1&&(p=h);let S=e.slice(l,p);u===44?(F_(t,S,r),r=Object.create(null)):a=S,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(c===void 0)if(p===-1&&OZ[u]===1)l===-1&&(l=h);else if(u===32||u===9)p===-1&&l!==-1&&(p=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);p===-1&&(p=h),F_(r,e.slice(l,p),!0),u===44&&(F_(t,a,r),r=Object.create(null),a=void 0),l=p=-1}else if(u===61&&l!==-1&&p===-1)c=e.slice(l,h),l=p=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(o){if(OZ[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1?l=h:n||(n=!0),o=!1}else if(i)if(OZ[u]===1)l===-1&&(l=h);else if(u===34&&l!==-1)i=!1,p=h;else if(u===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&e.charCodeAt(h-1)===61)i=!0;else if(p===-1&&OZ[u]===1)l===-1&&(l=h);else if(l!==-1&&(u===32||u===9))p===-1&&(p=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);p===-1&&(p=h);let S=e.slice(l,p);n&&(S=S.replace(/\\/g,""),n=!1),F_(r,c,S),u===44&&(F_(t,a,r),r=Object.create(null),a=void 0),c=void 0,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(l===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");p===-1&&(p=h);let g=e.slice(l,p);return a===void 0?F_(t,g,r):(c===void 0?F_(r,g,!0):n?F_(r,c,g.replace(/\\/g,"")):F_(r,c,g),F_(t,a,r)),t}function sIo(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let i=n[o];return Array.isArray(i)||(i=[i]),i.map(a=>a===!0?o:`${o}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Rbr.exports={format:sIo,parse:iIo}});var QAe=im((Jdc,Obr)=>{"use strict";var aIo=Fa("events"),cIo=Fa("https"),dIo=Fa("http"),Ibr=Fa("net"),lIo=Fa("tls"),{randomBytes:uIo,createHash:pIo}=Fa("crypto"),{Duplex:Kdc,Readable:Xdc}=Fa("stream"),{URL:Apt}=Fa("url"),gC=x$(),mIo=Rpt(),fIo=Ipt(),{isBlob:hIo}=A$(),{BINARY_TYPES:vbr,CLOSE_TIMEOUT:gIo,EMPTY_BUFFER:JAe,GUID:yIo,kForOnEventAttribute:bpt,kListener:SIo,kStatusCode:EIo,kWebSocket:pd,NOOP:xbr}=YT(),{EventTarget:{addEventListener:_Io,removeEventListener:RIo}}=_br(),{format:vIo,parse:TIo}=XAe(),{toBuffer:IIo}=kZ(),Abr=Symbol("kAborted"),Cpt=[8,13],eI=["CONNECTING","OPEN","CLOSING","CLOSED"],xIo=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,js=class e extends aIo{constructor(t,r,n){super(),this._binaryType=vbr[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=JAe,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?!n||n.protocols===void 0?r=[]:Array.isArray(n.protocols)?r=n.protocols:r=[n.protocols]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,n.protocols===void 0?r=[]:Array.isArray(n.protocols)?r=n.protocols:r=[n.protocols]):r=[r]),bbr(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){vbr.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n){let o=new mIo({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),i=new fIo(t,this._extensions,n.generateMask);this._receiver=o,this._sender=i,this._socket=t,o[pd]=this,i[pd]=this,t[pd]=this,o.on("conclude",CIo),o.on("drain",kIo),o.on("error",wIo),o.on("message",NIo),o.on("ping",PIo),o.on("pong",OIo),i.onerror=LIo,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",wbr),t.on("data",ZAe),t.on("end",Nbr),t.on("error",Pbr),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[gC.extensionName]&&this._extensions[gC.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Ym(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._readyState=e.CLOSING,kbr(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kpt(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||JAe,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kpt(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||JAe,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kpt(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[gC.extensionName]||(o.compress=!1),this._sender.send(t||JAe,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Ym(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(js,"CONNECTING",{enumerable:!0,value:eI.indexOf("CONNECTING")});Object.defineProperty(js.prototype,"CONNECTING",{enumerable:!0,value:eI.indexOf("CONNECTING")});Object.defineProperty(js,"OPEN",{enumerable:!0,value:eI.indexOf("OPEN")});Object.defineProperty(js.prototype,"OPEN",{enumerable:!0,value:eI.indexOf("OPEN")});Object.defineProperty(js,"CLOSING",{enumerable:!0,value:eI.indexOf("CLOSING")});Object.defineProperty(js.prototype,"CLOSING",{enumerable:!0,value:eI.indexOf("CLOSING")});Object.defineProperty(js,"CLOSED",{enumerable:!0,value:eI.indexOf("CLOSED")});Object.defineProperty(js.prototype,"CLOSED",{enumerable:!0,value:eI.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(js.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(js.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[bpt])return t[SIo];return null},set(t){for(let r of this.listeners(e))if(r[bpt]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[bpt]:!0})}})});js.prototype.addEventListener=_Io;js.prototype.removeEventListener=RIo;Obr.exports=js;function bbr(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:gIo,protocolVersion:Cpt[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,protocols:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!Cpt.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${Cpt.join(", ")})`);let i;if(t instanceof Apt)i=t;else try{i=new Apt(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),e._url=i.href;let a=i.protocol==="wss:",c=i.protocol==="ws+unix:",l;if(i.protocol!=="ws:"&&!a&&!c?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!i.pathname?l="The URL's pathname is empty":i.hash&&(l="The URL contains a fragment identifier"),l){let v=new SyntaxError(l);if(e._redirects===0)throw v;YAe(e,v);return}let u=a?443:80,p=uIo(16).toString("base64"),h=a?cIo.request:dIo.request,g=new Set,S;if(o.createConnection=o.createConnection||(a?bIo:AIo),o.defaultPort=o.defaultPort||u,o.port=i.port||u,o.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket"},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(S=new gC({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=vIo({[gC.extensionName]:S.offer()})),r.length){for(let v of r){if(typeof v!="string"||!xIo.test(v)||g.has(v))throw new SyntaxError("An invalid or duplicated subprotocol was specified");g.add(v)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(i.username||i.password)&&(o.auth=`${i.username}:${i.password}`),c){let v=o.path.split(":");o.socketPath=v[0],o.path=v[1]}let E;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=a,e._originalHostOrSocketPath=c?o.socketPath:i.host;let v=n&&n.headers;if(n={...n,headers:{}},v)for(let[T,x]of Object.entries(v))n.headers[T.toLowerCase()]=x}else if(e.listenerCount("redirect")===0){let v=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:i.host===e._originalHostOrSocketPath;(!v||e._originalSecure&&!a)&&(delete o.headers.authorization,delete o.headers.cookie,v||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),E=e._req=h(o),e._redirects&&e.emit("redirect",e.url,E)}else E=e._req=h(o);o.timeout&&E.on("timeout",()=>{Ym(e,E,"Opening handshake has timed out")}),E.on("error",v=>{E===null||E[Abr]||(E=e._req=null,YAe(e,v))}),E.on("response",v=>{let T=v.headers.location,x=v.statusCode;if(T&&o.followRedirects&&x>=300&&x<400){if(++e._redirects>o.maxRedirects){Ym(e,E,"Maximum redirects exceeded");return}E.abort();let w;try{w=new Apt(T,t)}catch{let N=new SyntaxError(`Invalid URL: ${T}`);YAe(e,N);return}bbr(e,w,r,n)}else e.emit("unexpected-response",E,v)||Ym(e,E,`Unexpected server response: ${v.statusCode}`)}),E.on("upgrade",(v,T,x)=>{if(e.emit("upgrade",v),e.readyState!==js.CONNECTING)return;E=e._req=null;let w=v.headers.upgrade;if(w===void 0||w.toLowerCase()!=="websocket"){Ym(e,T,"Invalid Upgrade header");return}let D=pIo("sha1").update(p+yIo).digest("base64");if(v.headers["sec-websocket-accept"]!==D){Ym(e,T,"Invalid Sec-WebSocket-Accept header");return}let N=v.headers["sec-websocket-protocol"],A;if(N!==void 0?g.size?g.has(N)||(A="Server sent an invalid subprotocol"):A="Server sent a subprotocol but none was requested":g.size&&(A="Server sent no subprotocol"),A){Ym(e,T,A);return}N&&(e._protocol=N);let k=v.headers["sec-websocket-extensions"];if(k!==void 0){if(!S){Ym(e,T,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let b;try{b=TIo(k)}catch{Ym(e,T,"Invalid Sec-WebSocket-Extensions header");return}let L=Object.keys(b);if(L.length!==1||L[0]!==gC.extensionName){Ym(e,T,"Server indicated an extension that was not requested");return}try{S.accept(b[gC.extensionName])}catch{Ym(e,T,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[gC.extensionName]=S}e.setSocket(T,x,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(E,e):E.end()}function YAe(e,t){e._readyState=js.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function AIo(e){return e.path=e.socketPath,Ibr.connect(e)}function bIo(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Ibr.isIP(e.host)?"":e.host),lIo.connect(e)}function Ym(e,t,r){e._readyState=js.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Ym),t.setHeader?(t[Abr]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(YAe,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function kpt(e,t,r){if(t){let n=hIo(t)?t.size:IIo(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${eI[e.readyState]})`);process.nextTick(r,n)}}function CIo(e,t){let r=this[pd];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[pd]!==void 0&&(r._socket.removeListener("data",ZAe),process.nextTick(Cbr,r._socket),e===1005?r.close():r.close(e,t))}function kIo(){let e=this[pd];e.isPaused||e._socket.resume()}function wIo(e){let t=this[pd];t._socket[pd]!==void 0&&(t._socket.removeListener("data",ZAe),process.nextTick(Cbr,t._socket),t.close(e[EIo])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function Tbr(){this[pd].emitClose()}function NIo(e,t){this[pd].emit("message",e,t)}function PIo(e){let t=this[pd];t._autoPong&&t.pong(e,!this._isServer,xbr),t.emit("ping",e)}function OIo(e){this[pd].emit("pong",e)}function Cbr(e){e.resume()}function LIo(e){let t=this[pd];t.readyState!==js.CLOSED&&(t.readyState===js.OPEN&&(t._readyState=js.CLOSING,kbr(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function kbr(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function wbr(){let e=this[pd];if(this.removeListener("close",wbr),this.removeListener("data",ZAe),this.removeListener("end",Nbr),e._readyState=js.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[pd]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Tbr),e._receiver.on("finish",Tbr))}function ZAe(e){this[pd]._receiver.write(e)||this.pause()}function Nbr(){let e=this[pd];e._readyState=js.CLOSING,e._receiver.end(),this.end()}function Pbr(){let e=this[pd];this.removeListener("error",Pbr),this.on("error",xbr),e&&(e._readyState=js.CLOSING,this.destroy())}});var Ubr=im((Zdc,Mbr)=>{"use strict";var Ydc=QAe(),{Duplex:DIo}=Fa("stream");function Lbr(e){e.emit("close")}function MIo(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Dbr(e){this.removeListener("error",Dbr),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function UIo(e,t){let r=!0,n=new DIo({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(i,a){let c=!a&&n._readableState.objectMode?i.toString():i;n.push(c)||e.pause()}),e.once("error",function(i){n.destroyed||(r=!1,n.destroy(i))}),e.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,i){if(e.readyState===e.CLOSED){i(o),process.nextTick(Lbr,n);return}let a=!1;e.once("error",function(l){a=!0,i(l)}),e.once("close",function(){a||i(o),process.nextTick(Lbr,n)}),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",function(){n._final(o)});return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",function(){o()}),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,i,a){if(e.readyState===e.CONNECTING){e.once("open",function(){n._write(o,i,a)});return}e.send(o,a)},n.on("end",MIo),n.on("error",Dbr),n}Mbr.exports=UIo});var wpt=im((Qdc,Fbr)=>{"use strict";var{tokenChars:FIo}=A$();function HIo(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let a=e.charCodeAt(o);if(n===-1&&FIo[a]===1)r===-1&&(r=o);else if(o!==0&&(a===32||a===9))n===-1&&r!==-1&&(n=o);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let i=e.slice(r,o);if(t.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return t.add(i),t}Fbr.exports={parse:HIo}});var zbr=im((tlc,$br)=>{"use strict";var BIo=Fa("events"),ebe=Fa("http"),{Duplex:elc}=Fa("stream"),{createHash:qIo}=Fa("crypto"),Hbr=XAe(),OL=x$(),jIo=wpt(),WIo=QAe(),{CLOSE_TIMEOUT:$Io,GUID:zIo,kWebSocket:GIo}=YT(),VIo=/^[+/0-9A-Za-z]{22}==$/,Bbr=0,qbr=1,Wbr=2,Npt=class extends BIo{constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:$Io,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:WIo,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=ebe.createServer((n,o)=>{let i=ebe.STATUS_CODES[426];o.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),o.end(i)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=KIo(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,i,a)=>{this.handleUpgrade(o,i,a,n)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Bbr}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===Wbr){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(LZ,this);return}if(t&&this.once("close",t),this._state!==qbr)if(this._state=qbr,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(LZ,this):process.nextTick(LZ,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{LZ(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",jbr);let i=t.headers["sec-websocket-key"],a=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){LL(this,t,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){LL(this,t,r,400,"Invalid Upgrade header");return}if(i===void 0||!VIo.test(i)){LL(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){LL(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){DZ(r,400);return}let l=t.headers["sec-websocket-protocol"],u=new Set;if(l!==void 0)try{u=jIo.parse(l)}catch{LL(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let p=t.headers["sec-websocket-extensions"],h={};if(this.options.perMessageDeflate&&p!==void 0){let g=new OL({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let S=Hbr.parse(p);S[OL.extensionName]&&(g.accept(S[OL.extensionName]),h[OL.extensionName]=g)}catch{LL(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let g={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(g,(S,E,v,T)=>{if(!S)return DZ(r,E||401,v,T);this.completeUpgrade(h,i,u,t,r,n,o)});return}if(!this.options.verifyClient(g))return DZ(r,401)}this.completeUpgrade(h,i,u,t,r,n,o)}completeUpgrade(t,r,n,o,i,a,c){if(!i.readable||!i.writable)return i.destroy();if(i[GIo])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Bbr)return DZ(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${qIo("sha1").update(r+zIo).digest("base64")}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let h=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),p._protocol=h)}if(t[OL.extensionName]){let h=t[OL.extensionName].params,g=Hbr.format({[OL.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${g}`),p._extensions=t}this.emit("headers",u,o),i.write(u.concat(`\r
|
|
238
|
+
`),$8='user_writes_only() { { [ "$1" = "$uid" ] || [ "$1" = 0 ]; } && [ $(( 0$3 & 002 )) -eq 0 ] && { [ $(( 0$3 & 020 )) -eq 0 ] || { [ -n "$upg" ] && [ "$2" = "$upg" ]; }; }; }'});import{createHash as Iho,timingSafeEqual as xho}from"node:crypto";import{closeSync as Aho,constants as z8,fstatSync as xTr,lstatSync as bho,openSync as Cho,statfsSync as kho}from"node:fs";import{lstat as Mxe,open as ATr}from"node:fs/promises";import{isAbsolute as Tlt,resolve as Ilt}from"node:path";var who,Nho,bTr,Pho,Oho,Lho,CTr,TTr,Uxe,BT,kTr,pL,Dho,Mho,Uho,Fho,G8,Hho,Bho,qho,jho,Who,xlt,$ho,ITr,zho,Gho,wTr,Alt,NTr,Vho,Kho,PTr,Xho,Jho,OTr,Yho,Zho,Qho,ego,tgo,rgo,ngo,Xy,LTr,ogo,igo,V8,K8,Fxe,DTr=q(()=>{"use strict";Z();F();G();vlt();who=256*1024*1024,Nho=64*1024,bTr=/^[0-9a-f]{64}$/u,Pho=64,Oho=4095,Lho=new Set([ge.claudeCode,ge.maiaAgent,ge.pi,"codex"]),CTr=e=>{switch(e){case ge.claudeCode:return["claude-code-session"];case ge.maiaAgent:return["maia-agent-session"];case ge.pi:return["pi-session"];case"codex":return["codex-probe","codex-session"];case"pi-rpc":return["pi-rpc-probe","pi-rpc-session"];case"skills":return["skills-listing"];case"git":case"security":case"systemd-creds":case"terminal":return[]}},TTr="skills-listing-1",Uxe=e=>({adapter:"skills",adapterVersion:e.version,executablePath:e.interpreterPath,ownerKinds:["skills-listing"],sandboxPolicyRevision:TTr,sha256:e.interpreterSha256,vouchPolicyRevision:TTr}),BT=()=>f("transport_failed","The requested executable is not admitted by the vouch policy."),kTr=e=>({changedAtNanoseconds:e.ctimeNs,device:e.dev,inode:e.ino,modifiedAtNanoseconds:e.mtimeNs,size:e.size}),pL=(e,t)=>e.ctimeNs===t.changedAtNanoseconds&&e.dev===t.device&&e.ino===t.inode&&e.mtimeNs===t.modifiedAtNanoseconds&&e.size===t.size,Dho=e=>e.uid===0n?e.nlink>0n:e.nlink===1n,Mho=e=>`0${(Number(e.mode)&Oho).toString(8)}`,Uho=({adapter:e,path:t},r)=>{if(r.isSymbolicLink())return`${t}: a symbolic link; fix: approve the file it points to.`;if(!r.isFile())return`${t}: not a regular file.`;if(r.size===0n)return`${t}: an empty file.`;if(!Lho.has(e)&&r.size>BigInt(who))return`${t}: ${r.size.toString()} bytes, over the 256 MiB limit.`},Fho=(e,t,r)=>{let n=Uho(e,t);if(n!==void 0)return n;let{path:o}=e,i=Mho(t),a=vTr({gid:Number(t.gid),mode:Number(t.mode),uid:Number(t.uid)},r);if(a==="foreign_owner")return`${o}: mode ${i}, owner uid ${t.uid.toString()}, not this user (${String(r.uid)}) or root; fix: install it as this user.`;if(a==="writable_by_others")return`${o}: mode ${i}, gid ${t.gid.toString()}, writable by others or a shared group; fix: chmod go-w on it.`;if(!Dho(t))return`${o}: ${t.nlink.toString()} hard links; fix: approve a copy with one link.`;if((Number(t.mode)&Pho)===0)return`${o}: mode ${i}, not executable by its owner; fix: chmod u+x on it.`},G8=(e,t,r)=>{let n=Fho(e,t,r);if(n!==void 0)throw f("configuration_invalid",`The vouch policy refuses ${n}`)},Hho=(e,t)=>{let r=Buffer.from(t,"hex");return e.byteLength===r.byteLength&&xho(e,r)},Bho=(e,t)=>{switch(e.adapter){case"git":return t==="git-inspection";case"security":case"systemd-creds":return t==="secret-store";case"terminal":return t==="interactive-terminal";case ge.claudeCode:case ge.maiaAgent:case ge.pi:case"codex":case"pi-rpc":case"skills":return CTr(e.adapter).includes(t)}},qho=(e,t)=>{switch(e.adapter){case"git":return t.selectedTier==="vouched_runtime"||t.selectedTier==="hard_containment";case"security":return t.selectedTier==="vouched_runtime";case"skills":case"systemd-creds":return t.selectedTier==="hard_containment";case"terminal":return t.selectedTier==="local_user_interactive_terminal";case ge.claudeCode:case ge.maiaAgent:case ge.pi:case"codex":return t.selectedTier==="cooperative_multi_pgid"||t.selectedTier==="hard_containment";case"pi-rpc":return t.selectedTier==="cooperative_pi_rpc_conversation"}},jho=(e,t)=>{let r=t.find(n=>n.executablePath===e.executable&&n.ownerKinds.includes(e.owner.kind));if(r===void 0||!Bho(r,e.owner.kind)||!qho(r,e)||!Tlt(r.executablePath)||Ilt(r.executablePath)!==r.executablePath||!bTr.test(r.sha256)||r.adapterVersion.length===0||r.sandboxPolicyRevision.length===0||r.adapter==="pi-rpc"&&(r.conversationPolicyRevision===void 0||r.conversationPolicyRevision.length===0)||r.vouchPolicyRevision.length===0)throw BT();return r},Who=e=>{G8(e,e.openedMetadata,e.user);let t=kTr(e.openedMetadata);if(!pL(e.pathMetadata,t)||!pL(e.currentMetadata,t)||!Hho(e.digest,e.expectedDigest))throw BT();return t},xlt=new Map,$ho=new Set([16914836n,1481003842n,2435016766n,61267n]),ITr=new Map,zho=()=>{try{let e=Cho("/proc/self/exe",z8.O_RDONLY);try{return[xTr(e,{bigint:!0})]}finally{Aho(e)}}catch{return[]}},Gho=()=>{if(process.platform!=="linux")return[];let[e]=zho();if(e===void 0)return[];try{let{type:t}=kho("/proc/self/exe",{bigint:!0});return[{filesystemType:t,identity:e}]}catch{return[]}},wTr=()=>{let e=ITr.get("exe");if(e!==void 0)return[e];let t=Gho(),[r]=t;return r!==void 0&&ITr.set("exe",r),t},Alt=e=>[e.dev,e.ino,e.size,e.mode,e.uid,e.ctimeNs,e.mtimeNs].join(":"),NTr=e=>e.platform==="linux"&&e.adapter==="skills"&&e.running.some(({filesystemType:t,identity:r})=>$ho.has(t)&&e.metadata.dev===r.dev&&e.metadata.ino===r.ino),Vho=e=>NTr(e)&&e.remembered===Alt(e.metadata),Kho=(e,t,r)=>NTr({adapter:e,metadata:t,platform:process.platform,running:r}),PTr=({executablePath:e,sha256:t})=>`${e}\0${t}`,Xho=(e,t)=>{let{expectation:r,handle:n,pathMetadata:o,signal:i}=e;return Vho({adapter:r.adapter,metadata:o,platform:process.platform,remembered:xlt.get(PTr(r))??"",running:t})?Promise.resolve(Buffer.from(r.sha256,"hex")):OTr(n,o.size,i)},Jho=async e=>{let{expectation:t,handle:r,pathMetadata:n,user:o}=e,i=await Xho(e,wTr()),a=await r.stat({bigint:!0}),c=Who({adapter:t.adapter,currentMetadata:await Mxe(t.executablePath,{bigint:!0}),digest:i,expectedDigest:t.sha256,openedMetadata:a,path:t.executablePath,pathMetadata:n,user:o});return t.adapter==="skills"&&xlt.set(PTr(t),Alt(a)),c},OTr=async(e,t,r)=>{let n=Iho("sha256"),o=Buffer.allocUnsafe(Nho),i=Number(t),a=async c=>{if(c>=i)return;r.throwIfAborted();let{bytesRead:l}=await e.read(o,0,Math.min(o.byteLength,i-c),c);if(l<=0)throw BT();n.update(o.subarray(0,l)),await a(c+l)};return await a(0),r.throwIfAborted(),n.digest()},Yho=async(e,t)=>{let[r,n]=await Promise.all([e.handle.stat({bigint:!0}),Mxe(e.path,{bigint:!0})]);if(!pL(r,t)||!pL(n,t))throw BT()},Zho=(e,t,r)=>({device:t.device.toString(),inode:t.inode.toString(),path:e,sha256:r.toString("hex"),sizeBytes:t.size.toString()}),Qho=async e=>{let t=await e.handle.stat({bigint:!0});G8(e,t,e.user);let r=kTr(t);if(!pL(e.pathMetadata,r))throw BT();let n=await OTr(e.handle,t.size,e.signal);return await Yho(e,r),Kho(e.adapter,t,wTr())&&xlt.set(`${e.path}\0${n.toString("hex")}`,Alt(t)),Zho(e.path,r,n)},ego=async(e,t,r)=>{let{path:n}=e;if(!Tlt(n)||Ilt(n)!==n)throw BT();let o=await Mxe(n,{bigint:!0});G8(e,o,t);let i=await ATr(n,z8.O_RDONLY|z8.O_NOFOLLOW);try{return await Qho({...e,handle:i,pathMetadata:o,signal:r,user:t})}finally{await i.close()}},tgo=e=>({adapter:e.adapter,path:e.executablePath}),rgo=async(e,t,r)=>{let n=await Mxe(e.executablePath,{bigint:!0});G8(tgo(e),n,t);let o=await ATr(e.executablePath,z8.O_RDONLY|z8.O_NOFOLLOW);try{let i=await Jho({expectation:e,handle:o,pathMetadata:n,signal:r,user:t});return{handle:o,identity:i}}catch(i){throw await o.close(),i}},ngo=(e,t,r)=>({adapter:e.adapter,adapterVersion:e.adapterVersion,descriptor:t.handle.fd,identity:t.identity,path:e.executablePath,sandboxPolicyRevision:e.sandboxPolicyRevision,sha256:e.sha256,user:r,vouchPolicyRevision:e.vouchPolicyRevision}),Xy=s.fn("DarwinVouch.inspectTarget")(function*(e,t){let r=yield*Rlt;return yield*s.tryPromise({catch:n=>Le(n,"transport_failed","The requested executable is not admitted by the vouch policy."),try:n=>ego({adapter:t,path:e},r,n)})}),LTr=s.fnUntraced(function*(e){let t=yield*Rlt,r=yield*s.acquireRelease(s.tryPromise({catch:n=>Le(n,"transport_failed","The requested executable is not admitted by the vouch policy."),try:n=>rgo(e,t,n)}),({handle:n})=>s.promise(()=>n.close()).pipe(s.ignore));return ngo(e,r,t)}),ogo=e=>{let t=CTr(e.adapter);return e.ownerKinds.length>0&&e.ownerKinds.every(r=>t.includes(r))},igo=e=>ogo(e)&&Tlt(e.executablePath)&&Ilt(e.executablePath)===e.executablePath&&bTr.test(e.sha256)&&e.adapterVersion.length>0&&e.sandboxPolicyRevision.length>0&&(e.adapter!=="pi-rpc"||e.conversationPolicyRevision!==void 0&&e.conversationPolicyRevision.length>0)&&e.vouchPolicyRevision.length>0,V8=s.fnUntraced(function*(e){return igo(e)?yield*LTr(e):yield*s.fail(BT())}),K8=e=>{try{let t=xTr(e.descriptor,{bigint:!0}),r=bho(e.path,{bigint:!0});if(!pL(t,e.identity)||!pL(r,e.identity))throw BT();G8(e,t,e.user)}catch(t){throw Le(t,"transport_failed","The requested executable is not admitted by the vouch policy.")}},Fxe=s.fnUntraced(function*(e,t){let r=yield*s.try({catch:()=>BT(),try:()=>jho(e,t)});return yield*LTr(r)})});import{createHash as sgo,randomUUID as ago}from"node:crypto";var blt,MTr,iC,Clt,Hxe,Bxe,UTr=q(()=>{"use strict";F();G();blt=new WeakMap,MTr=()=>f("authentication_failed","The Invocation attachment launch authorization is invalid."),iC=e=>`process_${sgo("sha256").update(JSON.stringify({commandId:e.commandId,kind:e.kind,sessionId:e.sessionId,taskId:e.taskId,terminalId:e.terminalId,workspaceId:e.workspaceId})).digest("hex")}`,Clt=e=>{let t=iC(e.owner),r=Object.freeze({attachmentId:e.attachmentId,...e.parentProcessOwnerId===void 0?{}:{parentProcessOwnerId:e.parentProcessOwnerId},processOwnerId:t,slotId:`invocation-slot-${ago().replaceAll("-","")}`});return blt.set(r,{lease:e.lease,processOwnerId:t,state:"available"}),r},Hxe=(e,t)=>{let r=blt.get(e),n=iC(t);return r?.state!=="available"||r.processOwnerId!==n||e.processOwnerId!==n?s.fail(MTr()):s.void},Bxe=s.fn("ProcessResourceManager.consumeInvocationAttachmentLease")(function*(e,t){let r=blt.get(e),n=iC(t);return r?.state!=="available"||r.processOwnerId!==n?yield*s.fail(MTr()):(r.state="consumed",r.lease)})});import{mkdtemp as cgo,open as dgo,rmdir as FTr,unlink as HTr}from"node:fs/promises";import{tmpdir as lgo}from"node:os";import{join as BTr}from"node:path";var ugo,qTr,klt,wlt,pgo,Nlt,jTr=q(()=>{"use strict";F();G();ugo=32,qTr=e=>Le(e,"transport_failed","The protected Invocation attachment handle could not be created."),klt=()=>{},wlt=e=>e.close().catch(klt),pgo=async e=>{let t=Buffer.from(e),r=await cgo(BTr(lgo(),"maia-ic1-")),n=BTr(r,"attachment");try{let o=await dgo(n,"wx+",384);try{return await o.write(t,0,t.byteLength,0),await HTr(n),await FTr(r),o}catch(i){throw await wlt(o),i}}finally{t.fill(0),await HTr(n).catch(klt),await FTr(r).catch(klt)}},Nlt=s.fn("ProcessResourceManager.openInvocationAttachmentNativeLease")(function*(e){return e.byteLength!==ugo?yield*s.fail(qTr(new Error("credential size invalid"))):yield*s.acquireRelease(s.tryPromise({catch:qTr,try:()=>pgo(e)}),t=>s.promise(()=>wlt(t)).pipe(s.asVoid)).pipe(s.map(t=>({close:s.promise(()=>wlt(t)).pipe(s.asVoid),descriptor:t.fd})))})});import{createHash as KTr}from"node:crypto";import{closeSync as XTr,constants as WTr,existsSync as mgo,fstatSync as Mlt,lstatSync as fgo,openSync as hgo,readdirSync as ggo,readFileSync as ygo,readSync as Sgo,realpathSync as JTr}from"node:fs";import{builtinModules as $Tr}from"node:module";import{dirname as Olt,isAbsolute as YTr,join as sC,relative as Ego,resolve as ZTr,sep as Ult}from"node:path";var jxe,Wxe,_go,zTr,Rgo,vgo,Flt,QTr,GTr,eIr,aC,r$,os,tIr,rIr,Tgo,$xe,Igo,Gxe,fL,X8,xgo,Ago,Vxe,zxe,nIr,oIr,iIr,Hlt,bgo,Cgo,kgo,sIr,wgo,aIr,Llt,cIr,mL,Ngo,Pgo,Ogo,Lgo,Dgo,dIr,Mgo,Ugo,Fgo,Hgo,Bgo,qgo,lIr,jgo,Wgo,$go,zgo,Ggo,Kxe,Dlt,Plt,VTr,Xxe,Blt,Vgo,Kgo,qlt,qxe,J8,uIr=q(()=>{"use strict";G();jxe="@maiaos/agent",Wxe="dist/managed-worker/main.js",_go="maia-agent-worker",zTr=["README.md","dist"],Rgo="dist/managed-worker/main.meta.json",vgo=["bin","engines","exports","files","imports","name","piConfig","type"],Flt="package.json",QTr="24.22.1",GTr=/^[0-9a-f]{64}$/u,eIr=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,aC=Object.freeze({maximumFileBytes:32*1024*1024,maximumFiles:4096,maximumInterpreterBytes:256*1024*1024,maximumPathBytes:4096,maximumTotalBytes:64*1024*1024}),r$=()=>f("transport_failed","The packaged managed Pi worker artifact is invalid."),os=()=>{throw r$()},tIr=e=>{try{return e()}catch(t){if(t instanceof lt)throw t;return os()}},rIr=e=>KTr("sha256").update(e).digest("hex"),Tgo=e=>e.length>0&&!e.includes("\0")&&Buffer.byteLength(e,"utf8")<=aC.maximumPathBytes&&YTr(e)&&ZTr(e)===e,$xe=e=>Tgo(e)?e:os(),Igo=e=>e.isFile()?"file":e.isDirectory()?"directory":e.isSymbolicLink()?"symlink":os(),Gxe=e=>Object.freeze({changedAtNanoseconds:e.ctimeNs,device:e.dev,groupId:e.gid,inode:e.ino,linkCount:e.nlink,mode:Number(e.mode),modifiedAtNanoseconds:e.mtimeNs,size:e.size,type:Igo(e),userId:e.uid}),fL=e=>Gxe(fgo(e,{bigint:!0})),X8=(e,t)=>e.changedAtNanoseconds===t.changedAtNanoseconds&&e.device===t.device&&e.groupId===t.groupId&&e.inode===t.inode&&e.linkCount===t.linkCount&&e.mode===t.mode&&e.modifiedAtNanoseconds===t.modifiedAtNanoseconds&&e.size===t.size&&e.type===t.type&&e.userId===t.userId,xgo=(e,t)=>{let r=fL(e),n=typeof process.getuid=="function"?process.getuid():void 0,o=n===void 0||r.userId===0n||r.userId===BigInt(n);return X8(t,r)&&o&&(t.mode&18)===0},Ago={package:"A path of the managed Pi worker package is writable by group or others; reinstall under umask 022 or remove group and other write access.",runtime:"The Node.js runtime is writable by group or others; use a Node.js installation that only you or root can write."},Vxe=(e,t,r="package")=>{if(!xgo(e,t))throw(t.mode&18)===0?r$():f("path_invalid",Ago[r])},zxe=(e,t,{allowSelectedSymlink:r,kind:n="package"})=>{let o=$xe(e),i=fL(o);if(i.type!==t&&!(r&&i.type==="symlink"))return os();let a=$xe(JTr.native(o)),c=fL(a);return c.type!==t?os():(Vxe(a,c,n),Object.freeze({nofollow:Object.freeze({identity:i,path:o}),realpath:Object.freeze({identity:c,path:a})}))},nIr=(e,t,r)=>{let n=fL(e);return n.type!=="file"||n.linkCount!==1n||n.size<0n||n.size>BigInt(t)?os():(Vxe(e,n,r),n)},oIr=e=>{let t=Gxe(Mlt(e.descriptor,{bigint:!0}));(!X8(e.before,e.opened)||e.byteCount!==Number(e.opened.size)||!X8(e.opened,t)||!X8(e.opened,fL(e.path)))&&os()},iIr=e=>hgo(e,WTr.O_RDONLY|(process.platform==="win32"?0:WTr.O_NOFOLLOW)),Hlt=(e,t,r="package")=>{let n=nIr(e,t,r),o=iIr(e);try{let i=Gxe(Mlt(o,{bigint:!0})),a=ygo(o),c=a.byteLength;return oIr({before:n,byteCount:c,descriptor:o,opened:i,path:e}),Object.freeze({bytes:a,identity:i,sha256:rIr(a)})}finally{XTr(o)}},bgo=1024*1024,Cgo=(e,t,r=bgo)=>{let n=KTr("sha256"),o=Buffer.allocUnsafe(r);return{byteCount:Array.from({length:Math.ceil(t/r)+1},(c,l)=>l*r).reduce((c,l)=>{let u=Sgo(e,o,0,r,l);return c+u>t?os():(n.update(o.subarray(0,u)),c+u)},0),sha256:n.digest("hex")}},kgo=(e,t,r)=>{let n=nIr(e,t,r),o=iIr(e);try{let i=Gxe(Mlt(o,{bigint:!0})),{byteCount:a,sha256:c}=Cgo(o,Number(i.size));return oIr({before:n,byteCount:a,descriptor:o,opened:i,path:e}),Object.freeze({identity:i,sha256:c})}finally{XTr(o)}},sIr=e=>{let t=e.split(Ult).join("/"),r=t.split("/");return t.length===0||t.startsWith("/")||t.includes("\\")||t.includes("\0")||r.some(n=>n.length===0||n==="."||n==="..")?os():t},wgo=(e,t)=>{let r=Ego(e,t);return r===""||r===".."||r.startsWith(`..${Ult}`)||YTr(r)?os():sIr(r)},aIr=(e,t,r)=>{e.observations.push({identity:r,path:t}),e.observations.length>aC.maximumFiles*2&&os()},Llt=(e,t,r)=>{let n=Hlt(t,aC.maximumFileBytes);aIr(r,t,n.identity),r.totalBytes+=n.bytes.byteLength,(r.entries.length>=aC.maximumFiles||r.totalBytes>aC.maximumTotalBytes)&&os(),r.entries.push(Object.freeze({byteCount:n.bytes.byteLength,executable:(n.identity.mode&73)!==0,relativePath:wgo(e,t),sha256:n.sha256}))},cIr=(e,t,r)=>{let n=fL(t);n.type!=="directory"&&os(),Vxe(t,n),aIr(r,t,n),ggo(t).toSorted().forEach(o=>{sIr(o);let i=sC(t,o),a=fL(i);a.type==="directory"?cIr(e,i,r):a.type==="file"?Llt(e,i,r):os()})},mL=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ngo=e=>Array.isArray(e),Pgo=new Set([...$Tr,...$Tr.map(e=>`node:${e}`)]),Ogo=e=>{let t=Hlt(sC(e,Rgo),aC.maximumFileBytes).bytes.toString("utf8"),r=JSON.parse(t);if(!mL(r))throw r$();let n=Reflect.get(r,"outputs");if(!mL(n))throw r$();Object.values(n).flatMap(a=>{if(!mL(a))throw r$();let c=Reflect.get(a,"imports");if(!Ngo(c))throw r$();return c}).some(a=>!mL(a)||typeof a.path!="string"||typeof a.external!="boolean"||a.external&&!Pgo.has(a.path))&&os()},Lgo=e=>{if(!mL(e)||!mL(e.exports)||!mL(e.bin))return os();let t=e.files;return e.name!==jxe||typeof e.version!="string"||!eIr.test(e.version)||e.exports["./managed-worker"]!==`./${Wxe}`||e.bin[_go]!==`./${Wxe}`||!Array.isArray(t)||t.length!==zTr.length||!zTr.every(r=>t.includes(r))?os():{loading:Object.fromEntries(vgo.map(r=>[r,e[r]])),name:jxe,version:e.version}},Dgo=e=>Lgo(JSON.parse(Hlt(sC(e,Flt),aC.maximumFileBytes).bytes.toString("utf8"))),dIr=(e,t)=>e===t||Olt(e)===e?os():mgo(sC(e,"package.json"))?e:dIr(Olt(e),t),Mgo=e=>dIr(Olt(e),ZTr(e,Ult)),Ugo=e=>{e.forEach(({identity:t,path:r})=>{Vxe(r,t)})},Fgo=(e,t)=>e.relativePath<t.relativePath?-1:e.relativePath>t.relativePath?1:0,Hgo=(e,t)=>rIr(JSON.stringify({entries:e.filter(({relativePath:r})=>r!==Flt),manifest:t.loading})),Bgo=e=>{let t={entries:[],observations:[],totalBytes:0};Llt(e,sC(e,Flt),t),Llt(e,sC(e,"README.md"),t),cIr(e,sC(e,"dist"),t);let r=Object.freeze(t.entries.toSorted(Fgo)),n=Dgo(e);Ogo(e),Ugo(t.observations);let o=Object.freeze([...t.observations]);return Object.freeze({entries:r,observations:o,packageClosureSha256:Hgo(r,n),packageName:n.name,packageVersion:n.version})},qgo=e=>{if(process.versions.node!==QTr)return os();let t=zxe(e,"file",{allowSelectedSymlink:!0,kind:"runtime"}),r=zxe(process.execPath,"file",{allowSelectedSymlink:!0,kind:"runtime"});if(t.realpath.path!==r.realpath.path)return os();let n=kgo(t.realpath.path,aC.maximumInterpreterBytes,"runtime");return X8(n.identity,t.realpath.identity)?{binding:t,sha256:n.sha256}:os()},lIr=e=>e.packageName===jxe&&eIr.test(e.packageVersion)&>r.test(e.entrySha256)&>r.test(e.packageClosureSha256),jgo=e=>{let t=$xe(e),r=zxe(t,"file",{allowSelectedSymlink:!0}),n=$xe(JTr.native(Mgo(r.realpath.path))),o=zxe(n,"directory",{allowSelectedSymlink:!1}),i=sC(n,...Wxe.split("/"));if(r.realpath.path!==i)return os();let a=Bgo(n),c=a.entries.find(({relativePath:l})=>l===Wxe);return c===void 0?os():{closure:a,entry:r,entryRecord:c,packageRoot:o,packageRootPath:n,selectedEntryPath:t}},Wgo=e=>({entrySha256:e.entryRecord.sha256,packageClosureSha256:e.closure.packageClosureSha256,packageName:e.closure.packageName,packageVersion:e.closure.packageVersion}),$go=(e,t)=>e.entrySha256===t.entrySha256&&e.packageClosureSha256===t.packageClosureSha256&&e.packageName===t.packageName&&e.packageVersion===t.packageVersion,zgo=(e,t)=>{(!lIr(e)||t!==void 0&&!$go(e,t))&&os()},Ggo=e=>Object.freeze({...e.releaseIdentity,closurePhysicalIdentities:e.inspected.closure.observations,entries:e.inspected.closure.entries,entryPath:e.inspected.entry.realpath.path,entryPhysicalIdentity:e.inspected.entry,interpreterPath:e.interpreter.binding.realpath.path,interpreterPhysicalIdentity:e.interpreter.binding,interpreterSha256:e.interpreter.sha256,interpreterVersion:QTr,packageRootPath:e.inspected.packageRootPath,packageRootPhysicalIdentity:e.inspected.packageRoot,selectedEntryPath:e.inspected.selectedEntryPath,selectedInterpreterPath:e.selectedInterpreterPath}),Kxe=e=>tIr(()=>{let t=jgo(e.entryPath),r=Wgo(t);zgo(r,e.expectedRelease);let n=e.interpreterPath??process.execPath,o=qgo(n);return Ggo({inspected:t,interpreter:o,releaseIdentity:r,selectedInterpreterPath:n})}),Dlt=e=>({...e,changedAtNanoseconds:e.changedAtNanoseconds.toString(),device:e.device.toString(),groupId:e.groupId.toString(),inode:e.inode.toString(),linkCount:e.linkCount.toString(),modifiedAtNanoseconds:e.modifiedAtNanoseconds.toString(),size:e.size.toString(),userId:e.userId.toString()}),Plt=e=>({nofollow:{identity:Dlt(e.nofollow.identity),path:e.nofollow.path},realpath:{identity:Dlt(e.realpath.identity),path:e.realpath.path}}),VTr=e=>JSON.stringify({...e,closurePhysicalIdentities:e.closurePhysicalIdentities.map(({identity:t,path:r})=>({identity:Dlt(t),path:r})),entryPhysicalIdentity:Plt(e.entryPhysicalIdentity),interpreterPhysicalIdentity:Plt(e.interpreterPhysicalIdentity),packageRootPhysicalIdentity:Plt(e.packageRootPhysicalIdentity)}),Xxe=e=>{tIr(()=>{let t=Kxe({entryPath:e.selectedEntryPath,expectedRelease:{entrySha256:e.entrySha256,packageClosureSha256:e.packageClosureSha256,packageName:e.packageName,packageVersion:e.packageVersion},interpreterPath:e.selectedInterpreterPath});if(VTr(t)!==VTr(e))return os()})},Blt=e=>Object.freeze({entrySha256:e.entrySha256,packageClosureSha256:e.packageClosureSha256,packageName:e.packageName,packageVersion:e.packageVersion}),Vgo=["MAIA_NODE_MANAGED_PI_WORKER_CLOSURE_SHA256","MAIA_NODE_MANAGED_PI_WORKER_ENTRY_SHA256","MAIA_NODE_MANAGED_PI_WORKER_PACKAGE_NAME","MAIA_NODE_MANAGED_PI_WORKER_PACKAGE_VERSION"],Kgo=e=>JSON.stringify(e)??"undefined",qlt=e=>Object.fromEntries(Vgo.map((t,r)=>[t,Kgo([e?.packageClosureSha256,e?.entrySha256,e?.packageName,e?.packageVersion][r])])),qxe=e=>{try{return e()}catch(t){if(t instanceof ReferenceError)return;throw t}},J8=()=>{let e=[qxe(()=>"46c90bb11a15acec3441bd4212bf416ff5280cf60a769d2ecbac4ae5b6e53a28"),qxe(()=>"7174f15101ef045ba1a60eaa433881fb8df4e5381c5d58cca41470d68271852a"),qxe(()=>"@maiaos/agent"),qxe(()=>"0.1.0-canary.70")];if(e.every(a=>a===void 0))return;let[t,r,n,o]=e,i={entrySha256:r,packageClosureSha256:t,packageName:n,packageVersion:o};return typeof r!="string"||typeof t!="string"||n!==jxe||typeof o!="string"||!lIr(i)?os():Object.freeze(i)}});import{isAbsolute as Xgo,resolve as Jgo}from"node:path";var pIr,Ygo,Zgo,Y8,Qgo,eyo,tyo,Jxe,mIr=q(()=>{"use strict";ns();pIr=([e],[t])=>e<t?-1:e>t?1:0,Ygo=(e,t)=>{let r=Object.entries(e).toSorted(pIr),n=Object.entries(t).toSorted(pIr);return r.length===n.length&&r.every(([o,i],a)=>n[a]?.[0]===o&&n[a]?.[1]===i)},Zgo=(e,t)=>e.kind===t.kind&&e.commandId===t.commandId&&e.sessionId===t.sessionId&&e.taskId===t.taskId&&e.terminalId===t.terminalId&&e.workspaceId===t.workspaceId,Y8=(e,t)=>e.executable===t.executable&&e.workingDirectory===t.workingDirectory&&e.standardInput===t.standardInput&&e.arguments_.length===t.arguments_.length&&e.arguments_.every((r,n)=>t.arguments_[n]===r)&&Ygo(e.environment,t.environment)&&Zgo(e.owner,t.owner)&&e.limits.maximumCpuTimeMilliseconds===t.limits.maximumCpuTimeMilliseconds&&e.limits.maximumMemoryBytes===t.limits.maximumMemoryBytes&&e.limits.maximumProcessCount===t.limits.maximumProcessCount&&e.limits.maximumWallTimeMilliseconds===t.limits.maximumWallTimeMilliseconds&&e.streamLimits.maximumDataChunkBytes===t.streamLimits.maximumDataChunkBytes&&e.streamLimits.maximumPendingInputBytes===t.streamLimits.maximumPendingInputBytes&&e.streamLimits.maximumPendingOutputBytes===t.streamLimits.maximumPendingOutputBytes&&e.interactiveTerminal===void 0&&t.interactiveTerminal===void 0&&e.repositoryAuthority===void 0&&t.repositoryAuthority===void 0,Qgo=e=>e.interpreterVersion==="24.22.1"&&e.packageName==="@maiaos/agent"&&/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.test(e.packageVersion)&&[e.entryPath,e.interpreterPath].every(t=>Xgo(t)&&Jgo(t)===t)&&[e.entrySha256,e.interpreterSha256,e.packageClosureSha256].every(t=>/^[0-9a-f]{64}$/u.test(t)),eyo=e=>{let t=Object.keys(e).toSorted();return t.length===2&&t[0]==="LANG"&&t[1]==="LC_ALL"&&e.LANG==="C"&&e.LC_ALL==="C"},tyo=(e,t)=>{let r=Km(e.launchRequest);return r.state==="valid"&&t.owner.kind==="pi-managed-session"&&t.owner.commandId!==void 0&&t.owner.sessionId!==void 0&&t.owner.workspaceId!==void 0&&Qgo(e.artifact)&&e.artifact.interpreterPath===t.executable&&t.arguments_.length===1&&t.arguments_[0]===e.artifact.entryPath&&t.standardInput==="pipe"&&eyo(t.environment)&&Y8(r.request,t)},Jxe=(e,t)=>{if(e.owner.kind!=="pi-managed-session")return;let r=t?.managedPi;return r!==void 0&&tyo(r,e)?r:void 0}});import{dirname as fIr,isAbsolute as hIr,join as Z8,normalize as ryo,relative as nyo,resolve as oyo,sep as iyo}from"node:path";var Q8,C_,Dl,syo,ayo,Ko,or,cyo,dyo,lyo,uyo,Ah,Yxe,eZ,jlt,pyo,myo,fyo,hyo,gyo,yyo,Syo,Eyo,n$,Wlt=q(()=>{"use strict";F();Q8="24.22.1",C_="1.0.0",Dl={exitDrainDeadline:"1 second",maximumInputRecordBytes:64*1024,maximumMessageEndRecords:16,maximumOutputRecordBytes:1024*1024,maximumOutputRecordsPerChunk:4096,maximumOutstandingRequests:8,maximumPendingInputBytes:128*1024,maximumPendingInputRecords:8,maximumPromptBytes:48*1024,maximumRequestIdBytes:128,maximumStderrBytes:64*1024,maximumStdoutBytes:16*1024*1024,requestDeadline:"10 seconds"},syo=d.Literals(["command_rejected","cleanup_unknown","input_limit_exceeded","invalid_request","lifecycle_invalid","output_limit_exceeded","prompt_acceptance_unknown","protocol_invalid","request_outcome_unknown","runtime_exited","saturated","transport_failed"]),ayo=d.TaggedError,Ko=class extends ayo("@maiaos/node/pi-rpc-failure")("PiRpcFailure",{message:d.String,reason:syo}){},or=(e,t)=>new Ko({message:t,reason:e}),cyo=/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/u,dyo=/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u,lyo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,uyo=/^[0-9a-f]{64}$/u,Ah=e=>{throw or("invalid_request",e)},Yxe=(e,t,r)=>e.length===0||e.includes("\0")||Buffer.byteLength(e,"utf8")>r?Ah(`The Pi RPC ${t} is invalid.`):e,eZ=(e,t)=>(Yxe(e,t,4096),!hIr(e)||ryo(e)!==e||oyo(e)!==e?Ah(`The Pi RPC ${t} must be an absolute normalized path.`):e),jlt=(e,t)=>uyo.test(e)?e:Ah(`The Pi RPC ${t} must be a lowercase SHA-256.`),pyo=e=>(Yxe(e,"session id",128),cyo.test(e)?e:Ah("The Pi RPC session id is invalid.")),myo=(e,t)=>{let r=nyo(e,t);return r.length>0&&r!==".."&&!r.startsWith(`..${iyo}`)&&!hIr(r)},fyo=e=>e.interpreterVersion!==Q8?Ah(`Pi RPC requires the exact Node ${Q8} interpreter.`):(eZ(e.interpreterPath,"interpreter path"),eZ(e.entryPath,"entry path"),jlt(e.interpreterSha256,"interpreter digest"),jlt(e.entrySha256,"entry digest"),jlt(e.packageClosureSha256,"package-closure digest"),Yxe(e.packageName,"package name",214),Yxe(e.packageVersion,"package version",128),dyo.test(e.packageName)?lyo.test(e.packageVersion)?Object.freeze({...e}):Ah("The Pi RPC package version is invalid."):Ah("The Pi RPC package name is invalid.")),hyo=(e,t)=>{let r=Z8(e,"harness","pi-rpc",t);return{agentDirectory:Z8(r,"agent"),homeDirectory:Z8(r,"home"),sessionDirectory:Z8(r,"sessions"),temporaryDirectory:Z8(r,"tmp")}},gyo=(e,t,r)=>{if(e.kind==="fresh"&&e.sessionFile===void 0)return{kind:"fresh",sessionId:r};if(e.sessionFile===void 0)return Ah("The Pi RPC session file is missing.");let n=eZ(e.sessionFile,e.kind==="fresh"?"prepared fresh session file":"resume session file");return(fIr(n)!==t.sessionDirectory||!myo(t.sessionDirectory,n)||!n.endsWith(".jsonl"))&&Ah("The Pi RPC resume file must be an exact file in its node-private session directory."),{kind:e.kind,sessionFile:n,sessionId:r}},yyo=(e,t,r)=>{let n;if(t.kind==="fresh"&&t.sessionFile===void 0)n=["--session-id",t.sessionId];else{if(t.sessionFile===void 0)return Ah("The Pi RPC session file is missing.");n=["--session",t.sessionFile]}return Object.freeze([e.entryPath,"--mode","rpc","--session-dir",r,...n,"--no-tools","--no-extensions","--no-skills","--no-prompt-templates","--no-themes","--no-context-files","--no-approve","--offline"])},Syo=e=>Object.freeze({HOME:e.homeDirectory,LANG:"C",LC_ALL:"C",NO_COLOR:"1",NODE_DISABLE_COMPILE_CACHE:"1",PI_CODING_AGENT_DIR:e.agentDirectory,PI_CODING_AGENT_SESSION_DIR:e.sessionDirectory,PI_OFFLINE:"1",PI_TELEMETRY:"0",TMPDIR:e.temporaryDirectory}),Eyo=e=>{let t=eZ(e.nodePrivateRoot,"node-private root");fIr(t)===t&&Ah("The Pi RPC node-private root cannot be a filesystem root.");let r=eZ(e.workingDirectory,"working directory"),n=pyo(e.activation.sessionId),o=hyo(t,n);return{activation:gyo(e.activation,o,n),paths:o,workingDirectory:r}},n$=e=>{let t=fyo(e.artifact),{activation:r,paths:n,workingDirectory:o}=Eyo(e);return r.sessionFile!==void 0&&t.packageVersion!==C_&&Ah(`Pi RPC persistent sessions require the exact ${C_} package format.`),Object.freeze({activation:r,...n,arguments_:yyo(t,r,n.sessionDirectory),artifact:t,environment:Syo(n),executable:t.interpreterPath,workingDirectory:o})}});var o$,$lt=q(()=>{"use strict";o$=(e,t)=>e===t?0:e<t?-1:1});import{createHash as _yo}from"node:crypto";import{closeSync as Ryo,constants as gIr,existsSync as vyo,fstatSync as yIr,lstatSync as EIr,openSync as Tyo,readdirSync as _Ir,readFileSync as Iyo,realpathSync as Xlt}from"node:fs";import{dirname as zlt,isAbsolute as RIr,join as Jlt,normalize as xyo,relative as Ayo,resolve as Ylt,sep as Glt}from"node:path";var byo,Cyo,kyo,qT,wyo,Nyo,vIr,ji,Pyo,TIr,Zxe,Oyo,Vlt,hL,k_,Qxe,Klt,Lyo,eAe,Zlt,Qlt,IIr,Dyo,SIr,xIr,Myo,Uyo,Fyo,Hyo,Byo,AIr,bIr,qyo,jyo,Wyo,$yo,zyo,Gyo,Vyo,Kyo,Xyo,Jyo,jT,CIr=q(()=>{"use strict";F();Wlt();$lt();byo="@earendil-works/pi-coding-agent",Cyo=/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u,kyo=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u,qT=Object.freeze({maximumExcludedBinEntries:256,maximumFileBytes:16*1024*1024,maximumFiles:16384,maximumFilesystemEntries:16384,maximumInterpreterBytes:256*1024*1024,maximumManifestBytes:8*1024*1024,maximumPathBytes:4096,maximumTotalBytes:256*1024*1024}),wyo=d.Struct({bin:d.Struct({pi:d.String}),name:d.String,version:d.String}),Nyo=d.decodeUnknownSync(d.fromJsonString(wyo)),vIr=()=>or("invalid_request","The selected Pi RPC artifact is invalid."),ji=()=>{throw vIr()},Pyo=e=>{try{return e()}catch(t){throw t instanceof Ko?t:vIr()}},TIr=e=>_yo("sha256").update(e).digest("hex"),Zxe=e=>e.length===0||e.includes("\0")||Buffer.byteLength(e,"utf8")>qT.maximumPathBytes||!RIr(e)||xyo(e)!==e||Ylt(e)!==e?ji():e,Oyo=e=>e.isFile()?"file":e.isDirectory()?"directory":e.isSymbolicLink()?"symlink":ji(),Vlt=e=>Object.freeze({changedAtNanoseconds:e.ctimeNs,device:e.dev,inode:e.ino,linkCount:e.nlink,mode:Number(e.mode),modifiedAtNanoseconds:e.mtimeNs,size:e.size,type:Oyo(e)}),hL=(e,t)=>e.changedAtNanoseconds===t.changedAtNanoseconds&&e.device===t.device&&e.inode===t.inode&&e.linkCount===t.linkCount&&e.mode===t.mode&&e.modifiedAtNanoseconds===t.modifiedAtNanoseconds&&e.size===t.size&&e.type===t.type,k_=e=>Vlt(EIr(e,{bigint:!0})),Qxe=(e,t,r)=>{let n=Zxe(e),o=k_(n);if(o.type!==t&&!(r&&o.type==="symlink"))return ji();let i=Zxe(Xlt.native(n)),a=k_(i);return a.type!==t?ji():Object.freeze({nofollow:Object.freeze({identity:o,path:n}),realpath:Object.freeze({identity:a,path:i})})},Klt=e=>{let t=k_(e.nofollow.path),r=Zxe(Xlt.native(e.nofollow.path)),n=k_(e.realpath.path);(r!==e.realpath.path||!hL(t,e.nofollow.identity)||!hL(n,e.realpath.identity))&&ji()},Lyo=e=>Buffer.from(e,"utf8").some(t=>t<=31||t===127),eAe=e=>{let t=e.split("/");return e.length===0||e.includes("\\")||e.startsWith("/")||Buffer.byteLength(e,"utf8")>qT.maximumPathBytes||Lyo(e)||t.some(r=>r.length===0||r==="."||r==="..")?ji():e},Zlt=(e,t)=>{let r=Ayo(e,t);return r.length===0||r===".."||r.startsWith(`..${Glt}`)||RIr(r)?ji():eAe(r.split(Glt).join("/"))},Qlt=(e,t,r)=>{IIr(e),e.observed.push({identity:r,path:t})},IIr=e=>{e.filesystemEntryCount+=1,e.filesystemEntryCount>qT.maximumFilesystemEntries&&ji()},Dyo=e=>{e.excludedBinEntryCount+=1,e.excludedBinEntryCount>qT.maximumExcludedBinEntries&&ji()},SIr=(e,t)=>{(e.type!=="file"||e.linkCount!==1n||e.size<0n||e.size>BigInt(t))&&ji()},xIr=(e,t)=>{let r=k_(e);SIr(r,t);let n=Tyo(e,gIr.O_RDONLY|gIr.O_NOFOLLOW);try{let o=Vlt(yIr(n,{bigint:!0}));SIr(o,t),hL(r,o)||ji();let i=Iyo(n),a=Vlt(yIr(n,{bigint:!0})),c=k_(e);return(i.byteLength!==Number(o.size)||!hL(o,a)||!hL(o,c))&&ji(),{bytes:i,identity:o,sha256:TIr(i)}}finally{Ryo(n)}},Myo=(e,t)=>o$(e.relativePath,t.relativePath),Uyo=(e,t,r)=>{t==="package.json"&&(e.state.packageManifestText=new TextDecoder("utf-8",{fatal:!0}).decode(r.bytes)),t===e.entryRelativePath&&(e.state.entrySha256=r.sha256)},Fyo=(e,t,r)=>{e.entries.push(Object.freeze({byteCount:r.bytes.byteLength,executable:(r.identity.mode&73)!==0,relativePath:t,sha256:r.sha256}))},Hyo=(e,t)=>{let r=Zlt(e.root,t),n=xIr(t,qT.maximumFileBytes);Qlt(e.state,t,n.identity),e.state.fileCount+=1,e.state.totalBytes+=n.bytes.byteLength,(e.state.fileCount>qT.maximumFiles||e.state.totalBytes>qT.maximumTotalBytes)&&ji(),Fyo(e.state,r,n),Uyo(e,r,n)},Byo=(e,t)=>{let r=Zlt(e,t);return r==="node_modules/.bin"||r.startsWith("node_modules/")&&r.endsWith("/node_modules/.bin")},AIr=(e,t)=>{let r=k_(t);r.type!=="directory"&&ji(),Qlt(e,t,r),_Ir(t).forEach(n=>{eAe(n);let o=Jlt(t,n),i=EIr(o,{bigint:!0});i.isDirectory()&&!i.isSymbolicLink()?AIr(e,o):(IIr(e),Dyo(e))})},bIr=(e,t)=>{let r=k_(t);r.type!=="directory"&&ji(),Qlt(e.state,t,r),_Ir(t).sort().forEach(o=>{eAe(o);let i=Jlt(t,o),a=k_(i);a.type==="directory"?Byo(e.root,i)?AIr(e.state,i):bIr(e,i):a.type==="file"?Hyo(e,i):ji()})},qyo=e=>{e.forEach(t=>{hL(k_(t.path),t.identity)||ji()})},jyo=()=>({entries:[],entrySha256:void 0,excludedBinEntryCount:0,fileCount:0,filesystemEntryCount:0,observed:[],packageManifestText:void 0,totalBytes:0}),Wyo=e=>{let t=Ylt(e,Glt),r=n=>vyo(Jlt(n,"package.json"))?n:n===t||zlt(n)===n?ji():r(zlt(n));return r(zlt(e))},$yo=(e,t,r)=>{if(e===void 0)return ji();let n=Nyo(e);if(n.name!==byo||!Cyo.test(n.name)||!kyo.test(n.version))return ji();let o=eAe(n.bin.pi.startsWith("./")?n.bin.pi.slice(2):n.bin.pi);return Ylt(t,o)!==r?ji():{name:n.name,version:n.version}},zyo=e=>{let t=JSON.stringify(e.map(({byteCount:n,executable:o,relativePath:i,sha256:a})=>({byteCount:n,executable:o,relativePath:i,sha256:a}))),r=Buffer.byteLength(t,"utf8");return r>qT.maximumManifestBytes&&ji(),{bytes:r,sha256:TIr(t)}},Gyo=e=>Object.freeze(e.entries.sort(Myo).map((t,r)=>Object.freeze({...t,ordinal:r}))),Vyo=(e,t)=>{let r=Zlt(e,t),n=jyo();bIr({entryRelativePath:r,root:e,state:n},e),qyo(n.observed);let o=Gyo(n),i=$yo(n.packageManifestText,e,t);if(n.entrySha256===void 0)return ji();let a=zyo(o);return{entries:o,entrySha256:n.entrySha256,excludedBinEntryCount:n.excludedBinEntryCount,fileCount:n.fileCount,manifestBytes:a.bytes,packageClosureSha256:a.sha256,packageName:i.name,packageVersion:i.version,totalBytes:n.totalBytes}},Kyo=e=>Object.freeze({closureSha256:e.closure.packageClosureSha256,entries:e.closure.entries,entryPath:e.entry.realpath.path,entryPhysicalIdentity:e.entry,entrySha256:e.closure.entrySha256,excludedBinEntryCount:e.closure.excludedBinEntryCount,fileCount:e.closure.fileCount,interpreterPath:e.interpreter.binding.realpath.path,interpreterPhysicalIdentity:e.interpreter.binding,interpreterSha256:e.interpreter.sha256,interpreterVersion:Q8,manifestBytes:e.closure.manifestBytes,packageClosureSha256:e.closure.packageClosureSha256,packageName:e.closure.packageName,packageRootPath:e.packageRootPath,packageRootPhysicalIdentity:e.packageRoot,packageVersion:e.closure.packageVersion,totalBytes:e.closure.totalBytes}),Xyo=e=>{process.versions.node!==Q8&&ji();let t=Qxe(e,"file",!0),r=Qxe(process.execPath,"file",!0);t.realpath.path!==r.realpath.path&&ji();let n=xIr(t.realpath.path,qT.maximumInterpreterBytes);return hL(n.identity,t.realpath.identity)||ji(),Klt(t),{binding:t,sha256:n.sha256}},Jyo=e=>{let t=Xyo(e.interpreterPath),r=Qxe(e.piExecutablePath,"file",!0),n=Zxe(Xlt.native(Wyo(r.realpath.path))),o=Qxe(n,"directory",!1);o.realpath.path!==n&&ji();let i=Vyo(n,r.realpath.path);return Klt(r),Klt(o),Kyo({closure:i,entry:r,interpreter:t,packageRoot:o,packageRootPath:n})},jT=e=>Pyo(()=>Jyo(e))});var bu=q(()=>{"use strict";CIr();Wlt();$lt()});import{dirname as Yyo,isAbsolute as tZ,resolve as rZ}from"node:path";var NIr,kIr,Zyo,Qyo,eSo,tSo,rSo,wIr,nSo,i$,oSo,iSo,sSo,aSo,tAe,PIr=q(()=>{"use strict";bu();ns();NIr=e=>(e.kind==="pi-rpc-probe"||e.kind==="pi-rpc-session")&&e.commandId!==void 0&&e.sessionId!==void 0,kIr=(e,t)=>e<t?-1:e>t?1:0,Zyo=(e,t)=>{let r=Object.entries(e).sort(([o],[i])=>kIr(o,i)),n=Object.entries(t).sort(([o],[i])=>kIr(o,i));return r.length===n.length&&r.every(([o,i],a)=>n[a]?.[0]===o&&n[a]?.[1]===i)},Qyo=(e,t)=>e.kind===t.kind&&e.commandId===t.commandId&&e.sessionId===t.sessionId&&e.taskId===t.taskId&&e.terminalId===t.terminalId&&e.workspaceId===t.workspaceId,eSo=(e,t)=>e.executable===t.executable&&e.workingDirectory===t.workingDirectory&&e.standardInput===t.standardInput&&e.arguments_.length===t.arguments_.length&&e.arguments_.every((r,n)=>t.arguments_[n]===r)&&Zyo(e.environment,t.environment)&&Qyo(e.owner,t.owner)&&e.limits.maximumCpuTimeMilliseconds===t.limits.maximumCpuTimeMilliseconds&&e.limits.maximumMemoryBytes===t.limits.maximumMemoryBytes&&e.limits.maximumProcessCount===t.limits.maximumProcessCount&&e.limits.maximumWallTimeMilliseconds===t.limits.maximumWallTimeMilliseconds&&e.streamLimits.maximumDataChunkBytes===t.streamLimits.maximumDataChunkBytes&&e.streamLimits.maximumPendingInputBytes===t.streamLimits.maximumPendingInputBytes&&e.streamLimits.maximumPendingOutputBytes===t.streamLimits.maximumPendingOutputBytes&&e.interactiveTerminal===void 0&&t.interactiveTerminal===void 0&&e.repositoryAuthority===void 0&&t.repositoryAuthority===void 0,tSo=e=>{let t=e.nativeSession.activation,r=t.sessionFile===void 0?["--session-id",e.nativeSession.id]:["--session",t.sessionFile];return[e.artifact.entryPath,"--mode","rpc","--session-dir",e.nativeSession.directory,...r,"--no-tools","--no-extensions","--no-skills","--no-prompt-templates","--no-themes","--no-context-files","--no-approve","--offline"]},rSo=(e,t)=>e.length===t.length&&e.every((r,n)=>t[n]===r),wIr=new Set(["HOME","LANG","LC_ALL","NODE_DISABLE_COMPILE_CACHE","NO_COLOR","PI_CODING_AGENT_DIR","PI_CODING_AGENT_SESSION_DIR","PI_OFFLINE","PI_TELEMETRY","TMPDIR"]),nSo=(e,t)=>{let r=e.environment,n=Object.keys(r);return n.length===wIr.size&&n.every(o=>wIr.has(o))&&r.LANG==="C"&&r.LC_ALL==="C"&&r.NODE_DISABLE_COMPILE_CACHE==="1"&&r.NO_COLOR==="1"&&r.PI_CODING_AGENT_SESSION_DIR===t&&r.PI_OFFLINE==="1"&&r.PI_TELEMETRY==="0"&&[r.HOME,r.PI_CODING_AGENT_DIR,r.TMPDIR].every(o=>o!==void 0&&tZ(o)&&rZ(o)===o)},i$=e=>e.length>0&&!e.includes("\0")&&Buffer.byteLength(e,"utf8")<=128,oSo=e=>e.interpreterVersion==="24.22.1"&&tZ(e.interpreterPath)&&rZ(e.interpreterPath)===e.interpreterPath&&tZ(e.entryPath)&&rZ(e.entryPath)===e.entryPath&&[e.interpreterSha256,e.entrySha256,e.packageClosureSha256].every(t=>/^[0-9a-f]{64}$/u.test(t))&&/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u.test(e.packageName)&&/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.test(e.packageVersion),iSo=e=>tZ(e.directory)&&rZ(e.directory)===e.directory&&/^(?:[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)$/u.test(e.id)&&(e.activation.sessionFile===void 0||tZ(e.activation.sessionFile)&&rZ(e.activation.sessionFile)===e.activation.sessionFile&&Yyo(e.activation.sessionFile)===e.directory),sSo=e=>{let{artifact:t,authorizationRevision:r,fenceId:n,nativeSession:o,permitId:i,policy:a}=e;return i$(r)&&i$(n)&&i$(i)&&oSo(t)&&iSo(o)&&i$(a.adapterVersion)&&i$(a.conversationPolicyRevision)&&i$(a.vouchPolicyRevision)},aSo=(e,t)=>{let r=Km(e.launchRequest);return r.state==="valid"&&NIr(t.owner)&&sSo(e)&&(t.owner.kind!=="pi-rpc-session"||e.nativeSession.activation.sessionFile!==void 0&&e.artifact.packageVersion===C_)&&e.launchRequest.owner.kind===t.owner.kind&&e.launchRequest.owner.commandId===t.owner.commandId&&e.launchRequest.owner.sessionId===t.owner.sessionId&&e.artifact.interpreterPath===t.executable&&rSo(t.arguments_,tSo(e))&&nSo(t,e.nativeSession.directory)&&eSo(r.request,t)},tAe=(e,t)=>{if(!NIr(e.owner))return;let r=t?.piRpc;return r!==void 0&&aSo(r,e)?r:void 0}});import{createHash as LIr}from"node:crypto";import{lstatSync as cSo}from"node:fs";import{dirname as s$,isAbsolute as dSo,join as cC,relative as DIr,sep as OIr}from"node:path";import{fileURLToPath as lSo}from"node:url";var a$,eut,uSo,pSo,gL,bh,mSo,fSo,rAe,WT,hSo,tut,MIr,UIr,gSo,ySo,SSo,ESo,FIr,_So,HIr,BIr,RSo,vSo,TSo,ISo,xSo,qIr,nAe,oAe,jIr=q(()=>{"use strict";F();G();a$="1.7.0",eut=Object.freeze({maximumEntries:4096,maximumFileBytes:8*1024*1024,maximumTotalBytes:16*1024*1024}),uSo=/\.(?:c?js|mjs|json)$/u,pSo=d.fromJsonString(d.Struct({bin:d.optionalKey(d.Unknown),dependencies:d.optionalKey(d.Record(d.String,d.Unknown)),name:d.optionalKey(d.Unknown),version:d.optionalKey(d.Unknown)})),gL=()=>f("transport_failed","The bundled Skills CLI does not match the package this Node was built with."),bh=s.fail(gL()),mSo=e=>{let t=process.getuid?.();return(t===void 0||Number(e.uid)===t||Number(e.uid)===0)&&(Number(e.mode)&18)===0},fSo=e=>e.isFile()?"file":e.isDirectory()?"directory":void 0,rAe=(e,t)=>s.try({catch:gL,try:()=>{let r=cSo(e,{bigint:!0}),n=fSo(r);if(n===void 0||t!==void 0&&n!==t||!mSo(r))throw gL();return{kind:n,size:r.size}}}),WT=(e,t)=>{let r=DIr(e,t);return r!==""&&!r.startsWith("..")&&!dSo(r)},hSo=1024*1024,tut=(e,t)=>{let r=cC(t,"package.json");return rAe(r,"file").pipe(s.filterOrFail(({size:n})=>n<=BigInt(hSo),gL),s.flatMap(()=>e.readFileString(r)),s.flatMap(d.decodeUnknownEffect(pSo)))},MIr=(e,t,r=t)=>e.fs.readDirectory(r).pipe(s.flatMap(n=>(e.closure.entries+=n.length,e.closure.entries>eut.maximumEntries?bh:s.forEach(n,o=>{let i=cC(r,o);return o==="node_modules"&&r===t?s.succeed([]):rAe(i).pipe(s.flatMap(({kind:a})=>a==="directory"?MIr(e,t,i):s.succeed([i])))}))),s.map(n=>n.flat())),UIr=(e,t,r)=>e.realPath(cC(t,"node_modules",r)).pipe(s.catch(()=>{let n=s$(t);return n===t?bh:UIr(e,n,r)})),gSo=(e,t,r)=>s.gen(function*(){let{closure:n,fs:o}=e,{size:i}=yield*rAe(r,"file");if(n.total+=Number(i),i>BigInt(eut.maximumFileBytes)||n.total>eut.maximumTotalBytes)return yield*bh;let a=yield*o.readFile(r);return n.hash.update(`${DIr(t,r)}\0${String(a.byteLength)}\0`),n.hash.update(LIr("sha256").update(a).digest()),r}),ySo=e=>Object.keys(e.dependencies??{}).toSorted(),SSo=(e,t)=>MIr(e,t).pipe(s.flatMap(r=>s.forEach(r.toSorted().filter(n=>uSo.test(n)),n=>gSo(e,t,n)))),ESo=(e,t)=>s.gen(function*(){let{closure:r,fs:n,prefix:o}=e;if(!WT(o,t))return yield*bh;r.seen.add(t),yield*rAe(t,"directory");let i=yield*tut(n,t);return r.hash.update(`${String(i.name)}@${String(i.version)}\0`),i}),FIr=(e,t)=>s.gen(function*(){if(e.closure.seen.has(t))return[];let r=yield*ESo(e,t),n=yield*SSo(e,t),o=yield*s.forEach(ySo(r),i=>UIr(e.fs,t,i).pipe(s.flatMap(a=>FIr(e,a))));return[...n,...o.flat()]}),_So="@maiaos/node",HIr=(e,t)=>tut(e,t).pipe(s.flatMap(r=>r.name===_So?s.succeed(t):bh),s.catch(()=>{let r=s$(t);return r===t?bh:HIr(e,r)})),BIr=(e,t)=>e.exists(cC(t,"pnpm-workspace.yaml")).pipe(s.flatMap(r=>{let n=s$(t);return r?s.succeed(t):n===t?bh:BIr(e,n)}),s.mapError(gL)),RSo=(e,t)=>s.gen(function*(){let r=yield*HIr(e,s$(t)),n=r.indexOf(`${OIr}node_modules${OIr}`),o=n>0?r.slice(0,n):yield*BIr(e,r);return{modules:n>0?s$(s$(r)):cC(r,"node_modules"),own:r,prefix:o}}),vSo=(e,t)=>{let{bin:r}=t,n=typeof r=="string"?r:r?.skills,o=typeof n=="string"?cC(e,n):"";return WT(e,o)?s.succeed(o):bh},TSo=(e,t)=>FIr(e,t).pipe(s.map(r=>({files:r,sha256:e.closure.hash.digest("hex")}))),ISo=(e,t)=>s.gen(function*(){let{modules:r,own:n,prefix:o}=yield*RSo(e,yield*e.realPath(lSo(t.fromUrl))),i=yield*e.realPath(cC(n,"node_modules","skills")).pipe(s.catch(()=>e.realPath(cC(r,"skills")))),a=yield*tut(e,i);return a.name!=="skills"||a.version!==a$?yield*bh:WT(o,i)?{entryPath:yield*e.realPath(yield*vSo(i,a)),prefix:o,root:i}:yield*bh}),xSo=(e,t)=>({closure:{entries:0,hash:LIr("sha256"),seen:new Set,total:0},fs:e,prefix:t}),qIr=e=>s.gen(function*(){let t=yield*ve.FileSystem,{entryPath:r,prefix:n,root:o}=yield*ISo(t,e),i=xSo(t,n),{files:a,sha256:c}=yield*TSo(i,o);return(yield*s.forEach(a,u=>t.realPath(u))).includes(r)?{closureSha256:c,entryPath:r,files:a,fromUrl:e.fromUrl,interpreterPath:yield*t.realPath(e.interpreterPath??process.execPath),packageRoot:o,version:a$}:yield*bh}),nAe=e=>qIr(e).pipe(s.mapError(gL)),oAe=e=>qIr({fromUrl:e.fromUrl,interpreterPath:e.interpreterPath}).pipe(s.mapError(gL),s.flatMap(t=>t.closureSha256===e.closureSha256&&t.entryPath===e.entryPath&&t.interpreterPath===e.interpreterPath&&t.packageRoot===e.packageRoot&&t.files.join("\0")===e.files.join("\0")?s.void:bh))});var dC,ASo,yL,$T,iAe,c$,WIr=q(()=>{"use strict";Z();t$();dC=Object.freeze(JW.map(({integration:e})=>e)),ASo=e=>kp(e).ownerKinds,yL=e=>dC.find(t=>ASo(t).includes(e)),$T=(e,t)=>{switch(t){case ge.claudeCode:return e?.claudeCode;case"codex":return e?.codex;case ge.maiaAgent:return e?.maiaAgent;case ge.pi:return e?.pi}},iAe=(e,t)=>{let r=Object.freeze(t);switch(e){case ge.claudeCode:return Object.freeze({claudeCode:r});case"codex":return Object.freeze({codex:r});case ge.maiaAgent:return Object.freeze({maiaAgent:r});case ge.pi:return Object.freeze({pi:r})}},c$=e=>dC.flatMap(t=>{let r=$T(e,t);return r===void 0?[]:[r]})});var $Ir={};Nn($Ir,{PRIVATE_GROUP_SHELL_FUNCTION:()=>W8,SKILLS_PACKAGE_VERSION:()=>a$,USER_WRITES_ONLY_SHELL_FUNCTION:()=>$8,consumeInvocationAttachmentNativeLease:()=>Bxe,embeddedManagedPiWorkerDefines:()=>qlt,insideDirectory:()=>WT,inspectDarwinVouchedTarget:()=>Xy,inspectManagedPiWorkerArtifact:()=>Kxe,inspectSkillsFiles:()=>nAe,invocationAttachmentProcessOwnerId:()=>iC,issueInvocationAttachmentLaunchAuthorization:()=>Clt,managedPiAuthorizationForRequest:()=>Jxe,openDarwinVouchedTarget:()=>Fxe,openInvocationAttachmentNativeLease:()=>Nlt,piRpcAuthorizationForRequest:()=>tAe,readEmbeddedManagedPiWorkerReleaseIdentity:()=>J8,releaseIdentityOf:()=>Blt,requireInvocationAttachmentLaunchAuthorization:()=>Hxe,retainDarwinVouchedAuthorizationTarget:()=>V8,sameRequest:()=>Y8,skillsVouchTarget:()=>Uxe,suppliedVendorLaunchAuthorizations:()=>c$,vendorIntegrationForOwner:()=>yL,vendorLaunchAuthorization:()=>$T,vendorLaunchAuthorizationGrant:()=>iAe,vendorLaunchIntegrations:()=>dC,verifyProcessLaunchAuthority:()=>Dxe,verifyResolvedManagedPiWorkerArtifact:()=>Xxe,verifyRetainedDarwinVouchedTargetPath:()=>K8,verifySkillsPackage:()=>oAe});var w_=q(()=>{"use strict";STr();DTr();UTr();jTr();uIr();mIr();PIr();vlt();jIr();WIr()});var YT=im((Fdc,zAr)=>{"use strict";var WAr=["nodebuffer","arraybuffer","fragments"],$Ar=typeof Blob<"u";$Ar&&WAr.push("blob");zAr.exports={BINARY_TYPES:WAr,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:$Ar,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var kZ=im((Hdc,qAe)=>{"use strict";var{EMPTY_BUFFER:kTo}=YT(),upt=Buffer[Symbol.species];function wTo(e,t){if(e.length===0)return kTo;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return n<t?new upt(r.buffer,r.byteOffset,n):r}function GAr(e,t,r,n,o){for(let i=0;i<o;i++)r[n+i]=e[i]^t[i&3]}function VAr(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function NTo(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function ppt(e){if(ppt.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new upt(e):ArrayBuffer.isView(e)?t=new upt(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),ppt.readOnly=!1),t}qAe.exports={concat:wTo,mask:GAr,toArrayBuffer:NTo,toBuffer:ppt,unmask:VAr};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Fa("bufferutil");qAe.exports.mask=function(t,r,n,o,i){i<48?GAr(t,r,n,o,i):e.mask(t,r,n,o,i)},qAe.exports.unmask=function(t,r){t.length<32?VAr(t,r):e.unmask(t,r)}}catch{}});var JAr=im((Bdc,XAr)=>{"use strict";var KAr=Symbol("kDone"),mpt=Symbol("kRun"),fpt=class{constructor(t){this[KAr]=()=>{this.pending--,this[mpt]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[mpt]()}[mpt](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[KAr])}}};XAr.exports=fpt});var x$=im((qdc,ebr)=>{"use strict";var wZ=Fa("zlib"),YAr=kZ(),PTo=JAr(),{kStatusCode:ZAr}=YT(),OTo=Buffer[Symbol.species],LTo=Buffer.from([0,0,255,255]),WAe=Symbol("permessage-deflate"),ZT=Symbol("total-length"),T$=Symbol("callback"),hC=Symbol("buffers"),I$=Symbol("error"),jAe,hpt=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!jAe){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;jAe=new PTo(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[T$];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&(typeof o.client_max_window_bits=="number"?r.clientMaxWindowBits>o.client_max_window_bits:!o.client_max_window_bits)));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let i=+o;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=i}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){jAe.add(o=>{this._decompress(t,r,(i,a)=>{o(),n(i,a)})})}compress(t,r,n){jAe.add(o=>{this._compress(t,r,(i,a)=>{o(),n(i,a)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?wZ.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=wZ.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[WAe]=this,this._inflate[ZT]=0,this._inflate[hC]=[],this._inflate.on("error",MTo),this._inflate.on("data",QAr)}this._inflate[T$]=n,this._inflate.write(t),r&&this._inflate.write(LTo),this._inflate.flush(()=>{let i=this._inflate[I$];if(i){this._inflate.close(),this._inflate=null,n(i);return}let a=YAr.concat(this._inflate[hC],this._inflate[ZT]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ZT]=0,this._inflate[hC]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,a)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let i=`${o}_max_window_bits`,a=typeof this.params[i]!="number"?wZ.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=wZ.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[ZT]=0,this._deflate[hC]=[],this._deflate.on("data",DTo)}this._deflate[T$]=n,this._deflate.write(t),this._deflate.flush(wZ.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=YAr.concat(this._deflate[hC],this._deflate[ZT]);r&&(i=new OTo(i.buffer,i.byteOffset,i.length-4)),this._deflate[T$]=null,this._deflate[ZT]=0,this._deflate[hC]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,i)})}};ebr.exports=hpt;function DTo(e){this[hC].push(e),this[ZT]+=e.length}function QAr(e){if(this[ZT]+=e.length,this[WAe]._maxPayload<1||this[ZT]<=this[WAe]._maxPayload){this[hC].push(e);return}this[I$]=new RangeError("Max payload size exceeded"),this[I$].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[I$][ZAr]=1009,this.removeListener("data",QAr),this.reset()}function MTo(e){if(this[WAe]._inflate=null,this[I$]){this[T$](this[I$]);return}e[ZAr]=1007,this[T$](e)}});var A$=im((jdc,$Ae)=>{"use strict";var{isUtf8:tbr}=Fa("buffer"),{hasBlob:UTo}=YT(),FTo=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function HTo(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function gpt(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function BTo(e){return UTo&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}$Ae.exports={isBlob:BTo,isValidStatusCode:HTo,isValidUTF8:gpt,tokenChars:FTo};if(tbr)$Ae.exports.isValidUTF8=function(e){return e.length<24?gpt(e):tbr(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Fa("utf-8-validate");$Ae.exports.isValidUTF8=function(t){return t.length<32?gpt(t):e(t)}}catch{}});var Rpt=im((Wdc,cbr)=>{"use strict";var{Writable:qTo}=Fa("stream"),rbr=x$(),{BINARY_TYPES:jTo,EMPTY_BUFFER:nbr,kStatusCode:WTo,kWebSocket:$To}=YT(),{concat:ypt,toArrayBuffer:zTo,unmask:GTo}=kZ(),{isValidStatusCode:VTo,isValidUTF8:obr}=A$(),zAe=Buffer[Symbol.species],Nh=0,ibr=1,sbr=2,abr=3,Spt=4,Ept=5,GAe=6,_pt=class extends qTo{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||jTo[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[$To]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Nh}_write(t,r,n){if(this._opcode===8&&this._state==Nh)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new zAe(n.buffer,n.byteOffset+t,n.length-t),new zAe(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new zAe(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Nh:this.getInfo(t);break;case ibr:this.getPayloadLength16(t);break;case sbr:this.getPayloadLength64(t);break;case abr:this.getMask();break;case Spt:this.getData(t);break;case Ept:case GAe:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[rbr.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=ibr:this._payloadLength===127?this._state=sbr:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=abr:this._state=Spt}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Spt}getData(t){let r=nbr;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&>o(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=Ept,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[rbr.extensionName].decompress(t,this._fin,(o,i)=>{if(o)return r(o);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}this._fragments.push(i)}this.dataMessage(r),this._state===Nh&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Nh;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=ypt(n,r):this._binaryType==="arraybuffer"?o=zTo(ypt(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Nh):(this._state=GAe,setImmediate(()=>{this.emit("message",o,!0),this._state=Nh,this.startLoop(t)}))}else{let o=ypt(n,r);if(!this._skipUTF8Validation&&!obr(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._state===Ept||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Nh):(this._state=GAe,setImmediate(()=>{this.emit("message",o,!1),this._state=Nh,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,nbr),this.end();else{let n=t.readUInt16BE(0);if(!VTo(n)){let i=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(i);return}let o=new zAe(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!obr(o)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(i);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Nh;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Nh):(this._state=GAe,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Nh,this.startLoop(r)}))}createError(t,r,n,o,i){this._loop=!1,this._errored=!0;let a=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=i,a[WTo]=o,a}};cbr.exports=_pt});var Ipt=im((zdc,ubr)=>{"use strict";var{Duplex:$dc}=Fa("stream"),{randomFillSync:KTo}=Fa("crypto"),{types:{isUint8Array:XTo}}=Fa("util"),dbr=x$(),{EMPTY_BUFFER:JTo,kWebSocket:YTo,NOOP:ZTo}=YT(),{isBlob:b$,isValidStatusCode:QTo}=A$(),{mask:lbr,toBuffer:wL}=kZ(),Ph=Symbol("kByteLength"),eIo=Buffer.alloc(4),VAe=8*1024,NL,C$=VAe,Zy=0,tIo=1,rIo=2,vpt=class e{constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Zy,this.onerror=ZTo,this[YTo]=void 0}static frame(t,r){let n,o=!1,i=2,a=!1;r.mask&&(n=r.maskBuffer||eIo,r.generateMask?r.generateMask(n):(C$===VAe&&(NL===void 0&&(NL=Buffer.alloc(VAe)),KTo(NL,0,VAe),C$=0),n[0]=NL[C$++],n[1]=NL[C$++],n[2]=NL[C$++],n[3]=NL[C$++]),a=(n[0]|n[1]|n[2]|n[3])===0,i=6);let c;typeof t=="string"?(!r.mask||a)&&r[Ph]!==void 0?c=r[Ph]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!a);let l=c;c>=65536?(i+=8,l=127):c>125&&(i+=2,l=126);let u=Buffer.allocUnsafe(o?c+i:i);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(c,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(c,4,6)),r.mask?(u[1]|=128,u[i-4]=n[0],u[i-3]=n[1],u[i-2]=n[2],u[i-1]=n[3],a?[u,t]:o?(lbr(t,n,u,i,c),[u]):(lbr(t,n,t,0,c),[u,t])):[u,t]}close(t,r,n,o){let i;if(t===void 0)i=JTo;else{if(typeof t!="number"||!QTo(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(i=Buffer.allocUnsafe(2+c),i.writeUInt16BE(t,0),typeof r=="string")i.write(r,2);else if(XTo(r))i.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let a={[Ph]:i.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Zy?this.enqueue([this.dispatch,i,!1,a,o]):this.sendFrame(e.frame(i,a),o)}ping(t,r,n){let o,i;if(typeof t=="string"?(o=Buffer.byteLength(t),i=!1):b$(t)?(o=t.size,i=!1):(t=wL(t),o=t.length,i=wL.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Ph]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};b$(t)?this._state!==Zy?this.enqueue([this.getBlobData,t,!1,a,n]):this.getBlobData(t,!1,a,n):this._state!==Zy?this.enqueue([this.dispatch,t,!1,a,n]):this.sendFrame(e.frame(t,a),n)}pong(t,r,n){let o,i;if(typeof t=="string"?(o=Buffer.byteLength(t),i=!1):b$(t)?(o=t.size,i=!1):(t=wL(t),o=t.length,i=wL.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[Ph]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};b$(t)?this._state!==Zy?this.enqueue([this.getBlobData,t,!1,a,n]):this.getBlobData(t,!1,a,n):this._state!==Zy?this.enqueue([this.dispatch,t,!1,a,n]):this.sendFrame(e.frame(t,a),n)}send(t,r,n){let o=this._extensions[dbr.extensionName],i=r.binary?2:1,a=r.compress,c,l;typeof t=="string"?(c=Buffer.byteLength(t),l=!1):b$(t)?(c=t.size,l=!1):(t=wL(t),c=t.length,l=wL.readOnly),this._firstFragment?(this._firstFragment=!1,a&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=c>=o._threshold),this._compress=a):(a=!1,i=0),r.fin&&(this._firstFragment=!0);let u={[Ph]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:l,rsv1:a};b$(t)?this._state!==Zy?this.enqueue([this.getBlobData,t,this._compress,u,n]):this.getBlobData(t,this._compress,u,n):this._state!==Zy?this.enqueue([this.dispatch,t,this._compress,u,n]):this.dispatch(t,this._compress,u,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[Ph],this._state=rIo,t.arrayBuffer().then(i=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(Tpt,this,c,o);return}this._bufferedBytes-=n[Ph];let a=wL(i);r?this.dispatch(a,r,n,o):(this._state=Zy,this.sendFrame(e.frame(a,n),o),this.dequeue())}).catch(i=>{process.nextTick(nIo,this,i,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let i=this._extensions[dbr.extensionName];this._bufferedBytes+=n[Ph],this._state=tIo,i.compress(t,n.fin,(a,c)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Tpt(this,l,o);return}this._bufferedBytes-=n[Ph],this._state=Zy,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===Zy&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Ph],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Ph],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};ubr.exports=vpt;function Tpt(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],i=o[o.length-1];typeof i=="function"&&i(t)}}function nIo(e,t,r){Tpt(e,t,r),e.onerror(t)}});var _br=im((Gdc,Ebr)=>{"use strict";var{kForOnEventAttribute:NZ,kListener:xpt}=YT(),pbr=Symbol("kCode"),mbr=Symbol("kData"),fbr=Symbol("kError"),hbr=Symbol("kMessage"),gbr=Symbol("kReason"),k$=Symbol("kTarget"),ybr=Symbol("kType"),Sbr=Symbol("kWasClean"),QT=class{constructor(t){this[k$]=null,this[ybr]=t}get target(){return this[k$]}get type(){return this[ybr]}};Object.defineProperty(QT.prototype,"target",{enumerable:!0});Object.defineProperty(QT.prototype,"type",{enumerable:!0});var PL=class extends QT{constructor(t,r={}){super(t),this[pbr]=r.code===void 0?0:r.code,this[gbr]=r.reason===void 0?"":r.reason,this[Sbr]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[pbr]}get reason(){return this[gbr]}get wasClean(){return this[Sbr]}};Object.defineProperty(PL.prototype,"code",{enumerable:!0});Object.defineProperty(PL.prototype,"reason",{enumerable:!0});Object.defineProperty(PL.prototype,"wasClean",{enumerable:!0});var w$=class extends QT{constructor(t,r={}){super(t),this[fbr]=r.error===void 0?null:r.error,this[hbr]=r.message===void 0?"":r.message}get error(){return this[fbr]}get message(){return this[hbr]}};Object.defineProperty(w$.prototype,"error",{enumerable:!0});Object.defineProperty(w$.prototype,"message",{enumerable:!0});var PZ=class extends QT{constructor(t,r={}){super(t),this[mbr]=r.data===void 0?null:r.data}get data(){return this[mbr]}};Object.defineProperty(PZ.prototype,"data",{enumerable:!0});var oIo={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[NZ]&&o[xpt]===t&&!o[NZ])return;let n;if(e==="message")n=function(i,a){let c=new PZ("message",{data:a?i:i.toString()});c[k$]=this,KAe(t,this,c)};else if(e==="close")n=function(i,a){let c=new PL("close",{code:i,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[k$]=this,KAe(t,this,c)};else if(e==="error")n=function(i){let a=new w$("error",{error:i,message:i.message});a[k$]=this,KAe(t,this,a)};else if(e==="open")n=function(){let i=new QT("open");i[k$]=this,KAe(t,this,i)};else return;n[NZ]=!!r[NZ],n[xpt]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[xpt]===t&&!r[NZ]){this.removeListener(e,r);break}}};Ebr.exports={CloseEvent:PL,ErrorEvent:w$,Event:QT,EventTarget:oIo,MessageEvent:PZ};function KAe(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var XAe=im((Vdc,Rbr)=>{"use strict";var{tokenChars:OZ}=A$();function F_(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function iIo(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,i=!1,a,c,l=-1,u=-1,p=-1,h=0;for(;h<e.length;h++)if(u=e.charCodeAt(h),a===void 0)if(p===-1&&OZ[u]===1)l===-1&&(l=h);else if(h!==0&&(u===32||u===9))p===-1&&l!==-1&&(p=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);p===-1&&(p=h);let S=e.slice(l,p);u===44?(F_(t,S,r),r=Object.create(null)):a=S,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(c===void 0)if(p===-1&&OZ[u]===1)l===-1&&(l=h);else if(u===32||u===9)p===-1&&l!==-1&&(p=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);p===-1&&(p=h),F_(r,e.slice(l,p),!0),u===44&&(F_(t,a,r),r=Object.create(null),a=void 0),l=p=-1}else if(u===61&&l!==-1&&p===-1)c=e.slice(l,h),l=p=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(o){if(OZ[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1?l=h:n||(n=!0),o=!1}else if(i)if(OZ[u]===1)l===-1&&(l=h);else if(u===34&&l!==-1)i=!1,p=h;else if(u===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&e.charCodeAt(h-1)===61)i=!0;else if(p===-1&&OZ[u]===1)l===-1&&(l=h);else if(l!==-1&&(u===32||u===9))p===-1&&(p=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);p===-1&&(p=h);let S=e.slice(l,p);n&&(S=S.replace(/\\/g,""),n=!1),F_(r,c,S),u===44&&(F_(t,a,r),r=Object.create(null),a=void 0),c=void 0,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(l===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");p===-1&&(p=h);let g=e.slice(l,p);return a===void 0?F_(t,g,r):(c===void 0?F_(r,g,!0):n?F_(r,c,g.replace(/\\/g,"")):F_(r,c,g),F_(t,a,r)),t}function sIo(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let i=n[o];return Array.isArray(i)||(i=[i]),i.map(a=>a===!0?o:`${o}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Rbr.exports={format:sIo,parse:iIo}});var QAe=im((Jdc,Obr)=>{"use strict";var aIo=Fa("events"),cIo=Fa("https"),dIo=Fa("http"),Ibr=Fa("net"),lIo=Fa("tls"),{randomBytes:uIo,createHash:pIo}=Fa("crypto"),{Duplex:Kdc,Readable:Xdc}=Fa("stream"),{URL:Apt}=Fa("url"),gC=x$(),mIo=Rpt(),fIo=Ipt(),{isBlob:hIo}=A$(),{BINARY_TYPES:vbr,CLOSE_TIMEOUT:gIo,EMPTY_BUFFER:JAe,GUID:yIo,kForOnEventAttribute:bpt,kListener:SIo,kStatusCode:EIo,kWebSocket:pd,NOOP:xbr}=YT(),{EventTarget:{addEventListener:_Io,removeEventListener:RIo}}=_br(),{format:vIo,parse:TIo}=XAe(),{toBuffer:IIo}=kZ(),Abr=Symbol("kAborted"),Cpt=[8,13],eI=["CONNECTING","OPEN","CLOSING","CLOSED"],xIo=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,js=class e extends aIo{constructor(t,r,n){super(),this._binaryType=vbr[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=JAe,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?!n||n.protocols===void 0?r=[]:Array.isArray(n.protocols)?r=n.protocols:r=[n.protocols]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,n.protocols===void 0?r=[]:Array.isArray(n.protocols)?r=n.protocols:r=[n.protocols]):r=[r]),bbr(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){vbr.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n){let o=new mIo({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),i=new fIo(t,this._extensions,n.generateMask);this._receiver=o,this._sender=i,this._socket=t,o[pd]=this,i[pd]=this,t[pd]=this,o.on("conclude",CIo),o.on("drain",kIo),o.on("error",wIo),o.on("message",NIo),o.on("ping",PIo),o.on("pong",OIo),i.onerror=LIo,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",wbr),t.on("data",ZAe),t.on("end",Nbr),t.on("error",Pbr),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[gC.extensionName]&&this._extensions[gC.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Ym(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._readyState=e.CLOSING,kbr(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kpt(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||JAe,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kpt(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||JAe,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kpt(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[gC.extensionName]||(o.compress=!1),this._sender.send(t||JAe,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Ym(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(js,"CONNECTING",{enumerable:!0,value:eI.indexOf("CONNECTING")});Object.defineProperty(js.prototype,"CONNECTING",{enumerable:!0,value:eI.indexOf("CONNECTING")});Object.defineProperty(js,"OPEN",{enumerable:!0,value:eI.indexOf("OPEN")});Object.defineProperty(js.prototype,"OPEN",{enumerable:!0,value:eI.indexOf("OPEN")});Object.defineProperty(js,"CLOSING",{enumerable:!0,value:eI.indexOf("CLOSING")});Object.defineProperty(js.prototype,"CLOSING",{enumerable:!0,value:eI.indexOf("CLOSING")});Object.defineProperty(js,"CLOSED",{enumerable:!0,value:eI.indexOf("CLOSED")});Object.defineProperty(js.prototype,"CLOSED",{enumerable:!0,value:eI.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(js.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(js.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[bpt])return t[SIo];return null},set(t){for(let r of this.listeners(e))if(r[bpt]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[bpt]:!0})}})});js.prototype.addEventListener=_Io;js.prototype.removeEventListener=RIo;Obr.exports=js;function bbr(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:gIo,protocolVersion:Cpt[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,protocols:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!Cpt.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${Cpt.join(", ")})`);let i;if(t instanceof Apt)i=t;else try{i=new Apt(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),e._url=i.href;let a=i.protocol==="wss:",c=i.protocol==="ws+unix:",l;if(i.protocol!=="ws:"&&!a&&!c?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!i.pathname?l="The URL's pathname is empty":i.hash&&(l="The URL contains a fragment identifier"),l){let v=new SyntaxError(l);if(e._redirects===0)throw v;YAe(e,v);return}let u=a?443:80,p=uIo(16).toString("base64"),h=a?cIo.request:dIo.request,g=new Set,S;if(o.createConnection=o.createConnection||(a?bIo:AIo),o.defaultPort=o.defaultPort||u,o.port=i.port||u,o.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket"},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(S=new gC({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=vIo({[gC.extensionName]:S.offer()})),r.length){for(let v of r){if(typeof v!="string"||!xIo.test(v)||g.has(v))throw new SyntaxError("An invalid or duplicated subprotocol was specified");g.add(v)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(i.username||i.password)&&(o.auth=`${i.username}:${i.password}`),c){let v=o.path.split(":");o.socketPath=v[0],o.path=v[1]}let E;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=a,e._originalHostOrSocketPath=c?o.socketPath:i.host;let v=n&&n.headers;if(n={...n,headers:{}},v)for(let[T,x]of Object.entries(v))n.headers[T.toLowerCase()]=x}else if(e.listenerCount("redirect")===0){let v=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:i.host===e._originalHostOrSocketPath;(!v||e._originalSecure&&!a)&&(delete o.headers.authorization,delete o.headers.cookie,v||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),E=e._req=h(o),e._redirects&&e.emit("redirect",e.url,E)}else E=e._req=h(o);o.timeout&&E.on("timeout",()=>{Ym(e,E,"Opening handshake has timed out")}),E.on("error",v=>{E===null||E[Abr]||(E=e._req=null,YAe(e,v))}),E.on("response",v=>{let T=v.headers.location,x=v.statusCode;if(T&&o.followRedirects&&x>=300&&x<400){if(++e._redirects>o.maxRedirects){Ym(e,E,"Maximum redirects exceeded");return}E.abort();let w;try{w=new Apt(T,t)}catch{let N=new SyntaxError(`Invalid URL: ${T}`);YAe(e,N);return}bbr(e,w,r,n)}else e.emit("unexpected-response",E,v)||Ym(e,E,`Unexpected server response: ${v.statusCode}`)}),E.on("upgrade",(v,T,x)=>{if(e.emit("upgrade",v),e.readyState!==js.CONNECTING)return;E=e._req=null;let w=v.headers.upgrade;if(w===void 0||w.toLowerCase()!=="websocket"){Ym(e,T,"Invalid Upgrade header");return}let D=pIo("sha1").update(p+yIo).digest("base64");if(v.headers["sec-websocket-accept"]!==D){Ym(e,T,"Invalid Sec-WebSocket-Accept header");return}let N=v.headers["sec-websocket-protocol"],A;if(N!==void 0?g.size?g.has(N)||(A="Server sent an invalid subprotocol"):A="Server sent a subprotocol but none was requested":g.size&&(A="Server sent no subprotocol"),A){Ym(e,T,A);return}N&&(e._protocol=N);let k=v.headers["sec-websocket-extensions"];if(k!==void 0){if(!S){Ym(e,T,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let b;try{b=TIo(k)}catch{Ym(e,T,"Invalid Sec-WebSocket-Extensions header");return}let L=Object.keys(b);if(L.length!==1||L[0]!==gC.extensionName){Ym(e,T,"Server indicated an extension that was not requested");return}try{S.accept(b[gC.extensionName])}catch{Ym(e,T,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[gC.extensionName]=S}e.setSocket(T,x,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(E,e):E.end()}function YAe(e,t){e._readyState=js.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function AIo(e){return e.path=e.socketPath,Ibr.connect(e)}function bIo(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Ibr.isIP(e.host)?"":e.host),lIo.connect(e)}function Ym(e,t,r){e._readyState=js.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Ym),t.setHeader?(t[Abr]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(YAe,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function kpt(e,t,r){if(t){let n=hIo(t)?t.size:IIo(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${eI[e.readyState]})`);process.nextTick(r,n)}}function CIo(e,t){let r=this[pd];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[pd]!==void 0&&(r._socket.removeListener("data",ZAe),process.nextTick(Cbr,r._socket),e===1005?r.close():r.close(e,t))}function kIo(){let e=this[pd];e.isPaused||e._socket.resume()}function wIo(e){let t=this[pd];t._socket[pd]!==void 0&&(t._socket.removeListener("data",ZAe),process.nextTick(Cbr,t._socket),t.close(e[EIo])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function Tbr(){this[pd].emitClose()}function NIo(e,t){this[pd].emit("message",e,t)}function PIo(e){let t=this[pd];t._autoPong&&t.pong(e,!this._isServer,xbr),t.emit("ping",e)}function OIo(e){this[pd].emit("pong",e)}function Cbr(e){e.resume()}function LIo(e){let t=this[pd];t.readyState!==js.CLOSED&&(t.readyState===js.OPEN&&(t._readyState=js.CLOSING,kbr(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function kbr(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function wbr(){let e=this[pd];if(this.removeListener("close",wbr),this.removeListener("data",ZAe),this.removeListener("end",Nbr),e._readyState=js.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[pd]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Tbr),e._receiver.on("finish",Tbr))}function ZAe(e){this[pd]._receiver.write(e)||this.pause()}function Nbr(){let e=this[pd];e._readyState=js.CLOSING,e._receiver.end(),this.end()}function Pbr(){let e=this[pd];this.removeListener("error",Pbr),this.on("error",xbr),e&&(e._readyState=js.CLOSING,this.destroy())}});var Ubr=im((Zdc,Mbr)=>{"use strict";var Ydc=QAe(),{Duplex:DIo}=Fa("stream");function Lbr(e){e.emit("close")}function MIo(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Dbr(e){this.removeListener("error",Dbr),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function UIo(e,t){let r=!0,n=new DIo({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(i,a){let c=!a&&n._readableState.objectMode?i.toString():i;n.push(c)||e.pause()}),e.once("error",function(i){n.destroyed||(r=!1,n.destroy(i))}),e.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,i){if(e.readyState===e.CLOSED){i(o),process.nextTick(Lbr,n);return}let a=!1;e.once("error",function(l){a=!0,i(l)}),e.once("close",function(){a||i(o),process.nextTick(Lbr,n)}),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",function(){n._final(o)});return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",function(){o()}),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,i,a){if(e.readyState===e.CONNECTING){e.once("open",function(){n._write(o,i,a)});return}e.send(o,a)},n.on("end",MIo),n.on("error",Dbr),n}Mbr.exports=UIo});var wpt=im((Qdc,Fbr)=>{"use strict";var{tokenChars:FIo}=A$();function HIo(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let a=e.charCodeAt(o);if(n===-1&&FIo[a]===1)r===-1&&(r=o);else if(o!==0&&(a===32||a===9))n===-1&&r!==-1&&(n=o);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let i=e.slice(r,o);if(t.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return t.add(i),t}Fbr.exports={parse:HIo}});var zbr=im((tlc,$br)=>{"use strict";var BIo=Fa("events"),ebe=Fa("http"),{Duplex:elc}=Fa("stream"),{createHash:qIo}=Fa("crypto"),Hbr=XAe(),OL=x$(),jIo=wpt(),WIo=QAe(),{CLOSE_TIMEOUT:$Io,GUID:zIo,kWebSocket:GIo}=YT(),VIo=/^[+/0-9A-Za-z]{22}==$/,Bbr=0,qbr=1,Wbr=2,Npt=class extends BIo{constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:$Io,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:WIo,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=ebe.createServer((n,o)=>{let i=ebe.STATUS_CODES[426];o.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),o.end(i)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=KIo(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,i,a)=>{this.handleUpgrade(o,i,a,n)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Bbr}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===Wbr){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(LZ,this);return}if(t&&this.once("close",t),this._state!==qbr)if(this._state=qbr,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(LZ,this):process.nextTick(LZ,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{LZ(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",jbr);let i=t.headers["sec-websocket-key"],a=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){LL(this,t,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){LL(this,t,r,400,"Invalid Upgrade header");return}if(i===void 0||!VIo.test(i)){LL(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){LL(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){DZ(r,400);return}let l=t.headers["sec-websocket-protocol"],u=new Set;if(l!==void 0)try{u=jIo.parse(l)}catch{LL(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let p=t.headers["sec-websocket-extensions"],h={};if(this.options.perMessageDeflate&&p!==void 0){let g=new OL({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let S=Hbr.parse(p);S[OL.extensionName]&&(g.accept(S[OL.extensionName]),h[OL.extensionName]=g)}catch{LL(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let g={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(g,(S,E,v,T)=>{if(!S)return DZ(r,E||401,v,T);this.completeUpgrade(h,i,u,t,r,n,o)});return}if(!this.options.verifyClient(g))return DZ(r,401)}this.completeUpgrade(h,i,u,t,r,n,o)}completeUpgrade(t,r,n,o,i,a,c){if(!i.readable||!i.writable)return i.destroy();if(i[GIo])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Bbr)return DZ(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${qIo("sha1").update(r+zIo).digest("base64")}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let h=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),p._protocol=h)}if(t[OL.extensionName]){let h=t[OL.extensionName].params,g=Hbr.format({[OL.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${g}`),p._extensions=t}this.emit("headers",u,o),i.write(u.concat(`\r
|
|
239
239
|
`).join(`\r
|
|
240
240
|
`)),i.removeListener("error",jbr),p.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on("close",()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(LZ,this)})),c(p,o)}};$br.exports=Npt;function KIo(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function LZ(e){e._state=Wbr,e.emit("close")}function jbr(){this.destroy()}function DZ(e,t,r,n){r=r||ebe.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${ebe.STATUS_CODES[t]}\r
|
|
241
241
|
`+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
|
|
@@ -11886,6 +11886,6 @@ planned and unavailable.
|
|
|
11886
11886
|
`);return}r.stdout(sba(e))},aba=(e,t,r)=>{if(t){r.stderr(`${JSON.stringify({error:e,ok:!1})}
|
|
11887
11887
|
`);return}r.stderr(`maia-node: ${e.message}
|
|
11888
11888
|
Run 'maia-node --help' for usage.
|
|
11889
|
-
`)},Id=e=>({code:"invalid_argument",message:e,retryable:!1}),WBe=e=>e.replaceAll(/[\p{C}]/gu,"\uFFFD"),cba=e=>({code:"command_not_implemented",message:`Command '${WBe(e)}' is not implemented.`,retryable:!1}),Ebn="The start, help and version forms accept no additional arguments.",_bn="--desktop",dba=e=>{if(e.length>gbn)return Id(`At most ${String(gbn)} arguments are allowed.`);if(e.some(t=>t.length>ybn))return Id(`Arguments must be at most ${String(ybn)} characters.`)},Rbn=()=>Id($X),lba=(e,t)=>{let[r,n,o,i,...a]=e;if(r==="state")return n!=="check"?Id("Use 'maia-node state check [--profile <name>] [--json]'."):o===void 0?{command:"state-check",json:t,profile:YAa}:o!=="--profile"||a.length>0?Id("State check accepts only '--profile <name>' and '--json', each once."):i===void 0?Id("Option '--profile' requires a profile name."):M0(i)?{command:"state-check",json:t,profile:i}:Rbn()},uba=(e,t)=>Id(t?`Option '--profile' cannot come before '${WBe(e)}'; put it after the command.`:`Option '--profile' starts the Node and cannot be used with '${WBe(e)}'.`),pba=(e,t)=>{let r=e.filter(c=>c==="--profile").length;if(r===0)return;if(r>1)return Id("Option '--profile' may be used only once.");let n=e.indexOf("--profile"),o=e[n+1];if(o===void 0)return Id("Option '--profile' requires a profile name.");if(!M0(o))return Rbn();let i=e.filter((c,l)=>l!==n&&l!==n+1),a=i.find(c=>c!==_bn);return a!==void 0?uba(a,e.indexOf(a)>n):i.length>1?Id(Ebn):{command:"desktop",json:t,profile:o}},mba=(e,t)=>{let r=lba(e,t)??pba(e,t);if(r!==void 0)return r;if(e.length>1)return Id(Ebn);let n=e[0];return n===void 0||n===_bn?{command:"desktop",json:t}:QAa.has(n)?{command:"help",json:t}:eba.has(n)?{command:"version",json:t}:n.startsWith("-")?Id(`Unknown option '${WBe(n)}'.`):cba(n)},fba=e=>{let t=e.filter(o=>o==="--json").length;if(t>1)return Id("Option '--json' may be used only once.");let r=e.filter(o=>o===jBe).length;if(r>1)return Id(`Option '${jBe}' may be used only once.`);let n=mba(e.filter(o=>o!=="--json"&&o!==jBe),t===1);return r===0||vbn(n)?n:n.command==="desktop"?{...n,bootstrapChannel:!0}:Id(`Option '${jBe}' may be used only when starting the Node.`)},vbn=e=>"code"in e,H0=e=>(aba(e.error,e.json,e.io),e.exitCode??ZAa),hba=(e,t)=>({...e.bootstrapChannel===!0?{bootstrapChannel:!0}:{},io:t.io,...t.nativeProcessHostIdentity===void 0?{}:{nativeProcessHostIdentity:t.nativeProcessHostIdentity},...t.nodeExecutablePath===void 0?{}:{nodeExecutablePath:t.nodeExecutablePath},...e.profile===void 0?{}:{profile:e.profile},version:t.version,...t.runtimeRootOverride===void 0?{}:{runtimeRootOverride:t.runtimeRootOverride}}),gba=(e,t)=>(t.dependencies??{startDesktop:WX}).startDesktop(hba(e,t)).pipe(s.as(0),s.catch(n=>s.sync(()=>H0({error:yc(n),exitCode:n.retryable?Sbn:Bjt,io:t.io,json:e.json})))),yba=(e,t)=>fbn({profile:e.profile,...t.runtimeRootOverride===void 0?{}:{runtimeRootOverride:t.runtimeRootOverride},version:t.version}).pipe(s.provide(_r),s.map(r=>(qjt(r,e.json,t.io),0)),s.catch(r=>s.sync(()=>H0({error:yc(r),exitCode:Bjt,io:t.io,json:e.json})))),Sba=e=>({...e.releaseHome===void 0?{}:{home:e.releaseHome},...e.releasePlatform===void 0?{}:{platform:e.releasePlatform},...e.runtimeRootOverride===void 0?{}:{runtimeRootOverride:e.runtimeRootOverride}}),Eba=(e,t,r)=>H0(typeof e=="string"?{error:Id(e),io:r.io,json:t.json}:{error:yc(e),exitCode:e.retryable?Sbn:Bjt,io:r.io,json:t.json}),_ba=(e,t)=>jAn(e).pipe(s.flatMap(r=>WAn(r,Sba(t))),s.provide(t.releaseServices??$An),s.map(r=>(qjt(r,e.json,t.io),0)),s.catch(r=>s.sync(()=>Eba(r,e,t)))),Rba=(e,t)=>{let r=qAn(e);if(typeof r!="string")return _ba(r,t);let n=e.includes("--json");return s.sync(()=>H0({error:Id(r),io:t.io,json:n}))},vba=(e,t)=>e.command==="desktop"?gba(e,t):e.command==="state-check"?yba(e,t):s.sync(()=>{let r=e.command==="help"?nba(t.version):oba(t.version);return qjt(r,e.json,t.io),0}),Tba=(e,t)=>{let r=T1t(e);return typeof r=="string"?s.sync(()=>H0({error:Id(r),io:t.io,json:e.includes("--json")})):I1t(r,{io:t.io,release:w7({...t.releaseHome===void 0?{}:{home:t.releaseHome},version:t.version}),...t.runtimeRootOverride===void 0?{}:{runtimeRootOverride:t.runtimeRootOverride},version:t.version}).pipe(s.provide(t.remotePlatform??$R))},Iba=(e,t)=>mbn(e,{...t.releaseHome===void 0?{}:{home:t.releaseHome},...t.serviceHost===void 0?{}:{host:t.serviceHost},io:t.io,...t.serviceServices===void 0?{}:{services:t.serviceServices}}),$Be=(e,t)=>{if(e[0]==="bridge"||e[0]==="remote")return Tba(e,t);let r=i=>s.sync(()=>H0({error:i,io:t.io,json:e.includes("--json")})),n=dba(e);if(n!==void 0)return r(n);if(e[0]==="release")return Rba(e,t);if(e[0]==="service")return Iba(e,t);let o=fba(e);return vbn(o)?r(o):vba(o,t)};F();var Tbn=1e4,XX=class extends ot.Service()("maia/ShutdownDeadline"){},Ose=class extends ot.Service()("maia/DesktopParent"){static layer=$e.effect(this,s.gen(function*(){return{closed:(yield*tT.Stdio).stdin.pipe(ze.runDrain,s.ignore,s.ensuring(s.sync(()=>{process.stdin.destroy()}))),forceExit:s.sync(()=>{process.kill(process.pid,"SIGKILL")})}})).pipe($e.provide(MX))},Ibn=e=>s.gen(function*(){let t=yield*Ose,r=yield*e.pipe(s.forkChild),n=s.gen(function*(){yield*t.closed;let o=yield*s.serviceOption(XX);if(B.isSome(o)){let i=Number((yield*De.monotonicTimeNanos)/1000000n);yield*me.set(o.value,i+Tbn)}return yield*uo.interrupt(r).pipe(s.forkChild),yield*s.sleep(Tbn),yield*t.forceExit,yield*s.never});return yield*uo.join(r).pipe(s.raceFirst(n))}),jjt=e=>s.gen(function*(){return yield*(yield*no.String("MAIA_DESKTOP_PARENT_PIPE").pipe(no.withDefault("0"),s.orDie))==="1"?Ibn(e).pipe(s.provide(Ose.layer)):e});G();YKe();var xbn=JKe(({fiber:e,teardown:t})=>{let r=!1;e.addObserver(o=>{process.removeListener("SIGINT",n),process.removeListener("SIGTERM",n),t(o,i=>{(r||i!==0)&&process.exit(i)})});function n(){r=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",n),process.on("SIGTERM",n)});F();var Aba=5e3,Abn=e=>s.gen(function*(){let t=yield*Q.make(),r=()=>{Q.doneUnsafe(t,s.succeed(!0))};e.on("error",r),e.on("close",r);let n=s.callback(o=>{if(e.writableLength===0){o(s.succeed(!0));return}e.write("",()=>{o(s.succeed(!0))})});return s.raceFirst(Q.await(t),n)}),bba=e=>xt.isSuccess(e)?e.value:Rr.hasInterruptsOnly(e.cause)?0:DH.getErrorExitCode(Rr.squash(e.cause)),Cba=(e,t)=>s.gen(function*(){let r=Number((yield*De.monotonicTimeNanos)/1000000n),n=(yield*me.get(t))-r;return yield*s.all(e,{concurrency:"unbounded",discard:!0}).pipe(s.timeoutOption(Math.min(Aba,n)))}),kba=(e,t)=>s.uninterruptibleMask(r=>s.gen(function*(){let n=[yield*Abn(t.stdout),yield*Abn(t.stderr)];yield*s.yieldNow;let o=yield*Q.make(),i=yield*me.make(Number.POSITIVE_INFINITY),a=yield*s.forkChild(e.pipe(s.onExit(p=>Q.succeed(o,p)),s.provideService(XX,i)),{startImmediately:!0});yield*s.exit(r(uo.await(a))),yield*uo.interrupt(a);let c=yield*Q.await(o),l=bba(c),u=yield*Cba(n,i);(l!==0||xt.isFailure(c)||B.isNone(u))&&t.exit(l)})),wba=(e,t)=>{if(xt.isFailure(e)&&!Rr.hasInterruptsOnly(e.cause)){DH.defaultTeardown(e,t);return}t(0)},bbn=(e,t)=>{xbn(kba(e,t),{disableErrorReporting:!0,teardown:wba})};var Pba=()=>({nodeVersion:"24.22.1",version:"0.1.0-canary.
|
|
11889
|
+
`)},Id=e=>({code:"invalid_argument",message:e,retryable:!1}),WBe=e=>e.replaceAll(/[\p{C}]/gu,"\uFFFD"),cba=e=>({code:"command_not_implemented",message:`Command '${WBe(e)}' is not implemented.`,retryable:!1}),Ebn="The start, help and version forms accept no additional arguments.",_bn="--desktop",dba=e=>{if(e.length>gbn)return Id(`At most ${String(gbn)} arguments are allowed.`);if(e.some(t=>t.length>ybn))return Id(`Arguments must be at most ${String(ybn)} characters.`)},Rbn=()=>Id($X),lba=(e,t)=>{let[r,n,o,i,...a]=e;if(r==="state")return n!=="check"?Id("Use 'maia-node state check [--profile <name>] [--json]'."):o===void 0?{command:"state-check",json:t,profile:YAa}:o!=="--profile"||a.length>0?Id("State check accepts only '--profile <name>' and '--json', each once."):i===void 0?Id("Option '--profile' requires a profile name."):M0(i)?{command:"state-check",json:t,profile:i}:Rbn()},uba=(e,t)=>Id(t?`Option '--profile' cannot come before '${WBe(e)}'; put it after the command.`:`Option '--profile' starts the Node and cannot be used with '${WBe(e)}'.`),pba=(e,t)=>{let r=e.filter(c=>c==="--profile").length;if(r===0)return;if(r>1)return Id("Option '--profile' may be used only once.");let n=e.indexOf("--profile"),o=e[n+1];if(o===void 0)return Id("Option '--profile' requires a profile name.");if(!M0(o))return Rbn();let i=e.filter((c,l)=>l!==n&&l!==n+1),a=i.find(c=>c!==_bn);return a!==void 0?uba(a,e.indexOf(a)>n):i.length>1?Id(Ebn):{command:"desktop",json:t,profile:o}},mba=(e,t)=>{let r=lba(e,t)??pba(e,t);if(r!==void 0)return r;if(e.length>1)return Id(Ebn);let n=e[0];return n===void 0||n===_bn?{command:"desktop",json:t}:QAa.has(n)?{command:"help",json:t}:eba.has(n)?{command:"version",json:t}:n.startsWith("-")?Id(`Unknown option '${WBe(n)}'.`):cba(n)},fba=e=>{let t=e.filter(o=>o==="--json").length;if(t>1)return Id("Option '--json' may be used only once.");let r=e.filter(o=>o===jBe).length;if(r>1)return Id(`Option '${jBe}' may be used only once.`);let n=mba(e.filter(o=>o!=="--json"&&o!==jBe),t===1);return r===0||vbn(n)?n:n.command==="desktop"?{...n,bootstrapChannel:!0}:Id(`Option '${jBe}' may be used only when starting the Node.`)},vbn=e=>"code"in e,H0=e=>(aba(e.error,e.json,e.io),e.exitCode??ZAa),hba=(e,t)=>({...e.bootstrapChannel===!0?{bootstrapChannel:!0}:{},io:t.io,...t.nativeProcessHostIdentity===void 0?{}:{nativeProcessHostIdentity:t.nativeProcessHostIdentity},...t.nodeExecutablePath===void 0?{}:{nodeExecutablePath:t.nodeExecutablePath},...e.profile===void 0?{}:{profile:e.profile},version:t.version,...t.runtimeRootOverride===void 0?{}:{runtimeRootOverride:t.runtimeRootOverride}}),gba=(e,t)=>(t.dependencies??{startDesktop:WX}).startDesktop(hba(e,t)).pipe(s.as(0),s.catch(n=>s.sync(()=>H0({error:yc(n),exitCode:n.retryable?Sbn:Bjt,io:t.io,json:e.json})))),yba=(e,t)=>fbn({profile:e.profile,...t.runtimeRootOverride===void 0?{}:{runtimeRootOverride:t.runtimeRootOverride},version:t.version}).pipe(s.provide(_r),s.map(r=>(qjt(r,e.json,t.io),0)),s.catch(r=>s.sync(()=>H0({error:yc(r),exitCode:Bjt,io:t.io,json:e.json})))),Sba=e=>({...e.releaseHome===void 0?{}:{home:e.releaseHome},...e.releasePlatform===void 0?{}:{platform:e.releasePlatform},...e.runtimeRootOverride===void 0?{}:{runtimeRootOverride:e.runtimeRootOverride}}),Eba=(e,t,r)=>H0(typeof e=="string"?{error:Id(e),io:r.io,json:t.json}:{error:yc(e),exitCode:e.retryable?Sbn:Bjt,io:r.io,json:t.json}),_ba=(e,t)=>jAn(e).pipe(s.flatMap(r=>WAn(r,Sba(t))),s.provide(t.releaseServices??$An),s.map(r=>(qjt(r,e.json,t.io),0)),s.catch(r=>s.sync(()=>Eba(r,e,t)))),Rba=(e,t)=>{let r=qAn(e);if(typeof r!="string")return _ba(r,t);let n=e.includes("--json");return s.sync(()=>H0({error:Id(r),io:t.io,json:n}))},vba=(e,t)=>e.command==="desktop"?gba(e,t):e.command==="state-check"?yba(e,t):s.sync(()=>{let r=e.command==="help"?nba(t.version):oba(t.version);return qjt(r,e.json,t.io),0}),Tba=(e,t)=>{let r=T1t(e);return typeof r=="string"?s.sync(()=>H0({error:Id(r),io:t.io,json:e.includes("--json")})):I1t(r,{io:t.io,release:w7({...t.releaseHome===void 0?{}:{home:t.releaseHome},version:t.version}),...t.runtimeRootOverride===void 0?{}:{runtimeRootOverride:t.runtimeRootOverride},version:t.version}).pipe(s.provide(t.remotePlatform??$R))},Iba=(e,t)=>mbn(e,{...t.releaseHome===void 0?{}:{home:t.releaseHome},...t.serviceHost===void 0?{}:{host:t.serviceHost},io:t.io,...t.serviceServices===void 0?{}:{services:t.serviceServices}}),$Be=(e,t)=>{if(e[0]==="bridge"||e[0]==="remote")return Tba(e,t);let r=i=>s.sync(()=>H0({error:i,io:t.io,json:e.includes("--json")})),n=dba(e);if(n!==void 0)return r(n);if(e[0]==="release")return Rba(e,t);if(e[0]==="service")return Iba(e,t);let o=fba(e);return vbn(o)?r(o):vba(o,t)};F();var Tbn=1e4,XX=class extends ot.Service()("maia/ShutdownDeadline"){},Ose=class extends ot.Service()("maia/DesktopParent"){static layer=$e.effect(this,s.gen(function*(){return{closed:(yield*tT.Stdio).stdin.pipe(ze.runDrain,s.ignore,s.ensuring(s.sync(()=>{process.stdin.destroy()}))),forceExit:s.sync(()=>{process.kill(process.pid,"SIGKILL")})}})).pipe($e.provide(MX))},Ibn=e=>s.gen(function*(){let t=yield*Ose,r=yield*e.pipe(s.forkChild),n=s.gen(function*(){yield*t.closed;let o=yield*s.serviceOption(XX);if(B.isSome(o)){let i=Number((yield*De.monotonicTimeNanos)/1000000n);yield*me.set(o.value,i+Tbn)}return yield*uo.interrupt(r).pipe(s.forkChild),yield*s.sleep(Tbn),yield*t.forceExit,yield*s.never});return yield*uo.join(r).pipe(s.raceFirst(n))}),jjt=e=>s.gen(function*(){return yield*(yield*no.String("MAIA_DESKTOP_PARENT_PIPE").pipe(no.withDefault("0"),s.orDie))==="1"?Ibn(e).pipe(s.provide(Ose.layer)):e});G();YKe();var xbn=JKe(({fiber:e,teardown:t})=>{let r=!1;e.addObserver(o=>{process.removeListener("SIGINT",n),process.removeListener("SIGTERM",n),t(o,i=>{(r||i!==0)&&process.exit(i)})});function n(){r=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",n),process.on("SIGTERM",n)});F();var Aba=5e3,Abn=e=>s.gen(function*(){let t=yield*Q.make(),r=()=>{Q.doneUnsafe(t,s.succeed(!0))};e.on("error",r),e.on("close",r);let n=s.callback(o=>{if(e.writableLength===0){o(s.succeed(!0));return}e.write("",()=>{o(s.succeed(!0))})});return s.raceFirst(Q.await(t),n)}),bba=e=>xt.isSuccess(e)?e.value:Rr.hasInterruptsOnly(e.cause)?0:DH.getErrorExitCode(Rr.squash(e.cause)),Cba=(e,t)=>s.gen(function*(){let r=Number((yield*De.monotonicTimeNanos)/1000000n),n=(yield*me.get(t))-r;return yield*s.all(e,{concurrency:"unbounded",discard:!0}).pipe(s.timeoutOption(Math.min(Aba,n)))}),kba=(e,t)=>s.uninterruptibleMask(r=>s.gen(function*(){let n=[yield*Abn(t.stdout),yield*Abn(t.stderr)];yield*s.yieldNow;let o=yield*Q.make(),i=yield*me.make(Number.POSITIVE_INFINITY),a=yield*s.forkChild(e.pipe(s.onExit(p=>Q.succeed(o,p)),s.provideService(XX,i)),{startImmediately:!0});yield*s.exit(r(uo.await(a))),yield*uo.interrupt(a);let c=yield*Q.await(o),l=bba(c),u=yield*Cba(n,i);(l!==0||xt.isFailure(c)||B.isNone(u))&&t.exit(l)})),wba=(e,t)=>{if(xt.isFailure(e)&&!Rr.hasInterruptsOnly(e.cause)){DH.defaultTeardown(e,t);return}t(0)},bbn=(e,t)=>{xbn(kba(e,t),{disableErrorReporting:!0,teardown:wba})};var Pba=()=>({nodeVersion:"24.22.1",version:"0.1.0-canary.70"}),zBe=Pba(),Wjt={stderr(e){process.stderr.write(e)},stdout(e){process.stdout.write(e)}},Cbn=void 0,kbn=Nba(import.meta.url),Oba=e=>s.try({catch:t=>f("transport_failed",t instanceof Error?t.message:String(t)),try:LAe}).pipe(s.bindTo("nativeProcessHostIdentity"),s.bind("headlessApprovals",()=>edt),s.flatMap(({headlessApprovals:t,nativeProcessHostIdentity:r})=>WX({...e,afterProfileLock:n=>kEt({modulePath:kbn,profile:n,running:zBe.version}).pipe(s.provide(_r)),headlessApprovals:t,...r===void 0?{}:{nativeProcessHostIdentity:r,nodeExecutablePath:kbn}})));if(process.versions.node===zBe.nodeVersion){let e=$Be(process.argv.slice(2),{dependencies:{startDesktop:t=>Oba(t).pipe(jjt)},io:Wjt,...Cbn===void 0?{}:{runtimeRootOverride:Cbn},version:zBe.version});bbn(Qct(process.argv.slice(2),Wjt.stderr)(e).pipe(s.provide(_r)),process)}else Wjt.stderr(`Maia Node requires Node ${zBe.nodeVersion}; received ${process.versions.node}.
|
|
11890
11890
|
`),process.exitCode=69;
|
|
11891
11891
|
//# sourceMappingURL=maia-node-main.mjs.map
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
"version": "1.1.0"
|
|
304
304
|
},
|
|
305
305
|
{
|
|
306
|
-
"bom-ref": "@maiaos/agent@0.1.0-canary.
|
|
306
|
+
"bom-ref": "@maiaos/agent@0.1.0-canary.70",
|
|
307
307
|
"licenses": [
|
|
308
308
|
{
|
|
309
309
|
"license": {
|
|
@@ -322,13 +322,13 @@
|
|
|
322
322
|
"value": "packages/agent"
|
|
323
323
|
}
|
|
324
324
|
],
|
|
325
|
-
"purl": "pkg:npm/%40maiaos/agent@0.1.0-canary.
|
|
325
|
+
"purl": "pkg:npm/%40maiaos/agent@0.1.0-canary.70",
|
|
326
326
|
"scope": "required",
|
|
327
327
|
"type": "library",
|
|
328
|
-
"version": "0.1.0-canary.
|
|
328
|
+
"version": "0.1.0-canary.70"
|
|
329
329
|
},
|
|
330
330
|
{
|
|
331
|
-
"bom-ref": "@maiaos/client-core@0.1.0-canary.
|
|
331
|
+
"bom-ref": "@maiaos/client-core@0.1.0-canary.70",
|
|
332
332
|
"licenses": [
|
|
333
333
|
{
|
|
334
334
|
"license": {
|
|
@@ -347,13 +347,13 @@
|
|
|
347
347
|
"value": "packages/client-core"
|
|
348
348
|
}
|
|
349
349
|
],
|
|
350
|
-
"purl": "pkg:npm/%40maiaos/client-core@0.1.0-canary.
|
|
350
|
+
"purl": "pkg:npm/%40maiaos/client-core@0.1.0-canary.70",
|
|
351
351
|
"scope": "required",
|
|
352
352
|
"type": "library",
|
|
353
|
-
"version": "0.1.0-canary.
|
|
353
|
+
"version": "0.1.0-canary.70"
|
|
354
354
|
},
|
|
355
355
|
{
|
|
356
|
-
"bom-ref": "@maiaos/panel@0.1.0-canary.
|
|
356
|
+
"bom-ref": "@maiaos/panel@0.1.0-canary.70",
|
|
357
357
|
"licenses": [
|
|
358
358
|
{
|
|
359
359
|
"license": {
|
|
@@ -372,13 +372,13 @@
|
|
|
372
372
|
"value": "apps/panel"
|
|
373
373
|
}
|
|
374
374
|
],
|
|
375
|
-
"purl": "pkg:npm/%40maiaos/panel@0.1.0-canary.
|
|
375
|
+
"purl": "pkg:npm/%40maiaos/panel@0.1.0-canary.70",
|
|
376
376
|
"scope": "required",
|
|
377
377
|
"type": "library",
|
|
378
|
-
"version": "0.1.0-canary.
|
|
378
|
+
"version": "0.1.0-canary.70"
|
|
379
379
|
},
|
|
380
380
|
{
|
|
381
|
-
"bom-ref": "@maiaos/protocol@0.1.0-canary.
|
|
381
|
+
"bom-ref": "@maiaos/protocol@0.1.0-canary.70",
|
|
382
382
|
"licenses": [
|
|
383
383
|
{
|
|
384
384
|
"license": {
|
|
@@ -397,13 +397,13 @@
|
|
|
397
397
|
"value": "packages/protocol"
|
|
398
398
|
}
|
|
399
399
|
],
|
|
400
|
-
"purl": "pkg:npm/%40maiaos/protocol@0.1.0-canary.
|
|
400
|
+
"purl": "pkg:npm/%40maiaos/protocol@0.1.0-canary.70",
|
|
401
401
|
"scope": "required",
|
|
402
402
|
"type": "library",
|
|
403
|
-
"version": "0.1.0-canary.
|
|
403
|
+
"version": "0.1.0-canary.70"
|
|
404
404
|
},
|
|
405
405
|
{
|
|
406
|
-
"bom-ref": "@maiaos/sdk@0.1.0-canary.
|
|
406
|
+
"bom-ref": "@maiaos/sdk@0.1.0-canary.70",
|
|
407
407
|
"licenses": [
|
|
408
408
|
{
|
|
409
409
|
"license": {
|
|
@@ -422,13 +422,13 @@
|
|
|
422
422
|
"value": "packages/sdk"
|
|
423
423
|
}
|
|
424
424
|
],
|
|
425
|
-
"purl": "pkg:npm/%40maiaos/sdk@0.1.0-canary.
|
|
425
|
+
"purl": "pkg:npm/%40maiaos/sdk@0.1.0-canary.70",
|
|
426
426
|
"scope": "required",
|
|
427
427
|
"type": "library",
|
|
428
|
-
"version": "0.1.0-canary.
|
|
428
|
+
"version": "0.1.0-canary.70"
|
|
429
429
|
},
|
|
430
430
|
{
|
|
431
|
-
"bom-ref": "@maiaos/web-ui@0.1.0-canary.
|
|
431
|
+
"bom-ref": "@maiaos/web-ui@0.1.0-canary.70",
|
|
432
432
|
"licenses": [
|
|
433
433
|
{
|
|
434
434
|
"license": {
|
|
@@ -447,10 +447,10 @@
|
|
|
447
447
|
"value": "packages/web-ui"
|
|
448
448
|
}
|
|
449
449
|
],
|
|
450
|
-
"purl": "pkg:npm/%40maiaos/web-ui@0.1.0-canary.
|
|
450
|
+
"purl": "pkg:npm/%40maiaos/web-ui@0.1.0-canary.70",
|
|
451
451
|
"scope": "required",
|
|
452
452
|
"type": "library",
|
|
453
|
-
"version": "0.1.0-canary.
|
|
453
|
+
"version": "0.1.0-canary.70"
|
|
454
454
|
},
|
|
455
455
|
{
|
|
456
456
|
"bom-ref": "@silvia-odwyer/photon-node@0.3.4",
|
|
@@ -2154,7 +2154,7 @@
|
|
|
2154
2154
|
},
|
|
2155
2155
|
{
|
|
2156
2156
|
"name": "maia:source-revision",
|
|
2157
|
-
"value": "
|
|
2157
|
+
"value": "ae33c76a8693acdf9a853826a35b3f5e96f6f7e4"
|
|
2158
2158
|
},
|
|
2159
2159
|
{
|
|
2160
2160
|
"name": "maia:target-triple",
|
|
@@ -2195,7 +2195,7 @@
|
|
|
2195
2195
|
],
|
|
2196
2196
|
"scope": "required",
|
|
2197
2197
|
"type": "file",
|
|
2198
|
-
"version": "0.1.0-canary.
|
|
2198
|
+
"version": "0.1.0-canary.70"
|
|
2199
2199
|
}
|
|
2200
2200
|
],
|
|
2201
2201
|
"dependencies": [
|
|
@@ -2213,12 +2213,12 @@
|
|
|
2213
2213
|
"@effect/platform-node-shared@4.0.0",
|
|
2214
2214
|
"@google/genai@2.21.0",
|
|
2215
2215
|
"@isaacs/nonrecursive-glob-match@1.1.0",
|
|
2216
|
-
"@maiaos/agent@0.1.0-canary.
|
|
2217
|
-
"@maiaos/client-core@0.1.0-canary.
|
|
2218
|
-
"@maiaos/panel@0.1.0-canary.
|
|
2219
|
-
"@maiaos/protocol@0.1.0-canary.
|
|
2220
|
-
"@maiaos/sdk@0.1.0-canary.
|
|
2221
|
-
"@maiaos/web-ui@0.1.0-canary.
|
|
2216
|
+
"@maiaos/agent@0.1.0-canary.70",
|
|
2217
|
+
"@maiaos/client-core@0.1.0-canary.70",
|
|
2218
|
+
"@maiaos/panel@0.1.0-canary.70",
|
|
2219
|
+
"@maiaos/protocol@0.1.0-canary.70",
|
|
2220
|
+
"@maiaos/sdk@0.1.0-canary.70",
|
|
2221
|
+
"@maiaos/web-ui@0.1.0-canary.70",
|
|
2222
2222
|
"@silvia-odwyer/photon-node@0.3.4",
|
|
2223
2223
|
"@stablelib/base64@1.0.1",
|
|
2224
2224
|
"agent-base@7.1.4",
|
|
@@ -2288,7 +2288,7 @@
|
|
|
2288
2288
|
"zod@4.6.7",
|
|
2289
2289
|
"file:maia-process-host-linux-x64@sha256:222d4c8f7891cb43e3d387cf5f22a6ccfad94846daa4fb14c0f9af5912102e39"
|
|
2290
2290
|
],
|
|
2291
|
-
"ref": "@maiaos/node@0.1.0-canary.
|
|
2291
|
+
"ref": "@maiaos/node@0.1.0-canary.70"
|
|
2292
2292
|
},
|
|
2293
2293
|
{
|
|
2294
2294
|
"dependsOn": [],
|
|
@@ -2340,27 +2340,27 @@
|
|
|
2340
2340
|
},
|
|
2341
2341
|
{
|
|
2342
2342
|
"dependsOn": [],
|
|
2343
|
-
"ref": "@maiaos/agent@0.1.0-canary.
|
|
2343
|
+
"ref": "@maiaos/agent@0.1.0-canary.70"
|
|
2344
2344
|
},
|
|
2345
2345
|
{
|
|
2346
2346
|
"dependsOn": [],
|
|
2347
|
-
"ref": "@maiaos/client-core@0.1.0-canary.
|
|
2347
|
+
"ref": "@maiaos/client-core@0.1.0-canary.70"
|
|
2348
2348
|
},
|
|
2349
2349
|
{
|
|
2350
2350
|
"dependsOn": [],
|
|
2351
|
-
"ref": "@maiaos/panel@0.1.0-canary.
|
|
2351
|
+
"ref": "@maiaos/panel@0.1.0-canary.70"
|
|
2352
2352
|
},
|
|
2353
2353
|
{
|
|
2354
2354
|
"dependsOn": [],
|
|
2355
|
-
"ref": "@maiaos/protocol@0.1.0-canary.
|
|
2355
|
+
"ref": "@maiaos/protocol@0.1.0-canary.70"
|
|
2356
2356
|
},
|
|
2357
2357
|
{
|
|
2358
2358
|
"dependsOn": [],
|
|
2359
|
-
"ref": "@maiaos/sdk@0.1.0-canary.
|
|
2359
|
+
"ref": "@maiaos/sdk@0.1.0-canary.70"
|
|
2360
2360
|
},
|
|
2361
2361
|
{
|
|
2362
2362
|
"dependsOn": [],
|
|
2363
|
-
"ref": "@maiaos/web-ui@0.1.0-canary.
|
|
2363
|
+
"ref": "@maiaos/web-ui@0.1.0-canary.70"
|
|
2364
2364
|
},
|
|
2365
2365
|
{
|
|
2366
2366
|
"dependsOn": [],
|
|
@@ -2637,16 +2637,16 @@
|
|
|
2637
2637
|
],
|
|
2638
2638
|
"metadata": {
|
|
2639
2639
|
"component": {
|
|
2640
|
-
"bom-ref": "@maiaos/node@0.1.0-canary.
|
|
2640
|
+
"bom-ref": "@maiaos/node@0.1.0-canary.70",
|
|
2641
2641
|
"hashes": [
|
|
2642
2642
|
{
|
|
2643
2643
|
"alg": "SHA-256",
|
|
2644
|
-
"content": "
|
|
2644
|
+
"content": "01c8fe78d57035af9c463529a98f818e1cb5319520056f05027c774316d6897d"
|
|
2645
2645
|
}
|
|
2646
2646
|
],
|
|
2647
2647
|
"name": "@maiaos/node",
|
|
2648
2648
|
"type": "application",
|
|
2649
|
-
"version": "0.1.0-canary.
|
|
2649
|
+
"version": "0.1.0-canary.70"
|
|
2650
2650
|
},
|
|
2651
2651
|
"properties": [
|
|
2652
2652
|
{
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"name": "@maiaos/node",
|
|
4
4
|
"path": "services/node/dist/bin/maia-node.mjs",
|
|
5
5
|
"sha256": "8b9aa2361909f11009ec8a1b472034e950e9e1e75a4ecade4413dfb5d9a6368c",
|
|
6
|
-
"version": "0.1.0-canary.
|
|
6
|
+
"version": "0.1.0-canary.70"
|
|
7
7
|
},
|
|
8
8
|
"artifacts": [
|
|
9
9
|
{
|
|
10
10
|
"bytes": 5223898,
|
|
11
11
|
"path": "services/node/dist/bin/maia-node-main.mjs",
|
|
12
12
|
"role": "application-main",
|
|
13
|
-
"sha256": "
|
|
13
|
+
"sha256": "01c8fe78d57035af9c463529a98f818e1cb5319520056f05027c774316d6897d"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"bytes": 6724135,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"bytes": 63218,
|
|
23
23
|
"path": "services/node/dist/bin/maia-node.cdx.json",
|
|
24
24
|
"role": "sbom",
|
|
25
|
-
"sha256": "
|
|
25
|
+
"sha256": "fbeb8051f4fbb51cc1bbee58d9b14a4ba29576fff17dd452c8668bdab6b99fd6"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"bytes": 3167605,
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"bytes": 2135,
|
|
53
53
|
"path": "services/node/dist/bin/maia-process-host-linux-x64.build.json",
|
|
54
54
|
"role": "native-build-metadata",
|
|
55
|
-
"sha256": "
|
|
55
|
+
"sha256": "fdea81da9cc9df899f1059b030c66c9e7be6ecfcb56286125e1a455b5be36575"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"bytes": 832543,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"services/node/native/process-host/protocol.h": "c1b97046c62b1b56e80e3d319c395282806d085b16322faa299f45ceb6c127a6",
|
|
59
59
|
"services/node/native/process-host/sha256.h": "b2a686bbe44f7a67b14b9550fd5166db560fbb23104654ae818a92a69b07f819"
|
|
60
60
|
},
|
|
61
|
-
"revision": "
|
|
61
|
+
"revision": "ae33c76a8693acdf9a853826a35b3f5e96f6f7e4"
|
|
62
62
|
},
|
|
63
63
|
"targetTriple": "linux-x64"
|
|
64
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"asset": "maia-web-0.1.0-canary.
|
|
1
|
+
{"asset": "maia-web-0.1.0-canary.70.tgz", "bytes": 15123353, "sha256": "df9ae9bb098145c15ae2c4f1e650a852591a60db84b47dd40e14326e492110e1", "version": "0.1.0-canary.70"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiaos/node",
|
|
3
|
-
"version": "0.1.0-canary.
|
|
3
|
+
"version": "0.1.0-canary.70",
|
|
4
4
|
"description": "Maia Node: the local authority that owns Sessions, worker accounts, durable state, events and receipts for swarms of AI coding agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"maia",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@effect/vitest": "4.0.0",
|
|
48
|
-
"@maiaos/cli": "0.1.0-canary.
|
|
49
|
-
"@maiaos/sdk": "0.1.0-canary.
|
|
48
|
+
"@maiaos/cli": "0.1.0-canary.70",
|
|
49
|
+
"@maiaos/sdk": "0.1.0-canary.70",
|
|
50
50
|
"@types/node": "24.13.3",
|
|
51
51
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
52
52
|
"@vitest/coverage-v8": "5.0.3",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@agentclientprotocol/sdk": "2.9.1",
|
|
62
62
|
"@anthropic-ai/claude-agent-sdk": "0.3.285",
|
|
63
63
|
"@effect/platform-node-shared": "4.0.0",
|
|
64
|
-
"@maiaos/agent": "0.1.0-canary.
|
|
65
|
-
"@maiaos/protocol": "0.1.0-canary.
|
|
64
|
+
"@maiaos/agent": "0.1.0-canary.70",
|
|
65
|
+
"@maiaos/protocol": "0.1.0-canary.70",
|
|
66
66
|
"effect": "4.0.0",
|
|
67
67
|
"skills": "1.7.0",
|
|
68
68
|
"xstate": "5.32.5"
|