@enclave-vm/types 2.12.0 → 2.13.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.
- package/esm/index.mjs +105 -6
- package/events.d.ts +151 -4
- package/index.d.ts +4 -4
- package/index.js +121 -6
- package/package.json +1 -1
- package/protocol.d.ts +26 -3
- package/schemas.d.ts +550 -51
package/schemas.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
/**
|
|
9
|
-
* Protocol version schema.
|
|
9
|
+
* Protocol version schema (accepts v1 and v2).
|
|
10
10
|
*/
|
|
11
|
-
export declare const ProtocolVersionSchema: z.ZodLiteral<1>;
|
|
11
|
+
export declare const ProtocolVersionSchema: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
12
12
|
/**
|
|
13
13
|
* Session ID schema.
|
|
14
14
|
*/
|
|
@@ -67,6 +67,9 @@ export declare const SessionLimitsSchema: z.ZodObject<{
|
|
|
67
67
|
maxToolResultBytes: z.ZodOptional<z.ZodNumber>;
|
|
68
68
|
toolTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
69
69
|
heartbeatIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
deadlineMs: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
perToolDeadlineMs: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
cancelOnFirstError: z.ZodOptional<z.ZodBoolean>;
|
|
70
73
|
}, z.core.$strip>;
|
|
71
74
|
/**
|
|
72
75
|
* Tool config schema.
|
|
@@ -81,7 +84,7 @@ export declare const ToolConfigSchema: z.ZodObject<{
|
|
|
81
84
|
* Base event schema (common fields).
|
|
82
85
|
*/
|
|
83
86
|
export declare const BaseEventSchema: z.ZodObject<{
|
|
84
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
87
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
85
88
|
sessionId: z.ZodString;
|
|
86
89
|
seq: z.ZodNumber;
|
|
87
90
|
}, z.core.$strip>;
|
|
@@ -145,6 +148,49 @@ export declare const SessionStatsSchema: z.ZodObject<{
|
|
|
145
148
|
toolCallCount: z.ZodNumber;
|
|
146
149
|
stdoutBytes: z.ZodNumber;
|
|
147
150
|
}, z.core.$strip>;
|
|
151
|
+
/**
|
|
152
|
+
* Error detail schema.
|
|
153
|
+
*/
|
|
154
|
+
export declare const ErrorDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
155
|
+
type: z.ZodLiteral<"retry_info">;
|
|
156
|
+
retryDelayMs: z.ZodNumber;
|
|
157
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
158
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
159
|
+
statusCode: z.ZodNumber;
|
|
160
|
+
url: z.ZodString;
|
|
161
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
162
|
+
type: z.ZodLiteral<"validation_info">;
|
|
163
|
+
field: z.ZodString;
|
|
164
|
+
reason: z.ZodString;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"quota_info">;
|
|
167
|
+
limit: z.ZodNumber;
|
|
168
|
+
used: z.ZodNumber;
|
|
169
|
+
}, z.core.$strip>], "type">;
|
|
170
|
+
/**
|
|
171
|
+
* Error payload schema (rich error model).
|
|
172
|
+
*/
|
|
173
|
+
export declare const ErrorPayloadSchema: z.ZodObject<{
|
|
174
|
+
code: z.ZodString;
|
|
175
|
+
message: z.ZodString;
|
|
176
|
+
path: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
177
|
+
details: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
178
|
+
type: z.ZodLiteral<"retry_info">;
|
|
179
|
+
retryDelayMs: z.ZodNumber;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
182
|
+
statusCode: z.ZodNumber;
|
|
183
|
+
url: z.ZodString;
|
|
184
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
185
|
+
type: z.ZodLiteral<"validation_info">;
|
|
186
|
+
field: z.ZodString;
|
|
187
|
+
reason: z.ZodString;
|
|
188
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
189
|
+
type: z.ZodLiteral<"quota_info">;
|
|
190
|
+
limit: z.ZodNumber;
|
|
191
|
+
used: z.ZodNumber;
|
|
192
|
+
}, z.core.$strip>], "type">>>;
|
|
193
|
+
}, z.core.$strip>;
|
|
148
194
|
/**
|
|
149
195
|
* Final payload schema.
|
|
150
196
|
*/
|
|
@@ -156,6 +202,27 @@ export declare const FinalPayloadSchema: z.ZodObject<{
|
|
|
156
202
|
code: z.ZodOptional<z.ZodString>;
|
|
157
203
|
stack: z.ZodOptional<z.ZodString>;
|
|
158
204
|
}, z.core.$strip>>;
|
|
205
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
206
|
+
code: z.ZodString;
|
|
207
|
+
message: z.ZodString;
|
|
208
|
+
path: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
|
+
details: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
210
|
+
type: z.ZodLiteral<"retry_info">;
|
|
211
|
+
retryDelayMs: z.ZodNumber;
|
|
212
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
213
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
214
|
+
statusCode: z.ZodNumber;
|
|
215
|
+
url: z.ZodString;
|
|
216
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
217
|
+
type: z.ZodLiteral<"validation_info">;
|
|
218
|
+
field: z.ZodString;
|
|
219
|
+
reason: z.ZodString;
|
|
220
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
221
|
+
type: z.ZodLiteral<"quota_info">;
|
|
222
|
+
limit: z.ZodNumber;
|
|
223
|
+
used: z.ZodNumber;
|
|
224
|
+
}, z.core.$strip>], "type">>>;
|
|
225
|
+
}, z.core.$strip>>>;
|
|
159
226
|
stats: z.ZodOptional<z.ZodObject<{
|
|
160
227
|
durationMs: z.ZodNumber;
|
|
161
228
|
toolCallCount: z.ZodNumber;
|
|
@@ -180,7 +247,7 @@ export declare const ErrorEventPayloadSchema: z.ZodObject<{
|
|
|
180
247
|
* Session init event schema.
|
|
181
248
|
*/
|
|
182
249
|
export declare const SessionInitEventSchema: z.ZodObject<{
|
|
183
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
250
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
184
251
|
sessionId: z.ZodString;
|
|
185
252
|
seq: z.ZodNumber;
|
|
186
253
|
type: z.ZodLiteral<"session_init">;
|
|
@@ -198,7 +265,7 @@ export declare const SessionInitEventSchema: z.ZodObject<{
|
|
|
198
265
|
* Stdout event schema.
|
|
199
266
|
*/
|
|
200
267
|
export declare const StdoutEventSchema: z.ZodObject<{
|
|
201
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
268
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
202
269
|
sessionId: z.ZodString;
|
|
203
270
|
seq: z.ZodNumber;
|
|
204
271
|
type: z.ZodLiteral<"stdout">;
|
|
@@ -210,7 +277,7 @@ export declare const StdoutEventSchema: z.ZodObject<{
|
|
|
210
277
|
* Log event schema.
|
|
211
278
|
*/
|
|
212
279
|
export declare const LogEventSchema: z.ZodObject<{
|
|
213
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
280
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
214
281
|
sessionId: z.ZodString;
|
|
215
282
|
seq: z.ZodNumber;
|
|
216
283
|
type: z.ZodLiteral<"log">;
|
|
@@ -229,7 +296,7 @@ export declare const LogEventSchema: z.ZodObject<{
|
|
|
229
296
|
* Tool call event schema.
|
|
230
297
|
*/
|
|
231
298
|
export declare const ToolCallEventSchema: z.ZodObject<{
|
|
232
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
299
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
233
300
|
sessionId: z.ZodString;
|
|
234
301
|
seq: z.ZodNumber;
|
|
235
302
|
type: z.ZodLiteral<"tool_call">;
|
|
@@ -243,7 +310,7 @@ export declare const ToolCallEventSchema: z.ZodObject<{
|
|
|
243
310
|
* Tool result applied event schema.
|
|
244
311
|
*/
|
|
245
312
|
export declare const ToolResultAppliedEventSchema: z.ZodObject<{
|
|
246
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
313
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
247
314
|
sessionId: z.ZodString;
|
|
248
315
|
seq: z.ZodNumber;
|
|
249
316
|
type: z.ZodLiteral<"tool_result_applied">;
|
|
@@ -255,7 +322,7 @@ export declare const ToolResultAppliedEventSchema: z.ZodObject<{
|
|
|
255
322
|
* Final event schema.
|
|
256
323
|
*/
|
|
257
324
|
export declare const FinalEventSchema: z.ZodObject<{
|
|
258
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
325
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
259
326
|
sessionId: z.ZodString;
|
|
260
327
|
seq: z.ZodNumber;
|
|
261
328
|
type: z.ZodLiteral<"final">;
|
|
@@ -267,6 +334,27 @@ export declare const FinalEventSchema: z.ZodObject<{
|
|
|
267
334
|
code: z.ZodOptional<z.ZodString>;
|
|
268
335
|
stack: z.ZodOptional<z.ZodString>;
|
|
269
336
|
}, z.core.$strip>>;
|
|
337
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
338
|
+
code: z.ZodString;
|
|
339
|
+
message: z.ZodString;
|
|
340
|
+
path: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
341
|
+
details: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
342
|
+
type: z.ZodLiteral<"retry_info">;
|
|
343
|
+
retryDelayMs: z.ZodNumber;
|
|
344
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
345
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
346
|
+
statusCode: z.ZodNumber;
|
|
347
|
+
url: z.ZodString;
|
|
348
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
349
|
+
type: z.ZodLiteral<"validation_info">;
|
|
350
|
+
field: z.ZodString;
|
|
351
|
+
reason: z.ZodString;
|
|
352
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
353
|
+
type: z.ZodLiteral<"quota_info">;
|
|
354
|
+
limit: z.ZodNumber;
|
|
355
|
+
used: z.ZodNumber;
|
|
356
|
+
}, z.core.$strip>], "type">>>;
|
|
357
|
+
}, z.core.$strip>>>;
|
|
270
358
|
stats: z.ZodOptional<z.ZodObject<{
|
|
271
359
|
durationMs: z.ZodNumber;
|
|
272
360
|
toolCallCount: z.ZodNumber;
|
|
@@ -278,7 +366,7 @@ export declare const FinalEventSchema: z.ZodObject<{
|
|
|
278
366
|
* Heartbeat event schema.
|
|
279
367
|
*/
|
|
280
368
|
export declare const HeartbeatEventSchema: z.ZodObject<{
|
|
281
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
369
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
282
370
|
sessionId: z.ZodString;
|
|
283
371
|
seq: z.ZodNumber;
|
|
284
372
|
type: z.ZodLiteral<"heartbeat">;
|
|
@@ -290,7 +378,7 @@ export declare const HeartbeatEventSchema: z.ZodObject<{
|
|
|
290
378
|
* Error event schema.
|
|
291
379
|
*/
|
|
292
380
|
export declare const ErrorEventSchema: z.ZodObject<{
|
|
293
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
381
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
294
382
|
sessionId: z.ZodString;
|
|
295
383
|
seq: z.ZodNumber;
|
|
296
384
|
type: z.ZodLiteral<"error">;
|
|
@@ -300,11 +388,162 @@ export declare const ErrorEventSchema: z.ZodObject<{
|
|
|
300
388
|
recoverable: z.ZodOptional<z.ZodBoolean>;
|
|
301
389
|
}, z.core.$strip>;
|
|
302
390
|
}, z.core.$strip>;
|
|
391
|
+
/**
|
|
392
|
+
* Partial result payload schema.
|
|
393
|
+
*/
|
|
394
|
+
export declare const PartialResultPayloadSchema: z.ZodObject<{
|
|
395
|
+
path: z.ZodArray<z.ZodString>;
|
|
396
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
397
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
398
|
+
code: z.ZodString;
|
|
399
|
+
message: z.ZodString;
|
|
400
|
+
path: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
401
|
+
details: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
402
|
+
type: z.ZodLiteral<"retry_info">;
|
|
403
|
+
retryDelayMs: z.ZodNumber;
|
|
404
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
405
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
406
|
+
statusCode: z.ZodNumber;
|
|
407
|
+
url: z.ZodString;
|
|
408
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
409
|
+
type: z.ZodLiteral<"validation_info">;
|
|
410
|
+
field: z.ZodString;
|
|
411
|
+
reason: z.ZodString;
|
|
412
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
413
|
+
type: z.ZodLiteral<"quota_info">;
|
|
414
|
+
limit: z.ZodNumber;
|
|
415
|
+
used: z.ZodNumber;
|
|
416
|
+
}, z.core.$strip>], "type">>>;
|
|
417
|
+
}, z.core.$strip>>;
|
|
418
|
+
hasNext: z.ZodBoolean;
|
|
419
|
+
}, z.core.$strip>;
|
|
420
|
+
/**
|
|
421
|
+
* Partial result event schema.
|
|
422
|
+
*/
|
|
423
|
+
export declare const PartialResultEventSchema: z.ZodObject<{
|
|
424
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
425
|
+
sessionId: z.ZodString;
|
|
426
|
+
seq: z.ZodNumber;
|
|
427
|
+
type: z.ZodLiteral<"partial_result">;
|
|
428
|
+
payload: z.ZodObject<{
|
|
429
|
+
path: z.ZodArray<z.ZodString>;
|
|
430
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
431
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
432
|
+
code: z.ZodString;
|
|
433
|
+
message: z.ZodString;
|
|
434
|
+
path: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
435
|
+
details: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
436
|
+
type: z.ZodLiteral<"retry_info">;
|
|
437
|
+
retryDelayMs: z.ZodNumber;
|
|
438
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
439
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
440
|
+
statusCode: z.ZodNumber;
|
|
441
|
+
url: z.ZodString;
|
|
442
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
443
|
+
type: z.ZodLiteral<"validation_info">;
|
|
444
|
+
field: z.ZodString;
|
|
445
|
+
reason: z.ZodString;
|
|
446
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
447
|
+
type: z.ZodLiteral<"quota_info">;
|
|
448
|
+
limit: z.ZodNumber;
|
|
449
|
+
used: z.ZodNumber;
|
|
450
|
+
}, z.core.$strip>], "type">>>;
|
|
451
|
+
}, z.core.$strip>>;
|
|
452
|
+
hasNext: z.ZodBoolean;
|
|
453
|
+
}, z.core.$strip>;
|
|
454
|
+
}, z.core.$strip>;
|
|
455
|
+
/**
|
|
456
|
+
* Tool progress phase schema.
|
|
457
|
+
*/
|
|
458
|
+
export declare const ToolProgressPhaseSchema: z.ZodEnum<{
|
|
459
|
+
connecting: "connecting";
|
|
460
|
+
sending: "sending";
|
|
461
|
+
receiving: "receiving";
|
|
462
|
+
processing: "processing";
|
|
463
|
+
}>;
|
|
464
|
+
/**
|
|
465
|
+
* Tool progress payload schema.
|
|
466
|
+
*/
|
|
467
|
+
export declare const ToolProgressPayloadSchema: z.ZodObject<{
|
|
468
|
+
callId: z.ZodString;
|
|
469
|
+
phase: z.ZodEnum<{
|
|
470
|
+
connecting: "connecting";
|
|
471
|
+
sending: "sending";
|
|
472
|
+
receiving: "receiving";
|
|
473
|
+
processing: "processing";
|
|
474
|
+
}>;
|
|
475
|
+
bytesReceived: z.ZodOptional<z.ZodNumber>;
|
|
476
|
+
totalBytes: z.ZodOptional<z.ZodNumber>;
|
|
477
|
+
elapsedMs: z.ZodNumber;
|
|
478
|
+
}, z.core.$strip>;
|
|
479
|
+
/**
|
|
480
|
+
* Tool progress event schema.
|
|
481
|
+
*/
|
|
482
|
+
export declare const ToolProgressEventSchema: z.ZodObject<{
|
|
483
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
484
|
+
sessionId: z.ZodString;
|
|
485
|
+
seq: z.ZodNumber;
|
|
486
|
+
type: z.ZodLiteral<"tool_progress">;
|
|
487
|
+
payload: z.ZodObject<{
|
|
488
|
+
callId: z.ZodString;
|
|
489
|
+
phase: z.ZodEnum<{
|
|
490
|
+
connecting: "connecting";
|
|
491
|
+
sending: "sending";
|
|
492
|
+
receiving: "receiving";
|
|
493
|
+
processing: "processing";
|
|
494
|
+
}>;
|
|
495
|
+
bytesReceived: z.ZodOptional<z.ZodNumber>;
|
|
496
|
+
totalBytes: z.ZodOptional<z.ZodNumber>;
|
|
497
|
+
elapsedMs: z.ZodNumber;
|
|
498
|
+
}, z.core.$strip>;
|
|
499
|
+
}, z.core.$strip>;
|
|
500
|
+
/**
|
|
501
|
+
* Deadline exceeded payload schema.
|
|
502
|
+
*/
|
|
503
|
+
export declare const DeadlineExceededPayloadSchema: z.ZodObject<{
|
|
504
|
+
elapsedMs: z.ZodNumber;
|
|
505
|
+
budgetMs: z.ZodNumber;
|
|
506
|
+
}, z.core.$strip>;
|
|
507
|
+
/**
|
|
508
|
+
* Deadline exceeded event schema.
|
|
509
|
+
*/
|
|
510
|
+
export declare const DeadlineExceededEventSchema: z.ZodObject<{
|
|
511
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
512
|
+
sessionId: z.ZodString;
|
|
513
|
+
seq: z.ZodNumber;
|
|
514
|
+
type: z.ZodLiteral<"deadline_exceeded">;
|
|
515
|
+
payload: z.ZodObject<{
|
|
516
|
+
elapsedMs: z.ZodNumber;
|
|
517
|
+
budgetMs: z.ZodNumber;
|
|
518
|
+
}, z.core.$strip>;
|
|
519
|
+
}, z.core.$strip>;
|
|
520
|
+
/**
|
|
521
|
+
* Catalog changed payload schema.
|
|
522
|
+
*/
|
|
523
|
+
export declare const CatalogChangedPayloadSchema: z.ZodObject<{
|
|
524
|
+
version: z.ZodString;
|
|
525
|
+
addedActions: z.ZodArray<z.ZodString>;
|
|
526
|
+
removedActions: z.ZodArray<z.ZodString>;
|
|
527
|
+
}, z.core.$strip>;
|
|
528
|
+
/**
|
|
529
|
+
* Catalog changed event schema.
|
|
530
|
+
*/
|
|
531
|
+
export declare const CatalogChangedEventSchema: z.ZodObject<{
|
|
532
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
533
|
+
sessionId: z.ZodString;
|
|
534
|
+
seq: z.ZodNumber;
|
|
535
|
+
type: z.ZodLiteral<"catalog_changed">;
|
|
536
|
+
payload: z.ZodObject<{
|
|
537
|
+
version: z.ZodString;
|
|
538
|
+
addedActions: z.ZodArray<z.ZodString>;
|
|
539
|
+
removedActions: z.ZodArray<z.ZodString>;
|
|
540
|
+
}, z.core.$strip>;
|
|
541
|
+
}, z.core.$strip>;
|
|
303
542
|
/**
|
|
304
543
|
* Stream event union schema.
|
|
305
544
|
*/
|
|
306
545
|
export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
307
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
546
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
308
547
|
sessionId: z.ZodString;
|
|
309
548
|
seq: z.ZodNumber;
|
|
310
549
|
type: z.ZodLiteral<"session_init">;
|
|
@@ -318,7 +557,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
318
557
|
replayUrl: z.ZodOptional<z.ZodString>;
|
|
319
558
|
}, z.core.$strip>;
|
|
320
559
|
}, z.core.$strip>, z.ZodObject<{
|
|
321
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
560
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
322
561
|
sessionId: z.ZodString;
|
|
323
562
|
seq: z.ZodNumber;
|
|
324
563
|
type: z.ZodLiteral<"stdout">;
|
|
@@ -326,7 +565,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
326
565
|
chunk: z.ZodString;
|
|
327
566
|
}, z.core.$strip>;
|
|
328
567
|
}, z.core.$strip>, z.ZodObject<{
|
|
329
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
568
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
330
569
|
sessionId: z.ZodString;
|
|
331
570
|
seq: z.ZodNumber;
|
|
332
571
|
type: z.ZodLiteral<"log">;
|
|
@@ -341,7 +580,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
341
580
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
342
581
|
}, z.core.$strip>;
|
|
343
582
|
}, z.core.$strip>, z.ZodObject<{
|
|
344
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
583
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
345
584
|
sessionId: z.ZodString;
|
|
346
585
|
seq: z.ZodNumber;
|
|
347
586
|
type: z.ZodLiteral<"tool_call">;
|
|
@@ -351,7 +590,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
351
590
|
args: z.ZodUnknown;
|
|
352
591
|
}, z.core.$strip>;
|
|
353
592
|
}, z.core.$strip>, z.ZodObject<{
|
|
354
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
593
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
355
594
|
sessionId: z.ZodString;
|
|
356
595
|
seq: z.ZodNumber;
|
|
357
596
|
type: z.ZodLiteral<"tool_result_applied">;
|
|
@@ -359,7 +598,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
359
598
|
callId: z.ZodString;
|
|
360
599
|
}, z.core.$strip>;
|
|
361
600
|
}, z.core.$strip>, z.ZodObject<{
|
|
362
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
601
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
363
602
|
sessionId: z.ZodString;
|
|
364
603
|
seq: z.ZodNumber;
|
|
365
604
|
type: z.ZodLiteral<"final">;
|
|
@@ -371,6 +610,27 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
371
610
|
code: z.ZodOptional<z.ZodString>;
|
|
372
611
|
stack: z.ZodOptional<z.ZodString>;
|
|
373
612
|
}, z.core.$strip>>;
|
|
613
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
614
|
+
code: z.ZodString;
|
|
615
|
+
message: z.ZodString;
|
|
616
|
+
path: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
617
|
+
details: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
618
|
+
type: z.ZodLiteral<"retry_info">;
|
|
619
|
+
retryDelayMs: z.ZodNumber;
|
|
620
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
621
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
622
|
+
statusCode: z.ZodNumber;
|
|
623
|
+
url: z.ZodString;
|
|
624
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
625
|
+
type: z.ZodLiteral<"validation_info">;
|
|
626
|
+
field: z.ZodString;
|
|
627
|
+
reason: z.ZodString;
|
|
628
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
629
|
+
type: z.ZodLiteral<"quota_info">;
|
|
630
|
+
limit: z.ZodNumber;
|
|
631
|
+
used: z.ZodNumber;
|
|
632
|
+
}, z.core.$strip>], "type">>>;
|
|
633
|
+
}, z.core.$strip>>>;
|
|
374
634
|
stats: z.ZodOptional<z.ZodObject<{
|
|
375
635
|
durationMs: z.ZodNumber;
|
|
376
636
|
toolCallCount: z.ZodNumber;
|
|
@@ -378,7 +638,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
378
638
|
}, z.core.$strip>>;
|
|
379
639
|
}, z.core.$strip>;
|
|
380
640
|
}, z.core.$strip>, z.ZodObject<{
|
|
381
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
641
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
382
642
|
sessionId: z.ZodString;
|
|
383
643
|
seq: z.ZodNumber;
|
|
384
644
|
type: z.ZodLiteral<"heartbeat">;
|
|
@@ -386,7 +646,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
386
646
|
ts: z.ZodString;
|
|
387
647
|
}, z.core.$strip>;
|
|
388
648
|
}, z.core.$strip>, z.ZodObject<{
|
|
389
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
649
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
390
650
|
sessionId: z.ZodString;
|
|
391
651
|
seq: z.ZodNumber;
|
|
392
652
|
type: z.ZodLiteral<"error">;
|
|
@@ -395,6 +655,73 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
395
655
|
code: z.ZodOptional<z.ZodString>;
|
|
396
656
|
recoverable: z.ZodOptional<z.ZodBoolean>;
|
|
397
657
|
}, z.core.$strip>;
|
|
658
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
659
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
660
|
+
sessionId: z.ZodString;
|
|
661
|
+
seq: z.ZodNumber;
|
|
662
|
+
type: z.ZodLiteral<"partial_result">;
|
|
663
|
+
payload: z.ZodObject<{
|
|
664
|
+
path: z.ZodArray<z.ZodString>;
|
|
665
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
666
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
667
|
+
code: z.ZodString;
|
|
668
|
+
message: z.ZodString;
|
|
669
|
+
path: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
670
|
+
details: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
671
|
+
type: z.ZodLiteral<"retry_info">;
|
|
672
|
+
retryDelayMs: z.ZodNumber;
|
|
673
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
674
|
+
type: z.ZodLiteral<"upstream_info">;
|
|
675
|
+
statusCode: z.ZodNumber;
|
|
676
|
+
url: z.ZodString;
|
|
677
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
678
|
+
type: z.ZodLiteral<"validation_info">;
|
|
679
|
+
field: z.ZodString;
|
|
680
|
+
reason: z.ZodString;
|
|
681
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
682
|
+
type: z.ZodLiteral<"quota_info">;
|
|
683
|
+
limit: z.ZodNumber;
|
|
684
|
+
used: z.ZodNumber;
|
|
685
|
+
}, z.core.$strip>], "type">>>;
|
|
686
|
+
}, z.core.$strip>>;
|
|
687
|
+
hasNext: z.ZodBoolean;
|
|
688
|
+
}, z.core.$strip>;
|
|
689
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
690
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
691
|
+
sessionId: z.ZodString;
|
|
692
|
+
seq: z.ZodNumber;
|
|
693
|
+
type: z.ZodLiteral<"tool_progress">;
|
|
694
|
+
payload: z.ZodObject<{
|
|
695
|
+
callId: z.ZodString;
|
|
696
|
+
phase: z.ZodEnum<{
|
|
697
|
+
connecting: "connecting";
|
|
698
|
+
sending: "sending";
|
|
699
|
+
receiving: "receiving";
|
|
700
|
+
processing: "processing";
|
|
701
|
+
}>;
|
|
702
|
+
bytesReceived: z.ZodOptional<z.ZodNumber>;
|
|
703
|
+
totalBytes: z.ZodOptional<z.ZodNumber>;
|
|
704
|
+
elapsedMs: z.ZodNumber;
|
|
705
|
+
}, z.core.$strip>;
|
|
706
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
707
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
708
|
+
sessionId: z.ZodString;
|
|
709
|
+
seq: z.ZodNumber;
|
|
710
|
+
type: z.ZodLiteral<"deadline_exceeded">;
|
|
711
|
+
payload: z.ZodObject<{
|
|
712
|
+
elapsedMs: z.ZodNumber;
|
|
713
|
+
budgetMs: z.ZodNumber;
|
|
714
|
+
}, z.core.$strip>;
|
|
715
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
716
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
717
|
+
sessionId: z.ZodString;
|
|
718
|
+
seq: z.ZodNumber;
|
|
719
|
+
type: z.ZodLiteral<"catalog_changed">;
|
|
720
|
+
payload: z.ZodObject<{
|
|
721
|
+
version: z.ZodString;
|
|
722
|
+
addedActions: z.ZodArray<z.ZodString>;
|
|
723
|
+
removedActions: z.ZodArray<z.ZodString>;
|
|
724
|
+
}, z.core.$strip>;
|
|
398
725
|
}, z.core.$strip>], "type">;
|
|
399
726
|
/**
|
|
400
727
|
* Supported curve schema.
|
|
@@ -435,7 +762,7 @@ export declare const EncryptedEnvelopePayloadSchema: z.ZodObject<{
|
|
|
435
762
|
* Encrypted envelope schema.
|
|
436
763
|
*/
|
|
437
764
|
export declare const EncryptedEnvelopeSchema: z.ZodObject<{
|
|
438
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
765
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
439
766
|
sessionId: z.ZodString;
|
|
440
767
|
seq: z.ZodNumber;
|
|
441
768
|
type: z.ZodLiteral<"enc">;
|
|
@@ -450,7 +777,7 @@ export declare const EncryptedEnvelopeSchema: z.ZodObject<{
|
|
|
450
777
|
* Client hello schema.
|
|
451
778
|
*/
|
|
452
779
|
export declare const ClientHelloSchema: z.ZodObject<{
|
|
453
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
780
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
454
781
|
clientEphemeralPubKeyB64: z.ZodString;
|
|
455
782
|
curve: z.ZodEnum<{
|
|
456
783
|
"P-256": "P-256";
|
|
@@ -463,7 +790,7 @@ export declare const ClientHelloSchema: z.ZodObject<{
|
|
|
463
790
|
* Server hello schema.
|
|
464
791
|
*/
|
|
465
792
|
export declare const ServerHelloSchema: z.ZodObject<{
|
|
466
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
793
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
467
794
|
serverEphemeralPubKeyB64: z.ZodString;
|
|
468
795
|
curve: z.ZodEnum<{
|
|
469
796
|
"P-256": "P-256";
|
|
@@ -487,7 +814,7 @@ export declare const EncryptionRequestSchema: z.ZodObject<{
|
|
|
487
814
|
required: "required";
|
|
488
815
|
}>;
|
|
489
816
|
clientHello: z.ZodOptional<z.ZodObject<{
|
|
490
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
817
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
491
818
|
clientEphemeralPubKeyB64: z.ZodString;
|
|
492
819
|
curve: z.ZodEnum<{
|
|
493
820
|
"P-256": "P-256";
|
|
@@ -514,7 +841,7 @@ export declare const ToolResultSubmitPayloadSchema: z.ZodObject<{
|
|
|
514
841
|
* Tool result submit message schema.
|
|
515
842
|
*/
|
|
516
843
|
export declare const ToolResultSubmitMessageSchema: z.ZodObject<{
|
|
517
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
844
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
518
845
|
sessionId: z.ZodString;
|
|
519
846
|
type: z.ZodLiteral<"tool_result_submit">;
|
|
520
847
|
payload: z.ZodObject<{
|
|
@@ -538,7 +865,7 @@ export declare const CancelPayloadSchema: z.ZodObject<{
|
|
|
538
865
|
* Cancel message schema.
|
|
539
866
|
*/
|
|
540
867
|
export declare const CancelMessageSchema: z.ZodObject<{
|
|
541
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
868
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
542
869
|
sessionId: z.ZodString;
|
|
543
870
|
type: z.ZodLiteral<"cancel">;
|
|
544
871
|
payload: z.ZodObject<{
|
|
@@ -549,7 +876,7 @@ export declare const CancelMessageSchema: z.ZodObject<{
|
|
|
549
876
|
* Runtime channel message union schema.
|
|
550
877
|
*/
|
|
551
878
|
export declare const RuntimeChannelMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
552
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
879
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
553
880
|
sessionId: z.ZodString;
|
|
554
881
|
type: z.ZodLiteral<"tool_result_submit">;
|
|
555
882
|
payload: z.ZodObject<{
|
|
@@ -563,7 +890,7 @@ export declare const RuntimeChannelMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
563
890
|
}, z.core.$strip>>;
|
|
564
891
|
}, z.core.$strip>;
|
|
565
892
|
}, z.core.$strip>, z.ZodObject<{
|
|
566
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
893
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
567
894
|
sessionId: z.ZodString;
|
|
568
895
|
type: z.ZodLiteral<"cancel">;
|
|
569
896
|
payload: z.ZodObject<{
|
|
@@ -574,7 +901,7 @@ export declare const RuntimeChannelMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
574
901
|
* Session creation request schema.
|
|
575
902
|
*/
|
|
576
903
|
export declare const CreateSessionRequestSchema: z.ZodObject<{
|
|
577
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
904
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
578
905
|
code: z.ZodString;
|
|
579
906
|
limits: z.ZodOptional<z.ZodObject<{
|
|
580
907
|
sessionTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -583,6 +910,9 @@ export declare const CreateSessionRequestSchema: z.ZodObject<{
|
|
|
583
910
|
maxToolResultBytes: z.ZodOptional<z.ZodNumber>;
|
|
584
911
|
toolTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
585
912
|
heartbeatIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
913
|
+
deadlineMs: z.ZodOptional<z.ZodNumber>;
|
|
914
|
+
perToolDeadlineMs: z.ZodOptional<z.ZodNumber>;
|
|
915
|
+
cancelOnFirstError: z.ZodOptional<z.ZodBoolean>;
|
|
586
916
|
}, z.core.$strip>>;
|
|
587
917
|
encryption: z.ZodOptional<z.ZodObject<{
|
|
588
918
|
mode: z.ZodEnum<{
|
|
@@ -591,7 +921,7 @@ export declare const CreateSessionRequestSchema: z.ZodObject<{
|
|
|
591
921
|
required: "required";
|
|
592
922
|
}>;
|
|
593
923
|
clientHello: z.ZodOptional<z.ZodObject<{
|
|
594
|
-
protocolVersion: z.ZodLiteral<1>;
|
|
924
|
+
protocolVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<1>]>;
|
|
595
925
|
clientEphemeralPubKeyB64: z.ZodString;
|
|
596
926
|
curve: z.ZodEnum<{
|
|
597
927
|
"P-256": "P-256";
|
|
@@ -606,7 +936,7 @@ export declare const CreateSessionRequestSchema: z.ZodObject<{
|
|
|
606
936
|
* Parse and validate a stream event.
|
|
607
937
|
*/
|
|
608
938
|
export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
609
|
-
protocolVersion: 1;
|
|
939
|
+
protocolVersion: 2 | 1;
|
|
610
940
|
sessionId: string;
|
|
611
941
|
seq: number;
|
|
612
942
|
type: "session_init";
|
|
@@ -620,7 +950,7 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
620
950
|
replayUrl?: string | undefined;
|
|
621
951
|
};
|
|
622
952
|
} | {
|
|
623
|
-
protocolVersion: 1;
|
|
953
|
+
protocolVersion: 2 | 1;
|
|
624
954
|
sessionId: string;
|
|
625
955
|
seq: number;
|
|
626
956
|
type: "stdout";
|
|
@@ -628,7 +958,7 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
628
958
|
chunk: string;
|
|
629
959
|
};
|
|
630
960
|
} | {
|
|
631
|
-
protocolVersion: 1;
|
|
961
|
+
protocolVersion: 2 | 1;
|
|
632
962
|
sessionId: string;
|
|
633
963
|
seq: number;
|
|
634
964
|
type: "log";
|
|
@@ -638,7 +968,7 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
638
968
|
data?: Record<string, unknown> | undefined;
|
|
639
969
|
};
|
|
640
970
|
} | {
|
|
641
|
-
protocolVersion: 1;
|
|
971
|
+
protocolVersion: 2 | 1;
|
|
642
972
|
sessionId: string;
|
|
643
973
|
seq: number;
|
|
644
974
|
type: "tool_call";
|
|
@@ -648,7 +978,7 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
648
978
|
args: unknown;
|
|
649
979
|
};
|
|
650
980
|
} | {
|
|
651
|
-
protocolVersion: 1;
|
|
981
|
+
protocolVersion: 2 | 1;
|
|
652
982
|
sessionId: string;
|
|
653
983
|
seq: number;
|
|
654
984
|
type: "tool_result_applied";
|
|
@@ -656,7 +986,7 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
656
986
|
callId: string;
|
|
657
987
|
};
|
|
658
988
|
} | {
|
|
659
|
-
protocolVersion: 1;
|
|
989
|
+
protocolVersion: 2 | 1;
|
|
660
990
|
sessionId: string;
|
|
661
991
|
seq: number;
|
|
662
992
|
type: "final";
|
|
@@ -668,6 +998,27 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
668
998
|
code?: string | undefined;
|
|
669
999
|
stack?: string | undefined;
|
|
670
1000
|
} | undefined;
|
|
1001
|
+
errors?: {
|
|
1002
|
+
code: string;
|
|
1003
|
+
message: string;
|
|
1004
|
+
path?: string[] | undefined;
|
|
1005
|
+
details?: ({
|
|
1006
|
+
type: "retry_info";
|
|
1007
|
+
retryDelayMs: number;
|
|
1008
|
+
} | {
|
|
1009
|
+
type: "upstream_info";
|
|
1010
|
+
statusCode: number;
|
|
1011
|
+
url: string;
|
|
1012
|
+
} | {
|
|
1013
|
+
type: "validation_info";
|
|
1014
|
+
field: string;
|
|
1015
|
+
reason: string;
|
|
1016
|
+
} | {
|
|
1017
|
+
type: "quota_info";
|
|
1018
|
+
limit: number;
|
|
1019
|
+
used: number;
|
|
1020
|
+
})[] | undefined;
|
|
1021
|
+
}[] | undefined;
|
|
671
1022
|
stats?: {
|
|
672
1023
|
durationMs: number;
|
|
673
1024
|
toolCallCount: number;
|
|
@@ -675,7 +1026,7 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
675
1026
|
} | undefined;
|
|
676
1027
|
};
|
|
677
1028
|
} | {
|
|
678
|
-
protocolVersion: 1;
|
|
1029
|
+
protocolVersion: 2 | 1;
|
|
679
1030
|
sessionId: string;
|
|
680
1031
|
seq: number;
|
|
681
1032
|
type: "heartbeat";
|
|
@@ -683,7 +1034,7 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
683
1034
|
ts: string;
|
|
684
1035
|
};
|
|
685
1036
|
} | {
|
|
686
|
-
protocolVersion: 1;
|
|
1037
|
+
protocolVersion: 2 | 1;
|
|
687
1038
|
sessionId: string;
|
|
688
1039
|
seq: number;
|
|
689
1040
|
type: "error";
|
|
@@ -692,12 +1043,74 @@ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
|
692
1043
|
code?: string | undefined;
|
|
693
1044
|
recoverable?: boolean | undefined;
|
|
694
1045
|
};
|
|
1046
|
+
} | {
|
|
1047
|
+
protocolVersion: 2 | 1;
|
|
1048
|
+
sessionId: string;
|
|
1049
|
+
seq: number;
|
|
1050
|
+
type: "partial_result";
|
|
1051
|
+
payload: {
|
|
1052
|
+
path: string[];
|
|
1053
|
+
hasNext: boolean;
|
|
1054
|
+
data?: unknown;
|
|
1055
|
+
error?: {
|
|
1056
|
+
code: string;
|
|
1057
|
+
message: string;
|
|
1058
|
+
path?: string[] | undefined;
|
|
1059
|
+
details?: ({
|
|
1060
|
+
type: "retry_info";
|
|
1061
|
+
retryDelayMs: number;
|
|
1062
|
+
} | {
|
|
1063
|
+
type: "upstream_info";
|
|
1064
|
+
statusCode: number;
|
|
1065
|
+
url: string;
|
|
1066
|
+
} | {
|
|
1067
|
+
type: "validation_info";
|
|
1068
|
+
field: string;
|
|
1069
|
+
reason: string;
|
|
1070
|
+
} | {
|
|
1071
|
+
type: "quota_info";
|
|
1072
|
+
limit: number;
|
|
1073
|
+
used: number;
|
|
1074
|
+
})[] | undefined;
|
|
1075
|
+
} | undefined;
|
|
1076
|
+
};
|
|
1077
|
+
} | {
|
|
1078
|
+
protocolVersion: 2 | 1;
|
|
1079
|
+
sessionId: string;
|
|
1080
|
+
seq: number;
|
|
1081
|
+
type: "tool_progress";
|
|
1082
|
+
payload: {
|
|
1083
|
+
callId: string;
|
|
1084
|
+
phase: "connecting" | "sending" | "receiving" | "processing";
|
|
1085
|
+
elapsedMs: number;
|
|
1086
|
+
bytesReceived?: number | undefined;
|
|
1087
|
+
totalBytes?: number | undefined;
|
|
1088
|
+
};
|
|
1089
|
+
} | {
|
|
1090
|
+
protocolVersion: 2 | 1;
|
|
1091
|
+
sessionId: string;
|
|
1092
|
+
seq: number;
|
|
1093
|
+
type: "deadline_exceeded";
|
|
1094
|
+
payload: {
|
|
1095
|
+
elapsedMs: number;
|
|
1096
|
+
budgetMs: number;
|
|
1097
|
+
};
|
|
1098
|
+
} | {
|
|
1099
|
+
protocolVersion: 2 | 1;
|
|
1100
|
+
sessionId: string;
|
|
1101
|
+
seq: number;
|
|
1102
|
+
type: "catalog_changed";
|
|
1103
|
+
payload: {
|
|
1104
|
+
version: string;
|
|
1105
|
+
addedActions: string[];
|
|
1106
|
+
removedActions: string[];
|
|
1107
|
+
};
|
|
695
1108
|
}>;
|
|
696
1109
|
/**
|
|
697
1110
|
* Parse and validate an encrypted envelope.
|
|
698
1111
|
*/
|
|
699
1112
|
export declare function parseEncryptedEnvelope(data: unknown): z.ZodSafeParseResult<{
|
|
700
|
-
protocolVersion: 1;
|
|
1113
|
+
protocolVersion: 2 | 1;
|
|
701
1114
|
sessionId: string;
|
|
702
1115
|
seq: number;
|
|
703
1116
|
type: "enc";
|
|
@@ -712,7 +1125,7 @@ export declare function parseEncryptedEnvelope(data: unknown): z.ZodSafeParseRes
|
|
|
712
1125
|
* Parse and validate a runtime channel message.
|
|
713
1126
|
*/
|
|
714
1127
|
export declare function parseRuntimeChannelMessage(data: unknown): z.ZodSafeParseResult<{
|
|
715
|
-
protocolVersion: 1;
|
|
1128
|
+
protocolVersion: 2 | 1;
|
|
716
1129
|
sessionId: string;
|
|
717
1130
|
type: "tool_result_submit";
|
|
718
1131
|
payload: {
|
|
@@ -726,7 +1139,7 @@ export declare function parseRuntimeChannelMessage(data: unknown): z.ZodSafePars
|
|
|
726
1139
|
} | undefined;
|
|
727
1140
|
};
|
|
728
1141
|
} | {
|
|
729
|
-
protocolVersion: 1;
|
|
1142
|
+
protocolVersion: 2 | 1;
|
|
730
1143
|
sessionId: string;
|
|
731
1144
|
type: "cancel";
|
|
732
1145
|
payload: {
|
|
@@ -737,7 +1150,7 @@ export declare function parseRuntimeChannelMessage(data: unknown): z.ZodSafePars
|
|
|
737
1150
|
* Parse and validate a session creation request.
|
|
738
1151
|
*/
|
|
739
1152
|
export declare function parseCreateSessionRequest(data: unknown): z.ZodSafeParseResult<{
|
|
740
|
-
protocolVersion: 1;
|
|
1153
|
+
protocolVersion: 2 | 1;
|
|
741
1154
|
code: string;
|
|
742
1155
|
limits?: {
|
|
743
1156
|
sessionTtlMs?: number | undefined;
|
|
@@ -746,11 +1159,14 @@ export declare function parseCreateSessionRequest(data: unknown): z.ZodSafeParse
|
|
|
746
1159
|
maxToolResultBytes?: number | undefined;
|
|
747
1160
|
toolTimeoutMs?: number | undefined;
|
|
748
1161
|
heartbeatIntervalMs?: number | undefined;
|
|
1162
|
+
deadlineMs?: number | undefined;
|
|
1163
|
+
perToolDeadlineMs?: number | undefined;
|
|
1164
|
+
cancelOnFirstError?: boolean | undefined;
|
|
749
1165
|
} | undefined;
|
|
750
1166
|
encryption?: {
|
|
751
1167
|
mode: "disabled" | "optional" | "required";
|
|
752
1168
|
clientHello?: {
|
|
753
|
-
protocolVersion: 1;
|
|
1169
|
+
protocolVersion: 2 | 1;
|
|
754
1170
|
clientEphemeralPubKeyB64: string;
|
|
755
1171
|
curve: "P-256";
|
|
756
1172
|
supportedAlgorithms: "AES-GCM-256"[];
|
|
@@ -761,7 +1177,7 @@ export declare function parseCreateSessionRequest(data: unknown): z.ZodSafeParse
|
|
|
761
1177
|
* Parse either a stream event or encrypted envelope.
|
|
762
1178
|
*/
|
|
763
1179
|
export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafeParseResult<{
|
|
764
|
-
protocolVersion: 1;
|
|
1180
|
+
protocolVersion: 2 | 1;
|
|
765
1181
|
sessionId: string;
|
|
766
1182
|
seq: number;
|
|
767
1183
|
type: "session_init";
|
|
@@ -775,7 +1191,7 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
775
1191
|
replayUrl?: string | undefined;
|
|
776
1192
|
};
|
|
777
1193
|
} | {
|
|
778
|
-
protocolVersion: 1;
|
|
1194
|
+
protocolVersion: 2 | 1;
|
|
779
1195
|
sessionId: string;
|
|
780
1196
|
seq: number;
|
|
781
1197
|
type: "stdout";
|
|
@@ -783,7 +1199,7 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
783
1199
|
chunk: string;
|
|
784
1200
|
};
|
|
785
1201
|
} | {
|
|
786
|
-
protocolVersion: 1;
|
|
1202
|
+
protocolVersion: 2 | 1;
|
|
787
1203
|
sessionId: string;
|
|
788
1204
|
seq: number;
|
|
789
1205
|
type: "log";
|
|
@@ -793,7 +1209,7 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
793
1209
|
data?: Record<string, unknown> | undefined;
|
|
794
1210
|
};
|
|
795
1211
|
} | {
|
|
796
|
-
protocolVersion: 1;
|
|
1212
|
+
protocolVersion: 2 | 1;
|
|
797
1213
|
sessionId: string;
|
|
798
1214
|
seq: number;
|
|
799
1215
|
type: "tool_call";
|
|
@@ -803,7 +1219,7 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
803
1219
|
args: unknown;
|
|
804
1220
|
};
|
|
805
1221
|
} | {
|
|
806
|
-
protocolVersion: 1;
|
|
1222
|
+
protocolVersion: 2 | 1;
|
|
807
1223
|
sessionId: string;
|
|
808
1224
|
seq: number;
|
|
809
1225
|
type: "tool_result_applied";
|
|
@@ -811,7 +1227,7 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
811
1227
|
callId: string;
|
|
812
1228
|
};
|
|
813
1229
|
} | {
|
|
814
|
-
protocolVersion: 1;
|
|
1230
|
+
protocolVersion: 2 | 1;
|
|
815
1231
|
sessionId: string;
|
|
816
1232
|
seq: number;
|
|
817
1233
|
type: "final";
|
|
@@ -823,6 +1239,27 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
823
1239
|
code?: string | undefined;
|
|
824
1240
|
stack?: string | undefined;
|
|
825
1241
|
} | undefined;
|
|
1242
|
+
errors?: {
|
|
1243
|
+
code: string;
|
|
1244
|
+
message: string;
|
|
1245
|
+
path?: string[] | undefined;
|
|
1246
|
+
details?: ({
|
|
1247
|
+
type: "retry_info";
|
|
1248
|
+
retryDelayMs: number;
|
|
1249
|
+
} | {
|
|
1250
|
+
type: "upstream_info";
|
|
1251
|
+
statusCode: number;
|
|
1252
|
+
url: string;
|
|
1253
|
+
} | {
|
|
1254
|
+
type: "validation_info";
|
|
1255
|
+
field: string;
|
|
1256
|
+
reason: string;
|
|
1257
|
+
} | {
|
|
1258
|
+
type: "quota_info";
|
|
1259
|
+
limit: number;
|
|
1260
|
+
used: number;
|
|
1261
|
+
})[] | undefined;
|
|
1262
|
+
}[] | undefined;
|
|
826
1263
|
stats?: {
|
|
827
1264
|
durationMs: number;
|
|
828
1265
|
toolCallCount: number;
|
|
@@ -830,7 +1267,7 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
830
1267
|
} | undefined;
|
|
831
1268
|
};
|
|
832
1269
|
} | {
|
|
833
|
-
protocolVersion: 1;
|
|
1270
|
+
protocolVersion: 2 | 1;
|
|
834
1271
|
sessionId: string;
|
|
835
1272
|
seq: number;
|
|
836
1273
|
type: "heartbeat";
|
|
@@ -838,7 +1275,7 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
838
1275
|
ts: string;
|
|
839
1276
|
};
|
|
840
1277
|
} | {
|
|
841
|
-
protocolVersion: 1;
|
|
1278
|
+
protocolVersion: 2 | 1;
|
|
842
1279
|
sessionId: string;
|
|
843
1280
|
seq: number;
|
|
844
1281
|
type: "error";
|
|
@@ -847,8 +1284,70 @@ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafePar
|
|
|
847
1284
|
code?: string | undefined;
|
|
848
1285
|
recoverable?: boolean | undefined;
|
|
849
1286
|
};
|
|
1287
|
+
} | {
|
|
1288
|
+
protocolVersion: 2 | 1;
|
|
1289
|
+
sessionId: string;
|
|
1290
|
+
seq: number;
|
|
1291
|
+
type: "partial_result";
|
|
1292
|
+
payload: {
|
|
1293
|
+
path: string[];
|
|
1294
|
+
hasNext: boolean;
|
|
1295
|
+
data?: unknown;
|
|
1296
|
+
error?: {
|
|
1297
|
+
code: string;
|
|
1298
|
+
message: string;
|
|
1299
|
+
path?: string[] | undefined;
|
|
1300
|
+
details?: ({
|
|
1301
|
+
type: "retry_info";
|
|
1302
|
+
retryDelayMs: number;
|
|
1303
|
+
} | {
|
|
1304
|
+
type: "upstream_info";
|
|
1305
|
+
statusCode: number;
|
|
1306
|
+
url: string;
|
|
1307
|
+
} | {
|
|
1308
|
+
type: "validation_info";
|
|
1309
|
+
field: string;
|
|
1310
|
+
reason: string;
|
|
1311
|
+
} | {
|
|
1312
|
+
type: "quota_info";
|
|
1313
|
+
limit: number;
|
|
1314
|
+
used: number;
|
|
1315
|
+
})[] | undefined;
|
|
1316
|
+
} | undefined;
|
|
1317
|
+
};
|
|
1318
|
+
} | {
|
|
1319
|
+
protocolVersion: 2 | 1;
|
|
1320
|
+
sessionId: string;
|
|
1321
|
+
seq: number;
|
|
1322
|
+
type: "tool_progress";
|
|
1323
|
+
payload: {
|
|
1324
|
+
callId: string;
|
|
1325
|
+
phase: "connecting" | "sending" | "receiving" | "processing";
|
|
1326
|
+
elapsedMs: number;
|
|
1327
|
+
bytesReceived?: number | undefined;
|
|
1328
|
+
totalBytes?: number | undefined;
|
|
1329
|
+
};
|
|
1330
|
+
} | {
|
|
1331
|
+
protocolVersion: 2 | 1;
|
|
1332
|
+
sessionId: string;
|
|
1333
|
+
seq: number;
|
|
1334
|
+
type: "deadline_exceeded";
|
|
1335
|
+
payload: {
|
|
1336
|
+
elapsedMs: number;
|
|
1337
|
+
budgetMs: number;
|
|
1338
|
+
};
|
|
1339
|
+
} | {
|
|
1340
|
+
protocolVersion: 2 | 1;
|
|
1341
|
+
sessionId: string;
|
|
1342
|
+
seq: number;
|
|
1343
|
+
type: "catalog_changed";
|
|
1344
|
+
payload: {
|
|
1345
|
+
version: string;
|
|
1346
|
+
addedActions: string[];
|
|
1347
|
+
removedActions: string[];
|
|
1348
|
+
};
|
|
850
1349
|
}> | z.ZodSafeParseResult<{
|
|
851
|
-
protocolVersion: 1;
|
|
1350
|
+
protocolVersion: 2 | 1;
|
|
852
1351
|
sessionId: string;
|
|
853
1352
|
seq: number;
|
|
854
1353
|
type: "enc";
|