@lizard-build/sdk 0.1.38 → 0.1.40
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 +20 -16
- package/dist/index.d.mts +510 -254
- package/dist/index.d.ts +510 -254
- package/dist/index.js +600 -252
- package/dist/index.mjs +596 -252
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# Lizard SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript and Python clients for Lizard apps, managed databases, storage and Linux sandboxes.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The current platform runs sandboxes on Kubernetes. Persistent volumes keep files across sandbox lifetimes. Pause, resume, fork and snapshot restore currently return HTTP 501; the SDK exposes those endpoints but does not promise state preservation.
|
|
6
|
+
|
|
7
|
+
Requires Node.js 18+ or Python 3.10+. The optional `LizardCLI` adapter and `billing.payX402()` / `billing.pay_x402()` require Lizard CLI 4.0.8+ on PATH.
|
|
8
|
+
|
|
9
|
+
See [CLI coverage and migration notes](https://github.com/lizard-build/lizard-sdk/blob/main/docs/cli-parity.md) for native methods, CLI-backed operations and test scope.
|
|
6
10
|
|
|
7
11
|
## Install
|
|
8
12
|
|
|
@@ -26,23 +30,23 @@ import { Lizard } from '@lizard-build/sdk'
|
|
|
26
30
|
// apiKey defaults to the LIZARD_API_KEY env var.
|
|
27
31
|
const lizard = new Lizard({ project: 'my-project' })
|
|
28
32
|
|
|
29
|
-
// Boot a
|
|
33
|
+
// Boot a sandbox from the 'base' template (Debian + Node.js 26)
|
|
30
34
|
const sandbox = await lizard.create('base')
|
|
31
35
|
|
|
32
|
-
// Write a file directly into the
|
|
36
|
+
// Write a file directly into the sandbox filesystem
|
|
33
37
|
await sandbox.fs.write('/app/server.js', `
|
|
34
38
|
const http = require('http')
|
|
35
39
|
http.createServer((_, res) => res.end('hello from Lizard')).listen(3000)
|
|
36
40
|
`)
|
|
37
41
|
|
|
38
|
-
// Execute a process inside the
|
|
42
|
+
// Execute a process inside the sandbox
|
|
39
43
|
await sandbox.process.exec('node /app/server.js &')
|
|
40
44
|
|
|
41
45
|
// Get a public HTTPS URL for port 3000 inside the sandbox
|
|
42
|
-
const url = sandbox.getHost(3000)
|
|
46
|
+
const url = await sandbox.getHost(3000)
|
|
43
47
|
console.log(`Live at https://${url}`)
|
|
44
48
|
|
|
45
|
-
// Tear down the
|
|
49
|
+
// Tear down the sandbox when done
|
|
46
50
|
await sandbox.kill()
|
|
47
51
|
```
|
|
48
52
|
|
|
@@ -55,10 +59,10 @@ from lizard import Lizard
|
|
|
55
59
|
# project is required (its ID, slug, or name). api_key defaults to LIZARD_API_KEY.
|
|
56
60
|
lizard = Lizard(project="my-project")
|
|
57
61
|
|
|
58
|
-
# Boot a Python
|
|
62
|
+
# Boot a Python sandbox from the 'code-interpreter-v1' template
|
|
59
63
|
sandbox = lizard.create("code-interpreter-v1")
|
|
60
64
|
|
|
61
|
-
# Write a script into the
|
|
65
|
+
# Write a script into the sandbox filesystem
|
|
62
66
|
sandbox.fs.write("/app/main.py", """
|
|
63
67
|
import http.server, socketserver
|
|
64
68
|
|
|
@@ -72,7 +76,7 @@ with socketserver.TCPServer(("", 3000), Handler) as httpd:
|
|
|
72
76
|
httpd.serve_forever()
|
|
73
77
|
""")
|
|
74
78
|
|
|
75
|
-
# Execute a process inside the
|
|
79
|
+
# Execute a process inside the sandbox
|
|
76
80
|
sandbox.process.exec_("python /app/main.py &")
|
|
77
81
|
|
|
78
82
|
print(f"Live at https://{sandbox.get_host(3000)}")
|
|
@@ -170,7 +174,7 @@ const sandbox = await lizard.create('code-interpreter-v1', { timeoutMs: 10 * 60
|
|
|
170
174
|
|
|
171
175
|
### `Sandbox.create(template?, opts?)`
|
|
172
176
|
|
|
173
|
-
|
|
177
|
+
Create a Lizard sandbox using a template such as `base` or `code-interpreter-v1`. Template availability depends on the platform and region. A project is required — pass `project` (ID, slug, or name) or an exact `projectId` in `opts`, or use a `Lizard` client, which pins one for you.
|
|
174
178
|
|
|
175
179
|
```ts
|
|
176
180
|
const sandbox = await Sandbox.create('base', { project: 'my-project' })
|
|
@@ -221,7 +225,7 @@ A volume's **name** is its key inside a project, so an agent can reconstruct it
|
|
|
221
225
|
|
|
222
226
|
### `sandbox.fs`
|
|
223
227
|
|
|
224
|
-
Read and write files inside the
|
|
228
|
+
Read and write files inside the sandbox filesystem.
|
|
225
229
|
|
|
226
230
|
| Method | Description |
|
|
227
231
|
|---|---|
|
|
@@ -233,7 +237,7 @@ Read and write files inside the microVM filesystem.
|
|
|
233
237
|
|
|
234
238
|
### `sandbox.process`
|
|
235
239
|
|
|
236
|
-
Execute commands inside the
|
|
240
|
+
Execute commands inside the sandbox.
|
|
237
241
|
|
|
238
242
|
| Method | Description |
|
|
239
243
|
|---|---|
|
|
@@ -243,11 +247,11 @@ Execute commands inside the microVM.
|
|
|
243
247
|
|
|
244
248
|
### `sandbox.getHost(port)`
|
|
245
249
|
|
|
246
|
-
Returns a public HTTPS URL for a port listening inside the
|
|
250
|
+
Returns a public HTTPS URL for a port listening inside the sandbox — no tunneling required.
|
|
247
251
|
|
|
248
252
|
```ts
|
|
249
253
|
await sandbox.process.exec('npx -y serve -p 3000 &')
|
|
250
|
-
const url = sandbox.getHost(3000)
|
|
254
|
+
const url = await sandbox.getHost(3000)
|
|
251
255
|
// https://{sandboxId}-3000.sandbox.{region}.onlizard.com
|
|
252
256
|
```
|
|
253
257
|
|
|
@@ -282,7 +286,7 @@ Once your agent has produced a working app inside a sandbox, deploy it as a pers
|
|
|
282
286
|
lizard up
|
|
283
287
|
```
|
|
284
288
|
|
|
285
|
-
|
|
289
|
+
Lizard manages the sandbox runtime.
|
|
286
290
|
|
|
287
291
|
## License
|
|
288
292
|
|