@e2b/cli 2.2.2 → 2.2.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 CHANGED
@@ -204,7 +204,7 @@ ${E2}
204
204
  Try running with %s or get access `,Ue.cyan("sudo"))+`
205
205
  to the local update config store via
206
206
  `+Ue.cyan((0,S_.format)(" sudo chown -R $USER:$(id -gn $USER) %s ",Bl));xi.default.on("exit",()=>{console.error(vi(r,{textAlignment:"center"}))})}}check(){!this.config||this.config.get("optOut")||this.#n||(this.update=this.config.get("update"),this.update&&(this.update.current=this.#t,this.config.delete("update")),!(Date.now()-this.config.get("lastUpdateCheck")<this.#r)&&(0,ck.spawn)(xi.default.execPath,[yC.default.join(ope,"check.js"),JSON.stringify(this.#e)],{detached:!0,stdio:"ignore"}).unref())}async fetchInfo(){let{distTag:e}=this.#e,r=await Xy(this._packageName,{version:e});return{latest:r,current:this.#t,type:P0(this.#t,r)||e,name:this._packageName}}notify(e){let r=!this._shouldNotifyInNpmScript&&J5;if(!xi.default.stdout.isTTY||r||!this.update||!dk.default.gt(this.update.latest,this.update.current))return this;e={isGlobal:pk.default,isYarnGlobal:_F(),...e};let n;e.isYarnGlobal?n=`yarn global add ${this._packageName}`:e.isGlobal?n=`npm i -g ${this._packageName}`:iC()?n=`yarn add ${this._packageName}`:n=`npm i ${this._packageName}`;let i="Update available "+Ue.dim("{currentVersion}")+Ue.reset(" \u2192 ")+Ue.green("{latestVersion}")+`
