@lizard-build/sdk 1.0.1 → 1.0.2

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
@@ -1766,6 +1766,8 @@ interface SandboxInfo {
1766
1766
  size?: 'small' | 'medium' | 'large' | null;
1767
1767
  /** Flat hourly price in USD for `size`, billed per second while running; may be `null` when billed by measured usage. */
1768
1768
  pricePerHour?: number | null;
1769
+ /** `false` when the sandbox was created with `internetAccess: false`; absent from older servers. */
1770
+ internetAccess?: boolean;
1769
1771
  cpus?: number;
1770
1772
  memoryMb?: number;
1771
1773
  metadata?: Record<string, string>;
@@ -1820,6 +1822,12 @@ interface SandboxOpts extends ConnectionOpts {
1820
1822
  metadata?: Record<string, string>;
1821
1823
  /** Environment variables set in the sandbox, visible to every command it runs. */
1822
1824
  envs?: Record<string, string>;
1825
+ /**
1826
+ * `false`: no internet for the sandbox's whole life, its resumes and forks included (no
1827
+ * outbound TCP, UDP, DNS or ping); commands, files and exposed ports still work. Set at
1828
+ * create only. Default `true`. Not available with a container volume or snapshot.
1829
+ */
1830
+ internetAccess?: boolean;
1823
1831
  timeoutMs?: number;
1824
1832
  /**
1825
1833
  * Region to run the sandbox in, e.g. `'us-east-1'`.
package/dist/index.d.ts CHANGED
@@ -1766,6 +1766,8 @@ interface SandboxInfo {
1766
1766
  size?: 'small' | 'medium' | 'large' | null;
1767
1767
  /** Flat hourly price in USD for `size`, billed per second while running; may be `null` when billed by measured usage. */
1768
1768
  pricePerHour?: number | null;
1769
+ /** `false` when the sandbox was created with `internetAccess: false`; absent from older servers. */
1770
+ internetAccess?: boolean;
1769
1771
  cpus?: number;
1770
1772
  memoryMb?: number;
1771
1773
  metadata?: Record<string, string>;
@@ -1820,6 +1822,12 @@ interface SandboxOpts extends ConnectionOpts {
1820
1822
  metadata?: Record<string, string>;
1821
1823
  /** Environment variables set in the sandbox, visible to every command it runs. */
1822
1824
  envs?: Record<string, string>;
1825
+ /**
1826
+ * `false`: no internet for the sandbox's whole life, its resumes and forks included (no
1827
+ * outbound TCP, UDP, DNS or ping); commands, files and exposed ports still work. Set at
1828
+ * create only. Default `true`. Not available with a container volume or snapshot.
1829
+ */
1830
+ internetAccess?: boolean;
1823
1831
  timeoutMs?: number;
1824
1832
  /**
1825
1833
  * Region to run the sandbox in, e.g. `'us-east-1'`.
package/dist/index.js CHANGED
@@ -1715,13 +1715,21 @@ var SandboxClient = class {
1715
1715
  region,
1716
1716
  volumeId: opts?.volumeId,
1717
1717
  volumeName: opts?.volumeName,
1718
- lizardToken: opts?.lizardToken
1718
+ lizardToken: opts?.lizardToken,
1719
+ // Sent only when asked: every other create stays what it was.
1720
+ ...opts?.internetAccess === false ? { internetAccess: false } : {}
1719
1721
  })
1720
1722
  });
1721
1723
  let res = await post(opts?.region || (defaultRegion ? DEFAULT_SANDBOX_REGION : void 0));
1722
1724
  if (defaultRegion && res.status === 503 && await regionUnavailable(res)) res = await post(void 0);
1723
1725
  if (!res.ok) await handleApiError(res);
1724
- return res.json();
1726
+ const created = await res.json();
1727
+ if (opts?.internetAccess === false && created.internetAccess !== false) {
1728
+ await this.killSandbox(created.sandboxId, opts).catch(() => {
1729
+ });
1730
+ throw new LizardError("This server does not support internetAccess: false yet; the sandbox it started had internet and was deleted");
1731
+ }
1732
+ return created;
1725
1733
  }
1726
1734
  static async killSandbox(sandboxId, opts) {
1727
1735
  const config = new ConnectionConfig(opts);
package/dist/index.mjs CHANGED
@@ -1643,13 +1643,21 @@ var SandboxClient = class {
1643
1643
  region,
1644
1644
  volumeId: opts?.volumeId,
1645
1645
  volumeName: opts?.volumeName,
1646
- lizardToken: opts?.lizardToken
1646
+ lizardToken: opts?.lizardToken,
1647
+ // Sent only when asked: every other create stays what it was.
1648
+ ...opts?.internetAccess === false ? { internetAccess: false } : {}
1647
1649
  })
1648
1650
  });
1649
1651
  let res = await post(opts?.region || (defaultRegion ? DEFAULT_SANDBOX_REGION : void 0));
1650
1652
  if (defaultRegion && res.status === 503 && await regionUnavailable(res)) res = await post(void 0);
1651
1653
  if (!res.ok) await handleApiError(res);
1652
- return res.json();
1654
+ const created = await res.json();
1655
+ if (opts?.internetAccess === false && created.internetAccess !== false) {
1656
+ await this.killSandbox(created.sandboxId, opts).catch(() => {
1657
+ });
1658
+ throw new LizardError("This server does not support internetAccess: false yet; the sandbox it started had internet and was deleted");
1659
+ }
1660
+ return created;
1653
1661
  }
1654
1662
  static async killSandbox(sandboxId, opts) {
1655
1663
  const config = new ConnectionConfig(opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lizard-build/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
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",