@blaxel/core 0.3.20 → 0.3.21-preview.292

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.
Files changed (47) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/client/sdk.gen.js +95 -2
  3. package/dist/cjs/common/settings.js +2 -2
  4. package/dist/cjs/index.js +1 -0
  5. package/dist/cjs/sandbox/index.js +1 -0
  6. package/dist/cjs/sandbox/sandbox.js +9 -0
  7. package/dist/cjs/sandbox/snapshot.js +77 -0
  8. package/dist/cjs/snapshot/index.js +145 -0
  9. package/dist/cjs/types/client/sdk.gen.d.ts +26 -1
  10. package/dist/cjs/types/client/types.gen.d.ts +277 -11
  11. package/dist/cjs/types/index.d.ts +1 -0
  12. package/dist/cjs/types/sandbox/index.d.ts +1 -0
  13. package/dist/cjs/types/sandbox/sandbox.d.ts +10 -2
  14. package/dist/cjs/types/sandbox/snapshot.d.ts +40 -0
  15. package/dist/cjs/types/snapshot/index.d.ts +103 -0
  16. package/dist/cjs-browser/.tsbuildinfo +1 -1
  17. package/dist/cjs-browser/client/sdk.gen.js +95 -2
  18. package/dist/cjs-browser/common/settings.js +2 -2
  19. package/dist/cjs-browser/index.js +1 -0
  20. package/dist/cjs-browser/sandbox/index.js +1 -0
  21. package/dist/cjs-browser/sandbox/sandbox.js +9 -0
  22. package/dist/cjs-browser/sandbox/snapshot.js +77 -0
  23. package/dist/cjs-browser/snapshot/index.js +145 -0
  24. package/dist/cjs-browser/types/client/sdk.gen.d.ts +26 -1
  25. package/dist/cjs-browser/types/client/types.gen.d.ts +277 -11
  26. package/dist/cjs-browser/types/index.d.ts +1 -0
  27. package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
  28. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +10 -2
  29. package/dist/cjs-browser/types/sandbox/snapshot.d.ts +40 -0
  30. package/dist/cjs-browser/types/snapshot/index.d.ts +103 -0
  31. package/dist/esm/.tsbuildinfo +1 -1
  32. package/dist/esm/client/sdk.gen.js +88 -0
  33. package/dist/esm/common/settings.js +2 -2
  34. package/dist/esm/index.js +1 -0
  35. package/dist/esm/sandbox/index.js +1 -0
  36. package/dist/esm/sandbox/sandbox.js +9 -0
  37. package/dist/esm/sandbox/snapshot.js +73 -0
  38. package/dist/esm/snapshot/index.js +141 -0
  39. package/dist/esm-browser/.tsbuildinfo +1 -1
  40. package/dist/esm-browser/client/sdk.gen.js +88 -0
  41. package/dist/esm-browser/common/settings.js +2 -2
  42. package/dist/esm-browser/index.js +1 -0
  43. package/dist/esm-browser/sandbox/index.js +1 -0
  44. package/dist/esm-browser/sandbox/sandbox.js +9 -0
  45. package/dist/esm-browser/sandbox/snapshot.js +73 -0
  46. package/dist/esm-browser/snapshot/index.js +141 -0
  47. package/package.json +1 -1
@@ -4125,7 +4125,7 @@ export type SandboxScheduleMetrics = {
4125
4125
  until?: string;
4126
4126
  };
4127
4127
  /**
4128
- * A point-in-time snapshot of a sandbox that can be used for forking into a new sandbox or application.
4128
+ * A point-in-time snapshot of a sandbox. It is a workspace-level object: it outlives the sandbox it was captured from, and can be restored onto a sandbox or forked into a new sandbox or application on its own.
4129
4129
  */
