@ai-sdk/sandbox-just-bash 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 +483 -0
- package/LICENSE +13 -0
- package/README.md +47 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +284 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
- package/src/index.ts +5 -0
- package/src/just-bash-network-sandbox-session.ts +69 -0
- package/src/just-bash-sandbox-session.ts +290 -0
- package/src/just-bash-sandbox.ts +91 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
# @ai-sdk/sandbox-just-bash
|
|
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
|
+
- @ai-sdk/harness@1.0.26
|
|
110
|
+
|
|
111
|
+
## 1.0.25
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- Updated dependencies [44e988a]
|
|
116
|
+
- @ai-sdk/harness@1.0.25
|
|
117
|
+
|
|
118
|
+
## 1.0.24
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- @ai-sdk/harness@1.0.24
|
|
123
|
+
|
|
124
|
+
## 1.0.23
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- Updated dependencies [39c8276]
|
|
129
|
+
- Updated dependencies [91fe6d8]
|
|
130
|
+
- Updated dependencies [0be5014]
|
|
131
|
+
- @ai-sdk/harness@1.0.23
|
|
132
|
+
|
|
133
|
+
## 1.0.22
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- @ai-sdk/harness@1.0.22
|
|
138
|
+
- @ai-sdk/provider-utils@5.0.7
|
|
139
|
+
|
|
140
|
+
## 1.0.21
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- Updated dependencies [ac306ed]
|
|
145
|
+
- @ai-sdk/provider-utils@5.0.6
|
|
146
|
+
- @ai-sdk/harness@1.0.21
|
|
147
|
+
|
|
148
|
+
## 1.0.20
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- Updated dependencies [b7aa06a]
|
|
153
|
+
- @ai-sdk/harness@1.0.20
|
|
154
|
+
|
|
155
|
+
## 1.0.19
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- @ai-sdk/harness@1.0.19
|
|
160
|
+
|
|
161
|
+
## 1.0.18
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- @ai-sdk/harness@1.0.18
|
|
166
|
+
|
|
167
|
+
## 1.0.17
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [5c5c0f5]
|
|
172
|
+
- @ai-sdk/provider-utils@5.0.5
|
|
173
|
+
- @ai-sdk/harness@1.0.17
|
|
174
|
+
|
|
175
|
+
## 1.0.16
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- @ai-sdk/harness@1.0.16
|
|
180
|
+
|
|
181
|
+
## 1.0.15
|
|
182
|
+
|
|
183
|
+
### Patch Changes
|
|
184
|
+
|
|
185
|
+
- Updated dependencies [c6f5e62]
|
|
186
|
+
- @ai-sdk/provider-utils@5.0.4
|
|
187
|
+
- @ai-sdk/harness@1.0.15
|
|
188
|
+
|
|
189
|
+
## 1.0.14
|
|
190
|
+
|
|
191
|
+
### Patch Changes
|
|
192
|
+
|
|
193
|
+
- @ai-sdk/harness@1.0.14
|
|
194
|
+
|
|
195
|
+
## 1.0.13
|
|
196
|
+
|
|
197
|
+
### Patch Changes
|
|
198
|
+
|
|
199
|
+
- Updated dependencies [8c616f0]
|
|
200
|
+
- @ai-sdk/provider-utils@5.0.3
|
|
201
|
+
- @ai-sdk/harness@1.0.13
|
|
202
|
+
|
|
203
|
+
## 1.0.12
|
|
204
|
+
|
|
205
|
+
### Patch Changes
|
|
206
|
+
|
|
207
|
+
- Updated dependencies [7859cea]
|
|
208
|
+
- Updated dependencies [c857346]
|
|
209
|
+
- @ai-sdk/harness@1.0.12
|
|
210
|
+
|
|
211
|
+
## 1.0.11
|
|
212
|
+
|
|
213
|
+
### Patch Changes
|
|
214
|
+
|
|
215
|
+
- @ai-sdk/harness@1.0.11
|
|
216
|
+
|
|
217
|
+
## 1.0.10
|
|
218
|
+
|
|
219
|
+
### Patch Changes
|
|
220
|
+
|
|
221
|
+
- @ai-sdk/harness@1.0.10
|
|
222
|
+
- @ai-sdk/provider-utils@5.0.2
|
|
223
|
+
|
|
224
|
+
## 1.0.9
|
|
225
|
+
|
|
226
|
+
### Patch Changes
|
|
227
|
+
|
|
228
|
+
- @ai-sdk/harness@1.0.9
|
|
229
|
+
|
|
230
|
+
## 1.0.8
|
|
231
|
+
|
|
232
|
+
### Patch Changes
|
|
233
|
+
|
|
234
|
+
- @ai-sdk/harness@1.0.8
|
|
235
|
+
|
|
236
|
+
## 1.0.7
|
|
237
|
+
|
|
238
|
+
### Patch Changes
|
|
239
|
+
|
|
240
|
+
- @ai-sdk/harness@1.0.7
|
|
241
|
+
|
|
242
|
+
## 1.0.6
|
|
243
|
+
|
|
244
|
+
### Patch Changes
|
|
245
|
+
|
|
246
|
+
- Updated dependencies [6a436e3]
|
|
247
|
+
- @ai-sdk/provider-utils@5.0.1
|
|
248
|
+
- @ai-sdk/harness@1.0.6
|
|
249
|
+
|
|
250
|
+
## 1.0.5
|
|
251
|
+
|
|
252
|
+
### Patch Changes
|
|
253
|
+
|
|
254
|
+
- @ai-sdk/harness@1.0.5
|
|
255
|
+
|
|
256
|
+
## 1.0.4
|
|
257
|
+
|
|
258
|
+
### Patch Changes
|
|
259
|
+
|
|
260
|
+
- Updated dependencies [c493634]
|
|
261
|
+
- @ai-sdk/harness@1.0.4
|
|
262
|
+
|
|
263
|
+
## 1.0.3
|
|
264
|
+
|
|
265
|
+
### Patch Changes
|
|
266
|
+
|
|
267
|
+
- Updated dependencies [51d10a0]
|
|
268
|
+
- @ai-sdk/harness@1.0.3
|
|
269
|
+
|
|
270
|
+
## 1.0.2
|
|
271
|
+
|
|
272
|
+
### Patch Changes
|
|
273
|
+
|
|
274
|
+
- @ai-sdk/harness@1.0.2
|
|
275
|
+
|
|
276
|
+
## 1.0.1
|
|
277
|
+
|
|
278
|
+
### Patch Changes
|
|
279
|
+
|
|
280
|
+
- @ai-sdk/harness@1.0.1
|
|
281
|
+
|
|
282
|
+
## 1.0.0
|
|
283
|
+
|
|
284
|
+
### Major Changes
|
|
285
|
+
|
|
286
|
+
- 9d6dbe0: feat(harness): add sandbox specific expansion for harness abstraction, add `sandbox-just-bash` and `sandbox-vercel`
|
|
287
|
+
|
|
288
|
+
### Patch Changes
|
|
289
|
+
|
|
290
|
+
- 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.
|
|
291
|
+
- b8396f0: trigger initial beta release
|
|
292
|
+
- e551763: fix(harness): avoid using peer dependencies for underlying harness and sandbox SDKs
|
|
293
|
+
|
|
294
|
+
## 1.0.0-beta.27
|
|
295
|
+
|
|
296
|
+
### Patch Changes
|
|
297
|
+
|
|
298
|
+
- @ai-sdk/harness@1.0.0-beta.27
|
|
299
|
+
|
|
300
|
+
## 1.0.0-beta.26
|
|
301
|
+
|
|
302
|
+
### Patch Changes
|
|
303
|
+
|
|
304
|
+
- Updated dependencies [a83a367]
|
|
305
|
+
- @ai-sdk/harness@1.0.0-beta.26
|
|
306
|
+
|
|
307
|
+
## 1.0.0-beta.25
|
|
308
|
+
|
|
309
|
+
### Patch Changes
|
|
310
|
+
|
|
311
|
+
- @ai-sdk/harness@1.0.0-beta.25
|
|
312
|
+
|
|
313
|
+
## 1.0.0-beta.24
|
|
314
|
+
|
|
315
|
+
### Patch Changes
|
|
316
|
+
|
|
317
|
+
- @ai-sdk/harness@1.0.0-beta.24
|
|
318
|
+
|
|
319
|
+
## 1.0.0-beta.23
|
|
320
|
+
|
|
321
|
+
### Patch Changes
|
|
322
|
+
|
|
323
|
+
- Updated dependencies [57e0a59]
|
|
324
|
+
- @ai-sdk/harness@1.0.0-beta.23
|
|
325
|
+
|
|
326
|
+
## 1.0.0-beta.22
|
|
327
|
+
|
|
328
|
+
### Patch Changes
|
|
329
|
+
|
|
330
|
+
- @ai-sdk/harness@1.0.0-beta.22
|
|
331
|
+
- @ai-sdk/provider-utils@5.0.0-beta.50
|
|
332
|
+
|
|
333
|
+
## 1.0.0-beta.21
|
|
334
|
+
|
|
335
|
+
### Patch Changes
|
|
336
|
+
|
|
337
|
+
- @ai-sdk/harness@1.0.0-beta.21
|
|
338
|
+
|
|
339
|
+
## 1.0.0-beta.20
|
|
340
|
+
|
|
341
|
+
### Patch Changes
|
|
342
|
+
|
|
343
|
+
- Updated dependencies [e5d4a24]
|
|
344
|
+
- @ai-sdk/harness@1.0.0-beta.20
|
|
345
|
+
|
|
346
|
+
## 1.0.0-beta.19
|
|
347
|
+
|
|
348
|
+
### Patch Changes
|
|
349
|
+
|
|
350
|
+
- @ai-sdk/harness@1.0.0-beta.19
|
|
351
|
+
|
|
352
|
+
## 1.0.0-beta.18
|
|
353
|
+
|
|
354
|
+
### Patch Changes
|
|
355
|
+
|
|
356
|
+
- @ai-sdk/harness@1.0.0-beta.18
|
|
357
|
+
|
|
358
|
+
## 1.0.0-beta.17
|
|
359
|
+
|
|
360
|
+
### Patch Changes
|
|
361
|
+
|
|
362
|
+
- Updated dependencies [534dac6]
|
|
363
|
+
- @ai-sdk/harness@1.0.0-beta.17
|
|
364
|
+
|
|
365
|
+
## 1.0.0-beta.16
|
|
366
|
+
|
|
367
|
+
### Patch Changes
|
|
368
|
+
|
|
369
|
+
- @ai-sdk/harness@1.0.0-beta.16
|
|
370
|
+
|
|
371
|
+
## 1.0.0-beta.15
|
|
372
|
+
|
|
373
|
+
### Patch Changes
|
|
374
|
+
|
|
375
|
+
- @ai-sdk/harness@1.0.0-beta.15
|
|
376
|
+
|
|
377
|
+
## 1.0.0-beta.14
|
|
378
|
+
|
|
379
|
+
### Patch Changes
|
|
380
|
+
|
|
381
|
+
- b8396f0: trigger initial beta release
|
|
382
|
+
- Updated dependencies [b8396f0]
|
|
383
|
+
- @ai-sdk/harness@1.0.0-beta.14
|
|
384
|
+
- @ai-sdk/provider-utils@5.0.0-beta.49
|
|
385
|
+
|
|
386
|
+
## 1.0.0-canary.13
|
|
387
|
+
|
|
388
|
+
### Patch Changes
|
|
389
|
+
|
|
390
|
+
- @ai-sdk/harness@1.0.0-canary.13
|
|
391
|
+
|
|
392
|
+
## 1.0.0-canary.12
|
|
393
|
+
|
|
394
|
+
### Patch Changes
|
|
395
|
+
|
|
396
|
+
- @ai-sdk/harness@1.0.0-canary.12
|
|
397
|
+
|
|
398
|
+
## 1.0.0-canary.11
|
|
399
|
+
|
|
400
|
+
### Patch Changes
|
|
401
|
+
|
|
402
|
+
- Updated dependencies [be83911]
|
|
403
|
+
- @ai-sdk/harness@1.0.0-canary.11
|
|
404
|
+
|
|
405
|
+
## 1.0.0-canary.10
|
|
406
|
+
|
|
407
|
+
### Patch Changes
|
|
408
|
+
|
|
409
|
+
- @ai-sdk/harness@1.0.0-canary.10
|
|
410
|
+
|
|
411
|
+
## 1.0.0-canary.9
|
|
412
|
+
|
|
413
|
+
### Patch Changes
|
|
414
|
+
|
|
415
|
+
- @ai-sdk/harness@1.0.0-canary.9
|
|
416
|
+
|
|
417
|
+
## 1.0.0-canary.8
|
|
418
|
+
|
|
419
|
+
### Patch Changes
|
|
420
|
+
|
|
421
|
+
- Updated dependencies [aae0138]
|
|
422
|
+
- @ai-sdk/harness@1.0.0-canary.8
|
|
423
|
+
|
|
424
|
+
## 1.0.0-canary.7
|
|
425
|
+
|
|
426
|
+
### Patch Changes
|
|
427
|
+
|
|
428
|
+
- e551763: fix(harness): avoid using peer dependencies for underlying harness and sandbox SDKs
|
|
429
|
+
- Updated dependencies [3d87086]
|
|
430
|
+
- Updated dependencies [aeda373]
|
|
431
|
+
- Updated dependencies [1ea15a3]
|
|
432
|
+
- Updated dependencies [375fdd7]
|
|
433
|
+
- Updated dependencies [b4507d5]
|
|
434
|
+
- @ai-sdk/harness@1.0.0-canary.7
|
|
435
|
+
- @ai-sdk/provider-utils@5.0.0-canary.48
|
|
436
|
+
|
|
437
|
+
## 1.0.0-canary.6
|
|
438
|
+
|
|
439
|
+
### Patch Changes
|
|
440
|
+
|
|
441
|
+
- @ai-sdk/harness@1.0.0-canary.6
|
|
442
|
+
|
|
443
|
+
## 1.0.0-canary.5
|
|
444
|
+
|
|
445
|
+
### Patch Changes
|
|
446
|
+
|
|
447
|
+
- Updated dependencies [d77bed4]
|
|
448
|
+
- Updated dependencies [bae5e2b]
|
|
449
|
+
- @ai-sdk/harness@1.0.0-canary.5
|
|
450
|
+
- @ai-sdk/provider-utils@5.0.0-canary.47
|
|
451
|
+
|
|
452
|
+
## 1.0.0-canary.4
|
|
453
|
+
|
|
454
|
+
### Patch Changes
|
|
455
|
+
|
|
456
|
+
- Updated dependencies [3d9a50c]
|
|
457
|
+
- @ai-sdk/harness@1.0.0-canary.4
|
|
458
|
+
|
|
459
|
+
## 1.0.0-canary.3
|
|
460
|
+
|
|
461
|
+
### Patch Changes
|
|
462
|
+
|
|
463
|
+
- Updated dependencies [21d3d60]
|
|
464
|
+
- @ai-sdk/harness@1.0.0-canary.3
|
|
465
|
+
|
|
466
|
+
## 1.0.0-canary.2
|
|
467
|
+
|
|
468
|
+
### Patch Changes
|
|
469
|
+
|
|
470
|
+
- 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.
|
|
471
|
+
- Updated dependencies [6c7a3e5]
|
|
472
|
+
- @ai-sdk/harness@1.0.0-canary.2
|
|
473
|
+
|
|
474
|
+
## 0.0.0-canary.1
|
|
475
|
+
|
|
476
|
+
### Major Changes
|
|
477
|
+
|
|
478
|
+
- 9d6dbe0: feat(harness): add sandbox specific expansion for harness abstraction, add `sandbox-just-bash` and `sandbox-vercel`
|
|
479
|
+
|
|
480
|
+
### Patch Changes
|
|
481
|
+
|
|
482
|
+
- Updated dependencies [9d6dbe0]
|
|
483
|
+
- @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,47 @@
|
|
|
1
|
+
# AI SDK - just-bash Sandbox
|
|
2
|
+
|
|
3
|
+
_This package is **experimental**._
|
|
4
|
+
|
|
5
|
+
`HarnessV1SandboxProvider` implementation for [`just-bash`](https://github.com/vercel-labs/just-bash), an in-process JavaScript bash environment with a virtual filesystem. File operations and spawned processes share the same in-memory state.
|
|
6
|
+
|
|
7
|
+
This provider does not expose ports, so it cannot be used with features that require actual network sandboxes. It is primarily useful for handing a local `Experimental_SandboxSession` to AI SDK tools that accept `experimental_sandbox`.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i @ai-sdk/sandbox-just-bash
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
The factory is synchronous. The returned provider is stable; the actual `just-bash` `Sandbox` is created on demand inside `provider.createSession()`.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createJustBashSandbox } from '@ai-sdk/sandbox-just-bash';
|
|
21
|
+
|
|
22
|
+
const justBashSandbox = createJustBashSandbox({ cwd: '/work' });
|
|
23
|
+
|
|
24
|
+
const networkSandboxSession = await justBashSandbox.createSession();
|
|
25
|
+
const sandboxSession = networkSandboxSession.restricted();
|
|
26
|
+
|
|
27
|
+
await sandboxSession.writeTextFile({ path: '/work/hello.txt', content: 'hi' });
|
|
28
|
+
|
|
29
|
+
const { stdout } = await sandboxSession.run({
|
|
30
|
+
command: 'cat /work/hello.txt',
|
|
31
|
+
});
|
|
32
|
+
console.log(stdout); // "hi"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`networkSandboxSession.restricted()` is typed as `Experimental_SandboxSession` and is the surface to hand to user tools. The network sandbox session's `getPortUrl` throws (just-bash has no port story) and `setNetworkPolicy` is omitted (no local enforcement primitive).
|
|
36
|
+
|
|
37
|
+
To wrap an already-created `just-bash` `Sandbox` (e.g. with a custom `fs`), pass it via `sandbox`. Install `just-bash` directly if your application imports `Sandbox`, `OverlayFs`, or other `just-bash` exports:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { createJustBashSandbox } from '@ai-sdk/sandbox-just-bash';
|
|
41
|
+
import { OverlayFs, Sandbox } from 'just-bash';
|
|
42
|
+
|
|
43
|
+
const overlay = new OverlayFs({ root: process.cwd() });
|
|
44
|
+
const sandbox = createJustBashSandbox({
|
|
45
|
+
sandbox: await Sandbox.create({ fs: overlay, cwd: overlay.getMountPoint() }),
|
|
46
|
+
});
|
|
47
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HarnessV1SandboxProvider, HarnessV1NetworkSandboxSession } from '@ai-sdk/harness';
|
|
2
|
+
import { Experimental_SandboxSession } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { Sandbox } from 'just-bash';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parameters forwarded to `just-bash`'s `Sandbox.create` when creating a
|
|
7
|
+
* sandbox from scratch. Aliased directly from the underlying SDK so the full
|
|
8
|
+
* surface is available without us re-declaring it.
|
|
9
|
+
*/
|
|
10
|
+
type JustBashSandboxCreateParams = NonNullable<Parameters<typeof Sandbox.create>[0]>;
|
|
11
|
+
/**
|
|
12
|
+
* Settings for {@link createJustBashSandbox}. Two mutually-exclusive shapes:
|
|
13
|
+
*
|
|
14
|
+
* - `{ sandbox }` — wrap an already-created `just-bash` `Sandbox`. The caller
|
|
15
|
+
* owns its lifecycle.
|
|
16
|
+
* - {@link JustBashSandboxCreateParams} fields — provider calls
|
|
17
|
+
* `Sandbox.create(settings)` on every `createSession()`.
|
|
18
|
+
*
|
|
19
|
+
* just-bash has no port exposure and no snapshot mechanism, so image
|
|
20
|
+
* management is a per-call no-op: if an adapter declares a bootstrap recipe
|
|
21
|
+
* the provider runs it once on the freshly-created sandbox before returning.
|
|
22
|
+
*/
|
|
23
|
+
type JustBashSandboxSettings = {
|
|
24
|
+
sandbox: Sandbox;
|
|
25
|
+
} | (JustBashSandboxCreateParams & {
|
|
26
|
+
sandbox?: never;
|
|
27
|
+
});
|
|
28
|
+
declare function createJustBashSandbox(settings?: JustBashSandboxSettings): HarnessV1SandboxProvider;
|
|
29
|
+
/**
|
|
30
|
+
* `HarnessV1SandboxProvider` implementation backed by `just-bash`. Useful for
|
|
31
|
+
* non-bridge harness flows and for handing a local `Experimental_SandboxSession`
|
|
32
|
+
* to AI SDK tools — use `provider.createSession()` then
|
|
33
|
+
* `sandboxSession.restricted()` to get the latter.
|
|
34
|
+
*
|
|
35
|
+
* Note: just-bash cannot expose ports, so bridge-backed harness adapters
|
|
36
|
+
* (claude-code, codex) will reject this provider at start.
|
|
37
|
+
*/
|
|
38
|
+
declare class JustBashSandboxProvider implements HarnessV1SandboxProvider {
|
|
39
|
+
private readonly settings;
|
|
40
|
+
readonly specificationVersion: "harness-sandbox-v1";
|
|
41
|
+
readonly providerId = "just-bash-sandbox";
|
|
42
|
+
constructor(settings: JustBashSandboxSettings);
|
|
43
|
+
createSession: (options?: {
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
abortSignal?: AbortSignal;
|
|
46
|
+
identity?: string;
|
|
47
|
+
onFirstCreate?: (session: Experimental_SandboxSession, opts: {
|
|
48
|
+
abortSignal?: AbortSignal;
|
|
49
|
+
}) => Promise<void>;
|
|
50
|
+
}) => Promise<HarnessV1NetworkSandboxSession>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { JustBashSandboxProvider, type JustBashSandboxSettings, createJustBashSandbox };
|