@ai-sdk/sandbox-vercel 0.0.0-07500555-20260730161446

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 ADDED
@@ -0,0 +1,484 @@
1
+ # @ai-sdk/sandbox-vercel
2
+
3
+ ## 0.0.0-07500555-20260730161446
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [5f65e61]
8
+ - @ai-sdk/harness@0.0.0-07500555-20260730161446
9
+ - @ai-sdk/provider-utils@0.0.0-07500555-20260730161446
10
+
11
+ ## 1.0.39
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [86a84c9]
16
+ - @ai-sdk/harness@1.0.39
17
+
18
+ ## 1.0.38
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [02ffdcb]
23
+ - Updated dependencies [76cb673]
24
+ - @ai-sdk/provider-utils@5.0.12
25
+ - @ai-sdk/harness@1.0.38
26
+
27
+ ## 1.0.37
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [b460541]
32
+ - Updated dependencies [079591e]
33
+ - @ai-sdk/harness@1.0.37
34
+
35
+ ## 1.0.36
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [cd06458]
40
+ - @ai-sdk/provider-utils@5.0.11
41
+ - @ai-sdk/harness@1.0.36
42
+
43
+ ## 1.0.35
44
+
45
+ ### Patch Changes
46
+
47
+ - @ai-sdk/harness@1.0.35
48
+
49
+ ## 1.0.34
50
+
51
+ ### Patch Changes
52
+
53
+ - @ai-sdk/harness@1.0.34
54
+
55
+ ## 1.0.33
56
+
57
+ ### Patch Changes
58
+
59
+ - @ai-sdk/harness@1.0.33
60
+
61
+ ## 1.0.32
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [31c7be8]
66
+ - @ai-sdk/provider-utils@5.0.10
67
+ - @ai-sdk/harness@1.0.32
68
+
69
+ ## 1.0.31
70
+
71
+ ### Patch Changes
72
+
73
+ - @ai-sdk/harness@1.0.31
74
+
75
+ ## 1.0.30
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [4be62c1]
80
+ - Updated dependencies [7805e4a]
81
+ - Updated dependencies [cd12954]
82
+ - @ai-sdk/provider-utils@5.0.9
83
+ - @ai-sdk/harness@1.0.30
84
+
85
+ ## 1.0.29
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies [e193290]
90
+ - @ai-sdk/provider-utils@5.0.8
91
+ - @ai-sdk/harness@1.0.29
92
+
93
+ ## 1.0.28
94
+
95
+ ### Patch Changes
96
+
97
+ - @ai-sdk/harness@1.0.28
98
+
99
+ ## 1.0.27
100
+
101
+ ### Patch Changes
102
+
103
+ - @ai-sdk/harness@1.0.27
104
+
105
+ ## 1.0.26
106
+
107
+ ### Patch Changes
108
+
109
+ - 7312d30: fix(sandbox-vercel): forward Vercel Sandbox credentials when resuming named harness sessions
110
+ - @ai-sdk/harness@1.0.26
111
+
112
+ ## 1.0.25
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [44e988a]
117
+ - @ai-sdk/harness@1.0.25
118
+
119
+ ## 1.0.24
120
+
121
+ ### Patch Changes
122
+
123
+ - @ai-sdk/harness@1.0.24
124
+
125
+ ## 1.0.23
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies [39c8276]
130
+ - Updated dependencies [91fe6d8]
131
+ - Updated dependencies [0be5014]
132
+ - @ai-sdk/harness@1.0.23
133
+
134
+ ## 1.0.22
135
+
136
+ ### Patch Changes
137
+
138
+ - @ai-sdk/harness@1.0.22
139
+ - @ai-sdk/provider-utils@5.0.7
140
+
141
+ ## 1.0.21
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [ac306ed]
146
+ - @ai-sdk/provider-utils@5.0.6
147
+ - @ai-sdk/harness@1.0.21
148
+
149
+ ## 1.0.20
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies [b7aa06a]
154
+ - @ai-sdk/harness@1.0.20
155
+
156
+ ## 1.0.19
157
+
158
+ ### Patch Changes
159
+
160
+ - @ai-sdk/harness@1.0.19
161
+
162
+ ## 1.0.18
163
+
164
+ ### Patch Changes
165
+
166
+ - @ai-sdk/harness@1.0.18
167
+
168
+ ## 1.0.17
169
+
170
+ ### Patch Changes
171
+
172
+ - Updated dependencies [5c5c0f5]
173
+ - @ai-sdk/provider-utils@5.0.5
174
+ - @ai-sdk/harness@1.0.17
175
+
176
+ ## 1.0.16
177
+
178
+ ### Patch Changes
179
+
180
+ - @ai-sdk/harness@1.0.16
181
+
182
+ ## 1.0.15
183
+
184
+ ### Patch Changes
185
+
186
+ - Updated dependencies [c6f5e62]
187
+ - @ai-sdk/provider-utils@5.0.4
188
+ - @ai-sdk/harness@1.0.15
189
+
190
+ ## 1.0.14
191
+
192
+ ### Patch Changes
193
+
194
+ - @ai-sdk/harness@1.0.14
195
+
196
+ ## 1.0.13
197
+
198
+ ### Patch Changes
199
+
200
+ - Updated dependencies [8c616f0]
201
+ - @ai-sdk/provider-utils@5.0.3
202
+ - @ai-sdk/harness@1.0.13
203
+
204
+ ## 1.0.12
205
+
206
+ ### Patch Changes
207
+
208
+ - Updated dependencies [7859cea]
209
+ - Updated dependencies [c857346]
210
+ - @ai-sdk/harness@1.0.12
211
+
212
+ ## 1.0.11
213
+
214
+ ### Patch Changes
215
+
216
+ - @ai-sdk/harness@1.0.11
217
+
218
+ ## 1.0.10
219
+
220
+ ### Patch Changes
221
+
222
+ - @ai-sdk/harness@1.0.10
223
+ - @ai-sdk/provider-utils@5.0.2
224
+
225
+ ## 1.0.9
226
+
227
+ ### Patch Changes
228
+
229
+ - @ai-sdk/harness@1.0.9
230
+
231
+ ## 1.0.8
232
+
233
+ ### Patch Changes
234
+
235
+ - @ai-sdk/harness@1.0.8
236
+
237
+ ## 1.0.7
238
+
239
+ ### Patch Changes
240
+
241
+ - @ai-sdk/harness@1.0.7
242
+
243
+ ## 1.0.6
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [6a436e3]
248
+ - @ai-sdk/provider-utils@5.0.1
249
+ - @ai-sdk/harness@1.0.6
250
+
251
+ ## 1.0.5
252
+
253
+ ### Patch Changes
254
+
255
+ - @ai-sdk/harness@1.0.5
256
+
257
+ ## 1.0.4
258
+
259
+ ### Patch Changes
260
+
261
+ - Updated dependencies [c493634]
262
+ - @ai-sdk/harness@1.0.4
263
+
264
+ ## 1.0.3
265
+
266
+ ### Patch Changes
267
+
268
+ - Updated dependencies [51d10a0]
269
+ - @ai-sdk/harness@1.0.3
270
+
271
+ ## 1.0.2
272
+
273
+ ### Patch Changes
274
+
275
+ - @ai-sdk/harness@1.0.2
276
+
277
+ ## 1.0.1
278
+
279
+ ### Patch Changes
280
+
281
+ - @ai-sdk/harness@1.0.1
282
+
283
+ ## 1.0.0
284
+
285
+ ### Major Changes
286
+
287
+ - 9d6dbe0: feat(harness): add sandbox specific expansion for harness abstraction, add `sandbox-just-bash` and `sandbox-vercel`
288
+
289
+ ### Patch Changes
290
+
291
+ - 6c7a3e5: Start the `1.0.0` canary release line for the experimental harness and sandbox packages. They were unintentionally published as `0.0.0-canary.*` because they were scaffolded with a `0.0.0-canary.0` premajor version, which semver could not advance past on a major bump.
292
+ - b8396f0: trigger initial beta release
293
+ - e551763: fix(harness): avoid using peer dependencies for underlying harness and sandbox SDKs
294
+
295
+ ## 1.0.0-beta.27
296
+
297
+ ### Patch Changes
298
+
299
+ - @ai-sdk/harness@1.0.0-beta.27
300
+
301
+ ## 1.0.0-beta.26
302
+
303
+ ### Patch Changes
304
+
305
+ - Updated dependencies [a83a367]
306
+ - @ai-sdk/harness@1.0.0-beta.26
307
+
308
+ ## 1.0.0-beta.25
309
+
310
+ ### Patch Changes
311
+
312
+ - @ai-sdk/harness@1.0.0-beta.25
313
+
314
+ ## 1.0.0-beta.24
315
+
316
+ ### Patch Changes
317
+
318
+ - @ai-sdk/harness@1.0.0-beta.24
319
+
320
+ ## 1.0.0-beta.23
321
+
322
+ ### Patch Changes
323
+
324
+ - Updated dependencies [57e0a59]
325
+ - @ai-sdk/harness@1.0.0-beta.23
326
+
327
+ ## 1.0.0-beta.22
328
+
329
+ ### Patch Changes
330
+
331
+ - @ai-sdk/harness@1.0.0-beta.22
332
+ - @ai-sdk/provider-utils@5.0.0-beta.50
333
+
334
+ ## 1.0.0-beta.21
335
+
336
+ ### Patch Changes
337
+
338
+ - @ai-sdk/harness@1.0.0-beta.21
339
+
340
+ ## 1.0.0-beta.20
341
+
342
+ ### Patch Changes
343
+
344
+ - Updated dependencies [e5d4a24]
345
+ - @ai-sdk/harness@1.0.0-beta.20
346
+
347
+ ## 1.0.0-beta.19
348
+
349
+ ### Patch Changes
350
+
351
+ - @ai-sdk/harness@1.0.0-beta.19
352
+
353
+ ## 1.0.0-beta.18
354
+
355
+ ### Patch Changes
356
+
357
+ - @ai-sdk/harness@1.0.0-beta.18
358
+
359
+ ## 1.0.0-beta.17
360
+
361
+ ### Patch Changes
362
+
363
+ - Updated dependencies [534dac6]
364
+ - @ai-sdk/harness@1.0.0-beta.17
365
+
366
+ ## 1.0.0-beta.16
367
+
368
+ ### Patch Changes
369
+
370
+ - @ai-sdk/harness@1.0.0-beta.16
371
+
372
+ ## 1.0.0-beta.15
373
+
374
+ ### Patch Changes
375
+
376
+ - @ai-sdk/harness@1.0.0-beta.15
377
+
378
+ ## 1.0.0-beta.14
379
+
380
+ ### Patch Changes
381
+
382
+ - b8396f0: trigger initial beta release
383
+ - Updated dependencies [b8396f0]
384
+ - @ai-sdk/harness@1.0.0-beta.14
385
+ - @ai-sdk/provider-utils@5.0.0-beta.49
386
+
387
+ ## 1.0.0-canary.13
388
+
389
+ ### Patch Changes
390
+
391
+ - @ai-sdk/harness@1.0.0-canary.13
392
+
393
+ ## 1.0.0-canary.12
394
+
395
+ ### Patch Changes
396
+
397
+ - @ai-sdk/harness@1.0.0-canary.12
398
+
399
+ ## 1.0.0-canary.11
400
+
401
+ ### Patch Changes
402
+
403
+ - Updated dependencies [be83911]
404
+ - @ai-sdk/harness@1.0.0-canary.11
405
+
406
+ ## 1.0.0-canary.10
407
+
408
+ ### Patch Changes
409
+
410
+ - @ai-sdk/harness@1.0.0-canary.10
411
+
412
+ ## 1.0.0-canary.9
413
+
414
+ ### Patch Changes
415
+
416
+ - @ai-sdk/harness@1.0.0-canary.9
417
+
418
+ ## 1.0.0-canary.8
419
+
420
+ ### Patch Changes
421
+
422
+ - Updated dependencies [aae0138]
423
+ - @ai-sdk/harness@1.0.0-canary.8
424
+
425
+ ## 1.0.0-canary.7
426
+
427
+ ### Patch Changes
428
+
429
+ - e551763: fix(harness): avoid using peer dependencies for underlying harness and sandbox SDKs
430
+ - Updated dependencies [3d87086]
431
+ - Updated dependencies [aeda373]
432
+ - Updated dependencies [1ea15a3]
433
+ - Updated dependencies [375fdd7]
434
+ - Updated dependencies [b4507d5]
435
+ - @ai-sdk/harness@1.0.0-canary.7
436
+ - @ai-sdk/provider-utils@5.0.0-canary.48
437
+
438
+ ## 1.0.0-canary.6
439
+
440
+ ### Patch Changes
441
+
442
+ - @ai-sdk/harness@1.0.0-canary.6
443
+
444
+ ## 1.0.0-canary.5
445
+
446
+ ### Patch Changes
447
+
448
+ - Updated dependencies [d77bed4]
449
+ - Updated dependencies [bae5e2b]
450
+ - @ai-sdk/harness@1.0.0-canary.5
451
+ - @ai-sdk/provider-utils@5.0.0-canary.47
452
+
453
+ ## 1.0.0-canary.4
454
+
455
+ ### Patch Changes
456
+
457
+ - Updated dependencies [3d9a50c]
458
+ - @ai-sdk/harness@1.0.0-canary.4
459
+
460
+ ## 1.0.0-canary.3
461
+
462
+ ### Patch Changes
463
+
464
+ - Updated dependencies [21d3d60]
465
+ - @ai-sdk/harness@1.0.0-canary.3
466
+
467
+ ## 1.0.0-canary.2
468
+
469
+ ### Patch Changes
470
+
471
+ - 6c7a3e5: Start the `1.0.0` canary release line for the experimental harness and sandbox packages. They were unintentionally published as `0.0.0-canary.*` because they were scaffolded with a `0.0.0-canary.0` premajor version, which semver could not advance past on a major bump.
472
+ - Updated dependencies [6c7a3e5]
473
+ - @ai-sdk/harness@1.0.0-canary.2
474
+
475
+ ## 0.0.0-canary.1
476
+
477
+ ### Major Changes
478
+
479
+ - 9d6dbe0: feat(harness): add sandbox specific expansion for harness abstraction, add `sandbox-just-bash` and `sandbox-vercel`
480
+
481
+ ### Patch Changes
482
+
483
+ - Updated dependencies [9d6dbe0]
484
+ - @ai-sdk/harness@0.0.0-canary.1
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Vercel, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # AI SDK - Vercel Sandbox
2
+
3
+ _This package is **experimental**._
4
+
5
+ `HarnessV1SandboxProvider` implementation for [Vercel Sandbox](https://vercel.com/docs/vercel-sandbox).
6
+
7
+ ## Setup
8
+
9
+ ```bash
10
+ npm i @ai-sdk/sandbox-vercel
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ The factory is synchronous. The returned provider is stable; the actual `@vercel/sandbox` `Sandbox` is created on demand inside `provider.createSession()`.
16
+
17
+ ```ts
18
+ import { createVercelSandbox } from '@ai-sdk/sandbox-vercel';
19
+
20
+ const vercelSandbox = createVercelSandbox({
21
+ runtime: 'node24',
22
+ ports: [3000],
23
+ });
24
+
25
+ const networkSandboxSession = await vercelSandbox.createSession();
26
+ const sandboxSession = networkSandboxSession.restricted();
27
+
28
+ await sandboxSession.writeTextFile({ path: 'hello.txt', content: 'hi' });
29
+
30
+ const { stdout } = await sandboxSession.run({
31
+ command: 'cat hello.txt',
32
+ });
33
+ console.log(stdout); // "hi"
34
+ await networkSandboxSession.stop();
35
+ ```
36
+
37
+ `networkSandboxSession.restricted()` is typed as `Experimental_SandboxSession`, so it's safe to pass to AI SDK tools that accept `experimental_sandbox`. The network sandbox session itself carries the infra surface (`ports`, `getPortUrl`, `setNetworkPolicy`, `stop`) that only the harness should reach for.
38
+
39
+ The flat-field settings are aliased directly from `@vercel/sandbox`'s `Sandbox.create` parameters, so every option Vercel supports — including its native `NetworkPolicy` — is available without re-declaration:
40
+
41
+ ```ts
42
+ const sandbox = createVercelSandbox({
43
+ runtime: 'node24',
44
+ ports: [3000],
45
+ timeout: 10 * 60 * 1000,
46
+ networkPolicy: {
47
+ allow: ['api.example.com'],
48
+ subnets: { deny: ['169.254.169.254/32'] },
49
+ },
50
+ });
51
+ ```
52
+
53
+ To wrap an already-created `@vercel/sandbox` `Sandbox` instead — e.g. when you need credentials or options outside the factory's settings, or you want to share one sandbox across multiple harness sessions — pass it via `sandbox`. Install `@vercel/sandbox` directly if your application imports `Sandbox`. The network sandbox session's `stop()` is a no-op in this case; the caller owns the lifecycle.
54
+
55
+ ```ts
56
+ import { createVercelSandbox } from '@ai-sdk/sandbox-vercel';
57
+ import { Sandbox } from '@vercel/sandbox';
58
+
59
+ const sandbox = createVercelSandbox({
60
+ sandbox: await Sandbox.create({ runtime: 'node24', ports: [3000] }),
61
+ });
62
+ ```
63
+
64
+ ### Mid-session network policy
65
+
66
+ Once the network sandbox session is alive, the host can update outbound network policy on the running sandbox:
67
+
68
+ ```ts
69
+ await networkSandboxSession.setNetworkPolicy?.({
70
+ mode: 'custom',
71
+ allowedHosts: ['api.example.com'],
72
+ deniedCIDRs: ['169.254.169.254/32'],
73
+ });
74
+ ```
75
+
76
+ `HarnessV1NetworkPolicy` is the harness-level abstraction used here. The provider translates it to `@vercel/sandbox`'s native `NetworkPolicy` for enforcement.
@@ -0,0 +1,77 @@
1
+ import { HarnessV1SandboxProvider, HarnessV1NetworkSandboxSession } from '@ai-sdk/harness';
2
+ import { Experimental_SandboxSession } from '@ai-sdk/provider-utils';
3
+ import { Sandbox } from '@vercel/sandbox';
4
+
5
+ /**
6
+ * Flattens an intersection of object types into a single object type so the
7
+ * resolved shape displays as its named properties rather than a chain of
8
+ * `A & B & C`.
9
+ */
10
+ type Prettify<T> = {
11
+ [K in keyof T]: T[K];
12
+ } & {};
13
+ /**
14
+ * Distributes `Omit` across each member of a union instead of collapsing the
15
+ * union to its common keys. `Sandbox.create`'s parameter is a union (a
16
+ * git/tarball/no-source create variant and a snapshot-source create variant),
17
+ * so a plain `Omit` would discard keys absent from any one member (e.g.
18
+ * `runtime`, which the snapshot variant lacks) and merge the `source` shapes.
19
+ * Applying `Omit` per-member preserves every variant intact; the `Prettify`
20
+ * wrapper collapses each member's intersections into a readable object shape.
21
+ */
22
+ type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Prettify<Omit<T, K>> : never;
23
+ /**
24
+ * Parameters forwarded to `@vercel/sandbox`'s `Sandbox.create` when creating
25
+ * a sandbox from scratch. Aliased directly from the underlying SDK so the
26
+ * full surface — every option Vercel supports, including its native
27
+ * `NetworkPolicy` — is available without us re-declaring it.
28
+ */
29
+ type VercelSandboxCreateParams = DistributiveOmit<NonNullable<Parameters<typeof Sandbox.create>[0]>, 'onResume'>;
30
+ /**
31
+ * Settings for {@link createVercelSandbox}. Two mutually-exclusive shapes:
32
+ *
33
+ * - `{ sandbox }` — wrap an already-created `@vercel/sandbox` `Sandbox`. The
34
+ * caller owns its lifecycle; the provider's `stop()` and `destroy()` are
35
+ * no-ops. Optionally declare `bridgePorts` to give the harness a port pool to
36
+ * lease from for concurrent sessions on the same provided sandbox.
37
+ * - {@link VercelSandboxCreateParams} fields — provider creates the underlying
38
+ * sandbox. When the adapter declares a bootstrap recipe the provider uses
39
+ * `Sandbox.getOrCreate` to maintain a persistent named template snapshot
40
+ * keyed by the recipe identity, and forks an ephemeral sandbox per session
41
+ * from the snapshot. Use `name` to override the auto-derived template name.
42
+ */
43
+ type VercelSandboxSettings = {
44
+ sandbox: Sandbox;
45
+ bridgePorts?: ReadonlyArray<number>;
46
+ } | (VercelSandboxCreateParams & {
47
+ sandbox?: never;
48
+ name?: string;
49
+ });
50
+ declare function createVercelSandbox(settings?: VercelSandboxSettings): HarnessV1SandboxProvider;
51
+ /**
52
+ * `HarnessV1SandboxProvider` implementation backed by `@vercel/sandbox`.
53
+ * Construct one via {@link createVercelSandbox} at module scope and pass it
54
+ * to a `HarnessAgent` (or call `createSession()` directly if you want raw
55
+ * access to a network sandbox session).
56
+ */
57
+ declare class VercelSandboxProvider implements HarnessV1SandboxProvider {
58
+ private readonly settings;
59
+ readonly specificationVersion: "harness-sandbox-v1";
60
+ readonly providerId = "vercel-sandbox";
61
+ readonly bridgePorts?: ReadonlyArray<number>;
62
+ constructor(settings: VercelSandboxSettings);
63
+ createSession: (options?: {
64
+ sessionId?: string;
65
+ abortSignal?: AbortSignal;
66
+ identity?: string;
67
+ onFirstCreate?: (session: Experimental_SandboxSession, opts: {
68
+ abortSignal?: AbortSignal;
69
+ }) => Promise<void>;
70
+ }) => Promise<HarnessV1NetworkSandboxSession>;
71
+ resumeSession: (options: {
72
+ sessionId: string;
73
+ abortSignal?: AbortSignal;
74
+ }) => Promise<HarnessV1NetworkSandboxSession>;
75
+ }
76
+
77
+ export { VercelSandboxProvider, type VercelSandboxSettings, createVercelSandbox };