4130
4130
  export type SandboxSnapshot = {
4131
4131
  /**
@@ -4137,36 +4137,154 @@ export type SandboxSnapshot = {
4137
4137
  */
4138
4138
  createdBy?: string;
4139
4139
  /**
4140
- * Unique snapshot identifier
4140
+ * Identifier of the snapshot on the compute plane
4141
4141
  */
4142
- id: string;
4142
+ readonly id: string;
4143
4143
  /**
4144
- * Optional human-readable name for the snapshot
4144
+ * Name of the snapshot, unique in its workspace
4145
4145
  */
4146
- name?: string;
4146
+ name: string;
4147
4147
  /**
4148
- * Name of the source sandbox
4148
+ * Name of the source sandbox. Kept for compatibility, read source.name instead.
4149
4149
  */
4150
- sandboxName: string;
4150
+ sandboxName?: string;
4151
+ source?: SandboxSnapshotSource;
4152
+ spec?: SandboxSnapshotSpec;
4151
4153
  /**
4152
4154
  * Status of the snapshot (pending, ready, failed)
4153
4155
  */
4154
4156
  status: string;
4155
4157
  /**
4156
- * Workspace of the source sandbox
4158
+ * Workspace owning the snapshot
4157
4159
  */
4158
4160
  workspace: string;
4159
4161
  };
4160
4162
  /**
4161
- * Request body for creating a snapshot of a sandbox. Captures the current sandbox state.
4163
+ * A point-in-time snapshot of a sandbox. It is a workspace-level object: it outlives the sandbox it was captured from, and can be restored onto a sandbox or forked into a new sandbox or application on its own.
4164
+ */
4165
+ export type SandboxSnapshotWritable = {
4166
+ /**
4167
+ * When the snapshot was created
4168
+ */
4169
+ createdAt: string;
4170
+ /**
4171
+ * Who created the snapshot
4172
+ */
4173
+ createdBy?: string;
4174
+ /**
4175
+ * Name of the snapshot, unique in its workspace
4176
+ */
4177
+ name: string;
4178
+ /**
4179
+ * Name of the source sandbox. Kept for compatibility, read source.name instead.
4180
+ */
4181
+ sandboxName?: string;
4182
+ source?: SandboxSnapshotSourceWritable;
4183
+ spec?: SandboxSnapshotSpec;
4184
+ /**
4185
+ * Status of the snapshot (pending, ready, failed)
4186
+ */
4187
+ status: string;
4188
+ /**
4189
+ * Workspace owning the snapshot
4190
+ */
4191
+ workspace: string;
4192
+ };
4193
+ /**
4194
+ * Cursor-paginated list of snapshots. Returned starting with API version 2026-04-28; older API versions return a bare array.
4195
+ */
4196
+ export type SandboxSnapshotList = {
4197
+ /**
4198
+ * Page of snapshots.
4199
+ */
4200
+ data?: Array<SandboxSnapshot>;
4201
+ meta?: PaginationMeta;
4202
+ };
4203
+ /**
4204
+ * Cursor-paginated list of snapshots. Returned starting with API version 2026-04-28; older API versions return a bare array.
4205
+ */
4206
+ export type SandboxSnapshotListWritable = {
4207
+ /**
4208
+ * Page of snapshots.
4209
+ */
4210
+ data?: Array<SandboxSnapshotWritable>;
4211
+ meta?: PaginationMeta;
4212
+ };
4213
+ /**
4214
+ * Request body for creating a snapshot. The source object is required at the root endpoint and implied by the path on the nested one.
4162
4215
  */
