@figulus/schema 0.4.0-alpha-dev

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 (50) hide show
  1. package/dist/figspec.d.ts +4394 -0
  2. package/dist/figspec.d.ts.map +1 -0
  3. package/dist/figspec.js +214 -0
  4. package/dist/figspec.js.map +1 -0
  5. package/dist/figstack.d.ts +419 -0
  6. package/dist/figstack.d.ts.map +1 -0
  7. package/dist/figstack.js +72 -0
  8. package/dist/figstack.js.map +1 -0
  9. package/dist/health.d.ts +16 -0
  10. package/dist/health.d.ts.map +1 -0
  11. package/dist/health.js +7 -0
  12. package/dist/health.js.map +1 -0
  13. package/dist/image.d.ts +115 -0
  14. package/dist/image.d.ts.map +1 -0
  15. package/dist/image.js +42 -0
  16. package/dist/image.js.map +1 -0
  17. package/dist/index.d.ts +9 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +9 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/run-request.d.ts +244 -0
  22. package/dist/run-request.d.ts.map +1 -0
  23. package/dist/run-request.js +43 -0
  24. package/dist/run-request.js.map +1 -0
  25. package/dist/session.d.ts +447 -0
  26. package/dist/session.d.ts.map +1 -0
  27. package/dist/session.js +78 -0
  28. package/dist/session.js.map +1 -0
  29. package/dist/shared.d.ts +90 -0
  30. package/dist/shared.d.ts.map +1 -0
  31. package/dist/shared.js +41 -0
  32. package/dist/shared.js.map +1 -0
  33. package/dist/volume.d.ts +140 -0
  34. package/dist/volume.d.ts.map +1 -0
  35. package/dist/volume.js +37 -0
  36. package/dist/volume.js.map +1 -0
  37. package/package.json +22 -0
  38. package/src/figspec.ts +279 -0
  39. package/src/figstack.ts +92 -0
  40. package/src/health.ts +8 -0
  41. package/src/image.ts +55 -0
  42. package/src/index.ts +8 -0
  43. package/src/run-request.ts +55 -0
  44. package/src/session.ts +101 -0
  45. package/src/shared.ts +56 -0
  46. package/src/volume.ts +50 -0
  47. package/tests/figspec.test.ts +383 -0
  48. package/tests/schemas.test.ts +187 -0
  49. package/tsconfig.build.json +11 -0
  50. package/tsconfig.json +12 -0
