@lizard-build/sdk 0.1.40 → 0.1.41

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.mjs CHANGED
@@ -450,12 +450,12 @@ var Process = class {
450
450
  this.config = config;
451
451
  }
452
452
  /**
453
- * Execute a command inside the microVM and wait for it to complete.
453
+ * Execute a command inside the sandbox and wait for it to complete.
454
454
  *
455
455
  * The command runs in a shell inside the Lizard sandbox and returns
456
456
  * stdout, stderr, and the exit code when it finishes.
457
457
  *
458
- * @param cmd Shell command to run inside the microVM.
458
+ * @param cmd Shell command to run inside the sandbox.
459
459
  * @param opts Optional execution options — environment variables, working
460
460
  * directory, user, and timeout.
461
461
  *
@@ -587,18 +587,19 @@ var Fs = class {
587
587
  this.config = config;
588
588
  }
589
589
  /**
590
- * Write a file into the microVM filesystem.
590
+ * Write a file into the sandbox filesystem.
591
591
  *
592
592
  * Creates parent directories automatically if they don't exist.
593
+ * Byte input must contain valid UTF-8; arbitrary binary uploads are unsupported.
593
594
  *
594
595
  * @example
595
596
  * ```ts
596
597
  * await sandbox.fs.write('/app/index.js', 'console.log("hello")')
597
598
  * ```
598
599
  *
599
- * @example Write binary data:
600
+ * @example Write UTF-8 bytes:
600
601
  * ```ts
601
- * await sandbox.fs.write('/app/data.bin', buffer)
602
+ * await sandbox.fs.write('/app/notes.txt', new TextEncoder().encode('hello'))
602
603
  * ```
603
604
  */
