@mastra/deployer-sandbox 0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150
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 +257 -0
- package/LICENSE.md +30 -0
- package/README.md +104 -0
- package/dist/alias.d.ts +10 -0
- package/dist/alias.d.ts.map +1 -0
- package/dist/client/index.cjs +174 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.ts +98 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +171 -0
- package/dist/client/index.js.map +1 -0
- package/dist/deployer.d.ts +57 -0
- package/dist/deployer.d.ts.map +1 -0
- package/dist/engine.d.ts +34 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/index.cjs +832 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +824 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +7 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/shared-C-piQAcU.js +115 -0
- package/dist/shared-C-piQAcU.js.map +1 -0
- package/dist/shared-H9GioaPM.cjs +192 -0
- package/dist/shared-H9GioaPM.cjs.map +1 -0
- package/dist/shared.d.ts +63 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/studio/assets/CommitMono-400-Regular-DzkyLZ26.woff2 +0 -0
- package/dist/studio/assets/CommitMono-700-Regular-DmOSN4kd.woff2 +0 -0
- package/dist/studio/assets/MonaSans-VariableFont_wdth-wght-CX-7s9jm.ttf +0 -0
- package/dist/studio/assets/babel-lWBcy2sH.js +16 -0
- package/dist/studio/assets/bash-atvbtKCR.js +1 -0
- package/dist/studio/assets/core-B-AlWOWa.js +12 -0
- package/dist/studio/assets/engine-compile-BkERmzkH.js +137 -0
- package/dist/studio/assets/engine-javascript-CSIo_1eZ.js +1 -0
- package/dist/studio/assets/estree-Dd9JfUIE.js +44 -0
- package/dist/studio/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/studio/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/studio/assets/index-yUiD89B4.js +1 -0
- package/dist/studio/assets/index-znlQ7_ex.js +2 -0
- package/dist/studio/assets/javascript-ySlJ1b_l.js +1 -0
- package/dist/studio/assets/json-BQoSv7ci.js +1 -0
- package/dist/studio/assets/jsx-BAng5TT0.js +1 -0
- package/dist/studio/assets/livekit-client.esm-CKIgC2IJ.js +39 -0
- package/dist/studio/assets/main-D5Yq7Fjg.js +769 -0
- package/dist/studio/assets/markdown-UIAJJxZW.js +1 -0
- package/dist/studio/assets/preload-helper-PPVm8Dsz.js +1 -0
- package/dist/studio/assets/python-DhUJRlN_.js +1 -0
- package/dist/studio/assets/shell-CjFT_Tl9.js +1 -0
- package/dist/studio/assets/standalone-Dfz2oS5J.js +29 -0
- package/dist/studio/assets/style-CAUk37Fq.css +1 -0
- package/dist/studio/assets/tsx-B6W0miNI.js +1 -0
- package/dist/studio/assets/typescript-Dj6nwHGl.js +1 -0
- package/dist/studio/index.html +100 -0
- package/dist/studio/mastra.svg +17 -0
- package/dist/studio/routes-manifest.json +27 -0
- package/dist/types.d.ts +215 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/worker.d.ts +3 -0
- package/dist/worker.d.ts.map +1 -0
- package/package.json +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# @mastra/deployer-sandbox
|
|
2
|
+
|
|
3
|
+
## 0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c5e56ff`](https://github.com/mastra-ai/mastra/commit/c5e56ff3bcabdf062708f2d48744fec304df6792), [`7f4e26d`](https://github.com/mastra-ai/mastra/commit/7f4e26dd57bd9b23c278ea21235ab823a3810a6c), [`322daa6`](https://github.com/mastra-ai/mastra/commit/322daa6d90552909204044790d850958f6745fed), [`cadaa13`](https://github.com/mastra-ai/mastra/commit/cadaa1372e1077c8e85eb64c5499ba8803caa323), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c), [`06000d7`](https://github.com/mastra-ai/mastra/commit/06000d73712911572e913b8a83339270296d0a22), [`cf24430`](https://github.com/mastra-ai/mastra/commit/cf24430226a6ecb104bc1d54d6e401defd7cb53f), [`4e35a56`](https://github.com/mastra-ai/mastra/commit/4e35a56cdf8d74a5ff6d5eda01f2c1deaf6cc7be), [`3de0188`](https://github.com/mastra-ai/mastra/commit/3de0188bfaf9a9c09c95fe322b53838cf52c70b6), [`8ac9019`](https://github.com/mastra-ai/mastra/commit/8ac9019db164b0703035c27da22c28e675053ce2), [`6306f2c`](https://github.com/mastra-ai/mastra/commit/6306f2cac6fbe9a89d881044a609cc1d4aace797), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c)]:
|
|
8
|
+
- @mastra/core@0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150
|
|
9
|
+
- @mastra/deployer@0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150
|
|
10
|
+
|
|
11
|
+
## 0.2.1-alpha.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`7f4e26d`](https://github.com/mastra-ai/mastra/commit/7f4e26dd57bd9b23c278ea21235ab823a3810a6c), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c), [`6306f2c`](https://github.com/mastra-ai/mastra/commit/6306f2cac6fbe9a89d881044a609cc1d4aace797), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c)]:
|
|
16
|
+
- @mastra/core@1.56.0-alpha.0
|
|
17
|
+
- @mastra/deployer@1.56.0-alpha.0
|
|
18
|
+
|
|
19
|
+
## 0.2.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- Run isolated non-HTTP workers with bounded input, separate byte-preserving output streams, cancellation, relaunch, and cleanup controls. ([#19641](https://github.com/mastra-ai/mastra/pull/19641))
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { deployWorkerToSandbox } from '@mastra/deployer-sandbox';
|
|
27
|
+
|
|
28
|
+
const worker = await deployWorkerToSandbox({
|
|
29
|
+
sandbox,
|
|
30
|
+
dir: './dist/worker',
|
|
31
|
+
executionId: 'job-1',
|
|
32
|
+
command: 'node',
|
|
33
|
+
args: ['index.mjs'],
|
|
34
|
+
input: { type: 'stdin', data: request },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const stdout = await worker.readOutput('stdout');
|
|
38
|
+
await worker.cancel();
|
|
39
|
+
const retry = await worker.relaunch({ executionId: 'job-2' });
|
|
40
|
+
await retry.destroy();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [[`3f472b4`](https://github.com/mastra-ai/mastra/commit/3f472b468892a1ff14ccb43cc0343b86f7d8fd7d), [`ba369f2`](https://github.com/mastra-ai/mastra/commit/ba369f2a0aaf998da0d6aa033d26f64f96bef8ac), [`35b929b`](https://github.com/mastra-ai/mastra/commit/35b929b7abc3d20d85c7985880960ac2d04a6c86), [`55c9e24`](https://github.com/mastra-ai/mastra/commit/55c9e248c27c1d72b5bb7e94ea6b8a3999eee49f), [`dcfed93`](https://github.com/mastra-ai/mastra/commit/dcfed93e1e256c6abfa792cbb7ca836f5d0e8638), [`2876e15`](https://github.com/mastra-ai/mastra/commit/2876e15b4d2f616a3bc1ed3af57d546c268384ce), [`9b3626a`](https://github.com/mastra-ai/mastra/commit/9b3626aeb1d16fcd34b0a8e94c114ddb80a3b240), [`4696963`](https://github.com/mastra-ai/mastra/commit/469696312ac4c618bc8475b0c5ed7949b8a3455e), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`07f5b4b`](https://github.com/mastra-ai/mastra/commit/07f5b4ba9d608d88865030732e580298296adf99), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`598080f`](https://github.com/mastra-ai/mastra/commit/598080f224edb3f0f5b801035b067fac50a56a03)]:
|
|
46
|
+
- @mastra/core@1.55.0
|
|
47
|
+
- @mastra/deployer@1.55.0
|
|
48
|
+
|
|
49
|
+
## 0.2.0-alpha.1
|
|
50
|
+
|
|
51
|
+
### Minor Changes
|
|
52
|
+
|
|
53
|
+
- Run isolated non-HTTP workers with bounded input, separate byte-preserving output streams, cancellation, relaunch, and cleanup controls. ([#19641](https://github.com/mastra-ai/mastra/pull/19641))
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { deployWorkerToSandbox } from '@mastra/deployer-sandbox';
|
|
57
|
+
|
|
58
|
+
const worker = await deployWorkerToSandbox({
|
|
59
|
+
sandbox,
|
|
60
|
+
dir: './dist/worker',
|
|
61
|
+
executionId: 'job-1',
|
|
62
|
+
command: 'node',
|
|
63
|
+
args: ['index.mjs'],
|
|
64
|
+
input: { type: 'stdin', data: request },
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const stdout = await worker.readOutput('stdout');
|
|
68
|
+
await worker.cancel();
|
|
69
|
+
const retry = await worker.relaunch({ executionId: 'job-2' });
|
|
70
|
+
await retry.destroy();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [[`55c9e24`](https://github.com/mastra-ai/mastra/commit/55c9e248c27c1d72b5bb7e94ea6b8a3999eee49f), [`07f5b4b`](https://github.com/mastra-ai/mastra/commit/07f5b4ba9d608d88865030732e580298296adf99)]:
|
|
76
|
+
- @mastra/core@1.55.0-alpha.2
|
|
77
|
+
- @mastra/deployer@1.55.0-alpha.2
|
|
78
|
+
|
|
79
|
+
## 0.1.4-alpha.0
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [[`3f472b4`](https://github.com/mastra-ai/mastra/commit/3f472b468892a1ff14ccb43cc0343b86f7d8fd7d), [`35b929b`](https://github.com/mastra-ai/mastra/commit/35b929b7abc3d20d85c7985880960ac2d04a6c86), [`9b3626a`](https://github.com/mastra-ai/mastra/commit/9b3626aeb1d16fcd34b0a8e94c114ddb80a3b240)]:
|
|
84
|
+
- @mastra/core@1.55.0-alpha.0
|
|
85
|
+
- @mastra/deployer@1.55.0-alpha.0
|
|
86
|
+
|
|
87
|
+
## 0.1.3
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [[`ce93a3c`](https://github.com/mastra-ai/mastra/commit/ce93a3c114ea1cbfbd576f3db41d7c26c9844f5b), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`a211d09`](https://github.com/mastra-ai/mastra/commit/a211d09185dc65a746534914cf38b67f21ee9bac), [`0dca9d0`](https://github.com/mastra-ai/mastra/commit/0dca9d0b1356024a53b72ea6f040db528b126caa), [`6218217`](https://github.com/mastra-ai/mastra/commit/62182171b6cfca0b099f1c6a77a2e65e7639ab86), [`5807d3a`](https://github.com/mastra-ai/mastra/commit/5807d3ae1d259b8b7d6df7e5bf2b485c694af9c8), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`05db566`](https://github.com/mastra-ai/mastra/commit/05db566fcbdcbf33d0bffca0c72ec30129e2e3ca), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`d1b7e3a`](https://github.com/mastra-ai/mastra/commit/d1b7e3a978a309a5653eeaa490d2d6c7c53bd093), [`29c584a`](https://github.com/mastra-ai/mastra/commit/29c584a13a88831e5ed1fdeb0ff8e82eae180433), [`c093146`](https://github.com/mastra-ai/mastra/commit/c0931466404d3c521308ea119cb165bb7e695155), [`8124754`](https://github.com/mastra-ai/mastra/commit/8124754ae89fbc69f8136d1df4a91904d0f84c4e), [`d12b2e4`](https://github.com/mastra-ai/mastra/commit/d12b2e4023fd9e3d3e93a9169f5088bcee2a849c)]:
|
|
92
|
+
- @mastra/core@1.54.0
|
|
93
|
+
- @mastra/deployer@1.54.0
|
|
94
|
+
|
|
95
|
+
## 0.1.3-alpha.0
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [[`0dca9d0`](https://github.com/mastra-ai/mastra/commit/0dca9d0b1356024a53b72ea6f040db528b126caa)]:
|
|
100
|
+
- @mastra/core@1.54.0-alpha.0
|
|
101
|
+
- @mastra/deployer@1.54.0-alpha.0
|
|
102
|
+
|
|
103
|
+
## 0.1.2
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- Updated dependencies [[`c8d8a01`](https://github.com/mastra-ai/mastra/commit/c8d8a010ee2efe2b7bf4d07707382c34c87b14e4), [`df6a9ce`](https://github.com/mastra-ai/mastra/commit/df6a9ce87214f7aadb2edfe62f67605fe998a0a4), [`73839cb`](https://github.com/mastra-ai/mastra/commit/73839cb58322679c170627d1015669ede5f619aa), [`371cf60`](https://github.com/mastra-ai/mastra/commit/371cf6075cef88ac6919a08d59a82e485397364a), [`8e4dc79`](https://github.com/mastra-ai/mastra/commit/8e4dc793dcf035ea506f9ce79f56d2d501a4be14), [`2db93cc`](https://github.com/mastra-ai/mastra/commit/2db93ccd0b872e4de7853a93383efe0647901df8), [`094ab61`](https://github.com/mastra-ai/mastra/commit/094ab6129a1a3ecf6eeb86decac17d5faea4e02a), [`fe80944`](https://github.com/mastra-ai/mastra/commit/fe80944f3ef6681fea6eae8200fce387b7bb3c2f), [`263d2ca`](https://github.com/mastra-ai/mastra/commit/263d2cac80ba3b03b9c0f008db6f1f1b9eb0278c), [`75f843d`](https://github.com/mastra-ai/mastra/commit/75f843d09f758223e6eeb321321bdcc5c7e779d0), [`e51e166`](https://github.com/mastra-ai/mastra/commit/e51e166c52e220abc9b64554ce37359dca8544b1)]:
|
|
108
|
+
- @mastra/core@1.53.0
|
|
109
|
+
- @mastra/deployer@1.53.0
|
|
110
|
+
|
|
111
|
+
## 0.1.2-alpha.1
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- Updated dependencies [[`c8d8a01`](https://github.com/mastra-ai/mastra/commit/c8d8a010ee2efe2b7bf4d07707382c34c87b14e4), [`371cf60`](https://github.com/mastra-ai/mastra/commit/371cf6075cef88ac6919a08d59a82e485397364a), [`263d2ca`](https://github.com/mastra-ai/mastra/commit/263d2cac80ba3b03b9c0f008db6f1f1b9eb0278c)]:
|
|
116
|
+
- @mastra/core@1.53.0-alpha.1
|
|
117
|
+
- @mastra/deployer@1.53.0-alpha.1
|
|
118
|
+
|
|
119
|
+
## 0.1.2-alpha.0
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [[`df6a9ce`](https://github.com/mastra-ai/mastra/commit/df6a9ce87214f7aadb2edfe62f67605fe998a0a4)]:
|
|
124
|
+
- @mastra/core@1.52.2-alpha.0
|
|
125
|
+
- @mastra/deployer@1.52.2-alpha.0
|
|
126
|
+
|
|
127
|
+
## 0.1.1
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- Updated dependencies [[`55adddf`](https://github.com/mastra-ai/mastra/commit/55adddfda2a170b00c112bf37d677e8ce5b65d5a)]:
|
|
132
|
+
- @mastra/core@1.52.1
|
|
133
|
+
- @mastra/deployer@1.52.1
|
|
134
|
+
|
|
135
|
+
## 0.1.1-alpha.0
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- Updated dependencies [[`55adddf`](https://github.com/mastra-ai/mastra/commit/55adddfda2a170b00c112bf37d677e8ce5b65d5a)]:
|
|
140
|
+
- @mastra/core@1.52.1-alpha.0
|
|
141
|
+
- @mastra/deployer@1.52.1-alpha.0
|
|
142
|
+
|
|
143
|
+
## 0.1.0
|
|
144
|
+
|
|
145
|
+
### Minor Changes
|
|
146
|
+
|
|
147
|
+
- New package: deploy a full Mastra server (including Studio) into any workspace sandbox that supports networking, and get a live public URL in seconds. Works with `@mastra/vercel`, `@mastra/e2b`, and `@mastra/daytona` sandboxes. Built for ephemeral environments: instant previews, PR/CI smoke deploys, agent-built app verification, and multi-tenant untrusted instances. ([#19577](https://github.com/mastra-ai/mastra/pull/19577))
|
|
148
|
+
|
|
149
|
+
**Deploy from your Mastra config**
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
153
|
+
import { SandboxDeployer } from '@mastra/deployer-sandbox';
|
|
154
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
155
|
+
|
|
156
|
+
export const mastra = new Mastra({
|
|
157
|
+
deployer: new SandboxDeployer({
|
|
158
|
+
sandbox: new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] }),
|
|
159
|
+
}),
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Then run `mastra build` — it bundles the project and deploys it into the sandbox in one step. Redeploys reuse the same sandbox and skip dependency installs when the install inputs (`package.json`, bundled lockfiles, and the install command) are unchanged.
|
|
164
|
+
|
|
165
|
+
**Manage the deployment**
|
|
166
|
+
|
|
167
|
+
The sandbox name is the identity — `getDeployment()` retrieves the deployment from any process or codebase, without importing the Mastra project:
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { getDeployment } from '@mastra/deployer-sandbox/client';
|
|
171
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
172
|
+
|
|
173
|
+
const dep = await getDeployment({
|
|
174
|
+
sandbox: new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] }),
|
|
175
|
+
}); // never wakes a stopped sandbox
|
|
176
|
+
await dep.stop(); // snapshot-stop (resumable)
|
|
177
|
+
await dep.destroy(); // permanent delete
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Deploy programmatically (CI / agents)**
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import { deployToSandbox } from '@mastra/deployer-sandbox';
|
|
184
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
185
|
+
|
|
186
|
+
const sandbox = new VercelSandbox({ sandboxName: 'ci-preview', ports: [4111] });
|
|
187
|
+
const deployment = await deployToSandbox({ sandbox, dir: '.mastra/output' });
|
|
188
|
+
console.info(deployment.url);
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Resolve and route at runtime**
|
|
192
|
+
|
|
193
|
+
The server-only `@mastra/deployer-sandbox/client` export includes `getDeployment()` to resolve the current URL and manage the deployment (`stop()`, `destroy()`, `logs()`, with optional wake-on-demand), plus `createSandboxHandler()` and `createSandboxProxy()` helpers to serve a sandbox behind a stable URL on your own domain.
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- Updated dependencies [[`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`d7385ad`](https://github.com/mastra-ai/mastra/commit/d7385ad9e88f9e4f33d15c0ec0bfebedde0cbc2e), [`41a5392`](https://github.com/mastra-ai/mastra/commit/41a5392d9f6c5e18d6b227f0fc0ddf49c50774e9), [`3b77e77`](https://github.com/mastra-ai/mastra/commit/3b77e7704936522e4769d29de1b5ea6901f302bd), [`3d6e539`](https://github.com/mastra-ai/mastra/commit/3d6e539272eb2ea0407034605ee1906b3be06b39), [`1426af2`](https://github.com/mastra-ai/mastra/commit/1426af24975879c000d13ac75673f630fcc970c1), [`a40adeb`](https://github.com/mastra-ai/mastra/commit/a40adeb222b961a56a58af56a106106525721b74), [`8a0d145`](https://github.com/mastra-ai/mastra/commit/8a0d145aadbdf7278665aceaaec364b35dd9bd94), [`bd2f1d2`](https://github.com/mastra-ai/mastra/commit/bd2f1d274d05e60e2366f005ea0d94d5cea0d5ff), [`e1f2fae`](https://github.com/mastra-ai/mastra/commit/e1f2faebaf048c3d4c2e2c01d293767c195d5794), [`63aa799`](https://github.com/mastra-ai/mastra/commit/63aa799c6b44eacc7806cda6846b7c5bbee06b37), [`b7e79c3`](https://github.com/mastra-ai/mastra/commit/b7e79c3c02ac5cd415db34ba0975ceafc1464333), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`da009e1`](https://github.com/mastra-ai/mastra/commit/da009e1aacd89ed94b8d1b2af09c9d4fe7c4db49), [`3b77e77`](https://github.com/mastra-ai/mastra/commit/3b77e7704936522e4769d29de1b5ea6901f302bd), [`c7d30cd`](https://github.com/mastra-ai/mastra/commit/c7d30cd86009c407df91105591f03cd6e3d2854d), [`21a0eb8`](https://github.com/mastra-ai/mastra/commit/21a0eb86746ba0b703acea360d4f84c6a5a493f2), [`8b20926`](https://github.com/mastra-ai/mastra/commit/8b20926cd59e2ba3d66458e062fa0e6e2ada3e68), [`975295d`](https://github.com/mastra-ai/mastra/commit/975295d418552f0d46a59edfef4c3ee555f9930a), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`6b1bf3b`](https://github.com/mastra-ai/mastra/commit/6b1bf3b9494bd51aa8f654c68c9355d6046fa2a1), [`35c2181`](https://github.com/mastra-ai/mastra/commit/35c2181e6a50e47c90ba36260db7c9723d54696f), [`0a2c22c`](https://github.com/mastra-ai/mastra/commit/0a2c22c902604439ec490319e14c17f331e0c84c), [`4cfdd64`](https://github.com/mastra-ai/mastra/commit/4cfdd645794feaea0c4ea711e70ecdfbef0c5b8e), [`0a50de7`](https://github.com/mastra-ai/mastra/commit/0a50de7024816171701e81ac3b69434cf5a302ea), [`b75d749`](https://github.com/mastra-ai/mastra/commit/b75d749621ff5d17e86bcb4ee809d301fb4f7cf3), [`821648b`](https://github.com/mastra-ai/mastra/commit/821648bf2871ef840100c7bacbecf676010bd12a), [`de86fd7`](https://github.com/mastra-ai/mastra/commit/de86fd7119f0438381d1a642e3d258143c0b9c29), [`2745031`](https://github.com/mastra-ai/mastra/commit/2745031d1d4a4978f037092da371428c32e2842a), [`b4b7ea8`](https://github.com/mastra-ai/mastra/commit/b4b7ea8733f033fc441ea47ed03f6afb17ec2248), [`3a8024c`](https://github.com/mastra-ai/mastra/commit/3a8024ce615f8aa89479c0d71fe61d10bb0040be), [`35865a5`](https://github.com/mastra-ai/mastra/commit/35865a53e194aa9634d6a70a97010e7a6b9d58b1), [`74faf8b`](https://github.com/mastra-ai/mastra/commit/74faf8bd9c1018f2492653c06b1e25fc8300e9e6), [`ef03fbc`](https://github.com/mastra-ai/mastra/commit/ef03fbcc556bcbc04c9b3d06fab88771ecaa043c), [`675fbff`](https://github.com/mastra-ai/mastra/commit/675fbff84d3274391b33e852f76083c38a5514e5), [`70687f7`](https://github.com/mastra-ai/mastra/commit/70687f7e495a322a02070b4a67cb0c77a5ca91ec), [`1fadac4`](https://github.com/mastra-ai/mastra/commit/1fadac44537caeefe81f9f775ae2f2f3d94e9069), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`76b7181`](https://github.com/mastra-ai/mastra/commit/76b71810366e6d90b9d3973149d1c7ba3659ffb9), [`792ec9a`](https://github.com/mastra-ai/mastra/commit/792ec9a0869bab8274cf5e0ed2840738737a1607), [`712b864`](https://github.com/mastra-ai/mastra/commit/712b864aa1ed12b14c54390ec17b69de163c37f7), [`85e4fb5`](https://github.com/mastra-ai/mastra/commit/85e4fb50087a81c74df3a762f53b56373db0b912), [`0c0e8d7`](https://github.com/mastra-ai/mastra/commit/0c0e8d7becd4d1445c656b78d5d845f606c1ff9d), [`53df41b`](https://github.com/mastra-ai/mastra/commit/53df41ba8b00438ebe5daee1b04613aa4239a5b2), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`72e437c`](https://github.com/mastra-ai/mastra/commit/72e437c515942c80b9def5b026e0bdee61b469d9), [`8f7a5de`](https://github.com/mastra-ai/mastra/commit/8f7a5dedc246cdc938bb65516703cf9b27b03756), [`a7bbe77`](https://github.com/mastra-ai/mastra/commit/a7bbe773577f60bc4761b534ef7ec6b476332dad), [`11f6cd9`](https://github.com/mastra-ai/mastra/commit/11f6cd96fe42582403416608beb212cc1a2cc79e), [`ef03c0c`](https://github.com/mastra-ai/mastra/commit/ef03c0cfc62367a458e4cc56462e2148b35681c5), [`4fb4d88`](https://github.com/mastra-ai/mastra/commit/4fb4d881bc107acee13890ad4d78661016c510ed), [`eac4537`](https://github.com/mastra-ai/mastra/commit/eac453795531df0d5fe3729d80e93a91f8c1bc91), [`4e68363`](https://github.com/mastra-ai/mastra/commit/4e683634f94ebd062d26a3bb6093a8dfc7263d37), [`c328769`](https://github.com/mastra-ai/mastra/commit/c3287698ff8ef98dba86d415faa566fa3e5f4d56), [`9f7c67a`](https://github.com/mastra-ai/mastra/commit/9f7c67abeeb52c41c51a9b5edee60b62afe7cd8d), [`3b65e68`](https://github.com/mastra-ai/mastra/commit/3b65e68d7f1c771c7a70eea42d83fefdd28cad88), [`4eba27a`](https://github.com/mastra-ai/mastra/commit/4eba27adcf60f991df0e62f94b3e75b4e67f3b4b), [`c701be3`](https://github.com/mastra-ai/mastra/commit/c701be32d7d9aa94a66da8c6cc38dcac6856f464), [`b4b7ea8`](https://github.com/mastra-ai/mastra/commit/b4b7ea8733f033fc441ea47ed03f6afb17ec2248), [`db650ce`](https://github.com/mastra-ai/mastra/commit/db650ce490348914e85b93651d83acdf8f2a4c31), [`232fcbc`](https://github.com/mastra-ai/mastra/commit/232fcbc14fce625dd672ba043329c0b732c62be2), [`6354eeb`](https://github.com/mastra-ai/mastra/commit/6354eeb32efa9f5f68f51dda394e90e2ee76f1fb), [`a8799bb`](https://github.com/mastra-ai/mastra/commit/a8799bb8e44f4a60d01e4e2acd3448ff80bf14f8), [`3d6e539`](https://github.com/mastra-ai/mastra/commit/3d6e539272eb2ea0407034605ee1906b3be06b39), [`e3868e2`](https://github.com/mastra-ai/mastra/commit/e3868e22babfffd0133771669ca724501c2dd58e), [`9251370`](https://github.com/mastra-ai/mastra/commit/9251370ad413af464aa22d7566338bec5613e8de), [`3491666`](https://github.com/mastra-ai/mastra/commit/34916663c4fdd43b48c21f4ab2d5fb6dcccc94f9), [`c0bec73`](https://github.com/mastra-ai/mastra/commit/c0bec732c93d1a22ae5e51ed66cf8cacca8bd6a6)]:
|
|
198
|
+
- @mastra/core@1.52.0
|
|
199
|
+
- @mastra/deployer@1.52.0
|
|
200
|
+
|
|
201
|
+
## 0.1.0-alpha.0
|
|
202
|
+
|
|
203
|
+
### Minor Changes
|
|
204
|
+
|
|
205
|
+
- New package: deploy a full Mastra server (including Studio) into any workspace sandbox that supports networking, and get a live public URL in seconds. Works with `@mastra/vercel`, `@mastra/e2b`, and `@mastra/daytona` sandboxes. Built for ephemeral environments: instant previews, PR/CI smoke deploys, agent-built app verification, and multi-tenant untrusted instances. ([#19577](https://github.com/mastra-ai/mastra/pull/19577))
|
|
206
|
+
|
|
207
|
+
**Deploy from your Mastra config**
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
211
|
+
import { SandboxDeployer } from '@mastra/deployer-sandbox';
|
|
212
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
213
|
+
|
|
214
|
+
export const mastra = new Mastra({
|
|
215
|
+
deployer: new SandboxDeployer({
|
|
216
|
+
sandbox: new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] }),
|
|
217
|
+
}),
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Then run `mastra build` — it bundles the project and deploys it into the sandbox in one step. Redeploys reuse the same sandbox and skip dependency installs when the install inputs (`package.json`, bundled lockfiles, and the install command) are unchanged.
|
|
222
|
+
|
|
223
|
+
**Manage the deployment**
|
|
224
|
+
|
|
225
|
+
The sandbox name is the identity — `getDeployment()` retrieves the deployment from any process or codebase, without importing the Mastra project:
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { getDeployment } from '@mastra/deployer-sandbox/client';
|
|
229
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
230
|
+
|
|
231
|
+
const dep = await getDeployment({
|
|
232
|
+
sandbox: new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] }),
|
|
233
|
+
}); // never wakes a stopped sandbox
|
|
234
|
+
await dep.stop(); // snapshot-stop (resumable)
|
|
235
|
+
await dep.destroy(); // permanent delete
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Deploy programmatically (CI / agents)**
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { deployToSandbox } from '@mastra/deployer-sandbox';
|
|
242
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
243
|
+
|
|
244
|
+
const sandbox = new VercelSandbox({ sandboxName: 'ci-preview', ports: [4111] });
|
|
245
|
+
const deployment = await deployToSandbox({ sandbox, dir: '.mastra/output' });
|
|
246
|
+
console.info(deployment.url);
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Resolve and route at runtime**
|
|
250
|
+
|
|
251
|
+
The server-only `@mastra/deployer-sandbox/client` export includes `getDeployment()` to resolve the current URL and manage the deployment (`stop()`, `destroy()`, `logs()`, with optional wake-on-demand), plus `createSandboxHandler()` and `createSandboxProxy()` helpers to serve a sandbox behind a stable URL on your own domain.
|
|
252
|
+
|
|
253
|
+
### Patch Changes
|
|
254
|
+
|
|
255
|
+
- Updated dependencies [[`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`e1f2fae`](https://github.com/mastra-ai/mastra/commit/e1f2faebaf048c3d4c2e2c01d293767c195d5794), [`63aa799`](https://github.com/mastra-ai/mastra/commit/63aa799c6b44eacc7806cda6846b7c5bbee06b37), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`76b7181`](https://github.com/mastra-ai/mastra/commit/76b71810366e6d90b9d3973149d1c7ba3659ffb9), [`0c0e8d7`](https://github.com/mastra-ai/mastra/commit/0c0e8d7becd4d1445c656b78d5d845f606c1ff9d), [`9f7c67a`](https://github.com/mastra-ai/mastra/commit/9f7c67abeeb52c41c51a9b5edee60b62afe7cd8d), [`3b65e68`](https://github.com/mastra-ai/mastra/commit/3b65e68d7f1c771c7a70eea42d83fefdd28cad88), [`e3868e2`](https://github.com/mastra-ai/mastra/commit/e3868e22babfffd0133771669ca724501c2dd58e)]:
|
|
256
|
+
- @mastra/core@1.52.0-alpha.5
|
|
257
|
+
- @mastra/deployer@1.52.0-alpha.5
|
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,104 @@
|
|
|
1
|
+
# @mastra/deployer-sandbox
|
|
2
|
+
|
|
3
|
+
Deploy a full Mastra server or a non-HTTP worker into a workspace sandbox.
|
|
4
|
+
|
|
5
|
+
Server deployments work with any `WorkspaceSandbox` provider that implements `executeCommand` and `networking`. Worker deployments require only `executeCommand`; they do not allocate ports, ingress, public URLs, or HTTP health checks. Positioning: **ephemeral environments** — instant previews, PR/CI smoke deploys, isolated jobs, agent-built-app verification, and multi-tenant untrusted instances. Not production hosting.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
// src/mastra/index.ts
|
|
11
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
12
|
+
import { SandboxDeployer } from '@mastra/deployer-sandbox';
|
|
13
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
14
|
+
|
|
15
|
+
const deployer = new SandboxDeployer({
|
|
16
|
+
sandbox: new VercelSandbox({
|
|
17
|
+
sandboxName: 'my-preview', // identity: redeploys resume this sandbox
|
|
18
|
+
timeout: 3_600_000,
|
|
19
|
+
ports: [4111],
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const mastra = new Mastra({
|
|
24
|
+
// ...
|
|
25
|
+
deployer,
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
mastra build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`mastra build` bundles the project and deploys it into the sandbox in one step, printing the live API and Studio URLs.
|
|
34
|
+
|
|
35
|
+
Manage the deployment afterward with `getDeployment()` from the server-only `client` export — the sandbox name is the identity, so this works from any process or codebase:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { getDeployment } from '@mastra/deployer-sandbox/client';
|
|
39
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
40
|
+
|
|
41
|
+
const dep = await getDeployment({
|
|
42
|
+
sandbox: new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] }),
|
|
43
|
+
}); // never wakes a stopped sandbox
|
|
44
|
+
console.log(dep.status, dep.url);
|
|
45
|
+
await dep.stop(); // snapshot-stop (resumable)
|
|
46
|
+
await dep.destroy(); // permanent delete
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Provider tooling works too (for example `vercel sandbox ls|stop|rm`).
|
|
50
|
+
|
|
51
|
+
One-shot programmatic deploy (CI / agents), no bundler — takes a prebuilt output dir:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { deployToSandbox } from '@mastra/deployer-sandbox';
|
|
55
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
56
|
+
|
|
57
|
+
const sandbox = new VercelSandbox({ sandboxName: 'ci-preview', ports: [4111] });
|
|
58
|
+
const deployment = await deployToSandbox({ sandbox, dir: '.mastra/output', port: 4111 });
|
|
59
|
+
console.log(deployment.url);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Non-HTTP workers and custom commands
|
|
63
|
+
|
|
64
|
+
Deploy a prebuilt worker artifact without requiring networking. The command, arguments, working directory, and install command are trusted developer-authored inputs. The deployer preserves the artifact layout rather than assuming a Mastra-specific entrypoint or process protocol.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { deployWorkerToSandbox } from '@mastra/deployer-sandbox';
|
|
68
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
69
|
+
|
|
70
|
+
const worker = await deployWorkerToSandbox({
|
|
71
|
+
sandbox: new VercelSandbox({ sandboxName: 'experiment-worker' }),
|
|
72
|
+
dir: '.mastra/experiment-worker',
|
|
73
|
+
executionId: 'attempt-1',
|
|
74
|
+
mode: 'job',
|
|
75
|
+
command: 'node',
|
|
76
|
+
args: ['index.mjs'],
|
|
77
|
+
env: { JOB_ID: 'job-123' },
|
|
78
|
+
input: { type: 'stdin', data: JSON.stringify({ requestId: 'request-123' }) },
|
|
79
|
+
startupTimeoutMs: 10_000,
|
|
80
|
+
executionTimeoutMs: 15 * 60_000,
|
|
81
|
+
terminationGraceMs: 5_000,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const stdout = await worker.readOutput('stdout', { offset: 0, maxBytes: 64 * 1024 });
|
|
85
|
+
const stderr = await worker.readOutput('stderr', { offset: 0, maxBytes: 64 * 1024 });
|
|
86
|
+
console.log(await worker.status(), stdout, stderr);
|
|
87
|
+
await worker.cancel();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Each caller-provided execution ID gets isolated runtime state. Input is bounded and may be delivered through stdin or staged at an artifact-relative file path. Stdout and stderr remain separate and are read as raw bytes with offsets, EOF, truncation, and interruption metadata; the deployer does not interpret their protocol.
|
|
91
|
+
|
|
92
|
+
Dependency installs are serialized and cached using the artifact's `package.json`, supported lockfiles, and install command. `cancel()` sends TERM and then KILL to the process group when necessary. `stop()` snapshot-stops the provider sandbox without assuming process preservation. `relaunch({ executionId })` starts the recorded command under a new execution identity. `destroy()` retries permanent sandbox deletion and returns a typed result.
|
|
93
|
+
|
|
94
|
+
Pass `wake: true` to resume a stopped server sandbox before returning — useful in a route handler that fronts the sandbox. If the server isn't healthy after the resume (some providers restore the filesystem but not processes), the wake relaunches it:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { getDeployment } from '@mastra/deployer-sandbox/client';
|
|
98
|
+
import { VercelSandbox } from '@mastra/vercel';
|
|
99
|
+
|
|
100
|
+
const sandbox = new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] });
|
|
101
|
+
const dep = await getDeployment({ sandbox, wake: true });
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
See the Mastra docs for lifecycle, routing tiers, and security notes.
|
package/dist/alias.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SandboxAliasOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Upsert a Vercel Edge Config item so a stable key always points at the
|
|
4
|
+
* current sandbox URL. Used for Tier 3 routing: apps read the key from Edge
|
|
5
|
+
* Config (e.g. in middleware) instead of hardcoding the rotating sandbox URL.
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateEdgeConfigAlias(options: SandboxAliasOptions & {
|
|
8
|
+
url: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=alias.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.d.ts","sourceRoot":"","sources":["../src/alias.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BzG"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_shared = require("../shared-H9GioaPM.cjs");
|
|
3
|
+
let _mastra_core_workspace = require("@mastra/core/workspace");
|
|
4
|
+
//#region src/client/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Runtime resolver + routing helpers for sandbox deployments.
|
|
7
|
+
*
|
|
8
|
+
* SERVER-ONLY. This module resolves sandbox URLs using provider credentials
|
|
9
|
+
* (e.g. VERCEL_TOKEN) — importing it in the browser would ship those
|
|
10
|
+
* credentials to the client. Use the proxy/handler patterns instead so the
|
|
11
|
+
* browser only ever talks to your own domain.
|
|
12
|
+
*/
|
|
13
|
+
function assertServerOnly() {
|
|
14
|
+
if (typeof globalThis.window !== "undefined") throw new Error("@mastra/deployer-sandbox/client is server-only: resolving a sandbox requires provider credentials that must never reach the browser. Proxy requests through your own backend instead (see createSandboxHandler / createSandboxProxy).");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve (and optionally wake) a sandbox deployment.
|
|
18
|
+
*
|
|
19
|
+
* With `wake: false` (default) the sandbox is not started: the URL is resolved
|
|
20
|
+
* only if the sandbox is already running in this process, otherwise
|
|
21
|
+
* `{ url: null, status: 'stopped' | 'unknown' }` is returned and the caller
|
|
22
|
+
* decides whether to wake.
|
|
23
|
+
*
|
|
24
|
+
* With `wake: true` the sandbox is started (providers resume by identity,
|
|
25
|
+
* e.g. name), the server is relaunched if it is not answering, and the
|
|
26
|
+
* deployment is returned once healthy.
|
|
27
|
+
*/
|
|
28
|
+
async function getDeployment(options) {
|
|
29
|
+
assertServerOnly();
|
|
30
|
+
const { sandbox, port = require_shared.DEFAULT_PORT, wake = false, healthCheckPath = "/api", healthCheckTimeoutMs = 6e4 } = options;
|
|
31
|
+
const handle = (url, status, expiresAt) => ({
|
|
32
|
+
url,
|
|
33
|
+
status,
|
|
34
|
+
expiresAt,
|
|
35
|
+
stop: async () => {
|
|
36
|
+
await sandbox.stop?.();
|
|
37
|
+
},
|
|
38
|
+
destroy: async () => {
|
|
39
|
+
await sandbox.destroy?.();
|
|
40
|
+
},
|
|
41
|
+
logs: async (lines) => require_shared.tailServerLog(sandbox, await require_shared.resolveRemoteDir(sandbox, options.remoteDir), lines)
|
|
42
|
+
});
|
|
43
|
+
if (!wake) {
|
|
44
|
+
const url = (0, _mastra_core_workspace.supportsNetworking)(sandbox) ? await sandbox.networking.getPortUrl(port) : null;
|
|
45
|
+
if (!url) return handle(null, "stopped");
|
|
46
|
+
return handle(url, await require_shared.waitForHealthy(url, {
|
|
47
|
+
path: healthCheckPath,
|
|
48
|
+
timeoutMs: 3e3,
|
|
49
|
+
intervalMs: 1e3
|
|
50
|
+
}) ? "running" : "stopped");
|
|
51
|
+
}
|
|
52
|
+
await sandbox.start?.();
|
|
53
|
+
if (!(0, _mastra_core_workspace.supportsNetworking)(sandbox)) throw new Error(`Sandbox provider "${sandbox.provider}" does not support networking (public port URLs).`);
|
|
54
|
+
const url = await sandbox.networking.getPortUrl(port);
|
|
55
|
+
if (!url) throw new Error(`Sandbox provider "${sandbox.provider}" did not expose a public URL for port ${port}. Make sure the port is declared when constructing the sandbox (e.g. \`ports: [${port}]\`).`);
|
|
56
|
+
let healthy = await require_shared.waitForHealthy(url, {
|
|
57
|
+
path: healthCheckPath,
|
|
58
|
+
timeoutMs: 3e3,
|
|
59
|
+
intervalMs: 1e3
|
|
60
|
+
});
|
|
61
|
+
if (!healthy) {
|
|
62
|
+
const remoteDir = await require_shared.resolveRemoteDir(sandbox, options.remoteDir);
|
|
63
|
+
await require_shared.killPreviousServer(sandbox, remoteDir);
|
|
64
|
+
await require_shared.launchServer(sandbox, remoteDir);
|
|
65
|
+
healthy = await require_shared.waitForHealthy(url, {
|
|
66
|
+
path: healthCheckPath,
|
|
67
|
+
timeoutMs: healthCheckTimeoutMs,
|
|
68
|
+
intervalMs: 1e3
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (!healthy) {
|
|
72
|
+
const log = await require_shared.resolveRemoteDir(sandbox, options.remoteDir).then((dir) => require_shared.tailServerLog(sandbox, dir)).catch(() => "");
|
|
73
|
+
throw new Error(`Woke sandbox but the Mastra server did not become healthy at ${url}${healthCheckPath}.` + (log ? `\n\nServer log:\n${log}` : ""));
|
|
74
|
+
}
|
|
75
|
+
return handle(url, "running", (await require_shared.getInfoSafe(sandbox))?.timeoutAt);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Framework-free route-handler proxy (fetch `Request` → `Response`). Mount it
|
|
79
|
+
* as a catch-all API route; the browser only ever sees your own domain, and
|
|
80
|
+
* the sandbox URL (which rotates across resumes) stays server-side.
|
|
81
|
+
*/
|
|
82
|
+
function createSandboxHandler(options) {
|
|
83
|
+
assertServerOnly();
|
|
84
|
+
let cachedUrl = null;
|
|
85
|
+
const forward = async (request, baseUrl) => {
|
|
86
|
+
const incoming = new URL(request.url);
|
|
87
|
+
const target = new URL(incoming.pathname + incoming.search, baseUrl);
|
|
88
|
+
const headers = new Headers(request.headers);
|
|
89
|
+
headers.delete("host");
|
|
90
|
+
if (options.secret) headers.set("x-mastra-sandbox-secret", options.secret);
|
|
91
|
+
const response = await fetch(target, {
|
|
92
|
+
method: request.method,
|
|
93
|
+
headers,
|
|
94
|
+
body: request.body,
|
|
95
|
+
duplex: "half",
|
|
96
|
+
redirect: "manual"
|
|
97
|
+
});
|
|
98
|
+
const location = response.headers.get("location");
|
|
99
|
+
if (location) {
|
|
100
|
+
const resolved = new URL(location, target);
|
|
101
|
+
if (resolved.origin === new URL(baseUrl).origin) {
|
|
102
|
+
const rewritten = new URL(resolved.pathname + resolved.search + resolved.hash, incoming.origin);
|
|
103
|
+
const responseHeaders = new Headers(response.headers);
|
|
104
|
+
responseHeaders.set("location", rewritten.toString());
|
|
105
|
+
return new Response(response.body, {
|
|
106
|
+
status: response.status,
|
|
107
|
+
statusText: response.statusText,
|
|
108
|
+
headers: responseHeaders
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return response;
|
|
113
|
+
};
|
|
114
|
+
return async (request) => {
|
|
115
|
+
cachedUrl ??= options.resolve();
|
|
116
|
+
try {
|
|
117
|
+
return await forward(request, await cachedUrl);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
cachedUrl = null;
|
|
120
|
+
if (![
|
|
121
|
+
"GET",
|
|
122
|
+
"HEAD",
|
|
123
|
+
"OPTIONS"
|
|
124
|
+
].includes(request.method)) throw error;
|
|
125
|
+
cachedUrl = options.resolve();
|
|
126
|
+
try {
|
|
127
|
+
return await forward(request, await cachedUrl);
|
|
128
|
+
} catch (retryError) {
|
|
129
|
+
cachedUrl = null;
|
|
130
|
+
throw retryError;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Next.js middleware helper for Tier 3 routing: reads the current sandbox URL
|
|
137
|
+
* from Edge Config (kept fresh by the deployer's `alias` option) and rewrites
|
|
138
|
+
* the request to it. Returns `undefined` when no URL is configured so the
|
|
139
|
+
* request falls through.
|
|
140
|
+
*
|
|
141
|
+
* ```typescript
|
|
142
|
+
* // middleware.ts
|
|
143
|
+
* export const middleware = createSandboxProxy({ key: 'my-preview' });
|
|
144
|
+
* export const config = { matcher: '/api/:path*' };
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
function createSandboxProxy(options) {
|
|
148
|
+
assertServerOnly();
|
|
149
|
+
return async (request) => {
|
|
150
|
+
const connection = options.edgeConfig ?? process.env.EDGE_CONFIG;
|
|
151
|
+
if (!connection) throw new Error("createSandboxProxy requires an Edge Config connection string (EDGE_CONFIG).");
|
|
152
|
+
const conn = new URL(connection);
|
|
153
|
+
const token = conn.searchParams.get("token");
|
|
154
|
+
const itemUrl = new URL(`${conn.origin}${conn.pathname}/item/${encodeURIComponent(options.key)}`);
|
|
155
|
+
const res = await fetch(itemUrl, { headers: { Authorization: `Bearer ${token}` } });
|
|
156
|
+
if (!res.ok) return;
|
|
157
|
+
const sandboxUrl = await res.json();
|
|
158
|
+
if (typeof sandboxUrl !== "string" || !sandboxUrl) return;
|
|
159
|
+
const incoming = new URL(request.url);
|
|
160
|
+
const target = new URL(incoming.pathname + incoming.search, sandboxUrl);
|
|
161
|
+
const headers = new Headers({ "x-middleware-rewrite": target.toString() });
|
|
162
|
+
if (options.secret) {
|
|
163
|
+
headers.set("x-middleware-request-x-mastra-sandbox-secret", options.secret);
|
|
164
|
+
headers.set("x-middleware-override-headers", "x-mastra-sandbox-secret");
|
|
165
|
+
}
|
|
166
|
+
return new Response(null, { headers });
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
exports.createSandboxHandler = createSandboxHandler;
|
|
171
|
+
exports.createSandboxProxy = createSandboxProxy;
|
|
172
|
+
exports.getDeployment = getDeployment;
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["DEFAULT_PORT","tailServerLog","resolveRemoteDir","waitForHealthy","killPreviousServer","launchServer","getInfoSafe"],"sources":["../../src/client/index.ts"],"sourcesContent":["/**\n * Runtime resolver + routing helpers for sandbox deployments.\n *\n * SERVER-ONLY. This module resolves sandbox URLs using provider credentials\n * (e.g. VERCEL_TOKEN) — importing it in the browser would ship those\n * credentials to the client. Use the proxy/handler patterns instead so the\n * browser only ever talks to your own domain.\n */\nimport { supportsNetworking } from '@mastra/core/workspace';\nimport type { WorkspaceSandbox } from '@mastra/core/workspace';\nimport {\n DEFAULT_PORT,\n getInfoSafe,\n killPreviousServer,\n launchServer,\n resolveRemoteDir,\n tailServerLog,\n waitForHealthy,\n} from '../shared';\n\nfunction assertServerOnly(): void {\n if (typeof (globalThis as { window?: unknown }).window !== 'undefined') {\n throw new Error(\n '@mastra/deployer-sandbox/client is server-only: resolving a sandbox requires provider credentials ' +\n 'that must never reach the browser. Proxy requests through your own backend instead ' +\n '(see createSandboxHandler / createSandboxProxy).',\n );\n }\n}\n\nexport type DeploymentStatus = 'running' | 'stopped' | 'unknown';\n\nexport interface GetDeploymentOptions {\n /**\n * The sandbox to resolve. Provider construction is identity — e.g.\n * `new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] })` resolves\n * the same sandbox from any process.\n */\n sandbox: WorkspaceSandbox;\n /** Port the Mastra server listens on. Defaults to 4111. */\n port?: number;\n /**\n * Wake the sandbox when it is not running. Waking starts (resumes) the\n * sandbox and, only if the server is not answering, relaunches it from the\n * recorded launch script — some providers (e.g. E2B) resume processes on\n * wake, others (e.g. Vercel) restore just the filesystem. Defaults to false.\n */\n wake?: boolean;\n /** Directory the app was deployed into. Defaults to `$HOME/mastra-app` resolved inside the sandbox. */\n remoteDir?: string;\n /** Path polled for health. Defaults to `/api`. */\n healthCheckPath?: string;\n /** Max time to wait for health after a wake, in ms. Defaults to 60000. */\n healthCheckTimeoutMs?: number;\n}\n\nexport interface ResolvedDeployment {\n /** Public URL of the Mastra server, or null when it could not be resolved without waking. */\n url: string | null;\n status: DeploymentStatus;\n /** When the sandbox will auto-shutdown (when known). */\n expiresAt?: Date;\n stop(): Promise<void>;\n destroy(): Promise<void>;\n logs(lines?: number): Promise<string>;\n}\n\n/**\n * Resolve (and optionally wake) a sandbox deployment.\n *\n * With `wake: false` (default) the sandbox is not started: the URL is resolved\n * only if the sandbox is already running in this process, otherwise\n * `{ url: null, status: 'stopped' | 'unknown' }` is returned and the caller\n * decides whether to wake.\n *\n * With `wake: true` the sandbox is started (providers resume by identity,\n * e.g. name), the server is relaunched if it is not answering, and the\n * deployment is returned once healthy.\n */\nexport async function getDeployment(options: GetDeploymentOptions): Promise<ResolvedDeployment> {\n assertServerOnly();\n\n const {\n sandbox,\n port = DEFAULT_PORT,\n wake = false,\n healthCheckPath = '/api',\n healthCheckTimeoutMs = 60_000,\n } = options;\n\n const handle = (url: string | null, status: DeploymentStatus, expiresAt?: Date): ResolvedDeployment => ({\n url,\n status,\n expiresAt,\n stop: async () => {\n await sandbox.stop?.();\n },\n destroy: async () => {\n await sandbox.destroy?.();\n },\n // Resolved lazily — reading logs requires a running sandbox anyway.\n logs: async (lines?: number) => tailServerLog(sandbox, await resolveRemoteDir(sandbox, options.remoteDir), lines),\n });\n\n if (!wake) {\n // Resolve without starting the sandbox (starting can resume billing).\n const url = supportsNetworking(sandbox) ? await sandbox.networking.getPortUrl(port) : null;\n if (!url) {\n return handle(null, 'stopped');\n }\n const healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: 3_000, intervalMs: 1_000 });\n return handle(url, healthy ? 'running' : 'stopped');\n }\n\n await sandbox.start?.();\n\n if (!supportsNetworking(sandbox)) {\n throw new Error(`Sandbox provider \"${sandbox.provider}\" does not support networking (public port URLs).`);\n }\n const url = await sandbox.networking.getPortUrl(port);\n if (!url) {\n throw new Error(\n `Sandbox provider \"${sandbox.provider}\" did not expose a public URL for port ${port}. ` +\n `Make sure the port is declared when constructing the sandbox (e.g. \\`ports: [${port}]\\`).`,\n );\n }\n\n // Some providers (e.g. Vercel) restore the filesystem but not processes on\n // resume, while others (e.g. E2B) resume processes too — relaunch the server\n // from the recorded launch script only when it is not answering.\n let healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: 3_000, intervalMs: 1_000 });\n if (!healthy) {\n const remoteDir = await resolveRemoteDir(sandbox, options.remoteDir);\n await killPreviousServer(sandbox, remoteDir);\n await launchServer(sandbox, remoteDir);\n healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: healthCheckTimeoutMs, intervalMs: 1_000 });\n }\n if (!healthy) {\n const log = await resolveRemoteDir(sandbox, options.remoteDir)\n .then(dir => tailServerLog(sandbox, dir))\n .catch(() => '');\n throw new Error(\n `Woke sandbox but the Mastra server did not become healthy at ${url}${healthCheckPath}.` +\n (log ? `\\n\\nServer log:\\n${log}` : ''),\n );\n }\n\n const info = await getInfoSafe(sandbox);\n return handle(url, 'running', info?.timeoutAt);\n}\n\n// =============================================================================\n// Tier 3 helpers\n// =============================================================================\n\nexport interface CreateSandboxHandlerOptions {\n /**\n * Resolve the current sandbox URL. Called once, cached, and re-invoked when\n * a forwarded request fails at the network level (e.g. the sandbox rotated\n * its URL or went to sleep). Typically wraps `getDeployment`:\n *\n * ```typescript\n * createSandboxHandler({\n * resolve: async () => {\n * const dep = await getDeployment({ sandbox, wake: true });\n * return dep.url!;\n * },\n * });\n * ```\n */\n resolve: () => Promise<string>;\n /** Shared secret attached as the `x-mastra-sandbox-secret` header on forwarded requests. */\n secret?: string;\n}\n\n/**\n * Framework-free route-handler proxy (fetch `Request` → `Response`). Mount it\n * as a catch-all API route; the browser only ever sees your own domain, and\n * the sandbox URL (which rotates across resumes) stays server-side.\n */\nexport function createSandboxHandler(options: CreateSandboxHandlerOptions): (request: Request) => Promise<Response> {\n assertServerOnly();\n\n let cachedUrl: Promise<string> | null = null;\n\n const forward = async (request: Request, baseUrl: string): Promise<Response> => {\n const incoming = new URL(request.url);\n const target = new URL(incoming.pathname + incoming.search, baseUrl);\n\n const headers = new Headers(request.headers);\n headers.delete('host');\n if (options.secret) {\n headers.set('x-mastra-sandbox-secret', options.secret);\n }\n\n const response = await fetch(target, {\n method: request.method,\n headers,\n body: request.body,\n // duplex is required by Node's fetch for streamed request bodies\n duplex: 'half',\n redirect: 'manual',\n } as RequestInit);\n\n // Redirects are passed through manually — rewrite sandbox-host Locations\n // onto the incoming origin so the rotating sandbox URL never reaches the\n // browser (and subsequent requests keep flowing through this handler).\n const location = response.headers.get('location');\n if (location) {\n const resolved = new URL(location, target);\n if (resolved.origin === new URL(baseUrl).origin) {\n const rewritten = new URL(resolved.pathname + resolved.search + resolved.hash, incoming.origin);\n const responseHeaders = new Headers(response.headers);\n responseHeaders.set('location', rewritten.toString());\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n });\n }\n }\n\n return response;\n };\n\n return async (request: Request): Promise<Response> => {\n cachedUrl ??= options.resolve();\n\n try {\n return await forward(request, await cachedUrl);\n } catch (error) {\n // Connection-level failure: the sandbox may have rotated its URL or gone\n // to sleep. Drop the cached URL so the next request re-resolves, and\n // retry once — but only for idempotent, bodyless methods. A failed\n // connection doesn't prove a write never landed, and a streamed body is\n // already consumed.\n cachedUrl = null;\n if (!['GET', 'HEAD', 'OPTIONS'].includes(request.method)) {\n throw error;\n }\n cachedUrl = options.resolve();\n try {\n return await forward(request, await cachedUrl);\n } catch (retryError) {\n cachedUrl = null;\n throw retryError;\n }\n }\n };\n}\n\nexport interface CreateSandboxProxyOptions {\n /** Edge Config item key that holds the current sandbox URL. */\n key: string;\n /**\n * Edge Config connection string (`https://edge-config.vercel.com/ecfg_...?token=...`).\n * Defaults to `process.env.EDGE_CONFIG`.\n */\n edgeConfig?: string;\n /** Shared secret attached as the `x-mastra-sandbox-secret` header on the rewrite. */\n secret?: string;\n}\n\n/**\n * Next.js middleware helper for Tier 3 routing: reads the current sandbox URL\n * from Edge Config (kept fresh by the deployer's `alias` option) and rewrites\n * the request to it. Returns `undefined` when no URL is configured so the\n * request falls through.\n *\n * ```typescript\n * // middleware.ts\n * export const middleware = createSandboxProxy({ key: 'my-preview' });\n * export const config = { matcher: '/api/:path*' };\n * ```\n */\nexport function createSandboxProxy(\n options: CreateSandboxProxyOptions,\n): (request: Request) => Promise<Response | undefined> {\n // Reads (and would transmit) the Edge Config bearer token — same\n // server-only contract as the rest of this module.\n assertServerOnly();\n\n return async (request: Request): Promise<Response | undefined> => {\n const connection = options.edgeConfig ?? process.env.EDGE_CONFIG;\n if (!connection) {\n throw new Error('createSandboxProxy requires an Edge Config connection string (EDGE_CONFIG).');\n }\n\n const conn = new URL(connection);\n const token = conn.searchParams.get('token');\n const itemUrl = new URL(`${conn.origin}${conn.pathname}/item/${encodeURIComponent(options.key)}`);\n\n const res = await fetch(itemUrl, { headers: { Authorization: `Bearer ${token}` } });\n if (!res.ok) {\n return undefined;\n }\n const sandboxUrl: unknown = await res.json();\n if (typeof sandboxUrl !== 'string' || !sandboxUrl) {\n return undefined;\n }\n\n const incoming = new URL(request.url);\n const target = new URL(incoming.pathname + incoming.search, sandboxUrl);\n\n // A Response with the x-middleware-rewrite header is how Next.js\n // middleware expresses a rewrite (NextResponse.rewrite does the same) —\n // this keeps the helper free of a next dependency.\n const headers = new Headers({ 'x-middleware-rewrite': target.toString() });\n if (options.secret) {\n headers.set('x-middleware-request-x-mastra-sandbox-secret', options.secret);\n headers.set('x-middleware-override-headers', 'x-mastra-sandbox-secret');\n }\n return new Response(null, { headers });\n };\n}\n"],"mappings":"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"}
|