@lizard-build/sdk 0.1.81 → 0.1.83

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 CHANGED
@@ -1871,7 +1871,10 @@ declare class SandboxClient {
1871
1871
  sandboxId: string;
1872
1872
  }>;
1873
1873
  protected static killSandbox(sandboxId: string, opts?: ConnectionOpts): Promise<boolean>;
1874
- protected static pauseSandbox(sandboxId: string, opts?: ConnectionOpts): Promise<boolean>;
1874
+ protected static pauseSandbox(sandboxId: string, opts?: ConnectionOpts & {
1875
+ fast?: boolean;
1876
+ memory?: boolean;
1877
+ }): Promise<boolean>;
1875
1878
  protected static resumeSandbox(sandboxId: string, opts?: ConnectionOpts): Promise<boolean>;
1876
1879
  protected static listSandboxes(opts?: ConnectionOpts & {
1877
1880
  projectId?: string;
@@ -2078,8 +2081,14 @@ declare class Sandbox extends SandboxClient {
2078
2081
  /**
2079
2082
  * Pause the sandbox: its memory, running processes and files are kept and
2080
2083
  * compute stops. Wait with `waitForStatus('paused')` before resuming.
2081
- */
2082
- pause(opts?: ConnectionOpts): Promise<boolean>;
2084
+ * `{ fast: true }` keeps files only: about a second whatever the RAM, but
2085
+ * processes end and the resume boots the sandbox fresh (`memory: false` is
2086
+ * the same).
2087
+ */
2088
+ pause(opts?: ConnectionOpts & {
2089
+ fast?: boolean;
2090
+ memory?: boolean;
2091
+ }): Promise<boolean>;
2083
2092
  /**
2084
2093
  * Resume a paused sandbox exactly where it stopped, processes included. Wait
2085
2094
  * with `waitForStatus('running')` before running commands.
package/dist/index.d.ts CHANGED
@@ -1871,7 +1871,10 @@ declare class SandboxClient {
1871
1871
  sandboxId: string;
1872
1872
  }>;
1873
1873
  protected static killSandbox(sandboxId: string, opts?: ConnectionOpts): Promise<boolean>;
1874
- protected static pauseSandbox(sandboxId: string, opts?: ConnectionOpts): Promise<boolean>;
1874
+ protected static pauseSandbox(sandboxId: string, opts?: ConnectionOpts & {
1875
+ fast?: boolean;
1876
+ memory?: boolean;
1877
+ }): Promise<boolean>;
1875
1878
  protected static resumeSandbox(sandboxId: string, opts?: ConnectionOpts): Promise<boolean>;
1876
1879
  protected static listSandboxes(opts?: ConnectionOpts & {
1877
1880
  projectId?: string;
@@ -2078,8 +2081,14 @@ declare class Sandbox extends SandboxClient {
2078
2081
  /**
2079
2082
  * Pause the sandbox: its memory, running processes and files are kept and
2080
2083
  * compute stops. Wait with `waitForStatus('paused')` before resuming.
2081
- */
2082
- pause(opts?: ConnectionOpts): Promise<boolean>;
2084
+ * `{ fast: true }` keeps files only: about a second whatever the RAM, but
2085
+ * processes end and the resume boots the sandbox fresh (`memory: false` is
2086
+ * the same).
2087
+ */
2088
+ pause(opts?: ConnectionOpts & {
2089
+ fast?: boolean;
2090
+ memory?: boolean;
2091
+ }): Promise<boolean>;
2083
2092
  /**
2084
2093
  * Resume a paused sandbox exactly where it stopped, processes included. Wait
2085
2094
  * with `waitForStatus('running')` before running commands.
package/dist/index.js CHANGED
@@ -1725,7 +1725,8 @@ var SandboxClient = class {
1725
1725
  const config = new ConnectionConfig(opts);
1726
1726
  const res = await fetch(`${config.apiUrl}/api/sandboxes/${sandboxId}/pause`, {
1727
1727
  method: "POST",
1728
- headers: config.headers
1728
+ // Sent as memory:false, which every server that has fast pause accepts.
1729
+ ...opts?.fast === true || opts?.memory === false ? { headers: { ...config.headers, "Content-Type": "application/json" }, body: JSON.stringify({ memory: false }) } : { headers: config.headers }
1729
1730
  });
1730
1731
  if (res.status === 404) return false;
1731
1732
  if (!res.ok) await handleApiError(res);
@@ -1835,6 +1836,9 @@ var Sandbox = class extends SandboxClient {
1835
1836
  /**
1836
1837
  * Pause the sandbox: its memory, running processes and files are kept and
1837
1838
  * compute stops. Wait with `waitForStatus('paused')` before resuming.
1839
+ * `{ fast: true }` keeps files only: about a second whatever the RAM, but
1840
+ * processes end and the resume boots the sandbox fresh (`memory: false` is
1841
+ * the same).
1838
1842
  */
1839
1843
  async pause(opts) {
1840
1844
  return SandboxClient.pauseSandbox(this.sandboxId, this.resolveOpts(opts));
package/dist/index.mjs CHANGED
@@ -1653,7 +1653,8 @@ var SandboxClient = class {
1653
1653
  const config = new ConnectionConfig(opts);
1654
1654
  const res = await fetch(`${config.apiUrl}/api/sandboxes/${sandboxId}/pause`, {
1655
1655
  method: "POST",
1656
- headers: config.headers
1656
+ // Sent as memory:false, which every server that has fast pause accepts.
1657
+ ...opts?.fast === true || opts?.memory === false ? { headers: { ...config.headers, "Content-Type": "application/json" }, body: JSON.stringify({ memory: false }) } : { headers: config.headers }
1657
1658
  });
1658
1659
  if (res.status === 404) return false;
1659
1660
  if (!res.ok) await handleApiError(res);
@@ -1763,6 +1764,9 @@ var Sandbox = class extends SandboxClient {
1763
1764
  /**
1764
1765
  * Pause the sandbox: its memory, running processes and files are kept and
1765
1766
  * compute stops. Wait with `waitForStatus('paused')` before resuming.
1767
+ * `{ fast: true }` keeps files only: about a second whatever the RAM, but
1768
+ * processes end and the resume boots the sandbox fresh (`memory: false` is
1769
+ * the same).
1766
1770
  */
1767
1771
  async pause(opts) {
1768
1772
  return SandboxClient.pauseSandbox(this.sandboxId, this.resolveOpts(opts));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lizard-build/sdk",
3
- "version": "0.1.81",
3
+ "version": "0.1.83",
4
4
  "description": "TypeScript and JavaScript SDK for Lizard (lizard.build): cloud sandboxes for AI agents and code execution.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",