@quietrobot/sandboxes 0.2.2 → 0.2.3
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 +6 -2
- package/dist/index.d.ts +21 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,8 +104,12 @@ const fresh = await qr.create({ snapshotId: snap.id });
|
|
|
104
104
|
`sbx.setTimeout(sec)`, `sbx.setEgress({...})`, `sbx.metrics(hours)`,
|
|
105
105
|
`sbx.executions()`, `sbx.audit()`, `sbx.destroy()`.
|
|
106
106
|
- Create options: `template`, `region`, `cpus`, `memoryMb`, `timeoutSec`,
|
|
107
|
-
`cpuClass`, `autoPauseSec`, `egress`, `secrets`, `env`, `snapshotId`, `name`, `
|
|
108
|
-
`ifExists`, `volumes`.
|
|
107
|
+
`cpuClass`, `autoPauseSec`, `egress`, `secrets`, `env`, `snapshotId`, `name`, `ephemeral`,
|
|
108
|
+
`durable`, `ifExists`, `volumes`.
|
|
109
|
+
- Saved by default: a sandbox keeps its files through pauses and its time
|
|
110
|
+
limit, and is deleted 72 hours after its last use. Pass `ephemeral: true`
|
|
111
|
+
for a throwaway one that is deleted when it stops. Take a snapshot to keep
|
|
112
|
+
files longer.
|
|
109
113
|
- Account: `qr.snapshots()`, `qr.deleteSnapshot(id)`, `qr.reservations()`,
|
|
110
114
|
`qr.usage(days)`, `qr.audit()`, `qr.secrets`, `qr.volumes`, `qr.webhooks`.
|
|
111
115
|
- Templates: start from one of ours with `template: "code-interpreter"` (or
|
package/dist/index.d.ts
CHANGED
|
@@ -90,8 +90,19 @@ export interface SandboxInfo {
|
|
|
90
90
|
};
|
|
91
91
|
autoPauseSec: number | null;
|
|
92
92
|
lastActiveAt: string | null;
|
|
93
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Saved (the default): kept through pauses, the time limit and a lost host,
|
|
95
|
+
* and deleted 72 hours after its last use or when destroyed. false: ephemeral,
|
|
96
|
+
* deleted when it stops.
|
|
97
|
+
*/
|
|
94
98
|
durable?: boolean;
|
|
99
|
+
/** Saved sandboxes only, while stopped: when it is deleted if nothing wakes it (ISO time). */
|
|
100
|
+
storage?: {
|
|
101
|
+
tier: "hot" | "warm" | "cold" | null;
|
|
102
|
+
sizeBytes: number | null;
|
|
103
|
+
archivedAt: string | null;
|
|
104
|
+
deletesAt?: string | null;
|
|
105
|
+
} | null;
|
|
95
106
|
metadata: Record<string, string>;
|
|
96
107
|
error: string | null;
|
|
97
108
|
createdAt: string;
|
|
@@ -301,11 +312,16 @@ export interface CreateOptions {
|
|
|
301
312
|
/** Set false to always boot a fresh VM rather than take a pre-started one. */
|
|
302
313
|
pool?: boolean;
|
|
303
314
|
/**
|
|
304
|
-
*
|
|
305
|
-
*
|
|
315
|
+
* Sandboxes are saved by default: the files are kept through pauses, the
|
|
316
|
+
* time limit and a lost host, and the sandbox is deleted 72 hours after its
|
|
317
|
+
* last use (take a snapshot to keep files longer). A saved sandbox's name
|
|
318
|
+
* also works as its id. true insists on it (an error if it can't be saved);
|
|
319
|
+
* false is the same as ephemeral: true.
|
|
306
320
|
*/
|
|
307
321
|
durable?: boolean;
|
|
308
|
-
/**
|
|
322
|
+
/** Delete the sandbox and its files when it stops or reaches its time limit, for throwaway runs. */
|
|
323
|
+
ephemeral?: boolean;
|
|
324
|
+
/** Saved only: when the name is taken, "error" (default) or "return" that sandbox. */
|
|
309
325
|
ifExists?: "error" | "return";
|
|
310
326
|
/**
|
|
311
327
|
* Network rules. allow and deny take domains (pypi.org, *.github.com), IP
|
|
@@ -464,7 +480,7 @@ export declare class Sandboxes {
|
|
|
464
480
|
redeliver: (id: string, deliveryId: string) => Promise<unknown>;
|
|
465
481
|
};
|
|
466
482
|
create(opts?: CreateOptions): Promise<Sandbox>;
|
|
467
|
-
/** A sandbox by id, or by name for a
|
|
483
|
+
/** A sandbox by id, or by name for a saved one. */
|
|
468
484
|
get(id: string): Promise<Sandbox>;
|
|
469
485
|
/** Same as get(): attach to a sandbox started elsewhere. */
|
|
470
486
|
connect(id: string): Promise<Sandbox>;
|
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ export class Sandboxes {
|
|
|
115
115
|
async create(opts = {}) {
|
|
116
116
|
return new Sandbox(this, await this.request("POST", "/sandboxes", opts));
|
|
117
117
|
}
|
|
118
|
-
/** A sandbox by id, or by name for a
|
|
118
|
+
/** A sandbox by id, or by name for a saved one. */
|
|
119
119
|
async get(id) {
|
|
120
120
|
return new Sandbox(this, await this.request("GET", `/sandboxes/${enc(id)}`));
|
|
121
121
|
}
|