@@ -0,0 +1,447 @@
1
+ import { z } from 'zod';
2
+ export declare const SessionConfigSchema: z.ZodObject<{
3
+ working_dir: z.ZodOptional<z.ZodString>;
4
+ environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
5
+ parser_script: z.ZodOptional<z.ZodString>;
6
+ volumes: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
+ type: z.ZodOptional<z.ZodString>;
8
+ host_path: z.ZodString;
9
+ container_path: z.ZodOptional<z.ZodString>;
10
+ read_only: z.ZodBoolean;
11
+ }, "strip", z.ZodTypeAny, {
12
+ host_path: string;
13
+ read_only: boolean;
14
+ type?: string | undefined;
15
+ container_path?: string | undefined;
16
+ }, {
17
+ host_path: string;
18
+ read_only: boolean;
19
+ type?: string | undefined;
20
+ container_path?: string | undefined;
21
+ }>, "many">>;
22
+ named_volumes: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
+ volume_name: z.ZodString;
24
+ container_path: z.ZodString;
25
+ read_only: z.ZodBoolean;
26
+ }, "strip", z.ZodTypeAny, {
27
+ container_path: string;
28
+ read_only: boolean;
29
+ volume_name: string;
30
+ }, {
31
+ container_path: string;
32
+ read_only: boolean;
33
+ volume_name: string;
34
+ }>, "many">>;
35
+ init_cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
36
+ destroy_cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
37
+ ports: z.ZodOptional<z.ZodArray<z.ZodObject<{
38
+ container: z.ZodNumber;
39
+ host: z.ZodOptional<z.ZodNumber>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ container: number;
42
+ host?: number | undefined;
43
+ }, {
44
+ container: number;
45
+ host?: number | undefined;
46
+ }>, "many">>;
47
+ start_cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
48
+ auto_cleanup: z.ZodOptional<z.ZodBoolean>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ volumes?: {
51
+ host_path: string;
52
+ read_only: boolean;
53
+ type?: string | undefined;
54
+ container_path?: string | undefined;
55
+ }[] | undefined;
56
+ ports?: {
57
+ container: number;
58
+ host?: number | undefined;
59
+ }[] | undefined;
60
+ parser_script?: string | undefined;
61
+ environment?: Record<string, string> | undefined;
62
+ named_volumes?: {
63
+ container_path: string;
64
+ read_only: boolean;
65
+ volume_name: string;
66
+ }[] | undefined;
67
+ working_dir?: string | undefined;
68
+ init_cmd?: string[] | undefined;
69
+ destroy_cmd?: string[] | undefined;
70
+ start_cmd?: string[] | undefined;
71
+ auto_cleanup?: boolean | undefined;
72
+ }, {
73
+ volumes?: {
74
+ host_path: string;
75
+ read_only: boolean;
76
+ type?: string | undefined;
77
+ container_path?: string | undefined;
78
+ }[] | undefined;
79
+ ports?: {
80
+ container: number;
81
+ host?: number | undefined;
82
+ }[] | undefined;
83
+ parser_script?: string | undefined;
84
+ environment?: Record<string, string> | undefined;
85
+ named_volumes?: {
86
+ container_path: string;
87
+ read_only: boolean;
88
+ volume_name: string;
89
+ }[] | undefined;
90
+ working_dir?: string | undefined;
91
+ init_cmd?: string[] | undefined;
92
+ destroy_cmd?: string[] | undefined;
93
+ start_cmd?: string[] | undefined;
94
+ auto_cleanup?: boolean | undefined;
95
+ }>;
96
+ export type SessionConfig = z.infer<typeof SessionConfigSchema>;
97
+ export declare const CreateSessionRequestSchema: z.ZodObject<{
98
+ image_tag: z.ZodString;
99
+ ttl: z.ZodOptional<z.ZodNumber>;
100
+ config: z.ZodOptional<z.ZodObject<{
101
+ working_dir: z.ZodOptional<z.ZodString>;
102
+ environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
103
+ parser_script: z.ZodOptional<z.ZodString>;
104
+ volumes: z.ZodOptional<z.ZodArray<z.ZodObject<{
105
+ type: z.ZodOptional<z.ZodString>;
106
+ host_path: z.ZodString;
107
+ container_path: z.ZodOptional<z.ZodString>;
108
+ read_only: z.ZodBoolean;
109
+ }, "strip", z.ZodTypeAny, {
110
+ host_path: string;
111
+ read_only: boolean;
112
+ type?: string | undefined;
113
+ container_path?: string | undefined;
114
+ }, {
115
+ host_path: string;
116
+ read_only: boolean;
117
+ type?: string | undefined;
118
+ container_path?: string | undefined;
119
+ }>, "many">>;
120
+ named_volumes: z.ZodOptional<z.ZodArray<z.ZodObject<{
121
+ volume_name: z.ZodString;
122
+ container_path: z.ZodString;
123
+ read_only: z.ZodBoolean;
124
+ }, "strip", z.ZodTypeAny, {
125
+ container_path: string;
126
+ read_only: boolean;
127
+ volume_name: string;
128
+ }, {
129
+ container_path: string;
130
+ read_only: boolean;
131
+ volume_name: string;
132
+ }>, "many">>;
133
+ init_cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
134
+ destroy_cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
135
+ ports: z.ZodOptional<z.ZodArray<z.ZodObject<{
136
+ container: z.ZodNumber;
137
+ host: z.ZodOptional<z.ZodNumber>;
138
+ }, "strip", z.ZodTypeAny, {
139
+ container: number;
140
+ host?: number | undefined;
141
+ }, {
142
+ container: number;
143
+ host?: number | undefined;
144
+ }>, "many">>;
145
+ start_cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
146
+ auto_cleanup: z.ZodOptional<z.ZodBoolean>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ volumes?: {
149
+ host_path: string;
150
+ read_only: boolean;
151
+ type?: string | undefined;
152
+ container_path?: string | undefined;
153
+ }[] | undefined;
154
+ ports?: {
155
+ container: number;
156
+ host?: number | undefined;
157
+ }[] | undefined;
158
+ parser_script?: string | undefined;
159
+ environment?: Record<string, string> | undefined;
160
+ named_volumes?: {
161
+ container_path: string;
162
+ read_only: boolean;
163
+ volume_name: string;
164
+ }[] | undefined;
165
+ working_dir?: string | undefined;
166
+ init_cmd?: string[] | undefined;
167
+ destroy_cmd?: string[] | undefined;
168
+ start_cmd?: string[] | undefined;
169
+ auto_cleanup?: boolean | undefined;
170
+ }, {
171
+ volumes?: {
172
+ host_path: string;
173
+ read_only: boolean;
174
+ type?: string | undefined;
175
+ container_path?: string | undefined;
176
+ }[] | undefined;
177
+ ports?: {
178
+ container: number;
179
+ host?: number | undefined;
180
+ }[] | undefined;
181
+ parser_script?: string | undefined;
182
+ environment?: Record<string, string> | undefined;
183
+ named_volumes?: {
184
+ container_path: string;
185
+ read_only: boolean;
186
+ volume_name: string;
187
+ }[] | undefined;
188
+ working_dir?: string | undefined;
189
+ init_cmd?: string[] | undefined;
190
+ destroy_cmd?: string[] | undefined;
191
+ start_cmd?: string[] | undefined;
192
+ auto_cleanup?: boolean | undefined;
193
+ }>>;
194
+ block_until_complete: z.ZodOptional<z.ZodBoolean>;
195
+ }, "strip", z.ZodTypeAny, {
196
+ image_tag: string;
197
+ ttl?: number | undefined;
198
+ config?: {
199
+ volumes?: {
200
+ host_path: string;
201
+ read_only: boolean;
202
+ type?: string | undefined;
203
+ container_path?: string | undefined;
204
+ }[] | undefined;
205
+ ports?: {
206
+ container: number;
207
+ host?: number | undefined;
208
+ }[] | undefined;
209
+ parser_script?: string | undefined;
210
+ environment?: Record<string, string> | undefined;
211
+ named_volumes?: {
212
+ container_path: string;
213
+ read_only: boolean;
214
+ volume_name: string;
215
+ }[] | undefined;
216
+ working_dir?: string | undefined;
217
+ init_cmd?: string[] | undefined;
218
+ destroy_cmd?: string[] | undefined;
219
+ start_cmd?: string[] | undefined;
220
+ auto_cleanup?: boolean | undefined;
221
+ } | undefined;
222
+ block_until_complete?: boolean | undefined;
223
+ }, {
224
+ image_tag: string;
225
+ ttl?: number | undefined;
226
+ config?: {
227
+ volumes?: {
228
+ host_path: string;
229
+ read_only: boolean;
230
+ type?: string | undefined;
231
+ container_path?: string | undefined;
232
+ }[] | undefined;
233
+ ports?: {
234
+ container: number;
235
+ host?: number | undefined;
236
+ }[] | undefined;
237
+ parser_script?: string | undefined;
238
+ environment?: Record<string, string> | undefined;
239
+ named_volumes?: {
240
+ container_path: string;
241
+ read_only: boolean;
242
+ volume_name: string;
243
+ }[] | undefined;
244
+ working_dir?: string | undefined;
245
+ init_cmd?: string[] | undefined;
246
+ destroy_cmd?: string[] | undefined;
247
+ start_cmd?: string[] | undefined;
248
+ auto_cleanup?: boolean | undefined;
249
+ } | undefined;
250
+ block_until_complete?: boolean | undefined;
251
+ }>;
252
+ export type CreateSessionRequest = z.infer<typeof CreateSessionRequestSchema>;
253
+ export declare const CreateSessionResponseSchema: z.ZodObject<{
254
+ session_id: z.ZodString;
255
+ container_id: z.ZodString;
256
+ status: z.ZodEnum<["active", "idle", "expired"]>;
257
+ created_at: z.ZodString;
258
+ ports: z.ZodOptional<z.ZodArray<z.ZodObject<{
259
+ container: z.ZodNumber;
260
+ host: z.ZodOptional<z.ZodNumber>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ container: number;
263
+ host?: number | undefined;
264
+ }, {
265
+ container: number;
266
+ host?: number | undefined;
267
+ }>, "many">>;
268
+ exit_code: z.ZodOptional<z.ZodNumber>;
269
+ stdout: z.ZodOptional<z.ZodString>;
270
+ stderr: z.ZodOptional<z.ZodString>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ status: "active" | "idle" | "expired";
273
+ container_id: string;
274
+ created_at: string;
275
+ session_id: string;
276
+ ports?: {
277
+ container: number;
278
+ host?: number | undefined;
279
+ }[] | undefined;
280
+ exit_code?: number | undefined;
281
+ stdout?: string | undefined;
282
+ stderr?: string | undefined;
283
+ }, {
284
+ status: "active" | "idle" | "expired";
285
+ container_id: string;
286
+ created_at: string;
287
+ session_id: string;
288
+ ports?: {
289
+ container: number;
290
+ host?: number | undefined;
291
+ }[] | undefined;
292
+ exit_code?: number | undefined;
293
+ stdout?: string | undefined;
294
+ stderr?: string | undefined;
295
+ }>;
296
+ export type CreateSessionResponse = z.infer<typeof CreateSessionResponseSchema>;
297
+ export declare const GetSessionResponseSchema: z.ZodObject<{
298
+ session_id: z.ZodString;
299
+ container_id: z.ZodString;
300
+ image_tag: z.ZodString;
301
+ status: z.ZodEnum<["active", "idle", "expired"]>;
302
+ created_at: z.ZodString;
303
+ last_used_at: z.ZodString;
304
+ ttl: z.ZodNumber;
305
+ ports: z.ZodOptional<z.ZodArray<z.ZodObject<{
306
+ container: z.ZodNumber;
307
+ host: z.ZodOptional<z.ZodNumber>;
308
+ }, "strip", z.ZodTypeAny, {
309
+ container: number;
310
+ host?: number | undefined;
311
+ }, {
312
+ container: number;
313
+ host?: number | undefined;
314
+ }>, "many">>;
315
+ }, "strip", z.ZodTypeAny, {
316
+ status: "active" | "idle" | "expired";
317
+ image_tag: string;
318
+ container_id: string;
319
+ created_at: string;
320
+ ttl: number;
321
+ session_id: string;
322
+ last_used_at: string;
323
+ ports?: {
324
+ container: number;
325
+ host?: number | undefined;
326
+ }[] | undefined;
327
+ }, {
328
+ status: "active" | "idle" | "expired";
329
+ image_tag: string;
330
+ container_id: string;
331
+ created_at: string;
332
+ ttl: number;
333
+ session_id: string;
334
+ last_used_at: string;
335
+ ports?: {
336
+ container: number;
337
+ host?: number | undefined;
338
+ }[] | undefined;
339
+ }>;
340
+ export type GetSessionResponse = z.infer<typeof GetSessionResponseSchema>;
341
+ export declare const RunInSessionRequestSchema: z.ZodObject<{
342
+ command: z.ZodArray<z.ZodString, "many">;
343
+ timeout: z.ZodOptional<z.ZodNumber>;
344
+ parser_script: z.ZodOptional<z.ZodString>;
345
+ working_dir: z.ZodOptional<z.ZodString>;
346
+ }, "strip", z.ZodTypeAny, {
347
+ command: string[];
348
+ timeout?: number | undefined;
349
+ parser_script?: string | undefined;
350
+ working_dir?: string | undefined;
351
+ }, {
352
+ command: string[];
353
+ timeout?: number | undefined;
354
+ parser_script?: string | undefined;
355
+ working_dir?: string | undefined;
356
+ }>;
357
+ export type RunInSessionRequest = z.infer<typeof RunInSessionRequestSchema>;
358
+ export declare const RunInSessionResponseSchema: z.ZodObject<{
359
+ run_id: z.ZodString;
360
+ exit_code: z.ZodNumber;
361
+ stdout: z.ZodString;
362
+ stderr: z.ZodString;
363
+ parsed_output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
364
+ duration: z.ZodNumber;
365
+ }, "strip", z.ZodTypeAny, {
366
+ exit_code: number;
367
+ stdout: string;
368
+ stderr: string;
369
+ duration: number;
370
+ run_id: string;
371
+ parsed_output?: Record<string, unknown> | undefined;
372
+ }, {
373
+ exit_code: number;
374
+ stdout: string;
375
+ stderr: string;
376
+ duration: number;
377
+ run_id: string;
378
+ parsed_output?: Record<string, unknown> | undefined;
379
+ }>;
380
+ export type RunInSessionResponse = z.infer<typeof RunInSessionResponseSchema>;
381
+ export declare const GetRunResponseSchema: z.ZodObject<{
382
+ run_id: z.ZodString;
383
+ session_id: z.ZodString;
384
+ command: z.ZodArray<z.ZodString, "many">;
385
+ exit_code: z.ZodNumber;
386
+ stdout: z.ZodString;
387
+ stderr: z.ZodString;
388
+ parsed_output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
389
+ started_at: z.ZodString;
390
+ completed_at: z.ZodString;
391
+ duration: z.ZodNumber;
392
+ }, "strip", z.ZodTypeAny, {
393
+ command: string[];
394
+ exit_code: number;
395
+ stdout: string;
396
+ stderr: string;
397
+ started_at: string;
398
+ completed_at: string;
399
+ duration: number;
400
+ session_id: string;
401
+ run_id: string;
402
+ parsed_output?: Record<string, unknown> | undefined;
403
+ }, {
404
+ command: string[];
405
+ exit_code: number;
406
+ stdout: string;
407
+ stderr: string;
408
+ started_at: string;
409
+ completed_at: string;
410
+ duration: number;
411
+ session_id: string;
412
+ run_id: string;
413
+ parsed_output?: Record<string, unknown> | undefined;
414
+ }>;
415
+ export type GetRunResponse = z.infer<typeof GetRunResponseSchema>;
416
+ export declare const SyncFileRequestSchema: z.ZodObject<{
417
+ targetPath: z.ZodString;
418
+ content: z.ZodString;
419
+ encoding: z.ZodDefault<z.ZodEnum<["base64", "utf8"]>>;
420
+ }, "strip", z.ZodTypeAny, {
421
+ encoding: "base64" | "utf8";
422
+ content: string;
423
+ targetPath: string;
424
+ }, {
425
+ content: string;
426
+ targetPath: string;
427
+ encoding?: "base64" | "utf8" | undefined;
428
+ }>;
429
+ export type SyncFileRequest = z.infer<typeof SyncFileRequestSchema>;
430
+ export declare const SyncFileResponseSchema: z.ZodObject<{
431
+ success: z.ZodBoolean;
432
+ path: z.ZodString;
433
+ bytes_written: z.ZodNumber;
434
+ message: z.ZodOptional<z.ZodString>;
435
+ }, "strip", z.ZodTypeAny, {
436
+ path: string;
437
+ success: boolean;
438
+ bytes_written: number;
439
+ message?: string | undefined;
440
+ }, {
441
+ path: string;
442
+ success: boolean;
443
+ bytes_written: number;
444
+ message?: string | undefined;
445
+ }>;
446
+ export type SyncFileResponse = z.infer<typeof SyncFileResponseSchema>;
447
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;EAKpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;EAOrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { z } from 'zod';
2
+ import { SessionStatusSchema, VolumeMountSchema, NamedVolumeMountSchema, PortMappingSchema, } from './shared.js';
3
+ export const SessionConfigSchema = z.object({
4
+ working_dir: z.string().optional(),
5
+ environment: z.record(z.string()).optional(),
6
+ parser_script: z.string().optional(),
7
+ volumes: z.array(VolumeMountSchema).optional(),
8
+ named_volumes: z.array(NamedVolumeMountSchema).optional(),
9
+ init_cmd: z.array(z.string()).optional(),
10
+ destroy_cmd: z.array(z.string()).optional(),
11
+ ports: z.array(PortMappingSchema).optional(),
12
+ start_cmd: z.array(z.string()).optional(),
13
+ auto_cleanup: z.boolean().optional(),
14
+ });
15
+ export const CreateSessionRequestSchema = z.object({
16
+ image_tag: z.string().min(1),
17
+ ttl: z.number().int().positive().optional(),
18
+ config: SessionConfigSchema.optional(),
19
+ block_until_complete: z.boolean().optional(),
20
+ });
21
+ export const CreateSessionResponseSchema = z.object({
22
+ session_id: z.string(),
23
+ container_id: z.string(),
24
+ status: SessionStatusSchema,
25
+ created_at: z.string().datetime(),
26
+ ports: z.array(PortMappingSchema).optional(),
27
+ exit_code: z.number().int().optional(),
28
+ stdout: z.string().optional(),
29
+ stderr: z.string().optional(),
30
+ });
31
+ export const GetSessionResponseSchema = z.object({
32
+ session_id: z.string(),
33
+ container_id: z.string(),
34
+ image_tag: z.string(),
35
+ status: SessionStatusSchema,
36
+ created_at: z.string().datetime(),
37
+ last_used_at: z.string().datetime(),
38
+ ttl: z.number().int(),
39
+ ports: z.array(PortMappingSchema).optional(),
40
+ });
41
+ export const RunInSessionRequestSchema = z.object({
42
+ command: z.array(z.string()).min(1),
43
+ timeout: z.number().int().positive().max(86400).optional(),
44
+ parser_script: z.string().optional(),
45
+ working_dir: z.string().optional(),
46
+ });
47
+ export const RunInSessionResponseSchema = z.object({
48
+ run_id: z.string(),
49
+ exit_code: z.number().int(),
50
+ stdout: z.string(),
51
+ stderr: z.string(),
52
+ parsed_output: z.record(z.unknown()).optional(),
53
+ duration: z.number(),
54
+ });
55
+ export const GetRunResponseSchema = z.object({
56
+ run_id: z.string(),
57
+ session_id: z.string(),
58
+ command: z.array(z.string()),
59
+ exit_code: z.number().int(),
60
+ stdout: z.string(),
61
+ stderr: z.string(),
62
+ parsed_output: z.record(z.unknown()).optional(),
63
+ started_at: z.string().datetime(),
64
+ completed_at: z.string().datetime(),
65
+ duration: z.number(),
66
+ });
67
+ export const SyncFileRequestSchema = z.object({
68
+ targetPath: z.string().min(1),
69
+ content: z.string().min(1),
70
+ encoding: z.enum(['base64', 'utf8']).default('base64'),
71
+ });
72
+ export const SyncFileResponseSchema = z.object({
73
+ success: z.boolean(),
74
+ path: z.string(),
75
+ bytes_written: z.number().int(),
76
+ message: z.string().optional(),
77
+ });
78
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EAEnB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;IAC9C,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE;IACzD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;IAC5C,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC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chema: z.ZodEnum<["pending", "running", "completed", "failed", "timeout", "awaiting_cleanup"]>;
3
+ export type JobStatus = z.infer<typeof JobStatusSchema>;
4
+ export declare const SessionStatusSchema: z.ZodEnum<["active", "idle", "expired"]>;
5
+ export type SessionStatus = z.infer<typeof SessionStatusSchema>;
6
+ export declare const ParsedOutputSchema: z.ZodObject<{
7
+ success: z.ZodBoolean;
8
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ success: boolean;
11
+ data?: Record<string, unknown> | undefined;
12
+ }, {
13
+ success: boolean;
14
+ data?: Record<string, unknown> | undefined;
15
+ }>;
16
+ export type ParsedOutput = z.infer<typeof ParsedOutputSchema>;
17
+ export declare const ResourceLimitsSchema: z.ZodObject<{
18
+ memory_limit: z.ZodOptional<z.ZodString>;
19
+ memory_reservation: z.ZodOptional<z.ZodString>;
20
+ cpu_limit: z.ZodOptional<z.ZodString>;
21
+ cpu_reservation: z.ZodOptional<z.ZodString>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ memory_limit?: string | undefined;
24
+ memory_reservation?: string | undefined;
25
+ cpu_limit?: string | undefined;
26
+ cpu_reservation?: string | undefined;
27
+ }, {
28
+ memory_limit?: string | undefined;
29
+ memory_reservation?: string | undefined;
30
+ cpu_limit?: string | undefined;
31
+ cpu_reservation?: string | undefined;
32
+ }>;
33
+ export type ResourceLimits = z.infer<typeof ResourceLimitsSchema>;
34
+ export declare const VolumeMountSchema: z.ZodObject<{
35
+ type: z.ZodOptional<z.ZodString>;
36
+ host_path: z.ZodString;
37
+ container_path: z.ZodOptional<z.ZodString>;
38
+ read_only: z.ZodBoolean;
39
+ }, "strip", z.ZodTypeAny, {
40
+ host_path: string;
41
+ read_only: boolean;
42
+ type?: string | undefined;
43
+ container_path?: string | undefined;
44
+ }, {
45
+ host_path: string;
46
+ read_only: boolean;
47
+ type?: string | undefined;
48
+ container_path?: string | undefined;
49
+ }>;
50
+ export type VolumeMount = z.infer<typeof VolumeMountSchema>;
51
+ export declare const NamedVolumeMountSchema: z.ZodObject<{
52
+ volume_name: z.ZodString;
53
+ container_path: z.ZodString;
54
+ read_only: z.ZodBoolean;
55
+ }, "strip", z.ZodTypeAny, {
56
+ container_path: string;
57
+ read_only: boolean;
58
+ volume_name: string;
59
+ }, {
60
+ container_path: string;
61
+ read_only: boolean;
62
+ volume_name: string;
63
+ }>;
64
+ export type NamedVolumeMount = z.infer<typeof NamedVolumeMountSchema>;
65
+ export declare const PortMappingSchema: z.ZodObject<{
66
+ container: z.ZodNumber;
67
+ host: z.ZodOptional<z.ZodNumber>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ container: number;
70
+ host?: number | undefined;
71
+ }, {
72
+ container: number;
73
+ host?: number | undefined;
74
+ }>;
75
+ export type PortMapping = z.infer<typeof PortMappingSchema>;
76
+ export declare const ErrorResponseSchema: z.ZodObject<{
77
+ error: z.ZodString;
78
+ message: z.ZodString;
79
+ code: z.ZodNumber;
80
+ }, "strip", z.ZodTypeAny, {
81
+ code: number;
82
+ message: string;
83
+ error: string;
84
+ }, {
85
+ code: number;
86
+ message: string;
87
+ error: string;
88
+ }>;
89
+ export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
90
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe,yFAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,mBAAmB,0CAAwC,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
package/dist/shared.js ADDED
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ export const JobStatusSchema = z.enum([
3
+ 'pending',
4
+ 'running',
5
+ 'completed',
6
+ 'failed',
7
+ 'timeout',
8
+ 'awaiting_cleanup',
9
+ ]);
10
+ export const SessionStatusSchema = z.enum(['active', 'idle', 'expired']);
11
+ export const ParsedOutputSchema = z.object({
12
+ success: z.boolean(),
13
+ data: z.record(z.unknown()).optional(),
14
+ });
15
+ export const ResourceLimitsSchema = z.object({
16
+ memory_limit: z.string().optional(),
17
+ memory_reservation: z.string().optional(),
18
+ cpu_limit: z.string().optional(),
19
+ cpu_reservation: z.string().optional(),
20
+ });
21
+ export const VolumeMountSchema = z.object({
22
+ type: z.string().optional(),
23
+ host_path: z.string(),
24
+ container_path: z.string().optional(),
25
+ read_only: z.boolean(),
26
+ });
27
+ export const NamedVolumeMountSchema = z.object({
28
+ volume_name: z.string().min(1),
29
+ container_path: z.string().min(1),
30
+ read_only: z.boolean(),
31
+ });
32
+ export const PortMappingSchema = z.object({
33
+ container: z.number().int().min(1).max(65535),
34
+ host: z.number().int().min(0).max(65535).optional(),
35
+ });
36
+ export const ErrorResponseSchema = z.object({
37
+ error: z.string(),
38
+ message: z.string(),
39
+ code: z.number().int(),
40
+ });
41
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,SAAS;IACT,kBAAkB;CACnB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAGzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,eAAe,EAAE,CAAC,CAAC,MAAM,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