File tree Expand file tree Collapse file tree
packages/js-sdk/src/sandbox Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' e2b ' : patch
3+ ---
4+
5+ allow passing template as an option in Sandbox.create()
Original file line number Diff line number Diff line change @@ -273,9 +273,11 @@ export class Sandbox extends SandboxApi {
273273 sandboxOpts : opts ,
274274 }
275275 : {
276- template : templateOrOpts ?. mcp
277- ? this . defaultMcpTemplate
278- : this . defaultTemplate ,
276+ template :
277+ templateOrOpts ?. template ??
278+ ( templateOrOpts ?. mcp
279+ ? this . defaultMcpTemplate
280+ : this . defaultTemplate ) ,
279281 sandboxOpts : templateOrOpts ,
280282 }
281283
@@ -368,9 +370,11 @@ export class Sandbox extends SandboxApi {
368370 sandboxOpts : opts ,
369371 }
370372 : {
371- template : templateOrOpts ?. mcp
372- ? this . defaultMcpTemplate
373- : this . defaultTemplate ,
373+ template :
374+ templateOrOpts ?. template ??
375+ ( templateOrOpts ?. mcp
376+ ? this . defaultMcpTemplate
377+ : this . defaultTemplate ) ,
374378 sandboxOpts : templateOrOpts ,
375379 }
376380
Original file line number Diff line number Diff line change @@ -107,6 +107,13 @@ export interface SandboxApiOpts
107107 * Options for creating a new Sandbox.
108108 */
109109export interface SandboxOpts extends ConnectionOpts {
110+ /**
111+ * Sandbox template name or ID.
112+ *
113+ * @default 'base' (or 'mcp-gateway' when `mcp` option is set)
114+ */
115+ template ?: string
116+
110117 /**
111118 * Custom metadata for the sandbox.
112119 *
You can’t perform that action at this time.
0 commit comments