@agentuity/sandbox 3.0.12 → 3.1.1

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 (122) hide show
  1. package/AGENTS.md +3 -3
  2. package/dist/api-reference.d.ts +1221 -0
  3. package/dist/api-reference.d.ts.map +1 -0
  4. package/dist/api-reference.js +1046 -0
  5. package/dist/api-reference.js.map +1 -0
  6. package/dist/base64.d.ts +2 -0
  7. package/dist/base64.d.ts.map +1 -0
  8. package/dist/base64.js +14 -0
  9. package/dist/base64.js.map +1 -0
  10. package/dist/client.d.ts +431 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +632 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/create.d.ts +203 -0
  15. package/dist/create.d.ts.map +1 -0
  16. package/dist/create.js +235 -0
  17. package/dist/create.js.map +1 -0
  18. package/dist/destroy.d.ts +23 -0
  19. package/dist/destroy.d.ts.map +1 -0
  20. package/dist/destroy.js +30 -0
  21. package/dist/destroy.js.map +1 -0
  22. package/dist/disk-checkpoint.d.ts +108 -0
  23. package/dist/disk-checkpoint.d.ts.map +1 -0
  24. package/dist/disk-checkpoint.js +124 -0
  25. package/dist/disk-checkpoint.js.map +1 -0
  26. package/dist/events.d.ts +56 -0
  27. package/dist/events.d.ts.map +1 -0
  28. package/dist/events.js +54 -0
  29. package/dist/events.js.map +1 -0
  30. package/dist/execute.d.ts +99 -0
  31. package/dist/execute.d.ts.map +1 -0
  32. package/dist/execute.js +138 -0
  33. package/dist/execute.js.map +1 -0
  34. package/dist/execution.d.ts +150 -0
  35. package/dist/execution.d.ts.map +1 -0
  36. package/dist/execution.js +120 -0
  37. package/dist/execution.js.map +1 -0
  38. package/dist/files.d.ts +283 -0
  39. package/dist/files.d.ts.map +1 -0
  40. package/dist/files.js +471 -0
  41. package/dist/files.js.map +1 -0
  42. package/dist/get.d.ts +288 -0
  43. package/dist/get.d.ts.map +1 -0
  44. package/dist/get.js +256 -0
  45. package/dist/get.js.map +1 -0
  46. package/dist/getStatus.d.ts +23 -0
  47. package/dist/getStatus.d.ts.map +1 -0
  48. package/dist/getStatus.js +53 -0
  49. package/dist/getStatus.js.map +1 -0
  50. package/dist/index.d.ts +42 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +22 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/job.d.ts +227 -0
  55. package/dist/job.d.ts.map +1 -0
  56. package/dist/job.js +109 -0
  57. package/dist/job.js.map +1 -0
  58. package/dist/list.d.ts +330 -0
  59. package/dist/list.d.ts.map +1 -0
  60. package/dist/list.js +209 -0
  61. package/dist/list.js.map +1 -0
  62. package/dist/pause.d.ts +39 -0
  63. package/dist/pause.d.ts.map +1 -0
  64. package/dist/pause.js +48 -0
  65. package/dist/pause.js.map +1 -0
  66. package/dist/resolve.d.ts +75 -0
  67. package/dist/resolve.d.ts.map +1 -0
  68. package/dist/resolve.js +76 -0
  69. package/dist/resolve.js.map +1 -0
  70. package/dist/resume.d.ts +23 -0
  71. package/dist/resume.d.ts.map +1 -0
  72. package/dist/resume.js +30 -0
  73. package/dist/resume.js.map +1 -0
  74. package/dist/run.d.ts +73 -0
  75. package/dist/run.d.ts.map +1 -0
  76. package/dist/run.js +568 -0
  77. package/dist/run.js.map +1 -0
  78. package/dist/runtime.d.ts +94 -0
  79. package/dist/runtime.d.ts.map +1 -0
  80. package/dist/runtime.js +82 -0
  81. package/dist/runtime.js.map +1 -0
  82. package/dist/snapshot-build.d.ts +48 -0
  83. package/dist/snapshot-build.d.ts.map +1 -0
  84. package/dist/snapshot-build.js +72 -0
  85. package/dist/snapshot-build.js.map +1 -0
  86. package/dist/snapshot.d.ts +596 -0
  87. package/dist/snapshot.d.ts.map +1 -0
  88. package/dist/snapshot.js +612 -0
  89. package/dist/snapshot.js.map +1 -0
  90. package/dist/types.d.ts +1010 -0
  91. package/dist/types.d.ts.map +1 -0
  92. package/dist/types.js +853 -0
  93. package/dist/types.js.map +1 -0
  94. package/dist/util.d.ts +296 -0
  95. package/dist/util.d.ts.map +1 -0
  96. package/dist/util.js +234 -0
  97. package/dist/util.js.map +1 -0
  98. package/package.json +7 -2
  99. package/src/api-reference.ts +1094 -0
  100. package/src/base64.ts +14 -0
  101. package/src/client.ts +998 -0
  102. package/src/create.ts +273 -0
  103. package/src/destroy.ts +43 -0
  104. package/src/disk-checkpoint.ts +184 -0
  105. package/src/events.ts +72 -0
  106. package/src/execute.ts +167 -0
  107. package/src/execution.ts +152 -0
  108. package/src/files.ts +637 -0
  109. package/src/get.ts +291 -0
  110. package/src/getStatus.ts +72 -0
  111. package/src/index.ts +252 -18
  112. package/src/job.ts +161 -0
  113. package/src/list.ts +239 -0
  114. package/src/pause.ts +75 -0
  115. package/src/resolve.ts +96 -0
  116. package/src/resume.ts +41 -0
  117. package/src/run.ts +783 -0
  118. package/src/runtime.ts +106 -0
  119. package/src/snapshot-build.ts +94 -0
  120. package/src/snapshot.ts +791 -0
  121. package/src/types.ts +1033 -0
  122. package/src/util.ts +280 -0
