@fabrika/provider-zerops 0.9.0-dev.7 → 0.9.0-dev.9
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/package.json +11 -10
- package/sandbox/Dockerfile +16 -0
- package/sandbox/bin/postgres-auth.sh +38 -0
- package/sandbox/bin/reset.sh +12 -0
- package/sandbox/bin/run-build.sh +35 -0
- package/sandbox/bin/run-launcher.sh +18 -0
- package/sandbox/bin/start-launcher.sh +25 -0
- package/sandbox/bin/stop.sh +47 -0
- package/sandbox/init.sh +61 -0
- package/src/api/client.ts +3 -1
- package/src/api/errors.ts +7 -3
- package/src/control.ts +150 -35
- package/src/execution.ts +12 -77
- package/src/installation/topology/setups.ts +3 -1
- package/src/installation/topology/topology.ts +1 -1
- package/src/manifest.ts +2 -7
- package/src/namespace/claims.ts +4 -0
- package/src/namespace/codec.ts +17 -0
- package/src/namespace/errors.ts +24 -0
- package/src/namespace/manifest.ts +31 -5
- package/src/namespace/provisioning.ts +68 -112
- package/src/namespace/proxy-reads.ts +16 -1
- package/src/namespace/proxy-secrets.ts +18 -5
- package/src/namespace/sandbox-host.ts +236 -0
- package/src/namespace/subdomain.ts +113 -0
- package/src/namespace/topology.ts +1 -1
- package/src/namespace/types.ts +11 -0
- package/src/namespace/update.ts +1 -0
- package/src/provider.ts +0 -40
- package/src/proxy-manifest-carrier.ts +21 -7
- package/src/sandbox/base-image.ts +100 -0
- package/src/sandbox/constants.ts +43 -0
- package/src/sandbox/deploy.ts +471 -0
- package/src/sandbox/dev-artifact.ts +206 -0
- package/src/sandbox/lifecycle.ts +200 -0
- package/src/sandbox/scripts.ts +26 -0
- package/src/sandbox-host.ts +31 -0
- package/src/source/port.ts +5 -0
- package/src/zbox/client.ts +267 -0
- package/src/zbox/errors.ts +45 -0
- package/src/zbox/index.ts +23 -0
- package/src/zbox/types.ts +168 -0
- package/types/src/api/errors.d.ts +3 -1
- package/types/src/control.d.ts +12 -1
- package/types/src/execution.d.ts +2 -13
- package/types/src/installation/topology/topology.d.ts +1 -1
- package/types/src/manifest.d.ts +3 -8
- package/types/src/namespace/codec.d.ts +18 -0
- package/types/src/namespace/errors.d.ts +12 -0
- package/types/src/namespace/proxy-reads.d.ts +6 -1
- package/types/src/namespace/proxy-secrets.d.ts +1 -1
- package/types/src/namespace/sandbox-host.d.ts +23 -0
- package/types/src/namespace/subdomain.d.ts +43 -0
- package/types/src/namespace/types.d.ts +10 -0
- package/types/src/provider.d.ts +0 -3
- package/types/src/proxy-manifest-carrier.d.ts +8 -1
- package/types/src/sandbox/base-image.d.ts +28 -0
- package/types/src/sandbox/constants.d.ts +29 -0
- package/types/src/sandbox/deploy.d.ts +75 -0
- package/types/src/sandbox/dev-artifact.d.ts +51 -0
- package/types/src/sandbox/lifecycle.d.ts +27 -0
- package/types/src/sandbox/scripts.d.ts +11 -0
- package/types/src/sandbox-host.d.ts +18 -0
- package/types/src/source/port.d.ts +5 -0
- package/types/src/zbox/client.d.ts +2 -0
- package/types/src/zbox/errors.d.ts +25 -0
- package/types/src/zbox/index.d.ts +3 -0
- package/types/src/zbox/types.d.ts +462 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const zboxOperationSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
sandboxId: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
5
|
+
kind: z.ZodString;
|
|
6
|
+
status: z.ZodEnum<["PENDING", "RUNNING", "FINISHED", "FAILED"]>;
|
|
7
|
+
error: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
kind: string;
|
|
10
|
+
status: "FINISHED" | "FAILED" | "PENDING" | "RUNNING";
|
|
11
|
+
id: string;
|
|
12
|
+
error: string | null;
|
|
13
|
+
sandboxId: string | null;
|
|
14
|
+
}, {
|
|
15
|
+
kind: string;
|
|
16
|
+
status: "FINISHED" | "FAILED" | "PENDING" | "RUNNING";
|
|
17
|
+
id: string;
|
|
18
|
+
error?: string | null | undefined;
|
|
19
|
+
sandboxId?: string | null | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export type ZboxOperation = z.infer<typeof zboxOperationSchema>;
|
|
22
|
+
export declare const zboxSandboxSchema: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
name: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
25
|
+
status: z.ZodEnum<["CREATING", "RUNNING", "PARKING", "PARKED", "WAKING", "FORKING", "RESTORING", "FAILED", "TERMINATED", "ARCHIVED"]>;
|
|
26
|
+
baseDigest: z.ZodString;
|
|
27
|
+
hosts: z.ZodArray<z.ZodObject<{
|
|
28
|
+
port: z.ZodNumber;
|
|
29
|
+
access: z.ZodString;
|
|
30
|
+
url: z.ZodString;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
access: string;
|
|
33
|
+
url: string;
|
|
34
|
+
port: number;
|
|
35
|
+
}, {
|
|
36
|
+
access: string;
|
|
37
|
+
url: string;
|
|
38
|
+
port: number;
|
|
39
|
+
}>, "many">;
|
|
40
|
+
policyGeneration: z.ZodNumber;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
name: string | null;
|
|
43
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
44
|
+
id: string;
|
|
45
|
+
hosts: {
|
|
46
|
+
access: string;
|
|
47
|
+
url: string;
|
|
48
|
+
port: number;
|
|
49
|
+
}[];
|
|
50
|
+
baseDigest: string;
|
|
51
|
+
policyGeneration: number;
|
|
52
|
+
}, {
|
|
53
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
54
|
+
id: string;
|
|
55
|
+
hosts: {
|
|
56
|
+
access: string;
|
|
57
|
+
url: string;
|
|
58
|
+
port: number;
|
|
59
|
+
}[];
|
|
60
|
+
baseDigest: string;
|
|
61
|
+
policyGeneration: number;
|
|
62
|
+
name?: string | null | undefined;
|
|
63
|
+
}>;
|
|
64
|
+
export type ZboxSandbox = z.infer<typeof zboxSandboxSchema>;
|
|
65
|
+
export declare const zboxSandboxListSchema: z.ZodObject<{
|
|
66
|
+
items: z.ZodArray<z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
name: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
69
|
+
status: z.ZodEnum<["CREATING", "RUNNING", "PARKING", "PARKED", "WAKING", "FORKING", "RESTORING", "FAILED", "TERMINATED", "ARCHIVED"]>;
|
|
70
|
+
baseDigest: z.ZodString;
|
|
71
|
+
hosts: z.ZodArray<z.ZodObject<{
|
|
72
|
+
port: z.ZodNumber;
|
|
73
|
+
access: z.ZodString;
|
|
74
|
+
url: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
access: string;
|
|
77
|
+
url: string;
|
|
78
|
+
port: number;
|
|
79
|
+
}, {
|
|
80
|
+
access: string;
|
|
81
|
+
url: string;
|
|
82
|
+
port: number;
|
|
83
|
+
}>, "many">;
|
|
84
|
+
policyGeneration: z.ZodNumber;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
name: string | null;
|
|
87
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
88
|
+
id: string;
|
|
89
|
+
hosts: {
|
|
90
|
+
access: string;
|
|
91
|
+
url: string;
|
|
92
|
+
port: number;
|
|
93
|
+
}[];
|
|
94
|
+
baseDigest: string;
|
|
95
|
+
policyGeneration: number;
|
|
96
|
+
}, {
|
|
97
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
98
|
+
id: string;
|
|
99
|
+
hosts: {
|
|
100
|
+
access: string;
|
|
101
|
+
url: string;
|
|
102
|
+
port: number;
|
|
103
|
+
}[];
|
|
104
|
+
baseDigest: string;
|
|
105
|
+
policyGeneration: number;
|
|
106
|
+
name?: string | null | undefined;
|
|
107
|
+
}>, "many">;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
items: {
|
|
110
|
+
name: string | null;
|
|
111
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
112
|
+
id: string;
|
|
113
|
+
hosts: {
|
|
114
|
+
access: string;
|
|
115
|
+
url: string;
|
|
116
|
+
port: number;
|
|
117
|
+
}[];
|
|
118
|
+
baseDigest: string;
|
|
119
|
+
policyGeneration: number;
|
|
120
|
+
}[];
|
|
121
|
+
}, {
|
|
122
|
+
items: {
|
|
123
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
124
|
+
id: string;
|
|
125
|
+
hosts: {
|
|
126
|
+
access: string;
|
|
127
|
+
url: string;
|
|
128
|
+
port: number;
|
|
129
|
+
}[];
|
|
130
|
+
baseDigest: string;
|
|
131
|
+
policyGeneration: number;
|
|
132
|
+
name?: string | null | undefined;
|
|
133
|
+
}[];
|
|
134
|
+
}>;
|
|
135
|
+
export declare const zboxSpawnSchema: z.ZodObject<{
|
|
136
|
+
operation: z.ZodObject<{
|
|
137
|
+
id: z.ZodString;
|
|
138
|
+
sandboxId: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
139
|
+
kind: z.ZodString;
|
|
140
|
+
status: z.ZodEnum<["PENDING", "RUNNING", "FINISHED", "FAILED"]>;
|
|
141
|
+
error: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
kind: string;
|
|
144
|
+
status: "FINISHED" | "FAILED" | "PENDING" | "RUNNING";
|
|
145
|
+
id: string;
|
|
146
|
+
error: string | null;
|
|
147
|
+
sandboxId: string | null;
|
|
148
|
+
}, {
|
|
149
|
+
kind: string;
|
|
150
|
+
status: "FINISHED" | "FAILED" | "PENDING" | "RUNNING";
|
|
151
|
+
id: string;
|
|
152
|
+
error?: string | null | undefined;
|
|
153
|
+
sandboxId?: string | null | undefined;
|
|
154
|
+
}>;
|
|
155
|
+
sandboxes: z.ZodArray<z.ZodObject<{
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
name: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
158
|
+
status: z.ZodEnum<["CREATING", "RUNNING", "PARKING", "PARKED", "WAKING", "FORKING", "RESTORING", "FAILED", "TERMINATED", "ARCHIVED"]>;
|
|
159
|
+
baseDigest: z.ZodString;
|
|
160
|
+
hosts: z.ZodArray<z.ZodObject<{
|
|
161
|
+
port: z.ZodNumber;
|
|
162
|
+
access: z.ZodString;
|
|
163
|
+
url: z.ZodString;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
access: string;
|
|
166
|
+
url: string;
|
|
167
|
+
port: number;
|
|
168
|
+
}, {
|
|
169
|
+
access: string;
|
|
170
|
+
url: string;
|
|
171
|
+
port: number;
|
|
172
|
+
}>, "many">;
|
|
173
|
+
policyGeneration: z.ZodNumber;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
name: string | null;
|
|
176
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
177
|
+
id: string;
|
|
178
|
+
hosts: {
|
|
179
|
+
access: string;
|
|
180
|
+
url: string;
|
|
181
|
+
port: number;
|
|
182
|
+
}[];
|
|
183
|
+
baseDigest: string;
|
|
184
|
+
policyGeneration: number;
|
|
185
|
+
}, {
|
|
186
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
187
|
+
id: string;
|
|
188
|
+
hosts: {
|
|
189
|
+
access: string;
|
|
190
|
+
url: string;
|
|
191
|
+
port: number;
|
|
192
|
+
}[];
|
|
193
|
+
baseDigest: string;
|
|
194
|
+
policyGeneration: number;
|
|
195
|
+
name?: string | null | undefined;
|
|
196
|
+
}>, "many">;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
operation: {
|
|
199
|
+
kind: string;
|
|
200
|
+
status: "FINISHED" | "FAILED" | "PENDING" | "RUNNING";
|
|
201
|
+
id: string;
|
|
202
|
+
error: string | null;
|
|
203
|
+
sandboxId: string | null;
|
|
204
|
+
};
|
|
205
|
+
sandboxes: {
|
|
206
|
+
name: string | null;
|
|
207
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
208
|
+
id: string;
|
|
209
|
+
hosts: {
|
|
210
|
+
access: string;
|
|
211
|
+
url: string;
|
|
212
|
+
port: number;
|
|
213
|
+
}[];
|
|
214
|
+
baseDigest: string;
|
|
215
|
+
policyGeneration: number;
|
|
216
|
+
}[];
|
|
217
|
+
}, {
|
|
218
|
+
operation: {
|
|
219
|
+
kind: string;
|
|
220
|
+
status: "FINISHED" | "FAILED" | "PENDING" | "RUNNING";
|
|
221
|
+
id: string;
|
|
222
|
+
error?: string | null | undefined;
|
|
223
|
+
sandboxId?: string | null | undefined;
|
|
224
|
+
};
|
|
225
|
+
sandboxes: {
|
|
226
|
+
status: "FAILED" | "CREATING" | "RUNNING" | "PARKING" | "PARKED" | "WAKING" | "FORKING" | "RESTORING" | "TERMINATED" | "ARCHIVED";
|
|
227
|
+
id: string;
|
|
228
|
+
hosts: {
|
|
229
|
+
access: string;
|
|
230
|
+
url: string;
|
|
231
|
+
port: number;
|
|
232
|
+
}[];
|
|
233
|
+
baseDigest: string;
|
|
234
|
+
policyGeneration: number;
|
|
235
|
+
name?: string | null | undefined;
|
|
236
|
+
}[];
|
|
237
|
+
}>;
|
|
238
|
+
declare const zboxDomainSchema: z.ZodObject<{
|
|
239
|
+
domain: z.ZodString;
|
|
240
|
+
form: z.ZodEnum<["DASH", "DOT"]>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
form: "DASH" | "DOT";
|
|
243
|
+
domain: string;
|
|
244
|
+
}, {
|
|
245
|
+
form: "DASH" | "DOT";
|
|
246
|
+
domain: string;
|
|
247
|
+
}>;
|
|
248
|
+
export type ZboxDomain = z.infer<typeof zboxDomainSchema>;
|
|
249
|
+
export declare const zboxWorkspaceSchema: z.ZodObject<{
|
|
250
|
+
version: z.ZodString;
|
|
251
|
+
domains: z.ZodArray<z.ZodObject<{
|
|
252
|
+
domain: z.ZodString;
|
|
253
|
+
form: z.ZodEnum<["DASH", "DOT"]>;
|
|
254
|
+
}, "strip", z.ZodTypeAny, {
|
|
255
|
+
form: "DASH" | "DOT";
|
|
256
|
+
domain: string;
|
|
257
|
+
}, {
|
|
258
|
+
form: "DASH" | "DOT";
|
|
259
|
+
domain: string;
|
|
260
|
+
}>, "many">;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
version: string;
|
|
263
|
+
domains: {
|
|
264
|
+
form: "DASH" | "DOT";
|
|
265
|
+
domain: string;
|
|
266
|
+
}[];
|
|
267
|
+
}, {
|
|
268
|
+
version: string;
|
|
269
|
+
domains: {
|
|
270
|
+
form: "DASH" | "DOT";
|
|
271
|
+
domain: string;
|
|
272
|
+
}[];
|
|
273
|
+
}>;
|
|
274
|
+
export type ZboxWorkspace = z.infer<typeof zboxWorkspaceSchema>;
|
|
275
|
+
export declare const zboxBaseSchema: z.ZodObject<{
|
|
276
|
+
digest: z.ZodString;
|
|
277
|
+
name: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
278
|
+
imageRef: z.ZodString;
|
|
279
|
+
status: z.ZodEnum<["PULLING", "FLATTENING", "READY", "FAILED", "DELETED"]>;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
name: string | null;
|
|
282
|
+
status: "FAILED" | "DELETED" | "PULLING" | "FLATTENING" | "READY";
|
|
283
|
+
digest: string;
|
|
284
|
+
imageRef: string;
|
|
285
|
+
}, {
|
|
286
|
+
status: "FAILED" | "DELETED" | "PULLING" | "FLATTENING" | "READY";
|
|
287
|
+
digest: string;
|
|
288
|
+
imageRef: string;
|
|
289
|
+
name?: string | null | undefined;
|
|
290
|
+
}>;
|
|
291
|
+
export type ZboxBase = z.infer<typeof zboxBaseSchema>;
|
|
292
|
+
export declare const zboxBaseListSchema: z.ZodObject<{
|
|
293
|
+
items: z.ZodArray<z.ZodObject<{
|
|
294
|
+
digest: z.ZodString;
|
|
295
|
+
name: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
|
|
296
|
+
imageRef: z.ZodString;
|
|
297
|
+
status: z.ZodEnum<["PULLING", "FLATTENING", "READY", "FAILED", "DELETED"]>;
|
|
298
|
+
}, "strip", z.ZodTypeAny, {
|
|
299
|
+
name: string | null;
|
|
300
|
+
status: "FAILED" | "DELETED" | "PULLING" | "FLATTENING" | "READY";
|
|
301
|
+
digest: string;
|
|
302
|
+
imageRef: string;
|
|
303
|
+
}, {
|
|
304
|
+
status: "FAILED" | "DELETED" | "PULLING" | "FLATTENING" | "READY";
|
|
305
|
+
digest: string;
|
|
306
|
+
imageRef: string;
|
|
307
|
+
name?: string | null | undefined;
|
|
308
|
+
}>, "many">;
|
|
309
|
+
}, "strip", z.ZodTypeAny, {
|
|
310
|
+
items: {
|
|
311
|
+
name: string | null;
|
|
312
|
+
status: "FAILED" | "DELETED" | "PULLING" | "FLATTENING" | "READY";
|
|
313
|
+
digest: string;
|
|
314
|
+
imageRef: string;
|
|
315
|
+
}[];
|
|
316
|
+
}, {
|
|
317
|
+
items: {
|
|
318
|
+
status: "FAILED" | "DELETED" | "PULLING" | "FLATTENING" | "READY";
|
|
319
|
+
digest: string;
|
|
320
|
+
imageRef: string;
|
|
321
|
+
name?: string | null | undefined;
|
|
322
|
+
}[];
|
|
323
|
+
}>;
|
|
324
|
+
export declare const zboxExecResultSchema: z.ZodObject<{
|
|
325
|
+
stdout: z.ZodString;
|
|
326
|
+
stderr: z.ZodString;
|
|
327
|
+
exitCode: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null, number | null | undefined>;
|
|
328
|
+
timedOut: z.ZodBoolean;
|
|
329
|
+
stdoutTruncated: z.ZodBoolean;
|
|
330
|
+
stderrTruncated: z.ZodBoolean;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
stdout: string;
|
|
333
|
+
stderr: string;
|
|
334
|
+
exitCode: number | null;
|
|
335
|
+
timedOut: boolean;
|
|
336
|
+
stdoutTruncated: boolean;
|
|
337
|
+
stderrTruncated: boolean;
|
|
338
|
+
}, {
|
|
339
|
+
stdout: string;
|
|
340
|
+
stderr: string;
|
|
341
|
+
timedOut: boolean;
|
|
342
|
+
stdoutTruncated: boolean;
|
|
343
|
+
stderrTruncated: boolean;
|
|
344
|
+
exitCode?: number | null | undefined;
|
|
345
|
+
}>;
|
|
346
|
+
export type ZboxExecResult = z.infer<typeof zboxExecResultSchema>;
|
|
347
|
+
export declare const zboxSessionSchema: z.ZodObject<{
|
|
348
|
+
id: z.ZodString;
|
|
349
|
+
status: z.ZodEnum<["OPEN", "CLOSED", "FAILED"]>;
|
|
350
|
+
exitCode: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null, number | null | undefined>;
|
|
351
|
+
hasOutput: z.ZodBoolean;
|
|
352
|
+
}, "strip", z.ZodTypeAny, {
|
|
353
|
+
status: "FAILED" | "OPEN" | "CLOSED";
|
|
354
|
+
id: string;
|
|
355
|
+
exitCode: number | null;
|
|
356
|
+
hasOutput: boolean;
|
|
357
|
+
}, {
|
|
358
|
+
status: "FAILED" | "OPEN" | "CLOSED";
|
|
359
|
+
id: string;
|
|
360
|
+
hasOutput: boolean;
|
|
361
|
+
exitCode?: number | null | undefined;
|
|
362
|
+
}>;
|
|
363
|
+
export type ZboxSession = z.infer<typeof zboxSessionSchema>;
|
|
364
|
+
export declare const zboxSuccessSchema: z.ZodObject<{
|
|
365
|
+
success: z.ZodLiteral<true>;
|
|
366
|
+
}, "strip", z.ZodTypeAny, {
|
|
367
|
+
success: true;
|
|
368
|
+
}, {
|
|
369
|
+
success: true;
|
|
370
|
+
}>;
|
|
371
|
+
export type ZboxNetworkMode = 'AIRGAPPED' | 'PROJECT' | 'INTERNET' | 'PROJECT_INTERNET';
|
|
372
|
+
export type ZboxPortAccess = 'PROJECT' | 'MEMBERS' | 'TICKET' | 'TOKEN' | 'PUBLIC';
|
|
373
|
+
export interface ZboxIngressPort {
|
|
374
|
+
port: number;
|
|
375
|
+
access: ZboxPortAccess;
|
|
376
|
+
wakeOnRequest: boolean;
|
|
377
|
+
}
|
|
378
|
+
/** No `env`: Box echoes launch env in its answers, so credentials reach a sandbox only through the file API. */
|
|
379
|
+
export interface ZboxLaunch {
|
|
380
|
+
entrypoint?: string[];
|
|
381
|
+
cmd?: string[];
|
|
382
|
+
workingDir?: string;
|
|
383
|
+
}
|
|
384
|
+
export interface ZboxCreateSandboxInput {
|
|
385
|
+
name: string;
|
|
386
|
+
baseDigest: string;
|
|
387
|
+
cpus: number;
|
|
388
|
+
memoryBytes: number;
|
|
389
|
+
networkMode: ZboxNetworkMode;
|
|
390
|
+
launch: ZboxLaunch;
|
|
391
|
+
ports: ZboxIngressPort[];
|
|
392
|
+
/** Reused on a retry so Box answers the first create instead of making a second sandbox. */
|
|
393
|
+
idempotencyKey: string;
|
|
394
|
+
}
|
|
395
|
+
/** No `env`, for the same reason as `ZboxLaunch`. */
|
|
396
|
+
export interface ZboxExecInput {
|
|
397
|
+
command: string[];
|
|
398
|
+
workingDir?: string;
|
|
399
|
+
timeoutSeconds?: number;
|
|
400
|
+
}
|
|
401
|
+
export interface ZboxProcessInput {
|
|
402
|
+
command: string[];
|
|
403
|
+
workingDir?: string;
|
|
404
|
+
}
|
|
405
|
+
export type ZboxBody = Uint8Array<ArrayBuffer> | ReadableStream<Uint8Array>;
|
|
406
|
+
export type ZboxFetch = (input: string, init: {
|
|
407
|
+
method: string;
|
|
408
|
+
headers: Record<string, string>;
|
|
409
|
+
body?: string | ZboxBody;
|
|
410
|
+
signal: AbortSignal;
|
|
411
|
+
}) => Promise<Response>;
|
|
412
|
+
export interface ZboxClientOptions {
|
|
413
|
+
/** The API origin; requests go to `<baseUrl>/api/rest/…`. */
|
|
414
|
+
baseUrl: string;
|
|
415
|
+
/** The Workspace API key, sent as `Authorization: Bearer`. Never logged. */
|
|
416
|
+
apiKey: string;
|
|
417
|
+
fetch?: ZboxFetch;
|
|
418
|
+
/** Generates the `Idempotency-Key` of a call whose caller supplied none. */
|
|
419
|
+
idempotencyKey?: () => string;
|
|
420
|
+
}
|
|
421
|
+
export interface ZboxAwaitOptions {
|
|
422
|
+
signal?: AbortSignal;
|
|
423
|
+
/** Milliseconds from now after which waiting gives up. */
|
|
424
|
+
deadlineMs: number;
|
|
425
|
+
}
|
|
426
|
+
export interface ZboxClient {
|
|
427
|
+
getWorkspace(signal?: AbortSignal): Promise<ZboxWorkspace>;
|
|
428
|
+
putDomains(domains: ZboxDomain[], signal?: AbortSignal): Promise<ZboxWorkspace>;
|
|
429
|
+
pullBase(input: {
|
|
430
|
+
imageRef: string;
|
|
431
|
+
name: string;
|
|
432
|
+
}, signal?: AbortSignal): Promise<ZboxOperation>;
|
|
433
|
+
buildBase(input: {
|
|
434
|
+
context: ZboxBody;
|
|
435
|
+
name: string;
|
|
436
|
+
}, signal?: AbortSignal): Promise<ZboxOperation>;
|
|
437
|
+
listBases(signal?: AbortSignal): Promise<ZboxBase[]>;
|
|
438
|
+
getOperation(id: string, waitSeconds: number, signal?: AbortSignal): Promise<ZboxOperation>;
|
|
439
|
+
awaitOperation(operation: ZboxOperation, options: ZboxAwaitOptions): Promise<ZboxOperation>;
|
|
440
|
+
createSandbox(input: ZboxCreateSandboxInput, signal?: AbortSignal): Promise<{
|
|
441
|
+
operation: ZboxOperation;
|
|
442
|
+
sandbox: ZboxSandbox;
|
|
443
|
+
}>;
|
|
444
|
+
getSandbox(id: string, signal?: AbortSignal): Promise<ZboxSandbox>;
|
|
445
|
+
findSandboxByName(name: string, signal?: AbortSignal): Promise<ZboxSandbox | null>;
|
|
446
|
+
deleteSandbox(id: string, idempotencyKey: string, signal?: AbortSignal): Promise<void>;
|
|
447
|
+
park(id: string, input: {
|
|
448
|
+
memory: boolean;
|
|
449
|
+
}, signal?: AbortSignal): Promise<ZboxOperation>;
|
|
450
|
+
wake(id: string, signal?: AbortSignal): Promise<ZboxOperation>;
|
|
451
|
+
exec(id: string, input: ZboxExecInput, signal?: AbortSignal): Promise<ZboxExecResult>;
|
|
452
|
+
startProcess(id: string, input: ZboxProcessInput, signal?: AbortSignal): Promise<ZboxSession>;
|
|
453
|
+
getSession(id: string, signal?: AbortSignal): Promise<ZboxSession>;
|
|
454
|
+
sessionOutput(id: string, signal?: AbortSignal): Promise<Uint8Array>;
|
|
455
|
+
/** `mode` is the octal file mode (Box defaults to 0644). */
|
|
456
|
+
putFile(id: string, path: string, body: ZboxBody, options?: {
|
|
457
|
+
mode?: string;
|
|
458
|
+
signal?: AbortSignal;
|
|
459
|
+
}): Promise<void>;
|
|
460
|
+
getFile(id: string, path: string, signal?: AbortSignal): Promise<Uint8Array | null>;
|
|
461
|
+
}
|
|
462
|
+
export {};
|