604
605
  async write(path, data, opts) {
@@ -611,7 +612,7 @@ var Fs = class {
611
612
  if (!res.ok) await handleApiError(res);
612
613
  }
613
614
  /**
614
- * Read a file from the microVM filesystem.
615
+ * Read a file from the sandbox filesystem.
615
616
  *
616
617
  * @returns The file contents as a UTF-8 string.
617
618
  *
@@ -628,14 +629,7 @@ var Fs = class {
628
629
  if (!res.ok) await handleApiError(res);
629
630
  return res.text();
630
631
  }
631
- /**
632
- * List files and directories at the given path inside the microVM.
633
- *
634
- * @example
635
- * ```ts
636
- * const entries = await sandbox.fs.list('/app')
637
- * ```
638
- */
632
+ /** Read a file as bytes. */
639
633
  async readBytes(path, opts) {
640
634
  const url = new URL(`${this.config.apiUrl}/api/sandboxes/${this.sandboxId}/files`);
641
635
  url.searchParams.set("path", path);
@@ -644,6 +638,14 @@ var Fs = class {
644
638
  if (!res.ok) await handleApiError(res);
645
639
  return new Uint8Array(await res.arrayBuffer());
646
640
  }
641
+ /**
642
+ * List files and directories at the given path inside the sandbox.
643
+ *
644
+ * @example
645
+ * ```ts
646
+ * const entries = await sandbox.fs.list('/app')
647
+ * ```
648
+ */
647
649
  async list(path, opts) {
648
650
  const url = new URL(`${this.config.apiUrl}/api/sandboxes/${this.sandboxId}/files/list`);
649
651
  url.searchParams.set("path", path);
@@ -653,7 +655,7 @@ var Fs = class {
653
655
  return res.json();
654
656
  }
655
657
  /**
656
- * Remove a file or directory from the microVM filesystem.
658
+ * Remove a file or directory from the sandbox filesystem.
657
659
  */
658
660
  async remove(path, opts) {
659
661
  const res = await fetch(`${this.config.apiUrl}/api/sandboxes/${this.sandboxId}/files`, {
@@ -664,7 +666,7 @@ var Fs = class {
664
666
  if (!res.ok) await handleApiError(res);
665
667
  }
666
668
  /**
667
- * Create a directory (and any missing parents) inside the microVM.
669
+ * Create a directory (and any missing parents) inside the sandbox.
668
670
  */
669
671
  async makeDir(path, opts) {
670
672
  await this.execInternal(`mkdir -p ${JSON.stringify(path)}`, opts?.user);
@@ -892,11 +894,7 @@ var Sandbox = class extends SandboxClient {
892
894
  * Verifies the sandbox exists and is reachable, then returns a handle to it.
893
895
  * Throws `NotFoundError` if it has been killed or has expired.
894
896
  *
895
- * This used to call `resume` first, on the assumption that a sandbox you are
896
- * reconnecting to might be paused. Sandboxes are pods now and pause/resume is a
897
- * `501` on every one of them, so that call turned every `connect()` into an
898
- * error against a perfectly healthy sandbox. Connecting does not need to change
899
- * a sandbox's state, so it no longer tries to.
897
+ * Connecting reads sandbox metadata without changing its state.
900
898
  *
901
899
  * @example
902
900
  * ```ts
@@ -921,29 +919,25 @@ var Sandbox = class extends SandboxClient {
921
919
  /**
922
920
  * Kill the sandbox and release its resources immediately.
923
921
  *
924
- * @returns `true` if the microVM was terminated, `false` if it was already gone.
922
+ * @returns `true` if the sandbox was terminated, `false` if it was already gone.
925
923
  */
926
924
  async kill(opts) {
927
925
  return SandboxClient.killSandbox(this.sandboxId, this.resolveOpts(opts));
928
926
  }
929
927
  /**
930
- * Pause the sandbox by freezing it in place.
928
+ * Request sandbox pause. The Kubernetes backend returns HTTP 501.
931
929
  *
932
- * @deprecated Not implemented for the current runtime — always throws
933
- * `LizardError` with HTTP 501. Sandboxes run as pods, and the equivalent is a CRIU
934
- * checkpoint of the pod, which is not built. To park work across a gap, put it on a
935
- * {@link Volume} and create a fresh sandbox on that volume later; the volume is the
936
- * part that is meant to outlive a sandbox.
930
+ * @deprecated Unsupported on Kubernetes. Save files to a {@link Volume}
931
+ * and attach it to a new sandbox instead.
937
932
  */
938
933
  async pause(opts) {
939
934
  return SandboxClient.pauseSandbox(this.sandboxId, this.resolveOpts(opts));
940
935
  }
941
936
  /**
942
- * Resume a paused sandbox.
937
+ * Request sandbox resume. The Kubernetes backend returns HTTP 501.
943
938
  *
944
- * @deprecated Not implemented for the current runtime — always throws
945
- * `LizardError` with HTTP 501. See {@link pause}. `Sandbox.connect()` no longer
946
- * calls this, so reconnecting to a running sandbox works without it.
939
+ * @deprecated Unsupported on Kubernetes. Use {@link Sandbox.connect} to
940
+ * reconnect to a running sandbox.
947
941
  */
948
942
  async resume(opts) {
949
943
  return SandboxClient.resumeSandbox(this.sandboxId, this.resolveOpts(opts));
@@ -963,25 +957,27 @@ var Sandbox = class extends SandboxClient {
963
957
  return SandboxClient.setTimeoutSandbox(this.sandboxId, timeoutMs, this.resolveOpts(opts));
964
958
  }
965
959
  /**
966
- * Get the public HTTPS URL for a port exposed inside the sandbox.
960
+ * Register a public HTTPS route and return its hostname without a scheme.
967
961
  *
968
- * Useful for accessing HTTP servers started inside the microVM from your
962
+ * Useful for accessing HTTP servers started inside the sandbox from your
969
963
  * agent or tests without additional tunneling.
970
964
  *
971
965
  * @example
972
966
  * ```ts
973
- * await sandbox.process.exec('npx -y serve -p 3000 &')
974
- * const url = sandbox.getHost(3000)
975
- * // https://{sandboxId}-3000.sandbox.{region}.onlizard.com
967
+ * // Start an HTTP server on port 3000 before exposing it.
968
+ * const hostname = await sandbox.getHost(3000)
969
+ * console.log(`https://${hostname}`)
976
970
  * ```
977
971
  */
978
972
  async getHost(port, opts) {
979
973
  const { hostname } = await SandboxClient.exposeSandboxPort(this.sandboxId, port, this.resolveOpts(opts));
980
974
  return hostname;
981
975
  }
976
+ /** Fork is unsupported on Kubernetes; the backend returns HTTP 501. */
982
977
  fork(opts = {}) {
983
978
  return new PlatformClient(this.resolveOpts()).post(`/api/sandboxes/${this.sandboxId}/fork`, { count: opts.count ?? 1, timeoutMs: opts.timeoutMs ?? 0 });
984
979
  }
980
+ /** Snapshot creation is unsupported on Kubernetes; the backend returns HTTP 501. */
985
981
  snapshot(name) {
986
982
  return new PlatformClient(this.resolveOpts()).post(`/api/sandboxes/${this.sandboxId}/snapshot`, { name });
987
983
  }
@@ -994,6 +990,7 @@ var Sandbox = class extends SandboxClient {
994
990
  static snapshots(projectId, opts) {
995
991
  return new PlatformClient(opts ?? {}).get(`/api/projects/${projectId}/snapshots`);
996
992
  }
993
+ /** Snapshot restore is unsupported on Kubernetes; the backend returns HTTP 501. */
997
994
  static async restore(snapshotId, opts) {
998
995
  const result = await new PlatformClient(opts ?? {}).post(`/api/sandbox-snapshots/${encodeURIComponent(snapshotId)}/fork`, { timeoutMs: opts?.timeoutMs ?? 0 });
999
996
  return new this({ ...opts, sandboxId: result.sandboxId ?? result.id });
@@ -1106,7 +1103,7 @@ var AddonsAPI = class {
1106
1103
  });
1107
1104
  return this.get(projectId, addonId);
1108
1105
  }
1109
- /** Restart an addon VM. */
1106
+ /** Restart an addon. */
1110
1107
  redeploy(projectId, addonId) {
1111
1108
  return this.client.post(`/api/projects/${projectId}/addons/${addonId}/redeploy`, {});
1112
1109
  }
@@ -1708,8 +1705,7 @@ var CodeSandbox = class extends Sandbox {
1708
1705
  *
1709
1706
  * @returns Execution result with stdout, stderr, results, and any error.
1710
1707
  *
1711
- * @throws {ExecutionError} if you pass neither language nor context and no
1712
- * default context exists — which cannot happen in normal usage.
1708
+ * Code errors appear in `execution.error`; request failures throw.
1713
1709
  *
1714
1710
  * @example
1715
1711
  * ```ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lizard-build/sdk",
3
- "version": "0.1.40",
4
- "description": "TypeScript SDK for Lizard apps, managed databases, storage and Linux sandboxes.",
3
+ "version": "0.1.41",
4
+ "description": "TypeScript SDK for Lizard: Kubernetes sandboxes, code execution and cloud apps.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -24,8 +24,8 @@
24
24
  "keywords": [
25
25
  "sandbox",
26
26
  "sandboxes",
27
- "microvm",
28
- "firecracker",
27
+ "kubernetes",
28
+ "containers",
29
29
  "ai-agents",
30
30
  "code-interpreter",
31
31
  "code-execution",