@computesdk/workbench 22.0.0 → 24.0.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 +11 -88
- package/dist/bin/workbench.js +61 -713
- package/dist/bin/workbench.js.map +1 -1
- package/dist/helpers.d.ts +0 -4
- package/dist/helpers.js +2 -2
- package/dist/helpers.js.map +1 -1
- package/dist/index.js +61 -713
- package/dist/index.js.map +1 -1
- package/package.json +25 -22
package/README.md
CHANGED
|
@@ -67,24 +67,16 @@ drwxr-xr-x 2 user user 4096 Dec 12 19:01 repo
|
|
|
67
67
|
|
|
68
68
|
### Workbench Commands
|
|
69
69
|
|
|
70
|
-
- `provider <name>` - Switch provider
|
|
71
|
-
- `provider direct <name>` - Switch to direct provider connection (e.g., `provider direct e2b`)
|
|
70
|
+
- `provider <name>` - Switch provider (e.g., `provider e2b`)
|
|
72
71
|
- `providers` - List all providers with status
|
|
73
72
|
- `restart` - Restart current sandbox
|
|
74
73
|
- `destroy` - Destroy current sandbox
|
|
75
|
-
- `connect <url> [token]` - Connect to existing sandbox via URL (e.g., `connect https://sandbox-123.localhost:8080` or `connect https://sandbox-123.localhost:8080 your_token`)
|
|
76
74
|
- `info` - Show sandbox info (provider, uptime)
|
|
77
75
|
- `env` - Show environment/credentials status
|
|
78
76
|
- `help` - Show this help
|
|
79
77
|
- `exit` - Exit workbench
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
- **Gateway mode (default)**: Routes through ComputeSDK API, zero-config setup
|
|
83
|
-
- Example: `provider e2b` uses E2B via gateway
|
|
84
|
-
- Requires: `COMPUTESDK_API_KEY` + provider credentials
|
|
85
|
-
- **Direct mode**: Connects directly to provider, requires provider packages
|
|
86
|
-
- Example: `provider direct e2b` connects directly to E2B
|
|
87
|
-
- Requires: Provider package installed (`@computesdk/e2b`) + provider credentials
|
|
79
|
+
Each provider requires its package installed (e.g. `@computesdk/e2b`) and its credentials configured.
|
|
88
80
|
|
|
89
81
|
### Running Commands
|
|
90
82
|
|
|
@@ -127,100 +119,45 @@ wget('https://file.com/download.zip')
|
|
|
127
119
|
|
|
128
120
|
## Provider Switching
|
|
129
121
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
Switch between providers via the gateway:
|
|
122
|
+
Switch between providers:
|
|
133
123
|
|
|
134
124
|
```
|
|
135
125
|
workbench> provider e2b
|
|
136
|
-
✅ Switched to e2b
|
|
126
|
+
✅ Switched to e2b
|
|
137
127
|
|
|
138
128
|
workbench> npm.install('express')
|
|
139
|
-
⏳ Creating sandbox with e2b
|
|
129
|
+
⏳ Creating sandbox with e2b...
|
|
140
130
|
✅ Sandbox ready (1.2s)
|
|
141
131
|
Running: npm install express
|
|
142
132
|
✅ Completed (3.2s)
|
|
143
133
|
|
|
144
134
|
workbench> provider railway
|
|
145
135
|
Destroy current sandbox? (y/N): y
|
|
146
|
-
✅ Switched to railway
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Direct Mode (Advanced)
|
|
150
|
-
|
|
151
|
-
Connect directly to providers (requires provider packages):
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
workbench> provider direct e2b
|
|
155
|
-
✅ Switched to e2b (direct)
|
|
156
|
-
|
|
157
|
-
workbench> pwd()
|
|
158
|
-
⏳ Creating sandbox with e2b (direct)...
|
|
159
|
-
✅ Sandbox ready (2.5s)
|
|
160
|
-
Running: pwd
|
|
161
|
-
/home
|
|
162
|
-
✅ Completed (0.1s)
|
|
136
|
+
✅ Switched to railway
|
|
163
137
|
```
|
|
164
138
|
|
|
165
|
-
## Connect to Existing Sandboxes
|
|
166
|
-
|
|
167
|
-
You can connect to an existing sandbox instance via its URL. This is particularly useful for:
|
|
168
|
-
- Connecting to locally running sandboxes
|
|
169
|
-
- Attaching to sandboxes created by other tools
|
|
170
|
-
- Debugging existing sandbox instances
|
|
171
|
-
|
|
172
|
-
### Without Authentication
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
workbench> connect https://sandbox-123.localhost:8080
|
|
176
|
-
⏳ Connecting to https://sandbox-123.localhost:8080...
|
|
177
|
-
✅ Connected to sandbox (0.5s)
|
|
178
|
-
Provider: e2b
|
|
179
|
-
Sandbox ID: sandbox-123
|
|
180
|
-
|
|
181
|
-
connected:sandbox-123> ls('/home')
|
|
182
|
-
Running: ls /home
|
|
183
|
-
total 8
|
|
184
|
-
drwxr-xr-x 3 user user 4096 Dec 12 19:00 app
|
|
185
|
-
✅ Completed (0.1s)
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### With Access Token
|
|
189
|
-
|
|
190
|
-
If the sandbox requires authentication, you can provide an access token:
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
workbench> connect https://sandbox-123.localhost:8080 your_access_token_here
|
|
194
|
-
⏳ Connecting to https://sandbox-123.localhost:8080...
|
|
195
|
-
✅ Connected to sandbox (0.5s)
|
|
196
|
-
Provider: e2b
|
|
197
|
-
Sandbox ID: sandbox-123
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
Note: When you exit the workbench after connecting to an external sandbox, it will disconnect without destroying the sandbox (since you don't own it).
|
|
201
|
-
|
|
202
139
|
## Creating and Switching Sandboxes
|
|
203
140
|
|
|
204
|
-
When you create a sandbox using `create()`,
|
|
141
|
+
When you create a sandbox using `create()`, it automatically becomes your current active sandbox. All subsequent commands will run on this sandbox.
|
|
205
142
|
|
|
206
143
|
```javascript
|
|
207
144
|
> create({ namespace: "h" })
|
|
208
145
|
✅ Switched to sandbox sandbox-123
|
|
209
|
-
{ sandboxId: 'sandbox-123', provider: '
|
|
210
|
-
|
|
146
|
+
{ sandboxId: 'sandbox-123', provider: 'e2b', metadata: {} }
|
|
147
|
+
e2b:sandbox-123> // Prompt shows you're now on this sandbox
|
|
211
148
|
|
|
212
149
|
> ls('/home') // Runs on sandbox-123
|
|
213
150
|
```
|
|
214
151
|
|
|
215
152
|
### Switching Between Sandboxes
|
|
216
153
|
|
|
217
|
-
If you already have an active sandbox and create
|
|
154
|
+
If you already have an active sandbox and create another one, the workbench will prompt you:
|
|
218
155
|
|
|
219
156
|
```javascript
|
|
220
157
|
e2b:sandbox-456> create({ namespace: "prod" })
|
|
221
158
|
Switch to new sandbox? (Y/n): y
|
|
222
159
|
✅ Switched to sandbox sandbox-789
|
|
223
|
-
|
|
160
|
+
e2b:sandbox-789>
|
|
224
161
|
```
|
|
225
162
|
|
|
226
163
|
Press Enter or type "y" to switch. Type "n" to create the sandbox without switching to it.
|
|
@@ -243,16 +180,6 @@ e2b railway daytona modal runloop vercel
|
|
|
243
180
|
|
|
244
181
|
## Supported Providers
|
|
245
182
|
|
|
246
|
-
### Gateway Provider (Zero-Config)
|
|
247
|
-
|
|
248
|
-
The **gateway** provider uses the ComputeSDK API to automatically route to any provider:
|
|
249
|
-
|
|
250
|
-
- No provider packages needed
|
|
251
|
-
- Just set `COMPUTESDK_API_KEY` + provider credentials
|
|
252
|
-
- Auto-detects provider from your environment
|
|
253
|
-
|
|
254
|
-
### Direct Provider Packages
|
|
255
|
-
|
|
256
183
|
Install any combination of:
|
|
257
184
|
|
|
258
185
|
- `@computesdk/e2b` - E2B sandboxes
|
|
@@ -270,9 +197,6 @@ Install any combination of:
|
|
|
270
197
|
Set provider credentials in `.env`:
|
|
271
198
|
|
|
272
199
|
```bash
|
|
273
|
-
# Gateway Provider (Zero-Config)
|
|
274
|
-
COMPUTESDK_API_KEY=computesdk_live_xxx
|
|
275
|
-
|
|
276
200
|
# E2B
|
|
277
201
|
E2B_API_KEY=e2b_xxx
|
|
278
202
|
|
|
@@ -325,7 +249,6 @@ The workbench is a full Node.js REPL with the ComputeSDK pre-loaded. You can rep
|
|
|
325
249
|
| SDK Test Code | Workbench Equivalent |
|
|
326
250
|
|---------------|---------------------|
|
|
327
251
|
| `sandbox.runCommand('echo hi')` | `runCommand('echo hi')` or `getInstance().runCommand(...)` |
|
|
328
|
-
| `sandbox.terminal.create()` | `terminal.create()` |
|
|
329
252
|
| `sandbox.filesystem.readFile(path)` | `filesystem.readFile(path)` |
|
|
330
253
|
| `sandbox.getInfo()` | `sandboxInfo()` |
|
|
331
254
|
| `sandbox.getUrl({ port })` | `getUrl({ port: 3000 })` |
|