@vibengine/cli 2.6.1 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -216,7 +216,7 @@ ${EL}
|
|
|
216
216
|
Try running with %s or get access `,Ue.cyan("sudo"))+`
|
|
217
217
|
to the local update config store via
|
|
218
218
|
`+Ue.cyan((0,b_.format)(" sudo chown -R $USER:$(id -gn $USER) %s ",Kc));es.default.on("exit",()=>{console.error(Fn(r,{textAlignment:"center"}))})}}check(){!this.config||this.config.get("optOut")||this.#n||(this.update=this.config.get("update"),this.update&&(this.update.current=this.#r,this.config.delete("update")),!(Date.now()-this.config.get("lastUpdateCheck")<this.#e)&&(0,j3.spawn)(es.default.execPath,[Mx.default.join(VEe,"check.js"),JSON.stringify(this.#t)],{detached:!0,stdio:"ignore"}).unref())}async fetchInfo(){let{distTag:e}=this.#t,r=await ux(this._packageName,{version:e});return{latest:r,current:this.#r,type:vT(this.#r,r)||e,name:this._packageName}}notify(e){let r=!this._shouldNotifyInNpmScript&&U8;if(!es.default.stdout.isTTY||r||!this.update||!X3.default.gt(this.update.latest,this.update.current))return this;e={isGlobal:Z3.default,isYarnGlobal:r3(),...e};let n;e.isYarnGlobal?n=`yarn global add ${this._packageName}`:e.isGlobal?n=`npm i -g ${this._packageName}`:gx()?n=`yarn add ${this._packageName}`:n=`npm i ${this._packageName}`;let i="Update available "+Ue.dim("{currentVersion}")+Ue.reset(" \u2192 ")+Ue.green("{latestVersion}")+`
|
|
219
|
-
Run `+Ue.cyan("{updateCommand}")+" to update",s=e.message||i;e.boxenOptions=e.boxenOptions||{padding:1,margin:1,textAlignment:"center",borderColor:"yellow",borderStyle:"round"};let a=Fn(Px(s,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:n}),e.boxenOptions);return e.defer===!1?console.error(a):(es.default.on("exit",()=>{console.error(a)}),es.default.on("SIGINT",()=>{console.error(""),es.default.exit()})),this}};function Fx(t){let e=new tf(t);return e.check(),e}u();var mF=J(pF(),1),{program:oet,createCommand:cet,createArgument:uet,createOption:det,CommanderError:fet,InvalidArgumentError:nf,InvalidOptionArgumentError:pet,Command:$e,Argument:met,Option:Aa,Help:het}=mF.default;var Qx={};Wb(Qx,{author:()=>mSe,bin:()=>xSe,bugs:()=>hSe,default:()=>ASe,dependencies:()=>CSe,description:()=>dSe,devDependencies:()=>TSe,engines:()=>DSe,files:()=>ySe,homepage:()=>fSe,keywords:()=>ESe,license:()=>pSe,name:()=>uSe,publishConfig:()=>gSe,repository:()=>_Se,scripts:()=>bSe,sideEffects:()=>SSe,version:()=>Xx});var uSe="@vibengine/cli",Xx="2.6.
|
|
219
|
+
Run `+Ue.cyan("{updateCommand}")+" to update",s=e.message||i;e.boxenOptions=e.boxenOptions||{padding:1,margin:1,textAlignment:"center",borderColor:"yellow",borderStyle:"round"};let a=Fn(Px(s,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:n}),e.boxenOptions);return e.defer===!1?console.error(a):(es.default.on("exit",()=>{console.error(a)}),es.default.on("SIGINT",()=>{console.error(""),es.default.exit()})),this}};function Fx(t){let e=new tf(t);return e.check(),e}u();var mF=J(pF(),1),{program:oet,createCommand:cet,createArgument:uet,createOption:det,CommanderError:fet,InvalidArgumentError:nf,InvalidOptionArgumentError:pet,Command:$e,Argument:met,Option:Aa,Help:het}=mF.default;var Qx={};Wb(Qx,{author:()=>mSe,bin:()=>xSe,bugs:()=>hSe,default:()=>ASe,dependencies:()=>CSe,description:()=>dSe,devDependencies:()=>TSe,engines:()=>DSe,files:()=>ySe,homepage:()=>fSe,keywords:()=>ESe,license:()=>pSe,name:()=>uSe,publishConfig:()=>gSe,repository:()=>_Se,scripts:()=>bSe,sideEffects:()=>SSe,version:()=>Xx});var uSe="@vibengine/cli",Xx="2.6.3",dSe="CLI for managing Vibengine sandbox templates",fSe="https://vibengine.ai",pSe="MIT",mSe={name:"FoundryLabs, Inc.",email:"hello@vibengine.ai",url:"https://vibengine.ai"},hSe="https://github.com/e2b-dev/e2b/issues",_Se={type:"git",url:"https://github.com/e2b-dev/e2b",directory:"packages/cli"},gSe={access:"public"},ESe=["vibengine","ai-agents","agents","ai","code-interpreter","sandbox","code","cli","runtime","vm","nodejs","javascript","typescript"],SSe=!1,bSe={prepublishOnly:"pnpm build",build:"tsc --noEmit --skipLibCheck && tsup --minify",dev:"tsup --watch",lint:"eslint src",format:"prettier --write src","test:interactive":"pnpm build && ./dist/index.js",test:"vitest run","test:watch":"vitest watch","test:coverage":"vitest run --coverage","check-deps":"knip","update-deps":"ncu -u && pnpm i","generate-ref":"./scripts/generate_sdk_ref.sh"},TSe={"@types/command-exists":"^1.2.3","@types/handlebars":"^4.1.0","@types/inquirer":"^9.0.7","@types/json2md":"^1.5.4","@types/node":"^20.19.19","@types/npmcli__package-json":"^4.0.4","@types/statuses":"^2.0.5","@types/update-notifier":"6.0.5","@vitest/coverage-v8":"^3.2.4",json2md:"^2.0.1",knip:"^5.43.6","npm-check-updates":"^16.14.6",tsup:"^8.4.0",typescript:"^5.2.2",vitest:"^3.2.4"},ySe=["dist","LICENSE","README","package.json"],xSe={ve:"dist/index.js"},CSe={"@iarna/toml":"^2.2.5","@inquirer/prompts":"^7.9.0","@npmcli/package-json":"^5.2.1","async-listen":"^3.0.1",boxen:"^7.1.1",chalk:"^5.3.0","cli-highlight":"^2.1.11","command-exists":"^1.2.9",commander:"^11.1.0","console-table-printer":"^2.11.2","dockerfile-ast":"^0.6.1",handlebars:"^4.7.8",inquirer:"^12.10.0",open:"^9.1.0",statuses:"^2.0.1","strip-ansi":"^7.1.0","update-notifier":"^6.0.2",yup:"^1.3.2","@vibengine/sdk":"^2.12.1"},DSe={node:">=20"},ASe={name:uSe,version:Xx,description:dSe,homepage:fSe,license:pSe,author:mSe,bugs:hSe,repository:_Se,publishConfig:gSe,keywords:ESe,sideEffects:SSe,scripts:bSe,devDependencies:TSe,files:ySe,bin:xSe,dependencies:CSe,engines:DSe};u();u();var RD=J(xW());u();var Hl=J(require("path"));function Rn(t){let e=process.cwd();return t?Hl.isAbsolute(t)?t:Hl.resolve(e,t):e}function CW(t){return Hl.relative(process.cwd(),t)}var wOe="#FFB766";function Og(t){let e=Re(t.email),r=t.teamName?Re(t.teamName):LOe("Log out and log in to get team name"),n=Re(t.teamId);return`You are logged in as ${e},
|
|
220
220
|
Selected team: ${r} (${n})`}function RW(t,e){let r=Re(t.name),n=Re(t.teamID),i=t.teamID==e?Qe(" (currently selected team)"):"";return`${r} (${n})${i}`}function Jt(t,e){let r=ND(t.aliases),n=r?Re(r):"",i=e?POe(" <-> ")+Tt(e):"";return`${`${t.templateID} `}${n}${i}`.trim()}function LOe(t){return Ue.redBright(t)}function ss(t,e){return Ue.redBright(`${t?`${t}
|
|
221
221
|
`:""}${e?e.stack:""}
|
|
222
222
|
`)}function POe(t){return Ue.dim(t)}function Re(t){return Ue.bold(t)}function Qe(t){return Ue.hex(wOe)(t)}function vg(t){return Ue.blue(t)}function Dt(t){return Ue.blue(t)}function Tt(t){return t?Dt("./"+CW(t)):""}function NW(t){return Ue.blueBright(t)}function ql(t){return Ue.underline(t)}function ND(t){if(t)return t.join(", ")}function Ig(t){return RD.default(t,{language:"typescript",ignoreIllegals:!0})}function wg(t){return RD.default(t,{language:"python",ignoreIllegals:!0})}var MOe={topLeft:"",topRight:"",bottomLeft:"",bottomRight:"",top:"",bottom:"",left:"",right:""},DW=2,AW=1;function $l(t,e,r){return Fn(t,{borderStyle:{...MOe,top:"\u2500",bottom:r?"\u2500":""},titleAlignment:"center",float:"left",title:e?Re(e):void 0,margin:{top:0,bottom:0,left:1,right:0},fullscreen:n=>[n,0],padding:{bottom:r?AW:0,left:DW,right:DW,top:AW}})}u();u();u();u();var FOe=/\{[^{}]+\}/g,kOe=()=>typeof process=="object"&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici;function BOe(){return Math.random().toString(36).slice(2,11)}function Lg(t){let{baseUrl:e="",Request:r=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:s,headers:a,requestInitExt:o=void 0,...c}={...t};o=kOe()?o:void 0,e=IW(e);let l=[];async function d(f,m){let{baseUrl:p,fetch:h=n,Request:_=r,headers:S,params:b={},parseAs:C="json",querySerializer:D,bodySerializer:N=s??GOe,body:k,...W}=m||{},q=e;p&&(q=IW(p)??e);let w=typeof i=="function"?i:OW(i);D&&(w=typeof D=="function"?D:OW({...typeof i=="object"?i:{},...D}));let R=k===void 0?void 0:N(k,vW(a,S,b.header)),v=vW(R===void 0||R instanceof FormData?{}:{"Content-Type":"application/json"},a,S,b.header),G={redirect:"follow",...c,...W,body:R,headers:v},te,se,ce=new _(HOe(f,{baseUrl:q,params:b,querySerializer:w}),G),re;for(let le in W)le in ce||(ce[le]=W[le]);if(l.length){te=BOe(),se=Object.freeze({baseUrl:q,fetch:h,parseAs:C,querySerializer:w,bodySerializer:N});for(let le of l)if(le&&typeof le=="object"&&typeof le.onRequest=="function"){let Ee=await le.onRequest({request:ce,schemaPath:f,params:b,options:se,id:te});if(Ee)if(Ee instanceof _)ce=Ee;else if(Ee instanceof Response){re=Ee;break}else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!re){try{re=await h(ce,o)}catch(le){let Ee=le;if(l.length)for(let be=l.length-1;be>=0;be--){let dt=l[be];if(dt&&typeof dt=="object"&&typeof dt.onError=="function"){let ft=await dt.onError({request:ce,error:Ee,schemaPath:f,params:b,options:se,id:te});if(ft){if(ft instanceof Response){Ee=void 0,re=ft;break}if(ft instanceof Error){Ee=ft;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(Ee)throw Ee}if(l.length)for(let le=l.length-1;le>=0;le--){let Ee=l[le];if(Ee&&typeof Ee=="object"&&typeof Ee.onResponse=="function"){let be=await Ee.onResponse({request:ce,response:re,schemaPath:f,params:b,options:se,id:te});if(be){if(!(be instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");re=be}}}}if(re.status===204||ce.method==="HEAD"||re.headers.get("Content-Length")==="0")return re.ok?{data:void 0,response:re}:{error:void 0,response:re};if(re.ok)return C==="stream"?{data:re.body,response:re}:{data:await re[C](),response:re};let ge=await re.text();try{ge=JSON.parse(ge)}catch{}return{error:ge,response:re}}return{request(f,m,p){return d(m,{...p,method:f.toUpperCase()})},GET(f,m){return d(f,{...m,method:"GET"})},PUT(f,m){return d(f,{...m,method:"PUT"})},POST(f,m){return d(f,{...m,method:"POST"})},DELETE(f,m){return d(f,{...m,method:"DELETE"})},OPTIONS(f,m){return d(f,{...m,method:"OPTIONS"})},HEAD(f,m){return d(f,{...m,method:"HEAD"})},PATCH(f,m){return d(f,{...m,method:"PATCH"})},TRACE(f,m){return d(f,{...m,method:"TRACE"})},use(...f){for(let m of f)if(m){if(typeof m!="object"||!("onRequest"in m||"onResponse"in m||"onError"in m))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");l.push(m)}},eject(...f){for(let m of f){let p=l.indexOf(m);p!==-1&&l.splice(p,1)}}}}function Pg(t,e,r){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${r?.allowReserved===!0?e:encodeURIComponent(e)}`}function wW(t,e,r){if(!e||typeof e!="object")return"";let n=[],i={simple:",",label:".",matrix:";"}[r.style]||"&";if(r.style!=="deepObject"&&r.explode===!1){for(let o in e)n.push(o,r.allowReserved===!0?e[o]:encodeURIComponent(e[o]));let a=n.join(",");switch(r.style){case"form":return`${t}=${a}`;case"label":return`.${a}`;case"matrix":return`;${t}=${a}`;default:return a}}for(let a in e){let o=r.style==="deepObject"?`${t}[${a}]`:a;n.push(Pg(o,e[a],r))}let s=n.join(i);return r.style==="label"||r.style==="matrix"?`${i}${s}`:s}function LW(t,e,r){if(!Array.isArray(e))return"";if(r.explode===!1){let s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",a=(r.allowReserved===!0?e:e.map(o=>encodeURIComponent(o))).join(s);switch(r.style){case"simple":return a;case"label":return`.${a}`;case"matrix":return`;${t}=${a}`;default:return`${t}=${a}`}}let n={simple:",",label:".",matrix:";"}[r.style]||"&",i=[];for(let s of e)r.style==="simple"||r.style==="label"?i.push(r.allowReserved===!0?s:encodeURIComponent(s)):i.push(Pg(t,s,r));return r.style==="label"||r.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function OW(t){return function(r){let n=[];if(r&&typeof r=="object")for(let i in r){let s=r[i];if(s!=null){if(Array.isArray(s)){if(s.length===0)continue;n.push(LW(i,s,{style:"form",explode:!0,...t?.array,allowReserved:t?.allowReserved||!1}));continue}if(typeof s=="object"){n.push(wW(i,s,{style:"deepObject",explode:!0,...t?.object,allowReserved:t?.allowReserved||!1}));continue}n.push(Pg(i,s,t))}}return n.join("&")}}function UOe(t,e){let r=t;for(let n of t.match(FOe)??[]){let i=n.substring(1,n.length-1),s=!1,a="simple";if(i.endsWith("*")&&(s=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(a="label",i=i.substring(1)):i.startsWith(";")&&(a="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;let o=e[i];if(Array.isArray(o)){r=r.replace(n,LW(i,o,{style:a,explode:s}));continue}if(typeof o=="object"){r=r.replace(n,wW(i,o,{style:a,explode:s}));continue}if(a==="matrix"){r=r.replace(n,`;${Pg(i,o)}`);continue}r=r.replace(n,a==="label"?`.${encodeURIComponent(o)}`:encodeURIComponent(o))}return r}function GOe(t,e){return t instanceof FormData?t:e&&(e.get instanceof Function?e.get("Content-Type")??e.get("content-type"):e["Content-Type"]??e["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(t).toString():JSON.stringify(t)}function HOe(t,e){let r=`${e.baseUrl}${t}`;e.params?.path&&(r=UOe(r,e.params.path));let n=e.querySerializer(e.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(r+=`?${n}`),r}function vW(...t){let e=new Headers;for(let r of t){if(!r||typeof r!="object")continue;let n=r instanceof Headers?r.entries():Object.entries(r);for(let[i,s]of n)if(s===null)e.delete(i);else if(Array.isArray(s))for(let a of s)e.append(i,a);else s!==void 0&&e.set(i,s)}return e}function IW(t){return t.endsWith("/")?t.substring(0,t.length-1):t}var UR=J(OD(),1),GR=J(OD(),1);u();u();u();var Me;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(Me||(Me={}));u();u();function Of(t,e){return t!==null&&typeof t=="object"&&"$typeName"in t&&typeof t.$typeName=="string"?e===void 0?!0:e.typeName===t.$typeName:!1}u();u();var z;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(z||(z={}));u();u();u();function MW(){let t=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[t,e]}let r=this.buf[this.pos++];if(t|=(r&15)<<28,e=(r&112)>>4,(r&128)==0)return this.assertBounds(),[t,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,(i&128)==0)return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function kg(t,e,r){for(let s=0;s<28;s=s+7){let a=t>>>s,o=!(!(a>>>7)&&e==0),c=(o?a|128:a)&255;if(r.push(c),!o)return}let n=t>>>28&15|(e&7)<<4,i=e>>3!=0;if(r.push((i?n|128:n)&255),!!i){for(let s=3;s<31;s=s+7){let a=e>>>s,o=!!(a>>>7),c=(o?a|128:a)&255;if(r.push(c),!o)return}r.push(e>>>31&1)}}var Fg=4294967296;function vD(t){let e=t[0]==="-";e&&(t=t.slice(1));let r=1e6,n=0,i=0;function s(a,o){let c=Number(t.slice(a,o));i*=r,n=n*r+c,n>=Fg&&(i=i+(n/Fg|0),n=n%Fg)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?kW(n,i):wD(n,i)}function FW(t,e){let r=wD(t,e),n=r.hi&2147483648;n&&(r=kW(r.lo,r.hi));let i=ID(r.lo,r.hi);return n?"-"+i:i}function ID(t,e){if({lo:t,hi:e}=qOe(t,e),e<=2097151)return String(Fg*e+t);let r=t&16777215,n=(t>>>24|e<<8)&16777215,i=e>>16&65535,s=r+n*6777216+i*6710656,a=n+i*8147497,o=i*2,c=1e7;return s>=c&&(a+=Math.floor(s/c),s%=c),a>=c&&(o+=Math.floor(a/c),a%=c),o.toString()+PW(a)+PW(s)}function qOe(t,e){return{lo:t>>>0,hi:e>>>0}}function wD(t,e){return{lo:t|0,hi:e|0}}function kW(t,e){return e=~e,t?t=~t+1:e+=1,wD(t,e)}var PW=t=>{let e=String(t);return"0000000".slice(e.length)+e};function LD(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let r=0;r<9;r++)e.push(t&127|128),t=t>>7;e.push(1)}}function BW(){let t=this.buf[this.pos++],e=t&127;if((t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,(t&128)==0)return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let r=5;(t&128)!==0&&r<10;r++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var ht=$Oe();function $Oe(){let t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){let o=typeof a=="bigint"?a:BigInt(a);if(o>n||o<r)throw new Error(`invalid int64: ${a}`);return o},uParse(a){let o=typeof a=="bigint"?a:BigInt(a);if(o>s||o<i)throw new Error(`invalid uint64: ${a}`);return o},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(a,o){return t.setInt32(0,a,!0),t.setInt32(4,o,!0),t.getBigInt64(0,!0)},uDec(a,o){return t.setInt32(0,a,!0),t.setInt32(4,o,!0),t.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),UW(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),GW(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),UW(r),vD(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),GW(r),vD(r)},dec(r,n){return FW(r,n)},uDec(r,n){return ID(r,n)}}}function UW(t){if(!/^-?[0-9]+$/.test(t))throw new Error("invalid int64: "+t)}function GW(t){if(!/^[0-9]+$/.test(t))throw new Error("invalid uint64: "+t)}function Bn(t,e){switch(t){case z.STRING:return"";case z.BOOL:return!1;case z.DOUBLE:case z.FLOAT:return 0;case z.INT64:case z.UINT64:case z.SFIXED64:case z.FIXED64:case z.SINT64:return e?"0":ht.zero;case z.BYTES:return new Uint8Array(0);default:return 0}}function HW(t,e){switch(t){case z.BOOL:return e===!1;case z.STRING:return e==="";case z.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}u();u();var qW=2,Pi=Symbol.for("reflect unsafe local");function Bg(t,e){let r=t[e.localName].case;return r===void 0?r:e.fields.find(n=>n.localName===r)}function $W(t,e){let r=e.localName;if(e.oneof)return t[e.oneof.localName].case===r;if(e.presence!=qW)return t[r]!==void 0&&Object.prototype.hasOwnProperty.call(t,r);switch(e.fieldKind){case"list":return t[r].length>0;case"map":return Object.keys(t[r]).length>0;case"scalar":return!HW(e.scalar,t[r]);case"enum":return t[r]!==e.enum.values[0].number}throw new Error("message field with implicit presence")}function jo(t,e){return Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==void 0}function Ug(t,e){if(e.oneof){let r=t[e.oneof.localName];return r.case===e.localName?r.value:void 0}return t[e.localName]}function Gg(t,e,r){e.oneof?t[e.oneof.localName]={case:e.localName,value:r}:t[e.localName]=r}function YW(t,e){let r=e.localName;if(e.oneof){let n=e.oneof.localName;t[n].case===r&&(t[n]={case:void 0})}else if(e.presence!=qW)delete t[r];else switch(e.fieldKind){case"map":t[r]={};break;case"list":t[r]=[];break;case"enum":t[r]=e.enum.values[0].number;break;case"scalar":t[r]=Bn(e.scalar,e.longAsString);break}}function as(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function vf(t,e){var r,n,i,s;if(as(t)&&Pi in t&&"add"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let a=e,o=t.field();return a.listKind==o.listKind&&a.scalar===o.scalar&&((r=a.message)===null||r===void 0?void 0:r.typeName)===((n=o.message)===null||n===void 0?void 0:n.typeName)&&((i=a.enum)===null||i===void 0?void 0:i.typeName)===((s=o.enum)===null||s===void 0?void 0:s.typeName)}return!0}return!1}function If(t,e){var r,n,i,s;if(as(t)&&Pi in t&&"has"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let a=e,o=t.field();return a.mapKey===o.mapKey&&a.mapKind==o.mapKind&&a.scalar===o.scalar&&((r=a.message)===null||r===void 0?void 0:r.typeName)===((n=o.message)===null||n===void 0?void 0:n.typeName)&&((i=a.enum)===null||i===void 0?void 0:i.typeName)===((s=o.enum)===null||s===void 0?void 0:s.typeName)}return!0}return!1}function wf(t,e){return as(t)&&Pi in t&&"desc"in t&&as(t.desc)&&t.desc.kind==="message"&&(e===void 0||t.desc.typeName==e.typeName)}u();function VW(t){return WW(t.$typeName)}function os(t){let e=t.fields[0];return WW(t.typeName)&&e!==void 0&&e.fieldKind=="scalar"&&e.name=="value"&&e.number==1}function WW(t){return t.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(t.substring(16))}var YOe=999,VOe=998,Hg=2;function Hr(t,e){if(Of(e,t))return e;let r=QOe(t);return e!==void 0&&WOe(t,r,e),r}function WOe(t,e,r){for(let n of t.members){let i=r[n.localName];if(i==null)continue;let s;if(n.kind=="oneof"){let a=Bg(r,n);if(!a)continue;s=a,i=Ug(r,a)}else s=n;switch(s.fieldKind){case"message":i=MD(s,i);break;case"scalar":i=jW(s,i);break;case"list":i=zOe(s,i);break;case"map":i=KOe(s,i);break}Gg(e,s,i)}return e}function jW(t,e){return t.scalar==z.BYTES?FD(e):e}function KOe(t,e){if(as(e)){if(t.scalar==z.BYTES)return KW(e,FD);if(t.mapKind=="message")return KW(e,r=>MD(t,r))}return e}function zOe(t,e){if(Array.isArray(e)){if(t.scalar==z.BYTES)return e.map(FD);if(t.listKind=="message")return e.map(r=>MD(t,r))}return e}function MD(t,e){if(t.fieldKind=="message"&&!t.oneof&&os(t.message))return jW(t.message.fields[0],e);if(as(e)){if(t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!=="google.protobuf.Value")return e;if(!Of(e,t.message))return Hr(t.message,e)}return e}function FD(t){return Array.isArray(t)?new Uint8Array(t):t}function KW(t,e){let r={};for(let n of Object.entries(t))r[n[0]]=e(n[1]);return r}var jOe=Symbol(),zW=new WeakMap;function QOe(t){let e;if(XOe(t)){let r=zW.get(t),n,i;if(r)({prototype:n,members:i}=r);else{n={},i=new Set;for(let s of t.members)s.kind!="oneof"&&(s.fieldKind!="scalar"&&s.fieldKind!="enum"||s.presence!=Hg&&(i.add(s),n[s.localName]=PD(s)));zW.set(t,{prototype:n,members:i})}e=Object.create(n),e.$typeName=t.typeName;for(let s of t.members)i.has(s)||s.kind=="field"&&(s.fieldKind=="message"||(s.fieldKind=="scalar"||s.fieldKind=="enum")&&s.presence!=Hg)||(e[s.localName]=PD(s))}else{e={$typeName:t.typeName};for(let r of t.members)(r.kind=="oneof"||r.presence==Hg)&&(e[r.localName]=PD(r))}return e}function XOe(t){switch(t.file.edition){case YOe:return!1;case VOe:return!0;default:return t.fields.some(e=>e.presence!=Hg&&e.fieldKind!="message"&&!e.oneof)}}function PD(t){if(t.kind=="oneof")return{case:void 0};if(t.fieldKind=="list")return[];if(t.fieldKind=="map")return{};if(t.fieldKind=="message")return jOe;let e=t.getDefaultValue();return e!==void 0?t.fieldKind=="scalar"&&t.longAsString?e.toString():e:t.fieldKind=="scalar"?Bn(t.scalar,t.longAsString):t.enum.values[0].number}u();u();u();var ZOe=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"],gr=class extends Error{constructor(e,r,n="FieldValueInvalidError"){super(r),this.name=n,this.field=()=>e}};function QW(t){return t instanceof Error&&ZOe.includes(t.name)&&"field"in t&&typeof t.field=="function"}u();u();var kD=Symbol.for("@bufbuild/protobuf/text-encoding");function Lf(){if(globalThis[kD]==null){let t=new globalThis.TextEncoder,e=new globalThis.TextDecoder;globalThis[kD]={encodeUtf8(r){return t.encode(r)},decodeUtf8(r){return e.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return globalThis[kD]}var zt;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(zt||(zt={}));var UD=34028234663852886e22,GD=-34028234663852886e22,HD=4294967295,qD=2147483647,$D=-2147483648,ka=class{constructor(e=Lf().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let r=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)r.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,r){return this.uint32((e<<3|r)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(XW(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return BD(e),LD(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let r=this.encodeUtf8(e);return this.uint32(r.byteLength),this.raw(r)}float(e){JOe(e);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,e,!0),this.raw(r)}double(e){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,e,!0),this.raw(r)}fixed32(e){XW(e);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!0),this.raw(r)}sfixed32(e){BD(e);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,e,!0),this.raw(r)}sint32(e){return BD(e),e=(e<<1^e>>31)>>>0,LD(e,this.buf),this}sfixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),i=ht.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}fixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),i=ht.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}int64(e){let r=ht.enc(e);return kg(r.lo,r.hi,this.buf),this}sint64(e){let r=ht.enc(e),n=r.hi>>31,i=r.lo<<1^n,s=(r.hi<<1|r.lo>>>31)^n;return kg(i,s,this.buf),this}uint64(e){let r=ht.uEnc(e);return kg(r.lo,r.hi,this.buf),this}},Qo=class{constructor(e,r=Lf().decodeUtf8){this.decodeUtf8=r,this.varint64=MW,this.uint32=BW,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),r=e>>>3,n=e&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(e,r){let n=this.pos;switch(e){case zt.Varint:for(;this.buf[this.pos++]&128;);break;case zt.Bit64:this.pos+=4;case zt.Bit32:this.pos+=4;break;case zt.LengthDelimited:let i=this.uint32();this.pos+=i;break;case zt.StartGroup:for(;;){let[s,a]=this.tag();if(a===zt.EndGroup){if(r!==void 0&&s!==r)throw new Error("invalid end group tag");break}this.skip(a,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return ht.dec(...this.varint64())}uint64(){return ht.uDec(...this.varint64())}sint64(){let[e,r]=this.varint64(),n=-(e&1);return e=(e>>>1|(r&1)<<31)^n,r=r>>>1^n,ht.dec(e,r)}bool(){let[e,r]=this.varint64();return e!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return ht.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return ht.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),r=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(r,r+e)}string(){return this.decodeUtf8(this.bytes())}};function BD(t){if(typeof t=="string")t=Number(t);else if(typeof t!="number")throw new Error("invalid int32: "+typeof t);if(!Number.isInteger(t)||t>qD||t<$D)throw new Error("invalid int32: "+t)}function XW(t){if(typeof t=="string")t=Number(t);else if(typeof t!="number")throw new Error("invalid uint32: "+typeof t);if(!Number.isInteger(t)||t>HD||t<0)throw new Error("invalid uint32: "+t)}function JOe(t){if(typeof t=="string"){let e=t;if(t=Number(t),Number.isNaN(t)&&e!=="NaN")throw new Error("invalid float32: "+e)}else if(typeof t!="number")throw new Error("invalid float32: "+typeof t);if(Number.isFinite(t)&&(t>UD||t<GD))throw new Error("invalid float32: "+t)}function Gs(t,e){let r=t.fieldKind=="list"?vf(e,t):t.fieldKind=="map"?If(e,t):VD(t,e);if(r===!0)return;let n;switch(t.fieldKind){case"list":n=`expected ${tK(t)}, got ${cr(e)}`;break;case"map":n=`expected ${rK(t)}, got ${cr(e)}`;break;default:n=qg(t,e,r)}return new gr(t,n)}function YD(t,e,r){let n=VD(t,r);if(n!==!0)return new gr(t,`list item #${e+1}: ${qg(t,r,n)}`)}function ZW(t,e,r){let n=JW(e,t.mapKey);if(n!==!0)return new gr(t,`invalid map key: ${qg({scalar:t.mapKey},e,n)}`);let i=VD(t,r);if(i!==!0)return new gr(t,`map entry ${cr(e)}: ${qg(t,r,i)}`)}function VD(t,e){return t.scalar!==void 0?JW(e,t.scalar):t.enum!==void 0?t.enum.open?Number.isInteger(e):t.enum.values.some(r=>r.number===e):wf(e,t.message)}function JW(t,e){switch(e){case z.DOUBLE:return typeof t=="number";case z.FLOAT:return typeof t!="number"?!1:Number.isNaN(t)||!Number.isFinite(t)?!0:t>UD||t<GD?`${t.toFixed()} out of range`:!0;case z.INT32:case z.SFIXED32:case z.SINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>qD||t<$D?`${t.toFixed()} out of range`:!0;case z.FIXED32:case z.UINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>HD||t<0?`${t.toFixed()} out of range`:!0;case z.BOOL:return typeof t=="boolean";case z.STRING:return typeof t!="string"?!1:Lf().checkUtf8(t)||"invalid UTF8";case z.BYTES:return t instanceof Uint8Array;case z.INT64:case z.SFIXED64:case z.SINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return ht.parse(t),!0}catch{return`${t} out of range`}return!1;case z.FIXED64:case z.UINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return ht.uParse(t),!0}catch{return`${t} out of range`}return!1}}function qg(t,e,r){return r=typeof r=="string"?`: ${r}`:`, got ${cr(e)}`,t.scalar!==void 0?`expected ${eve(t.scalar)}`+r:t.enum!==void 0?`expected ${t.enum.toString()}`+r:`expected ${eK(t.message)}`+r}function cr(t){switch(typeof t){case"object":return t===null?"null":t instanceof Uint8Array?`Uint8Array(${t.length})`:Array.isArray(t)?`Array(${t.length})`:vf(t)?tK(t.field()):If(t)?rK(t.field()):wf(t)?eK(t.desc):Of(t)?`message ${t.$typeName}`:"object";case"string":return t.length>30?"string":`"${t.split('"').join('\\"')}"`;case"boolean":return String(t);case"number":return String(t);case"bigint":return String(t)+"n";default:return typeof t}}function eK(t){return`ReflectMessage (${t.typeName})`}function tK(t){switch(t.listKind){case"message":return`ReflectList (${t.message.toString()})`;case"enum":return`ReflectList (${t.enum.toString()})`;case"scalar":return`ReflectList (${z[t.scalar]})`}}function rK(t){switch(t.mapKind){case"message":return`ReflectMap (${z[t.mapKey]}, ${t.message.toString()})`;case"enum":return`ReflectMap (${z[t.mapKey]}, ${t.enum.toString()})`;case"scalar":return`ReflectMap (${z[t.mapKey]}, ${z[t.scalar]})`}}function eve(t){switch(t){case z.STRING:return"string";case z.BOOL:return"boolean";case z.INT64:case z.SINT64:case z.SFIXED64:return"bigint (int64)";case z.UINT64:case z.FIXED64:return"bigint (uint64)";case z.BYTES:return"Uint8Array";case z.DOUBLE:return"number (float64)";case z.FLOAT:return"number (float32)";case z.FIXED32:case z.UINT32:return"number (uint32)";case z.INT32:case z.SFIXED32:case z.SINT32:return"number (int32)"}}function qr(t,e,r=!0){return new Yg(t,e,r)}var Yg=class{get sortedFields(){var e;return(e=this._sortedFields)!==null&&e!==void 0?e:this._sortedFields=this.desc.fields.concat().sort((r,n)=>r.number-n.number)}constructor(e,r,n=!0){this.lists=new Map,this.maps=new Map,this.check=n,this.desc=e,this.message=this[Pi]=r??Hr(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(r=>[r.number,r]))),this._fieldsByNumber.get(e)}oneofCase(e){return Pf(this.message,e),Bg(this.message,e)}isSet(e){return Pf(this.message,e),$W(this.message,e)}clear(e){Pf(this.message,e),YW(this.message,e)}get(e){Pf(this.message,e);let r=Ug(this.message,e);switch(e.fieldKind){case"list":let n=this.lists.get(e);return(!n||n[Pi]!==r)&&this.lists.set(e,n=new zD(e,r,this.check)),n;case"map":let i=this.maps.get(e);return(!i||i[Pi]!==r)&&this.maps.set(e,i=new jD(e,r,this.check)),i;case"message":return XD(e,r,this.check);case"scalar":return r===void 0?Bn(e.scalar,!1):ZD(e,r);case"enum":return r??e.enum.values[0].number}}set(e,r){if(Pf(this.message,e),this.check){let i=Gs(e,r);if(i)throw i}let n;e.fieldKind=="message"?n=QD(e,r):If(r)||vf(r)?n=r[Pi]:n=JD(e,r),Gg(this.message,e,n)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function Pf(t,e){if(e.parent.typeName!==t.$typeName)throw new gr(e,`cannot use ${e.toString()} with message ${t.$typeName}`,"ForeignFieldError")}var zD=class{field(){return this._field}get size(){return this._arr.length}constructor(e,r,n){this._field=e,this._arr=this[Pi]=r,this.check=n}get(e){let r=this._arr[e];return r===void 0?void 0:WD(this._field,r,this.check)}set(e,r){if(e<0||e>=this._arr.length)throw new gr(this._field,`list item #${e+1}: out of range`);if(this.check){let n=YD(this._field,e,r);if(n)throw n}this._arr[e]=nK(this._field,r)}add(e){if(this.check){let r=YD(this._field,this._arr.length,e);if(r)throw r}this._arr.push(nK(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let e of this._arr)yield WD(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,WD(this._field,this._arr[e],this.check)]}};var jD=class{constructor(e,r,n=!0){this.obj=this[Pi]=r??{},this.check=n,this._field=e}field(){return this._field}set(e,r){if(this.check){let n=ZW(this._field,e,r);if(n)throw n}return this.obj[$g(e)]=tve(this._field,r),this}delete(e){let r=$g(e),n=Object.prototype.hasOwnProperty.call(this.obj,r);return n&&delete this.obj[r],n}clear(){for(let e of Object.keys(this.obj))delete this.obj[e]}get(e){let r=this.obj[$g(e)];return r!==void 0&&(r=KD(this._field,r,this.check)),r}has(e){return Object.prototype.hasOwnProperty.call(this.obj,$g(e))}*keys(){for(let e of Object.keys(this.obj))yield iK(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[iK(e[0],this._field.mapKey),KD(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let e of Object.values(this.obj))yield KD(this._field,e,this.check)}forEach(e,r){for(let n of this.entries())e.call(r,n[1],n[0],this)}};function QD(t,e){return wf(e)?VW(e.message)&&!t.oneof&&t.fieldKind=="message"?e.message.value:e.desc.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"?aK(e.message):e.message:e}function XD(t,e,r){return e!==void 0&&(os(t.message)&&!t.oneof&&t.fieldKind=="message"?e={$typeName:t.message.typeName,value:ZD(t.message.fields[0],e)}:t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"&&as(e)&&(e=sK(e))),new Yg(t.message,e,r)}function nK(t,e){return t.listKind=="message"?QD(t,e):JD(t,e)}function WD(t,e,r){return t.listKind=="message"?XD(t,e,r):ZD(t,e)}function tve(t,e){return t.mapKind=="message"?QD(t,e):JD(t,e)}function KD(t,e,r){return t.mapKind=="message"?XD(t,e,r):e}function $g(t){return typeof t=="string"||typeof t=="number"?t:String(t)}function iK(t,e){switch(e){case z.STRING:return t;case z.INT32:case z.FIXED32:case z.UINT32:case z.SFIXED32:case z.SINT32:{let r=Number.parseInt(t);if(Number.isFinite(r))return r;break}case z.BOOL:switch(t){case"true":return!0;case"false":return!1}break;case z.UINT64:case z.FIXED64:try{return ht.uParse(t)}catch{}break;default:try{return ht.parse(t)}catch{}break}return t}function ZD(t,e){switch(t.scalar){case z.INT64:case z.SFIXED64:case z.SINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=ht.parse(e));break;case z.FIXED64:case z.UINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=ht.uParse(e));break}return e}function JD(t,e){switch(t.scalar){case z.INT64:case z.SFIXED64:case z.SINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=ht.parse(e));break;case z.FIXED64:case z.UINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=ht.uParse(e));break}return e}function sK(t){let e={$typeName:"google.protobuf.Struct",fields:{}};if(as(t))for(let[r,n]of Object.entries(t))e.fields[r]=cK(n);return e}function aK(t){let e={};for(let[r,n]of Object.entries(t.fields))e[r]=oK(n);return e}function oK(t){switch(t.kind.case){case"structValue":return aK(t.kind.value);case"listValue":return t.kind.value.values.map(oK);case"nullValue":case void 0:return null;default:return t.kind.value}}function cK(t){let e={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof t){case"number":e.kind={case:"numberValue",value:t};break;case"string":e.kind={case:"stringValue",value:t};break;case"boolean":e.kind={case:"boolValue",value:t};break;case"object":if(t===null)e.kind={case:"nullValue",value:0};else if(Array.isArray(t)){let r={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(t))for(let n of t)r.values.push(cK(n));e.kind={case:"listValue",value:r}}else e.kind={case:"structValue",value:sK(t)};break}return e}u();u();u();function Vl(t){let e=rve(),r=t.length*3/4;t[t.length-2]=="="?r-=2:t[t.length-1]=="="&&(r-=1);let n=new Uint8Array(r),i=0,s=0,a,o=0;for(let c=0;c<t.length;c++){if(a=e[t.charCodeAt(c)],a===void 0)switch(t[c]){case"=":s=0;case`
|
|
@@ -367,7 +367,7 @@ Learn more about Template SDK: ${Qe("https://vibengine.ai/docs")}
|
|
|
367
367
|
\u26A0\uFE0F This will make the ${s.length===1?"template":"templates"} ${t?"public to everyone outside your team":"private to your team"}`)){console.log("Canceled");return}await Promise.all(s.map(async a=>{console.log(`- ${t?"Publishing":"Unpublishing"} sandbox template ${Jt({...a,templateID:a.template_id},a.configPath)}`);let o=await hUe(a.template_id,t);t&&o.length>0&&console.log(` Published as: ${Re(o.join(", "))}`)})),process.stdout.write(`
|
|
368
368
|
`)}catch(n){console.error(ss(n.message)),process.exit(1)}}var Rse=new $e("publish").description("publish sandbox template").argument("[template]",`specify ${Re("[template]")} to publish it. If you dont specify ${Re("[template]")} the command will try to publish sandbox template defined by ${Dt("vibengine.toml")}.`).addOption(gn).addOption(Ui).addOption(op).addOption(Js).alias("pb").option("-y, --yes","skip manual publish confirmation").action(Ase.bind(null,!0)),Nse=new $e("unpublish").description("unpublish sandbox template").argument("[template]",`specify ${Re("[template]")} to unpublish it. If you don't specify ${Re("[template]")} the command will try to unpublish sandbox template defined by ${Dt("vibengine.toml")}.`).addOption(gn).addOption(Ui).addOption(op).addOption(Js).alias("upb").option("-y, --yes","skip manual unpublish confirmation").action(Ase.bind(null,!1));var Ose=new $e("template").description("manage sandbox templates").alias("tpl").addCommand(gX).addCommand(_X,{hidden:!0}).addCommand(kX).addCommand(xse).addCommand(UX).addCommand(Rse).addCommand(Nse).addCommand(Cse);u();u();u();var _Ue=10;function vse(){return{cols:process.stdout.columns,rows:process.stdout.rows}}async function ob(t){process.stdin.setRawMode(!0),process.stdout.setEncoding("utf-8");let e=await t.pty.create({onData:s=>{process.stdout.write(s)},...vse(),timeoutMs:0}),r=new DI(async s=>{let a=Buffer.concat(s);await t.pty.sendInput(e.pid,a)},_Ue),n=process.stdout.on("resize",()=>t.pty.resize(e.pid,vse())),i=process.stdin.on("data",s=>{r.push(s)});r.start();try{await e.wait()}catch(s){if(s instanceof lc){if(s.exitCode===-1&&s.error==="signal: killed")return;if(s.exitCode===130){console.warn("Terminal session was killed by user");return}}throw s}finally{process.stdout.write(`
|
|
369
369
|
`),n.destroy(),i.destroy(),await r.stop(),process.stdin.setRawMode(!1)}}var DI=class{constructor(e,r){this.flushHandler=e;this.flushIntervalMs=r}queue=[];isFlushing=!1;intervalId;push(e){this.queue.push(e)}start(){this.intervalId=setInterval(async()=>{this.isFlushing||(this.isFlushing=!0,await this.flush(),this.isFlushing=!1)},this.flushIntervalMs)}async stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),await this.flush()}async flush(){if(this.queue.length===0)return;let e=this.queue.splice(0,this.queue.length);try{await this.flushHandler(e)}catch(r){console.error("Error sending input:",r)}}};var Ise=new $e("connect").description("connect terminal to already running sandbox").argument("<sandboxID>",`connect to sandbox with ${Re("<sandboxID>")}`).alias("cn").action(async t=>{try{let e=en();t||(console.error("You need to specify sandbox ID"),process.exit(1)),await gUe({apiKey:e,sandboxID:t}),process.exit(0)}catch(e){console.error(e),process.exit(1)}});async function gUe({apiKey:t,sandboxID:e}){let r=await Sr.connect(e,{apiKey:t});console.log(`Terminal connecting to sandbox ${Qe(`${r.sandboxId}`)}`),await ob(r),console.log(`Closing terminal connection to sandbox ${Qe(r.sandboxId)}`)}u();var Lse=J(wN());u();function Dm(t){return Object.values(t).map(e=>Re(e)).join(", ")}var $c=(r=>(r.JSON="json",r.PRETTY="pretty",r))($c||{}),EUe=24*60*60*1e3;function wse(t){let e=!0;async function r(){let n=new Date().getTime();for(;!(new Date().getTime()-n>=EUe||(e=await qu(t),!e));)await Wa(5e3)}return r(),()=>qu}async function qu(t){try{let e=en();return(await Sr.getInfo(t,{apiKey:e})).state==="running"}catch{return!1}}function cb(t){let e;if(t&&t.length>0){let r={};t.split(",").map(n=>{let[i,s]=n.split("=");i&&s&&(r[i.trim()]=s.trim())}),e=r}return e}function SUe(t){if(t?.length===1){if(t?.includes("running"))return"Running sandboxes";if(t?.includes("paused"))return"Paused sandboxes"}return"Sandboxes"}var Pse=new $e("list").description("list all sandboxes, by default it list only running ones").alias("ls").option("-s, --state <state>","filter by state, eg. running, paused. Defaults to running",t=>t.split(",")).option("-m, --metadata <metadata>","filter by metadata, eg. key1=value1").option("-l, --limit <limit>","limit the number of sandboxes returned",t=>parseInt(t)).option("-f, --format <format>","output format, eg. json, pretty").action(async t=>{try{let e=t.state||["running"],r=t.format||"pretty",n=await TUe({limit:t.limit,state:e,metadataRaw:t.metadata});r==="pretty"?bUe(n,e):r==="json"?console.log(JSON.stringify(n,null,2)):(console.error(`Unsupported output format: ${r}`),process.exit(1))}catch(e){console.error(e),process.exit(1)}});function bUe(t,e){if(!t?.length){console.log("No sandboxes found");return}new Lse.Table({title:SUe(e),columns:[{name:"sandboxId",alignment:"left",title:"Sandbox ID"},{name:"templateId",alignment:"left",title:"Template ID",maxLen:20},{name:"name",alignment:"left",title:"Alias"},{name:"startedAt",alignment:"left",title:"Started at"},{name:"endAt",alignment:"left",title:"End at"},{name:"state",alignment:"left",title:"State"},{name:"cpuCount",alignment:"left",title:"vCPUs"},{name:"memoryMB",alignment:"left",title:"RAM MiB"},{name:"envdVersion",alignment:"left",title:"Envd version"},{name:"metadata",alignment:"left",title:"Metadata"}],disabledColumns:["clientID"],rows:t.map(n=>({...n,startedAt:new Date(n.startedAt).toLocaleString(),endAt:new Date(n.endAt).toLocaleString(),state:n.state.charAt(0).toUpperCase()+n.state.slice(1),metadata:JSON.stringify(n.metadata)})).sort((n,i)=>n.startedAt.localeCompare(i.startedAt)||n.sandboxId.localeCompare(i.sandboxId)),style:{headerTop:{left:"",right:"",mid:"",other:""},headerBottom:{left:"",right:"",mid:"",other:""},tableBottom:{left:"",right:"",mid:"",other:""},vertical:""},colorMap:{orange:"\x1B[38;5;216m"}}).printTable(),process.stdout.write(`
|
|
370
|
-
`)}async function TUe({limit:t,state:e,metadataRaw:r}={}){let n=en(),i=cb(r),s=t;(!t||t>100)&&(s=100);let a=t,o=[],c=Sr.list({apiKey:n,limit:s,query:{state:e,metadata:i}});for(;c.hasNext&&(!a||a>0);){let l=await c.nextItems();o.push(...l),t&&a&&(a-=l.length)}return o}u();async function Mse(t,e){await Sr.kill(t,{apiKey:e})?console.log(`Sandbox ${Re(t)} has been killed`):console.error(`Sandbox ${Re(t)} wasn't found`)}var Fse=new $e("kill").description("kill sandbox").argument("[sandboxIDs...]",`kill the sandboxes specified by ${Re("[sandboxIDs...]")}`).alias("kl").option("-a, --all","kill all sandboxes").option("-s, --state <state>","when used with -a/--all flag, filter by state, eg. running, paused. Defaults to running",t=>t.split(",")).option("-m, --metadata <metadata>","when used with -a/--all flag, filter by metadata, eg. key1=value1").action(async(t,{all:e,state:r,metadata:n})=>{try{let i=en(),s=r||["running"],a=cb(n);if((!t||t.length===0)&&!e&&(console.error(`You need to specify ${Re("[sandboxIDs...]")} or use ${Re("-a/--all")} flag`),process.exit(1)),e&&t&&t.length>0&&(console.error(`You cannot use ${Re("-a/--all")} flag while specifying ${Re("[sandboxIDs...]")}`),process.exit(1)),e){let o=0,c=Sr.list({apiKey:i,query:{state:s,metadata:a}});for(;c.hasNext;){let l=await c.nextItems();o+=l.length,await Promise.all(l.map(d=>Mse(d.sandboxId,i)))}console.log(o===0?"No running sandboxes":`Killed ${o} running sandboxes`),process.exit(0)}else await Promise.all(t.map(o=>Mse(o,i)))}catch(i){console.error(i),process.exit(1)}});u();var kse=J(require("path"));var Bse=J(require("fs"));function AI(t,e,r){return new $e(t).description("create sandbox and connect terminal to it").argument("[template]",`create and connect to sandbox specified by ${Re("[template]")}`).addOption(gn).addOption(Ui).alias(e).action(async(n,i)=>{r&&console.warn(`Warning: The '${t}' command is deprecated and will be removed in future releases. Please use 've sandbox create' instead.`);try{let s=en(),a=n,o=Rn(i.path),c=fs(o,i.config),l=Bse.default.existsSync(c)?await ds(c):void 0,d=kse.relative(o,c);!a&&l&&(console.log(`Found sandbox template ${Jt({templateID:l.template_id,aliases:l.template_name?[l.template_name]:void 0},d)}`),a=l.template_id),a||(console.error("You need to specify sandbox template ID or path to sandbox template config"),process.exit(1)),await yUe({apiKey:s,template:{templateID:a}}),process.exit(0)}catch(s){console.error(s),process.exit(1)}})}async function yUe({apiKey:t,template:e}){let
|
|
370
|
+
`)}async function TUe({limit:t,state:e,metadataRaw:r}={}){let n=en(),i=cb(r),s=t;(!t||t>100)&&(s=100);let a=t,o=[],c=Sr.list({apiKey:n,limit:s,query:{state:e,metadata:i}});for(;c.hasNext&&(!a||a>0);){let l=await c.nextItems();o.push(...l),t&&a&&(a-=l.length)}return o}u();async function Mse(t,e){await Sr.kill(t,{apiKey:e})?console.log(`Sandbox ${Re(t)} has been killed`):console.error(`Sandbox ${Re(t)} wasn't found`)}var Fse=new $e("kill").description("kill sandbox").argument("[sandboxIDs...]",`kill the sandboxes specified by ${Re("[sandboxIDs...]")}`).alias("kl").option("-a, --all","kill all sandboxes").option("-s, --state <state>","when used with -a/--all flag, filter by state, eg. running, paused. Defaults to running",t=>t.split(",")).option("-m, --metadata <metadata>","when used with -a/--all flag, filter by metadata, eg. key1=value1").action(async(t,{all:e,state:r,metadata:n})=>{try{let i=en(),s=r||["running"],a=cb(n);if((!t||t.length===0)&&!e&&(console.error(`You need to specify ${Re("[sandboxIDs...]")} or use ${Re("-a/--all")} flag`),process.exit(1)),e&&t&&t.length>0&&(console.error(`You cannot use ${Re("-a/--all")} flag while specifying ${Re("[sandboxIDs...]")}`),process.exit(1)),e){let o=0,c=Sr.list({apiKey:i,query:{state:s,metadata:a}});for(;c.hasNext;){let l=await c.nextItems();o+=l.length,await Promise.all(l.map(d=>Mse(d.sandboxId,i)))}console.log(o===0?"No running sandboxes":`Killed ${o} running sandboxes`),process.exit(0)}else await Promise.all(t.map(o=>Mse(o,i)))}catch(i){console.error(i),process.exit(1)}});u();var kse=J(require("path"));var Bse=J(require("fs"));function AI(t,e,r){return new $e(t).description("create sandbox and connect terminal to it").argument("[template]",`create and connect to sandbox specified by ${Re("[template]")}`).addOption(gn).addOption(Ui).option("-t, --timeout <seconds>","sandbox timeout in seconds","300").alias(e).action(async(n,i)=>{r&&console.warn(`Warning: The '${t}' command is deprecated and will be removed in future releases. Please use 've sandbox create' instead.`);try{let s=en(),a=n,o=Rn(i.path),c=fs(o,i.config),l=Bse.default.existsSync(c)?await ds(c):void 0,d=kse.relative(o,c);!a&&l&&(console.log(`Found sandbox template ${Jt({templateID:l.template_id,aliases:l.template_name?[l.template_name]:void 0},d)}`),a=l.template_id),a||(console.error("You need to specify sandbox template ID or path to sandbox template config"),process.exit(1));let f=parseInt(i.timeout||"300",10);await yUe({apiKey:s,template:{templateID:a},timeoutMs:f*1e3}),process.exit(0)}catch(s){console.error(s),process.exit(1)}})}async function yUe({apiKey:t,template:e,timeoutMs:r=3e5}){let n=await Sr.create(e.templateID,{apiKey:t,timeoutMs:r}),i=setInterval(async()=>{await n.setTimeout(r)},5e3);console.log(`Terminal connecting to template ${Jt(e)} with sandbox ID ${Re(`${n.sandboxId}`)}`);try{await ob(n)}finally{clearInterval(i),await n.kill(),console.log(`Closing terminal connection to template ${Jt(e)} with sandbox ID ${Re(`${n.sandboxId}`)}`)}}u();var Use=J(require("util"));var RI=(i=>(i.DEBUG="DEBUG",i.INFO="INFO",i.WARN="WARN",i.ERROR="ERROR",i))(RI||{});function xUe(t,e){if(!e)return!0;switch(e){case"DEBUG":return!0;case"INFO":return t==="INFO"||t==="WARN"||t==="ERROR";case"WARN":return t==="WARN"||t==="ERROR";case"ERROR":return t==="ERROR"}}function CUe(t){return t?t.replaceAll("Svc",""):""}var Gse=new $e("logs").description("show logs for sandbox").argument("<sandboxID>",`show logs for sandbox specified by ${Re("<sandboxID>")}`).alias("lg").option("--level <level>",`filter logs by level (${Dm(RI)}). The logs with the higher levels will be also shown.`,"INFO").option("-f, --follow","keep streaming logs until the sandbox is closed").option("--format <format>",`specify format for printing logs (${Dm($c)})`,"pretty").option("--loggers [loggers]","filter logs by loggers. Specify multiple loggers by separating them with a comma.",t=>t.split(",")).action(async(t,e)=>{try{let r=e?.level.toUpperCase();if(r&&!Object.values(RI).includes(r))throw new Error(`Invalid log level: ${r}`);let n=e?.format.toLowerCase();if(n&&!Object.values($c).includes(n))throw new Error(`Invalid log format: ${n}`);let i=e?.follow?wse(t):()=>!1,s,a=!0,o=!1;n==="pretty"&&console.log(`
|
|
371
371
|
Logs for sandbox ${Re(t)}:`);do{let c=await AUe({sandboxID:t,start:s});c.length!==0&&o===!1&&(o=!0,process.stdout.write(`
|
|
372
372
|
`));for(let f of c)DUe(f.timestamp,f.line,r,n,e?.loggers??void 0);let l=await qu(t);if(!l&&c.length===0&&a){n==="pretty"&&console.log(`
|
|
373
373
|
Stopped printing logs \u2014 sandbox ${ql("not found")}`);break}if(!l){n==="pretty"&&console.log(`
|
|
@@ -386,7 +386,7 @@ Already logged in. ${Og(e)}.
|
|
|
386
386
|
|
|
387
387
|
If you want to log in as a different user, log out first by running 've auth logout'.
|
|
388
388
|
To change the team, run 've auth configure'.
|
|
389
|
-
`);return}console.log("Attempting to log in...");let r=null,n=t.token||process.env.VIBENGINE_ACCESS_TOKEN||process.env.E2B_ACCESS_TOKEN||"";if(!n){try{r=await Dqe()}catch(l){console.error(ss("Browser login failed. Use `ve auth login --token <token>` with a token from dashboard.vibengine.ai.",l)),process.exit(1)}if(!r){console.info("Login aborted");return}n=r.accessToken}let i=On.getSignal(),s=new er({accessToken:n}),o=await new Or(s).api.GET("/teams",{signal:i});tn(o,"Error getting teams");let c=o.data.find(l=>l.isDefault);c||(console.error(ss("No default team found, please contact support")),process.exit(1)),e={email:r?.email||"token-authenticated-user",accessToken:n,teamName:c.name,teamId:c.teamID,teamApiKey:c.apiKey},Ib.mkdirSync(Hce.dirname($r),{recursive:!0}),Ib.writeFileSync($r,JSON.stringify(e,null,2)),console.log(`Logged in as ${Re(e.email)} with selected team ${Re(e.teamName)}`),process.exit(0)});async function Dqe(){let t=Gce.createServer(),{port:e}=await Uce.default(t,0,"127.0.0.1"),r=new URL(`${VR}/
|
|
389
|
+
`);return}console.log("Attempting to log in...");let r=null,n=t.token||process.env.VIBENGINE_ACCESS_TOKEN||process.env.E2B_ACCESS_TOKEN||"";if(!n){try{r=await Dqe()}catch(l){console.error(ss("Browser login failed. Use `ve auth login --token <token>` with a token from dashboard.vibengine.ai.",l)),process.exit(1)}if(!r){console.info("Login aborted");return}n=r.accessToken}let i=On.getSignal(),s=new er({accessToken:n}),o=await new Or(s).api.GET("/teams",{signal:i});tn(o,"Error getting teams");let c=o.data.find(l=>l.isDefault);c||(console.error(ss("No default team found, please contact support")),process.exit(1)),e={email:r?.email||"token-authenticated-user",accessToken:n,teamName:c.name,teamId:c.teamID,teamApiKey:c.apiKey},Ib.mkdirSync(Hce.dirname($r),{recursive:!0}),Ib.writeFileSync($r,JSON.stringify(e,null,2)),console.log(`Logged in as ${Re(e.email)} with selected team ${Re(e.teamName)}`),process.exit(0)});async function Dqe(){let t=Gce.createServer(),{port:e}=await Uce.default(t,0,"127.0.0.1"),r=new URL(`${VR}/auth/cli`);return r.searchParams.set("next",`http://localhost:${e}`),r.searchParams.set("cliVersion",wb.version),new Promise((n,i)=>(t.once("request",(s,a)=>{a.setHeader("connection","close");let o=new URL(`${VR}/auth/cli`),c=new URL(s.url||"/","http://localhost").searchParams,l=Object.fromEntries(c.entries()),{error:d}=l;d?(i(new Error(d)),o.searchParams.set("state","error"),o.searchParams.set("error",d)):(n(l),o.searchParams.set("state","success"),o.searchParams.set("email",l.email)),a.statusCode=302,a.setHeader("location",o.href),a.end()}),Bce(r.toString())))}u();var Lb=J(require("fs"));var $ce=new $e("logout").description("log out of CLI").action(()=>{Lb.existsSync($r)?(Lb.unlinkSync($r),console.log("Logged out.")):console.log("Not logged in, nothing to do")});u();var Yce=new $e("info").description("get information about the current user").action(async()=>{let t;try{t=ui()}catch(e){console.error(ss("Failed to read user config",e))}if(!t){console.log("Not logged in");return}console.log(Og(t)),process.exit(0)});u();var Xu=J(require("fs"));var Vce=J(require("path"));var Wce=new $e("configure").description("configure user").action(async()=>{let t=await import("inquirer");if(console.log(`Configuring user...
|
|
390
390
|
`),!Xu.existsSync($r)){console.log("No user config found, run `ve auth login` to log in first.");return}let e=Kj();Ga();let r=On.getSignal(),n=await _n.api.GET("/teams",{signal:r});tn(n,"Error getting teams");let i=(await t.default.prompt([{name:"team",message:Ue.underline("Select team"),type:"list",pageSize:50,choices:n.data.map(s=>({name:RW(s,e.teamId),value:s}))}])).team;e.teamName=i.name,e.teamId=i.teamID,e.teamApiKey=i.apiKey,Xu.mkdirSync(Vce.dirname($r),{recursive:!0}),Xu.writeFileSync($r,JSON.stringify(e,null,2)),console.log(`Team ${Re(i.name)} (${i.teamID}) selected.
|
|
391
391
|
`)});var Kce=new $e("auth").description("authentication commands").addCommand(qce).addCommand($ce).addCommand(Yce).addCommand(Wce);var yw=new $e().description(`Create sandbox templates from Dockerfiles by running ${Qe("ve template build")} then use our SDKs to create sandboxes from these templates.
|
|
392
392
|
|