@mastra/e2b 0.0.0

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.
@@ -0,0 +1,84 @@
1
+ import type { TemplateBuilder } from 'e2b';
2
+ /**
3
+ * Template specification for E2B sandbox.
4
+ *
5
+ * Can be:
6
+ * - `string` - Existing template ID (e.g., 'base', 'my-custom-template')
7
+ * - `TemplateBuilder` - A built template object from Template()
8
+ * - `(base: TemplateBuilder) => TemplateBuilder` - Callback to customize the base template
9
+ *
10
+ * @example Using template ID
11
+ * ```typescript
12
+ * new E2BSandbox({ template: 'my-custom-template' })
13
+ * ```
14
+ *
15
+ * @example Using Template builder
16
+ * ```typescript
17
+ * import { Template } from 'e2b';
18
+ *
19
+ * new E2BSandbox({
20
+ * template: Template()
21
+ * .fromUbuntuImage('22.04')
22
+ * .aptInstall(['s3fs', 'curl'])
23
+ * .setEnvs({ NODE_ENV: 'production' })
24
+ * })
25
+ * ```
26
+ *
27
+ * @example Customizing default mountable template
28
+ * ```typescript
29
+ * new E2BSandbox({
30
+ * template: base => base
31
+ * .aptInstall(['nodejs', 'npm'])
32
+ * .runCmd('npm install -g typescript')
33
+ * })
34
+ * ```
35
+ */
36
+ export type TemplateSpec = string | TemplateBuilder | ((base: TemplateBuilder) => TemplateBuilder);
37
+ /**
38
+ * Result from createMountableTemplate containing both the template and its ID.
39
+ */
40
+ export interface MountableTemplateResult {
41
+ /** The template builder with mount dependencies */
42
+ template: TemplateBuilder;
43
+ /** Deterministic template ID for caching */
44
+ id: string;
45
+ /** List of apt packages installed in the template */
46
+ aptPackages: string[];
47
+ }
48
+ /**
49
+ * Version of the default mountable template.
50
+ * Increment this when changing the default template dependencies.
51
+ */
52
+ export declare const MOUNTABLE_TEMPLATE_VERSION = "v1";
53
+ /**
54
+ * Create a base template with FUSE mounting dependencies pre-installed.
55
+ *
56
+ * This template includes s3fs and fuse packages required for mounting
57
+ * cloud filesystems (S3, GCS, R2) into the sandbox.
58
+ *
59
+ * The returned `id` is deterministic, allowing E2BSandbox to check if
60
+ * the template already exists before building it.
61
+ *
62
+ * @example Basic usage
63
+ * ```typescript
64
+ * const { template, id } = createMountableTemplate();
65
+ * // First time: builds and caches the template
66
+ * // Subsequent times: reuses existing template
67
+ * const sandbox = new E2BSandbox({ template });
68
+ * ```
69
+ *
70
+ * @example With customization
71
+ * ```typescript
72
+ * const { template } = createMountableTemplate();
73
+ * const customTemplate = template
74
+ * .aptInstall(['nodejs', 'npm'])
75
+ * .runCmd('npm install -g typescript');
76
+ *
77
+ * // Note: customized templates get a unique ID, not the cached one
78
+ * const sandbox = new E2BSandbox({ template: customTemplate });
79
+ * ```
80
+ *
81
+ * @returns Object with template builder and deterministic ID
82
+ */
83
+ export declare function createDefaultMountableTemplate(): MountableTemplateResult;
84
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAM3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,eAAe,CAAC,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,mDAAmD;IACnD,QAAQ,EAAE,eAAe,CAAC;IAC1B,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,8BAA8B,IAAI,uBAAuB,CAmBxE"}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@mastra/e2b",
3
+ "version": "0.0.0",
4
+ "description": "E2B cloud sandbox provider for Mastra workspaces",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "dependencies": {
23
+ "e2b": "^2.12.1"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "22.19.7",
27
+ "@vitest/coverage-v8": "4.0.12",
28
+ "@vitest/ui": "4.0.12",
29
+ "dotenv": "^17.2.3",
30
+ "eslint": "^9.37.0",
31
+ "tsup": "^8.5.1",
32
+ "typescript": "^5.9.3",
33
+ "vitest": "4.0.16",
34
+ "@internal/lint": "0.0.57",
35
+ "@internal/workspace-test-utils": "0.0.1",
36
+ "@internal/types-builder": "0.0.32",
37
+ "@mastra/core": "1.2.1-alpha.0",
38
+ "@mastra/gcs": "0.0.0",
39
+ "@mastra/s3": "0.0.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@mastra/core": ">=1.3.0-0 <2.0.0-0"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "CHANGELOG.md"
47
+ ],
48
+ "homepage": "https://mastra.ai",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/mastra-ai/mastra.git",
52
+ "directory": "workspaces/e2b"
53
+ },
54
+ "bugs": {
55
+ "url": "https://github.com/mastra-ai/mastra/issues"
56
+ },
57
+ "engines": {
58
+ "node": ">=22.13.0"
59
+ },
60
+ "scripts": {
61
+ "build": "tsup --silent --config tsup.config.ts",
62
+ "build:lib": "pnpm build",
63
+ "build:watch": "pnpm build --watch",
64
+ "test:unit": "vitest run --exclude '**/*.integration.test.ts'",
65
+ "test:watch": "vitest watch",
66
+ "test": "vitest run ./src/**/*.integration.test.ts",
67
+ "test:cloud": "pnpm test",
68
+ "lint": "eslint ."
69
+ }
70
+ }