@vercel/sandbox 1.9.0 → 1.9.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.
Files changed (190) hide show
  1. package/README.md +8 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/api-client/api-client.cjs +375 -0
  4. package/dist/api-client/api-client.cjs.map +1 -0
  5. package/dist/api-client/api-client.d.cts +403 -0
  6. package/dist/api-client/api-client.d.ts +397 -392
  7. package/dist/api-client/api-client.js +365 -405
  8. package/dist/api-client/api-client.js.map +1 -1
  9. package/dist/api-client/api-error.cjs +31 -0
  10. package/dist/api-client/api-error.cjs.map +1 -0
  11. package/dist/api-client/api-error.d.cts +27 -0
  12. package/dist/api-client/api-error.d.ts +19 -16
  13. package/dist/api-client/api-error.js +27 -32
  14. package/dist/api-client/api-error.js.map +1 -1
  15. package/dist/api-client/base-client.cjs +113 -0
  16. package/dist/api-client/base-client.cjs.map +1 -0
  17. package/dist/api-client/base-client.d.cts +38 -0
  18. package/dist/api-client/base-client.d.ts +31 -36
  19. package/dist/api-client/base-client.js +101 -118
  20. package/dist/api-client/base-client.js.map +1 -1
  21. package/dist/api-client/file-writer.cjs +62 -0
  22. package/dist/api-client/file-writer.cjs.map +1 -0
  23. package/dist/api-client/file-writer.d.cts +66 -0
  24. package/dist/api-client/file-writer.d.ts +56 -52
  25. package/dist/api-client/file-writer.js +57 -61
  26. package/dist/api-client/file-writer.js.map +1 -1
  27. package/dist/api-client/index.cjs +2 -0
  28. package/dist/api-client/index.d.ts +2 -2
  29. package/dist/api-client/index.js +4 -21
  30. package/dist/api-client/validators.cjs +149 -0
  31. package/dist/api-client/validators.cjs.map +1 -0
  32. package/dist/api-client/validators.d.cts +1677 -0
  33. package/dist/api-client/validators.d.ts +1501 -2412
  34. package/dist/api-client/validators.js +124 -154
  35. package/dist/api-client/validators.js.map +1 -1
  36. package/dist/api-client/with-retry.cjs +89 -0
  37. package/dist/api-client/with-retry.cjs.map +1 -0
  38. package/dist/api-client/with-retry.d.cts +10 -0
  39. package/dist/api-client/with-retry.d.ts +9 -13
  40. package/dist/api-client/with-retry.js +81 -102
  41. package/dist/api-client/with-retry.js.map +1 -1
  42. package/dist/auth/api.cjs +29 -0
  43. package/dist/auth/api.cjs.map +1 -0
  44. package/dist/auth/api.js +26 -25
  45. package/dist/auth/api.js.map +1 -1
  46. package/dist/auth/error.cjs +13 -0
  47. package/dist/auth/error.cjs.map +1 -0
  48. package/dist/auth/error.js +11 -11
  49. package/dist/auth/error.js.map +1 -1
  50. package/dist/auth/file.cjs +64 -0
  51. package/dist/auth/file.cjs.map +1 -0
  52. package/dist/auth/file.d.cts +26 -0
  53. package/dist/auth/file.d.ts +19 -15
  54. package/dist/auth/file.js +49 -64
  55. package/dist/auth/file.js.map +1 -1
  56. package/dist/auth/index.cjs +12 -0
  57. package/dist/auth/index.d.cts +5 -0
  58. package/dist/auth/index.d.ts +5 -6
  59. package/dist/auth/index.js +6 -27
  60. package/dist/auth/linked-project.cjs +38 -0
  61. package/dist/auth/linked-project.cjs.map +1 -0
  62. package/dist/auth/linked-project.js +30 -64
  63. package/dist/auth/linked-project.js.map +1 -1
  64. package/dist/auth/oauth.cjs +205 -0
  65. package/dist/auth/oauth.cjs.map +1 -0
  66. package/dist/auth/oauth.d.cts +135 -0
  67. package/dist/auth/oauth.d.ts +113 -109
  68. package/dist/auth/oauth.js +185 -252
  69. package/dist/auth/oauth.js.map +1 -1
  70. package/dist/auth/poll-for-token.cjs +82 -0
  71. package/dist/auth/poll-for-token.cjs.map +1 -0
  72. package/dist/auth/poll-for-token.d.cts +28 -0
  73. package/dist/auth/poll-for-token.d.ts +23 -15
  74. package/dist/auth/poll-for-token.js +79 -64
  75. package/dist/auth/poll-for-token.js.map +1 -1
  76. package/dist/auth/project.cjs +80 -0
  77. package/dist/auth/project.cjs.map +1 -0
  78. package/dist/auth/project.d.cts +44 -0
  79. package/dist/auth/project.d.ts +12 -8
  80. package/dist/auth/project.js +70 -72
  81. package/dist/auth/project.js.map +1 -1
  82. package/dist/auth/zod.cjs +22 -0
  83. package/dist/auth/zod.cjs.map +1 -0
  84. package/dist/auth/zod.js +18 -17
  85. package/dist/auth/zod.js.map +1 -1
  86. package/dist/command.cjs +328 -0
  87. package/dist/command.cjs.map +1 -0
  88. package/dist/command.d.cts +289 -0
  89. package/dist/command.d.ts +265 -171
  90. package/dist/command.js +323 -226
  91. package/dist/command.js.map +1 -1
  92. package/dist/constants.d.cts +5 -0
  93. package/dist/constants.d.ts +5 -1
  94. package/dist/index.cjs +11 -0
  95. package/dist/index.d.cts +6 -0
  96. package/dist/index.d.ts +6 -5
  97. package/dist/index.js +6 -15
  98. package/dist/network-policy.d.cts +100 -0
  99. package/dist/network-policy.d.ts +32 -28
  100. package/dist/sandbox.cjs +543 -0
  101. package/dist/sandbox.cjs.map +1 -0
  102. package/dist/sandbox.d.cts +538 -0
  103. package/dist/sandbox.d.ts +521 -479
  104. package/dist/sandbox.js +539 -512
  105. package/dist/sandbox.js.map +1 -1
  106. package/dist/snapshot.cjs +116 -0
  107. package/dist/snapshot.cjs.map +1 -0
  108. package/dist/snapshot.d.cts +109 -0
  109. package/dist/snapshot.d.ts +100 -92
  110. package/dist/snapshot.js +114 -114
  111. package/dist/snapshot.js.map +1 -1
  112. package/dist/utils/array.cjs +17 -0
  113. package/dist/utils/array.cjs.map +1 -0
  114. package/dist/utils/array.js +12 -15
  115. package/dist/utils/array.js.map +1 -1
  116. package/dist/utils/consume-readable.cjs +18 -0
  117. package/dist/utils/consume-readable.cjs.map +1 -0
  118. package/dist/utils/consume-readable.js +13 -12
  119. package/dist/utils/consume-readable.js.map +1 -1
  120. package/dist/utils/decode-base64-url.cjs +15 -0
  121. package/dist/utils/decode-base64-url.cjs.map +1 -0
  122. package/dist/utils/decode-base64-url.js +10 -9
  123. package/dist/utils/decode-base64-url.js.map +1 -1
  124. package/dist/utils/dev-credentials.cjs +142 -0
  125. package/dist/utils/dev-credentials.cjs.map +1 -0
  126. package/dist/utils/dev-credentials.js +126 -184
  127. package/dist/utils/dev-credentials.js.map +1 -1
  128. package/dist/utils/get-credentials.cjs +123 -0
  129. package/dist/utils/get-credentials.cjs.map +1 -0
  130. package/dist/utils/get-credentials.d.cts +21 -0
  131. package/dist/utils/get-credentials.d.ts +19 -61
  132. package/dist/utils/get-credentials.js +106 -140
  133. package/dist/utils/get-credentials.js.map +1 -1
  134. package/dist/utils/log.cjs +25 -0
  135. package/dist/utils/log.cjs.map +1 -0
  136. package/dist/utils/log.js +15 -17
  137. package/dist/utils/log.js.map +1 -1
  138. package/dist/utils/network-policy.cjs +65 -0
  139. package/dist/utils/network-policy.cjs.map +1 -0
  140. package/dist/utils/network-policy.js +58 -77
  141. package/dist/utils/network-policy.js.map +1 -1
  142. package/dist/utils/normalizePath.cjs +27 -0
  143. package/dist/utils/normalizePath.cjs.map +1 -0
  144. package/dist/utils/normalizePath.js +21 -28
  145. package/dist/utils/normalizePath.js.map +1 -1
  146. package/dist/utils/resolveSignal.cjs +20 -0
  147. package/dist/utils/resolveSignal.cjs.map +1 -0
  148. package/dist/utils/resolveSignal.d.cts +15 -0
  149. package/dist/utils/resolveSignal.d.ts +12 -10
  150. package/dist/utils/resolveSignal.js +14 -17
  151. package/dist/utils/resolveSignal.js.map +1 -1
  152. package/dist/utils/sandbox-snapshot.cjs +14 -0
  153. package/dist/utils/sandbox-snapshot.cjs.map +1 -0
  154. package/dist/utils/sandbox-snapshot.d.cts +10 -0
  155. package/dist/utils/sandbox-snapshot.d.ts +11 -0
  156. package/dist/utils/sandbox-snapshot.js +14 -0
  157. package/dist/utils/sandbox-snapshot.js.map +1 -0
  158. package/dist/utils/types.cjs +13 -0
  159. package/dist/utils/types.cjs.map +1 -0
  160. package/dist/utils/types.d.cts +11 -0
  161. package/dist/utils/types.d.ts +5 -7
  162. package/dist/utils/types.js +8 -8
  163. package/dist/utils/types.js.map +1 -1
  164. package/dist/version.cjs +7 -0
  165. package/dist/version.cjs.map +1 -0
  166. package/dist/version.js +5 -5
  167. package/dist/version.js.map +1 -1
  168. package/package.json +23 -3
  169. package/dist/api-client/index.js.map +0 -1
  170. package/dist/auth/api.d.ts +0 -6
  171. package/dist/auth/error.d.ts +0 -11
  172. package/dist/auth/index.js.map +0 -1
  173. package/dist/auth/linked-project.d.ts +0 -10
  174. package/dist/auth/zod.d.ts +0 -5
  175. package/dist/constants.js +0 -3
  176. package/dist/constants.js.map +0 -1
  177. package/dist/index.js.map +0 -1
  178. package/dist/network-policy.js +0 -3
  179. package/dist/network-policy.js.map +0 -1
  180. package/dist/utils/array.d.ts +0 -9
  181. package/dist/utils/consume-readable.d.ts +0 -5
  182. package/dist/utils/convert-sandbox.d.ts +0 -6
  183. package/dist/utils/convert-sandbox.js +0 -14
  184. package/dist/utils/convert-sandbox.js.map +0 -1
  185. package/dist/utils/decode-base64-url.d.ts +0 -7
  186. package/dist/utils/dev-credentials.d.ts +0 -37
  187. package/dist/utils/log.d.ts +0 -2
  188. package/dist/utils/network-policy.d.ts +0 -7
  189. package/dist/utils/normalizePath.d.ts +0 -17
  190. package/dist/version.d.ts +0 -1
