experimental-agent 0.0.0

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.
@@ -0,0 +1,805 @@
1
+ import { UIMessage } from 'ai';
2
+ import { z } from 'zod';
3
+ import * as errore from 'errore';
4
+
5
+ declare const SessionNotFoundError_base: errore.FactoryTaggedErrorClass<"SessionNotFoundError", "Session $id not found", Error>;
6
+ declare class SessionNotFoundError extends SessionNotFoundError_base {
7
+ }
8
+ declare const SessionError_base: errore.FactoryTaggedErrorClass<"SessionError", "Session $id failed: $reason", Error>;
9
+ declare class SessionError extends SessionError_base {
10
+ }
11
+ declare const SandboxNotFoundError_base: errore.FactoryTaggedErrorClass<"SandboxNotFoundError", "Sandbox $id not found", Error>;
12
+ declare class SandboxNotFoundError extends SandboxNotFoundError_base {
13
+ }
14
+ declare const StorageError_base: errore.FactoryTaggedErrorClass<"StorageError", "$reason", Error>;
15
+ declare class StorageError extends StorageError_base {
16
+ }
17
+ declare const SandboxError_base: errore.FactoryTaggedErrorClass<"SandboxError", "$reason", Error>;
18
+ declare class SandboxError extends SandboxError_base {
19
+ }
20
+ declare const MessageNotFoundError_base: errore.FactoryTaggedErrorClass<"MessageNotFoundError", "Message $id not found", Error>;
21
+ declare class MessageNotFoundError extends MessageNotFoundError_base {
22
+ }
23
+
24
+ declare const SandboxConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
25
+ type: z.ZodLiteral<"vercel">;
26
+ resources: z.ZodOptional<z.ZodObject<{
27
+ vcpus: z.ZodNumber;
28
+ }, z.core.$strip>>;
29
+ ports: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
30
+ lifecycle: z.ZodOptional<z.ZodObject<{
31
+ stopAfterInactiveMs: z.ZodOptional<z.ZodNumber>;
32
+ snapshotBeforeTimeoutMs: z.ZodOptional<z.ZodNumber>;
33
+ snapshotId: z.ZodOptional<z.ZodString>;
34
+ autoStart: z.ZodOptional<z.ZodBoolean>;
35
+ }, z.core.$strip>>;
36
+ }, z.core.$strip>, z.ZodObject<{
37
+ type: z.ZodLiteral<"local">;
38
+ path: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ type: z.ZodLiteral<"custom">;
41
+ url: z.ZodString;
42
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
43
+ }, z.core.$strip>], "type">;
44
+ type SandboxConfig = z.infer<typeof SandboxConfigSchema>;
45
+ declare const SessionSchema: z.ZodObject<{
46
+ id: z.ZodString;
47
+ createdAt: z.ZodNumber;
48
+ updatedAt: z.ZodNumber;
49
+ runId: z.ZodNullable<z.ZodString>;
50
+ lastMessageId: z.ZodNullable<z.ZodString>;
51
+ tags: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
52
+ instructions: z.ZodNullable<z.ZodString>;
53
+ model: z.ZodNullable<z.ZodString>;
54
+ mcp: z.ZodNullable<z.ZodUnknown>;
55
+ sandboxId: z.ZodNullable<z.ZodString>;
56
+ skillsDir: z.ZodNullable<z.ZodArray<z.ZodString>>;
57
+ hookToken: z.ZodNullable<z.ZodString>;
58
+ }, z.core.$strip>;
59
+ declare const MessageSchema: z.ZodObject<{
60
+ id: z.ZodString;
61
+ sessionId: z.ZodString;
62
+ role: z.ZodEnum<{
63
+ user: "user";
64
+ assistant: "assistant";
65
+ system: "system";
66
+ }>;
67
+ createdAt: z.ZodNumber;
68
+ completedAt: z.ZodNullable<z.ZodNumber>;
69
+ mcpContext: z.ZodNullable<z.ZodUnknown>;
70
+ }, z.core.$strip>;
71
+ /**
72
+ * The `part` field corresponds to `UIMessage["parts"][number]` from the `ai` package.
73
+ * We use `z.unknown()` because the exact shape varies by part type (text, tool-call,
74
+ * tool-result, etc.) and may evolve with the AI SDK. The RPC layer just passes it through.
75
+ */
76
+ declare const PartSchema: z.ZodObject<{
77
+ id: z.ZodString;
78
+ messageId: z.ZodString;
79
+ sessionId: z.ZodString;
80
+ index: z.ZodNumber;
81
+ part: z.ZodUnknown;
82
+ }, z.core.$strip>;
83
+ declare const SandboxRecordSchema: z.ZodObject<{
84
+ id: z.ZodString;
85
+ config: z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ type: z.ZodLiteral<"vercel">;
87
+ resources: z.ZodOptional<z.ZodObject<{
88
+ vcpus: z.ZodNumber;
89
+ }, z.core.$strip>>;
90
+ ports: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
91
+ lifecycle: z.ZodOptional<z.ZodObject<{
92
+ stopAfterInactiveMs: z.ZodOptional<z.ZodNumber>;
93
+ snapshotBeforeTimeoutMs: z.ZodOptional<z.ZodNumber>;
94
+ snapshotId: z.ZodOptional<z.ZodString>;
95
+ autoStart: z.ZodOptional<z.ZodBoolean>;
96
+ }, z.core.$strip>>;
97
+ }, z.core.$strip>, z.ZodObject<{
98
+ type: z.ZodLiteral<"local">;
99
+ path: z.ZodOptional<z.ZodString>;
100
+ }, z.core.$strip>, z.ZodObject<{
101
+ type: z.ZodLiteral<"custom">;
102
+ url: z.ZodString;
103
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
104
+ }, z.core.$strip>], "type">;
105
+ createdAt: z.ZodNullable<z.ZodNumber>;
106
+ lastActivityAt: z.ZodNullable<z.ZodNumber>;
107
+ acquiringLockId: z.ZodNullable<z.ZodString>;
108
+ acquiringLockAt: z.ZodNullable<z.ZodNumber>;
109
+ providerMetadata: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
110
+ provider: z.ZodLiteral<"vercel">;
111
+ sandboxId: z.ZodNullable<z.ZodString>;
112
+ snapshotId: z.ZodNullable<z.ZodString>;
113
+ }, z.core.$strip>], "provider">>;
114
+ }, z.core.$strip>;
115
+ declare const CommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ id: z.ZodString;
117
+ sessionId: z.ZodString;
118
+ command: z.ZodString;
119
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
+ startedAt: z.ZodNumber;
121
+ status: z.ZodLiteral<"running">;
122
+ }, z.core.$strip>, z.ZodObject<{
123
+ id: z.ZodString;
124
+ sessionId: z.ZodString;
125
+ command: z.ZodString;
126
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ startedAt: z.ZodNumber;
128
+ status: z.ZodLiteral<"completed">;
129
+ result: z.ZodObject<{
130
+ stdout: z.ZodString;
131
+ stderr: z.ZodString;
132
+ exitCode: z.ZodNumber;
133
+ completedAt: z.ZodNumber;
134
+ }, z.core.$strip>;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ id: z.ZodString;
137
+ sessionId: z.ZodString;
138
+ command: z.ZodString;
139
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
140
+ startedAt: z.ZodNumber;
141
+ status: z.ZodLiteral<"killed">;
142
+ result: z.ZodOptional<z.ZodObject<{
143
+ stdout: z.ZodString;
144
+ stderr: z.ZodString;
145
+ exitCode: z.ZodNumber;
146
+ completedAt: z.ZodNumber;
147
+ }, z.core.$strip>>;
148
+ }, z.core.$strip>, z.ZodObject<{
149
+ id: z.ZodString;
150
+ sessionId: z.ZodString;
151
+ command: z.ZodString;
152
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
153
+ startedAt: z.ZodNumber;
154
+ status: z.ZodLiteral<"failed">;
155
+ result: z.ZodObject<{
156
+ stdout: z.ZodString;
157
+ stderr: z.ZodString;
158
+ exitCode: z.ZodNumber;
159
+ completedAt: z.ZodNumber;
160
+ }, z.core.$strip>;
161
+ }, z.core.$strip>], "status">;
162
+ declare const methods: {
163
+ readonly "session.get": {
164
+ readonly params: z.ZodObject<{
165
+ id: z.ZodString;
166
+ }, z.core.$strip>;
167
+ readonly result: z.ZodNullable<z.ZodObject<{
168
+ id: z.ZodString;
169
+ createdAt: z.ZodNumber;
170
+ updatedAt: z.ZodNumber;
171
+ runId: z.ZodNullable<z.ZodString>;
172
+ lastMessageId: z.ZodNullable<z.ZodString>;
173
+ tags: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
174
+ instructions: z.ZodNullable<z.ZodString>;
175
+ model: z.ZodNullable<z.ZodString>;
176
+ mcp: z.ZodNullable<z.ZodUnknown>;
177
+ sandboxId: z.ZodNullable<z.ZodString>;
178
+ skillsDir: z.ZodNullable<z.ZodArray<z.ZodString>>;
179
+ hookToken: z.ZodNullable<z.ZodString>;
180
+ }, z.core.$strip>>;
181
+ };
182
+ readonly "session.set": {
183
+ readonly params: z.ZodObject<{
184
+ id: z.ZodString;
185
+ createdAt: z.ZodNumber;
186
+ updatedAt: z.ZodNumber;
187
+ runId: z.ZodNullable<z.ZodString>;
188
+ lastMessageId: z.ZodNullable<z.ZodString>;
189
+ tags: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
190
+ instructions: z.ZodNullable<z.ZodString>;
191
+ model: z.ZodNullable<z.ZodString>;
192
+ mcp: z.ZodNullable<z.ZodUnknown>;
193
+ sandboxId: z.ZodNullable<z.ZodString>;
194
+ skillsDir: z.ZodNullable<z.ZodArray<z.ZodString>>;
195
+ hookToken: z.ZodNullable<z.ZodString>;
196
+ }, z.core.$strip>;
197
+ readonly result: z.ZodObject<{
198
+ id: z.ZodString;
199
+ createdAt: z.ZodNumber;
200
+ updatedAt: z.ZodNumber;
201
+ runId: z.ZodNullable<z.ZodString>;
202
+ lastMessageId: z.ZodNullable<z.ZodString>;
203
+ tags: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
204
+ instructions: z.ZodNullable<z.ZodString>;
205
+ model: z.ZodNullable<z.ZodString>;
206
+ mcp: z.ZodNullable<z.ZodUnknown>;
207
+ sandboxId: z.ZodNullable<z.ZodString>;
208
+ skillsDir: z.ZodNullable<z.ZodArray<z.ZodString>>;
209
+ hookToken: z.ZodNullable<z.ZodString>;
210
+ }, z.core.$strip>;
211
+ };
212
+ readonly "session.list": {
213
+ readonly params: z.ZodObject<{
214
+ tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
215
+ order: z.ZodOptional<z.ZodEnum<{
216
+ createdAt_asc: "createdAt_asc";
217
+ createdAt_desc: "createdAt_desc";
218
+ updatedAt_asc: "updatedAt_asc";
219
+ updatedAt_desc: "updatedAt_desc";
220
+ }>>;
221
+ cursor: z.ZodOptional<z.ZodString>;
222
+ limit: z.ZodOptional<z.ZodNumber>;
223
+ }, z.core.$strip>;
224
+ readonly result: z.ZodObject<{
225
+ items: z.ZodArray<z.ZodObject<{
226
+ id: z.ZodString;
227
+ createdAt: z.ZodNumber;
228
+ updatedAt: z.ZodNumber;
229
+ runId: z.ZodNullable<z.ZodString>;
230
+ lastMessageId: z.ZodNullable<z.ZodString>;
231
+ tags: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
232
+ instructions: z.ZodNullable<z.ZodString>;
233
+ model: z.ZodNullable<z.ZodString>;
234
+ mcp: z.ZodNullable<z.ZodUnknown>;
235
+ sandboxId: z.ZodNullable<z.ZodString>;
236
+ skillsDir: z.ZodNullable<z.ZodArray<z.ZodString>>;
237
+ hookToken: z.ZodNullable<z.ZodString>;
238
+ }, z.core.$strip>>;
239
+ nextCursor: z.ZodNullable<z.ZodString>;
240
+ }, z.core.$strip>;
241
+ };
242
+ readonly "session.listBySandbox": {
243
+ readonly params: z.ZodObject<{
244
+ sandboxId: z.ZodString;
245
+ tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
246
+ order: z.ZodOptional<z.ZodEnum<{
247
+ createdAt_asc: "createdAt_asc";
248
+ createdAt_desc: "createdAt_desc";
249
+ updatedAt_asc: "updatedAt_asc";
250
+ updatedAt_desc: "updatedAt_desc";
251
+ }>>;
252
+ cursor: z.ZodOptional<z.ZodString>;
253
+ limit: z.ZodOptional<z.ZodNumber>;
254
+ }, z.core.$strip>;
255
+ readonly result: z.ZodObject<{
256
+ items: z.ZodArray<z.ZodObject<{
257
+ id: z.ZodString;
258
+ createdAt: z.ZodNumber;
259
+ updatedAt: z.ZodNumber;
260
+ runId: z.ZodNullable<z.ZodString>;
261
+ lastMessageId: z.ZodNullable<z.ZodString>;
262
+ tags: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
263
+ instructions: z.ZodNullable<z.ZodString>;
264
+ model: z.ZodNullable<z.ZodString>;
265
+ mcp: z.ZodNullable<z.ZodUnknown>;
266
+ sandboxId: z.ZodNullable<z.ZodString>;
267
+ skillsDir: z.ZodNullable<z.ZodArray<z.ZodString>>;
268
+ hookToken: z.ZodNullable<z.ZodString>;
269
+ }, z.core.$strip>>;
270
+ nextCursor: z.ZodNullable<z.ZodString>;
271
+ }, z.core.$strip>;
272
+ };
273
+ readonly "session.tag.set": {
274
+ readonly params: z.ZodObject<{
275
+ sessionId: z.ZodString;
276
+ tags: z.ZodRecord<z.ZodString, z.ZodUnknown>;
277
+ }, z.core.$strip>;
278
+ readonly result: z.ZodObject<{
279
+ id: z.ZodString;
280
+ createdAt: z.ZodNumber;
281
+ updatedAt: z.ZodNumber;
282
+ runId: z.ZodNullable<z.ZodString>;
283
+ lastMessageId: z.ZodNullable<z.ZodString>;
284
+ tags: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
285
+ instructions: z.ZodNullable<z.ZodString>;
286
+ model: z.ZodNullable<z.ZodString>;
287
+ mcp: z.ZodNullable<z.ZodUnknown>;
288
+ sandboxId: z.ZodNullable<z.ZodString>;
289
+ skillsDir: z.ZodNullable<z.ZodArray<z.ZodString>>;
290
+ hookToken: z.ZodNullable<z.ZodString>;
291
+ }, z.core.$strip>;
292
+ };
293
+ readonly "message.get": {
294
+ readonly params: z.ZodObject<{
295
+ id: z.ZodString;
296
+ }, z.core.$strip>;
297
+ readonly result: z.ZodNullable<z.ZodObject<{
298
+ id: z.ZodString;
299
+ sessionId: z.ZodString;
300
+ role: z.ZodEnum<{
301
+ user: "user";
302
+ assistant: "assistant";
303
+ system: "system";
304
+ }>;
305
+ createdAt: z.ZodNumber;
306
+ completedAt: z.ZodNullable<z.ZodNumber>;
307
+ mcpContext: z.ZodNullable<z.ZodUnknown>;
308
+ }, z.core.$strip>>;
309
+ };
310
+ readonly "message.set": {
311
+ readonly params: z.ZodObject<{
312
+ id: z.ZodString;
313
+ sessionId: z.ZodString;
314
+ role: z.ZodEnum<{
315
+ user: "user";
316
+ assistant: "assistant";
317
+ system: "system";
318
+ }>;
319
+ createdAt: z.ZodNumber;
320
+ completedAt: z.ZodNullable<z.ZodNumber>;
321
+ mcpContext: z.ZodNullable<z.ZodUnknown>;
322
+ }, z.core.$strip>;
323
+ readonly result: z.ZodObject<{
324
+ id: z.ZodString;
325
+ sessionId: z.ZodString;
326
+ role: z.ZodEnum<{
327
+ user: "user";
328
+ assistant: "assistant";
329
+ system: "system";
330
+ }>;
331
+ createdAt: z.ZodNumber;
332
+ completedAt: z.ZodNullable<z.ZodNumber>;
333
+ mcpContext: z.ZodNullable<z.ZodUnknown>;
334
+ }, z.core.$strip>;
335
+ };
336
+ readonly "message.list": {
337
+ readonly params: z.ZodObject<{
338
+ sessionId: z.ZodString;
339
+ cursor: z.ZodOptional<z.ZodString>;
340
+ limit: z.ZodOptional<z.ZodNumber>;
341
+ }, z.core.$strip>;
342
+ readonly result: z.ZodObject<{
343
+ items: z.ZodArray<z.ZodObject<{
344
+ id: z.ZodString;
345
+ sessionId: z.ZodString;
346
+ role: z.ZodEnum<{
347
+ user: "user";
348
+ assistant: "assistant";
349
+ system: "system";
350
+ }>;
351
+ createdAt: z.ZodNumber;
352
+ completedAt: z.ZodNullable<z.ZodNumber>;
353
+ mcpContext: z.ZodNullable<z.ZodUnknown>;
354
+ }, z.core.$strip>>;
355
+ nextCursor: z.ZodNullable<z.ZodString>;
356
+ }, z.core.$strip>;
357
+ };
358
+ readonly "part.listByMessage": {
359
+ readonly params: z.ZodObject<{
360
+ messageId: z.ZodString;
361
+ cursor: z.ZodOptional<z.ZodString>;
362
+ limit: z.ZodOptional<z.ZodNumber>;
363
+ }, z.core.$strip>;
364
+ readonly result: z.ZodObject<{
365
+ items: z.ZodArray<z.ZodObject<{
366
+ id: z.ZodString;
367
+ messageId: z.ZodString;
368
+ sessionId: z.ZodString;
369
+ index: z.ZodNumber;
370
+ part: z.ZodUnknown;
371
+ }, z.core.$strip>>;
372
+ nextCursor: z.ZodNullable<z.ZodString>;
373
+ }, z.core.$strip>;
374
+ };
375
+ readonly "part.listBySession": {
376
+ readonly params: z.ZodObject<{
377
+ sessionId: z.ZodString;
378
+ cursor: z.ZodOptional<z.ZodString>;
379
+ limit: z.ZodOptional<z.ZodNumber>;
380
+ }, z.core.$strip>;
381
+ readonly result: z.ZodObject<{
382
+ items: z.ZodArray<z.ZodObject<{
383
+ id: z.ZodString;
384
+ messageId: z.ZodString;
385
+ sessionId: z.ZodString;
386
+ index: z.ZodNumber;
387
+ part: z.ZodUnknown;
388
+ }, z.core.$strip>>;
389
+ nextCursor: z.ZodNullable<z.ZodString>;
390
+ }, z.core.$strip>;
391
+ };
392
+ readonly "part.set": {
393
+ readonly params: z.ZodObject<{
394
+ id: z.ZodString;
395
+ messageId: z.ZodString;
396
+ sessionId: z.ZodString;
397
+ index: z.ZodNumber;
398
+ part: z.ZodUnknown;
399
+ }, z.core.$strip>;
400
+ readonly result: z.ZodObject<{
401
+ id: z.ZodString;
402
+ messageId: z.ZodString;
403
+ sessionId: z.ZodString;
404
+ index: z.ZodNumber;
405
+ part: z.ZodUnknown;
406
+ }, z.core.$strip>;
407
+ };
408
+ readonly "sandbox.get": {
409
+ readonly params: z.ZodObject<{
410
+ key: z.ZodString;
411
+ }, z.core.$strip>;
412
+ readonly result: z.ZodNullable<z.ZodObject<{
413
+ id: z.ZodString;
414
+ config: z.ZodDiscriminatedUnion<[z.ZodObject<{
415
+ type: z.ZodLiteral<"vercel">;
416
+ resources: z.ZodOptional<z.ZodObject<{
417
+ vcpus: z.ZodNumber;
418
+ }, z.core.$strip>>;
419
+ ports: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
420
+ lifecycle: z.ZodOptional<z.ZodObject<{
421
+ stopAfterInactiveMs: z.ZodOptional<z.ZodNumber>;
422
+ snapshotBeforeTimeoutMs: z.ZodOptional<z.ZodNumber>;
423
+ snapshotId: z.ZodOptional<z.ZodString>;
424
+ autoStart: z.ZodOptional<z.ZodBoolean>;
425
+ }, z.core.$strip>>;
426
+ }, z.core.$strip>, z.ZodObject<{
427
+ type: z.ZodLiteral<"local">;
428
+ path: z.ZodOptional<z.ZodString>;
429
+ }, z.core.$strip>, z.ZodObject<{
430
+ type: z.ZodLiteral<"custom">;
431
+ url: z.ZodString;
432
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
433
+ }, z.core.$strip>], "type">;
434
+ createdAt: z.ZodNullable<z.ZodNumber>;
435
+ lastActivityAt: z.ZodNullable<z.ZodNumber>;
436
+ acquiringLockId: z.ZodNullable<z.ZodString>;
437
+ acquiringLockAt: z.ZodNullable<z.ZodNumber>;
438
+ providerMetadata: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
439
+ provider: z.ZodLiteral<"vercel">;
440
+ sandboxId: z.ZodNullable<z.ZodString>;
441
+ snapshotId: z.ZodNullable<z.ZodString>;
442
+ }, z.core.$strip>], "provider">>;
443
+ }, z.core.$strip>>;
444
+ };
445
+ readonly "sandbox.getBySession": {
446
+ readonly params: z.ZodObject<{
447
+ sessionId: z.ZodString;
448
+ }, z.core.$strip>;
449
+ readonly result: z.ZodNullable<z.ZodObject<{
450
+ id: z.ZodString;
451
+ config: z.ZodDiscriminatedUnion<[z.ZodObject<{
452
+ type: z.ZodLiteral<"vercel">;
453
+ resources: z.ZodOptional<z.ZodObject<{
454
+ vcpus: z.ZodNumber;
455
+ }, z.core.$strip>>;
456
+ ports: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
457
+ lifecycle: z.ZodOptional<z.ZodObject<{
458
+ stopAfterInactiveMs: z.ZodOptional<z.ZodNumber>;
459
+ snapshotBeforeTimeoutMs: z.ZodOptional<z.ZodNumber>;
460
+ snapshotId: z.ZodOptional<z.ZodString>;
461
+ autoStart: z.ZodOptional<z.ZodBoolean>;
462
+ }, z.core.$strip>>;
463
+ }, z.core.$strip>, z.ZodObject<{
464
+ type: z.ZodLiteral<"local">;
465
+ path: z.ZodOptional<z.ZodString>;
466
+ }, z.core.$strip>, z.ZodObject<{
467
+ type: z.ZodLiteral<"custom">;
468
+ url: z.ZodString;
469
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
470
+ }, z.core.$strip>], "type">;
471
+ createdAt: z.ZodNullable<z.ZodNumber>;
472
+ lastActivityAt: z.ZodNullable<z.ZodNumber>;
473
+ acquiringLockId: z.ZodNullable<z.ZodString>;
474
+ acquiringLockAt: z.ZodNullable<z.ZodNumber>;
475
+ providerMetadata: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
476
+ provider: z.ZodLiteral<"vercel">;
477
+ sandboxId: z.ZodNullable<z.ZodString>;
478
+ snapshotId: z.ZodNullable<z.ZodString>;
479
+ }, z.core.$strip>], "provider">>;
480
+ }, z.core.$strip>>;
481
+ };
482
+ readonly "sandbox.set": {
483
+ readonly params: z.ZodObject<{
484
+ id: z.ZodString;
485
+ config: z.ZodDiscriminatedUnion<[z.ZodObject<{
486
+ type: z.ZodLiteral<"vercel">;
487
+ resources: z.ZodOptional<z.ZodObject<{
488
+ vcpus: z.ZodNumber;
489
+ }, z.core.$strip>>;
490
+ ports: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
491
+ lifecycle: z.ZodOptional<z.ZodObject<{
492
+ stopAfterInactiveMs: z.ZodOptional<z.ZodNumber>;
493
+ snapshotBeforeTimeoutMs: z.ZodOptional<z.ZodNumber>;
494
+ snapshotId: z.ZodOptional<z.ZodString>;
495
+ autoStart: z.ZodOptional<z.ZodBoolean>;
496
+ }, z.core.$strip>>;
497
+ }, z.core.$strip>, z.ZodObject<{
498
+ type: z.ZodLiteral<"local">;
499
+ path: z.ZodOptional<z.ZodString>;
500
+ }, z.core.$strip>, z.ZodObject<{
501
+ type: z.ZodLiteral<"custom">;
502
+ url: z.ZodString;
503
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
504
+ }, z.core.$strip>], "type">;
505
+ createdAt: z.ZodNullable<z.ZodNumber>;
506
+ lastActivityAt: z.ZodNullable<z.ZodNumber>;
507
+ acquiringLockId: z.ZodNullable<z.ZodString>;
508
+ acquiringLockAt: z.ZodNullable<z.ZodNumber>;
509
+ providerMetadata: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
510
+ provider: z.ZodLiteral<"vercel">;
511
+ sandboxId: z.ZodNullable<z.ZodString>;
512
+ snapshotId: z.ZodNullable<z.ZodString>;
513
+ }, z.core.$strip>], "provider">>;
514
+ }, z.core.$strip>;
515
+ readonly result: z.ZodVoid;
516
+ };
517
+ readonly "command.get": {
518
+ readonly params: z.ZodObject<{
519
+ id: z.ZodString;
520
+ }, z.core.$strip>;
521
+ readonly result: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
522
+ id: z.ZodString;
523
+ sessionId: z.ZodString;
524
+ command: z.ZodString;
525
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
526
+ startedAt: z.ZodNumber;
527
+ status: z.ZodLiteral<"running">;
528
+ }, z.core.$strip>, z.ZodObject<{
529
+ id: z.ZodString;
530
+ sessionId: z.ZodString;
531
+ command: z.ZodString;
532
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
533
+ startedAt: z.ZodNumber;
534
+ status: z.ZodLiteral<"completed">;
535
+ result: z.ZodObject<{
536
+ stdout: z.ZodString;
537
+ stderr: z.ZodString;
538
+ exitCode: z.ZodNumber;
539
+ completedAt: z.ZodNumber;
540
+ }, z.core.$strip>;
541
+ }, z.core.$strip>, z.ZodObject<{
542
+ id: z.ZodString;
543
+ sessionId: z.ZodString;
544
+ command: z.ZodString;
545
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
546
+ startedAt: z.ZodNumber;
547
+ status: z.ZodLiteral<"killed">;
548
+ result: z.ZodOptional<z.ZodObject<{
549
+ stdout: z.ZodString;
550
+ stderr: z.ZodString;
551
+ exitCode: z.ZodNumber;
552
+ completedAt: z.ZodNumber;
553
+ }, z.core.$strip>>;
554
+ }, z.core.$strip>, z.ZodObject<{
555
+ id: z.ZodString;
556
+ sessionId: z.ZodString;
557
+ command: z.ZodString;
558
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
559
+ startedAt: z.ZodNumber;
560
+ status: z.ZodLiteral<"failed">;
561
+ result: z.ZodObject<{
562
+ stdout: z.ZodString;
563
+ stderr: z.ZodString;
564
+ exitCode: z.ZodNumber;
565
+ completedAt: z.ZodNumber;
566
+ }, z.core.$strip>;
567
+ }, z.core.$strip>], "status">>;
568
+ };
569
+ readonly "command.set": {
570
+ readonly params: z.ZodDiscriminatedUnion<[z.ZodObject<{
571
+ id: z.ZodString;
572
+ sessionId: z.ZodString;
573
+ command: z.ZodString;
574
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
575
+ startedAt: z.ZodNumber;
576
+ status: z.ZodLiteral<"running">;
577
+ }, z.core.$strip>, z.ZodObject<{
578
+ id: z.ZodString;
579
+ sessionId: z.ZodString;
580
+ command: z.ZodString;
581
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
582
+ startedAt: z.ZodNumber;
583
+ status: z.ZodLiteral<"completed">;
584
+ result: z.ZodObject<{
585
+ stdout: z.ZodString;
586
+ stderr: z.ZodString;
587
+ exitCode: z.ZodNumber;
588
+ completedAt: z.ZodNumber;
589
+ }, z.core.$strip>;
590
+ }, z.core.$strip>, z.ZodObject<{
591
+ id: z.ZodString;
592
+ sessionId: z.ZodString;
593
+ command: z.ZodString;
594
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
595
+ startedAt: z.ZodNumber;
596
+ status: z.ZodLiteral<"killed">;
597
+ result: z.ZodOptional<z.ZodObject<{
598
+ stdout: z.ZodString;
599
+ stderr: z.ZodString;
600
+ exitCode: z.ZodNumber;
601
+ completedAt: z.ZodNumber;
602
+ }, z.core.$strip>>;
603
+ }, z.core.$strip>, z.ZodObject<{
604
+ id: z.ZodString;
605
+ sessionId: z.ZodString;
606
+ command: z.ZodString;
607
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
608
+ startedAt: z.ZodNumber;
609
+ status: z.ZodLiteral<"failed">;
610
+ result: z.ZodObject<{
611
+ stdout: z.ZodString;
612
+ stderr: z.ZodString;
613
+ exitCode: z.ZodNumber;
614
+ completedAt: z.ZodNumber;
615
+ }, z.core.$strip>;
616
+ }, z.core.$strip>], "status">;
617
+ readonly result: z.ZodDiscriminatedUnion<[z.ZodObject<{
618
+ id: z.ZodString;
619
+ sessionId: z.ZodString;
620
+ command: z.ZodString;
621
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
622
+ startedAt: z.ZodNumber;
623
+ status: z.ZodLiteral<"running">;
624
+ }, z.core.$strip>, z.ZodObject<{
625
+ id: z.ZodString;
626
+ sessionId: z.ZodString;
627
+ command: z.ZodString;
628
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
629
+ startedAt: z.ZodNumber;
630
+ status: z.ZodLiteral<"completed">;
631
+ result: z.ZodObject<{
632
+ stdout: z.ZodString;
633
+ stderr: z.ZodString;
634
+ exitCode: z.ZodNumber;
635
+ completedAt: z.ZodNumber;
636
+ }, z.core.$strip>;
637
+ }, z.core.$strip>, z.ZodObject<{
638
+ id: z.ZodString;
639
+ sessionId: z.ZodString;
640
+ command: z.ZodString;
641
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
642
+ startedAt: z.ZodNumber;
643
+ status: z.ZodLiteral<"killed">;
644
+ result: z.ZodOptional<z.ZodObject<{
645
+ stdout: z.ZodString;
646
+ stderr: z.ZodString;
647
+ exitCode: z.ZodNumber;
648
+ completedAt: z.ZodNumber;
649
+ }, z.core.$strip>>;
650
+ }, z.core.$strip>, z.ZodObject<{
651
+ id: z.ZodString;
652
+ sessionId: z.ZodString;
653
+ command: z.ZodString;
654
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
655
+ startedAt: z.ZodNumber;
656
+ status: z.ZodLiteral<"failed">;
657
+ result: z.ZodObject<{
658
+ stdout: z.ZodString;
659
+ stderr: z.ZodString;
660
+ exitCode: z.ZodNumber;
661
+ completedAt: z.ZodNumber;
662
+ }, z.core.$strip>;
663
+ }, z.core.$strip>], "status">;
664
+ };
665
+ readonly "command.list": {
666
+ readonly params: z.ZodObject<{
667
+ sessionId: z.ZodString;
668
+ includeFinished: z.ZodOptional<z.ZodBoolean>;
669
+ cursor: z.ZodOptional<z.ZodString>;
670
+ limit: z.ZodOptional<z.ZodNumber>;
671
+ }, z.core.$strip>;
672
+ readonly result: z.ZodObject<{
673
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
674
+ id: z.ZodString;
675
+ sessionId: z.ZodString;
676
+ command: z.ZodString;
677
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
678
+ startedAt: z.ZodNumber;
679
+ status: z.ZodLiteral<"running">;
680
+ }, z.core.$strip>, z.ZodObject<{
681
+ id: z.ZodString;
682
+ sessionId: z.ZodString;
683
+ command: z.ZodString;
684
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
685
+ startedAt: z.ZodNumber;
686
+ status: z.ZodLiteral<"completed">;
687
+ result: z.ZodObject<{
688
+ stdout: z.ZodString;
689
+ stderr: z.ZodString;
690
+ exitCode: z.ZodNumber;
691
+ completedAt: z.ZodNumber;
692
+ }, z.core.$strip>;
693
+ }, z.core.$strip>, z.ZodObject<{
694
+ id: z.ZodString;
695
+ sessionId: z.ZodString;
696
+ command: z.ZodString;
697
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
698
+ startedAt: z.ZodNumber;
699
+ status: z.ZodLiteral<"killed">;
700
+ result: z.ZodOptional<z.ZodObject<{
701
+ stdout: z.ZodString;
702
+ stderr: z.ZodString;
703
+ exitCode: z.ZodNumber;
704
+ completedAt: z.ZodNumber;
705
+ }, z.core.$strip>>;
706
+ }, z.core.$strip>, z.ZodObject<{
707
+ id: z.ZodString;
708
+ sessionId: z.ZodString;
709
+ command: z.ZodString;
710
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
711
+ startedAt: z.ZodNumber;
712
+ status: z.ZodLiteral<"failed">;
713
+ result: z.ZodObject<{
714
+ stdout: z.ZodString;
715
+ stderr: z.ZodString;
716
+ exitCode: z.ZodNumber;
717
+ completedAt: z.ZodNumber;
718
+ }, z.core.$strip>;
719
+ }, z.core.$strip>], "status">>;
720
+ nextCursor: z.ZodNullable<z.ZodString>;
721
+ }, z.core.$strip>;
722
+ };
723
+ };
724
+ type StorageMethods = typeof methods;
725
+ type MethodName = keyof StorageMethods;
726
+
727
+ type Session = z.infer<typeof SessionSchema>;
728
+ type Message = z.infer<typeof MessageSchema>;
729
+ type Command = z.infer<typeof CommandSchema>;
730
+ type SandboxRecord = z.infer<typeof SandboxRecordSchema>;
731
+ type PartBase = z.infer<typeof PartSchema>;
732
+ type Part = Omit<PartBase, "part"> & {
733
+ part: UIMessage["parts"][number];
734
+ };
735
+ type ListResult<T> = {
736
+ items: T[];
737
+ nextCursor: string | null;
738
+ };
739
+ interface Storage {
740
+ session: {
741
+ get: (id: string) => Promise<SessionNotFoundError | StorageError | Session>;
742
+ set: (session: Session) => Promise<StorageError | Session>;
743
+ list: (opts?: {
744
+ tags?: Record<string, unknown>;
745
+ order?: "createdAt_asc" | "createdAt_desc" | "updatedAt_asc" | "updatedAt_desc";
746
+ cursor?: string;
747
+ limit?: number;
748
+ }) => Promise<StorageError | ListResult<Session>>;
749
+ tag: {
750
+ set: (opts: {
751
+ sessionId: string;
752
+ tags: Record<string, unknown>;
753
+ }) => Promise<StorageError | Session>;
754
+ };
755
+ };
756
+ message: {
757
+ list: (sessionId: string, opts?: {
758
+ cursor?: string;
759
+ limit?: number;
760
+ }) => Promise<StorageError | ListResult<Message>>;
761
+ get: (id: string) => Promise<StorageError | MessageNotFoundError | Message>;
762
+ set: (message: Message) => Promise<StorageError | Message>;
763
+ };
764
+ part: {
765
+ listByMessage: (messageId: string, opts?: {
766
+ cursor?: string;
767
+ limit?: number;
768
+ }) => Promise<StorageError | ListResult<Part>>;
769
+ listBySession: (sessionId: string, opts?: {
770
+ cursor?: string;
771
+ limit?: number;
772
+ }) => Promise<StorageError | ListResult<Part>>;
773
+ set: (part: Part) => Promise<StorageError | Part>;
774
+ };
775
+ sandbox: {
776
+ get: (key: string) => Promise<StorageError | SandboxRecord | SandboxNotFoundError>;
777
+ getBySession: (sessionId: string) => Promise<StorageError | SandboxRecord | SandboxNotFoundError>;
778
+ set: (opts: SandboxRecord) => Promise<StorageError | SandboxRecord>;
779
+ };
780
+ command: {
781
+ get: (id: string) => Promise<StorageError | Command | null>;
782
+ set: (command: Command) => Promise<StorageError | Command>;
783
+ list: (sessionId: string, opts?: {
784
+ includeFinished?: boolean;
785
+ cursor?: string;
786
+ limit?: number;
787
+ }) => Promise<StorageError | ListResult<Command>>;
788
+ };
789
+ }
790
+ type StorageConfig = {
791
+ type: "local";
792
+ path?: string;
793
+ } | {
794
+ type: "vercel";
795
+ } | {
796
+ type: "custom";
797
+ url: string;
798
+ headers?: Record<string, string>;
799
+ };
800
+ type ResolvedStorage = {
801
+ url: string;
802
+ headers?: Record<string, string>;
803
+ };
804
+
805
+ export { type ListResult as L, type MethodName as M, type Part as P, type ResolvedStorage as R, type StorageMethods as S, type StorageConfig as a, SessionError as b, SessionNotFoundError as c, StorageError as d, type SandboxConfig as e, type Storage as f, MessageNotFoundError as g, SandboxError as h, SandboxNotFoundError as i, type Message as j, type SandboxRecord as k, type Session as l };