@enclave-vm/types 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,865 @@
1
+ /**
2
+ * @enclave-vm/types - Zod schemas
3
+ *
4
+ * Runtime validation schemas for all protocol types.
5
+ * These schemas are used for validating incoming messages from untrusted sources.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Protocol version schema.
10
+ */
11
+ export declare const ProtocolVersionSchema: z.ZodLiteral<1>;
12
+ /**
13
+ * Session ID schema.
14
+ */
15
+ export declare const SessionIdSchema: z.ZodString;
16
+ /**
17
+ * Call ID schema.
18
+ */
19
+ export declare const CallIdSchema: z.ZodString;
20
+ /**
21
+ * Reference ID schema.
22
+ */
23
+ export declare const RefIdSchema: z.ZodString;
24
+ /**
25
+ * Log level schema.
26
+ */
27
+ export declare const LogLevelSchema: z.ZodEnum<{
28
+ debug: "debug";
29
+ info: "info";
30
+ warn: "warn";
31
+ error: "error";
32
+ }>;
33
+ /**
34
+ * Session state schema.
35
+ */
36
+ export declare const SessionStateSchema: z.ZodEnum<{
37
+ starting: "starting";
38
+ running: "running";
39
+ waiting_for_tool: "waiting_for_tool";
40
+ completed: "completed";
41
+ cancelled: "cancelled";
42
+ failed: "failed";
43
+ }>;
44
+ /**
45
+ * Error info schema.
46
+ */
47
+ export declare const ErrorInfoSchema: z.ZodObject<{
48
+ message: z.ZodString;
49
+ code: z.ZodOptional<z.ZodString>;
50
+ stack: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strip>;
52
+ /**
53
+ * Reference token schema.
54
+ */
55
+ export declare const RefTokenSchema: z.ZodObject<{
56
+ $ref: z.ZodObject<{
57
+ id: z.ZodString;
58
+ }, z.core.$strip>;
59
+ }, z.core.$strip>;
60
+ /**
61
+ * Session limits schema.
62
+ */
63
+ export declare const SessionLimitsSchema: z.ZodObject<{
64
+ sessionTtlMs: z.ZodOptional<z.ZodNumber>;
65
+ maxToolCalls: z.ZodOptional<z.ZodNumber>;
66
+ maxStdoutBytes: z.ZodOptional<z.ZodNumber>;
67
+ maxToolResultBytes: z.ZodOptional<z.ZodNumber>;
68
+ toolTimeoutMs: z.ZodOptional<z.ZodNumber>;
69
+ heartbeatIntervalMs: z.ZodOptional<z.ZodNumber>;
70
+ }, z.core.$strip>;
71
+ /**
72
+ * Tool config schema.
73
+ */
74
+ export declare const ToolConfigSchema: z.ZodObject<{
75
+ timeout: z.ZodOptional<z.ZodNumber>;
76
+ retryable: z.ZodOptional<z.ZodBoolean>;
77
+ maxRetries: z.ZodOptional<z.ZodNumber>;
78
+ runtimeReadable: z.ZodOptional<z.ZodBoolean>;
79
+ }, z.core.$strip>;
80
+ /**
81
+ * Base event schema (common fields).
82
+ */
83
+ export declare const BaseEventSchema: z.ZodObject<{
84
+ protocolVersion: z.ZodLiteral<1>;
85
+ sessionId: z.ZodString;
86
+ seq: z.ZodNumber;
87
+ }, z.core.$strip>;
88
+ /**
89
+ * Encryption config schema.
90
+ */
91
+ export declare const EncryptionConfigSchema: z.ZodObject<{
92
+ enabled: z.ZodBoolean;
93
+ keyId: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$strip>;
95
+ /**
96
+ * Session init payload schema.
97
+ */
98
+ export declare const SessionInitPayloadSchema: z.ZodObject<{
99
+ cancelUrl: z.ZodString;
100
+ expiresAt: z.ZodString;
101
+ encryption: z.ZodObject<{
102
+ enabled: z.ZodBoolean;
103
+ keyId: z.ZodOptional<z.ZodString>;
104
+ }, z.core.$strip>;
105
+ replayUrl: z.ZodOptional<z.ZodString>;
106
+ }, z.core.$strip>;
107
+ /**
108
+ * Stdout payload schema.
109
+ */
110
+ export declare const StdoutPayloadSchema: z.ZodObject<{
111
+ chunk: z.ZodString;
112
+ }, z.core.$strip>;
113
+ /**
114
+ * Log payload schema.
115
+ */
116
+ export declare const LogPayloadSchema: z.ZodObject<{
117
+ level: z.ZodEnum<{
118
+ debug: "debug";
119
+ info: "info";
120
+ warn: "warn";
121
+ error: "error";
122
+ }>;
123
+ message: z.ZodString;
124
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
125
+ }, z.core.$strip>;
126
+ /**
127
+ * Tool call payload schema.
128
+ */
129
+ export declare const ToolCallPayloadSchema: z.ZodObject<{
130
+ callId: z.ZodString;
131
+ toolName: z.ZodString;
132
+ args: z.ZodUnknown;
133
+ }, z.core.$strip>;
134
+ /**
135
+ * Tool result applied payload schema.
136
+ */
137
+ export declare const ToolResultAppliedPayloadSchema: z.ZodObject<{
138
+ callId: z.ZodString;
139
+ }, z.core.$strip>;
140
+ /**
141
+ * Session stats schema.
142
+ */
143
+ export declare const SessionStatsSchema: z.ZodObject<{
144
+ durationMs: z.ZodNumber;
145
+ toolCallCount: z.ZodNumber;
146
+ stdoutBytes: z.ZodNumber;
147
+ }, z.core.$strip>;
148
+ /**
149
+ * Final payload schema.
150
+ */
151
+ export declare const FinalPayloadSchema: z.ZodObject<{
152
+ ok: z.ZodBoolean;
153
+ result: z.ZodOptional<z.ZodUnknown>;
154
+ error: z.ZodOptional<z.ZodObject<{
155
+ message: z.ZodString;
156
+ code: z.ZodOptional<z.ZodString>;
157
+ stack: z.ZodOptional<z.ZodString>;
158
+ }, z.core.$strip>>;
159
+ stats: z.ZodOptional<z.ZodObject<{
160
+ durationMs: z.ZodNumber;
161
+ toolCallCount: z.ZodNumber;
162
+ stdoutBytes: z.ZodNumber;
163
+ }, z.core.$strip>>;
164
+ }, z.core.$strip>;
165
+ /**
166
+ * Heartbeat payload schema.
167
+ */
168
+ export declare const HeartbeatPayloadSchema: z.ZodObject<{
169
+ ts: z.ZodString;
170
+ }, z.core.$strip>;
171
+ /**
172
+ * Error event payload schema.
173
+ */
174
+ export declare const ErrorEventPayloadSchema: z.ZodObject<{
175
+ message: z.ZodString;
176
+ code: z.ZodOptional<z.ZodString>;
177
+ recoverable: z.ZodOptional<z.ZodBoolean>;
178
+ }, z.core.$strip>;
179
+ /**
180
+ * Session init event schema.
181
+ */
182
+ export declare const SessionInitEventSchema: z.ZodObject<{
183
+ protocolVersion: z.ZodLiteral<1>;
184
+ sessionId: z.ZodString;
185
+ seq: z.ZodNumber;
186
+ type: z.ZodLiteral<"session_init">;
187
+ payload: z.ZodObject<{
188
+ cancelUrl: z.ZodString;
189
+ expiresAt: z.ZodString;
190
+ encryption: z.ZodObject<{
191
+ enabled: z.ZodBoolean;
192
+ keyId: z.ZodOptional<z.ZodString>;
193
+ }, z.core.$strip>;
194
+ replayUrl: z.ZodOptional<z.ZodString>;
195
+ }, z.core.$strip>;
196
+ }, z.core.$strip>;
197
+ /**
198
+ * Stdout event schema.
199
+ */
200
+ export declare const StdoutEventSchema: z.ZodObject<{
201
+ protocolVersion: z.ZodLiteral<1>;
202
+ sessionId: z.ZodString;
203
+ seq: z.ZodNumber;
204
+ type: z.ZodLiteral<"stdout">;
205
+ payload: z.ZodObject<{
206
+ chunk: z.ZodString;
207
+ }, z.core.$strip>;
208
+ }, z.core.$strip>;
209
+ /**
210
+ * Log event schema.
211
+ */
212
+ export declare const LogEventSchema: z.ZodObject<{
213
+ protocolVersion: z.ZodLiteral<1>;
214
+ sessionId: z.ZodString;
215
+ seq: z.ZodNumber;
216
+ type: z.ZodLiteral<"log">;
217
+ payload: z.ZodObject<{
218
+ level: z.ZodEnum<{
219
+ debug: "debug";
220
+ info: "info";
221
+ warn: "warn";
222
+ error: "error";
223
+ }>;
224
+ message: z.ZodString;
225
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
226
+ }, z.core.$strip>;
227
+ }, z.core.$strip>;
228
+ /**
229
+ * Tool call event schema.
230
+ */
231
+ export declare const ToolCallEventSchema: z.ZodObject<{
232
+ protocolVersion: z.ZodLiteral<1>;
233
+ sessionId: z.ZodString;
234
+ seq: z.ZodNumber;
235
+ type: z.ZodLiteral<"tool_call">;
236
+ payload: z.ZodObject<{
237
+ callId: z.ZodString;
238
+ toolName: z.ZodString;
239
+ args: z.ZodUnknown;
240
+ }, z.core.$strip>;
241
+ }, z.core.$strip>;
242
+ /**
243
+ * Tool result applied event schema.
244
+ */
245
+ export declare const ToolResultAppliedEventSchema: z.ZodObject<{
246
+ protocolVersion: z.ZodLiteral<1>;
247
+ sessionId: z.ZodString;
248
+ seq: z.ZodNumber;
249
+ type: z.ZodLiteral<"tool_result_applied">;
250
+ payload: z.ZodObject<{
251
+ callId: z.ZodString;
252
+ }, z.core.$strip>;
253
+ }, z.core.$strip>;
254
+ /**
255
+ * Final event schema.
256
+ */
257
+ export declare const FinalEventSchema: z.ZodObject<{
258
+ protocolVersion: z.ZodLiteral<1>;
259
+ sessionId: z.ZodString;
260
+ seq: z.ZodNumber;
261
+ type: z.ZodLiteral<"final">;
262
+ payload: z.ZodObject<{
263
+ ok: z.ZodBoolean;
264
+ result: z.ZodOptional<z.ZodUnknown>;
265
+ error: z.ZodOptional<z.ZodObject<{
266
+ message: z.ZodString;
267
+ code: z.ZodOptional<z.ZodString>;
268
+ stack: z.ZodOptional<z.ZodString>;
269
+ }, z.core.$strip>>;
270
+ stats: z.ZodOptional<z.ZodObject<{
271
+ durationMs: z.ZodNumber;
272
+ toolCallCount: z.ZodNumber;
273
+ stdoutBytes: z.ZodNumber;
274
+ }, z.core.$strip>>;
275
+ }, z.core.$strip>;
276
+ }, z.core.$strip>;
277
+ /**
278
+ * Heartbeat event schema.
279
+ */
280
+ export declare const HeartbeatEventSchema: z.ZodObject<{
281
+ protocolVersion: z.ZodLiteral<1>;
282
+ sessionId: z.ZodString;
283
+ seq: z.ZodNumber;
284
+ type: z.ZodLiteral<"heartbeat">;
285
+ payload: z.ZodObject<{
286
+ ts: z.ZodString;
287
+ }, z.core.$strip>;
288
+ }, z.core.$strip>;
289
+ /**
290
+ * Error event schema.
291
+ */
292
+ export declare const ErrorEventSchema: z.ZodObject<{
293
+ protocolVersion: z.ZodLiteral<1>;
294
+ sessionId: z.ZodString;
295
+ seq: z.ZodNumber;
296
+ type: z.ZodLiteral<"error">;
297
+ payload: z.ZodObject<{
298
+ message: z.ZodString;
299
+ code: z.ZodOptional<z.ZodString>;
300
+ recoverable: z.ZodOptional<z.ZodBoolean>;
301
+ }, z.core.$strip>;
302
+ }, z.core.$strip>;
303
+ /**
304
+ * Stream event union schema.
305
+ */
306
+ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
307
+ protocolVersion: z.ZodLiteral<1>;
308
+ sessionId: z.ZodString;
309
+ seq: z.ZodNumber;
310
+ type: z.ZodLiteral<"session_init">;
311
+ payload: z.ZodObject<{
312
+ cancelUrl: z.ZodString;
313
+ expiresAt: z.ZodString;
314
+ encryption: z.ZodObject<{
315
+ enabled: z.ZodBoolean;
316
+ keyId: z.ZodOptional<z.ZodString>;
317
+ }, z.core.$strip>;
318
+ replayUrl: z.ZodOptional<z.ZodString>;
319
+ }, z.core.$strip>;
320
+ }, z.core.$strip>, z.ZodObject<{
321
+ protocolVersion: z.ZodLiteral<1>;
322
+ sessionId: z.ZodString;
323
+ seq: z.ZodNumber;
324
+ type: z.ZodLiteral<"stdout">;
325
+ payload: z.ZodObject<{
326
+ chunk: z.ZodString;
327
+ }, z.core.$strip>;
328
+ }, z.core.$strip>, z.ZodObject<{
329
+ protocolVersion: z.ZodLiteral<1>;
330
+ sessionId: z.ZodString;
331
+ seq: z.ZodNumber;
332
+ type: z.ZodLiteral<"log">;
333
+ payload: z.ZodObject<{
334
+ level: z.ZodEnum<{
335
+ debug: "debug";
336
+ info: "info";
337
+ warn: "warn";
338
+ error: "error";
339
+ }>;
340
+ message: z.ZodString;
341
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
342
+ }, z.core.$strip>;
343
+ }, z.core.$strip>, z.ZodObject<{
344
+ protocolVersion: z.ZodLiteral<1>;
345
+ sessionId: z.ZodString;
346
+ seq: z.ZodNumber;
347
+ type: z.ZodLiteral<"tool_call">;
348
+ payload: z.ZodObject<{
349
+ callId: z.ZodString;
350
+ toolName: z.ZodString;
351
+ args: z.ZodUnknown;
352
+ }, z.core.$strip>;
353
+ }, z.core.$strip>, z.ZodObject<{
354
+ protocolVersion: z.ZodLiteral<1>;
355
+ sessionId: z.ZodString;
356
+ seq: z.ZodNumber;
357
+ type: z.ZodLiteral<"tool_result_applied">;
358
+ payload: z.ZodObject<{
359
+ callId: z.ZodString;
360
+ }, z.core.$strip>;
361
+ }, z.core.$strip>, z.ZodObject<{
362
+ protocolVersion: z.ZodLiteral<1>;
363
+ sessionId: z.ZodString;
364
+ seq: z.ZodNumber;
365
+ type: z.ZodLiteral<"final">;
366
+ payload: z.ZodObject<{
367
+ ok: z.ZodBoolean;
368
+ result: z.ZodOptional<z.ZodUnknown>;
369
+ error: z.ZodOptional<z.ZodObject<{
370
+ message: z.ZodString;
371
+ code: z.ZodOptional<z.ZodString>;
372
+ stack: z.ZodOptional<z.ZodString>;
373
+ }, z.core.$strip>>;
374
+ stats: z.ZodOptional<z.ZodObject<{
375
+ durationMs: z.ZodNumber;
376
+ toolCallCount: z.ZodNumber;
377
+ stdoutBytes: z.ZodNumber;
378
+ }, z.core.$strip>>;
379
+ }, z.core.$strip>;
380
+ }, z.core.$strip>, z.ZodObject<{
381
+ protocolVersion: z.ZodLiteral<1>;
382
+ sessionId: z.ZodString;
383
+ seq: z.ZodNumber;
384
+ type: z.ZodLiteral<"heartbeat">;
385
+ payload: z.ZodObject<{
386
+ ts: z.ZodString;
387
+ }, z.core.$strip>;
388
+ }, z.core.$strip>, z.ZodObject<{
389
+ protocolVersion: z.ZodLiteral<1>;
390
+ sessionId: z.ZodString;
391
+ seq: z.ZodNumber;
392
+ type: z.ZodLiteral<"error">;
393
+ payload: z.ZodObject<{
394
+ message: z.ZodString;
395
+ code: z.ZodOptional<z.ZodString>;
396
+ recoverable: z.ZodOptional<z.ZodBoolean>;
397
+ }, z.core.$strip>;
398
+ }, z.core.$strip>], "type">;
399
+ /**
400
+ * Supported curve schema.
401
+ */
402
+ export declare const SupportedCurveSchema: z.ZodEnum<{
403
+ "P-256": "P-256";
404
+ }>;
405
+ /**
406
+ * Encryption algorithm schema.
407
+ */
408
+ export declare const EncryptionAlgorithmSchema: z.ZodEnum<{
409
+ "AES-GCM-256": "AES-GCM-256";
410
+ }>;
411
+ /**
412
+ * Key derivation schema.
413
+ */
414
+ export declare const KeyDerivationSchema: z.ZodEnum<{
415
+ "HKDF-SHA-256": "HKDF-SHA-256";
416
+ }>;
417
+ /**
418
+ * Encryption mode schema.
419
+ */
420
+ export declare const EncryptionModeSchema: z.ZodEnum<{
421
+ disabled: "disabled";
422
+ optional: "optional";
423
+ required: "required";
424
+ }>;
425
+ /**
426
+ * Encrypted envelope payload schema.
427
+ */
428
+ export declare const EncryptedEnvelopePayloadSchema: z.ZodObject<{
429
+ kid: z.ZodString;
430
+ nonceB64: z.ZodString;
431
+ ciphertextB64: z.ZodString;
432
+ tagB64: z.ZodOptional<z.ZodString>;
433
+ }, z.core.$strip>;
434
+ /**
435
+ * Encrypted envelope schema.
436
+ */
437
+ export declare const EncryptedEnvelopeSchema: z.ZodObject<{
438
+ protocolVersion: z.ZodLiteral<1>;
439
+ sessionId: z.ZodString;
440
+ seq: z.ZodNumber;
441
+ type: z.ZodLiteral<"enc">;
442
+ payload: z.ZodObject<{
443
+ kid: z.ZodString;
444
+ nonceB64: z.ZodString;
445
+ ciphertextB64: z.ZodString;
446
+ tagB64: z.ZodOptional<z.ZodString>;
447
+ }, z.core.$strip>;
448
+ }, z.core.$strip>;
449
+ /**
450
+ * Client hello schema.
451
+ */
452
+ export declare const ClientHelloSchema: z.ZodObject<{
453
+ protocolVersion: z.ZodLiteral<1>;
454
+ clientEphemeralPubKeyB64: z.ZodString;
455
+ curve: z.ZodEnum<{
456
+ "P-256": "P-256";
457
+ }>;
458
+ supportedAlgorithms: z.ZodArray<z.ZodEnum<{
459
+ "AES-GCM-256": "AES-GCM-256";
460
+ }>>;
461
+ }, z.core.$strip>;
462
+ /**
463
+ * Server hello schema.
464
+ */
465
+ export declare const ServerHelloSchema: z.ZodObject<{
466
+ protocolVersion: z.ZodLiteral<1>;
467
+ serverEphemeralPubKeyB64: z.ZodString;
468
+ curve: z.ZodEnum<{
469
+ "P-256": "P-256";
470
+ }>;
471
+ selectedAlgorithm: z.ZodEnum<{
472
+ "AES-GCM-256": "AES-GCM-256";
473
+ }>;
474
+ kdf: z.ZodEnum<{
475
+ "HKDF-SHA-256": "HKDF-SHA-256";
476
+ }>;
477
+ keyId: z.ZodString;
478
+ signatureB64: z.ZodOptional<z.ZodString>;
479
+ }, z.core.$strip>;
480
+ /**
481
+ * Encryption request schema.
482
+ */
483
+ export declare const EncryptionRequestSchema: z.ZodObject<{
484
+ mode: z.ZodEnum<{
485
+ disabled: "disabled";
486
+ optional: "optional";
487
+ required: "required";
488
+ }>;
489
+ clientHello: z.ZodOptional<z.ZodObject<{
490
+ protocolVersion: z.ZodLiteral<1>;
491
+ clientEphemeralPubKeyB64: z.ZodString;
492
+ curve: z.ZodEnum<{
493
+ "P-256": "P-256";
494
+ }>;
495
+ supportedAlgorithms: z.ZodArray<z.ZodEnum<{
496
+ "AES-GCM-256": "AES-GCM-256";
497
+ }>>;
498
+ }, z.core.$strip>>;
499
+ }, z.core.$strip>;
500
+ /**
501
+ * Tool result submit payload schema.
502
+ */
503
+ export declare const ToolResultSubmitPayloadSchema: z.ZodObject<{
504
+ callId: z.ZodString;
505
+ ok: z.ZodBoolean;
506
+ result: z.ZodOptional<z.ZodUnknown>;
507
+ error: z.ZodOptional<z.ZodObject<{
508
+ message: z.ZodString;
509
+ code: z.ZodOptional<z.ZodString>;
510
+ stack: z.ZodOptional<z.ZodString>;
511
+ }, z.core.$strip>>;
512
+ }, z.core.$strip>;
513
+ /**
514
+ * Tool result submit message schema.
515
+ */
516
+ export declare const ToolResultSubmitMessageSchema: z.ZodObject<{
517
+ protocolVersion: z.ZodLiteral<1>;
518
+ sessionId: z.ZodString;
519
+ type: z.ZodLiteral<"tool_result_submit">;
520
+ payload: z.ZodObject<{
521
+ callId: z.ZodString;
522
+ ok: z.ZodBoolean;
523
+ result: z.ZodOptional<z.ZodUnknown>;
524
+ error: z.ZodOptional<z.ZodObject<{
525
+ message: z.ZodString;
526
+ code: z.ZodOptional<z.ZodString>;
527
+ stack: z.ZodOptional<z.ZodString>;
528
+ }, z.core.$strip>>;
529
+ }, z.core.$strip>;
530
+ }, z.core.$strip>;
531
+ /**
532
+ * Cancel payload schema.
533
+ */
534
+ export declare const CancelPayloadSchema: z.ZodObject<{
535
+ reason: z.ZodOptional<z.ZodString>;
536
+ }, z.core.$strip>;
537
+ /**
538
+ * Cancel message schema.
539
+ */
540
+ export declare const CancelMessageSchema: z.ZodObject<{
541
+ protocolVersion: z.ZodLiteral<1>;
542
+ sessionId: z.ZodString;
543
+ type: z.ZodLiteral<"cancel">;
544
+ payload: z.ZodObject<{
545
+ reason: z.ZodOptional<z.ZodString>;
546
+ }, z.core.$strip>;
547
+ }, z.core.$strip>;
548
+ /**
549
+ * Runtime channel message union schema.
550
+ */
551
+ export declare const RuntimeChannelMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
552
+ protocolVersion: z.ZodLiteral<1>;
553
+ sessionId: z.ZodString;
554
+ type: z.ZodLiteral<"tool_result_submit">;
555
+ payload: z.ZodObject<{
556
+ callId: z.ZodString;
557
+ ok: z.ZodBoolean;
558
+ result: z.ZodOptional<z.ZodUnknown>;
559
+ error: z.ZodOptional<z.ZodObject<{
560
+ message: z.ZodString;
561
+ code: z.ZodOptional<z.ZodString>;
562
+ stack: z.ZodOptional<z.ZodString>;
563
+ }, z.core.$strip>>;
564
+ }, z.core.$strip>;
565
+ }, z.core.$strip>, z.ZodObject<{
566
+ protocolVersion: z.ZodLiteral<1>;
567
+ sessionId: z.ZodString;
568
+ type: z.ZodLiteral<"cancel">;
569
+ payload: z.ZodObject<{
570
+ reason: z.ZodOptional<z.ZodString>;
571
+ }, z.core.$strip>;
572
+ }, z.core.$strip>], "type">;
573
+ /**
574
+ * Session creation request schema.
575
+ */
576
+ export declare const CreateSessionRequestSchema: z.ZodObject<{
577
+ protocolVersion: z.ZodLiteral<1>;
578
+ code: z.ZodString;
579
+ limits: z.ZodOptional<z.ZodObject<{
580
+ sessionTtlMs: z.ZodOptional<z.ZodNumber>;
581
+ maxToolCalls: z.ZodOptional<z.ZodNumber>;
582
+ maxStdoutBytes: z.ZodOptional<z.ZodNumber>;
583
+ maxToolResultBytes: z.ZodOptional<z.ZodNumber>;
584
+ toolTimeoutMs: z.ZodOptional<z.ZodNumber>;
585
+ heartbeatIntervalMs: z.ZodOptional<z.ZodNumber>;
586
+ }, z.core.$strip>>;
587
+ encryption: z.ZodOptional<z.ZodObject<{
588
+ mode: z.ZodEnum<{
589
+ disabled: "disabled";
590
+ optional: "optional";
591
+ required: "required";
592
+ }>;
593
+ clientHello: z.ZodOptional<z.ZodObject<{
594
+ protocolVersion: z.ZodLiteral<1>;
595
+ clientEphemeralPubKeyB64: z.ZodString;
596
+ curve: z.ZodEnum<{
597
+ "P-256": "P-256";
598
+ }>;
599
+ supportedAlgorithms: z.ZodArray<z.ZodEnum<{
600
+ "AES-GCM-256": "AES-GCM-256";
601
+ }>>;
602
+ }, z.core.$strip>>;
603
+ }, z.core.$strip>>;
604
+ }, z.core.$strip>;
605
+ /**
606
+ * Parse and validate a stream event.
607
+ */
608
+ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{
609
+ protocolVersion: 1;
610
+ sessionId: string;
611
+ seq: number;
612
+ type: "session_init";
613
+ payload: {
614
+ cancelUrl: string;
615
+ expiresAt: string;
616
+ encryption: {
617
+ enabled: boolean;
618
+ keyId?: string | undefined;
619
+ };
620
+ replayUrl?: string | undefined;
621
+ };
622
+ } | {
623
+ protocolVersion: 1;
624
+ sessionId: string;
625
+ seq: number;
626
+ type: "stdout";
627
+ payload: {
628
+ chunk: string;
629
+ };
630
+ } | {
631
+ protocolVersion: 1;
632
+ sessionId: string;
633
+ seq: number;
634
+ type: "log";
635
+ payload: {
636
+ level: "debug" | "info" | "warn" | "error";
637
+ message: string;
638
+ data?: Record<string, unknown> | undefined;
639
+ };
640
+ } | {
641
+ protocolVersion: 1;
642
+ sessionId: string;
643
+ seq: number;
644
+ type: "tool_call";
645
+ payload: {
646
+ callId: string;
647
+ toolName: string;
648
+ args: unknown;
649
+ };
650
+ } | {
651
+ protocolVersion: 1;
652
+ sessionId: string;
653
+ seq: number;
654
+ type: "tool_result_applied";
655
+ payload: {
656
+ callId: string;
657
+ };
658
+ } | {
659
+ protocolVersion: 1;
660
+ sessionId: string;
661
+ seq: number;
662
+ type: "final";
663
+ payload: {
664
+ ok: boolean;
665
+ result?: unknown;
666
+ error?: {
667
+ message: string;
668
+ code?: string | undefined;
669
+ stack?: string | undefined;
670
+ } | undefined;
671
+ stats?: {
672
+ durationMs: number;
673
+ toolCallCount: number;
674
+ stdoutBytes: number;
675
+ } | undefined;
676
+ };
677
+ } | {
678
+ protocolVersion: 1;
679
+ sessionId: string;
680
+ seq: number;
681
+ type: "heartbeat";
682
+ payload: {
683
+ ts: string;
684
+ };
685
+ } | {
686
+ protocolVersion: 1;
687
+ sessionId: string;
688
+ seq: number;
689
+ type: "error";
690
+ payload: {
691
+ message: string;
692
+ code?: string | undefined;
693
+ recoverable?: boolean | undefined;
694
+ };
695
+ }>;
696
+ /**
697
+ * Parse and validate an encrypted envelope.
698
+ */
699
+ export declare function parseEncryptedEnvelope(data: unknown): z.ZodSafeParseResult<{
700
+ protocolVersion: 1;
701
+ sessionId: string;
702
+ seq: number;
703
+ type: "enc";
704
+ payload: {
705
+ kid: string;
706
+ nonceB64: string;
707
+ ciphertextB64: string;
708
+ tagB64?: string | undefined;
709
+ };
710
+ }>;
711
+ /**
712
+ * Parse and validate a runtime channel message.
713
+ */
714
+ export declare function parseRuntimeChannelMessage(data: unknown): z.ZodSafeParseResult<{
715
+ protocolVersion: 1;
716
+ sessionId: string;
717
+ type: "tool_result_submit";
718
+ payload: {
719
+ callId: string;
720
+ ok: boolean;
721
+ result?: unknown;
722
+ error?: {
723
+ message: string;
724
+ code?: string | undefined;
725
+ stack?: string | undefined;
726
+ } | undefined;
727
+ };
728
+ } | {
729
+ protocolVersion: 1;
730
+ sessionId: string;
731
+ type: "cancel";
732
+ payload: {
733
+ reason?: string | undefined;
734
+ };
735
+ }>;
736
+ /**
737
+ * Parse and validate a session creation request.
738
+ */
739
+ export declare function parseCreateSessionRequest(data: unknown): z.ZodSafeParseResult<{
740
+ protocolVersion: 1;
741
+ code: string;
742
+ limits?: {
743
+ sessionTtlMs?: number | undefined;
744
+ maxToolCalls?: number | undefined;
745
+ maxStdoutBytes?: number | undefined;
746
+ maxToolResultBytes?: number | undefined;
747
+ toolTimeoutMs?: number | undefined;
748
+ heartbeatIntervalMs?: number | undefined;
749
+ } | undefined;
750
+ encryption?: {
751
+ mode: "disabled" | "optional" | "required";
752
+ clientHello?: {
753
+ protocolVersion: 1;
754
+ clientEphemeralPubKeyB64: string;
755
+ curve: "P-256";
756
+ supportedAlgorithms: "AES-GCM-256"[];
757
+ } | undefined;
758
+ } | undefined;
759
+ }>;
760
+ /**
761
+ * Parse either a stream event or encrypted envelope.
762
+ */
763
+ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafeParseResult<{
764
+ protocolVersion: 1;
765
+ sessionId: string;
766
+ seq: number;
767
+ type: "session_init";
768
+ payload: {
769
+ cancelUrl: string;
770
+ expiresAt: string;
771
+ encryption: {
772
+ enabled: boolean;
773
+ keyId?: string | undefined;
774
+ };
775
+ replayUrl?: string | undefined;
776
+ };
777
+ } | {
778
+ protocolVersion: 1;
779
+ sessionId: string;
780
+ seq: number;
781
+ type: "stdout";
782
+ payload: {
783
+ chunk: string;
784
+ };
785
+ } | {
786
+ protocolVersion: 1;
787
+ sessionId: string;
788
+ seq: number;
789
+ type: "log";
790
+ payload: {
791
+ level: "debug" | "info" | "warn" | "error";
792
+ message: string;
793
+ data?: Record<string, unknown> | undefined;
794
+ };
795
+ } | {
796
+ protocolVersion: 1;
797
+ sessionId: string;
798
+ seq: number;
799
+ type: "tool_call";
800
+ payload: {
801
+ callId: string;
802
+ toolName: string;
803
+ args: unknown;
804
+ };
805
+ } | {
806
+ protocolVersion: 1;
807
+ sessionId: string;
808
+ seq: number;
809
+ type: "tool_result_applied";
810
+ payload: {
811
+ callId: string;
812
+ };
813
+ } | {
814
+ protocolVersion: 1;
815
+ sessionId: string;
816
+ seq: number;
817
+ type: "final";
818
+ payload: {
819
+ ok: boolean;
820
+ result?: unknown;
821
+ error?: {
822
+ message: string;
823
+ code?: string | undefined;
824
+ stack?: string | undefined;
825
+ } | undefined;
826
+ stats?: {
827
+ durationMs: number;
828
+ toolCallCount: number;
829
+ stdoutBytes: number;
830
+ } | undefined;
831
+ };
832
+ } | {
833
+ protocolVersion: 1;
834
+ sessionId: string;
835
+ seq: number;
836
+ type: "heartbeat";
837
+ payload: {
838
+ ts: string;
839
+ };
840
+ } | {
841
+ protocolVersion: 1;
842
+ sessionId: string;
843
+ seq: number;
844
+ type: "error";
845
+ payload: {
846
+ message: string;
847
+ code?: string | undefined;
848
+ recoverable?: boolean | undefined;
849
+ };
850
+ }> | z.ZodSafeParseResult<{
851
+ protocolVersion: 1;
852
+ sessionId: string;
853
+ seq: number;
854
+ type: "enc";
855
+ payload: {
856
+ kid: string;
857
+ nonceB64: string;
858
+ ciphertextB64: string;
859
+ tagB64?: string | undefined;
860
+ };
861
+ }>;
862
+ export type ParsedStreamEvent = z.infer<typeof StreamEventSchema>;
863
+ export type ParsedEncryptedEnvelope = z.infer<typeof EncryptedEnvelopeSchema>;
864
+ export type ParsedRuntimeChannelMessage = z.infer<typeof RuntimeChannelMessageSchema>;
865
+ export type ParsedCreateSessionRequest = z.infer<typeof CreateSessionRequestSchema>;