@@ -0,0 +1,403 @@
1
+ import { BaseClient, Parsed, RequestParams } from "./base-client.cjs";
2
+ import { CommandData, CommandFinishedData, CommandFinishedResponse, CommandResponse, CreateSnapshotResponse, ExtendTimeoutResponse, LogLineStderr, LogLineStdout, SandboxResponse, SnapshotResponse, UpdateNetworkPolicyResponse } from "./validators.cjs";
3
+ import { FileWriter } from "./file-writer.cjs";
4
+ import { NetworkPolicy } from "../network-policy.cjs";
5
+ import { WithPrivate } from "../utils/types.cjs";
6
+ import { RUNTIMES } from "../constants.cjs";
7
+ import { z } from "zod";
8
+ import { Readable } from "stream";
9
+
10
+ //#region src/api-client/api-client.d.ts
11
+ interface WithFetchOptions {
12
+ fetch?: typeof globalThis.fetch;
13
+ }
14
+ declare class APIClient extends BaseClient {
15
+ private teamId;
16
+ private projectId;
17
+ private isJwtToken;
18
+ constructor(params: {
19
+ baseUrl?: string;
20
+ teamId: string;
21
+ token: string;
22
+ fetch?: typeof globalThis.fetch;
23
+ });
24
+ private ensureValidToken;
25
+ protected request(path: string, params?: RequestParams): Promise<Response>;
26
+ getSandbox(params: WithPrivate<{
27
+ sandboxId: string;
28
+ signal?: AbortSignal;
29
+ }>): Promise<Parsed<{
30
+ sandbox: {
31
+ status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
32
+ id: string;
33
+ memory: number;
34
+ vcpus: number;
35
+ region: string;
36
+ runtime: string;
37
+ timeout: number;
38
+ requestedAt: number;
39
+ createdAt: number;
40
+ cwd: string;
41
+ updatedAt: number;
42
+ startedAt?: number | undefined;
43
+ requestedStopAt?: number | undefined;
44
+ stoppedAt?: number | undefined;
45
+ abortedAt?: number | undefined;
46
+ duration?: number | undefined;
47
+ sourceSnapshotId?: string | undefined;
48
+ snapshottedAt?: number | undefined;
49
+ interactivePort?: number | undefined;
50
+ networkPolicy?: z.objectInputType<{
51
+ mode: z.ZodLiteral<"allow-all">;
52
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
53
+ mode: z.ZodLiteral<"deny-all">;
54
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
55
+ mode: z.ZodLiteral<"custom">;
56
+ allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
57
+ allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
58
+ deniedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
59
+ injectionRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
60
+ domain: z.ZodString;
61
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
62
+ headerNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ domain: string;
65
+ headers?: Record<string, string> | undefined;
66
+ headerNames?: string[] | undefined;
67
+ }, {
68
+ domain: string;
69
+ headers?: Record<string, string> | undefined;
70
+ headerNames?: string[] | undefined;
71
+ }>, "many">>;
72
+ }, z.ZodTypeAny, "passthrough"> | undefined;
73
+ activeCpuDurationMs?: number | undefined;
74
+ networkTransfer?: {
75
+ ingress: number;
76
+ egress: number;
77
+ } | undefined;
78
+ };
79
+ routes: {
80
+ url: string;
81
+ subdomain: string;
82
+ port: number;
83
+ }[];
84
+ }>>;
85
+ createSandbox(params: WithPrivate<{
86
+ ports?: number[];
87
+ projectId: string;
88
+ source?: {
89
+ type: "git";
90
+ url: string;
91
+ depth?: number;
92
+ revision?: string;
93
+ username?: string;
94
+ password?: string;
95
+ } | {
96
+ type: "tarball";
97
+ url: string;
98
+ } | {
99
+ type: "snapshot";
100
+ snapshotId: string;
101
+ };
102
+ timeout?: number;
103
+ resources?: {
104
+ vcpus: number;
105
+ };
106
+ runtime?: RUNTIMES | (string & {});
107
+ networkPolicy?: NetworkPolicy;
108
+ env?: Record<string, string>;
109
+ signal?: AbortSignal;
110
+ }>): Promise<Parsed<{
111
+ sandbox: {
112
+ status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
113
+ id: string;
114
+ memory: number;
115
+ vcpus: number;
116
+ region: string;
117
+ runtime: string;
118
+ timeout: number;
119
+ requestedAt: number;
120
+ createdAt: number;
121
+ cwd: string;
122
+ updatedAt: number;
123
+ startedAt?: number | undefined;
124
+ requestedStopAt?: number | undefined;
125
+ stoppedAt?: number | undefined;
126
+ abortedAt?: number | undefined;
127
+ duration?: number | undefined;
128
+ sourceSnapshotId?: string | undefined;
129
+ snapshottedAt?: number | undefined;
130
+ interactivePort?: number | undefined;
131
+ networkPolicy?: z.objectInputType<{
132
+ mode: z.ZodLiteral<"allow-all">;
133
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
134
+ mode: z.ZodLiteral<"deny-all">;
135
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
136
+ mode: z.ZodLiteral<"custom">;
137
+ allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
138
+ allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
139
+ deniedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
140
+ injectionRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
141
+ domain: z.ZodString;
142
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
143
+ headerNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ domain: string;
146
+ headers?: Record<string, string> | undefined;
147
+ headerNames?: string[] | undefined;
148
+ }, {
149
+ domain: string;
150
+ headers?: Record<string, string> | undefined;
151
+ headerNames?: string[] | undefined;
152
+ }>, "many">>;
153
+ }, z.ZodTypeAny, "passthrough"> | undefined;
154
+ activeCpuDurationMs?: number | undefined;
155
+ networkTransfer?: {
156
+ ingress: number;
157
+ egress: number;
158
+ } | undefined;
159
+ };
160
+ routes: {
161
+ url: string;
162
+ subdomain: string;
163
+ port: number;
164
+ }[];
165
+ }>>;
166
+ runCommand(params: {
167
+ sandboxId: string;
168
+ cwd?: string;
169
+ command: string;
170
+ args: string[];
171
+ env: Record<string, string>;
172
+ sudo: boolean;
173
+ wait: true;
174
+ signal?: AbortSignal;
175
+ }): Promise<{
176
+ command: CommandData;
177
+ finished: Promise<CommandFinishedData>;
178
+ }>;
179
+ runCommand(params: {
180
+ sandboxId: string;
181
+ cwd?: string;
182
+ command: string;
183
+ args: string[];
184
+ env: Record<string, string>;
185
+ sudo: boolean;
186
+ wait?: false;
187
+ signal?: AbortSignal;
188
+ }): Promise<Parsed<z.infer<typeof CommandResponse>>>;
189
+ getCommand(params: {
190
+ sandboxId: string;
191
+ cmdId: string;
192
+ wait: true;
193
+ signal?: AbortSignal;
194
+ }): Promise<Parsed<z.infer<typeof CommandFinishedResponse>>>;
195
+ getCommand(params: {
196
+ sandboxId: string;
197
+ cmdId: string;
198
+ wait?: boolean;
199
+ signal?: AbortSignal;
200
+ }): Promise<Parsed<z.infer<typeof CommandResponse>>>;
201
+ mkDir(params: {
202
+ sandboxId: string;
203
+ path: string;
204
+ cwd?: string;
205
+ signal?: AbortSignal;
206
+ }): Promise<Parsed<{}>>;
207
+ getFileWriter(params: {
208
+ sandboxId: string;
209
+ extractDir: string;
210
+ signal?: AbortSignal;
211
+ }): {
212
+ response: Promise<Response>;
213
+ writer: FileWriter;
214
+ };
215
+ listSandboxes(params: {
216
+ /**
217
+ * The ID or name of the project to which the sandboxes belong.
218
+ * @example "my-project"
219
+ */
220
+ projectId: string;
221
+ /**
222
+ * Maximum number of sandboxes to list from a request.
223
+ * @example 10
224
+ */
225
+ limit?: number;
226
+ /**
227
+ * Get sandboxes created after this JavaScript timestamp.
228
+ * @example 1540095775941
229
+ */
230
+ since?: number | Date;
231
+ /**
232
+ * Get sandboxes created before this JavaScript timestamp.
233
+ * @example 1540095775951
234
+ */
235
+ until?: number | Date;
236
+ signal?: AbortSignal;
237
+ }): Promise<Parsed<{
238
+ sandboxes: {
239
+ status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
240
+ id: string;
241
+ memory: number;
242
+ vcpus: number;
243
+ region: string;
244
+ runtime: string;
245
+ timeout: number;
246
+ requestedAt: number;
247
+ createdAt: number;
248
+ cwd: string;
249
+ updatedAt: number;
250
+ startedAt?: number | undefined;
251
+ requestedStopAt?: number | undefined;
252
+ stoppedAt?: number | undefined;
253
+ abortedAt?: number | undefined;
254
+ duration?: number | undefined;
255
+ sourceSnapshotId?: string | undefined;
256
+ snapshottedAt?: number | undefined;
257
+ interactivePort?: number | undefined;
258
+ networkPolicy?: z.objectInputType<{
259
+ mode: z.ZodLiteral<"allow-all">;
260
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
261
+ mode: z.ZodLiteral<"deny-all">;
262
+ }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
263
+ mode: z.ZodLiteral<"custom">;
264
+ allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
265
+ allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
266
+ deniedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
267
+ injectionRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
268
+ domain: z.ZodString;
269
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
270
+ headerNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ domain: string;
273
+ headers?: Record<string, string> | undefined;
274
+ headerNames?: string[] | undefined;
275
+ }, {
276
+ domain: string;
277
+ headers?: Record<string, string> | undefined;
278
+ headerNames?: string[] | undefined;
279
+ }>, "many">>;
280
+ }, z.ZodTypeAny, "passthrough"> | undefined;
281
+ activeCpuDurationMs?: number | undefined;
282
+ networkTransfer?: {
283
+ ingress: number;
284
+ egress: number;
285
+ } | undefined;
286
+ }[];
287
+ pagination: {
288
+ count: number;
289
+ next: number | null;
290
+ prev: number | null;
291
+ };
292
+ }>>;
293
+ listSnapshots(params: {
294
+ /**
295
+ * The ID or name of the project to which the snapshots belong.
296
+ * @example "my-project"
297
+ */
298
+ projectId: string;
299
+ /**
300
+ * Maximum number of snapshots to list from a request.
301
+ * @example 10
302
+ */
303
+ limit?: number;
304
+ /**
305
+ * Get snapshots created after this JavaScript timestamp.
306
+ * @example 1540095775941
307
+ */
308
+ since?: number | Date;
309
+ /**
310
+ * Get snapshots created before this JavaScript timestamp.
311
+ * @example 1540095775951
312
+ */
313
+ until?: number | Date;
314
+ signal?: AbortSignal;
315
+ }): Promise<Parsed<{
316
+ pagination: {
317
+ count: number;
318
+ next: number | null;
319
+ prev: number | null;
320
+ };
321
+ snapshots: {
322
+ status: "failed" | "created" | "deleted";
323
+ id: string;
324
+ region: string;
325
+ createdAt: number;
326
+ updatedAt: number;
327
+ sourceSandboxId: string;
328
+ sizeBytes: number;
329
+ expiresAt?: number | undefined;
330
+ }[];
331
+ }>>;
332
+ writeFiles(params: {
333
+ sandboxId: string;
334
+ cwd: string;
335
+ files: {
336
+ path: string;
337
+ content: string | Uint8Array;
338
+ mode?: number;
339
+ }[];
340
+ extractDir: string;
341
+ signal?: AbortSignal;
342
+ }): Promise<void>;
343
+ readFile(params: {
344
+ sandboxId: string;
345
+ path: string;
346
+ cwd?: string;
347
+ signal?: AbortSignal;
348
+ }): Promise<Readable | null>;
349
+ killCommand(params: {
350
+ sandboxId: string;
351
+ commandId: string;
352
+ signal: number;
353
+ abortSignal?: AbortSignal;
354
+ }): Promise<Parsed<{
355
+ command: {
356
+ id: string;
357
+ startedAt: number;
358
+ cwd: string;
359
+ name: string;
360
+ args: string[];
361
+ sandboxId: string;
362
+ exitCode: number | null;
363
+ };
364
+ }>>;
365
+ getLogs(params: {
366
+ sandboxId: string;
367
+ cmdId: string;
368
+ signal?: AbortSignal;
369
+ }): AsyncGenerator<z.infer<typeof LogLineStdout> | z.infer<typeof LogLineStderr>, void, void> & Disposable & {
370
+ close(): void;
371
+ };
372
+ stopSandbox(params: {
373
+ sandboxId: string;
374
+ signal?: AbortSignal;
375
+ blocking?: boolean;
376
+ }): Promise<Parsed<z.infer<typeof SandboxResponse>>>;
377
+ updateNetworkPolicy(params: {
378
+ sandboxId: string;
379
+ networkPolicy: NetworkPolicy;
380
+ signal?: AbortSignal;
381
+ }): Promise<Parsed<z.infer<typeof UpdateNetworkPolicyResponse>>>;
382
+ extendTimeout(params: {
383
+ sandboxId: string;
384
+ duration: number;
385
+ signal?: AbortSignal;
386
+ }): Promise<Parsed<z.infer<typeof ExtendTimeoutResponse>>>;
387
+ createSnapshot(params: {
388
+ sandboxId: string;
389
+ expiration?: number;
390
+ signal?: AbortSignal;
391
+ }): Promise<Parsed<z.infer<typeof CreateSnapshotResponse>>>;
392
+ deleteSnapshot(params: {
393
+ snapshotId: string;
394
+ signal?: AbortSignal;
395
+ }): Promise<Parsed<z.infer<typeof SnapshotResponse>>>;
396
+ getSnapshot(params: {
397
+ snapshotId: string;
398
+ signal?: AbortSignal;
399
+ }): Promise<Parsed<z.infer<typeof SnapshotResponse>>>;
400
+ }
401
+ //#endregion
402
+ export { APIClient, WithFetchOptions };
403
+ //# sourceMappingURL=api-client.d.cts.map