@alineo-labs/sandbox 0.4.1 → 0.4.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/dist/index.d.mts +6 -0
- package/dist/index.mjs +6 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -376,6 +376,12 @@ export declare class Sandbox {
|
|
|
376
376
|
/** Default team scope for any later `.fork()` call — see `SandboxOptions.teamId`. Same
|
|
377
377
|
* rationale as `opts.resourceId`. */
|
|
378
378
|
teamId?: string;
|
|
379
|
+
/**
|
|
380
|
+
* Also accept a Paused sandbox. The handle comes back marked paused: `exec()` and friends
|
|
381
|
+
* throw until `resume()` is called. For reconnecting to a sandbox someone paused (e.g. after
|
|
382
|
+
* the process that paused it restarted) without resuming it first.
|
|
383
|
+
*/
|
|
384
|
+
allowPaused?: boolean;
|
|
379
385
|
}): Promise<SandboxHandle$1>;
|
|
380
386
|
/**
|
|
381
387
|
* Create a fresh sandbox from a snapshot ID without exec replay.
|
package/dist/index.mjs
CHANGED
|
@@ -398,11 +398,12 @@ var Sandbox = class {
|
|
|
398
398
|
*/
|
|
399
399
|
async connect(sandboxId, name, opts) {
|
|
400
400
|
await this._ensureConnected();
|
|
401
|
-
const
|
|
402
|
-
|
|
401
|
+
const state = (await this._control.getSandbox(sandboxId)).status.state;
|
|
402
|
+
const paused = state === SandboxState.Paused;
|
|
403
|
+
if (state !== SandboxState.Running && !(paused && opts?.allowPaused)) throw new SandboxClientError(`SandboxHandle ${sandboxId} is ${state} — can only connect to Running sandboxes` + (paused ? " (pass allowPaused to connect to a Paused one)" : ""), 409);
|
|
403
404
|
await this._acquireSlot();
|
|
404
405
|
const resources = opts?.resources;
|
|
405
|
-
|
|
406
|
+
const handle = new SandboxHandle$1(sandboxId, name, {
|
|
406
407
|
control: this._control,
|
|
407
408
|
adapter: this._adapter,
|
|
408
409
|
credentialBroker: this._credentialBroker,
|
|
@@ -412,6 +413,8 @@ var Sandbox = class {
|
|
|
412
413
|
fork: resources ? (snapshotId, tag, overrideRunId, forkOpts) => this._forkFromSnapshot(snapshotId, name, resources, void 0, overrideRunId ?? opts?.runId, sandboxId, opts?.resourceId, opts?.teamId, forkOpts) : void 0,
|
|
413
414
|
useServerProxy: this._useServerProxy
|
|
414
415
|
});
|
|
416
|
+
if (paused) handle.setPaused(true);
|
|
417
|
+
return handle;
|
|
415
418
|
}
|
|
416
419
|
/**
|
|
417
420
|
* Create a fresh sandbox from a snapshot ID without exec replay.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alineo-labs/sandbox",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"test:watch": "vitest"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@alineo-labs/core": "0.4.
|
|
33
|
-
"@alineo-labs/opensandbox": "0.3.
|
|
34
|
-
"@alineo-labs/vault": "0.3.
|
|
32
|
+
"@alineo-labs/core": "0.4.2",
|
|
33
|
+
"@alineo-labs/opensandbox": "0.3.1",
|
|
34
|
+
"@alineo-labs/vault": "0.3.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"bun-types": "1.4.2",
|