@@ -0,0 +1,120 @@
1
+ import { ExecutionStatusSchema } from './types.js';
2
+ import { z } from 'zod';
3
+ import { APIResponseSchema } from '@agentuity/api';
4
+ import { throwSandboxError } from './util.js';
5
+ export const ExecutionInfoSchema = z
6
+ .object({
7
+ executionId: z.string().describe('Unique identifier for the execution'),
8
+ sandboxId: z.string().describe('ID of the sandbox where the execution ran'),
9
+ type: z
10
+ .string()
11
+ .optional()
12
+ .describe('Type of execution (e.g., exec, write_files, read_file)'),
13
+ status: ExecutionStatusSchema.describe('Current status of the execution'),
14
+ command: z.array(z.string()).optional().describe('Command that was executed'),
15
+ exitCode: z.number().optional().describe('Exit code of the executed command'),
16
+ durationMs: z.number().optional().describe('Execution duration in milliseconds'),
17
+ startedAt: z.string().optional().describe('ISO timestamp when execution started'),
18
+ completedAt: z.string().optional().describe('ISO timestamp when execution completed'),
19
+ error: z.string().optional().describe('Error message if execution failed'),
20
+ stdoutStreamUrl: z.string().optional().describe('URL to stream stdout output'),
21
+ stderrStreamUrl: z.string().optional().describe('URL to stream stderr output'),
22
+ outputTruncated: z
23
+ .boolean()
24
+ .optional()
25
+ .describe('Whether the captured output was truncated due to size limits'),
26
+ })
27
+ .describe('Detailed information about a command execution');
28
+ export const ExecutionGetResponseSchema = APIResponseSchema(ExecutionInfoSchema);
29
+ export const ExecutionListDataSchema = z
30
+ .object({
31
+ executions: z.array(ExecutionInfoSchema).describe('List of executions'),
32
+ })
33
+ .describe('List of executions for a sandbox');
34
+ export const ExecutionListResponseSchema = APIResponseSchema(ExecutionListDataSchema);
35
+ export const ExecutionGetParamsSchema = z.object({
36
+ executionId: z.string().describe('execution id'),
37
+ orgId: z.string().optional().describe('organization id'),
38
+ /** Optional wait duration for long-polling. */
39
+ wait: z.string().optional().describe('wait duration for long-polling'),
40
+ /** Optional AbortSignal to cancel the in-flight request. */
41
+ signal: z.custom().optional().describe('abort signal for cancellation'),
42
+ });
43
+ /**
44
+ * Retrieves detailed information about a specific execution.
45
+ *
46
+ * @param client - The API client to use for the request
47
+ * @param params - Parameters including the execution ID and optional wait duration
48
+ * @returns Detailed execution information including status, timing, and errors
49
+ * @throws {SandboxResponseError} If the execution is not found or request fails
50
+ *
51
+ * @example
52
+ * // Immediate return (current behavior)
53
+ * const info = await executionGet(client, { executionId: 'exec_123' });
54
+ *
55
+ * @example
56
+ * // Long-poll: wait up to 60 seconds for completion
57
+ * const info = await executionGet(client, { executionId: 'exec_123', wait: '60s' });
58
+ */
59
+ export async function executionGet(client, params) {
60
+ const { executionId, orgId, wait, signal } = params;
61
+ const queryParams = new URLSearchParams();
62
+ if (orgId) {
63
+ queryParams.set('orgId', orgId);
64
+ }
65
+ if (wait) {
66
+ queryParams.set('wait', wait);
67
+ }
68
+ const queryString = queryParams.toString();
69
+ const url = `/sandbox/execution/${executionId}${queryString ? `?${queryString}` : ''}`;
70
+ const resp = await client.get(url, ExecutionGetResponseSchema, signal);
71
+ if (resp.success) {
72
+ return {
73
+ executionId: resp.data.executionId,
74
+ sandboxId: resp.data.sandboxId,
75
+ type: resp.data.type,
76
+ status: resp.data.status,
77
+ command: resp.data.command,
78
+ exitCode: resp.data.exitCode,
79
+ durationMs: resp.data.durationMs,
80
+ startedAt: resp.data.startedAt,
81
+ completedAt: resp.data.completedAt,
82
+ error: resp.data.error,
83
+ stdoutStreamUrl: resp.data.stdoutStreamUrl,
84
+ stderrStreamUrl: resp.data.stderrStreamUrl,
85
+ outputTruncated: resp.data.outputTruncated,
86
+ };
87
+ }
88
+ throwSandboxError(resp, { executionId });
89
+ }
90
+ export const ExecutionListParamsSchema = z.object({
91
+ sandboxId: z.string().describe('sandbox id'),
92
+ orgId: z.string().optional().describe('organization id'),
93
+ limit: z.number().optional().describe('limit'),
94
+ });
95
+ /**
96
+ * Lists all executions for a specific sandbox.
97
+ *
98
+ * @param client - The API client to use for the request
99
+ * @param params - Parameters including the sandbox ID and optional limit
100
+ * @returns List of execution information for the sandbox
101
+ * @throws {SandboxResponseError} If the sandbox is not found or request fails
102
+ */
103
+ export async function executionList(client, params) {
104
+ const { sandboxId, orgId, limit } = params;
105
+ const queryParams = new URLSearchParams();
106
+ if (orgId) {
107
+ queryParams.set('orgId', orgId);
108
+ }
109
+ if (limit !== undefined) {
110
+ queryParams.set('limit', String(limit));
111
+ }
112
+ const queryString = queryParams.toString();
113
+ const url = `/sandbox/sandboxes/${sandboxId}/executions${queryString ? `?${queryString}` : ''}`;
114
+ const resp = await client.get(url, ExecutionListResponseSchema);
115
+ if (resp.success) {
116
+ return resp.data;
117
+ }
118
+ throwSandboxError(resp, { sandboxId });
119
+ }
120
+ //# sourceMappingURL=execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.js","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,iBAAi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,283 @@
1
+ import { z } from 'zod';
2
+ import { APIClient } from '@agentuity/api';
3
+ export declare const FileToWriteSchema: z.ZodObject<{
4
+ path: z.ZodString;
5
+ content: z.ZodString;
6
+ }, z.core.$strip>;
7
+ export declare const WriteFilesRequestSchema: z.ZodObject<{
8
+ files: z.ZodArray<z.ZodObject<{
9
+ path: z.ZodString;
10
+ content: z.ZodString;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>;
13
+ export declare const WriteFilesDataSchema: z.ZodObject<{
14
+ filesWritten: z.ZodNumber;
15
+ }, z.core.$strip>;
16
+ export declare const WriteFilesResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
17
+ success: z.ZodLiteral<false>;
18
+ message: z.ZodString;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ success: z.ZodLiteral<true>;
21
+ data: z.ZodOptional<z.ZodObject<{
22
+ filesWritten: z.ZodNumber;
23
+ }, z.core.$strip>>;
24
+ filesWritten: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strip>], "success">;
26
+ export declare const WriteFilesParamsSchema: z.ZodObject<{
27
+ sandboxId: z.ZodString;
28
+ files: z.ZodArray<z.ZodCustom<{
29
+ path: string;
30
+ content: Uint8Array<ArrayBuffer>;
31
+ }, {
32
+ path: string;
33
+ content: Uint8Array<ArrayBuffer>;
34
+ }>>;
35
+ orgId: z.ZodOptional<z.ZodString>;
36
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
37
+ }, z.core.$strip>;
38
+ export type WriteFilesParams = z.infer<typeof WriteFilesParamsSchema>;
39
+ export type WriteFilesResult = z.infer<typeof WriteFilesDataSchema>;
40
+ /**
41
+ * Writes files to a sandbox workspace.
42
+ *
43
+ * @param client - The API client to use for the request
44
+ * @param params - Parameters including sandbox ID and files to write
45
+ * @returns The result including number of files written
46
+ * @throws {SandboxResponseError} If the write request fails
47
+ */
48
+ export declare function sandboxWriteFiles(client: APIClient, params: WriteFilesParams): Promise<WriteFilesResult>;
49
+ export declare const ReadFileParamsSchema: z.ZodObject<{
50
+ sandboxId: z.ZodString;
51
+ path: z.ZodString;
52
+ orgId: z.ZodOptional<z.ZodString>;
53
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
54
+ }, z.core.$strip>;
55
+ export type ReadFileParams = z.infer<typeof ReadFileParamsSchema>;
56
+ /**
57
+ * Reads a file from a sandbox workspace.
58
+ *
59
+ * @param client - The API client to use for the request
60
+ * @param params - Parameters including sandbox ID and file path
61
+ * @returns A ReadableStream of the file contents
62
+ * @throws {SandboxResponseError} If the read request fails
63
+ */
64
+ export declare function sandboxReadFile(client: APIClient, params: ReadFileParams): Promise<ReadableStream<Uint8Array>>;
65
+ export declare const MkDirRequestSchema: z.ZodObject<{
66
+ path: z.ZodString;
67
+ recursive: z.ZodOptional<z.ZodBoolean>;
68
+ }, z.core.$strip>;
69
+ export declare const MkDirResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
70
+ success: z.ZodLiteral<false>;
71
+ message: z.ZodString;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ success: z.ZodLiteral<true>;
74
+ }, z.core.$strip>], "success">;
75
+ export declare const MkDirParamsSchema: z.ZodObject<{
76
+ sandboxId: z.ZodString;
77
+ path: z.ZodString;
78
+ recursive: z.ZodOptional<z.ZodBoolean>;
79
+ orgId: z.ZodOptional<z.ZodString>;
80
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
81
+ }, z.core.$strip>;
82
+ export type MkDirParams = z.infer<typeof MkDirParamsSchema>;
83
+ /**
84
+ * Creates a directory in a sandbox workspace.
85
+ *
86
+ * @param client - The API client to use for the request
87
+ * @param params - Parameters including sandbox ID, path, and recursive flag
88
+ * @throws {SandboxResponseError} If the mkdir request fails
89
+ */
90
+ export declare function sandboxMkDir(client: APIClient, params: MkDirParams): Promise<void>;
91
+ export declare const RmDirRequestSchema: z.ZodObject<{
92
+ path: z.ZodString;
93
+ recursive: z.ZodOptional<z.ZodBoolean>;
94
+ }, z.core.$strip>;
95
+ export declare const RmDirResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
96
+ success: z.ZodLiteral<false>;
97
+ message: z.ZodString;
98
+ }, z.core.$strip>, z.ZodObject<{
99
+ success: z.ZodLiteral<true>;
100
+ found: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
101
+ }, z.core.$strip>], "success">;
102
+ export declare const RmDirParamsSchema: z.ZodObject<{
103
+ sandboxId: z.ZodString;
104
+ path: z.ZodString;
105
+ recursive: z.ZodOptional<z.ZodBoolean>;
106
+ orgId: z.ZodOptional<z.ZodString>;
107
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
108
+ }, z.core.$strip>;
109
+ export type RmDirParams = z.infer<typeof RmDirParamsSchema>;
110
+ /**
111
+ * Removes a directory from a sandbox workspace.
112
+ *
113
+ * @param client - The API client to use for the request
114
+ * @param params - Parameters including sandbox ID, path, and recursive flag
115
+ * @returns Object with `found` indicating whether the directory existed before removal
116
+ * @throws {SandboxResponseError} If the rmdir request fails
117
+ */
118
+ export declare function sandboxRmDir(client: APIClient, params: RmDirParams): Promise<{
119
+ found: boolean;
120
+ }>;
121
+ export declare const RmFileRequestSchema: z.ZodObject<{
122
+ path: z.ZodString;
123
+ }, z.core.$strip>;
124
+ export declare const RmFileResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
125
+ success: z.ZodLiteral<false>;
126
+ message: z.ZodString;
127
+ }, z.core.$strip>, z.ZodObject<{
128
+ success: z.ZodLiteral<true>;
129
+ found: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
130
+ }, z.core.$strip>], "success">;
131
+ export declare const RmFileParamsSchema: z.ZodObject<{
132
+ sandboxId: z.ZodString;
133
+ path: z.ZodString;
134
+ orgId: z.ZodOptional<z.ZodString>;
135
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
136
+ }, z.core.$strip>;
137
+ export type RmFileParams = z.infer<typeof RmFileParamsSchema>;
138
+ /**
139
+ * Removes a file from a sandbox workspace.
140
+ *
141
+ * @param client - The API client to use for the request
142
+ * @param params - Parameters including sandbox ID and path
143
+ * @returns Object with `found` indicating whether the file existed before removal
144
+ * @throws {SandboxResponseError} If the rm request fails
145
+ */
146
+ export declare function sandboxRmFile(client: APIClient, params: RmFileParams): Promise<{
147
+ found: boolean;
148
+ }>;
149
+ export declare const FileInfoSchema: z.ZodObject<{
150
+ path: z.ZodString;
151
+ size: z.ZodNumber;
152
+ isDir: z.ZodBoolean;
153
+ isSymlink: z.ZodOptional<z.ZodBoolean>;
154
+ linkTarget: z.ZodOptional<z.ZodString>;
155
+ mode: z.ZodString;
156
+ modTime: z.ZodString;
157
+ }, z.core.$strip>;
158
+ export declare const ListFilesDataSchema: z.ZodObject<{
159
+ files: z.ZodArray<z.ZodObject<{
160
+ path: z.ZodString;
161
+ size: z.ZodNumber;
162
+ isDir: z.ZodBoolean;
163
+ isSymlink: z.ZodOptional<z.ZodBoolean>;
164
+ linkTarget: z.ZodOptional<z.ZodString>;
165
+ mode: z.ZodString;
166
+ modTime: z.ZodString;
167
+ }, z.core.$strip>>;
168
+ }, z.core.$strip>;
169
+ export declare const ListFilesResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
170
+ success: z.ZodLiteral<false>;
171
+ message: z.ZodString;
172
+ }, z.core.$strip>, z.ZodObject<{
173
+ success: z.ZodLiteral<true>;
174
+ data: z.ZodObject<{
175
+ files: z.ZodArray<z.ZodObject<{
176
+ path: z.ZodString;
177
+ size: z.ZodNumber;
178
+ isDir: z.ZodBoolean;
179
+ isSymlink: z.ZodOptional<z.ZodBoolean>;
180
+ linkTarget: z.ZodOptional<z.ZodString>;
181
+ mode: z.ZodString;
182
+ modTime: z.ZodString;
183
+ }, z.core.$strip>>;
184
+ }, z.core.$strip>;
185
+ }, z.core.$strip>], "success">;
186
+ export type FileInfo = z.infer<typeof FileInfoSchema>;
187
+ export declare const ListFilesParamsSchema: z.ZodObject<{
188
+ sandboxId: z.ZodString;
189
+ path: z.ZodOptional<z.ZodString>;
190
+ orgId: z.ZodOptional<z.ZodString>;
191
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
192
+ }, z.core.$strip>;
193
+ export type ListFilesParams = z.infer<typeof ListFilesParamsSchema>;
194
+ export type ListFilesResult = z.infer<typeof ListFilesDataSchema>;
195
+ /**
196
+ * Lists files in a sandbox workspace directory.
197
+ *
198
+ * @param client - The API client to use for the request
199
+ * @param params - Parameters including sandbox ID and optional path
200
+ * @returns The list of files and directories
201
+ * @throws {SandboxResponseError} If the list request fails
202
+ */
203
+ export declare function sandboxListFiles(client: APIClient, params: ListFilesParams): Promise<ListFilesResult>;
204
+ export type ArchiveFormat = 'zip' | 'tar.gz';
205
+ export declare const DownloadArchiveParamsSchema: z.ZodObject<{
206
+ sandboxId: z.ZodString;
207
+ path: z.ZodOptional<z.ZodString>;
208
+ format: z.ZodOptional<z.ZodEnum<{
209
+ "tar.gz": "tar.gz";
210
+ zip: "zip";
211
+ }>>;
212
+ orgId: z.ZodOptional<z.ZodString>;
213
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
214
+ }, z.core.$strip>;
215
+ export type DownloadArchiveParams = z.infer<typeof DownloadArchiveParamsSchema>;
216
+ /**
217
+ * Downloads files from a sandbox as a compressed archive.
218
+ *
219
+ * @param client - The API client to use for the request
220
+ * @param params - Parameters including sandbox ID, path, and format
221
+ * @returns A ReadableStream of the archive contents
222
+ * @throws {SandboxResponseError} If the download request fails
223
+ */
224
+ export declare function sandboxDownloadArchive(client: APIClient, params: DownloadArchiveParams): Promise<ReadableStream<Uint8Array>>;
225
+ export declare const UploadArchiveParamsSchema: z.ZodObject<{
226
+ sandboxId: z.ZodString;
227
+ archive: z.ZodUnion<readonly [z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<ReadableStream<Uint8Array<ArrayBufferLike>>, ReadableStream<Uint8Array<ArrayBufferLike>>>]>;
228
+ path: z.ZodOptional<z.ZodString>;
229
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
230
+ "tar.gz": "tar.gz";
231
+ zip: "zip";
232
+ }>, z.ZodLiteral<"">]>>;
233
+ orgId: z.ZodOptional<z.ZodString>;
234
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
235
+ }, z.core.$strip>;
236
+ export type UploadArchiveParams = z.infer<typeof UploadArchiveParamsSchema>;
237
+ export declare const UploadArchiveResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
238
+ success: z.ZodLiteral<false>;
239
+ message: z.ZodString;
240
+ }, z.core.$strip>, z.ZodObject<{
241
+ success: z.ZodLiteral<true>;
242
+ }, z.core.$strip>], "success">;
243
+ /**
244
+ * Uploads a compressed archive to a sandbox and extracts it.
245
+ *
246
+ * @param client - The API client to use for the request
247
+ * @param params - Parameters including sandbox ID, archive data, path, and optional format
248
+ * @throws {SandboxResponseError} If the upload request fails
249
+ */
250
+ export declare function sandboxUploadArchive(client: APIClient, params: UploadArchiveParams): Promise<void>;
251
+ export declare const SetEnvRequestSchema: z.ZodObject<{
252
+ env: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
253
+ }, z.core.$strip>;
254
+ export declare const SetEnvDataSchema: z.ZodObject<{
255
+ env: z.ZodRecord<z.ZodString, z.ZodString>;
256
+ }, z.core.$strip>;
257
+ export declare const SetEnvResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
258
+ success: z.ZodLiteral<false>;
259
+ message: z.ZodString;
260
+ }, z.core.$strip>, z.ZodObject<{
261
+ success: z.ZodLiteral<true>;
262
+ data: z.ZodObject<{
263
+ env: z.ZodRecord<z.ZodString, z.ZodString>;
264
+ }, z.core.$strip>;
265
+ }, z.core.$strip>], "success">;
266
+ export declare const SetEnvParamsSchema: z.ZodObject<{
267
+ sandboxId: z.ZodString;
268
+ env: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
269
+ orgId: z.ZodOptional<z.ZodString>;
270
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
271
+ }, z.core.$strip>;
272
+ export type SetEnvParams = z.infer<typeof SetEnvParamsSchema>;
273
+ export type SetEnvResult = z.infer<typeof SetEnvDataSchema>;
274
+ /**
275
+ * Sets environment variables on a sandbox. Pass null to delete a variable.
276
+ *
277
+ * @param client - The API client to use for the request
278
+ * @param params - Parameters including sandbox ID and env key/value pairs
279
+ * @returns The current environment variables after the update
280
+ * @throws {SandboxResponseError} If the request fails
281
+ */
282
+ export declare function sandboxSetEnv(client: APIClient, params: SetEnvParams): Promise<SetEnvResult>;
283
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;iBAIqB,CAAC;AAE1D,eAAO,MAAM,oBAAoB;;iBAIa,CAAC;AAE/C,eAAO,MAAM,wBAAwB;;;;;;;;;8BAUnC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAKjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEpE;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACtC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAgC3B;AAED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