@lizard-build/sdk 0.1.36 → 0.1.37
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/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ sandbox.kill()
|
|
|
82
82
|
|
|
83
83
|
## Persisting Work Across Sandboxes
|
|
84
84
|
|
|
85
|
-
Sandboxes are **ephemeral**: killing one, or letting it hit its timeout, discards everything written inside it. State that has to outlive a sandbox goes on a **volume** — a separate disk mounted at `/
|
|
85
|
+
Sandboxes are **ephemeral**: killing one, or letting it hit its timeout, discards everything written inside it. State that has to outlive a sandbox goes on a **volume** — a separate disk mounted at `/workspace` that a later sandbox re-attaches.
|
|
86
86
|
|
|
87
87
|
A volume is node-local, so it fixes the region too. You don't thread a region through both calls: the sandbox is placed wherever its volume already lives.
|
|
88
88
|
|
|
@@ -90,25 +90,25 @@ A volume is node-local, so it fixes the region too. You don't thread a region th
|
|
|
90
90
|
const vol = await lizard.volumes.getOrCreate('agent-scratch', { sizeGb: 10 })
|
|
91
91
|
|
|
92
92
|
const first = await lizard.create('codex', { volumeName: 'agent-scratch' })
|
|
93
|
-
await first.process.exec('pip install numpy pandas && echo "notes" > /
|
|
94
|
-
await first.kill() // sandbox gone, /
|
|
93
|
+
await first.process.exec('pip install numpy pandas && echo "notes" > /workspace/notes.txt')
|
|
94
|
+
await first.kill() // sandbox gone, /workspace survives
|
|
95
95
|
|
|
96
96
|
const second = await lizard.create('codex', { volumeName: 'agent-scratch' })
|
|
97
|
-
console.log(await second.fs.read('/
|
|
97
|
+
console.log(await second.fs.read('/workspace/notes.txt')) // "notes"
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
```python
|
|
101
101
|
vol = lizard.volumes.get_or_create("agent-scratch", size_gb=10)
|
|
102
102
|
|
|
103
103
|
first = lizard.create("codex", volume_name="agent-scratch")
|
|
104
|
-
first.process.exec_('echo "notes" > /
|
|
105
|
-
first.kill() # sandbox gone, /
|
|
104
|
+
first.process.exec_('echo "notes" > /workspace/notes.txt')
|
|
105
|
+
first.kill() # sandbox gone, /workspace survives
|
|
106
106
|
|
|
107
107
|
second = lizard.create("codex", volume_name="agent-scratch")
|
|
108
|
-
print(second.fs.read("/
|
|
108
|
+
print(second.fs.read("/workspace/notes.txt")) # "notes"
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
Note that only `/
|
|
111
|
+
Note that only `/workspace` survives — installed packages and in-memory state do not. Bake tooling into a template instead of reinstalling it per sandbox.
|
|
112
112
|
|
|
113
113
|
> `pause()` / `resume()` exist on the client but are **not implemented** for the current runtime and always fail with HTTP 501. Use a volume.
|
|
114
114
|
|
package/dist/index.d.mts
CHANGED
|
@@ -303,10 +303,10 @@ interface SandboxOpts extends ConnectionOpts {
|
|
|
303
303
|
* Defaults to the platform's default sandbox region.
|
|
304
304
|
*/
|
|
305
305
|
region?: string;
|
|
306
|
-
/** Attach a persistent volume by id, mounted at `/
|
|
306
|
+
/** Attach a persistent volume by id, mounted at `/workspace`. */
|
|
307
307
|
volumeId?: string;
|
|
308
308
|
/**
|
|
309
|
-
* Attach a persistent volume by name, mounted at `/
|
|
309
|
+
* Attach a persistent volume by name, mounted at `/workspace`. A volume's name is its
|
|
310
310
|
* key inside a project, so this is usually what you want — see {@link Volume}.
|
|
311
311
|
* Requires the sandbox's project to be given as an exact `projectId`.
|
|
312
312
|
*/
|
|
@@ -361,7 +361,7 @@ declare class SandboxClient {
|
|
|
361
361
|
*
|
|
362
362
|
* Sandboxes are **ephemeral**: killing one, or letting it hit its timeout, discards
|
|
363
363
|
* everything written inside it. State that has to outlive a sandbox belongs on a
|
|
364
|
-
* {@link Volume}, which is a separate disk you mount at `/
|
|
364
|
+
* {@link Volume}, which is a separate disk you mount at `/workspace` and re-attach to a
|
|
365
365
|
* later sandbox.
|
|
366
366
|
*
|
|
367
367
|
* @example Basic usage:
|
|
@@ -380,13 +380,13 @@ declare class SandboxClient {
|
|
|
380
380
|
* const vol = await Volume.getOrCreate(projectId, 'agent-scratch', { sizeGb: 10 })
|
|
381
381
|
*
|
|
382
382
|
* const first = await Sandbox.create('codex', { projectId, volumeName: 'agent-scratch' })
|
|
383
|
-
* await first.process.exec('echo "notes" > /
|
|
383
|
+
* await first.process.exec('echo "notes" > /workspace/notes.txt')
|
|
384
384
|
* await first.kill()
|
|
385
385
|
*
|
|
386
386
|
* // A different sandbox, the same disk. No region to thread through: the sandbox
|
|
387
387
|
* // is placed wherever the volume already lives.
|
|
388
388
|
* const second = await Sandbox.create('codex', { projectId, volumeName: 'agent-scratch' })
|
|
389
|
-
* console.log(await second.fs.read('/
|
|
389
|
+
* console.log(await second.fs.read('/workspace/notes.txt')) // "notes"
|
|
390
390
|
* ```
|
|
391
391
|
*/
|
|
392
392
|
declare class Sandbox extends SandboxClient {
|
package/dist/index.d.ts
CHANGED
|
@@ -303,10 +303,10 @@ interface SandboxOpts extends ConnectionOpts {
|
|
|
303
303
|
* Defaults to the platform's default sandbox region.
|
|
304
304
|
*/
|
|
305
305
|
region?: string;
|
|
306
|
-
/** Attach a persistent volume by id, mounted at `/
|
|
306
|
+
/** Attach a persistent volume by id, mounted at `/workspace`. */
|
|
307
307
|
volumeId?: string;
|
|
308
308
|
/**
|
|
309
|
-
* Attach a persistent volume by name, mounted at `/
|
|
309
|
+
* Attach a persistent volume by name, mounted at `/workspace`. A volume's name is its
|
|
310
310
|
* key inside a project, so this is usually what you want — see {@link Volume}.
|
|
311
311
|
* Requires the sandbox's project to be given as an exact `projectId`.
|
|
312
312
|
*/
|
|
@@ -361,7 +361,7 @@ declare class SandboxClient {
|
|
|
361
361
|
*
|
|
362
362
|
* Sandboxes are **ephemeral**: killing one, or letting it hit its timeout, discards
|
|
363
363
|
* everything written inside it. State that has to outlive a sandbox belongs on a
|
|
364
|
-
* {@link Volume}, which is a separate disk you mount at `/
|
|
364
|
+
* {@link Volume}, which is a separate disk you mount at `/workspace` and re-attach to a
|
|
365
365
|
* later sandbox.
|
|
366
366
|
*
|
|
367
367
|
* @example Basic usage:
|
|
@@ -380,13 +380,13 @@ declare class SandboxClient {
|
|
|
380
380
|
* const vol = await Volume.getOrCreate(projectId, 'agent-scratch', { sizeGb: 10 })
|
|
381
381
|
*
|
|
382
382
|
* const first = await Sandbox.create('codex', { projectId, volumeName: 'agent-scratch' })
|
|
383
|
-
* await first.process.exec('echo "notes" > /
|
|
383
|
+
* await first.process.exec('echo "notes" > /workspace/notes.txt')
|
|
384
384
|
* await first.kill()
|
|
385
385
|
*
|
|
386
386
|
* // A different sandbox, the same disk. No region to thread through: the sandbox
|
|
387
387
|
* // is placed wherever the volume already lives.
|
|
388
388
|
* const second = await Sandbox.create('codex', { projectId, volumeName: 'agent-scratch' })
|
|
389
|
-
* console.log(await second.fs.read('/
|
|
389
|
+
* console.log(await second.fs.read('/workspace/notes.txt')) // "notes"
|
|
390
390
|
* ```
|
|
391
391
|
*/
|
|
392
392
|
declare class Sandbox extends SandboxClient {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lizard-build/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"description": "Firecracker microVM sandboxes for AI agents — boot Linux in milliseconds, run code, write files, expose ports over HTTPS, then pause a session with memory intact and resume it later. TypeScript SDK for Lizard Sandboxes (lizard.build).",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|