@hasna/sandboxes 0.1.0 → 0.1.2
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/cli/index.js +30 -9
- package/dist/index.js +46 -9
- package/dist/mcp/index.js +46 -9
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/modal.d.ts +3 -0
- package/dist/providers/modal.d.ts.map +1 -1
- package/dist/server/index.js +46 -9
- package/package.json +43 -44
package/dist/cli/index.js
CHANGED
|
@@ -2871,30 +2871,47 @@ var exports_modal = {};
|
|
|
2871
2871
|
__export(exports_modal, {
|
|
2872
2872
|
ModalProvider: () => ModalProvider
|
|
2873
2873
|
});
|
|
2874
|
-
import { ModalClient } from "modal";
|
|
2875
2874
|
|
|
2876
2875
|
class ModalProvider {
|
|
2877
2876
|
name = "modal";
|
|
2878
2877
|
client;
|
|
2878
|
+
_initialized = false;
|
|
2879
|
+
_apiKey;
|
|
2879
2880
|
constructor(apiKey) {
|
|
2880
|
-
|
|
2881
|
-
|
|
2881
|
+
this._apiKey = apiKey;
|
|
2882
|
+
}
|
|
2883
|
+
async ensureClient() {
|
|
2884
|
+
if (this._initialized)
|
|
2885
|
+
return this.client;
|
|
2886
|
+
try {
|
|
2887
|
+
const mod = await import("modal");
|
|
2888
|
+
const ModalClient = mod.ModalClient || mod.default?.ModalClient;
|
|
2889
|
+
if (!ModalClient)
|
|
2890
|
+
throw new Error("ModalClient not found in modal package");
|
|
2891
|
+
if (this._apiKey) {
|
|
2892
|
+
process.env["MODAL_TOKEN_SECRET"] = this._apiKey;
|
|
2893
|
+
}
|
|
2894
|
+
this.client = new ModalClient;
|
|
2895
|
+
this._initialized = true;
|
|
2896
|
+
return this.client;
|
|
2897
|
+
} catch (err) {
|
|
2898
|
+
throw new ProviderError("modal", `Modal SDK not available. Install with: bun add modal. Error: ${err.message}`);
|
|
2882
2899
|
}
|
|
2883
|
-
this.client = new ModalClient;
|
|
2884
2900
|
}
|
|
2885
2901
|
async create(opts) {
|
|
2886
2902
|
try {
|
|
2887
|
-
const
|
|
2903
|
+
const client = await this.ensureClient();
|
|
2904
|
+
const app = await client.apps.fromName("open-sandboxes", {
|
|
2888
2905
|
createIfMissing: true
|
|
2889
2906
|
});
|
|
2890
2907
|
const imageName = opts?.image || "ubuntu:22.04";
|
|
2891
|
-
const image =
|
|
2908
|
+
const image = client.images.fromRegistry(imageName);
|
|
2892
2909
|
const timeout = opts?.timeout || 3600;
|
|
2893
2910
|
const createOpts = { timeout };
|
|
2894
2911
|
if (opts?.envVars && Object.keys(opts.envVars).length > 0) {
|
|
2895
2912
|
createOpts.envVars = opts.envVars;
|
|
2896
2913
|
}
|
|
2897
|
-
const sandbox = await
|
|
2914
|
+
const sandbox = await client.sandboxes.create(app, image, createOpts);
|
|
2898
2915
|
const sandboxId = sandbox.id || sandbox.sandboxId || String(sandbox);
|
|
2899
2916
|
sandboxCache.set(sandboxId, sandbox);
|
|
2900
2917
|
return {
|
|
@@ -3127,8 +3144,12 @@ async function getProvider(name, apiKey) {
|
|
|
3127
3144
|
break;
|
|
3128
3145
|
}
|
|
3129
3146
|
case "modal": {
|
|
3130
|
-
|
|
3131
|
-
|
|
3147
|
+
try {
|
|
3148
|
+
const { ModalProvider: ModalProvider2 } = await Promise.resolve().then(() => (init_modal(), exports_modal));
|
|
3149
|
+
provider = new ModalProvider2(key);
|
|
3150
|
+
} catch {
|
|
3151
|
+
throw new ProviderError("modal", "Modal SDK not available. Install it with: bun add modal");
|
|
3152
|
+
}
|
|
3132
3153
|
break;
|
|
3133
3154
|
}
|
|
3134
3155
|
default:
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -10,6 +25,7 @@ var __export = (target, all) => {
|
|
|
10
25
|
});
|
|
11
26
|
};
|
|
12
27
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
28
|
+
var __require = import.meta.require;
|
|
13
29
|
|
|
14
30
|
// src/types/index.ts
|
|
15
31
|
var SANDBOX_PROVIDERS, SANDBOX_STATUSES, SESSION_STATUSES, AGENT_TYPES, EVENT_TYPES, SandboxNotFoundError, SessionNotFoundError, ProviderError, AgentNotFoundError, ProjectNotFoundError, WebhookNotFoundError;
|
|
@@ -383,30 +399,47 @@ var exports_modal = {};
|
|
|
383
399
|
__export(exports_modal, {
|
|
384
400
|
ModalProvider: () => ModalProvider
|
|
385
401
|
});
|
|
386
|
-
import { ModalClient } from "modal";
|
|
387
402
|
|
|
388
403
|
class ModalProvider {
|
|
389
404
|
name = "modal";
|
|
390
405
|
client;
|
|
406
|
+
_initialized = false;
|
|
407
|
+
_apiKey;
|
|
391
408
|
constructor(apiKey) {
|
|
392
|
-
|
|
393
|
-
|
|
409
|
+
this._apiKey = apiKey;
|
|
410
|
+
}
|
|
411
|
+
async ensureClient() {
|
|
412
|
+
if (this._initialized)
|
|
413
|
+
return this.client;
|
|
414
|
+
try {
|
|
415
|
+
const mod = await import("modal");
|
|
416
|
+
const ModalClient = mod.ModalClient || mod.default?.ModalClient;
|
|
417
|
+
if (!ModalClient)
|
|
418
|
+
throw new Error("ModalClient not found in modal package");
|
|
419
|
+
if (this._apiKey) {
|
|
420
|
+
process.env["MODAL_TOKEN_SECRET"] = this._apiKey;
|
|
421
|
+
}
|
|
422
|
+
this.client = new ModalClient;
|
|
423
|
+
this._initialized = true;
|
|
424
|
+
return this.client;
|
|
425
|
+
} catch (err) {
|
|
426
|
+
throw new ProviderError("modal", `Modal SDK not available. Install with: bun add modal. Error: ${err.message}`);
|
|
394
427
|
}
|
|
395
|
-
this.client = new ModalClient;
|
|
396
428
|
}
|
|
397
429
|
async create(opts) {
|
|
398
430
|
try {
|
|
399
|
-
const
|
|
431
|
+
const client = await this.ensureClient();
|
|
432
|
+
const app = await client.apps.fromName("open-sandboxes", {
|
|
400
433
|
createIfMissing: true
|
|
401
434
|
});
|
|
402
435
|
const imageName = opts?.image || "ubuntu:22.04";
|
|
403
|
-
const image =
|
|
436
|
+
const image = client.images.fromRegistry(imageName);
|
|
404
437
|
const timeout = opts?.timeout || 3600;
|
|
405
438
|
const createOpts = { timeout };
|
|
406
439
|
if (opts?.envVars && Object.keys(opts.envVars).length > 0) {
|
|
407
440
|
createOpts.envVars = opts.envVars;
|
|
408
441
|
}
|
|
409
|
-
const sandbox = await
|
|
442
|
+
const sandbox = await client.sandboxes.create(app, image, createOpts);
|
|
410
443
|
const sandboxId = sandbox.id || sandbox.sandboxId || String(sandbox);
|
|
411
444
|
sandboxCache.set(sandboxId, sandbox);
|
|
412
445
|
return {
|
|
@@ -1301,8 +1334,12 @@ async function getProvider(name, apiKey) {
|
|
|
1301
1334
|
break;
|
|
1302
1335
|
}
|
|
1303
1336
|
case "modal": {
|
|
1304
|
-
|
|
1305
|
-
|
|
1337
|
+
try {
|
|
1338
|
+
const { ModalProvider: ModalProvider2 } = await Promise.resolve().then(() => (init_modal(), exports_modal));
|
|
1339
|
+
provider = new ModalProvider2(key);
|
|
1340
|
+
} catch {
|
|
1341
|
+
throw new ProviderError("modal", "Modal SDK not available. Install it with: bun add modal");
|
|
1342
|
+
}
|
|
1306
1343
|
break;
|
|
1307
1344
|
}
|
|
1308
1345
|
default:
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
4
19
|
var __export = (target, all) => {
|
|
5
20
|
for (var name in all)
|
|
6
21
|
__defProp(target, name, {
|
|
@@ -11,6 +26,7 @@ var __export = (target, all) => {
|
|
|
11
26
|
});
|
|
12
27
|
};
|
|
13
28
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
|
+
var __require = import.meta.require;
|
|
14
30
|
|
|
15
31
|
// src/types/index.ts
|
|
16
32
|
var SandboxNotFoundError, SessionNotFoundError, ProviderError, AgentNotFoundError, ProjectNotFoundError;
|
|
@@ -356,30 +372,47 @@ var exports_modal = {};
|
|
|
356
372
|
__export(exports_modal, {
|
|
357
373
|
ModalProvider: () => ModalProvider
|
|
358
374
|
});
|
|
359
|
-
import { ModalClient } from "modal";
|
|
360
375
|
|
|
361
376
|
class ModalProvider {
|
|
362
377
|
name = "modal";
|
|
363
378
|
client;
|
|
379
|
+
_initialized = false;
|
|
380
|
+
_apiKey;
|
|
364
381
|
constructor(apiKey) {
|
|
365
|
-
|
|
366
|
-
|
|
382
|
+
this._apiKey = apiKey;
|
|
383
|
+
}
|
|
384
|
+
async ensureClient() {
|
|
385
|
+
if (this._initialized)
|
|
386
|
+
return this.client;
|
|
387
|
+
try {
|
|
388
|
+
const mod = await import("modal");
|
|
389
|
+
const ModalClient = mod.ModalClient || mod.default?.ModalClient;
|
|
390
|
+
if (!ModalClient)
|
|
391
|
+
throw new Error("ModalClient not found in modal package");
|
|
392
|
+
if (this._apiKey) {
|
|
393
|
+
process.env["MODAL_TOKEN_SECRET"] = this._apiKey;
|
|
394
|
+
}
|
|
395
|
+
this.client = new ModalClient;
|
|
396
|
+
this._initialized = true;
|
|
397
|
+
return this.client;
|
|
398
|
+
} catch (err) {
|
|
399
|
+
throw new ProviderError("modal", `Modal SDK not available. Install with: bun add modal. Error: ${err.message}`);
|
|
367
400
|
}
|
|
368
|
-
this.client = new ModalClient;
|
|
369
401
|
}
|
|
370
402
|
async create(opts) {
|
|
371
403
|
try {
|
|
372
|
-
const
|
|
404
|
+
const client = await this.ensureClient();
|
|
405
|
+
const app = await client.apps.fromName("open-sandboxes", {
|
|
373
406
|
createIfMissing: true
|
|
374
407
|
});
|
|
375
408
|
const imageName = opts?.image || "ubuntu:22.04";
|
|
376
|
-
const image =
|
|
409
|
+
const image = client.images.fromRegistry(imageName);
|
|
377
410
|
const timeout = opts?.timeout || 3600;
|
|
378
411
|
const createOpts = { timeout };
|
|
379
412
|
if (opts?.envVars && Object.keys(opts.envVars).length > 0) {
|
|
380
413
|
createOpts.envVars = opts.envVars;
|
|
381
414
|
}
|
|
382
|
-
const sandbox = await
|
|
415
|
+
const sandbox = await client.sandboxes.create(app, image, createOpts);
|
|
383
416
|
const sandboxId = sandbox.id || sandbox.sandboxId || String(sandbox);
|
|
384
417
|
sandboxCache.set(sandboxId, sandbox);
|
|
385
418
|
return {
|
|
@@ -5094,8 +5127,12 @@ async function getProvider(name, apiKey) {
|
|
|
5094
5127
|
break;
|
|
5095
5128
|
}
|
|
5096
5129
|
case "modal": {
|
|
5097
|
-
|
|
5098
|
-
|
|
5130
|
+
try {
|
|
5131
|
+
const { ModalProvider: ModalProvider2 } = await Promise.resolve().then(() => (init_modal(), exports_modal));
|
|
5132
|
+
provider = new ModalProvider2(key);
|
|
5133
|
+
} catch {
|
|
5134
|
+
throw new ProviderError("modal", "Modal SDK not available. Install it with: bun add modal");
|
|
5135
|
+
}
|
|
5099
5136
|
break;
|
|
5100
5137
|
}
|
|
5101
5138
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,mBAAmB,EACzB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,mBAAmB,EACzB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,CAAC,CAqC1B;AAED,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -3,7 +3,10 @@ import type { SandboxProvider, ProviderSandbox, CreateSandboxOpts, ExecOptions }
|
|
|
3
3
|
export declare class ModalProvider implements SandboxProvider {
|
|
4
4
|
readonly name = "modal";
|
|
5
5
|
private client;
|
|
6
|
+
private _initialized;
|
|
7
|
+
private _apiKey?;
|
|
6
8
|
constructor(apiKey?: string);
|
|
9
|
+
private ensureClient;
|
|
7
10
|
create(opts?: CreateSandboxOpts): Promise<ProviderSandbox>;
|
|
8
11
|
private getSandbox;
|
|
9
12
|
exec(sandboxId: string, command: string, opts?: ExecOptions): Promise<ExecResult | ExecHandle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/providers/modal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/providers/modal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,WAAW,EACZ,MAAM,YAAY,CAAC;AAKpB,qBAAa,aAAc,YAAW,eAAe;IACnD,QAAQ,CAAC,IAAI,WAAW;IACxB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAS;gBAEb,MAAM,CAAC,EAAE,MAAM;YAIb,YAAY;IAiBpB,MAAM,CAAC,IAAI,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsChE,OAAO,CAAC,UAAU;IAWZ,IAAI,CACR,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;IAmF7B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB1D,SAAS,CACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IAoBV,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAmD/D,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAatC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxE;;OAEG;IACH,OAAO,CAAC,YAAY;IAuCpB;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB"}
|
package/dist/server/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
4
19
|
var __export = (target, all) => {
|
|
5
20
|
for (var name in all)
|
|
6
21
|
__defProp(target, name, {
|
|
@@ -11,6 +26,7 @@ var __export = (target, all) => {
|
|
|
11
26
|
});
|
|
12
27
|
};
|
|
13
28
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
|
+
var __require = import.meta.require;
|
|
14
30
|
|
|
15
31
|
// src/types/index.ts
|
|
16
32
|
var SandboxNotFoundError, SessionNotFoundError, ProviderError, AgentNotFoundError, ProjectNotFoundError, WebhookNotFoundError;
|
|
@@ -362,30 +378,47 @@ var exports_modal = {};
|
|
|
362
378
|
__export(exports_modal, {
|
|
363
379
|
ModalProvider: () => ModalProvider
|
|
364
380
|
});
|
|
365
|
-
import { ModalClient } from "modal";
|
|
366
381
|
|
|
367
382
|
class ModalProvider {
|
|
368
383
|
name = "modal";
|
|
369
384
|
client;
|
|
385
|
+
_initialized = false;
|
|
386
|
+
_apiKey;
|
|
370
387
|
constructor(apiKey) {
|
|
371
|
-
|
|
372
|
-
|
|
388
|
+
this._apiKey = apiKey;
|
|
389
|
+
}
|
|
390
|
+
async ensureClient() {
|
|
391
|
+
if (this._initialized)
|
|
392
|
+
return this.client;
|
|
393
|
+
try {
|
|
394
|
+
const mod = await import("modal");
|
|
395
|
+
const ModalClient = mod.ModalClient || mod.default?.ModalClient;
|
|
396
|
+
if (!ModalClient)
|
|
397
|
+
throw new Error("ModalClient not found in modal package");
|
|
398
|
+
if (this._apiKey) {
|
|
399
|
+
process.env["MODAL_TOKEN_SECRET"] = this._apiKey;
|
|
400
|
+
}
|
|
401
|
+
this.client = new ModalClient;
|
|
402
|
+
this._initialized = true;
|
|
403
|
+
return this.client;
|
|
404
|
+
} catch (err) {
|
|
405
|
+
throw new ProviderError("modal", `Modal SDK not available. Install with: bun add modal. Error: ${err.message}`);
|
|
373
406
|
}
|
|
374
|
-
this.client = new ModalClient;
|
|
375
407
|
}
|
|
376
408
|
async create(opts) {
|
|
377
409
|
try {
|
|
378
|
-
const
|
|
410
|
+
const client = await this.ensureClient();
|
|
411
|
+
const app = await client.apps.fromName("open-sandboxes", {
|
|
379
412
|
createIfMissing: true
|
|
380
413
|
});
|
|
381
414
|
const imageName = opts?.image || "ubuntu:22.04";
|
|
382
|
-
const image =
|
|
415
|
+
const image = client.images.fromRegistry(imageName);
|
|
383
416
|
const timeout = opts?.timeout || 3600;
|
|
384
417
|
const createOpts = { timeout };
|
|
385
418
|
if (opts?.envVars && Object.keys(opts.envVars).length > 0) {
|
|
386
419
|
createOpts.envVars = opts.envVars;
|
|
387
420
|
}
|
|
388
|
-
const sandbox = await
|
|
421
|
+
const sandbox = await client.sandboxes.create(app, image, createOpts);
|
|
389
422
|
const sandboxId = sandbox.id || sandbox.sandboxId || String(sandbox);
|
|
390
423
|
sandboxCache.set(sandboxId, sandbox);
|
|
391
424
|
return {
|
|
@@ -1188,8 +1221,12 @@ async function getProvider(name, apiKey) {
|
|
|
1188
1221
|
break;
|
|
1189
1222
|
}
|
|
1190
1223
|
case "modal": {
|
|
1191
|
-
|
|
1192
|
-
|
|
1224
|
+
try {
|
|
1225
|
+
const { ModalProvider: ModalProvider2 } = await Promise.resolve().then(() => (init_modal(), exports_modal));
|
|
1226
|
+
provider = new ModalProvider2(key);
|
|
1227
|
+
} catch {
|
|
1228
|
+
throw new ProviderError("modal", "Modal SDK not available. Install it with: bun add modal");
|
|
1229
|
+
}
|
|
1193
1230
|
break;
|
|
1194
1231
|
}
|
|
1195
1232
|
default:
|
package/package.json
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/sandboxes",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"author": "Andrei Hasna <andrei@hasna.com>",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/hasna/sandboxes.git"
|
|
8
|
+
},
|
|
6
9
|
"main": "dist/index.js",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@daytonaio/sdk": "^0.18.0",
|
|
12
|
+
"@e2b/code-interpreter": "^1.5.0",
|
|
13
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
14
|
+
"chalk": "^5.4.1",
|
|
15
|
+
"commander": "^13.1.0",
|
|
16
|
+
"ink": "^5.2.0",
|
|
17
|
+
"react": "^18.3.1",
|
|
18
|
+
"zod": "^3.24.2"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/bun": "^1.2.4",
|
|
22
|
+
"@types/react": "^18.3.18",
|
|
23
|
+
"typescript": "^5.7.3"
|
|
12
24
|
},
|
|
13
25
|
"exports": {
|
|
14
26
|
".": {
|
|
@@ -16,19 +28,24 @@
|
|
|
16
28
|
"import": "./dist/index.js"
|
|
17
29
|
}
|
|
18
30
|
},
|
|
31
|
+
"bin": {
|
|
32
|
+
"sandboxes": "dist/cli/index.js",
|
|
33
|
+
"sandboxes-mcp": "dist/mcp/index.js",
|
|
34
|
+
"sandboxes-serve": "dist/server/index.js"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/hasna/sandboxes/issues"
|
|
38
|
+
},
|
|
39
|
+
"description": "Universal cloud sandbox manager for AI coding agents - supports e2b, Daytona, Modal",
|
|
40
|
+
"engines": {
|
|
41
|
+
"bun": ">=1.0.0"
|
|
42
|
+
},
|
|
19
43
|
"files": [
|
|
20
44
|
"dist",
|
|
21
45
|
"LICENSE",
|
|
22
46
|
"README.md"
|
|
23
47
|
],
|
|
24
|
-
"
|
|
25
|
-
"build": "bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && bun build src/server/index.ts --outdir dist/server --target bun --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && bun build src/index.ts --outdir dist --target bun --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && tsc --emitDeclarationOnly --outDir dist",
|
|
26
|
-
"typecheck": "tsc --noEmit",
|
|
27
|
-
"test": "bun test",
|
|
28
|
-
"dev:cli": "bun run src/cli/index.tsx",
|
|
29
|
-
"dev:mcp": "bun run src/mcp/index.ts",
|
|
30
|
-
"dev:serve": "bun run src/server/index.ts"
|
|
31
|
-
},
|
|
48
|
+
"homepage": "https://github.com/hasna/sandboxes",
|
|
32
49
|
"keywords": [
|
|
33
50
|
"sandbox",
|
|
34
51
|
"cloud",
|
|
@@ -43,36 +60,18 @@
|
|
|
43
60
|
"gemini",
|
|
44
61
|
"cli"
|
|
45
62
|
],
|
|
63
|
+
"license": "Apache-2.0",
|
|
46
64
|
"publishConfig": {
|
|
47
65
|
"access": "public"
|
|
48
66
|
},
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
},
|
|
57
|
-
"engines": {
|
|
58
|
-
"bun": ">=1.0.0"
|
|
59
|
-
},
|
|
60
|
-
"author": "Andrei Hasna <andrei@hasna.com>",
|
|
61
|
-
"license": "Apache-2.0",
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"@daytonaio/sdk": "^0.18.0",
|
|
64
|
-
"@e2b/code-interpreter": "^1.5.0",
|
|
65
|
-
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
66
|
-
"chalk": "^5.4.1",
|
|
67
|
-
"commander": "^13.1.0",
|
|
68
|
-
"ink": "^5.2.0",
|
|
69
|
-
"modal": "^0.2.0",
|
|
70
|
-
"react": "^18.3.1",
|
|
71
|
-
"zod": "^3.24.2"
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && bun build src/server/index.ts --outdir dist/server --target bun --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && bun build src/index.ts --outdir dist --target bun --external @e2b/code-interpreter --external @daytonaio/sdk --external modal && tsc --emitDeclarationOnly --outDir dist",
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"test": "bun test",
|
|
71
|
+
"dev:cli": "bun run src/cli/index.tsx",
|
|
72
|
+
"dev:mcp": "bun run src/mcp/index.ts",
|
|
73
|
+
"dev:serve": "bun run src/server/index.ts"
|
|
72
74
|
},
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
"@types/react": "^18.3.18",
|
|
76
|
-
"typescript": "^5.7.3"
|
|
77
|
-
}
|
|
75
|
+
"type": "module",
|
|
76
|
+
"types": "dist/index.d.ts"
|
|
78
77
|
}
|