@computesdk/superserve 0.2.11 → 0.2.12
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 +8 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ compute.setConfig({
|
|
|
28
28
|
provider: superserve({ apiKey: process.env.SUPERSERVE_API_KEY }),
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
const sandbox = await compute.
|
|
31
|
+
const sandbox = await compute.instances.create();
|
|
32
32
|
|
|
33
33
|
const result = await sandbox.runCommand('node -v');
|
|
34
34
|
console.log(result.stdout);
|
|
@@ -77,7 +77,7 @@ superserve({
|
|
|
77
77
|
Boots a new microVM. Common options:
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
|
-
await compute.
|
|
80
|
+
await compute.instances.create({
|
|
81
81
|
templateId: 'superserve/python-3.11', // optional, defaults to superserve/base
|
|
82
82
|
timeout: 60_000, // auto-pause timeout in ms
|
|
83
83
|
envs: { API_KEY: 'value' },
|
|
@@ -161,10 +161,10 @@ ComputeSDK's `stopped`, `failed` as `error`, and every other state as
|
|
|
161
161
|
|
|
162
162
|
```typescript
|
|
163
163
|
const items = await provider.sandbox.list(); // read-only, no side effects
|
|
164
|
-
const sandbox = await provider.sandbox.getById(items[0].
|
|
164
|
+
const sandbox = await provider.sandbox.getById(items[0].instanceId);
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
`list()` is read-only — it returns `
|
|
167
|
+
`list()` is read-only — it returns `InstanceInfo` stubs without opening a
|
|
168
168
|
session. To actually operate on a listed entry, call `getById(id)`.
|
|
169
169
|
|
|
170
170
|
Note that `getById()` issues `POST /activate` on the sandbox, which
|
|
@@ -185,20 +185,20 @@ require a build spec (`from` + `steps`), which the ComputeSDK
|
|
|
185
185
|
### Snapshots
|
|
186
186
|
|
|
187
187
|
```typescript
|
|
188
|
-
const snapshot = await provider.snapshot!.create(sandbox.
|
|
188
|
+
const snapshot = await provider.snapshot!.create(sandbox.instanceId, {
|
|
189
189
|
name: 'before-upgrade',
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
// Boot a new sandbox from it; processes that were running continue.
|
|
193
193
|
const fork = await provider.sandbox.create({ snapshotId: snapshot.id });
|
|
194
194
|
|
|
195
|
-
const snapshots = await provider.snapshot!.list({
|
|
195
|
+
const snapshots = await provider.snapshot!.list({ instanceId: sandbox.instanceId });
|
|
196
196
|
await provider.snapshot!.delete(snapshot.id);
|
|
197
197
|
```
|
|
198
198
|
|
|
199
199
|
A snapshot saves a sandbox's memory and disk and is kept until deleted, even
|
|
200
200
|
after the original sandbox is gone. Snapshots are listed per sandbox: pass
|
|
201
|
-
`
|
|
201
|
+
`instanceId` to `list()`, which returns an empty list without it.
|
|
202
202
|
`snapshot.create()` connects to the sandbox first, which resumes it if it is
|
|
203
203
|
paused. See the
|
|
204
204
|
[snapshots guide](https://docs.superserve.ai/sandbox/snapshots).
|
|
@@ -209,7 +209,7 @@ Common errors and how to recover:
|
|
|
209
209
|
|
|
210
210
|
```typescript
|
|
211
211
|
try {
|
|
212
|
-
const sandbox = await compute.
|
|
212
|
+
const sandbox = await compute.instances.create();
|
|
213
213
|
} catch (error) {
|
|
214
214
|
const msg = error instanceof Error ? error.message : String(error);
|
|
215
215
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@computesdk/superserve",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Superserve provides sandbox infrastructure to run code in isolated cloud environments powered by Firecracker MicroVMs",
|
|
5
5
|
"author": "Superserve",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@superserve/sdk": "^0.9.3",
|
|
22
|
-
"@computesdk/provider": "2.1.
|
|
23
|
-
"computesdk": "4.1.
|
|
22
|
+
"@computesdk/provider": "2.1.14",
|
|
23
|
+
"computesdk": "4.1.12"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"computesdk",
|