@sandboxrouter/sdk 0.21.0 → 0.21.1
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/dist/providers/e2b.js +3 -1
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/providers/e2b.js
CHANGED
|
@@ -24,6 +24,8 @@ export class E2BProvider {
|
|
|
24
24
|
timeoutMs: (spec.timeoutMinutes ?? 30) * 60_000,
|
|
25
25
|
envs: spec.env,
|
|
26
26
|
metadata: spec.metadata,
|
|
27
|
+
// Left out, the project's own default applies: public unless the project requires its traffic token.
|
|
28
|
+
...(spec.publicPorts ? { network: { allowPublicTraffic: true } } : {}),
|
|
27
29
|
};
|
|
28
30
|
const sbx = spec.image?.e2b ? await Sandbox.create(spec.image.e2b, opts) : await Sandbox.create(opts);
|
|
29
31
|
return new E2BNativeBox(sbx);
|
|
@@ -180,7 +182,7 @@ export class E2BNativeBox extends E2BBox {
|
|
|
180
182
|
async url(port) {
|
|
181
183
|
const info = await this.sandbox.getInfo?.();
|
|
182
184
|
if (info?.network?.allowPublicTraffic === false) {
|
|
183
|
-
throw new ProviderError(this.provider, "this sandbox requires authenticated preview traffic
|
|
185
|
+
throw new ProviderError(this.provider, "this sandbox requires authenticated preview traffic: the E2B project allows no public sandbox URLs. Create the sandbox with publicPorts: true to open its ports, or use a project with browser-accessible previews", 403);
|
|
184
186
|
}
|
|
185
187
|
return `https://${this.sandbox.getHost(port)}`;
|
|
186
188
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -20,6 +20,13 @@ export interface SandboxSpec {
|
|
|
20
20
|
ports?: number[];
|
|
21
21
|
/** Hard lifetime in minutes (default 30). */
|
|
22
22
|
timeoutMinutes?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Ask for the sandbox's port URLs to answer without the provider's own credentials, where that is
|
|
25
|
+
* a setting. E2B: a project can require its traffic access token on every sandbox URL, and this
|
|
26
|
+
* opens them for this one sandbox. Elsewhere it changes nothing. It never narrows routing: a
|
|
27
|
+
* provider's URLs are as public as that provider makes them (see `url`).
|
|
28
|
+
*/
|
|
29
|
+
publicPorts?: boolean;
|
|
23
30
|
/**
|
|
24
31
|
* How long you expect to use the sandbox, in seconds. Only a ranking hint: the sandbox still lives
|
|
25
32
|
* until you kill it or `timeoutMinutes` runs out. Without it, ranking assumes the whole lifetime.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sandboxrouter/sdk",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "One API for every sandbox provider: route AI agents' code by price, speed or capability, with automatic fallback. Free and open source.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|