@mastra/daytona 0.0.0-agent-chat-ui-20260305212602
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/CHANGELOG.md +176 -0
- package/LICENSE.md +30 -0
- package/README.md +354 -0
- package/dist/index.cjs +1208 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1205 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/index.d.ts +276 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/mounts/gcs.d.ts +20 -0
- package/dist/sandbox/mounts/gcs.d.ts.map +1 -0
- package/dist/sandbox/mounts/index.d.ts +4 -0
- package/dist/sandbox/mounts/index.d.ts.map +1 -0
- package/dist/sandbox/mounts/s3.d.ts +30 -0
- package/dist/sandbox/mounts/s3.d.ts.map +1 -0
- package/dist/sandbox/mounts/types.d.ts +59 -0
- package/dist/sandbox/mounts/types.d.ts.map +1 -0
- package/dist/sandbox/process-manager.d.ts +34 -0
- package/dist/sandbox/process-manager.d.ts.map +1 -0
- package/dist/sandbox/types.d.ts +15 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/utils/compact.d.ts +5 -0
- package/dist/utils/compact.d.ts.map +1 -0
- package/dist/utils/shell-quote.d.ts +8 -0
- package/dist/utils/shell-quote.d.ts.map +1 -0
- package/package.json +70 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# @mastra/daytona
|
|
2
|
+
|
|
3
|
+
## 0.0.0-agent-chat-ui-20260305212602
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`41e48c1`](https://github.com/mastra-ai/mastra/commit/41e48c198eee846478e60c02ec432c19d322a517), [`82469d3`](https://github.com/mastra-ai/mastra/commit/82469d3135d5a49dd8dc8feec0ff398b4e0225a0), [`33e2fd5`](https://github.com/mastra-ai/mastra/commit/33e2fd5088f83666df17401e2da68c943dbc0448), [`7ef6e2c`](https://github.com/mastra-ai/mastra/commit/7ef6e2c61be5a42e26f55d15b5902866fc76634f), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`fa37d39`](https://github.com/mastra-ai/mastra/commit/fa37d39910421feaf8847716292e3d65dd4f30c2), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`71c38bf`](https://github.com/mastra-ai/mastra/commit/71c38bf905905148ecd0e75c07c1f9825d299b76), [`f993c38`](https://github.com/mastra-ai/mastra/commit/f993c3848c97479b813231be872443bedeced6ab), [`f51849a`](https://github.com/mastra-ai/mastra/commit/f51849a568935122b5100b7ee69704e6d680cf7b), [`9bf3a0d`](https://github.com/mastra-ai/mastra/commit/9bf3a0dac602787925f1762f1f0387d7b4a59620), [`cafa045`](https://github.com/mastra-ai/mastra/commit/cafa0453c9de141ad50c09a13894622dffdd9978), [`1fd9ddb`](https://github.com/mastra-ai/mastra/commit/1fd9ddbb3fe83b281b12bd2e27e426ae86288266), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443), [`d9d228c`](https://github.com/mastra-ai/mastra/commit/d9d228c0c6ae82ae6ce3b540a3a56b2b1c2b8d98), [`5576507`](https://github.com/mastra-ai/mastra/commit/55765071e360fb97e443aa0a91ccf7e1cd8d92aa), [`79d69c9`](https://github.com/mastra-ai/mastra/commit/79d69c9d5f842ff1c31352fb6026f04c1f6190f3), [`94f44b8`](https://github.com/mastra-ai/mastra/commit/94f44b827ce57b179e50f4916a84c0fa6e7f3b8c), [`13187db`](https://github.com/mastra-ai/mastra/commit/13187dbac880174232dedc5a501ff6c5d0fe59bc), [`2ae5311`](https://github.com/mastra-ai/mastra/commit/2ae531185fff66a80fa165c0999e3d801900e89d), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443)]:
|
|
8
|
+
- @mastra/core@0.0.0-agent-chat-ui-20260305212602
|
|
9
|
+
|
|
10
|
+
## 0.1.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- Add DaytonaSandbox workspace provider — Daytona cloud sandbox integration for Mastra workspaces, implementing the WorkspaceSandbox interface with support for command execution, environment variables, resource configuration, snapshots, and Daytona volumes. ([#13112](https://github.com/mastra-ai/mastra/pull/13112))
|
|
15
|
+
|
|
16
|
+
**Basic usage**
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
20
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
21
|
+
|
|
22
|
+
const sandbox = new DaytonaSandbox({
|
|
23
|
+
id: 'my-sandbox',
|
|
24
|
+
env: { NODE_ENV: 'production' },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const workspace = new Workspace({ sandbox });
|
|
28
|
+
await workspace.init();
|
|
29
|
+
|
|
30
|
+
const result = await workspace.sandbox.executeCommand('echo', ['Hello!']);
|
|
31
|
+
console.log(result.stdout); // "Hello!"
|
|
32
|
+
|
|
33
|
+
await workspace.destroy();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- Added S3 and GCS cloud filesystem mounting support via FUSE (s3fs-fuse, gcsfuse). Daytona sandboxes can now mount cloud storage as local directories, matching the mount capabilities of E2B and Blaxel providers. ([#13544](https://github.com/mastra-ai/mastra/pull/13544))
|
|
37
|
+
|
|
38
|
+
**New methods:**
|
|
39
|
+
- `mount(filesystem, mountPath)` — Mount an S3 or GCS filesystem at a path in the sandbox
|
|
40
|
+
- `unmount(mountPath)` — Unmount a previously mounted filesystem
|
|
41
|
+
|
|
42
|
+
**What changed:**
|
|
43
|
+
- Added S3 and GCS bucket mounts as local directories in Daytona sandboxes.
|
|
44
|
+
- Improved reconnect behavior so mounts are restored reliably.
|
|
45
|
+
- Added safety checks to prevent mounting into non-empty directories.
|
|
46
|
+
- Improved concurrent mount support by isolating credentials per mount.
|
|
47
|
+
|
|
48
|
+
**Usage:**
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
52
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
53
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
54
|
+
|
|
55
|
+
const workspace = new Workspace({
|
|
56
|
+
mounts: {
|
|
57
|
+
'/data': new S3Filesystem({
|
|
58
|
+
bucket: 'my-bucket',
|
|
59
|
+
region: 'us-east-1',
|
|
60
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
61
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
sandbox: new DaytonaSandbox(),
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Remove internal `processes` field from sandbox provider options ([#13597](https://github.com/mastra-ai/mastra/pull/13597))
|
|
71
|
+
|
|
72
|
+
The `processes` field is no longer exposed in constructor options for E2B, Daytona, and Blaxel sandbox providers. This field is managed internally and was not intended to be user-configurable.
|
|
73
|
+
|
|
74
|
+
- Improved S3/GCS FUSE mounting reliability and sandbox reconnection. ([#13543](https://github.com/mastra-ai/mastra/pull/13543))
|
|
75
|
+
|
|
76
|
+
**Mounting improvements**
|
|
77
|
+
- Replaced direct SDK coupling in mount helpers with callback-based context, making mount operations more testable and resilient
|
|
78
|
+
- Added tmpfs overlay to handle FUSE-on-FUSE remount scenarios that previously failed with ENOENT
|
|
79
|
+
- Added `mount --move` fallback when standard FUSE unmount fails on stuck mounts
|
|
80
|
+
- `stop()` now unmounts all filesystems before stopping the sandbox
|
|
81
|
+
- Added early connectivity check for GCS mounting that detects Daytona's restricted internet tiers and fails fast with an actionable error message instead of hanging
|
|
82
|
+
- Improved gcsfuse installation with distro-aware codename detection (bookworm for Debian, jammy for Ubuntu)
|
|
83
|
+
- Added input validation for bucket names, endpoints, and credentials before interpolating into shell commands
|
|
84
|
+
|
|
85
|
+
**Reconnection improvements**
|
|
86
|
+
- `findExistingSandbox` now looks up sandboxes by name first (works for stopped sandboxes), then falls back to label search
|
|
87
|
+
- Added transitional state handling that polls and waits when a sandbox is starting/stopping/restoring before attempting to start it, avoiding "State change in progress" errors
|
|
88
|
+
|
|
89
|
+
- Sandbox instructions no longer include a working directory path, keeping instructions stable across sessions. ([#13520](https://github.com/mastra-ai/mastra/pull/13520))
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [[`504fc8b`](https://github.com/mastra-ai/mastra/commit/504fc8b9d0ddab717577ad3bf9c95ea4bd5377bd), [`f9c150b`](https://github.com/mastra-ai/mastra/commit/f9c150b7595ad05ad9cc9a11098e2944361e8c22), [`88de7e8`](https://github.com/mastra-ai/mastra/commit/88de7e8dfe4b7e1951a9e441bb33136e705ce24e), [`edee4b3`](https://github.com/mastra-ai/mastra/commit/edee4b37dff0af515fc7cc0e8d71ee39e6a762f0), [`3790c75`](https://github.com/mastra-ai/mastra/commit/3790c7578cc6a47d854eb12d89e6b1912867fe29), [`e7a235b`](https://github.com/mastra-ai/mastra/commit/e7a235be6472e0c870ed6c791ddb17c492dc188b), [`d51d298`](https://github.com/mastra-ai/mastra/commit/d51d298953967aab1f58ec965b644d109214f085), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d5f0d8d`](https://github.com/mastra-ai/mastra/commit/d5f0d8d6a03e515ddaa9b5da19b7e44b8357b07b), [`09c3b18`](https://github.com/mastra-ai/mastra/commit/09c3b1802ff14e243a8a8baea327440bc8cc2e32), [`b896379`](https://github.com/mastra-ai/mastra/commit/b8963791c6afa79484645fcec596a201f936b9a2), [`85c84eb`](https://github.com/mastra-ai/mastra/commit/85c84ebb78aebfcba9d209c8e152b16d7a00cb71), [`a89272a`](https://github.com/mastra-ai/mastra/commit/a89272a5d71939b9fcd284e6a6dc1dd091a6bdcf), [`ee9c8df`](https://github.com/mastra-ai/mastra/commit/ee9c8df644f19d055af5f496bf4942705f5a47b7), [`77b4a25`](https://github.com/mastra-ai/mastra/commit/77b4a254e51907f8ff3a3ba95596a18e93ae4b35), [`276246e`](https://github.com/mastra-ai/mastra/commit/276246e0b9066a1ea48bbc70df84dbe528daaf99), [`08ecfdb`](https://github.com/mastra-ai/mastra/commit/08ecfdbdad6fb8285deef86a034bdf4a6047cfca), [`d5f628c`](https://github.com/mastra-ai/mastra/commit/d5f628ca86c6f6f3ff1035d52f635df32dd81cab), [`524c0f3`](https://github.com/mastra-ai/mastra/commit/524c0f3c434c3d9d18f66338dcef383d6161b59c), [`c18a0e9`](https://github.com/mastra-ai/mastra/commit/c18a0e9cef1e4ca004b2963d35e4cfc031971eac), [`4bd21ea`](https://github.com/mastra-ai/mastra/commit/4bd21ea43d44d0a0427414fc047577f9f0aa3bec), [`115a7a4`](https://github.com/mastra-ai/mastra/commit/115a7a47db5e9896fec12ae6507501adb9ec89bf), [`22a48ae`](https://github.com/mastra-ai/mastra/commit/22a48ae2513eb54d8d79dad361fddbca97a155e8), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9311c17`](https://github.com/mastra-ai/mastra/commit/9311c17d7a0640d9c4da2e71b814dc67c57c6369), [`7edf78f`](https://github.com/mastra-ai/mastra/commit/7edf78f80422c43e84585f08ba11df0d4d0b73c5), [`1c4221c`](https://github.com/mastra-ai/mastra/commit/1c4221cf6032ec98d0e094d4ee11da3e48490d96), [`d25b9ea`](https://github.com/mastra-ai/mastra/commit/d25b9eabd400167255a97b690ffbc4ee4097ded5), [`fe1ce5c`](https://github.com/mastra-ai/mastra/commit/fe1ce5c9211c03d561606fda95cbfe7df1d9a9b5), [`b03c0e0`](https://github.com/mastra-ai/mastra/commit/b03c0e0389a799523929a458b0509c9e4244d562), [`0a8366b`](https://github.com/mastra-ai/mastra/commit/0a8366b0a692fcdde56c4d526e4cf03c502ae4ac), [`85664e9`](https://github.com/mastra-ai/mastra/commit/85664e9fd857320fbc245e301f764f45f66f32a3), [`bc79650`](https://github.com/mastra-ai/mastra/commit/bc796500c6e0334faa158a96077e3fb332274869), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`3a3a59e`](https://github.com/mastra-ai/mastra/commit/3a3a59e8ffaa6a985fe3d9a126a3f5ade11a6724), [`3108d4e`](https://github.com/mastra-ai/mastra/commit/3108d4e649c9fddbf03253a6feeb388a5fa9fa5a), [`0c33b2c`](https://github.com/mastra-ai/mastra/commit/0c33b2c9db537f815e1c59e2c898ffce2e395a79), [`191e5bd`](https://github.com/mastra-ai/mastra/commit/191e5bd29b82f5bda35243945790da7bc7b695c2), [`f77cd94`](https://github.com/mastra-ai/mastra/commit/f77cd94c44eabed490384e7d19232a865e13214c), [`e8135c7`](https://github.com/mastra-ai/mastra/commit/e8135c7e300dac5040670eec7eab896ac6092e30), [`daca48f`](https://github.com/mastra-ai/mastra/commit/daca48f0fb17b7ae0b62a2ac40cf0e491b2fd0b7), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`352f25d`](https://github.com/mastra-ai/mastra/commit/352f25da316b24cdd5b410fd8dddf6a8b763da2a), [`93477d0`](https://github.com/mastra-ai/mastra/commit/93477d0769b8a13ea5ed73d508d967fb23eaeed9), [`31c78b3`](https://github.com/mastra-ai/mastra/commit/31c78b3eb28f58a8017f1dcc795c33214d87feac), [`0bc0720`](https://github.com/mastra-ai/mastra/commit/0bc07201095791858087cc56f353fcd65e87ab54), [`36516ac`](https://github.com/mastra-ai/mastra/commit/36516aca1021cbeb42e74751b46a2614101f37c8), [`e947652`](https://github.com/mastra-ai/mastra/commit/e9476527fdecb4449e54570e80dfaf8466901254), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`ec248f6`](https://github.com/mastra-ai/mastra/commit/ec248f6b56e8a037c066c49b2178e2507471d988)]:
|
|
92
|
+
- @mastra/core@1.9.0
|
|
93
|
+
|
|
94
|
+
## 0.1.0-alpha.0
|
|
95
|
+
|
|
96
|
+
### Minor Changes
|
|
97
|
+
|
|
98
|
+
- Add DaytonaSandbox workspace provider — Daytona cloud sandbox integration for Mastra workspaces, implementing the WorkspaceSandbox interface with support for command execution, environment variables, resource configuration, snapshots, and Daytona volumes. ([#13112](https://github.com/mastra-ai/mastra/pull/13112))
|
|
99
|
+
|
|
100
|
+
**Basic usage**
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
104
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
105
|
+
|
|
106
|
+
const sandbox = new DaytonaSandbox({
|
|
107
|
+
id: 'my-sandbox',
|
|
108
|
+
env: { NODE_ENV: 'production' },
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const workspace = new Workspace({ sandbox });
|
|
112
|
+
await workspace.init();
|
|
113
|
+
|
|
114
|
+
const result = await workspace.sandbox.executeCommand('echo', ['Hello!']);
|
|
115
|
+
console.log(result.stdout); // "Hello!"
|
|
116
|
+
|
|
117
|
+
await workspace.destroy();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- Added S3 and GCS cloud filesystem mounting support via FUSE (s3fs-fuse, gcsfuse). Daytona sandboxes can now mount cloud storage as local directories, matching the mount capabilities of E2B and Blaxel providers. ([#13544](https://github.com/mastra-ai/mastra/pull/13544))
|
|
121
|
+
|
|
122
|
+
**New methods:**
|
|
123
|
+
- `mount(filesystem, mountPath)` — Mount an S3 or GCS filesystem at a path in the sandbox
|
|
124
|
+
- `unmount(mountPath)` — Unmount a previously mounted filesystem
|
|
125
|
+
|
|
126
|
+
**What changed:**
|
|
127
|
+
- Added S3 and GCS bucket mounts as local directories in Daytona sandboxes.
|
|
128
|
+
- Improved reconnect behavior so mounts are restored reliably.
|
|
129
|
+
- Added safety checks to prevent mounting into non-empty directories.
|
|
130
|
+
- Improved concurrent mount support by isolating credentials per mount.
|
|
131
|
+
|
|
132
|
+
**Usage:**
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
136
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
137
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
138
|
+
|
|
139
|
+
const workspace = new Workspace({
|
|
140
|
+
mounts: {
|
|
141
|
+
'/data': new S3Filesystem({
|
|
142
|
+
bucket: 'my-bucket',
|
|
143
|
+
region: 'us-east-1',
|
|
144
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
145
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
146
|
+
}),
|
|
147
|
+
},
|
|
148
|
+
sandbox: new DaytonaSandbox(),
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- Remove internal `processes` field from sandbox provider options ([#13597](https://github.com/mastra-ai/mastra/pull/13597))
|
|
155
|
+
|
|
156
|
+
The `processes` field is no longer exposed in constructor options for E2B, Daytona, and Blaxel sandbox providers. This field is managed internally and was not intended to be user-configurable.
|
|
157
|
+
|
|
158
|
+
- Improved S3/GCS FUSE mounting reliability and sandbox reconnection. ([#13543](https://github.com/mastra-ai/mastra/pull/13543))
|
|
159
|
+
|
|
160
|
+
**Mounting improvements**
|
|
161
|
+
- Replaced direct SDK coupling in mount helpers with callback-based context, making mount operations more testable and resilient
|
|
162
|
+
- Added tmpfs overlay to handle FUSE-on-FUSE remount scenarios that previously failed with ENOENT
|
|
163
|
+
- Added `mount --move` fallback when standard FUSE unmount fails on stuck mounts
|
|
164
|
+
- `stop()` now unmounts all filesystems before stopping the sandbox
|
|
165
|
+
- Added early connectivity check for GCS mounting that detects Daytona's restricted internet tiers and fails fast with an actionable error message instead of hanging
|
|
166
|
+
- Improved gcsfuse installation with distro-aware codename detection (bookworm for Debian, jammy for Ubuntu)
|
|
167
|
+
- Added input validation for bucket names, endpoints, and credentials before interpolating into shell commands
|
|
168
|
+
|
|
169
|
+
**Reconnection improvements**
|
|
170
|
+
- `findExistingSandbox` now looks up sandboxes by name first (works for stopped sandboxes), then falls back to label search
|
|
171
|
+
- Added transitional state handling that polls and waits when a sandbox is starting/stopping/restoring before attempting to start it, avoiding "State change in progress" errors
|
|
172
|
+
|
|
173
|
+
- Sandbox instructions no longer include a working directory path, keeping instructions stable across sessions. ([#13520](https://github.com/mastra-ai/mastra/pull/13520))
|
|
174
|
+
|
|
175
|
+
- Updated dependencies [[`504fc8b`](https://github.com/mastra-ai/mastra/commit/504fc8b9d0ddab717577ad3bf9c95ea4bd5377bd), [`f9c150b`](https://github.com/mastra-ai/mastra/commit/f9c150b7595ad05ad9cc9a11098e2944361e8c22), [`88de7e8`](https://github.com/mastra-ai/mastra/commit/88de7e8dfe4b7e1951a9e441bb33136e705ce24e), [`edee4b3`](https://github.com/mastra-ai/mastra/commit/edee4b37dff0af515fc7cc0e8d71ee39e6a762f0), [`3790c75`](https://github.com/mastra-ai/mastra/commit/3790c7578cc6a47d854eb12d89e6b1912867fe29), [`e7a235b`](https://github.com/mastra-ai/mastra/commit/e7a235be6472e0c870ed6c791ddb17c492dc188b), [`d51d298`](https://github.com/mastra-ai/mastra/commit/d51d298953967aab1f58ec965b644d109214f085), [`6dbeeb9`](https://github.com/mastra-ai/mastra/commit/6dbeeb94a8b1eebb727300d1a98961f882180794), [`d5f0d8d`](https://github.com/mastra-ai/mastra/commit/d5f0d8d6a03e515ddaa9b5da19b7e44b8357b07b), [`09c3b18`](https://github.com/mastra-ai/mastra/commit/09c3b1802ff14e243a8a8baea327440bc8cc2e32), [`b896379`](https://github.com/mastra-ai/mastra/commit/b8963791c6afa79484645fcec596a201f936b9a2), [`85c84eb`](https://github.com/mastra-ai/mastra/commit/85c84ebb78aebfcba9d209c8e152b16d7a00cb71), [`a89272a`](https://github.com/mastra-ai/mastra/commit/a89272a5d71939b9fcd284e6a6dc1dd091a6bdcf), [`ee9c8df`](https://github.com/mastra-ai/mastra/commit/ee9c8df644f19d055af5f496bf4942705f5a47b7), [`77b4a25`](https://github.com/mastra-ai/mastra/commit/77b4a254e51907f8ff3a3ba95596a18e93ae4b35), [`276246e`](https://github.com/mastra-ai/mastra/commit/276246e0b9066a1ea48bbc70df84dbe528daaf99), [`08ecfdb`](https://github.com/mastra-ai/mastra/commit/08ecfdbdad6fb8285deef86a034bdf4a6047cfca), [`d5f628c`](https://github.com/mastra-ai/mastra/commit/d5f628ca86c6f6f3ff1035d52f635df32dd81cab), [`524c0f3`](https://github.com/mastra-ai/mastra/commit/524c0f3c434c3d9d18f66338dcef383d6161b59c), [`c18a0e9`](https://github.com/mastra-ai/mastra/commit/c18a0e9cef1e4ca004b2963d35e4cfc031971eac), [`4bd21ea`](https://github.com/mastra-ai/mastra/commit/4bd21ea43d44d0a0427414fc047577f9f0aa3bec), [`115a7a4`](https://github.com/mastra-ai/mastra/commit/115a7a47db5e9896fec12ae6507501adb9ec89bf), [`22a48ae`](https://github.com/mastra-ai/mastra/commit/22a48ae2513eb54d8d79dad361fddbca97a155e8), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9311c17`](https://github.com/mastra-ai/mastra/commit/9311c17d7a0640d9c4da2e71b814dc67c57c6369), [`7edf78f`](https://github.com/mastra-ai/mastra/commit/7edf78f80422c43e84585f08ba11df0d4d0b73c5), [`1c4221c`](https://github.com/mastra-ai/mastra/commit/1c4221cf6032ec98d0e094d4ee11da3e48490d96), [`d25b9ea`](https://github.com/mastra-ai/mastra/commit/d25b9eabd400167255a97b690ffbc4ee4097ded5), [`fe1ce5c`](https://github.com/mastra-ai/mastra/commit/fe1ce5c9211c03d561606fda95cbfe7df1d9a9b5), [`b03c0e0`](https://github.com/mastra-ai/mastra/commit/b03c0e0389a799523929a458b0509c9e4244d562), [`0a8366b`](https://github.com/mastra-ai/mastra/commit/0a8366b0a692fcdde56c4d526e4cf03c502ae4ac), [`85664e9`](https://github.com/mastra-ai/mastra/commit/85664e9fd857320fbc245e301f764f45f66f32a3), [`bc79650`](https://github.com/mastra-ai/mastra/commit/bc796500c6e0334faa158a96077e3fb332274869), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`3a3a59e`](https://github.com/mastra-ai/mastra/commit/3a3a59e8ffaa6a985fe3d9a126a3f5ade11a6724), [`3108d4e`](https://github.com/mastra-ai/mastra/commit/3108d4e649c9fddbf03253a6feeb388a5fa9fa5a), [`0c33b2c`](https://github.com/mastra-ai/mastra/commit/0c33b2c9db537f815e1c59e2c898ffce2e395a79), [`191e5bd`](https://github.com/mastra-ai/mastra/commit/191e5bd29b82f5bda35243945790da7bc7b695c2), [`f77cd94`](https://github.com/mastra-ai/mastra/commit/f77cd94c44eabed490384e7d19232a865e13214c), [`e8135c7`](https://github.com/mastra-ai/mastra/commit/e8135c7e300dac5040670eec7eab896ac6092e30), [`daca48f`](https://github.com/mastra-ai/mastra/commit/daca48f0fb17b7ae0b62a2ac40cf0e491b2fd0b7), [`257d14f`](https://github.com/mastra-ai/mastra/commit/257d14faca5931f2e4186fc165b6f0b1f915deee), [`352f25d`](https://github.com/mastra-ai/mastra/commit/352f25da316b24cdd5b410fd8dddf6a8b763da2a), [`93477d0`](https://github.com/mastra-ai/mastra/commit/93477d0769b8a13ea5ed73d508d967fb23eaeed9), [`31c78b3`](https://github.com/mastra-ai/mastra/commit/31c78b3eb28f58a8017f1dcc795c33214d87feac), [`0bc0720`](https://github.com/mastra-ai/mastra/commit/0bc07201095791858087cc56f353fcd65e87ab54), [`36516ac`](https://github.com/mastra-ai/mastra/commit/36516aca1021cbeb42e74751b46a2614101f37c8), [`e947652`](https://github.com/mastra-ai/mastra/commit/e9476527fdecb4449e54570e80dfaf8466901254), [`3c6ef79`](https://github.com/mastra-ai/mastra/commit/3c6ef798481e00d6d22563be2de98818fd4dd5e0), [`9257d01`](https://github.com/mastra-ai/mastra/commit/9257d01d1366d81f84c582fe02b5e200cf9621f4), [`ec248f6`](https://github.com/mastra-ai/mastra/commit/ec248f6b56e8a037c066c49b2178e2507471d988)]:
|
|
176
|
+
- @mastra/core@1.9.0-alpha.0
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Portions of this software are licensed as follows:
|
|
2
|
+
|
|
3
|
+
- All content that resides under any directory named "ee/" within this
|
|
4
|
+
repository, including but not limited to:
|
|
5
|
+
- `packages/core/src/auth/ee/`
|
|
6
|
+
- `packages/server/src/server/auth/ee/`
|
|
7
|
+
is licensed under the license defined in `ee/LICENSE`.
|
|
8
|
+
|
|
9
|
+
- All third-party components incorporated into the Mastra Software are
|
|
10
|
+
licensed under the original license provided by the owner of the
|
|
11
|
+
applicable component.
|
|
12
|
+
|
|
13
|
+
- Content outside of the above-mentioned directories or restrictions is
|
|
14
|
+
available under the "Apache License 2.0" as defined below.
|
|
15
|
+
|
|
16
|
+
# Apache License 2.0
|
|
17
|
+
|
|
18
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
19
|
+
|
|
20
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
+
you may not use this file except in compliance with the License.
|
|
22
|
+
You may obtain a copy of the License at
|
|
23
|
+
|
|
24
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
|
|
26
|
+
Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
+
See the License for the specific language governing permissions and
|
|
30
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# @mastra/daytona
|
|
2
|
+
|
|
3
|
+
Daytona cloud sandbox provider for [Mastra](https://mastra.ai) workspaces.
|
|
4
|
+
|
|
5
|
+
Implements the `WorkspaceSandbox` interface using [Daytona](https://www.daytona.io/) sandboxes. Supports multiple runtimes, resource configuration, volumes, snapshots, streaming output, sandbox reconnection, and filesystem mounting (S3, GCS).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @mastra/daytona @mastra/core
|
|
11
|
+
|
|
12
|
+
# For filesystem mounting (optional)
|
|
13
|
+
pnpm add @mastra/s3 @mastra/gcs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Basic
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
22
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
23
|
+
|
|
24
|
+
const sandbox = new DaytonaSandbox({
|
|
25
|
+
language: 'typescript',
|
|
26
|
+
timeout: 60_000,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const workspace = new Workspace({ sandbox });
|
|
30
|
+
await workspace.init();
|
|
31
|
+
|
|
32
|
+
const result = await workspace.sandbox.executeCommand('echo', ['Hello!']);
|
|
33
|
+
console.log(result.stdout); // "Hello!"
|
|
34
|
+
|
|
35
|
+
await workspace.destroy();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Snapshot
|
|
39
|
+
|
|
40
|
+
Use a pre-built snapshot to skip environment setup time:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const sandbox = new DaytonaSandbox({
|
|
44
|
+
snapshot: 'my-snapshot-id',
|
|
45
|
+
timeout: 60_000,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Custom image with resources
|
|
50
|
+
|
|
51
|
+
Use a custom Docker image with specific resource allocation:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const sandbox = new DaytonaSandbox({
|
|
55
|
+
image: 'node:20-slim',
|
|
56
|
+
resources: { cpu: 2, memory: 4, disk: 6 },
|
|
57
|
+
language: 'typescript',
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Ephemeral sandbox
|
|
62
|
+
|
|
63
|
+
For one-shot tasks — sandbox is deleted immediately on stop:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const sandbox = new DaytonaSandbox({
|
|
67
|
+
ephemeral: true,
|
|
68
|
+
language: 'python',
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Streaming output
|
|
73
|
+
|
|
74
|
+
Stream command output in real time via callbacks:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
await sandbox.executeCommand('bash', ['-c', 'for i in 1 2 3; do echo "line $i"; sleep 1; done'], {
|
|
78
|
+
onStdout: chunk => process.stdout.write(chunk),
|
|
79
|
+
onStderr: chunk => process.stderr.write(chunk),
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Reconnection
|
|
84
|
+
|
|
85
|
+
Reconnect to an existing sandbox by providing the same `id`. The sandbox resumes with its files and state intact:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const sandbox = new DaytonaSandbox({ id: 'my-persistent-sandbox' });
|
|
89
|
+
|
|
90
|
+
// First session
|
|
91
|
+
await sandbox._start();
|
|
92
|
+
await sandbox.executeCommand('sh', ['-c', 'echo "session 1" > /tmp/state.txt']);
|
|
93
|
+
await sandbox._stop();
|
|
94
|
+
|
|
95
|
+
// Later — reconnects to the same sandbox
|
|
96
|
+
const sandbox2 = new DaytonaSandbox({ id: 'my-persistent-sandbox' });
|
|
97
|
+
await sandbox2._start();
|
|
98
|
+
const result = await sandbox2.executeCommand('cat', ['/tmp/state.txt']);
|
|
99
|
+
console.log(result.stdout); // "session 1"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Filesystem mounting
|
|
103
|
+
|
|
104
|
+
Mount S3 or GCS buckets as local directories inside the sandbox.
|
|
105
|
+
|
|
106
|
+
#### Via workspace mounts config
|
|
107
|
+
|
|
108
|
+
The simplest way — filesystems are mounted automatically when the sandbox starts:
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
112
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
113
|
+
import { GCSFilesystem } from '@mastra/gcs';
|
|
114
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
115
|
+
|
|
116
|
+
const workspace = new Workspace({
|
|
117
|
+
mounts: {
|
|
118
|
+
'/s3-data': new S3Filesystem({
|
|
119
|
+
bucket: process.env.S3_BUCKET!,
|
|
120
|
+
region: 'auto',
|
|
121
|
+
accessKeyId: process.env.S3_ACCESS_KEY_ID,
|
|
122
|
+
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
|
|
123
|
+
endpoint: process.env.S3_ENDPOINT, // e.g. https://<account-id>.r2.cloudflarestorage.com
|
|
124
|
+
}),
|
|
125
|
+
'/gcs-data': new GCSFilesystem({
|
|
126
|
+
bucket: process.env.GCS_BUCKET!,
|
|
127
|
+
projectId: 'my-project-id',
|
|
128
|
+
credentials: JSON.parse(process.env.GCS_SERVICE_ACCOUNT_KEY!),
|
|
129
|
+
}),
|
|
130
|
+
},
|
|
131
|
+
sandbox: new DaytonaSandbox({ language: 'python' }),
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### Via sandbox.mount()
|
|
136
|
+
|
|
137
|
+
Mount manually at any point after the sandbox has started:
|
|
138
|
+
|
|
139
|
+
#### S3
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
143
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
144
|
+
|
|
145
|
+
const sandbox = new DaytonaSandbox({ language: 'python' });
|
|
146
|
+
await sandbox._start();
|
|
147
|
+
|
|
148
|
+
await sandbox.mount(
|
|
149
|
+
new S3Filesystem({
|
|
150
|
+
bucket: process.env.S3_BUCKET!,
|
|
151
|
+
region: 'us-east-1',
|
|
152
|
+
accessKeyId: process.env.S3_ACCESS_KEY_ID,
|
|
153
|
+
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
|
|
154
|
+
}),
|
|
155
|
+
'/data',
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// Files in the bucket are now accessible at /data
|
|
159
|
+
const result = await sandbox.executeCommand('ls', ['/data']);
|
|
160
|
+
console.log(result.stdout);
|
|
161
|
+
|
|
162
|
+
await sandbox._stop(); // Unmounts automatically before stopping
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### S3-compatible (Cloudflare R2, MinIO)
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
169
|
+
|
|
170
|
+
await sandbox.mount(
|
|
171
|
+
new S3Filesystem({
|
|
172
|
+
bucket: process.env.S3_BUCKET!,
|
|
173
|
+
region: 'auto',
|
|
174
|
+
accessKeyId: process.env.S3_ACCESS_KEY_ID,
|
|
175
|
+
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
|
|
176
|
+
endpoint: process.env.S3_ENDPOINT, // e.g. https://<account-id>.r2.cloudflarestorage.com
|
|
177
|
+
}),
|
|
178
|
+
'/data',
|
|
179
|
+
);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### GCS
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { GCSFilesystem } from '@mastra/gcs';
|
|
186
|
+
|
|
187
|
+
await sandbox.mount(
|
|
188
|
+
new GCSFilesystem({
|
|
189
|
+
bucket: process.env.GCS_BUCKET!,
|
|
190
|
+
projectId: 'my-project-id',
|
|
191
|
+
credentials: JSON.parse(process.env.GCS_SERVICE_ACCOUNT_KEY!),
|
|
192
|
+
}),
|
|
193
|
+
'/data',
|
|
194
|
+
);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Network isolation
|
|
198
|
+
|
|
199
|
+
Restrict outbound network access:
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
const sandbox = new DaytonaSandbox({
|
|
203
|
+
networkBlockAll: true,
|
|
204
|
+
networkAllowList: '10.0.0.0/8,192.168.0.0/16',
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### With Agent
|
|
209
|
+
|
|
210
|
+
Wire a Daytona sandbox into a Mastra agent to give it code execution in an isolated sandbox:
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import { Agent } from '@mastra/core/agent';
|
|
214
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
215
|
+
import { DaytonaSandbox } from '@mastra/daytona';
|
|
216
|
+
|
|
217
|
+
const sandbox = new DaytonaSandbox({
|
|
218
|
+
language: 'typescript',
|
|
219
|
+
timeout: 120_000,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const workspace = new Workspace({ sandbox });
|
|
223
|
+
|
|
224
|
+
const agent = new Agent({
|
|
225
|
+
id: 'code-agent',
|
|
226
|
+
name: 'Code Agent',
|
|
227
|
+
instructions: 'You are a coding assistant working in this workspace.',
|
|
228
|
+
model: 'anthropic/claude-sonnet-4-6',
|
|
229
|
+
workspace,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const response = await agent.generate('Print "Hello, world!" and show the current working directory.');
|
|
233
|
+
|
|
234
|
+
console.log(response.text);
|
|
235
|
+
// I'll run both commands simultaneously!
|
|
236
|
+
//
|
|
237
|
+
// Here are the results:
|
|
238
|
+
//
|
|
239
|
+
// 1. **Hello, world!** — Successfully printed the message.
|
|
240
|
+
// 2. **Current Working Directory** — `/home/daytona`
|
|
241
|
+
//
|
|
242
|
+
// Both commands ran in parallel and completed successfully!
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Configuration
|
|
246
|
+
|
|
247
|
+
| Option | Type | Default | Description |
|
|
248
|
+
| --------------------- | --------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
249
|
+
| `id` | `string` | auto-generated | Sandbox identifier |
|
|
250
|
+
| `apiKey` | `string` | `DAYTONA_API_KEY` env | API key |
|
|
251
|
+
| `apiUrl` | `string` | `DAYTONA_API_URL` env | API endpoint |
|
|
252
|
+
| `target` | `string` | `DAYTONA_TARGET` env | Runner region |
|
|
253
|
+
| `timeout` | `number` | `300000` | Default execution timeout (ms) |
|
|
254
|
+
| `language` | `string` | `'typescript'` | Runtime language |
|
|
255
|
+
| `snapshot` | `string` | — | Pre-built snapshot ID. Takes precedence over `image`. |
|
|
256
|
+
| `image` | `string` | — | Docker image for sandbox creation. Triggers image-based creation when set. Can be combined with `resources`. Ignored when `snapshot` is set. |
|
|
257
|
+
| `resources` | `object` | SDK defaults | `{ cpu, memory, disk }`. Only used with `image`. |
|
|
258
|
+
| `env` | `object` | `{}` | Environment variables |
|
|
259
|
+
| `labels` | `object` | `{}` | Custom metadata labels |
|
|
260
|
+
| `name` | `string` | sandbox `id` | Sandbox display name |
|
|
261
|
+
| `user` | `string` | `daytona` | OS user to run commands as |
|
|
262
|
+
| `public` | `boolean` | `false` | Make port previews public |
|
|
263
|
+
| `ephemeral` | `boolean` | `false` | Delete sandbox immediately on stop |
|
|
264
|
+
| `autoStopInterval` | `number` | `15` | Auto-stop interval in minutes (0 = disabled) |
|
|
265
|
+
| `autoArchiveInterval` | `number` | `7 days` | Auto-archive interval in minutes (0 = 7 days) |
|
|
266
|
+
| `autoDeleteInterval` | `number` | `disabled` | Auto-delete interval in minutes (negative = disabled, 0 = delete on stop) |
|
|
267
|
+
| `volumes` | `array` | — | `[{ volumeId, mountPath }]` |
|
|
268
|
+
| `networkBlockAll` | `boolean` | `false` | Block all network access |
|
|
269
|
+
| `networkAllowList` | `string` | — | Comma-separated allowed CIDR addresses |
|
|
270
|
+
|
|
271
|
+
## Mount Configuration
|
|
272
|
+
|
|
273
|
+
Pass `S3Filesystem` or `GCSFilesystem` instances via the workspace `mounts` config or directly to `sandbox.mount()`.
|
|
274
|
+
|
|
275
|
+
### S3 environment variables
|
|
276
|
+
|
|
277
|
+
| Variable | Description |
|
|
278
|
+
| ---------------------- | --------------------------------- |
|
|
279
|
+
| `S3_BUCKET` | Bucket name |
|
|
280
|
+
| `S3_REGION` | AWS region or `auto` for R2/MinIO |
|
|
281
|
+
| `S3_ACCESS_KEY_ID` | Access key ID |
|
|
282
|
+
| `S3_SECRET_ACCESS_KEY` | Secret access key |
|
|
283
|
+
| `S3_ENDPOINT` | Endpoint URL (S3-compatible only) |
|
|
284
|
+
|
|
285
|
+
### GCS environment variables
|
|
286
|
+
|
|
287
|
+
| Variable | Description |
|
|
288
|
+
| ------------------------- | ------------------------------------------------------- |
|
|
289
|
+
| `GCS_BUCKET` | Bucket name |
|
|
290
|
+
| `GCS_SERVICE_ACCOUNT_KEY` | Service account key JSON (full JSON string, not a path) |
|
|
291
|
+
|
|
292
|
+
### Reducing cold start latency with a snapshot
|
|
293
|
+
|
|
294
|
+
By default, `s3fs` and `gcsfuse` are installed at first mount via `apt`, which adds startup time. To eliminate this, prebake them into a Daytona snapshot and pass the snapshot name via the `snapshot` option.
|
|
295
|
+
|
|
296
|
+
Create the snapshot once:
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
import { Daytona, Image } from '@daytonaio/sdk';
|
|
300
|
+
|
|
301
|
+
const template = Image.base('daytonaio/sandbox')
|
|
302
|
+
.runCommands('sudo apt-get update -qq')
|
|
303
|
+
.runCommands('sudo apt-get install -y s3fs')
|
|
304
|
+
// gcsfuse requires the Google Cloud apt repository
|
|
305
|
+
.runCommands(
|
|
306
|
+
'sudo mkdir -p /etc/apt/keyrings && ' +
|
|
307
|
+
'curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg -o /tmp/gcsfuse-key.gpg && ' +
|
|
308
|
+
'sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/gcsfuse.gpg /tmp/gcsfuse-key.gpg && ' +
|
|
309
|
+
// Use gcsfuse-jammy for Ubuntu, gcsfuse-bookworm for Debian
|
|
310
|
+
'echo "deb [signed-by=/etc/apt/keyrings/gcsfuse.gpg] https://packages.cloud.google.com/apt gcsfuse-jammy main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list',
|
|
311
|
+
)
|
|
312
|
+
.runCommands('sudo apt-get update -qq && sudo apt-get install -y gcsfuse');
|
|
313
|
+
|
|
314
|
+
const daytona = new Daytona();
|
|
315
|
+
await daytona.snapshot.create(
|
|
316
|
+
{
|
|
317
|
+
name: 'cloud-fs-mounting',
|
|
318
|
+
image: template,
|
|
319
|
+
},
|
|
320
|
+
{ onLogs: console.log },
|
|
321
|
+
);
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Then use the snapshot name in your sandbox config:
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
const workspace = new Workspace({
|
|
328
|
+
mounts: {
|
|
329
|
+
'/s3-data': new S3Filesystem({
|
|
330
|
+
/* ... */
|
|
331
|
+
}),
|
|
332
|
+
'/gcs-data': new GCSFilesystem({
|
|
333
|
+
/* ... */
|
|
334
|
+
}),
|
|
335
|
+
},
|
|
336
|
+
sandbox: new DaytonaSandbox({ snapshot: 'cloud-fs-mounting' }),
|
|
337
|
+
});
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Direct SDK Access
|
|
341
|
+
|
|
342
|
+
Access the underlying Daytona `Sandbox` instance for filesystem, git, and other operations not exposed through WorkspaceSandbox:
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
const daytonaSandbox = sandbox.instance;
|
|
346
|
+
|
|
347
|
+
await daytonaSandbox.fs.uploadFile(Buffer.from('data'), '/tmp/file.txt');
|
|
348
|
+
|
|
349
|
+
await daytonaSandbox.git.clone('https://github.com/org/repo', '/workspace/repo');
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## License
|
|
353
|
+
|
|
354
|
+
Apache-2.0
|