@ekairos/sandbox 1.21.53-beta.0
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/README.md +240 -0
- package/dist/commands.d.ts +16 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +27 -0
- package/dist/commands.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +11 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +14 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schema.d.ts +18 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +25 -0
- package/dist/schema.js.map +1 -0
- package/dist/service.d.ts +53 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +219 -0
- package/dist/service.js.map +1 -0
- package/dist/steps.d.ts +2 -0
- package/dist/steps.d.ts.map +1 -0
- package/dist/steps.js +2 -0
- package/dist/steps.js.map +1 -0
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
|
|
2
|
+
# @ekairos/sandbox
|
|
3
|
+
|
|
4
|
+
Server-side utilities to provision and manage external sandboxes through a single, provider-agnostic interface.
|
|
5
|
+
|
|
6
|
+
This package is **independent**. Other packages (e.g. `@ekairos/dataset`) may depend on it, but `@ekairos/sandbox` does not depend on any workflow framework.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation (pnpm)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @ekairos/sandbox
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Environment variables (required)
|
|
19
|
+
|
|
20
|
+
### InstantDB (admin)
|
|
21
|
+
You must provide an InstantDB **admin** database client so sandbox actions can persist and query sandbox records.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Data model (InstantDB)
|
|
26
|
+
|
|
27
|
+
### `sandboxDomain`
|
|
28
|
+
Defines a single entity:
|
|
29
|
+
|
|
30
|
+
- `sandbox_sandboxes`
|
|
31
|
+
|
|
32
|
+
Fields (high-level):
|
|
33
|
+
- `externalSandboxId` (string, indexed): provider sandbox id (Vercel `sandbox.sandboxId`)
|
|
34
|
+
- `provider` (string, indexed): e.g. `"vercel"`
|
|
35
|
+
- `sandboxUrl` (string, optional): optional URL metadata
|
|
36
|
+
- `status` (string, indexed): `"creating" | "active" | "shutdown" | "error" | ...`
|
|
37
|
+
- `timeout` (number, optional): milliseconds
|
|
38
|
+
- `runtime` (string, optional): `"node22" | "python3" | ...`
|
|
39
|
+
- `vcpus` (number, optional)
|
|
40
|
+
- `ports` (json, optional): array of ports
|
|
41
|
+
- `purpose` (string, optional, indexed)
|
|
42
|
+
- `params` (json, optional)
|
|
43
|
+
- timestamps: `createdAt`, `updatedAt`, `shutdownAt`
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## ID semantics (important)
|
|
48
|
+
|
|
49
|
+
There are two ids involved:
|
|
50
|
+
|
|
51
|
+
### 1) `sandboxId` (internal, durable handle)
|
|
52
|
+
- The **InstantDB record id**: `sandbox_sandboxes[sandboxId]`
|
|
53
|
+
- This is the id you store in durable state and pass around.
|
|
54
|
+
- All sandbox actions and helpers take this `sandboxId`.
|
|
55
|
+
|
|
56
|
+
### 2) `externalSandboxId` (provider id)
|
|
57
|
+
- The id returned by the provider SDK (Vercel Sandbox `sandbox.sandboxId`)
|
|
58
|
+
- Stored on the record as `externalSandboxId`
|
|
59
|
+
- Used internally to call `Sandbox.get(...)` during reconnect.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Schema integration
|
|
64
|
+
|
|
65
|
+
In your app schema, include `sandboxDomain` along with other domains, then initialize Instant with the composed schema.
|
|
66
|
+
|
|
67
|
+
Example:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { domain } from "@ekairos/domain";
|
|
71
|
+
import { sandboxDomain } from "@ekairos/sandbox";
|
|
72
|
+
// import { storyDomain } from "@ekairos/story" (if you use stories)
|
|
73
|
+
// import { datasetDomain } from "@ekairos/dataset" (if you use dataset)
|
|
74
|
+
|
|
75
|
+
export const appDomain = domain("app")
|
|
76
|
+
.includes(sandboxDomain)
|
|
77
|
+
// .includes(storyDomain)
|
|
78
|
+
// .includes(datasetDomain)
|
|
79
|
+
.schema({
|
|
80
|
+
entities: {},
|
|
81
|
+
links: {},
|
|
82
|
+
rooms: {},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const schema = appDomain.toInstantSchema();
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Exports
|
|
91
|
+
|
|
92
|
+
This package exports:
|
|
93
|
+
|
|
94
|
+
- `sandboxDomain` (schema domain + actions factory)
|
|
95
|
+
- `runCommandInSandbox` (low-level helper)
|
|
96
|
+
- Types (for TypeScript users): `SandboxConfig`, `SandboxRecord`, `ServiceResult<T>`, `CommandResult`
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Quickstart
|
|
101
|
+
|
|
102
|
+
This package gives you a **persisted sandbox record** (`sandboxId`) and helpers to (re)connect and run commands.
|
|
103
|
+
|
|
104
|
+
### 1) Instantiate the service (server-side)
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { init } from "@instantdb/admin";
|
|
108
|
+
import { sandboxDomain } from "@ekairos/sandbox";
|
|
109
|
+
|
|
110
|
+
const db = init({
|
|
111
|
+
appId: process.env.NEXT_PUBLIC_INSTANT_APP_ID,
|
|
112
|
+
adminToken: process.env.INSTANT_APP_ADMIN_TOKEN,
|
|
113
|
+
schema: {}, // your composed schema that includes sandboxDomain
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const sandboxes = sandboxDomain(db);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 2) Create a persisted sandbox
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
const created = await sandboxes.createSandbox({
|
|
123
|
+
runtime: "python3",
|
|
124
|
+
timeout: 10 * 60 * 1000,
|
|
125
|
+
resources: { vcpus: 2 },
|
|
126
|
+
purpose: "dataset-file-parse",
|
|
127
|
+
params: { datasetId: "..." },
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
if (!created.ok) throw new Error(created.error);
|
|
131
|
+
|
|
132
|
+
const { sandboxId } = created.data;
|
|
133
|
+
// Persist sandboxId in your app for continuity.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 3) Run commands by `sandboxId` (recommended)
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
// Preferred DX: bind sandboxId once
|
|
140
|
+
const sandbox = sandboxes.getSandbox(sandboxId);
|
|
141
|
+
|
|
142
|
+
const res = await sandbox.runCommand("python", ["-c", "print('hello')"]);
|
|
143
|
+
if (!res.ok) throw new Error(res.error);
|
|
144
|
+
|
|
145
|
+
console.log(res.data.exitCode, res.data.output);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 4) Reconnect (when you need the runtime object)
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
const sandbox = sandboxes.getSandbox(sandboxId);
|
|
152
|
+
|
|
153
|
+
const rec = await sandbox.reconnect();
|
|
154
|
+
if (!rec.ok) throw new Error(rec.error);
|
|
155
|
+
|
|
156
|
+
const { sandbox } = rec.data;
|
|
157
|
+
// Use sandbox.runCommand(...) / sandbox.writeFiles(...) / etc.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 5) Stop (optional)
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
const sandbox = sandboxes.getSandbox(sandboxId);
|
|
164
|
+
|
|
165
|
+
const stopped = await sandbox.stop();
|
|
166
|
+
if (!stopped.ok) throw new Error(stopped.error);
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Behavioral notes
|
|
172
|
+
|
|
173
|
+
### `createSandbox(config)`
|
|
174
|
+
- Creates an InstantDB record `sandbox_sandboxes[sandboxId]` with status `"creating"`.
|
|
175
|
+
- Provisions a provider sandbox (provider-specific).
|
|
176
|
+
- Updates the record to status `"active"` and stores `externalSandboxId` (provider sandbox id).
|
|
177
|
+
|
|
178
|
+
### `reconnectToSandbox(sandboxId)`
|
|
179
|
+
- Loads the record by internal `sandboxId`.
|
|
180
|
+
- Validates:
|
|
181
|
+
- record exists
|
|
182
|
+
- `externalSandboxId` exists
|
|
183
|
+
- Reconnects using the provider SDK/client (provider-specific).
|
|
184
|
+
- Returns `ok: false` if sandbox is not found/not running.
|
|
185
|
+
- If reconnection fails and the record was `"active"`, it may mark the record as `"shutdown"`.
|
|
186
|
+
|
|
187
|
+
### `runCommand(sandboxId, command, args?)`
|
|
188
|
+
- Durable-friendly command execution.
|
|
189
|
+
- Attempts to reconnect; if unavailable it may recreate the sandbox from the stored record configuration and retry.
|
|
190
|
+
- Returns a capped output payload suitable for storing in logs.
|
|
191
|
+
|
|
192
|
+
### `stopSandbox(sandboxId)`
|
|
193
|
+
- Attempts to reconnect and stop the provider sandbox.
|
|
194
|
+
- Marks the record as `"shutdown"` regardless (the provider sandbox may already be gone).
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Usage
|
|
199
|
+
The examples above cover the typical flows. When integrating in a real app, prefer `runCommand()` (provider-agnostic) and only call `reconnectToSandbox()` when you need direct access to the provider runtime object.
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
// Preferred: bind sandboxId once
|
|
203
|
+
const sandbox = sandboxes.getSandbox(sandboxId);
|
|
204
|
+
|
|
205
|
+
// Typical: run a command
|
|
206
|
+
await sandbox.runCommand("python", ["-c", "print('hello')"]);
|
|
207
|
+
|
|
208
|
+
// Advanced: reconnect for direct provider access
|
|
209
|
+
const rec = await sandbox.reconnect();
|
|
210
|
+
if (rec.ok) {
|
|
211
|
+
const { sandbox } = rec.data;
|
|
212
|
+
await sandbox.runCommand({ cmd: "echo", args: ["ok"] });
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Providers
|
|
219
|
+
|
|
220
|
+
This package is designed to support multiple sandbox providers behind the same interface.
|
|
221
|
+
|
|
222
|
+
### Vercel Sandbox (current provider)
|
|
223
|
+
|
|
224
|
+
Environment variables:
|
|
225
|
+
- `SANDBOX_VERCEL_TEAM_ID`
|
|
226
|
+
- `SANDBOX_VERCEL_PROJECT_ID`
|
|
227
|
+
- `SANDBOX_VERCEL_TOKEN`
|
|
228
|
+
|
|
229
|
+
Provider behavior notes:
|
|
230
|
+
- `externalSandboxId` maps to Vercel's sandbox id (e.g. `sandbox.sandboxId`).
|
|
231
|
+
- Reconnect is done via `Sandbox.get(...)` using the stored `externalSandboxId`.
|
|
232
|
+
|
|
233
|
+
### Ekairos Cloud (planned provider)
|
|
234
|
+
|
|
235
|
+
Ekairos Cloud will provide sandboxes behind the same interface as the Vercel provider.
|
|
236
|
+
It will be configured via an API key and act as a thin wrapper.
|
|
237
|
+
|
|
238
|
+
Environment variables (planned):
|
|
239
|
+
- `EKAIROS_CLOUD_API_KEY`
|
|
240
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Sandbox } from "@vercel/sandbox";
|
|
2
|
+
export interface CommandResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
exitCode?: number;
|
|
5
|
+
output?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
streamingLogs?: unknown[];
|
|
8
|
+
command?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Ejecuta un comando en un sandbox.
|
|
12
|
+
*
|
|
13
|
+
* Nota: sin logs con interpolación para respetar reglas del repo.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runCommandInSandbox(sandbox: Sandbox, command: string, args?: string[]): Promise<CommandResult>;
|
|
16
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,EAAE,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,GAClB,OAAO,CAAC,aAAa,CAAC,CAsBxB"}
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ejecuta un comando en un sandbox.
|
|
3
|
+
*
|
|
4
|
+
* Nota: sin logs con interpolación para respetar reglas del repo.
|
|
5
|
+
*/
|
|
6
|
+
export async function runCommandInSandbox(sandbox, command, args = []) {
|
|
7
|
+
try {
|
|
8
|
+
// @vercel/sandbox soporta { cmd, args } en runCommand
|
|
9
|
+
const result = await sandbox.runCommand({ cmd: command, args });
|
|
10
|
+
const stdout = (await result.stdout()) ?? "";
|
|
11
|
+
const stderr = (await result.stderr()) ?? "";
|
|
12
|
+
const fullCommand = args.length > 0 ? [command, ...args].join(" ") : command;
|
|
13
|
+
return {
|
|
14
|
+
success: (result.exitCode ?? 0) === 0,
|
|
15
|
+
exitCode: result.exitCode ?? 0,
|
|
16
|
+
output: stdout,
|
|
17
|
+
error: stderr,
|
|
18
|
+
command: fullCommand,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
23
|
+
const fullCommand = args.length > 0 ? [command, ...args].join(" ") : command;
|
|
24
|
+
return { success: false, error: message, command: fullCommand };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAgB,EAChB,OAAe,EACf,OAAiB,EAAE;IAEnB,IAAI,CAAC;QACH,sDAAsD;QACtD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAA;QAC5C,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAA;QAE5C,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAE5E,OAAO;YACL,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC;YACrC,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,CAAC;YAC9B,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,WAAW;SACrB,CAAA;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACtE,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAC5E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAA;IACjE,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { SandboxConfig, SandboxId, SandboxProvider, SandboxRunCommandResult, } from "./types.js";
|
|
2
|
+
export { sandboxDomain } from "./schema.js";
|
|
3
|
+
export { SandboxService } from "./service.js";
|
|
4
|
+
export type { CommandResult } from "./commands.js";
|
|
5
|
+
export { runCommandInSandbox } from "./commands.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,SAAS,EACT,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type SandboxRuntime = {
|
|
2
|
+
/**
|
|
3
|
+
* Instant Admin DB (or compatible) that contains `sandbox_sandboxes`.
|
|
4
|
+
*/
|
|
5
|
+
db: any;
|
|
6
|
+
};
|
|
7
|
+
export type SandboxRuntimeResolver = () => Promise<SandboxRuntime> | SandboxRuntime;
|
|
8
|
+
export declare function configureSandboxRuntime(resolver: SandboxRuntimeResolver): void;
|
|
9
|
+
export declare function isSandboxRuntimeConfigured(): boolean;
|
|
10
|
+
export declare function resolveSandboxRuntime(): Promise<SandboxRuntime>;
|
|
11
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,EAAE,EAAE,GAAG,CAAA;CACR,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAAA;AAInF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,sBAAsB,QAEvE;AAED,wBAAgB,0BAA0B,YAEzC;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,cAAc,CAAC,CAMrE"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
let runtimeResolver = null;
|
|
2
|
+
export function configureSandboxRuntime(resolver) {
|
|
3
|
+
runtimeResolver = resolver;
|
|
4
|
+
}
|
|
5
|
+
export function isSandboxRuntimeConfigured() {
|
|
6
|
+
return Boolean(runtimeResolver);
|
|
7
|
+
}
|
|
8
|
+
export async function resolveSandboxRuntime() {
|
|
9
|
+
if (!runtimeResolver) {
|
|
10
|
+
throw new Error("Sandbox runtime is not configured.");
|
|
11
|
+
}
|
|
12
|
+
return await runtimeResolver();
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AASA,IAAI,eAAe,GAAkC,IAAI,CAAA;AAEzD,MAAM,UAAU,uBAAuB,CAAC,QAAgC;IACtE,eAAe,GAAG,QAAQ,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,OAAO,OAAO,CAAC,eAAe,CAAC,CAAA;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACvD,CAAC;IAED,OAAO,MAAM,eAAe,EAAE,CAAA;AAChC,CAAC"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const sandboxDomain: import("@ekairos/domain").DomainSchemaResult<{
|
|
2
|
+
sandbox_sandboxes: import("@instantdb/core").EntityDef<{
|
|
3
|
+
externalSandboxId: import("@instantdb/core").DataAttrDef<string, false, true>;
|
|
4
|
+
provider: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
5
|
+
sandboxUrl: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
6
|
+
status: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
7
|
+
timeout: import("@instantdb/core").DataAttrDef<number, false, false>;
|
|
8
|
+
runtime: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
9
|
+
vcpus: import("@instantdb/core").DataAttrDef<number, false, false>;
|
|
10
|
+
ports: import("@instantdb/core").DataAttrDef<any, false, false>;
|
|
11
|
+
purpose: import("@instantdb/core").DataAttrDef<string, false, true>;
|
|
12
|
+
params: import("@instantdb/core").DataAttrDef<any, false, false>;
|
|
13
|
+
createdAt: import("@instantdb/core").DataAttrDef<number, true, true>;
|
|
14
|
+
updatedAt: import("@instantdb/core").DataAttrDef<number, false, true>;
|
|
15
|
+
shutdownAt: import("@instantdb/core").DataAttrDef<number, false, true>;
|
|
16
|
+
}, {}, void>;
|
|
17
|
+
}, {}, import("@instantdb/core").RoomsDef>;
|
|
18
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;0CAoBxB,CAAA"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { i } from "@instantdb/core";
|
|
2
|
+
import { domain } from "@ekairos/domain";
|
|
3
|
+
// Port de `ekairos-core/src/lib/domain/sandbox/schema.ts`
|
|
4
|
+
export const sandboxDomain = domain("sandbox").schema({
|
|
5
|
+
entities: {
|
|
6
|
+
sandbox_sandboxes: i.entity({
|
|
7
|
+
externalSandboxId: i.string().optional().indexed(),
|
|
8
|
+
provider: i.string().indexed(),
|
|
9
|
+
sandboxUrl: i.string().optional(),
|
|
10
|
+
status: i.string().indexed(),
|
|
11
|
+
timeout: i.number().optional(),
|
|
12
|
+
runtime: i.string().optional(),
|
|
13
|
+
vcpus: i.number().optional(),
|
|
14
|
+
ports: i.json().optional(),
|
|
15
|
+
purpose: i.string().optional().indexed(),
|
|
16
|
+
params: i.json().optional(),
|
|
17
|
+
createdAt: i.number().indexed(),
|
|
18
|
+
updatedAt: i.number().optional().indexed(),
|
|
19
|
+
shutdownAt: i.number().optional().indexed(),
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
links: {},
|
|
23
|
+
rooms: {},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.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AAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Sandbox } from "@vercel/sandbox";
|
|
2
|
+
import { type InstantAdminDatabase } from "@instantdb/admin";
|
|
3
|
+
import { SchemaOf } from "@ekairos/domain";
|
|
4
|
+
import { type CommandResult } from "./commands.js";
|
|
5
|
+
import { sandboxDomain } from "./schema.js";
|
|
6
|
+
import type { SandboxConfig } from "./types.js";
|
|
7
|
+
type SandboxSchemaType = SchemaOf<typeof sandboxDomain>;
|
|
8
|
+
export interface SandboxRecord {
|
|
9
|
+
id: string;
|
|
10
|
+
externalSandboxId?: string;
|
|
11
|
+
provider: string;
|
|
12
|
+
sandboxUrl?: string;
|
|
13
|
+
status: "creating" | "active" | "shutdown" | "error" | "recreating";
|
|
14
|
+
timeout?: number;
|
|
15
|
+
runtime?: string;
|
|
16
|
+
vcpus?: number;
|
|
17
|
+
ports?: number[];
|
|
18
|
+
purpose?: string;
|
|
19
|
+
params?: Record<string, any>;
|
|
20
|
+
createdAt: number;
|
|
21
|
+
updatedAt?: number;
|
|
22
|
+
shutdownAt?: number;
|
|
23
|
+
}
|
|
24
|
+
export type ServiceResult<T = any> = {
|
|
25
|
+
ok: true;
|
|
26
|
+
data: T;
|
|
27
|
+
} | {
|
|
28
|
+
ok: false;
|
|
29
|
+
error: string;
|
|
30
|
+
};
|
|
31
|
+
export declare class SandboxService {
|
|
32
|
+
private adminDb;
|
|
33
|
+
constructor(db: InstantAdminDatabase<SandboxSchemaType>);
|
|
34
|
+
private static getVercelCredentials;
|
|
35
|
+
private static provisionVercelSandbox;
|
|
36
|
+
createSandbox(config: SandboxConfig): Promise<ServiceResult<{
|
|
37
|
+
sandboxId: string;
|
|
38
|
+
}>>;
|
|
39
|
+
reconnectToSandbox(sandboxId: string): Promise<ServiceResult<{
|
|
40
|
+
sandbox: Sandbox;
|
|
41
|
+
}>>;
|
|
42
|
+
stopSandbox(sandboxId: string): Promise<ServiceResult<void>>;
|
|
43
|
+
runCommand(sandboxId: string, command: string, args?: string[]): Promise<ServiceResult<CommandResult>>;
|
|
44
|
+
writeFiles(sandboxId: string, files: Array<{
|
|
45
|
+
path: string;
|
|
46
|
+
contentBase64: string;
|
|
47
|
+
}>): Promise<ServiceResult<void>>;
|
|
48
|
+
readFile(sandboxId: string, path: string): Promise<ServiceResult<{
|
|
49
|
+
contentBase64: string;
|
|
50
|
+
}>>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAM,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,KAAK,iBAAiB,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAA;AAEvD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAA;IACnE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC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,OAAO,CAAC,aAAa,CAAC;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CA4BnG"}
|
package/dist/service.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Sandbox } from "@vercel/sandbox";
|
|
2
|
+
import { id } from "@instantdb/admin";
|
|
3
|
+
import { runCommandInSandbox } from "./commands.js";
|
|
4
|
+
function formatInstantSchemaError(err) {
|
|
5
|
+
const base = err instanceof Error ? err.message : String(err);
|
|
6
|
+
const body = err?.body;
|
|
7
|
+
const hintErrors = body?.hint?.errors;
|
|
8
|
+
if (!Array.isArray(hintErrors) || hintErrors.length === 0) {
|
|
9
|
+
return base;
|
|
10
|
+
}
|
|
11
|
+
const missingAttrs = [];
|
|
12
|
+
for (const he of hintErrors) {
|
|
13
|
+
const attrs = he?.hint?.attributes;
|
|
14
|
+
if (Array.isArray(attrs)) {
|
|
15
|
+
for (const a of attrs) {
|
|
16
|
+
if (typeof a === "string")
|
|
17
|
+
missingAttrs.push(a);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const uniq = Array.from(new Set(missingAttrs));
|
|
22
|
+
if (uniq.length === 0)
|
|
23
|
+
return base;
|
|
24
|
+
// Keep it short + copy/paste friendly for debugging schema issues.
|
|
25
|
+
return base + " | missing attributes: " + uniq.join(", ");
|
|
26
|
+
}
|
|
27
|
+
export class SandboxService {
|
|
28
|
+
constructor(db) {
|
|
29
|
+
this.adminDb = db;
|
|
30
|
+
}
|
|
31
|
+
static getVercelCredentials() {
|
|
32
|
+
const teamId = String(process.env.SANDBOX_VERCEL_TEAM_ID ?? "").trim();
|
|
33
|
+
const projectId = String(process.env.SANDBOX_VERCEL_PROJECT_ID ?? "").trim();
|
|
34
|
+
const token = String(process.env.SANDBOX_VERCEL_TOKEN ?? "").trim();
|
|
35
|
+
if (!teamId || !projectId || !token) {
|
|
36
|
+
throw new Error("Missing required Vercel sandbox environment variables");
|
|
37
|
+
}
|
|
38
|
+
return { teamId, projectId, token };
|
|
39
|
+
}
|
|
40
|
+
static async provisionVercelSandbox(config) {
|
|
41
|
+
const creds = SandboxService.getVercelCredentials();
|
|
42
|
+
return await Sandbox.create({
|
|
43
|
+
teamId: creds.teamId,
|
|
44
|
+
projectId: creds.projectId,
|
|
45
|
+
token: creds.token,
|
|
46
|
+
timeout: config.timeoutMs ?? 5 * 60 * 1000,
|
|
47
|
+
ports: Array.isArray(config.ports) ? config.ports : [],
|
|
48
|
+
// IMPORTANT: pass runtime as-is (e.g. "python3.13") to match provider expectations.
|
|
49
|
+
// Don't normalize to "python3"/"node22" as that can cause provider-side 400s.
|
|
50
|
+
runtime: (config.runtime ?? "node22"),
|
|
51
|
+
resources: { vcpus: config.resources?.vcpus ?? 2 },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async createSandbox(config) {
|
|
55
|
+
const sandboxId = id();
|
|
56
|
+
const now = Date.now();
|
|
57
|
+
try {
|
|
58
|
+
await this.adminDb.transact(this.adminDb.tx.sandbox_sandboxes[sandboxId].update({
|
|
59
|
+
status: "creating",
|
|
60
|
+
provider: "vercel",
|
|
61
|
+
timeout: config.timeoutMs,
|
|
62
|
+
runtime: config.runtime,
|
|
63
|
+
vcpus: config.resources?.vcpus,
|
|
64
|
+
ports: config.ports,
|
|
65
|
+
purpose: config.purpose,
|
|
66
|
+
params: config.params,
|
|
67
|
+
createdAt: now,
|
|
68
|
+
updatedAt: now,
|
|
69
|
+
}));
|
|
70
|
+
let sandbox;
|
|
71
|
+
try {
|
|
72
|
+
sandbox = await SandboxService.provisionVercelSandbox(config);
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
76
|
+
await this.adminDb.transact(this.adminDb.tx.sandbox_sandboxes[sandboxId].update({
|
|
77
|
+
status: "error",
|
|
78
|
+
updatedAt: Date.now(),
|
|
79
|
+
params: { ...(config.params ?? {}), error: msg },
|
|
80
|
+
}));
|
|
81
|
+
return { ok: false, error: msg };
|
|
82
|
+
}
|
|
83
|
+
await this.adminDb.transact(this.adminDb.tx.sandbox_sandboxes[sandboxId].update({
|
|
84
|
+
status: "active",
|
|
85
|
+
externalSandboxId: sandbox.sandboxId,
|
|
86
|
+
updatedAt: Date.now(),
|
|
87
|
+
}));
|
|
88
|
+
return { ok: true, data: { sandboxId } };
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
return { ok: false, error: formatInstantSchemaError(e) };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async reconnectToSandbox(sandboxId) {
|
|
95
|
+
try {
|
|
96
|
+
const recordResult = await this.adminDb.query({
|
|
97
|
+
sandbox_sandboxes: { $: { where: { id: sandboxId }, limit: 1 } },
|
|
98
|
+
});
|
|
99
|
+
const record = recordResult?.sandbox_sandboxes?.[0];
|
|
100
|
+
if (!record || !record.externalSandboxId || record.provider !== "vercel") {
|
|
101
|
+
return { ok: false, error: "Valid sandbox record not found" };
|
|
102
|
+
}
|
|
103
|
+
const creds = SandboxService.getVercelCredentials();
|
|
104
|
+
try {
|
|
105
|
+
const maxAttempts = 20;
|
|
106
|
+
const delayMs = 500;
|
|
107
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
108
|
+
const sandbox = await Sandbox.get({
|
|
109
|
+
sandboxId: String(record.externalSandboxId),
|
|
110
|
+
teamId: creds.teamId,
|
|
111
|
+
projectId: creds.projectId,
|
|
112
|
+
token: creds.token,
|
|
113
|
+
});
|
|
114
|
+
if (!sandbox)
|
|
115
|
+
return { ok: false, error: "Sandbox not found" };
|
|
116
|
+
if (sandbox.status === "running") {
|
|
117
|
+
return { ok: true, data: { sandbox } };
|
|
118
|
+
}
|
|
119
|
+
await new Promise((r) => setTimeout(r, delayMs));
|
|
120
|
+
}
|
|
121
|
+
return { ok: false, error: "Sandbox not active" };
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
if (record.status === "active") {
|
|
125
|
+
await this.adminDb.transact(this.adminDb.tx.sandbox_sandboxes[sandboxId].update({
|
|
126
|
+
status: "shutdown",
|
|
127
|
+
shutdownAt: Date.now(),
|
|
128
|
+
updatedAt: Date.now(),
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
132
|
+
return { ok: false, error: msg };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
return { ok: false, error: formatInstantSchemaError(e) };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async stopSandbox(sandboxId) {
|
|
140
|
+
try {
|
|
141
|
+
const result = await this.reconnectToSandbox(sandboxId);
|
|
142
|
+
if (result.ok) {
|
|
143
|
+
try {
|
|
144
|
+
await result.data.sandbox.stop();
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// ignore
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
await this.adminDb.transact(this.adminDb.tx.sandbox_sandboxes[sandboxId].update({
|
|
151
|
+
status: "shutdown",
|
|
152
|
+
shutdownAt: Date.now(),
|
|
153
|
+
updatedAt: Date.now(),
|
|
154
|
+
}));
|
|
155
|
+
return { ok: true, data: undefined };
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
return { ok: false, error: formatInstantSchemaError(e) };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async runCommand(sandboxId, command, args = []) {
|
|
162
|
+
try {
|
|
163
|
+
const sandboxResult = await this.reconnectToSandbox(sandboxId);
|
|
164
|
+
if (!sandboxResult.ok)
|
|
165
|
+
return { ok: false, error: sandboxResult.error };
|
|
166
|
+
const result = await runCommandInSandbox(sandboxResult.data.sandbox, command, args);
|
|
167
|
+
return { ok: true, data: result };
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
return { ok: false, error: formatInstantSchemaError(e) };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async writeFiles(sandboxId, files) {
|
|
174
|
+
try {
|
|
175
|
+
const sandboxResult = await this.reconnectToSandbox(sandboxId);
|
|
176
|
+
if (!sandboxResult.ok)
|
|
177
|
+
return { ok: false, error: sandboxResult.error };
|
|
178
|
+
await sandboxResult.data.sandbox.writeFiles(files.map((f) => ({
|
|
179
|
+
path: f.path,
|
|
180
|
+
content: Buffer.from(f.contentBase64, "base64"),
|
|
181
|
+
})));
|
|
182
|
+
return { ok: true, data: undefined };
|
|
183
|
+
}
|
|
184
|
+
catch (e) {
|
|
185
|
+
return { ok: false, error: formatInstantSchemaError(e) };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async readFile(sandboxId, path) {
|
|
189
|
+
try {
|
|
190
|
+
const sandboxResult = await this.reconnectToSandbox(sandboxId);
|
|
191
|
+
if (!sandboxResult.ok)
|
|
192
|
+
return { ok: false, error: sandboxResult.error };
|
|
193
|
+
const stream = await sandboxResult.data.sandbox.readFile({ path });
|
|
194
|
+
if (!stream) {
|
|
195
|
+
return { ok: true, data: { contentBase64: "" } };
|
|
196
|
+
}
|
|
197
|
+
const chunks = [];
|
|
198
|
+
for await (const chunk of stream) {
|
|
199
|
+
if (typeof chunk === "string") {
|
|
200
|
+
chunks.push(Buffer.from(chunk, "utf-8"));
|
|
201
|
+
}
|
|
202
|
+
else if (chunk instanceof Uint8Array) {
|
|
203
|
+
chunks.push(Buffer.from(chunk));
|
|
204
|
+
}
|
|
205
|
+
else if (chunk instanceof ArrayBuffer) {
|
|
206
|
+
chunks.push(Buffer.from(chunk));
|
|
207
|
+
}
|
|
208
|
+
else if (chunk) {
|
|
209
|
+
chunks.push(Buffer.from(chunk));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return { ok: true, data: { contentBase64: Buffer.concat(chunks).toString("base64") } };
|
|
213
|
+
}
|
|
214
|
+
catch (e) {
|
|
215
|
+
return { ok: false, error: formatInstantSchemaError(e) };
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
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AY,WAAW,EAAE,CAAC;oBACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;gBACjC,CAAC;qBAAM,IAAI,KAAK,EAAE,CAAC;oBACjB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;gBACjC,CAAC;YACH,CAAC;YAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAA;QACxF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1D,CAAC;IACH,CAAC;CACF"}
|
package/dist/steps.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAA"}
|
package/dist/steps.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type SandboxId = string;
|
|
2
|
+
export type SandboxConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* Provider runtime, e.g. "python3.13", "node22"
|
|
5
|
+
*/
|
|
6
|
+
runtime?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Max lifetime in ms.
|
|
9
|
+
*/
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
ports?: number[];
|
|
12
|
+
resources?: {
|
|
13
|
+
vcpus?: number;
|
|
14
|
+
};
|
|
15
|
+
purpose?: string;
|
|
16
|
+
params?: Record<string, any>;
|
|
17
|
+
};
|
|
18
|
+
export type SandboxRunCommandResult = {
|
|
19
|
+
exitCode: number;
|
|
20
|
+
stdout: string;
|
|
21
|
+
stderr: string;
|
|
22
|
+
};
|
|
23
|
+
export type SandboxProvider = "vercel";
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,SAAS,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ekairos/sandbox",
|
|
3
|
+
"version": "1.21.53-beta.0",
|
|
4
|
+
"description": "Pulzar Sandbox - Provider-agnostic sandbox helpers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/pulz-ar/pulzar-lib-core.git",
|
|
19
|
+
"directory": "packages/sandbox"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"require": "./dist/index.js",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.json",
|
|
31
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
32
|
+
"clean": "node -e \"require('fs').rmSync('dist', {recursive:true, force:true})\"",
|
|
33
|
+
"typecheck": "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@ekairos/domain": "^1.21.53-beta.0",
|
|
37
|
+
"@instantdb/admin": "^0.22.13",
|
|
38
|
+
"@instantdb/core": "^0.22.13",
|
|
39
|
+
"@vercel/sandbox": "^0.0.23",
|
|
40
|
+
"zod": "^4.1.8"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@ekairos/tsconfig": "workspace:*",
|
|
44
|
+
"@types/node": "^24.5.0",
|
|
45
|
+
"typescript": "^5.9.2"
|
|
46
|
+
}
|
|
47
|
+
}
|