@tensorlakeai/tensorlake 0.5.156 → 0.5.157

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.cts CHANGED
@@ -89,6 +89,7 @@ interface NativeSandboxClient {
89
89
  createSnapshot(sandboxId: string, snapshotType?: string | null): Promise<TracedJson>;
90
90
  getSnapshot(snapshotId: string): Promise<TracedJson>;
91
91
  listSnapshots(): Promise<TracedJson>;
92
+ listSandboxSnapshots(sandboxId: string): Promise<TracedJson>;
92
93
  deleteSnapshot(snapshotId: string): Promise<string>;
93
94
  createPool(requestJson: string): Promise<TracedJson>;
94
95
  getPool(poolId: string): Promise<TracedJson>;
@@ -1629,6 +1630,11 @@ declare class SandboxClient {
1629
1630
  getSnapshot(snapshotId: string): Promise<Traced<SnapshotInfo>>;
1630
1631
  /** List all snapshots in the namespace. */
1631
1632
  listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
1633
+ /**
1634
+ * List snapshots taken from one sandbox (its ID or name), from the
1635
+ * sandbox's own listing rather than the whole namespace's.
1636
+ */
1637
+ listSandboxSnapshots(sandboxId: string): Promise<Traced<SnapshotInfo[]>>;
1632
1638
  /** Delete a snapshot by ID. */
1633
1639
  deleteSnapshot(snapshotId: string): Promise<void>;
1634
1640
  /**
package/dist/index.d.ts CHANGED
@@ -89,6 +89,7 @@ interface NativeSandboxClient {
89
89
  createSnapshot(sandboxId: string, snapshotType?: string | null): Promise<TracedJson>;
90
90
  getSnapshot(snapshotId: string): Promise<TracedJson>;
91
91
  listSnapshots(): Promise<TracedJson>;
92
+ listSandboxSnapshots(sandboxId: string): Promise<TracedJson>;
92
93
  deleteSnapshot(snapshotId: string): Promise<string>;
93
94
  createPool(requestJson: string): Promise<TracedJson>;
94
95
  getPool(poolId: string): Promise<TracedJson>;
@@ -1629,6 +1630,11 @@ declare class SandboxClient {
1629
1630
  getSnapshot(snapshotId: string): Promise<Traced<SnapshotInfo>>;
1630
1631
  /** List all snapshots in the namespace. */
1631
1632
  listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
1633
+ /**
1634
+ * List snapshots taken from one sandbox (its ID or name), from the
1635
+ * sandbox's own listing rather than the whole namespace's.
1636
+ */
1637
+ listSandboxSnapshots(sandboxId: string): Promise<Traced<SnapshotInfo[]>>;
1632
1638
  /** Delete a snapshot by ID. */
1633
1639
  deleteSnapshot(snapshotId: string): Promise<void>;
1634
1640
  /**
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ var init_defaults = __esm({
46
46
  "src/defaults.ts"() {
47
47
  "use strict";
48
48
  init_esm_shims();
49
- SDK_VERSION = "0.5.156";
49
+ SDK_VERSION = "0.5.157";
50
50
  API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
51
51
  API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
52
52
  NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
@@ -509,7 +509,7 @@ var init_native_worker_client = __esm({
509
509
  }
510
510
  };
511
511
  runtimeKey = /* @__PURE__ */ Symbol.for(
512
- `tensorlake.native.worker.${false ? "source" : "0.5.156"}.v1`
512
+ `tensorlake.native.worker.${false ? "source" : "0.5.157"}.v1`
513
513
  );
514
514
  runtimes = globalThis;
515
515
  }
@@ -4085,9 +4085,7 @@ var init_sandbox = __esm({
4085
4085
  */
4086
4086
  async listSnapshots() {
4087
4087
  const client = this.requireLifecycleClient("listSnapshots");
4088
- const all = await client.listSnapshots();
4089
- const filtered = all.filter((s) => s.sandboxId === this.lifecycleIdentifier);
4090
- return Object.assign(filtered, { traceId: all.traceId });
4088
+ return client.listSandboxSnapshots(this.lifecycleIdentifier);
4091
4089
  }
4092
4090
  /** Close the proxy connection. The sandbox keeps running. */
4093
4091
  close() {
@@ -4635,6 +4633,18 @@ function validateResizeWait(options) {
4635
4633
  throw new SandboxError("pollInterval must be finite and positive");
4636
4634
  }
4637
4635
  }
4636
+ function parseSnapshotList({ traceId, json }) {
4637
+ const parsed = JSON.parse(json);
4638
+ if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
4639
+ throw new SandboxError("Invalid snapshot list response: expected an object");
4640
+ }
4641
+ const records = parsed?.snapshots ?? [];
4642
+ if (!Array.isArray(records)) {
4643
+ throw new SandboxError("Invalid snapshot list response: snapshots must be an array");
4644
+ }
4645
+ const snapshots = records.map((s) => parseSnapshot(s));
4646
+ return Object.assign(snapshots, { traceId });
4647
+ }
4638
4648
  var DEFAULT_WAIT_POLL_INTERVAL_SEC, GPU_MODELS, SandboxClient, RESERVED_SANDBOX_MANAGEMENT_PORT;
4639
4649
  var init_client = __esm({
4640
4650
  "src/client.ts"() {
@@ -5304,19 +5314,18 @@ var init_client = __esm({
5304
5314
  }
5305
5315
  /** List all snapshots in the namespace. */
5306
5316
  async listSnapshots() {
5307
- const { traceId, json } = await callNative(
5308
- () => this.native.listSnapshots()
5317
+ return parseSnapshotList(
5318
+ await callNative(() => this.native.listSnapshots())
5319
+ );
5320
+ }
5321
+ /**
5322
+ * List snapshots taken from one sandbox (its ID or name), from the
5323
+ * sandbox's own listing rather than the whole namespace's.
5324
+ */
5325
+ async listSandboxSnapshots(sandboxId) {
5326
+ return parseSnapshotList(
5327
+ await callNative(() => this.native.listSandboxSnapshots(sandboxId))
5309
5328
  );
5310
- const parsed = JSON.parse(json);
5311
- if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
5312
- throw new SandboxError("Invalid snapshot list response: expected an object");
5313
- }
5314
- const records = parsed?.snapshots ?? [];
5315
- if (!Array.isArray(records)) {
5316
- throw new SandboxError("Invalid snapshot list response: snapshots must be an array");
5317
- }
5318
- const snapshots = records.map((s) => parseSnapshot(s));
5319
- return Object.assign(snapshots, { traceId });
5320
5329
  }
5321
5330
  /** Delete a snapshot by ID. */
5322
5331
  async deleteSnapshot(snapshotId) {