4163
4216
  export type SandboxSnapshotRequest = {
4164
4217
  /**
4165
- * Optional human-readable name for the snapshot
4218
+ * Name of the snapshot, unique in the workspace. Generated when absent, and always generated by the nested endpoint so a capture cannot collide with a name a user picked.
4166
4219
  */
4167
4220
  name?: string;
4221
+ source?: SandboxSnapshotSource;
4222
+ };
4223
+ /**
4224
+ * Request body for creating a snapshot. The source object is required at the root endpoint and implied by the path on the nested one.
4225
+ */
4226
+ export type SandboxSnapshotRequestWritable = {
4227
+ /**
4228
+ * Name of the snapshot, unique in the workspace. Generated when absent, and always generated by the nested endpoint so a capture cannot collide with a name a user picked.
4229
+ */
4230
+ name?: string;
4231
+ source?: SandboxSnapshotSourceWritable;
4232
+ };
4233
+ /**
4234
+ * The object a snapshot was captured from.
4235
+ */
4236
+ export type SandboxSnapshotSource = {
4237
+ /**
4238
+ * Whether the source object has since been deleted. The snapshot stays usable, the link is only kept for context.
4239
+ */
4240
+ readonly deleted?: boolean;
4241
+ /**
4242
+ * Kind of the object the snapshot was captured from. Defaults to sandbox, the only kind that can be captured today.
4243
+ */
4244
+ kind?: 'sandbox';
4245
+ /**
4246
+ * Name of the object the snapshot was captured from
4247
+ */
4248
+ name: string;
4249
+ };
4250
+ /**
4251
+ * The object a snapshot was captured from.
4252
+ */
4253
+ export type SandboxSnapshotSourceWritable = {
4254
+ /**
4255
+ * Kind of the object the snapshot was captured from. Defaults to sandbox, the only kind that can be captured today.
4256
+ */
4257
+ kind?: 'sandbox';
4258
+ /**
4259
+ * Name of the object the snapshot was captured from
4260
+ */
4261
+ name: string;
4262
+ };
4263
+ /**
4264
+ * The configuration a snapshot carries, so a sandbox or an application can be created from it once its source object is gone.
4265
+ */
4266
+ export type SandboxSnapshotSpec = {
4267
+ /**
4268
+ * Infrastructure generation the snapshot was captured on. A snapshot only restores on the generation it came from.
4269
+ */
4270
+ generation?: 'mk2' | 'mk3';
4271
+ /**
4272
+ * Image the source object ran
4273
+ */
4274
+ image?: string;
4275
+ /**
4276
+ * Memory in MB the source object ran with
4277
+ */
4278
+ memory?: number;
4279
+ ports?: Ports;
4280
+ /**
4281
+ * Region holding the snapshot. Restores and forks land in it.
4282
+ */
4283
+ region?: string;
4284
+ volumes?: VolumeAttachments;
4168
4285
  };
4169
4286
  export type SandboxSnapshots = Array<SandboxSnapshot>;
4287
+ export type SandboxSnapshotsWritable = Array<SandboxSnapshotWritable>;
4170
4288
  /**
4171
4289
  * Configuration for a sandbox including its image, memory, ports, region, and lifecycle policies
4172
4290
  */
@@ -8166,7 +8284,7 @@ export type ListSandboxSnapshotsResponses = {
8166
8284
  };
8167
8285
  export type ListSandboxSnapshotsResponse = ListSandboxSnapshotsResponses[keyof ListSandboxSnapshotsResponses];