207
- 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 o=vi(bC(s,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:n}),e.boxenOptions);return e.defer===!1?console.error(o):(xi.default.on("exit",()=>{console.error(o)}),xi.default.on("SIGINT",()=>{console.error(""),xi.default.exit()})),this}};function CC(t){let e=new np(t);return e.check(),e}u();var Nk=W(Ok(),1),{program:i7e,createCommand:s7e,createArgument:o7e,createOption:a7e,CommanderError:l7e,InvalidArgumentError:c7e,InvalidOptionArgumentError:u7e,Command:$e,Argument:d7e,Option:ao,Help:p7e}=Nk.default;var kC={};Fl(kC,{author:()=>Ipe,bin:()=>Bpe,bugs:()=>vpe,default:()=>Hpe,dependencies:()=>Upe,description:()=>Ape,devDependencies:()=>Fpe,engines:()=>Gpe,files:()=>kpe,homepage:()=>Ope,keywords:()=>Lpe,license:()=>Npe,name:()=>Rpe,publishConfig:()=>wpe,repository:()=>xpe,scripts:()=>Ppe,sideEffects:()=>Mpe,version:()=>BC});var Rpe="@e2b/cli",BC="2.2.2",Ape="CLI for managing e2b sandbox templates",Ope="https://e2b.dev",Npe="MIT",Ipe={name:"FoundryLabs, Inc.",email:"hello@e2b.dev",url:"https://e2b.dev"},vpe="https://github.com/e2b-dev/e2b/issues",xpe={type:"git",url:"https://github.com/e2b-dev/e2b",directory:"packages/cli"},wpe={access:"public"},Lpe=["e2b","ai-agents","agents","ai","code-interpreter","sandbox","code","cli","runtime","vm","nodejs","javascript","typescript"],Mpe=!1,Ppe={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"},Fpe={"@types/command-exists":"^1.2.3","@types/handlebars":"^4.1.0","@types/inquirer":"^9.0.7","@types/json2md":"^1.5.4","@types/node":"^18.18.6","@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"},kpe=["dist","LICENSE","README","package.json"],Bpe={e2b:"dist/index.js"},Upe={"@iarna/toml":"^2.2.5","@inquirer/prompts":"^5.5.0","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",e2b:"^2.0.3",handlebars:"^4.7.8",inquirer:"^9.2.12",open:"^9.1.0",statuses:"^2.0.1","strip-ansi":"^7.1.0","update-notifier":"^6.0.2",yup:"^1.3.2"},Gpe={node:">=18"},Hpe={name:Rpe,version:BC,description:Ape,homepage:Ope,license:Npe,author:Ipe,bugs:vpe,repository:xpe,publishConfig:wpe,keywords:Lpe,sideEffects:Mpe,scripts:Ppe,devDependencies:Fpe,files:kpe,bin:Bpe,dependencies:Upe,engines:Gpe};u();u();var fR=W(kY());u();var vc=W(require("path"));function Mn(t){let e=process.cwd();return t?vc.isAbsolute(t)?t:vc.resolve(e,t):e}function BY(t){return vc.relative(process.cwd(),t)}var Kbe="#FFB766";function Ng(t){let e=Ae(t.email),r=t.teamName?Ae(t.teamName):zbe("Log out and log in to get team name"),n=Ae(t.teamId);return`You are logged in as ${e},
207
+ 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 o=vi(bC(s,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:n}),e.boxenOptions);return e.defer===!1?console.error(o):(xi.default.on("exit",()=>{console.error(o)}),xi.default.on("SIGINT",()=>{console.error(""),xi.default.exit()})),this}};function CC(t){let e=new np(t);return e.check(),e}u();var Nk=W(Ok(),1),{program:i7e,createCommand:s7e,createArgument:o7e,createOption:a7e,CommanderError:l7e,InvalidArgumentError:c7e,InvalidOptionArgumentError:u7e,Command:$e,Argument:d7e,Option:ao,Help:p7e}=Nk.default;var kC={};Fl(kC,{author:()=>Ipe,bin:()=>Bpe,bugs:()=>vpe,default:()=>Hpe,dependencies:()=>Upe,description:()=>Ape,devDependencies:()=>Fpe,engines:()=>Gpe,files:()=>kpe,homepage:()=>Ope,keywords:()=>Lpe,license:()=>Npe,name:()=>Rpe,publishConfig:()=>wpe,repository:()=>xpe,scripts:()=>Ppe,sideEffects:()=>Mpe,version:()=>BC});var Rpe="@e2b/cli",BC="2.2.3",Ape="CLI for managing e2b sandbox templates",Ope="https://e2b.dev",Npe="MIT",Ipe={name:"FoundryLabs, Inc.",email:"hello@e2b.dev",url:"https://e2b.dev"},vpe="https://github.com/e2b-dev/e2b/issues",xpe={type:"git",url:"https://github.com/e2b-dev/e2b",directory:"packages/cli"},wpe={access:"public"},Lpe=["e2b","ai-agents","agents","ai","code-interpreter","sandbox","code","cli","runtime","vm","nodejs","javascript","typescript"],Mpe=!1,Ppe={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"},Fpe={"@types/command-exists":"^1.2.3","@types/handlebars":"^4.1.0","@types/inquirer":"^9.0.7","@types/json2md":"^1.5.4","@types/node":"^18.18.6","@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"},kpe=["dist","LICENSE","README","package.json"],Bpe={e2b:"dist/index.js"},Upe={"@iarna/toml":"^2.2.5","@inquirer/prompts":"^5.5.0","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",e2b:"^2.0.3",handlebars:"^4.7.8",inquirer:"^9.2.12",open:"^9.1.0",statuses:"^2.0.1","strip-ansi":"^7.1.0","update-notifier":"^6.0.2",yup:"^1.3.2"},Gpe={node:">=18"},Hpe={name:Rpe,version:BC,description:Ape,homepage:Ope,license:Npe,author:Ipe,bugs:vpe,repository:xpe,publishConfig:wpe,keywords:Lpe,sideEffects:Mpe,scripts:Ppe,devDependencies:Fpe,files:kpe,bin:Bpe,dependencies:Upe,engines:Gpe};u();u();var fR=W(kY());u();var vc=W(require("path"));function Mn(t){let e=process.cwd();return t?vc.isAbsolute(t)?t:vc.resolve(e,t):e}function BY(t){return vc.relative(process.cwd(),t)}var Kbe="#FFB766";function Ng(t){let e=Ae(t.email),r=t.teamName?Ae(t.teamName):zbe("Log out and log in to get team name"),n=Ae(t.teamId);return`You are logged in as ${e},
208
208
  Selected team: ${r} (${n})`}function HY(t,e){let r=Ae(t.name),n=Ae(t.teamID),i=t.teamID==e?Ct(" (currently selected team)"):"";return`${r} (${n})${i}`}function Qt(t,e){let r=hR(t.aliases),n=r?Ae(r):"",i=e?Qbe(" <-> ")+_t(e):"";return`${`${t.templateID} `}${n}${i}`.trim()}function zbe(t){return Ue.redBright(t)}function bs(t,e){return Ue.redBright(`${t?`${t}
209
209
  `:""}${e?e.stack:""}
210
210
  `)}function Qbe(t){return Ue.dim(t)}function Ae(t){return Ue.bold(t)}function Ct(t){return Ue.hex(Kbe)(t)}function Ig(t){return Ue.blue(t)}function Yt(t){return Ue.blue(t)}function _t(t){return t?Yt("./"+BY(t)):""}function qY(t){return Ue.blueBright(t)}function xc(t){return Ue.underline(t)}function hR(t){if(t)return t.join(", ")}function YY(t){return fR.default(t,{language:"typescript",ignoreIllegals:!0})}function VY(t){return fR.default(t,{language:"python",ignoreIllegals:!0})}var jbe={topLeft:"",topRight:"",bottomLeft:"",bottomRight:"",top:"",bottom:"",left:"",right:""},UY=2,GY=1;function _R(t,e,r){return vi(t,{borderStyle:{...jbe,top:"\u2500",bottom:r?"\u2500":""},titleAlignment:"center",float:"left",title:e?Ae(e):void 0,margin:{top:0,bottom:0,left:1,right:0},fullscreen:n=>[n,0],padding:{bottom:r?GY:0,left:UY,right:UY,top:GY}})}u();u();var uf=W(require("fs")),Vs=W(require("path"));var Fj=W(ZY());u();async function So(t){return new Promise(e=>setTimeout(e,t))}u();u();u();u();var s0e={"Content-Type":"application/json"},o0e=/\{[^{}]+\}/g,TR=class extends Request{constructor(e,r){super(e,r);for(let n in r)n in this||(this[n]=r[n])}};function Np(t){let{baseUrl:e="",fetch:r=globalThis.fetch,querySerializer:n,bodySerializer:i,headers:s,...o}={...t};e.endsWith("/")&&(e=e.substring(0,e.length-1)),s=eV(s0e,s);let a=[];async function l(c,d){let{fetch:p=r,headers:f,params:m={},parseAs:h="json",querySerializer:_,bodySerializer:y=i??l0e,...T}=d||{},O=typeof n=="function"?n:JY(n);_&&(O=typeof _=="function"?_:JY({...typeof n=="object"?n:{},..._}));let R={redirect:"follow",...o,...T,headers:eV(s,f,m.header)};R.body&&(R.body=y(R.body)),R.body instanceof FormData&&R.headers.delete("Content-Type");let I=new TR(c0e(c,{baseUrl:e,params:m,querySerializer:O}),R),Y={baseUrl:e,fetch:p,parseAs:h,querySerializer:O,bodySerializer:y};for(let k of a)if(k&&typeof k=="object"&&typeof k.onRequest=="function"){I.schemaPath=c,I.params=m;let N=await k.onRequest(I,Y);if(N){if(!(N instanceof Request))throw new Error("Middleware must return new Request() when modifying the request");I=N}}let Z=await p(I);for(let k=a.length-1;k>=0;k--){let N=a[k];if(N&&typeof N=="object"&&typeof N.onResponse=="function"){I.schemaPath=c,I.params=m;let V=await N.onResponse(Z,Y,I);if(V){if(!(V instanceof Response))throw new Error("Middleware must return new Response() when modifying the response");Z=V}}}if(Z.status===204||Z.headers.get("Content-Length")==="0")return Z.ok?{data:{},response:Z}:{error:{},response:Z};if(Z.ok)return h==="stream"?{data:Z.body,response:Z}:{data:await Z[h](),response:Z};let J=await Z.text();try{J=JSON.parse(J)}catch{}return{error:J,response:Z}}return{async GET(c,d){return l(c,{...d,method:"GET"})},async PUT(c,d){return l(c,{...d,method:"PUT"})},async POST(c,d){return l(c,{...d,method:"POST"})},async DELETE(c,d){return l(c,{...d,method:"DELETE"})},async OPTIONS(c,d){return l(c,{...d,method:"OPTIONS"})},async HEAD(c,d){return l(c,{...d,method:"HEAD"})},async PATCH(c,d){return l(c,{...d,method:"PATCH"})},async TRACE(c,d){return l(c,{...d,method:"TRACE"})},use(...c){for(let d of c)if(d){if(typeof d!="object"||!("onRequest"in d||"onResponse"in d))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");a.push(d)}},eject(...c){for(let d of c){let p=a.indexOf(d);p!==-1&&a.splice(p,1)}}}}function xg(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 tV(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 a in e)n.push(a,r.allowReserved===!0?e[a]:encodeURIComponent(e[a]));let o=n.join(",");switch(r.style){case"form":return`${t}=${o}`;case"label":return`.${o}`;case"matrix":return`;${t}=${o}`;default:return o}}for(let o in e){let a=r.style==="deepObject"?`${t}[${o}]`:o;n.push(xg(a,e[o],r))}let s=n.join(i);return r.style==="label"||r.style==="matrix"?`${i}${s}`:s}function rV(t,e,r){if(!Array.isArray(e))return"";if(r.explode===!1){let s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",o=(r.allowReserved===!0?e:e.map(a=>encodeURIComponent(a))).join(s);switch(r.style){case"simple":return o;case"label":return`.${o}`;case"matrix":return`;${t}=${o}`;default:return`${t}=${o}`}}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(xg(t,s,r));return r.style==="label"||r.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function JY(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)){n.push(rV(i,s,{style:"form",explode:!0,...t?.array,allowReserved:t?.allowReserved||!1}));continue}if(typeof s=="object"){n.push(tV(i,s,{style:"deepObject",explode:!0,...t?.object,allowReserved:t?.allowReserved||!1}));continue}n.push(xg(i,s,t))}}return n.join("&")}}function a0e(t,e){let r=t;for(let n of t.match(o0e)??[]){let i=n.substring(1,n.length-1),s=!1,o="simple";if(i.endsWith("*")&&(s=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(o="label",i=i.substring(1)):i.startsWith(";")&&(o="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;let a=e[i];if(Array.isArray(a)){r=r.replace(n,rV(i,a,{style:o,explode:s}));continue}if(typeof a=="object"){r=r.replace(n,tV(i,a,{style:o,explode:s}));continue}if(o==="matrix"){r=r.replace(n,`;${xg(i,a)}`);continue}r=r.replace(n,o==="label"?`.${a}`:a)}return r}function l0e(t){return JSON.stringify(t)}function c0e(t,e){let r=`${e.baseUrl}${t}`;e.params?.path&&(r=a0e(r,e.params.path));let n=e.querySerializer(e.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(r+=`?${n}`),r}function eV(...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 o of s)e.append(i,o);else s!==void 0&&e.set(i,s)}return e}u();var SO=W(bR());var Lg="2.1.5";u();var gO=W(bR());function ZCe(){return globalThis.Bun?{runtime:"bun",version:globalThis.Bun.version}:globalThis.Deno?{runtime:"deno",version:globalThis.Deno.version.deno}:globalThis.process?.release?.name==="node"?{runtime:"node",version:gO.default.version||"unknown"}:typeof EdgeRuntime=="string"?{runtime:"vercel-edge",version:"unknown"}:globalThis.navigator?.userAgent==="Cloudflare-Workers"?{runtime:"cloudflare-worker",version:"unknown"}:typeof window<"u"?{runtime:"browser",version:gO.default.version||"unknown"}:{runtime:"unknown",version:"unknown"}}var{runtime:mi,version:TW}=ZCe();async function bW(t){if(typeof crypto<"u"){let i=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",i),o=new Uint8Array(s);return btoa(String.fromCharCode(...o))}let{createHash:e}=require("crypto");return e("sha256").update(t,"utf8").digest().toString("base64")}function XE(t){return Math.ceil(t/1e3)}async function EO(){if(mi==="browser")throw new Error("Browser runtime is not supported for glob");return await Promise.resolve().then(()=>(o$(),s$))}async function yW(){if(mi==="browser")throw new Error("Browser runtime is not supported for tar");return await Promise.resolve().then(()=>(SW(),EW))}function JCe({onlyFirst:t=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,t?void 0:"g")}function ZE(t){return t.replace(JCe(),"")}var CW={browser:typeof window<"u"&&SO.default.name||"unknown",lang:"js",lang_version:TW,package_version:Lg,publisher:"e2b",sdk_runtime:mi,system:SO.default.os?.family||"unknown"};function Rm(t){return mi==="deno"?Deno.env.get(t):typeof process>"u"?"":process.env[t]}u();function e1(t){return new au(`${t}: This error is likely due to sandbox timeout. You can modify the sandbox timeout by passing 'timeoutMs' when starting the sandbox or calling '.setTimeout' on the sandbox with the desired timeout.`)}var Wt=class extends Error{constructor(e,r){super(e),this.name="SandboxError",r&&(this.stack=r)}},au=class extends Wt{constructor(e,r){super(e,r),this.name="TimeoutError"}},Go=class extends Wt{constructor(e,r){super(e,r),this.name="InvalidArgumentError"}},JE=class extends Wt{constructor(e,r){super(e,r),this.name="NotEnoughSpaceError"}},fi=class extends Wt{constructor(e,r){super(e,r),this.name="NotFoundError"}},hi=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},lu=class extends Wt{constructor(e,r){super(e,r),this.name="TemplateError"}},Am=class extends Wt{constructor(e){super(e),this.name="RateLimitError"}};u();function DW(t){return JSON.parse(JSON.stringify(t))}function RW(t){async function*e(r){for await(let n of r)t.debug?.("Response stream:",DW(n)),yield n}return r=>async n=>{t.info?.(`Request: POST ${n.url}`);let i=await r(n);return i.stream?{...i,message:e(i.message)}:(t.info?.("Response:",DW(i.message)),i)}}function t1(t){return{async onRequest(e){return t.info?.(`Request ${e.method} ${e.url}`),e},async onResponse(e){return e.status>=400?t.error?.("Response:",e.status,e.statusText):t.info?.("Response:",e.status,e.statusText),e}}}function on(t,e=Wt,r){if(!t.error)return;if(t.response.status===401){let i="Unauthorized, please check your credentials.",s=t.error?.message??t.error;return s?new hi(`${i} - ${s}`):new hi(i)}if(t.response.status===429){let i="Rate limit exceeded, please try again later",s=t.error?.message??t.error;return s?new Am(`${i} - ${s}`):new Am(i)}let n=t.error?.message??t.error;return new e(`${t.response.status}: ${n}`,r)}var Er=class{api;constructor(e,r={requireAccessToken:!1,requireApiKey:!1}){if(r?.requireApiKey&&!e.apiKey)throw new hi("API key is required, please visit the Team tab at https://e2b.dev/dashboard to get your API key. You can either set the environment variable `E2B_API_KEY` or you can pass it directly to the sandbox like Sandbox.create({ apiKey: 'e2b_...' })");if(r?.requireAccessToken&&!e.accessToken)throw new hi("Access token is required, please visit the Personal tab at https://e2b.dev/dashboard to get your access token. You can set the environment variable `E2B_ACCESS_TOKEN` or pass the `accessToken` in options.");this.api=Np({baseUrl:e.apiUrl,headers:{...CW,...e.apiKey&&{"X-API-KEY":e.apiKey},...e.accessToken&&{Authorization:`Bearer ${e.accessToken}`},...e.headers},querySerializer:{array:{style:"form",explode:!1}}}),e.logger&&this.api.use(t1(e.logger))}};u();var eDe=6e4,cu=3e5,il=50,sl="Keepalive-Ping-Interval",kt=class t{debug;domain;apiUrl;logger;requestTimeoutMs;apiKey;accessToken;headers;constructor(e){this.apiKey=e?.apiKey||t.apiKey,this.debug=e?.debug||t.debug,this.domain=e?.domain||t.domain,this.accessToken=e?.accessToken||t.accessToken,this.requestTimeoutMs=e?.requestTimeoutMs??eDe,this.logger=e?.logger,this.headers=e?.headers||{},this.headers["User-Agent"]=`e2b-js-sdk/${Lg}`,this.apiUrl=this.debug?"http://localhost:3000":`https://api.${this.domain}`}static get domain(){return Rm("E2B_DOMAIN")||"e2b.app"}static get debug(){return(Rm("E2B_DEBUG")||"false").toLowerCase()==="true"}static get apiKey(){return Rm("E2B_API_KEY")}static get accessToken(){return Rm("E2B_ACCESS_TOKEN")}getSignal(e){let r=e??this.requestTimeoutMs;return r?AbortSignal.timeout(r):void 0}},Ls="user";u();async function TO({path:t,operation:e,user:r,expirationInSeconds:n,envdAccessToken:i}){if(!i)throw new Error("Access token is not set and signature cannot be generated!");let s=n?Math.floor(Date.now()/1e3)+n:null,o;return s===null?o=`${t}:${e}:${r}:${i}`:o=`${t}:${e}:${r}:${i}:${s.toString()}`,{signature:"v1_"+(await bW(o)).replace(/=+$/,""),expiration:s}}u();u();u();u();var Le;(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"})(Le||(Le={}));u();u();function Om(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 $;(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"})($||($={}));u();u();u();function OW(){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 n1(t,e,r){for(let s=0;s<28;s=s+7){let o=t>>>s,a=!(!(o>>>7)&&e==0),l=(a?o|128:o)&255;if(r.push(l),!a)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 o=e>>>s,a=!!(o>>>7),l=(a?o|128:o)&255;if(r.push(l),!a)return}r.push(e>>>31&1)}}var r1=4294967296;function bO(t){let e=t[0]==="-";e&&(t=t.slice(1));let r=1e6,n=0,i=0;function s(o,a){let l=Number(t.slice(o,a));i*=r,n=n*r+l,n>=r1&&(i=i+(n/r1|0),n=n%r1)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?IW(n,i):CO(n,i)}function NW(t,e){let r=CO(t,e),n=r.hi&2147483648;n&&(r=IW(r.lo,r.hi));let i=yO(r.lo,r.hi);return n?"-"+i:i}function yO(t,e){if({lo:t,hi:e}=tDe(t,e),e<=2097151)return String(r1*e+t);let r=t&16777215,n=(t>>>24|e<<8)&16777215,i=e>>16&65535,s=r+n*6777216+i*6710656,o=n+i*8147497,a=i*2,l=1e7;return s>=l&&(o+=Math.floor(s/l),s%=l),o>=l&&(a+=Math.floor(o/l),o%=l),a.toString()+AW(o)+AW(s)}function tDe(t,e){return{lo:t>>>0,hi:e>>>0}}function CO(t,e){return{lo:t|0,hi:e|0}}function IW(t,e){return e=~e,t?t=~t+1:e+=1,CO(t,e)}var AW=t=>{let e=String(t);return"0000000".slice(e.length)+e};function DO(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 vW(){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 at=rDe();function rDe(){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(o){let a=typeof o=="bigint"?o:BigInt(o);if(a>n||a<r)throw new Error(`invalid int64: ${o}`);return a},uParse(o){let a=typeof o=="bigint"?o:BigInt(o);if(a>s||a<i)throw new Error(`invalid uint64: ${o}`);return a},enc(o){return t.setBigInt64(0,this.parse(o),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(o){return t.setBigInt64(0,this.uParse(o),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(o,a){return t.setInt32(0,o,!0),t.setInt32(4,a,!0),t.getBigInt64(0,!0)},uDec(o,a){return t.setInt32(0,o,!0),t.setInt32(4,a,!0),t.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),xW(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),wW(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),xW(r),bO(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),wW(r),bO(r)},dec(r,n){return NW(r,n)},uDec(r,n){return yO(r,n)}}}function xW(t){if(!/^-?[0-9]+$/.test(t))throw new Error("invalid int64: "+t)}function wW(t){if(!/^[0-9]+$/.test(t))throw new Error("invalid uint64: "+t)}function hn(t,e){switch(t){case $.STRING:return"";case $.BOOL:return!1;case $.DOUBLE:case $.FLOAT:return 0;case $.INT64:case $.UINT64:case $.SFIXED64:case $.FIXED64:case $.SINT64:return e?"0":at.zero;case $.BYTES:return new Uint8Array(0);default:return 0}}function LW(t,e){switch(t){case $.BOOL:return e===!1;case $.STRING:return e==="";case $.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}u();u();var MW=2,_i=Symbol.for("reflect unsafe local");function i1(t,e){let r=t[e.localName].case;return r===void 0?r:e.fields.find(n=>n.localName===r)}function PW(t,e){let r=e.localName;if(e.oneof)return t[e.oneof.localName].case===r;if(e.presence!=MW)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!LW(e.scalar,t[r]);case"enum":return t[r]!==e.enum.values[0].number}throw new Error("message field with implicit presence")}function ol(t,e){return Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==void 0}function s1(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 o1(t,e,r){e.oneof?t[e.oneof.localName]={case:e.localName,value:r}:t[e.localName]=r}function FW(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!=MW)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]=hn(e.scalar,e.longAsString);break}}function Ki(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Nm(t,e){var r,n,i,s;if(Ki(t)&&_i in t&&"add"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let o=e,a=t.field();return o.listKind==a.listKind&&o.scalar===a.scalar&&((r=o.message)===null||r===void 0?void 0:r.typeName)===((n=a.message)===null||n===void 0?void 0:n.typeName)&&((i=o.enum)===null||i===void 0?void 0:i.typeName)===((s=a.enum)===null||s===void 0?void 0:s.typeName)}return!0}return!1}function Im(t,e){var r,n,i,s;if(Ki(t)&&_i in t&&"has"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let o=e,a=t.field();return o.mapKey===a.mapKey&&o.mapKind==a.mapKind&&o.scalar===a.scalar&&((r=o.message)===null||r===void 0?void 0:r.typeName)===((n=a.message)===null||n===void 0?void 0:n.typeName)&&((i=o.enum)===null||i===void 0?void 0:i.typeName)===((s=a.enum)===null||s===void 0?void 0:s.typeName)}return!0}return!1}function vm(t,e){return Ki(t)&&_i in t&&"desc"in t&&Ki(t.desc)&&t.desc.kind==="message"&&(e===void 0||t.desc.typeName==e.typeName)}u();function kW(t){return BW(t.$typeName)}function zi(t){let e=t.fields[0];return BW(t.typeName)&&e!==void 0&&e.fieldKind=="scalar"&&e.name=="value"&&e.number==1}function BW(t){return t.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(t.substring(16))}var nDe=999,iDe=998,a1=2;function Ar(t,e){if(Om(e,t))return e;let r=cDe(t);return e!==void 0&&sDe(t,r,e),r}function sDe(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 o=i1(r,n);if(!o)continue;s=o,i=s1(r,o)}else s=n;switch(s.fieldKind){case"message":i=AO(s,i);break;case"scalar":i=HW(s,i);break;case"list":i=aDe(s,i);break;case"map":i=oDe(s,i);break}o1(e,s,i)}return e}function HW(t,e){return t.scalar==$.BYTES?OO(e):e}function oDe(t,e){if(Ki(e)){if(t.scalar==$.BYTES)return UW(e,OO);if(t.mapKind=="message")return UW(e,r=>AO(t,r))}return e}function aDe(t,e){if(Array.isArray(e)){if(t.scalar==$.BYTES)return e.map(OO);if(t.listKind=="message")return e.map(r=>AO(t,r))}return e}function AO(t,e){if(t.fieldKind=="message"&&!t.oneof&&zi(t.message))return HW(t.message.fields[0],e);if(Ki(e)){if(t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!=="google.protobuf.Value")return e;if(!Om(e,t.message))return Ar(t.message,e)}return e}function OO(t){return Array.isArray(t)?new Uint8Array(t):t}function UW(t,e){let r={};for(let n of Object.entries(t))r[n[0]]=e(n[1]);return r}var lDe=Symbol(),GW=new WeakMap;function cDe(t){let e;if(uDe(t)){let r=GW.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!=a1&&(i.add(s),n[s.localName]=RO(s)));GW.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!=a1)||(e[s.localName]=RO(s))}else{e={$typeName:t.typeName};for(let r of t.members)(r.kind=="oneof"||r.presence==a1)&&(e[r.localName]=RO(r))}return e}function uDe(t){switch(t.file.edition){case nDe:return!1;case iDe:return!0;default:return t.fields.some(e=>e.presence!=a1&&e.fieldKind!="message"&&!e.oneof)}}function RO(t){if(t.kind=="oneof")return{case:void 0};if(t.fieldKind=="list")return[];if(t.fieldKind=="map")return{};if(t.fieldKind=="message")return lDe;let e=t.getDefaultValue();return e!==void 0?t.fieldKind=="scalar"&&t.longAsString?e.toString():e:t.fieldKind=="scalar"?hn(t.scalar,t.longAsString):t.enum.values[0].number}u();u();u();var dDe=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"],or=class extends Error{constructor(e,r,n="FieldValueInvalidError"){super(r),this.name=n,this.field=()=>e}};function qW(t){return t instanceof Error&&dDe.includes(t.name)&&"field"in t&&typeof t.field=="function"}u();u();var NO=Symbol.for("@bufbuild/protobuf/text-encoding");function xm(){if(globalThis[NO]==null){let t=new globalThis.TextEncoder,e=new globalThis.TextDecoder;globalThis[NO]={encodeUtf8(r){return t.encode(r)},decodeUtf8(r){return e.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return globalThis[NO]}var Bt;(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"})(Bt||(Bt={}));var vO=34028234663852886e22,xO=-34028234663852886e22,wO=4294967295,LO=2147483647,MO=-2147483648,Ho=class{constructor(e=xm().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(YW(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return IO(e),DO(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){pDe(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){YW(e);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!0),this.raw(r)}sfixed32(e){IO(e);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,e,!0),this.raw(r)}sint32(e){return IO(e),e=(e<<1^e>>31)>>>0,DO(e,this.buf),this}sfixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),i=at.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=at.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(r)}int64(e){let r=at.enc(e);return n1(r.lo,r.hi,this.buf),this}sint64(e){let r=at.enc(e),n=r.hi>>31,i=r.lo<<1^n,s=(r.hi<<1|r.lo>>>31)^n;return n1(i,s,this.buf),this}uint64(e){let r=at.uEnc(e);return n1(r.lo,r.hi,this.buf),this}},al=class{constructor(e,r=xm().decodeUtf8){this.decodeUtf8=r,this.varint64=OW,this.uint32=vW,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 Bt.Varint:for(;this.buf[this.pos++]&128;);break;case Bt.Bit64:this.pos+=4;case Bt.Bit32:this.pos+=4;break;case Bt.LengthDelimited:let i=this.uint32();this.pos+=i;break;case Bt.StartGroup:for(;;){let[s,o]=this.tag();if(o===Bt.EndGroup){if(r!==void 0&&s!==r)throw new Error("invalid end group tag");break}this.skip(o,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 at.dec(...this.varint64())}uint64(){return at.uDec(...this.varint64())}sint64(){let[e,r]=this.varint64(),n=-(e&1);return e=(e>>>1|(r&1)<<31)^n,r=r>>>1^n,at.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 at.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return at.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 IO(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>LO||t<MO)throw new Error("invalid int32: "+t)}function YW(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>wO||t<0)throw new Error("invalid uint32: "+t)}function pDe(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>vO||t<xO))throw new Error("invalid float32: "+t)}function Ms(t,e){let r=t.fieldKind=="list"?Nm(e,t):t.fieldKind=="map"?Im(e,t):FO(t,e);if(r===!0)return;let n;switch(t.fieldKind){case"list":n=`expected ${KW(t)}, got ${jt(e)}`;break;case"map":n=`expected ${zW(t)}, got ${jt(e)}`;break;default:n=l1(t,e,r)}return new or(t,n)}function PO(t,e,r){let n=FO(t,r);if(n!==!0)return new or(t,`list item #${e+1}: ${l1(t,r,n)}`)}function VW(t,e,r){let n=$W(e,t.mapKey);if(n!==!0)return new or(t,`invalid map key: ${l1({scalar:t.mapKey},e,n)}`);let i=FO(t,r);if(i!==!0)return new or(t,`map entry ${jt(e)}: ${l1(t,r,i)}`)}function FO(t,e){return t.scalar!==void 0?$W(e,t.scalar):t.enum!==void 0?t.enum.open?Number.isInteger(e):t.enum.values.some(r=>r.number===e):vm(e,t.message)}function $W(t,e){switch(e){case $.DOUBLE:return typeof t=="number";case $.FLOAT:return typeof t!="number"?!1:Number.isNaN(t)||!Number.isFinite(t)?!0:t>vO||t<xO?`${t.toFixed()} out of range`:!0;case $.INT32:case $.SFIXED32:case $.SINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>LO||t<MO?`${t.toFixed()} out of range`:!0;case $.FIXED32:case $.UINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>wO||t<0?`${t.toFixed()} out of range`:!0;case $.BOOL:return typeof t=="boolean";case $.STRING:return typeof t!="string"?!1:xm().checkUtf8(t)||"invalid UTF8";case $.BYTES:return t instanceof Uint8Array;case $.INT64:case $.SFIXED64:case $.SINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return at.parse(t),!0}catch{return`${t} out of range`}return!1;case $.FIXED64:case $.UINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return at.uParse(t),!0}catch{return`${t} out of range`}return!1}}function l1(t,e,r){return r=typeof r=="string"?`: ${r}`:`, got ${jt(e)}`,t.scalar!==void 0?`expected ${mDe(t.scalar)}`+r:t.enum!==void 0?`expected ${t.enum.toString()}`+r:`expected ${WW(t.message)}`+r}function jt(t){switch(typeof t){case"object":return t===null?"null":t instanceof Uint8Array?`Uint8Array(${t.length})`:Array.isArray(t)?`Array(${t.length})`:Nm(t)?KW(t.field()):Im(t)?zW(t.field()):vm(t)?WW(t.desc):Om(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 WW(t){return`ReflectMessage (${t.typeName})`}function KW(t){switch(t.listKind){case"message":return`ReflectList (${t.message.toString()})`;case"enum":return`ReflectList (${t.enum.toString()})`;case"scalar":return`ReflectList (${$[t.scalar]})`}}function zW(t){switch(t.mapKind){case"message":return`ReflectMap (${$[t.mapKey]}, ${t.message.toString()})`;case"enum":return`ReflectMap (${$[t.mapKey]}, ${t.enum.toString()})`;case"scalar":return`ReflectMap (${$[t.mapKey]}, ${$[t.scalar]})`}}function mDe(t){switch(t){case $.STRING:return"string";case $.BOOL:return"boolean";case $.INT64:case $.SINT64:case $.SFIXED64:return"bigint (int64)";case $.UINT64:case $.FIXED64:return"bigint (uint64)";case $.BYTES:return"Uint8Array";case $.DOUBLE:return"number (float64)";case $.FLOAT:return"number (float32)";case $.FIXED32:case $.UINT32:return"number (uint32)";case $.INT32:case $.SFIXED32:case $.SINT32:return"number (int32)"}}function Or(t,e,r=!0){return new u1(t,e,r)}var u1=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[_i]=r??Ar(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 wm(this.message,e),i1(this.message,e)}isSet(e){return wm(this.message,e),PW(this.message,e)}clear(e){wm(this.message,e),FW(this.message,e)}get(e){wm(this.message,e);let r=s1(this.message,e);switch(e.fieldKind){case"list":let n=this.lists.get(e);return(!n||n[_i]!==r)&&this.lists.set(e,n=new UO(e,r,this.check)),n;case"map":let i=this.maps.get(e);return(!i||i[_i]!==r)&&this.maps.set(e,i=new GO(e,r,this.check)),i;case"message":return qO(e,r,this.check);case"scalar":return r===void 0?hn(e.scalar,!1):YO(e,r);case"enum":return r??e.enum.values[0].number}}set(e,r){if(wm(this.message,e),this.check){let i=Ms(e,r);if(i)throw i}let n;e.fieldKind=="message"?n=HO(e,r):Im(r)||Nm(r)?n=r[_i]:n=VO(e,r),o1(this.message,e,n)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function wm(t,e){if(e.parent.typeName!==t.$typeName)throw new or(e,`cannot use ${e.toString()} with message ${t.$typeName}`,"ForeignFieldError")}var UO=class{field(){return this._field}get size(){return this._arr.length}constructor(e,r,n){this._field=e,this._arr=this[_i]=r,this.check=n}get(e){let r=this._arr[e];return r===void 0?void 0:kO(this._field,r,this.check)}set(e,r){if(e<0||e>=this._arr.length)throw new or(this._field,`list item #${e+1}: out of range`);if(this.check){let n=PO(this._field,e,r);if(n)throw n}this._arr[e]=QW(this._field,r)}add(e){if(this.check){let r=PO(this._field,this._arr.length,e);if(r)throw r}this._arr.push(QW(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 kO(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,kO(this._field,this._arr[e],this.check)]}};var GO=class{constructor(e,r,n=!0){this.obj=this[_i]=r??{},this.check=n,this._field=e}field(){return this._field}set(e,r){if(this.check){let n=VW(this._field,e,r);if(n)throw n}return this.obj[c1(e)]=fDe(this._field,r),this}delete(e){let r=c1(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[c1(e)];return r!==void 0&&(r=BO(this._field,r,this.check)),r}has(e){return Object.prototype.hasOwnProperty.call(this.obj,c1(e))}*keys(){for(let e of Object.keys(this.obj))yield jW(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[jW(e[0],this._field.mapKey),BO(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 BO(this._field,e,this.check)}forEach(e,r){for(let n of this.entries())e.call(r,n[1],n[0],this)}};function HO(t,e){return vm(e)?kW(e.message)&&!t.oneof&&t.fieldKind=="message"?e.message.value:e.desc.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"?ZW(e.message):e.message:e}function qO(t,e,r){return e!==void 0&&(zi(t.message)&&!t.oneof&&t.fieldKind=="message"?e={$typeName:t.message.typeName,value:YO(t.message.fields[0],e)}:t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"&&Ki(e)&&(e=XW(e))),new u1(t.message,e,r)}function QW(t,e){return t.listKind=="message"?HO(t,e):VO(t,e)}function kO(t,e,r){return t.listKind=="message"?qO(t,e,r):YO(t,e)}function fDe(t,e){return t.mapKind=="message"?HO(t,e):VO(t,e)}function BO(t,e,r){return t.mapKind=="message"?qO(t,e,r):e}function c1(t){return typeof t=="string"||typeof t=="number"?t:String(t)}function jW(t,e){switch(e){case $.STRING:return t;case $.INT32:case $.FIXED32:case $.UINT32:case $.SFIXED32:case $.SINT32:{let r=Number.parseInt(t);if(Number.isFinite(r))return r;break}case $.BOOL:switch(t){case"true":return!0;case"false":return!1}break;case $.UINT64:case $.FIXED64:try{return at.uParse(t)}catch{}break;default:try{return at.parse(t)}catch{}break}return t}function YO(t,e){switch(t.scalar){case $.INT64:case $.SFIXED64:case $.SINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=at.parse(e));break;case $.FIXED64:case $.UINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=at.uParse(e));break}return e}function VO(t,e){switch(t.scalar){case $.INT64:case $.SFIXED64:case $.SINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=at.parse(e));break;case $.FIXED64:case $.UINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=at.uParse(e));break}return e}function XW(t){let e={$typeName:"google.protobuf.Struct",fields:{}};if(Ki(t))for(let[r,n]of Object.entries(t))e.fields[r]=eK(n);return e}function ZW(t){let e={};for(let[r,n]of Object.entries(t.fields))e[r]=JW(n);return e}function JW(t){switch(t.kind.case){case"structValue":return ZW(t.kind.value);case"listValue":return t.kind.value.values.map(JW);case"nullValue":case void 0:return null;default:return t.kind.value}}function eK(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(eK(n));e.kind={case:"listValue",value:r}}else e.kind={case:"structValue",value:XW(t)};break}return e}u();u();u();function du(t){let e=hDe(),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,o,a=0;for(let l=0;l<t.length;l++){if(o=e[t.charCodeAt(l)],o===void 0)switch(t[l]){case"=":s=0;case`
@@ -230,7 +230,7 @@ attempted value: ${o}
230
230
 
231
231
  # Python SDK
232
232
  # from e2b import Sandbox, AsyncSandbox
233
- # sandbox = Sandbox("${t.template_name||t.template_id}") # Sync sandbox
233
+ # sandbox = Sandbox.create("${t.template_name||t.template_id}") # Sync sandbox
234
234
  # sandbox = await AsyncSandbox.create("${t.template_name||t.template_id}") # Async sandbox
235
235
 
236
236
  # JS SDK
@@ -249,7 +249,7 @@ ${Ae(V)}
249
249
  `);do switch(await So(SIe),i=await TIe({templateID:t,logsOffset:n,buildID:e}),n+=i.logs.length,i.logs.forEach(o=>process.stdout.write(qY(Ia(o)))),i.status){case"building":break;case"ready":{let o=VY(`from e2b import Sandbox, AsyncSandbox
250
250
 
251
251
  # Create sync sandbox
252
- sandbox = Sandbox("${s?.length?s[0]:i.templateID}")
252
+ sandbox = Sandbox.create("${s?.length?s[0]:i.templateID}")
253
253
 
254
254
  # Create async sandbox
255
255
  sandbox = await AsyncSandbox.create("${s?.length?s[0]:i.templateID}")`),a=YY(`import { Sandbox } from 'e2b'