8168
8286
  export type CreateSandboxSnapshotData = {
8169
- body: SandboxSnapshotRequest;
8287
+ body: SandboxSnapshotRequestWritable;
8170
8288
  path: {
8171
8289
  /**
8172
8290
  * Name of the sandbox to snapshot
@@ -8682,6 +8800,154 @@ export type DeleteApiKeyForServiceAccountResponses = {
8682
8800
  */
8683
8801
  200: unknown;
8684
8802
  };
8803
+ export type ListSnapshotsData = {
8804
+ body?: never;
8805
+ path?: never;
8806
+ query?: {
8807
+ /**
8808
+ * Opaque cursor returned by a previous response's meta.nextCursor. Only valid for the same query (workspace + filters); the server rejects cursors bound to a different query or older than 24h. Omit on the first page.
8809
+ */
8810
+ cursor?: string;
8811
+ /**
8812
+ * Maximum number of items to return per page. Defaults to 50, clamped to 200.
8813
+ */
8814
+ limit?: number;
8815
+ /**
8816
+ * Sort spec, formatted as `<key>:<direction>`. Allowed values are `createdAt:desc` (default), `createdAt:asc`, `name:asc`, `name:desc`. The cursor fingerprint is bound to the sort, so a cursor opened with one value cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
8817
+ */
8818
+ sort?: 'createdAt:desc' | 'createdAt:asc' | 'name:asc' | 'name:desc';
8819
+ /**
8820
+ * Substring search across `metadata.name`, `metadata.displayName` and labels (keys + values). Trimmed and lowercased server-side; queries shorter than 2 characters fall back to the unfiltered listing. Bound into the cursor fingerprint so a cursor opened with one query cannot be reused with another. Only honoured starting on Blaxel-Version 2026-04-28.
8821
+ */
8822
+ q?: string;
8823
+ /**
8824
+ * Start from a known pagination boundary. `end` is only supported for `createdAt` listings (asc or desc) and returns the tail page directly without walking every cursor from the first page.
8825
+ */
8826
+ anchor?: 'end';
8827
+ };
8828
+ url: '/snapshots';
8829
+ };
8830
+ export type ListSnapshotsErrors = {
8831
+ /**
8832
+ * Internal server error
8833
+ */
8834
+ 500: _Error;
8835
+ };
8836
+ export type ListSnapshotsError = ListSnapshotsErrors[keyof ListSnapshotsErrors];
8837
+ export type ListSnapshotsResponses = {
8838
+ /**
8839
+ * successful operation
8840
+ */
8841
+ 200: SandboxSnapshotList;
8842
+ };
8843
+ export type ListSnapshotsResponse = ListSnapshotsResponses[keyof ListSnapshotsResponses];
8844
+ export type CreateSnapshotData = {
8845
+ body: SandboxSnapshotRequestWritable;
8846
+ path?: never;
8847
+ query?: never;
8848
+ url: '/snapshots';
8849
+ };
8850
+ export type CreateSnapshotErrors = {
8851
+ /**
8852
+ * Not found - Source object does not exist
8853
+ */
8854
+ 404: _Error;
8855
+ /**
8856
+ * Internal server error
8857
+ */
8858
+ 500: _Error;
8859
+ };
8860
+ export type CreateSnapshotError = CreateSnapshotErrors[keyof CreateSnapshotErrors];
8861
+ export type CreateSnapshotResponses = {
8862
+ /**
8863
+ * Snapshot created successfully
8864
+ */
8865
+ 200: SandboxSnapshot;
8866
+ };
8867
+ export type CreateSnapshotResponse = CreateSnapshotResponses[keyof CreateSnapshotResponses];
8868
+ export type DeleteSnapshotData = {
8869
+ body?: never;
8870
+ path: {
8871
+ /**
8872
+ * Name of the snapshot
8873
+ */
8874
+ snapshotName: string;
8875
+ };
8876
+ query?: never;
8877
+ url: '/snapshots/{snapshotName}';
8878
+ };
8879
+ export type DeleteSnapshotErrors = {
8880
+ /**
8881
+ * Not found - Snapshot does not exist
8882
+ */
8883
+ 404: _Error;
8884
+ /**
8885
+ * Internal server error
8886
+ */
8887
+ 500: _Error;
8888
+ };
8889
+ export type DeleteSnapshotError = DeleteSnapshotErrors[keyof DeleteSnapshotErrors];
8890
+ export type DeleteSnapshotResponses = {
8891
+ /**
8892
+ * Snapshot deleted successfully
8893
+ */
8894
+ 204: void;
8895
+ };
8896
+ export type DeleteSnapshotResponse = DeleteSnapshotResponses[keyof DeleteSnapshotResponses];
8897
+ export type GetSnapshotData = {
8898
+ body?: never;
8899
+ path: {
8900
+ /**
8901
+ * Name of the snapshot
8902
+ */
8903
+ snapshotName: string;
8904
+ };
8905
+ query?: never;
8906
+ url: '/snapshots/{snapshotName}';
8907
+ };
8908
+ export type GetSnapshotErrors = {
8909
+ /**
8910
+ * Not found - Snapshot does not exist
8911
+ */
8912
+ 404: _Error;
8913
+ };
8914
+ export type GetSnapshotError = GetSnapshotErrors[keyof GetSnapshotErrors];
8915
+ export type GetSnapshotResponses = {
8916
+ /**
8917
+ * successful operation
8918
+ */
8919
+ 200: SandboxSnapshot;
8920
+ };
8921
+ export type GetSnapshotResponse = GetSnapshotResponses[keyof GetSnapshotResponses];
8922
+ export type ForkSnapshotData = {
8923
+ body: SandboxForkRequest;
8924
+ path: {
8925
+ /**
8926
+ * Name of the snapshot to create the resource from
8927
+ */
8928
+ snapshotName: string;
8929
+ };
8930
+ query?: never;
8931
+ url: '/snapshots/{snapshotName}/fork';
8932
+ };
8933
+ export type ForkSnapshotErrors = {
8934
+ /**
8935
+ * Not found - Snapshot does not exist
8936
+ */
8937
+ 404: _Error;
8938
+ /**
8939
+ * Internal server error
8940
+ */
8941
+ 500: _Error;
8942
+ };
8943
+ export type ForkSnapshotError = ForkSnapshotErrors[keyof ForkSnapshotErrors];
8944
+ export type ForkSnapshotResponses = {
8945
+ /**
8946
+ * Resource created successfully
8947
+ */
8948
+ 200: SandboxForkResponse;
8949
+ };
8950
+ export type ForkSnapshotResponse = ForkSnapshotResponses[keyof ForkSnapshotResponses];
8685
8951
  export type ListTemplatesData = {
8686
8952
  body?: never;
8687
8953
  path?: never;
@@ -18,6 +18,7 @@ export * from "./jobs/index.js";
18
18
  export * from "./mcp/index.js";
19
19
  export * from "./models/index.js";
20
20
  export * from "./sandbox/index.js";
21
+ export * from "./snapshot/index.js";
21
22
  export * from "./telemetry/telemetry.js";
22
23
  export * from "./tools/index.js";
23
24
  export * from "./tools/types.js";
@@ -5,6 +5,7 @@ export * from "./codegen/index.js";
5
5
  export { SandboxDrive, type DriveMountRequest, type DriveMountResponse, type DriveMountInfo, type DriveUnmountResponse } from "./drive/index.js";
6
6
  export * from "./preview.js";
7
7
  export * from "./schedule.js";
8
+ export * from "./snapshot.js";
8
9
  export * from "./session.js";
9
10
  export * from "./sandbox.js";
10
11
  export * from "./system.js";
@@ -1,5 +1,5 @@
1
1
  import type http2 from "http2";
2
- import { type Env, type ListSandboxesData, type SandboxForkResponse, type SandboxLifecycle, type Sandbox as SandboxModel, type SandboxRestoreResponse, type SandboxSnapshot, type SandboxSnapshots } from "../client/index.js";
2
+ import { type Env, type ListSandboxesData, type SandboxForkResponse, type SandboxLifecycle, type Sandbox as SandboxModel, type SandboxRestoreResponse, type SandboxSnapshot } from "../client/index.js";
3
3
  import { SandboxCodegen } from "./codegen/index.js";
4
4
  import { SandboxDrive } from "./drive/index.js";
5
5
  import { SandboxFileSystem } from "./filesystem/index.js";
@@ -7,6 +7,7 @@ import { SandboxNetwork } from "./network/index.js";
7
7
  import { SandboxPreviews } from "./preview.js";
8
8
  import { SandboxProcess } from "./process/index.js";
9
9
  import { SandboxSchedules } from "./schedule.js";
10
+ import { SandboxSnapshotsResource } from "./snapshot.js";
10
11
  import { SandboxSessions } from "./session.js";
11
12
  import { SandboxSystem } from "./system.js";
12
13
  import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SandboxUpdateNetwork, SessionWithToken } from "./types.js";
@@ -55,6 +56,7 @@ export declare class SandboxInstance {
55
56
  codegen: SandboxCodegen;
56
57
  system: SandboxSystem;
57
58
  drives: SandboxDrive;
59
+ snapshots: SandboxSnapshotsResource;
58
60
  h2Session: http2.ClientHttp2Session | null;
59
61
  constructor(sandbox: SandboxConfiguration);
60
62
  get metadata(): import("../client/types.gen.js").Metadata;
@@ -90,14 +92,19 @@ export declare class SandboxInstance {
90
92
  * sandbox state and can be forked into new sandboxes or applications.
91
93
  *
92
94
  * @param name - Optional human-readable name for the snapshot.
95
+ * @deprecated Use `sandbox.snapshots.create(name)`.
93
96
  */
94
97
  snapshot(name?: string): Promise<SandboxSnapshot>;
95
98
  /**
96
99
  * List the snapshots of this sandbox.
100
+ *
101
+ * @deprecated Use `sandbox.snapshots.list()`.
97
102
  */
98
- listSnapshots(): Promise<SandboxSnapshots>;
103
+ listSnapshots(): Promise<SandboxSnapshot[]>;
99
104
  /**
100
105
  * Delete a snapshot of this sandbox by its ID.
106
+ *
107
+ * @deprecated Use `sandbox.snapshots.delete(name)`.
101
108
  */
102
109
  deleteSnapshot(snapshotId: string): Promise<void>;
103
110
  /**
@@ -110,6 +117,7 @@ export declare class SandboxInstance {
110
117
  * is: connections to a sandbox still resuming are retried by the gateway.
111
118
  *
112
119
  * @param snapshotId - ID of the snapshot to restore this sandbox to.
120
+ * @deprecated Use `sandbox.snapshots.restore(name)`.
113
121
  */
114
122
  restore(snapshotId: string): Promise<SandboxRestoreResponse>;
115
123
  /**
@@ -0,0 +1,40 @@
1
+ import { type Sandbox, type SandboxRestoreResponse } from "../client/index.js";
2
+ import { Snapshot } from "../snapshot/index.js";
3
+ /**
4
+ * SandboxSnapshotsResource is the sandbox's view of the workspace's snapshots: the
5
+ * ones captured from it. A snapshot itself belongs to the workspace, so
6
+ * deleting one here deletes it everywhere, and it stays after this sandbox is
7
+ * deleted.
8
+ */
9
+ export declare class SandboxSnapshotsResource {
10
+ private sandbox;
11
+ constructor(sandbox: Sandbox);
12
+ get sandboxName(): string;
13
+ /**
14
+ * Capture a snapshot of the sandbox.
15
+ *
16
+ * @param name - Name of the snapshot, unique among this sandbox's
17
+ * snapshots. Generated when omitted.
18
+ */
19
+ create(name?: string): Promise<Snapshot>;
20
+ /** List the snapshots captured from this sandbox. */
21
+ list(): Promise<Snapshot[]>;
22
+ /**
23
+ * Find a snapshot captured from this sandbox by its name, or by its
24
+ * identifier. Names are only unique within the sandbox, which is why the
25
+ * workspace-level `Snapshot.get` takes the identifier instead.
26
+ */
27
+ get(snapshotName: string): Promise<Snapshot>;
28
+ /**
29
+ * Delete a snapshot captured from this sandbox. The snapshot is a workspace
30
+ * object, so it is removed for the whole workspace.
31
+ */
32
+ delete(snapshotName: string): Promise<void>;
33
+ /**
34
+ * Restore the sandbox to one of its snapshots. The sandbox keeps its name,
35
+ * its URLs and its previews: the running instance is torn down and rebuilt
36
+ * from the snapshot, so everything written since it was taken is lost unless
37
+ * it was snapshotted too.
38
+ */
39
+ restore(snapshotName: string): Promise<SandboxRestoreResponse>;
40
+ }
@@ -0,0 +1,103 @@
1
+ import { type Env, type ListSnapshotsData, type SandboxForkResponse, type SandboxSnapshot, type SandboxSnapshotSource } from "../client/index.js";
2
+ export type SnapshotListQuery = NonNullable<ListSnapshotsData["query"]>;
3
+ /** The object a snapshot is captured from. `kind` defaults to `sandbox`. */
4
+ export type SnapshotSourceConfiguration = {
5
+ name: string;
6
+ kind?: SandboxSnapshotSource["kind"];
7
+ };
8
+ export type SnapshotCreateConfiguration = {
9
+ /** Name of the snapshot, unique in the workspace. Generated when omitted. */
10
+ name?: string;
11
+ source: SnapshotSourceConfiguration;
12
+ };
13
+ export type SnapshotForkOptions = {
14
+ /** Resource type to create from the snapshot. Defaults to "sandbox". */
15
+ targetType?: "sandbox" | "application";
16
+ /** Port to expose from the created resource. */
17
+ port?: number;
18
+ /** Canary traffic percentage (0-100) when forking into an application. */
19
+ traffic?: number;
20
+ /** Custom domain for the application fork. */
21
+ customDomain?: string;
22
+ /** URL prefix for the application fork. */
23
+ prefix?: string;
24
+ /**
25
+ * Environment variables the fork runs with, on top of the source's. A
26
+ * variable the source already has takes this value, others are added.
27
+ */
28
+ envs?: Env[];
29
+ };
30
+ /**
31
+ * A snapshot is a workspace resource: it is captured from a sandbox, but it
32
+ * outlives it. Deleting the sandbox it came from leaves the snapshot in place,
33
+ * with `source.deleted` set, and it still carries what a fork needs to run.
34
+ */
35
+ export declare class Snapshot {
36
+ private snapshot;
37
+ constructor(snapshot: SandboxSnapshot);
38
+ get name(): string;
39
+ /** Identifier of the snapshot on the compute plane. */
40
+ get id(): string;
41
+ get status(): string;
42
+ get workspace(): string;
43
+ get createdAt(): string;
44
+ /** The object the snapshot was captured from, and whether it still exists. */
45
+ get source(): SandboxSnapshotSource | undefined;
46
+ /** The configuration a fork of this snapshot runs with. */
47
+ get spec(): import("../client/types.gen.js").SandboxSnapshotSpec | undefined;
48
+ /**
49
+ * Capture a snapshot of a source object.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const snapshot = await Snapshot.create({
54
+ * name: "my-snapshot",
55
+ * source: { name: "my-sandbox" },
56
+ * });
57
+ * ```
58
+ */
59
+ static create(config: SnapshotCreateConfiguration): Promise<Snapshot>;
60
+ /**
61
+ * Fetch a snapshot by its identifier (`snapshot.id`). Names are only unique
62
+ * within the sandbox they were captured from, so the workspace-level routes
63
+ * take the identifier; use `sandbox.snapshots.get(name)` to address one by
64
+ * name.
65
+ */
66
+ static get(snapshotId: string): Promise<Snapshot>;
67
+ /**
68
+ * List one page of the workspace's snapshots.
69
+ *
70
+ * The returned page exposes `data` for the current page, `meta` for cursor
71
+ * metadata, and `nextPage()` / `autoPagingEach()` / `autoPagingToArray()`
72
+ * helpers. Iterate it directly with `for await` to walk every page.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const page = await Snapshot.list({ limit: 50 });
77
+ * for await (const snapshot of page) {
78
+ * console.log(snapshot.name);
79
+ * }
80
+ * ```
81
+ */
82
+ static list(query?: SnapshotListQuery): Promise<import("../common/pagination.js").PaginatedList<Snapshot, {
83
+ cursor?: string;
84
+ limit?: number;
85
+ sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
86
+ q?: string;
87
+ anchor?: "end";
88
+ }>>;
89
+ /**
90
+ * Delete a snapshot. There is one snapshot object, so this removes it for
91
+ * the whole workspace, whether or not the sandbox it came from still exists.
92
+ */
93
+ static delete(snapshotId: string): Promise<void>;
94
+ delete(): Promise<void>;
95
+ /**
96
+ * Create a sandbox or an application from this snapshot. This works after
97
+ * the sandbox the snapshot was captured from has been deleted.
98
+ *
99
+ * @param targetName - Name of the sandbox/application to create.
100
+ * @param options - Fork options (target type, port, traffic, ...).
101
+ */
102
+ fork(targetName: string, options?: SnapshotForkOptions): Promise<SandboxForkResponse>;
103
+ }