@zuoyehaoduoa/wire 0.1.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,2500 @@
1
+ import * as z from 'zod';
2
+
3
+ declare const MessageMetaSchema: z.ZodObject<{
4
+ sentFrom: z.ZodOptional<z.ZodString>;
5
+ permissionMode: z.ZodOptional<z.ZodEnum<["default", "acceptEdits", "bypassPermissions", "plan", "read-only", "safe-yolo", "yolo"]>>;
6
+ model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ fallbackModel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ customSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ appendSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
+ allowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
11
+ disallowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
12
+ displayText: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ sentFrom?: string | undefined;
15
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
16
+ model?: string | null | undefined;
17
+ fallbackModel?: string | null | undefined;
18
+ customSystemPrompt?: string | null | undefined;
19
+ appendSystemPrompt?: string | null | undefined;
20
+ allowedTools?: string[] | null | undefined;
21
+ disallowedTools?: string[] | null | undefined;
22
+ displayText?: string | undefined;
23
+ }, {
24
+ sentFrom?: string | undefined;
25
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
26
+ model?: string | null | undefined;
27
+ fallbackModel?: string | null | undefined;
28
+ customSystemPrompt?: string | null | undefined;
29
+ appendSystemPrompt?: string | null | undefined;
30
+ allowedTools?: string[] | null | undefined;
31
+ disallowedTools?: string[] | null | undefined;
32
+ displayText?: string | undefined;
33
+ }>;
34
+ type MessageMeta = z.infer<typeof MessageMetaSchema>;
35
+
36
+ declare const SessionMessageContentSchema: z.ZodObject<{
37
+ c: z.ZodString;
38
+ t: z.ZodLiteral<"encrypted">;
39
+ }, "strip", z.ZodTypeAny, {
40
+ c: string;
41
+ t: "encrypted";
42
+ }, {
43
+ c: string;
44
+ t: "encrypted";
45
+ }>;
46
+ type SessionMessageContent = z.infer<typeof SessionMessageContentSchema>;
47
+ declare const SessionMessageSchema: z.ZodObject<{
48
+ id: z.ZodString;
49
+ seq: z.ZodNumber;
50
+ localId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ content: z.ZodObject<{
52
+ c: z.ZodString;
53
+ t: z.ZodLiteral<"encrypted">;
54
+ }, "strip", z.ZodTypeAny, {
55
+ c: string;
56
+ t: "encrypted";
57
+ }, {
58
+ c: string;
59
+ t: "encrypted";
60
+ }>;
61
+ createdAt: z.ZodNumber;
62
+ updatedAt: z.ZodNumber;
63
+ }, "strip", z.ZodTypeAny, {
64
+ id: string;
65
+ seq: number;
66
+ content: {
67
+ c: string;
68
+ t: "encrypted";
69
+ };
70
+ createdAt: number;
71
+ updatedAt: number;
72
+ localId?: string | null | undefined;
73
+ }, {
74
+ id: string;
75
+ seq: number;
76
+ content: {
77
+ c: string;
78
+ t: "encrypted";
79
+ };
80
+ createdAt: number;
81
+ updatedAt: number;
82
+ localId?: string | null | undefined;
83
+ }>;
84
+ type SessionMessage = z.infer<typeof SessionMessageSchema>;
85
+
86
+ declare const SessionProtocolMessageSchema: z.ZodObject<{
87
+ role: z.ZodLiteral<"session">;
88
+ content: z.ZodEffects<z.ZodObject<{
89
+ id: z.ZodString;
90
+ time: z.ZodNumber;
91
+ role: z.ZodEnum<["user", "agent"]>;
92
+ turn: z.ZodOptional<z.ZodString>;
93
+ subagent: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
94
+ ev: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
95
+ t: z.ZodLiteral<"text">;
96
+ text: z.ZodString;
97
+ thinking: z.ZodOptional<z.ZodBoolean>;
98
+ }, "strip", z.ZodTypeAny, {
99
+ t: "text";
100
+ text: string;
101
+ thinking?: boolean | undefined;
102
+ }, {
103
+ t: "text";
104
+ text: string;
105
+ thinking?: boolean | undefined;
106
+ }>, z.ZodObject<{
107
+ t: z.ZodLiteral<"service">;
108
+ text: z.ZodString;
109
+ }, "strip", z.ZodTypeAny, {
110
+ t: "service";
111
+ text: string;
112
+ }, {
113
+ t: "service";
114
+ text: string;
115
+ }>, z.ZodObject<{
116
+ t: z.ZodLiteral<"tool-call-start">;
117
+ call: z.ZodString;
118
+ name: z.ZodString;
119
+ title: z.ZodString;
120
+ description: z.ZodString;
121
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
122
+ }, "strip", z.ZodTypeAny, {
123
+ t: "tool-call-start";
124
+ call: string;
125
+ name: string;
126
+ title: string;
127
+ description: string;
128
+ args: Record<string, unknown>;
129
+ }, {
130
+ t: "tool-call-start";
131
+ call: string;
132
+ name: string;
133
+ title: string;
134
+ description: string;
135
+ args: Record<string, unknown>;
136
+ }>, z.ZodObject<{
137
+ t: z.ZodLiteral<"tool-call-end">;
138
+ call: z.ZodString;
139
+ }, "strip", z.ZodTypeAny, {
140
+ t: "tool-call-end";
141
+ call: string;
142
+ }, {
143
+ t: "tool-call-end";
144
+ call: string;
145
+ }>, z.ZodObject<{
146
+ t: z.ZodLiteral<"file">;
147
+ ref: z.ZodString;
148
+ name: z.ZodString;
149
+ size: z.ZodNumber;
150
+ image: z.ZodOptional<z.ZodObject<{
151
+ width: z.ZodNumber;
152
+ height: z.ZodNumber;
153
+ thumbhash: z.ZodString;
154
+ }, "strip", z.ZodTypeAny, {
155
+ width: number;
156
+ height: number;
157
+ thumbhash: string;
158
+ }, {
159
+ width: number;
160
+ height: number;
161
+ thumbhash: string;
162
+ }>>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ t: "file";
165
+ name: string;
166
+ ref: string;
167
+ size: number;
168
+ image?: {
169
+ width: number;
170
+ height: number;
171
+ thumbhash: string;
172
+ } | undefined;
173
+ }, {
174
+ t: "file";
175
+ name: string;
176
+ ref: string;
177
+ size: number;
178
+ image?: {
179
+ width: number;
180
+ height: number;
181
+ thumbhash: string;
182
+ } | undefined;
183
+ }>, z.ZodObject<{
184
+ t: z.ZodLiteral<"turn-start">;
185
+ }, "strip", z.ZodTypeAny, {
186
+ t: "turn-start";
187
+ }, {
188
+ t: "turn-start";
189
+ }>, z.ZodObject<{
190
+ t: z.ZodLiteral<"start">;
191
+ title: z.ZodOptional<z.ZodString>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ t: "start";
194
+ title?: string | undefined;
195
+ }, {
196
+ t: "start";
197
+ title?: string | undefined;
198
+ }>, z.ZodObject<{
199
+ t: z.ZodLiteral<"turn-end">;
200
+ status: z.ZodEnum<["completed", "failed", "cancelled"]>;
201
+ }, "strip", z.ZodTypeAny, {
202
+ t: "turn-end";
203
+ status: "completed" | "failed" | "cancelled";
204
+ }, {
205
+ t: "turn-end";
206
+ status: "completed" | "failed" | "cancelled";
207
+ }>, z.ZodObject<{
208
+ t: z.ZodLiteral<"stop">;
209
+ }, "strip", z.ZodTypeAny, {
210
+ t: "stop";
211
+ }, {
212
+ t: "stop";
213
+ }>]>;
214
+ }, "strip", z.ZodTypeAny, {
215
+ id: string;
216
+ role: "user" | "agent";
217
+ time: number;
218
+ ev: {
219
+ t: "text";
220
+ text: string;
221
+ thinking?: boolean | undefined;
222
+ } | {
223
+ t: "service";
224
+ text: string;
225
+ } | {
226
+ t: "tool-call-start";
227
+ call: string;
228
+ name: string;
229
+ title: string;
230
+ description: string;
231
+ args: Record<string, unknown>;
232
+ } | {
233
+ t: "tool-call-end";
234
+ call: string;
235
+ } | {
236
+ t: "file";
237
+ name: string;
238
+ ref: string;
239
+ size: number;
240
+ image?: {
241
+ width: number;
242
+ height: number;
243
+ thumbhash: string;
244
+ } | undefined;
245
+ } | {
246
+ t: "turn-start";
247
+ } | {
248
+ t: "start";
249
+ title?: string | undefined;
250
+ } | {
251
+ t: "turn-end";
252
+ status: "completed" | "failed" | "cancelled";
253
+ } | {
254
+ t: "stop";
255
+ };
256
+ turn?: string | undefined;
257
+ subagent?: string | undefined;
258
+ }, {
259
+ id: string;
260
+ role: "user" | "agent";
261
+ time: number;
262
+ ev: {
263
+ t: "text";
264
+ text: string;
265
+ thinking?: boolean | undefined;
266
+ } | {
267
+ t: "service";
268
+ text: string;
269
+ } | {
270
+ t: "tool-call-start";
271
+ call: string;
272
+ name: string;
273
+ title: string;
274
+ description: string;
275
+ args: Record<string, unknown>;
276
+ } | {
277
+ t: "tool-call-end";
278
+ call: string;
279
+ } | {
280
+ t: "file";
281
+ name: string;
282
+ ref: string;
283
+ size: number;
284
+ image?: {
285
+ width: number;
286
+ height: number;
287
+ thumbhash: string;
288
+ } | undefined;
289
+ } | {
290
+ t: "turn-start";
291
+ } | {
292
+ t: "start";
293
+ title?: string | undefined;
294
+ } | {
295
+ t: "turn-end";
296
+ status: "completed" | "failed" | "cancelled";
297
+ } | {
298
+ t: "stop";
299
+ };
300
+ turn?: string | undefined;
301
+ subagent?: string | undefined;
302
+ }>, {
303
+ id: string;
304
+ role: "user" | "agent";
305
+ time: number;
306
+ ev: {
307
+ t: "text";
308
+ text: string;
309
+ thinking?: boolean | undefined;
310
+ } | {
311
+ t: "service";
312
+ text: string;
313
+ } | {
314
+ t: "tool-call-start";
315
+ call: string;
316
+ name: string;
317
+ title: string;
318
+ description: string;
319
+ args: Record<string, unknown>;
320
+ } | {
321
+ t: "tool-call-end";
322
+ call: string;
323
+ } | {
324
+ t: "file";
325
+ name: string;
326
+ ref: string;
327
+ size: number;
328
+ image?: {
329
+ width: number;
330
+ height: number;
331
+ thumbhash: string;
332
+ } | undefined;
333
+ } | {
334
+ t: "turn-start";
335
+ } | {
336
+ t: "start";
337
+ title?: string | undefined;
338
+ } | {
339
+ t: "turn-end";
340
+ status: "completed" | "failed" | "cancelled";
341
+ } | {
342
+ t: "stop";
343
+ };
344
+ turn?: string | undefined;
345
+ subagent?: string | undefined;
346
+ }, {
347
+ id: string;
348
+ role: "user" | "agent";
349
+ time: number;
350
+ ev: {
351
+ t: "text";
352
+ text: string;
353
+ thinking?: boolean | undefined;
354
+ } | {
355
+ t: "service";
356
+ text: string;
357
+ } | {
358
+ t: "tool-call-start";
359
+ call: string;
360
+ name: string;
361
+ title: string;
362
+ description: string;
363
+ args: Record<string, unknown>;
364
+ } | {
365
+ t: "tool-call-end";
366
+ call: string;
367
+ } | {
368
+ t: "file";
369
+ name: string;
370
+ ref: string;
371
+ size: number;
372
+ image?: {
373
+ width: number;
374
+ height: number;
375
+ thumbhash: string;
376
+ } | undefined;
377
+ } | {
378
+ t: "turn-start";
379
+ } | {
380
+ t: "start";
381
+ title?: string | undefined;
382
+ } | {
383
+ t: "turn-end";
384
+ status: "completed" | "failed" | "cancelled";
385
+ } | {
386
+ t: "stop";
387
+ };
388
+ turn?: string | undefined;
389
+ subagent?: string | undefined;
390
+ }>;
391
+ meta: z.ZodOptional<z.ZodObject<{
392
+ sentFrom: z.ZodOptional<z.ZodString>;
393
+ permissionMode: z.ZodOptional<z.ZodEnum<["default", "acceptEdits", "bypassPermissions", "plan", "read-only", "safe-yolo", "yolo"]>>;
394
+ model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
395
+ fallbackModel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
396
+ customSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
397
+ appendSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
398
+ allowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
399
+ disallowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
400
+ displayText: z.ZodOptional<z.ZodString>;
401
+ }, "strip", z.ZodTypeAny, {
402
+ sentFrom?: string | undefined;
403
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
404
+ model?: string | null | undefined;
405
+ fallbackModel?: string | null | undefined;
406
+ customSystemPrompt?: string | null | undefined;
407
+ appendSystemPrompt?: string | null | undefined;
408
+ allowedTools?: string[] | null | undefined;
409
+ disallowedTools?: string[] | null | undefined;
410
+ displayText?: string | undefined;
411
+ }, {
412
+ sentFrom?: string | undefined;
413
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
414
+ model?: string | null | undefined;
415
+ fallbackModel?: string | null | undefined;
416
+ customSystemPrompt?: string | null | undefined;
417
+ appendSystemPrompt?: string | null | undefined;
418
+ allowedTools?: string[] | null | undefined;
419
+ disallowedTools?: string[] | null | undefined;
420
+ displayText?: string | undefined;
421
+ }>>;
422
+ }, "strip", z.ZodTypeAny, {
423
+ content: {
424
+ id: string;
425
+ role: "user" | "agent";
426
+ time: number;
427
+ ev: {
428
+ t: "text";
429
+ text: string;
430
+ thinking?: boolean | undefined;
431
+ } | {
432
+ t: "service";
433
+ text: string;
434
+ } | {
435
+ t: "tool-call-start";
436
+ call: string;
437
+ name: string;
438
+ title: string;
439
+ description: string;
440
+ args: Record<string, unknown>;
441
+ } | {
442
+ t: "tool-call-end";
443
+ call: string;
444
+ } | {
445
+ t: "file";
446
+ name: string;
447
+ ref: string;
448
+ size: number;
449
+ image?: {
450
+ width: number;
451
+ height: number;
452
+ thumbhash: string;
453
+ } | undefined;
454
+ } | {
455
+ t: "turn-start";
456
+ } | {
457
+ t: "start";
458
+ title?: string | undefined;
459
+ } | {
460
+ t: "turn-end";
461
+ status: "completed" | "failed" | "cancelled";
462
+ } | {
463
+ t: "stop";
464
+ };
465
+ turn?: string | undefined;
466
+ subagent?: string | undefined;
467
+ };
468
+ role: "session";
469
+ meta?: {
470
+ sentFrom?: string | undefined;
471
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
472
+ model?: string | null | undefined;
473
+ fallbackModel?: string | null | undefined;
474
+ customSystemPrompt?: string | null | undefined;
475
+ appendSystemPrompt?: string | null | undefined;
476
+ allowedTools?: string[] | null | undefined;
477
+ disallowedTools?: string[] | null | undefined;
478
+ displayText?: string | undefined;
479
+ } | undefined;
480
+ }, {
481
+ content: {
482
+ id: string;
483
+ role: "user" | "agent";
484
+ time: number;
485
+ ev: {
486
+ t: "text";
487
+ text: string;
488
+ thinking?: boolean | undefined;
489
+ } | {
490
+ t: "service";
491
+ text: string;
492
+ } | {
493
+ t: "tool-call-start";
494
+ call: string;
495
+ name: string;
496
+ title: string;
497
+ description: string;
498
+ args: Record<string, unknown>;
499
+ } | {
500
+ t: "tool-call-end";
501
+ call: string;
502
+ } | {
503
+ t: "file";
504
+ name: string;
505
+ ref: string;
506
+ size: number;
507
+ image?: {
508
+ width: number;
509
+ height: number;
510
+ thumbhash: string;
511
+ } | undefined;
512
+ } | {
513
+ t: "turn-start";
514
+ } | {
515
+ t: "start";
516
+ title?: string | undefined;
517
+ } | {
518
+ t: "turn-end";
519
+ status: "completed" | "failed" | "cancelled";
520
+ } | {
521
+ t: "stop";
522
+ };
523
+ turn?: string | undefined;
524
+ subagent?: string | undefined;
525
+ };
526
+ role: "session";
527
+ meta?: {
528
+ sentFrom?: string | undefined;
529
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
530
+ model?: string | null | undefined;
531
+ fallbackModel?: string | null | undefined;
532
+ customSystemPrompt?: string | null | undefined;
533
+ appendSystemPrompt?: string | null | undefined;
534
+ allowedTools?: string[] | null | undefined;
535
+ disallowedTools?: string[] | null | undefined;
536
+ displayText?: string | undefined;
537
+ } | undefined;
538
+ }>;
539
+ type SessionProtocolMessage = z.infer<typeof SessionProtocolMessageSchema>;
540
+ declare const MessageContentSchema: z.ZodObject<{
541
+ role: z.ZodLiteral<"session">;
542
+ content: z.ZodEffects<z.ZodObject<{
543
+ id: z.ZodString;
544
+ time: z.ZodNumber;
545
+ role: z.ZodEnum<["user", "agent"]>;
546
+ turn: z.ZodOptional<z.ZodString>;
547
+ subagent: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
548
+ ev: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
549
+ t: z.ZodLiteral<"text">;
550
+ text: z.ZodString;
551
+ thinking: z.ZodOptional<z.ZodBoolean>;
552
+ }, "strip", z.ZodTypeAny, {
553
+ t: "text";
554
+ text: string;
555
+ thinking?: boolean | undefined;
556
+ }, {
557
+ t: "text";
558
+ text: string;
559
+ thinking?: boolean | undefined;
560
+ }>, z.ZodObject<{
561
+ t: z.ZodLiteral<"service">;
562
+ text: z.ZodString;
563
+ }, "strip", z.ZodTypeAny, {
564
+ t: "service";
565
+ text: string;
566
+ }, {
567
+ t: "service";
568
+ text: string;
569
+ }>, z.ZodObject<{
570
+ t: z.ZodLiteral<"tool-call-start">;
571
+ call: z.ZodString;
572
+ name: z.ZodString;
573
+ title: z.ZodString;
574
+ description: z.ZodString;
575
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
576
+ }, "strip", z.ZodTypeAny, {
577
+ t: "tool-call-start";
578
+ call: string;
579
+ name: string;
580
+ title: string;
581
+ description: string;
582
+ args: Record<string, unknown>;
583
+ }, {
584
+ t: "tool-call-start";
585
+ call: string;
586
+ name: string;
587
+ title: string;
588
+ description: string;
589
+ args: Record<string, unknown>;
590
+ }>, z.ZodObject<{
591
+ t: z.ZodLiteral<"tool-call-end">;
592
+ call: z.ZodString;
593
+ }, "strip", z.ZodTypeAny, {
594
+ t: "tool-call-end";
595
+ call: string;
596
+ }, {
597
+ t: "tool-call-end";
598
+ call: string;
599
+ }>, z.ZodObject<{
600
+ t: z.ZodLiteral<"file">;
601
+ ref: z.ZodString;
602
+ name: z.ZodString;
603
+ size: z.ZodNumber;
604
+ image: z.ZodOptional<z.ZodObject<{
605
+ width: z.ZodNumber;
606
+ height: z.ZodNumber;
607
+ thumbhash: z.ZodString;
608
+ }, "strip", z.ZodTypeAny, {
609
+ width: number;
610
+ height: number;
611
+ thumbhash: string;
612
+ }, {
613
+ width: number;
614
+ height: number;
615
+ thumbhash: string;
616
+ }>>;
617
+ }, "strip", z.ZodTypeAny, {
618
+ t: "file";
619
+ name: string;
620
+ ref: string;
621
+ size: number;
622
+ image?: {
623
+ width: number;
624
+ height: number;
625
+ thumbhash: string;
626
+ } | undefined;
627
+ }, {
628
+ t: "file";
629
+ name: string;
630
+ ref: string;
631
+ size: number;
632
+ image?: {
633
+ width: number;
634
+ height: number;
635
+ thumbhash: string;
636
+ } | undefined;
637
+ }>, z.ZodObject<{
638
+ t: z.ZodLiteral<"turn-start">;
639
+ }, "strip", z.ZodTypeAny, {
640
+ t: "turn-start";
641
+ }, {
642
+ t: "turn-start";
643
+ }>, z.ZodObject<{
644
+ t: z.ZodLiteral<"start">;
645
+ title: z.ZodOptional<z.ZodString>;
646
+ }, "strip", z.ZodTypeAny, {
647
+ t: "start";
648
+ title?: string | undefined;
649
+ }, {
650
+ t: "start";
651
+ title?: string | undefined;
652
+ }>, z.ZodObject<{
653
+ t: z.ZodLiteral<"turn-end">;
654
+ status: z.ZodEnum<["completed", "failed", "cancelled"]>;
655
+ }, "strip", z.ZodTypeAny, {
656
+ t: "turn-end";
657
+ status: "completed" | "failed" | "cancelled";
658
+ }, {
659
+ t: "turn-end";
660
+ status: "completed" | "failed" | "cancelled";
661
+ }>, z.ZodObject<{
662
+ t: z.ZodLiteral<"stop">;
663
+ }, "strip", z.ZodTypeAny, {
664
+ t: "stop";
665
+ }, {
666
+ t: "stop";
667
+ }>]>;
668
+ }, "strip", z.ZodTypeAny, {
669
+ id: string;
670
+ role: "user" | "agent";
671
+ time: number;
672
+ ev: {
673
+ t: "text";
674
+ text: string;
675
+ thinking?: boolean | undefined;
676
+ } | {
677
+ t: "service";
678
+ text: string;
679
+ } | {
680
+ t: "tool-call-start";
681
+ call: string;
682
+ name: string;
683
+ title: string;
684
+ description: string;
685
+ args: Record<string, unknown>;
686
+ } | {
687
+ t: "tool-call-end";
688
+ call: string;
689
+ } | {
690
+ t: "file";
691
+ name: string;
692
+ ref: string;
693
+ size: number;
694
+ image?: {
695
+ width: number;
696
+ height: number;
697
+ thumbhash: string;
698
+ } | undefined;
699
+ } | {
700
+ t: "turn-start";
701
+ } | {
702
+ t: "start";
703
+ title?: string | undefined;
704
+ } | {
705
+ t: "turn-end";
706
+ status: "completed" | "failed" | "cancelled";
707
+ } | {
708
+ t: "stop";
709
+ };
710
+ turn?: string | undefined;
711
+ subagent?: string | undefined;
712
+ }, {
713
+ id: string;
714
+ role: "user" | "agent";
715
+ time: number;
716
+ ev: {
717
+ t: "text";
718
+ text: string;
719
+ thinking?: boolean | undefined;
720
+ } | {
721
+ t: "service";
722
+ text: string;
723
+ } | {
724
+ t: "tool-call-start";
725
+ call: string;
726
+ name: string;
727
+ title: string;
728
+ description: string;
729
+ args: Record<string, unknown>;
730
+ } | {
731
+ t: "tool-call-end";
732
+ call: string;
733
+ } | {
734
+ t: "file";
735
+ name: string;
736
+ ref: string;
737
+ size: number;
738
+ image?: {
739
+ width: number;
740
+ height: number;
741
+ thumbhash: string;
742
+ } | undefined;
743
+ } | {
744
+ t: "turn-start";
745
+ } | {
746
+ t: "start";
747
+ title?: string | undefined;
748
+ } | {
749
+ t: "turn-end";
750
+ status: "completed" | "failed" | "cancelled";
751
+ } | {
752
+ t: "stop";
753
+ };
754
+ turn?: string | undefined;
755
+ subagent?: string | undefined;
756
+ }>, {
757
+ id: string;
758
+ role: "user" | "agent";
759
+ time: number;
760
+ ev: {
761
+ t: "text";
762
+ text: string;
763
+ thinking?: boolean | undefined;
764
+ } | {
765
+ t: "service";
766
+ text: string;
767
+ } | {
768
+ t: "tool-call-start";
769
+ call: string;
770
+ name: string;
771
+ title: string;
772
+ description: string;
773
+ args: Record<string, unknown>;
774
+ } | {
775
+ t: "tool-call-end";
776
+ call: string;
777
+ } | {
778
+ t: "file";
779
+ name: string;
780
+ ref: string;
781
+ size: number;
782
+ image?: {
783
+ width: number;
784
+ height: number;
785
+ thumbhash: string;
786
+ } | undefined;
787
+ } | {
788
+ t: "turn-start";
789
+ } | {
790
+ t: "start";
791
+ title?: string | undefined;
792
+ } | {
793
+ t: "turn-end";
794
+ status: "completed" | "failed" | "cancelled";
795
+ } | {
796
+ t: "stop";
797
+ };
798
+ turn?: string | undefined;
799
+ subagent?: string | undefined;
800
+ }, {
801
+ id: string;
802
+ role: "user" | "agent";
803
+ time: number;
804
+ ev: {
805
+ t: "text";
806
+ text: string;
807
+ thinking?: boolean | undefined;
808
+ } | {
809
+ t: "service";
810
+ text: string;
811
+ } | {
812
+ t: "tool-call-start";
813
+ call: string;
814
+ name: string;
815
+ title: string;
816
+ description: string;
817
+ args: Record<string, unknown>;
818
+ } | {
819
+ t: "tool-call-end";
820
+ call: string;
821
+ } | {
822
+ t: "file";
823
+ name: string;
824
+ ref: string;
825
+ size: number;
826
+ image?: {
827
+ width: number;
828
+ height: number;
829
+ thumbhash: string;
830
+ } | undefined;
831
+ } | {
832
+ t: "turn-start";
833
+ } | {
834
+ t: "start";
835
+ title?: string | undefined;
836
+ } | {
837
+ t: "turn-end";
838
+ status: "completed" | "failed" | "cancelled";
839
+ } | {
840
+ t: "stop";
841
+ };
842
+ turn?: string | undefined;
843
+ subagent?: string | undefined;
844
+ }>;
845
+ meta: z.ZodOptional<z.ZodObject<{
846
+ sentFrom: z.ZodOptional<z.ZodString>;
847
+ permissionMode: z.ZodOptional<z.ZodEnum<["default", "acceptEdits", "bypassPermissions", "plan", "read-only", "safe-yolo", "yolo"]>>;
848
+ model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
849
+ fallbackModel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
850
+ customSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
851
+ appendSystemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
852
+ allowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
853
+ disallowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
854
+ displayText: z.ZodOptional<z.ZodString>;
855
+ }, "strip", z.ZodTypeAny, {
856
+ sentFrom?: string | undefined;
857
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
858
+ model?: string | null | undefined;
859
+ fallbackModel?: string | null | undefined;
860
+ customSystemPrompt?: string | null | undefined;
861
+ appendSystemPrompt?: string | null | undefined;
862
+ allowedTools?: string[] | null | undefined;
863
+ disallowedTools?: string[] | null | undefined;
864
+ displayText?: string | undefined;
865
+ }, {
866
+ sentFrom?: string | undefined;
867
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
868
+ model?: string | null | undefined;
869
+ fallbackModel?: string | null | undefined;
870
+ customSystemPrompt?: string | null | undefined;
871
+ appendSystemPrompt?: string | null | undefined;
872
+ allowedTools?: string[] | null | undefined;
873
+ disallowedTools?: string[] | null | undefined;
874
+ displayText?: string | undefined;
875
+ }>>;
876
+ }, "strip", z.ZodTypeAny, {
877
+ content: {
878
+ id: string;
879
+ role: "user" | "agent";
880
+ time: number;
881
+ ev: {
882
+ t: "text";
883
+ text: string;
884
+ thinking?: boolean | undefined;
885
+ } | {
886
+ t: "service";
887
+ text: string;
888
+ } | {
889
+ t: "tool-call-start";
890
+ call: string;
891
+ name: string;
892
+ title: string;
893
+ description: string;
894
+ args: Record<string, unknown>;
895
+ } | {
896
+ t: "tool-call-end";
897
+ call: string;
898
+ } | {
899
+ t: "file";
900
+ name: string;
901
+ ref: string;
902
+ size: number;
903
+ image?: {
904
+ width: number;
905
+ height: number;
906
+ thumbhash: string;
907
+ } | undefined;
908
+ } | {
909
+ t: "turn-start";
910
+ } | {
911
+ t: "start";
912
+ title?: string | undefined;
913
+ } | {
914
+ t: "turn-end";
915
+ status: "completed" | "failed" | "cancelled";
916
+ } | {
917
+ t: "stop";
918
+ };
919
+ turn?: string | undefined;
920
+ subagent?: string | undefined;
921
+ };
922
+ role: "session";
923
+ meta?: {
924
+ sentFrom?: string | undefined;
925
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
926
+ model?: string | null | undefined;
927
+ fallbackModel?: string | null | undefined;
928
+ customSystemPrompt?: string | null | undefined;
929
+ appendSystemPrompt?: string | null | undefined;
930
+ allowedTools?: string[] | null | undefined;
931
+ disallowedTools?: string[] | null | undefined;
932
+ displayText?: string | undefined;
933
+ } | undefined;
934
+ }, {
935
+ content: {
936
+ id: string;
937
+ role: "user" | "agent";
938
+ time: number;
939
+ ev: {
940
+ t: "text";
941
+ text: string;
942
+ thinking?: boolean | undefined;
943
+ } | {
944
+ t: "service";
945
+ text: string;
946
+ } | {
947
+ t: "tool-call-start";
948
+ call: string;
949
+ name: string;
950
+ title: string;
951
+ description: string;
952
+ args: Record<string, unknown>;
953
+ } | {
954
+ t: "tool-call-end";
955
+ call: string;
956
+ } | {
957
+ t: "file";
958
+ name: string;
959
+ ref: string;
960
+ size: number;
961
+ image?: {
962
+ width: number;
963
+ height: number;
964
+ thumbhash: string;
965
+ } | undefined;
966
+ } | {
967
+ t: "turn-start";
968
+ } | {
969
+ t: "start";
970
+ title?: string | undefined;
971
+ } | {
972
+ t: "turn-end";
973
+ status: "completed" | "failed" | "cancelled";
974
+ } | {
975
+ t: "stop";
976
+ };
977
+ turn?: string | undefined;
978
+ subagent?: string | undefined;
979
+ };
980
+ role: "session";
981
+ meta?: {
982
+ sentFrom?: string | undefined;
983
+ permissionMode?: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "read-only" | "safe-yolo" | "yolo" | undefined;
984
+ model?: string | null | undefined;
985
+ fallbackModel?: string | null | undefined;
986
+ customSystemPrompt?: string | null | undefined;
987
+ appendSystemPrompt?: string | null | undefined;
988
+ allowedTools?: string[] | null | undefined;
989
+ disallowedTools?: string[] | null | undefined;
990
+ displayText?: string | undefined;
991
+ } | undefined;
992
+ }>;
993
+ type MessageContent = z.infer<typeof MessageContentSchema>;
994
+ declare const VersionedEncryptedValueSchema: z.ZodObject<{
995
+ version: z.ZodNumber;
996
+ value: z.ZodString;
997
+ }, "strip", z.ZodTypeAny, {
998
+ value: string;
999
+ version: number;
1000
+ }, {
1001
+ value: string;
1002
+ version: number;
1003
+ }>;
1004
+ type VersionedEncryptedValue = z.infer<typeof VersionedEncryptedValueSchema>;
1005
+ declare const VersionedNullableEncryptedValueSchema: z.ZodObject<{
1006
+ version: z.ZodNumber;
1007
+ value: z.ZodNullable<z.ZodString>;
1008
+ }, "strip", z.ZodTypeAny, {
1009
+ value: string | null;
1010
+ version: number;
1011
+ }, {
1012
+ value: string | null;
1013
+ version: number;
1014
+ }>;
1015
+ type VersionedNullableEncryptedValue = z.infer<typeof VersionedNullableEncryptedValueSchema>;
1016
+ declare const UpdateNewMessageBodySchema: z.ZodObject<{
1017
+ t: z.ZodLiteral<"new-message">;
1018
+ sid: z.ZodString;
1019
+ message: z.ZodObject<{
1020
+ id: z.ZodString;
1021
+ seq: z.ZodNumber;
1022
+ localId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1023
+ content: z.ZodObject<{
1024
+ c: z.ZodString;
1025
+ t: z.ZodLiteral<"encrypted">;
1026
+ }, "strip", z.ZodTypeAny, {
1027
+ c: string;
1028
+ t: "encrypted";
1029
+ }, {
1030
+ c: string;
1031
+ t: "encrypted";
1032
+ }>;
1033
+ createdAt: z.ZodNumber;
1034
+ updatedAt: z.ZodNumber;
1035
+ }, "strip", z.ZodTypeAny, {
1036
+ id: string;
1037
+ seq: number;
1038
+ content: {
1039
+ c: string;
1040
+ t: "encrypted";
1041
+ };
1042
+ createdAt: number;
1043
+ updatedAt: number;
1044
+ localId?: string | null | undefined;
1045
+ }, {
1046
+ id: string;
1047
+ seq: number;
1048
+ content: {
1049
+ c: string;
1050
+ t: "encrypted";
1051
+ };
1052
+ createdAt: number;
1053
+ updatedAt: number;
1054
+ localId?: string | null | undefined;
1055
+ }>;
1056
+ }, "strip", z.ZodTypeAny, {
1057
+ t: "new-message";
1058
+ message: {
1059
+ id: string;
1060
+ seq: number;
1061
+ content: {
1062
+ c: string;
1063
+ t: "encrypted";
1064
+ };
1065
+ createdAt: number;
1066
+ updatedAt: number;
1067
+ localId?: string | null | undefined;
1068
+ };
1069
+ sid: string;
1070
+ }, {
1071
+ t: "new-message";
1072
+ message: {
1073
+ id: string;
1074
+ seq: number;
1075
+ content: {
1076
+ c: string;
1077
+ t: "encrypted";
1078
+ };
1079
+ createdAt: number;
1080
+ updatedAt: number;
1081
+ localId?: string | null | undefined;
1082
+ };
1083
+ sid: string;
1084
+ }>;
1085
+ type UpdateNewMessageBody = z.infer<typeof UpdateNewMessageBodySchema>;
1086
+ declare const UpdateSessionBodySchema: z.ZodObject<{
1087
+ t: z.ZodLiteral<"update-session">;
1088
+ id: z.ZodString;
1089
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1090
+ version: z.ZodNumber;
1091
+ value: z.ZodString;
1092
+ }, "strip", z.ZodTypeAny, {
1093
+ value: string;
1094
+ version: number;
1095
+ }, {
1096
+ value: string;
1097
+ version: number;
1098
+ }>>>;
1099
+ agentState: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1100
+ version: z.ZodNumber;
1101
+ value: z.ZodNullable<z.ZodString>;
1102
+ }, "strip", z.ZodTypeAny, {
1103
+ value: string | null;
1104
+ version: number;
1105
+ }, {
1106
+ value: string | null;
1107
+ version: number;
1108
+ }>>>;
1109
+ }, "strip", z.ZodTypeAny, {
1110
+ t: "update-session";
1111
+ id: string;
1112
+ metadata?: {
1113
+ value: string;
1114
+ version: number;
1115
+ } | null | undefined;
1116
+ agentState?: {
1117
+ value: string | null;
1118
+ version: number;
1119
+ } | null | undefined;
1120
+ }, {
1121
+ t: "update-session";
1122
+ id: string;
1123
+ metadata?: {
1124
+ value: string;
1125
+ version: number;
1126
+ } | null | undefined;
1127
+ agentState?: {
1128
+ value: string | null;
1129
+ version: number;
1130
+ } | null | undefined;
1131
+ }>;
1132
+ type UpdateSessionBody = z.infer<typeof UpdateSessionBodySchema>;
1133
+ declare const VersionedMachineEncryptedValueSchema: z.ZodObject<{
1134
+ version: z.ZodNumber;
1135
+ value: z.ZodString;
1136
+ }, "strip", z.ZodTypeAny, {
1137
+ value: string;
1138
+ version: number;
1139
+ }, {
1140
+ value: string;
1141
+ version: number;
1142
+ }>;
1143
+ type VersionedMachineEncryptedValue = z.infer<typeof VersionedMachineEncryptedValueSchema>;
1144
+ declare const UpdateMachineBodySchema: z.ZodObject<{
1145
+ t: z.ZodLiteral<"update-machine">;
1146
+ machineId: z.ZodString;
1147
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1148
+ version: z.ZodNumber;
1149
+ value: z.ZodString;
1150
+ }, "strip", z.ZodTypeAny, {
1151
+ value: string;
1152
+ version: number;
1153
+ }, {
1154
+ value: string;
1155
+ version: number;
1156
+ }>>>;
1157
+ daemonState: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1158
+ version: z.ZodNumber;
1159
+ value: z.ZodString;
1160
+ }, "strip", z.ZodTypeAny, {
1161
+ value: string;
1162
+ version: number;
1163
+ }, {
1164
+ value: string;
1165
+ version: number;
1166
+ }>>>;
1167
+ active: z.ZodOptional<z.ZodBoolean>;
1168
+ activeAt: z.ZodOptional<z.ZodNumber>;
1169
+ }, "strip", z.ZodTypeAny, {
1170
+ t: "update-machine";
1171
+ machineId: string;
1172
+ metadata?: {
1173
+ value: string;
1174
+ version: number;
1175
+ } | null | undefined;
1176
+ daemonState?: {
1177
+ value: string;
1178
+ version: number;
1179
+ } | null | undefined;
1180
+ active?: boolean | undefined;
1181
+ activeAt?: number | undefined;
1182
+ }, {
1183
+ t: "update-machine";
1184
+ machineId: string;
1185
+ metadata?: {
1186
+ value: string;
1187
+ version: number;
1188
+ } | null | undefined;
1189
+ daemonState?: {
1190
+ value: string;
1191
+ version: number;
1192
+ } | null | undefined;
1193
+ active?: boolean | undefined;
1194
+ activeAt?: number | undefined;
1195
+ }>;
1196
+ type UpdateMachineBody = z.infer<typeof UpdateMachineBodySchema>;
1197
+ declare const CoreUpdateBodySchema: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
1198
+ t: z.ZodLiteral<"new-message">;
1199
+ sid: z.ZodString;
1200
+ message: z.ZodObject<{
1201
+ id: z.ZodString;
1202
+ seq: z.ZodNumber;
1203
+ localId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1204
+ content: z.ZodObject<{
1205
+ c: z.ZodString;
1206
+ t: z.ZodLiteral<"encrypted">;
1207
+ }, "strip", z.ZodTypeAny, {
1208
+ c: string;
1209
+ t: "encrypted";
1210
+ }, {
1211
+ c: string;
1212
+ t: "encrypted";
1213
+ }>;
1214
+ createdAt: z.ZodNumber;
1215
+ updatedAt: z.ZodNumber;
1216
+ }, "strip", z.ZodTypeAny, {
1217
+ id: string;
1218
+ seq: number;
1219
+ content: {
1220
+ c: string;
1221
+ t: "encrypted";
1222
+ };
1223
+ createdAt: number;
1224
+ updatedAt: number;
1225
+ localId?: string | null | undefined;
1226
+ }, {
1227
+ id: string;
1228
+ seq: number;
1229
+ content: {
1230
+ c: string;
1231
+ t: "encrypted";
1232
+ };
1233
+ createdAt: number;
1234
+ updatedAt: number;
1235
+ localId?: string | null | undefined;
1236
+ }>;
1237
+ }, "strip", z.ZodTypeAny, {
1238
+ t: "new-message";
1239
+ message: {
1240
+ id: string;
1241
+ seq: number;
1242
+ content: {
1243
+ c: string;
1244
+ t: "encrypted";
1245
+ };
1246
+ createdAt: number;
1247
+ updatedAt: number;
1248
+ localId?: string | null | undefined;
1249
+ };
1250
+ sid: string;
1251
+ }, {
1252
+ t: "new-message";
1253
+ message: {
1254
+ id: string;
1255
+ seq: number;
1256
+ content: {
1257
+ c: string;
1258
+ t: "encrypted";
1259
+ };
1260
+ createdAt: number;
1261
+ updatedAt: number;
1262
+ localId?: string | null | undefined;
1263
+ };
1264
+ sid: string;
1265
+ }>, z.ZodObject<{
1266
+ t: z.ZodLiteral<"update-session">;
1267
+ id: z.ZodString;
1268
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1269
+ version: z.ZodNumber;
1270
+ value: z.ZodString;
1271
+ }, "strip", z.ZodTypeAny, {
1272
+ value: string;
1273
+ version: number;
1274
+ }, {
1275
+ value: string;
1276
+ version: number;
1277
+ }>>>;
1278
+ agentState: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1279
+ version: z.ZodNumber;
1280
+ value: z.ZodNullable<z.ZodString>;
1281
+ }, "strip", z.ZodTypeAny, {
1282
+ value: string | null;
1283
+ version: number;
1284
+ }, {
1285
+ value: string | null;
1286
+ version: number;
1287
+ }>>>;
1288
+ }, "strip", z.ZodTypeAny, {
1289
+ t: "update-session";
1290
+ id: string;
1291
+ metadata?: {
1292
+ value: string;
1293
+ version: number;
1294
+ } | null | undefined;
1295
+ agentState?: {
1296
+ value: string | null;
1297
+ version: number;
1298
+ } | null | undefined;
1299
+ }, {
1300
+ t: "update-session";
1301
+ id: string;
1302
+ metadata?: {
1303
+ value: string;
1304
+ version: number;
1305
+ } | null | undefined;
1306
+ agentState?: {
1307
+ value: string | null;
1308
+ version: number;
1309
+ } | null | undefined;
1310
+ }>, z.ZodObject<{
1311
+ t: z.ZodLiteral<"update-machine">;
1312
+ machineId: z.ZodString;
1313
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1314
+ version: z.ZodNumber;
1315
+ value: z.ZodString;
1316
+ }, "strip", z.ZodTypeAny, {
1317
+ value: string;
1318
+ version: number;
1319
+ }, {
1320
+ value: string;
1321
+ version: number;
1322
+ }>>>;
1323
+ daemonState: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1324
+ version: z.ZodNumber;
1325
+ value: z.ZodString;
1326
+ }, "strip", z.ZodTypeAny, {
1327
+ value: string;
1328
+ version: number;
1329
+ }, {
1330
+ value: string;
1331
+ version: number;
1332
+ }>>>;
1333
+ active: z.ZodOptional<z.ZodBoolean>;
1334
+ activeAt: z.ZodOptional<z.ZodNumber>;
1335
+ }, "strip", z.ZodTypeAny, {
1336
+ t: "update-machine";
1337
+ machineId: string;
1338
+ metadata?: {
1339
+ value: string;
1340
+ version: number;
1341
+ } | null | undefined;
1342
+ daemonState?: {
1343
+ value: string;
1344
+ version: number;
1345
+ } | null | undefined;
1346
+ active?: boolean | undefined;
1347
+ activeAt?: number | undefined;
1348
+ }, {
1349
+ t: "update-machine";
1350
+ machineId: string;
1351
+ metadata?: {
1352
+ value: string;
1353
+ version: number;
1354
+ } | null | undefined;
1355
+ daemonState?: {
1356
+ value: string;
1357
+ version: number;
1358
+ } | null | undefined;
1359
+ active?: boolean | undefined;
1360
+ activeAt?: number | undefined;
1361
+ }>]>;
1362
+ type CoreUpdateBody = z.infer<typeof CoreUpdateBodySchema>;
1363
+ declare const CoreUpdateContainerSchema: z.ZodObject<{
1364
+ id: z.ZodString;
1365
+ seq: z.ZodNumber;
1366
+ body: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
1367
+ t: z.ZodLiteral<"new-message">;
1368
+ sid: z.ZodString;
1369
+ message: z.ZodObject<{
1370
+ id: z.ZodString;
1371
+ seq: z.ZodNumber;
1372
+ localId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1373
+ content: z.ZodObject<{
1374
+ c: z.ZodString;
1375
+ t: z.ZodLiteral<"encrypted">;
1376
+ }, "strip", z.ZodTypeAny, {
1377
+ c: string;
1378
+ t: "encrypted";
1379
+ }, {
1380
+ c: string;
1381
+ t: "encrypted";
1382
+ }>;
1383
+ createdAt: z.ZodNumber;
1384
+ updatedAt: z.ZodNumber;
1385
+ }, "strip", z.ZodTypeAny, {
1386
+ id: string;
1387
+ seq: number;
1388
+ content: {
1389
+ c: string;
1390
+ t: "encrypted";
1391
+ };
1392
+ createdAt: number;
1393
+ updatedAt: number;
1394
+ localId?: string | null | undefined;
1395
+ }, {
1396
+ id: string;
1397
+ seq: number;
1398
+ content: {
1399
+ c: string;
1400
+ t: "encrypted";
1401
+ };
1402
+ createdAt: number;
1403
+ updatedAt: number;
1404
+ localId?: string | null | undefined;
1405
+ }>;
1406
+ }, "strip", z.ZodTypeAny, {
1407
+ t: "new-message";
1408
+ message: {
1409
+ id: string;
1410
+ seq: number;
1411
+ content: {
1412
+ c: string;
1413
+ t: "encrypted";
1414
+ };
1415
+ createdAt: number;
1416
+ updatedAt: number;
1417
+ localId?: string | null | undefined;
1418
+ };
1419
+ sid: string;
1420
+ }, {
1421
+ t: "new-message";
1422
+ message: {
1423
+ id: string;
1424
+ seq: number;
1425
+ content: {
1426
+ c: string;
1427
+ t: "encrypted";
1428
+ };
1429
+ createdAt: number;
1430
+ updatedAt: number;
1431
+ localId?: string | null | undefined;
1432
+ };
1433
+ sid: string;
1434
+ }>, z.ZodObject<{
1435
+ t: z.ZodLiteral<"update-session">;
1436
+ id: z.ZodString;
1437
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1438
+ version: z.ZodNumber;
1439
+ value: z.ZodString;
1440
+ }, "strip", z.ZodTypeAny, {
1441
+ value: string;
1442
+ version: number;
1443
+ }, {
1444
+ value: string;
1445
+ version: number;
1446
+ }>>>;
1447
+ agentState: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1448
+ version: z.ZodNumber;
1449
+ value: z.ZodNullable<z.ZodString>;
1450
+ }, "strip", z.ZodTypeAny, {
1451
+ value: string | null;
1452
+ version: number;
1453
+ }, {
1454
+ value: string | null;
1455
+ version: number;
1456
+ }>>>;
1457
+ }, "strip", z.ZodTypeAny, {
1458
+ t: "update-session";
1459
+ id: string;
1460
+ metadata?: {
1461
+ value: string;
1462
+ version: number;
1463
+ } | null | undefined;
1464
+ agentState?: {
1465
+ value: string | null;
1466
+ version: number;
1467
+ } | null | undefined;
1468
+ }, {
1469
+ t: "update-session";
1470
+ id: string;
1471
+ metadata?: {
1472
+ value: string;
1473
+ version: number;
1474
+ } | null | undefined;
1475
+ agentState?: {
1476
+ value: string | null;
1477
+ version: number;
1478
+ } | null | undefined;
1479
+ }>, z.ZodObject<{
1480
+ t: z.ZodLiteral<"update-machine">;
1481
+ machineId: z.ZodString;
1482
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1483
+ version: z.ZodNumber;
1484
+ value: z.ZodString;
1485
+ }, "strip", z.ZodTypeAny, {
1486
+ value: string;
1487
+ version: number;
1488
+ }, {
1489
+ value: string;
1490
+ version: number;
1491
+ }>>>;
1492
+ daemonState: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1493
+ version: z.ZodNumber;
1494
+ value: z.ZodString;
1495
+ }, "strip", z.ZodTypeAny, {
1496
+ value: string;
1497
+ version: number;
1498
+ }, {
1499
+ value: string;
1500
+ version: number;
1501
+ }>>>;
1502
+ active: z.ZodOptional<z.ZodBoolean>;
1503
+ activeAt: z.ZodOptional<z.ZodNumber>;
1504
+ }, "strip", z.ZodTypeAny, {
1505
+ t: "update-machine";
1506
+ machineId: string;
1507
+ metadata?: {
1508
+ value: string;
1509
+ version: number;
1510
+ } | null | undefined;
1511
+ daemonState?: {
1512
+ value: string;
1513
+ version: number;
1514
+ } | null | undefined;
1515
+ active?: boolean | undefined;
1516
+ activeAt?: number | undefined;
1517
+ }, {
1518
+ t: "update-machine";
1519
+ machineId: string;
1520
+ metadata?: {
1521
+ value: string;
1522
+ version: number;
1523
+ } | null | undefined;
1524
+ daemonState?: {
1525
+ value: string;
1526
+ version: number;
1527
+ } | null | undefined;
1528
+ active?: boolean | undefined;
1529
+ activeAt?: number | undefined;
1530
+ }>]>;
1531
+ createdAt: z.ZodNumber;
1532
+ }, "strip", z.ZodTypeAny, {
1533
+ id: string;
1534
+ seq: number;
1535
+ createdAt: number;
1536
+ body: {
1537
+ t: "new-message";
1538
+ message: {
1539
+ id: string;
1540
+ seq: number;
1541
+ content: {
1542
+ c: string;
1543
+ t: "encrypted";
1544
+ };
1545
+ createdAt: number;
1546
+ updatedAt: number;
1547
+ localId?: string | null | undefined;
1548
+ };
1549
+ sid: string;
1550
+ } | {
1551
+ t: "update-session";
1552
+ id: string;
1553
+ metadata?: {
1554
+ value: string;
1555
+ version: number;
1556
+ } | null | undefined;
1557
+ agentState?: {
1558
+ value: string | null;
1559
+ version: number;
1560
+ } | null | undefined;
1561
+ } | {
1562
+ t: "update-machine";
1563
+ machineId: string;
1564
+ metadata?: {
1565
+ value: string;
1566
+ version: number;
1567
+ } | null | undefined;
1568
+ daemonState?: {
1569
+ value: string;
1570
+ version: number;
1571
+ } | null | undefined;
1572
+ active?: boolean | undefined;
1573
+ activeAt?: number | undefined;
1574
+ };
1575
+ }, {
1576
+ id: string;
1577
+ seq: number;
1578
+ createdAt: number;
1579
+ body: {
1580
+ t: "new-message";
1581
+ message: {
1582
+ id: string;
1583
+ seq: number;
1584
+ content: {
1585
+ c: string;
1586
+ t: "encrypted";
1587
+ };
1588
+ createdAt: number;
1589
+ updatedAt: number;
1590
+ localId?: string | null | undefined;
1591
+ };
1592
+ sid: string;
1593
+ } | {
1594
+ t: "update-session";
1595
+ id: string;
1596
+ metadata?: {
1597
+ value: string;
1598
+ version: number;
1599
+ } | null | undefined;
1600
+ agentState?: {
1601
+ value: string | null;
1602
+ version: number;
1603
+ } | null | undefined;
1604
+ } | {
1605
+ t: "update-machine";
1606
+ machineId: string;
1607
+ metadata?: {
1608
+ value: string;
1609
+ version: number;
1610
+ } | null | undefined;
1611
+ daemonState?: {
1612
+ value: string;
1613
+ version: number;
1614
+ } | null | undefined;
1615
+ active?: boolean | undefined;
1616
+ activeAt?: number | undefined;
1617
+ };
1618
+ }>;
1619
+ type CoreUpdateContainer = z.infer<typeof CoreUpdateContainerSchema>;
1620
+
1621
+ declare const sessionRoleSchema: z.ZodEnum<["user", "agent"]>;
1622
+ type SessionRole = z.infer<typeof sessionRoleSchema>;
1623
+ declare const sessionTextEventSchema: z.ZodObject<{
1624
+ t: z.ZodLiteral<"text">;
1625
+ text: z.ZodString;
1626
+ thinking: z.ZodOptional<z.ZodBoolean>;
1627
+ }, "strip", z.ZodTypeAny, {
1628
+ t: "text";
1629
+ text: string;
1630
+ thinking?: boolean | undefined;
1631
+ }, {
1632
+ t: "text";
1633
+ text: string;
1634
+ thinking?: boolean | undefined;
1635
+ }>;
1636
+ declare const sessionServiceMessageEventSchema: z.ZodObject<{
1637
+ t: z.ZodLiteral<"service">;
1638
+ text: z.ZodString;
1639
+ }, "strip", z.ZodTypeAny, {
1640
+ t: "service";
1641
+ text: string;
1642
+ }, {
1643
+ t: "service";
1644
+ text: string;
1645
+ }>;
1646
+ declare const sessionToolCallStartEventSchema: z.ZodObject<{
1647
+ t: z.ZodLiteral<"tool-call-start">;
1648
+ call: z.ZodString;
1649
+ name: z.ZodString;
1650
+ title: z.ZodString;
1651
+ description: z.ZodString;
1652
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1653
+ }, "strip", z.ZodTypeAny, {
1654
+ t: "tool-call-start";
1655
+ call: string;
1656
+ name: string;
1657
+ title: string;
1658
+ description: string;
1659
+ args: Record<string, unknown>;
1660
+ }, {
1661
+ t: "tool-call-start";
1662
+ call: string;
1663
+ name: string;
1664
+ title: string;
1665
+ description: string;
1666
+ args: Record<string, unknown>;
1667
+ }>;
1668
+ declare const sessionToolCallEndEventSchema: z.ZodObject<{
1669
+ t: z.ZodLiteral<"tool-call-end">;
1670
+ call: z.ZodString;
1671
+ }, "strip", z.ZodTypeAny, {
1672
+ t: "tool-call-end";
1673
+ call: string;
1674
+ }, {
1675
+ t: "tool-call-end";
1676
+ call: string;
1677
+ }>;
1678
+ declare const sessionFileEventSchema: z.ZodObject<{
1679
+ t: z.ZodLiteral<"file">;
1680
+ ref: z.ZodString;
1681
+ name: z.ZodString;
1682
+ size: z.ZodNumber;
1683
+ image: z.ZodOptional<z.ZodObject<{
1684
+ width: z.ZodNumber;
1685
+ height: z.ZodNumber;
1686
+ thumbhash: z.ZodString;
1687
+ }, "strip", z.ZodTypeAny, {
1688
+ width: number;
1689
+ height: number;
1690
+ thumbhash: string;
1691
+ }, {
1692
+ width: number;
1693
+ height: number;
1694
+ thumbhash: string;
1695
+ }>>;
1696
+ }, "strip", z.ZodTypeAny, {
1697
+ t: "file";
1698
+ name: string;
1699
+ ref: string;
1700
+ size: number;
1701
+ image?: {
1702
+ width: number;
1703
+ height: number;
1704
+ thumbhash: string;
1705
+ } | undefined;
1706
+ }, {
1707
+ t: "file";
1708
+ name: string;
1709
+ ref: string;
1710
+ size: number;
1711
+ image?: {
1712
+ width: number;
1713
+ height: number;
1714
+ thumbhash: string;
1715
+ } | undefined;
1716
+ }>;
1717
+ declare const sessionTurnStartEventSchema: z.ZodObject<{
1718
+ t: z.ZodLiteral<"turn-start">;
1719
+ }, "strip", z.ZodTypeAny, {
1720
+ t: "turn-start";
1721
+ }, {
1722
+ t: "turn-start";
1723
+ }>;
1724
+ declare const sessionStartEventSchema: z.ZodObject<{
1725
+ t: z.ZodLiteral<"start">;
1726
+ title: z.ZodOptional<z.ZodString>;
1727
+ }, "strip", z.ZodTypeAny, {
1728
+ t: "start";
1729
+ title?: string | undefined;
1730
+ }, {
1731
+ t: "start";
1732
+ title?: string | undefined;
1733
+ }>;
1734
+ declare const sessionTurnEndStatusSchema: z.ZodEnum<["completed", "failed", "cancelled"]>;
1735
+ type SessionTurnEndStatus = z.infer<typeof sessionTurnEndStatusSchema>;
1736
+ declare const sessionTurnEndEventSchema: z.ZodObject<{
1737
+ t: z.ZodLiteral<"turn-end">;
1738
+ status: z.ZodEnum<["completed", "failed", "cancelled"]>;
1739
+ }, "strip", z.ZodTypeAny, {
1740
+ t: "turn-end";
1741
+ status: "completed" | "failed" | "cancelled";
1742
+ }, {
1743
+ t: "turn-end";
1744
+ status: "completed" | "failed" | "cancelled";
1745
+ }>;
1746
+ declare const sessionStopEventSchema: z.ZodObject<{
1747
+ t: z.ZodLiteral<"stop">;
1748
+ }, "strip", z.ZodTypeAny, {
1749
+ t: "stop";
1750
+ }, {
1751
+ t: "stop";
1752
+ }>;
1753
+ declare const sessionEventSchema: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
1754
+ t: z.ZodLiteral<"text">;
1755
+ text: z.ZodString;
1756
+ thinking: z.ZodOptional<z.ZodBoolean>;
1757
+ }, "strip", z.ZodTypeAny, {
1758
+ t: "text";
1759
+ text: string;
1760
+ thinking?: boolean | undefined;
1761
+ }, {
1762
+ t: "text";
1763
+ text: string;
1764
+ thinking?: boolean | undefined;
1765
+ }>, z.ZodObject<{
1766
+ t: z.ZodLiteral<"service">;
1767
+ text: z.ZodString;
1768
+ }, "strip", z.ZodTypeAny, {
1769
+ t: "service";
1770
+ text: string;
1771
+ }, {
1772
+ t: "service";
1773
+ text: string;
1774
+ }>, z.ZodObject<{
1775
+ t: z.ZodLiteral<"tool-call-start">;
1776
+ call: z.ZodString;
1777
+ name: z.ZodString;
1778
+ title: z.ZodString;
1779
+ description: z.ZodString;
1780
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1781
+ }, "strip", z.ZodTypeAny, {
1782
+ t: "tool-call-start";
1783
+ call: string;
1784
+ name: string;
1785
+ title: string;
1786
+ description: string;
1787
+ args: Record<string, unknown>;
1788
+ }, {
1789
+ t: "tool-call-start";
1790
+ call: string;
1791
+ name: string;
1792
+ title: string;
1793
+ description: string;
1794
+ args: Record<string, unknown>;
1795
+ }>, z.ZodObject<{
1796
+ t: z.ZodLiteral<"tool-call-end">;
1797
+ call: z.ZodString;
1798
+ }, "strip", z.ZodTypeAny, {
1799
+ t: "tool-call-end";
1800
+ call: string;
1801
+ }, {
1802
+ t: "tool-call-end";
1803
+ call: string;
1804
+ }>, z.ZodObject<{
1805
+ t: z.ZodLiteral<"file">;
1806
+ ref: z.ZodString;
1807
+ name: z.ZodString;
1808
+ size: z.ZodNumber;
1809
+ image: z.ZodOptional<z.ZodObject<{
1810
+ width: z.ZodNumber;
1811
+ height: z.ZodNumber;
1812
+ thumbhash: z.ZodString;
1813
+ }, "strip", z.ZodTypeAny, {
1814
+ width: number;
1815
+ height: number;
1816
+ thumbhash: string;
1817
+ }, {
1818
+ width: number;
1819
+ height: number;
1820
+ thumbhash: string;
1821
+ }>>;
1822
+ }, "strip", z.ZodTypeAny, {
1823
+ t: "file";
1824
+ name: string;
1825
+ ref: string;
1826
+ size: number;
1827
+ image?: {
1828
+ width: number;
1829
+ height: number;
1830
+ thumbhash: string;
1831
+ } | undefined;
1832
+ }, {
1833
+ t: "file";
1834
+ name: string;
1835
+ ref: string;
1836
+ size: number;
1837
+ image?: {
1838
+ width: number;
1839
+ height: number;
1840
+ thumbhash: string;
1841
+ } | undefined;
1842
+ }>, z.ZodObject<{
1843
+ t: z.ZodLiteral<"turn-start">;
1844
+ }, "strip", z.ZodTypeAny, {
1845
+ t: "turn-start";
1846
+ }, {
1847
+ t: "turn-start";
1848
+ }>, z.ZodObject<{
1849
+ t: z.ZodLiteral<"start">;
1850
+ title: z.ZodOptional<z.ZodString>;
1851
+ }, "strip", z.ZodTypeAny, {
1852
+ t: "start";
1853
+ title?: string | undefined;
1854
+ }, {
1855
+ t: "start";
1856
+ title?: string | undefined;
1857
+ }>, z.ZodObject<{
1858
+ t: z.ZodLiteral<"turn-end">;
1859
+ status: z.ZodEnum<["completed", "failed", "cancelled"]>;
1860
+ }, "strip", z.ZodTypeAny, {
1861
+ t: "turn-end";
1862
+ status: "completed" | "failed" | "cancelled";
1863
+ }, {
1864
+ t: "turn-end";
1865
+ status: "completed" | "failed" | "cancelled";
1866
+ }>, z.ZodObject<{
1867
+ t: z.ZodLiteral<"stop">;
1868
+ }, "strip", z.ZodTypeAny, {
1869
+ t: "stop";
1870
+ }, {
1871
+ t: "stop";
1872
+ }>]>;
1873
+ type SessionEvent = z.infer<typeof sessionEventSchema>;
1874
+ declare const sessionEnvelopeSchema: z.ZodEffects<z.ZodObject<{
1875
+ id: z.ZodString;
1876
+ time: z.ZodNumber;
1877
+ role: z.ZodEnum<["user", "agent"]>;
1878
+ turn: z.ZodOptional<z.ZodString>;
1879
+ subagent: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1880
+ ev: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
1881
+ t: z.ZodLiteral<"text">;
1882
+ text: z.ZodString;
1883
+ thinking: z.ZodOptional<z.ZodBoolean>;
1884
+ }, "strip", z.ZodTypeAny, {
1885
+ t: "text";
1886
+ text: string;
1887
+ thinking?: boolean | undefined;
1888
+ }, {
1889
+ t: "text";
1890
+ text: string;
1891
+ thinking?: boolean | undefined;
1892
+ }>, z.ZodObject<{
1893
+ t: z.ZodLiteral<"service">;
1894
+ text: z.ZodString;
1895
+ }, "strip", z.ZodTypeAny, {
1896
+ t: "service";
1897
+ text: string;
1898
+ }, {
1899
+ t: "service";
1900
+ text: string;
1901
+ }>, z.ZodObject<{
1902
+ t: z.ZodLiteral<"tool-call-start">;
1903
+ call: z.ZodString;
1904
+ name: z.ZodString;
1905
+ title: z.ZodString;
1906
+ description: z.ZodString;
1907
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1908
+ }, "strip", z.ZodTypeAny, {
1909
+ t: "tool-call-start";
1910
+ call: string;
1911
+ name: string;
1912
+ title: string;
1913
+ description: string;
1914
+ args: Record<string, unknown>;
1915
+ }, {
1916
+ t: "tool-call-start";
1917
+ call: string;
1918
+ name: string;
1919
+ title: string;
1920
+ description: string;
1921
+ args: Record<string, unknown>;
1922
+ }>, z.ZodObject<{
1923
+ t: z.ZodLiteral<"tool-call-end">;
1924
+ call: z.ZodString;
1925
+ }, "strip", z.ZodTypeAny, {
1926
+ t: "tool-call-end";
1927
+ call: string;
1928
+ }, {
1929
+ t: "tool-call-end";
1930
+ call: string;
1931
+ }>, z.ZodObject<{
1932
+ t: z.ZodLiteral<"file">;
1933
+ ref: z.ZodString;
1934
+ name: z.ZodString;
1935
+ size: z.ZodNumber;
1936
+ image: z.ZodOptional<z.ZodObject<{
1937
+ width: z.ZodNumber;
1938
+ height: z.ZodNumber;
1939
+ thumbhash: z.ZodString;
1940
+ }, "strip", z.ZodTypeAny, {
1941
+ width: number;
1942
+ height: number;
1943
+ thumbhash: string;
1944
+ }, {
1945
+ width: number;
1946
+ height: number;
1947
+ thumbhash: string;
1948
+ }>>;
1949
+ }, "strip", z.ZodTypeAny, {
1950
+ t: "file";
1951
+ name: string;
1952
+ ref: string;
1953
+ size: number;
1954
+ image?: {
1955
+ width: number;
1956
+ height: number;
1957
+ thumbhash: string;
1958
+ } | undefined;
1959
+ }, {
1960
+ t: "file";
1961
+ name: string;
1962
+ ref: string;
1963
+ size: number;
1964
+ image?: {
1965
+ width: number;
1966
+ height: number;
1967
+ thumbhash: string;
1968
+ } | undefined;
1969
+ }>, z.ZodObject<{
1970
+ t: z.ZodLiteral<"turn-start">;
1971
+ }, "strip", z.ZodTypeAny, {
1972
+ t: "turn-start";
1973
+ }, {
1974
+ t: "turn-start";
1975
+ }>, z.ZodObject<{
1976
+ t: z.ZodLiteral<"start">;
1977
+ title: z.ZodOptional<z.ZodString>;
1978
+ }, "strip", z.ZodTypeAny, {
1979
+ t: "start";
1980
+ title?: string | undefined;
1981
+ }, {
1982
+ t: "start";
1983
+ title?: string | undefined;
1984
+ }>, z.ZodObject<{
1985
+ t: z.ZodLiteral<"turn-end">;
1986
+ status: z.ZodEnum<["completed", "failed", "cancelled"]>;
1987
+ }, "strip", z.ZodTypeAny, {
1988
+ t: "turn-end";
1989
+ status: "completed" | "failed" | "cancelled";
1990
+ }, {
1991
+ t: "turn-end";
1992
+ status: "completed" | "failed" | "cancelled";
1993
+ }>, z.ZodObject<{
1994
+ t: z.ZodLiteral<"stop">;
1995
+ }, "strip", z.ZodTypeAny, {
1996
+ t: "stop";
1997
+ }, {
1998
+ t: "stop";
1999
+ }>]>;
2000
+ }, "strip", z.ZodTypeAny, {
2001
+ id: string;
2002
+ role: "user" | "agent";
2003
+ time: number;
2004
+ ev: {
2005
+ t: "text";
2006
+ text: string;
2007
+ thinking?: boolean | undefined;
2008
+ } | {
2009
+ t: "service";
2010
+ text: string;
2011
+ } | {
2012
+ t: "tool-call-start";
2013
+ call: string;
2014
+ name: string;
2015
+ title: string;
2016
+ description: string;
2017
+ args: Record<string, unknown>;
2018
+ } | {
2019
+ t: "tool-call-end";
2020
+ call: string;
2021
+ } | {
2022
+ t: "file";
2023
+ name: string;
2024
+ ref: string;
2025
+ size: number;
2026
+ image?: {
2027
+ width: number;
2028
+ height: number;
2029
+ thumbhash: string;
2030
+ } | undefined;
2031
+ } | {
2032
+ t: "turn-start";
2033
+ } | {
2034
+ t: "start";
2035
+ title?: string | undefined;
2036
+ } | {
2037
+ t: "turn-end";
2038
+ status: "completed" | "failed" | "cancelled";
2039
+ } | {
2040
+ t: "stop";
2041
+ };
2042
+ turn?: string | undefined;
2043
+ subagent?: string | undefined;
2044
+ }, {
2045
+ id: string;
2046
+ role: "user" | "agent";
2047
+ time: number;
2048
+ ev: {
2049
+ t: "text";
2050
+ text: string;
2051
+ thinking?: boolean | undefined;
2052
+ } | {
2053
+ t: "service";
2054
+ text: string;
2055
+ } | {
2056
+ t: "tool-call-start";
2057
+ call: string;
2058
+ name: string;
2059
+ title: string;
2060
+ description: string;
2061
+ args: Record<string, unknown>;
2062
+ } | {
2063
+ t: "tool-call-end";
2064
+ call: string;
2065
+ } | {
2066
+ t: "file";
2067
+ name: string;
2068
+ ref: string;
2069
+ size: number;
2070
+ image?: {
2071
+ width: number;
2072
+ height: number;
2073
+ thumbhash: string;
2074
+ } | undefined;
2075
+ } | {
2076
+ t: "turn-start";
2077
+ } | {
2078
+ t: "start";
2079
+ title?: string | undefined;
2080
+ } | {
2081
+ t: "turn-end";
2082
+ status: "completed" | "failed" | "cancelled";
2083
+ } | {
2084
+ t: "stop";
2085
+ };
2086
+ turn?: string | undefined;
2087
+ subagent?: string | undefined;
2088
+ }>, {
2089
+ id: string;
2090
+ role: "user" | "agent";
2091
+ time: number;
2092
+ ev: {
2093
+ t: "text";
2094
+ text: string;
2095
+ thinking?: boolean | undefined;
2096
+ } | {
2097
+ t: "service";
2098
+ text: string;
2099
+ } | {
2100
+ t: "tool-call-start";
2101
+ call: string;
2102
+ name: string;
2103
+ title: string;
2104
+ description: string;
2105
+ args: Record<string, unknown>;
2106
+ } | {
2107
+ t: "tool-call-end";
2108
+ call: string;
2109
+ } | {
2110
+ t: "file";
2111
+ name: string;
2112
+ ref: string;
2113
+ size: number;
2114
+ image?: {
2115
+ width: number;
2116
+ height: number;
2117
+ thumbhash: string;
2118
+ } | undefined;
2119
+ } | {
2120
+ t: "turn-start";
2121
+ } | {
2122
+ t: "start";
2123
+ title?: string | undefined;
2124
+ } | {
2125
+ t: "turn-end";
2126
+ status: "completed" | "failed" | "cancelled";
2127
+ } | {
2128
+ t: "stop";
2129
+ };
2130
+ turn?: string | undefined;
2131
+ subagent?: string | undefined;
2132
+ }, {
2133
+ id: string;
2134
+ role: "user" | "agent";
2135
+ time: number;
2136
+ ev: {
2137
+ t: "text";
2138
+ text: string;
2139
+ thinking?: boolean | undefined;
2140
+ } | {
2141
+ t: "service";
2142
+ text: string;
2143
+ } | {
2144
+ t: "tool-call-start";
2145
+ call: string;
2146
+ name: string;
2147
+ title: string;
2148
+ description: string;
2149
+ args: Record<string, unknown>;
2150
+ } | {
2151
+ t: "tool-call-end";
2152
+ call: string;
2153
+ } | {
2154
+ t: "file";
2155
+ name: string;
2156
+ ref: string;
2157
+ size: number;
2158
+ image?: {
2159
+ width: number;
2160
+ height: number;
2161
+ thumbhash: string;
2162
+ } | undefined;
2163
+ } | {
2164
+ t: "turn-start";
2165
+ } | {
2166
+ t: "start";
2167
+ title?: string | undefined;
2168
+ } | {
2169
+ t: "turn-end";
2170
+ status: "completed" | "failed" | "cancelled";
2171
+ } | {
2172
+ t: "stop";
2173
+ };
2174
+ turn?: string | undefined;
2175
+ subagent?: string | undefined;
2176
+ }>;
2177
+ type SessionEnvelope = z.infer<typeof sessionEnvelopeSchema>;
2178
+ type CreateEnvelopeOptions = {
2179
+ id?: string;
2180
+ time?: number;
2181
+ turn?: string;
2182
+ subagent?: string;
2183
+ };
2184
+ declare function createEnvelope(role: SessionRole, ev: SessionEvent, opts?: CreateEnvelopeOptions): SessionEnvelope;
2185
+
2186
+ declare function encodeBase64(bytes: Uint8Array): string;
2187
+ declare function decodeBase64(base64: string): Uint8Array;
2188
+ interface RemoteAuthMaterial {
2189
+ secret: Uint8Array;
2190
+ relayKey: Uint8Array;
2191
+ authKeyPair: {
2192
+ publicKey: Uint8Array;
2193
+ secretKey: Uint8Array;
2194
+ };
2195
+ contentKeyPair: {
2196
+ publicKey: Uint8Array;
2197
+ secretKey: Uint8Array;
2198
+ };
2199
+ publicKeyHex: string;
2200
+ }
2201
+ interface RemoteCredentialMaterial extends RemoteAuthMaterial {
2202
+ loginHandle: string;
2203
+ realmId: string;
2204
+ }
2205
+ interface RemoteOpaqueClientRegistrationStart {
2206
+ clientRegistrationState: string;
2207
+ registrationRequest: string;
2208
+ }
2209
+ interface RemoteOpaqueRegistrationFinishResult {
2210
+ registrationRecord: string;
2211
+ exportKey: string;
2212
+ relayKey: Uint8Array;
2213
+ serverStaticPublicKey: string;
2214
+ }
2215
+ interface RemoteOpaqueClientLoginStart {
2216
+ clientLoginState: string;
2217
+ startLoginRequest: string;
2218
+ }
2219
+ interface RemoteOpaqueLoginStartResult {
2220
+ loginResponse: string;
2221
+ serverLoginState: string;
2222
+ }
2223
+ interface RemoteOpaqueLoginFinishResult {
2224
+ finishLoginRequest: string;
2225
+ sessionKey: string;
2226
+ exportKey: string;
2227
+ relayKey: Uint8Array;
2228
+ serverStaticPublicKey: string;
2229
+ }
2230
+ type RemoteAuthClientKind = "browser" | "cli" | "api";
2231
+ interface RemoteAuthChallengeBinding {
2232
+ challengeId: string;
2233
+ challenge: string;
2234
+ clientKind: RemoteAuthClientKind;
2235
+ machineId?: string | null;
2236
+ }
2237
+ declare function deriveRemoteAuthMaterialFromSecret(secret: Uint8Array | string): RemoteAuthMaterial;
2238
+ declare function deriveRemoteLoginHandle(username: string, realmId: string): Promise<string>;
2239
+ declare function createRemoteOpaqueServerSetup(): Promise<string>;
2240
+ declare function getRemoteOpaqueServerPublicKey(serverSetup: string): Promise<string>;
2241
+ declare function deriveRemoteRelayKeyFromExportKey(exportKey: Uint8Array | string): Promise<Uint8Array>;
2242
+ declare function startRemoteOpaqueRegistration(password: string): Promise<RemoteOpaqueClientRegistrationStart>;
2243
+ declare function createRemoteOpaqueRegistrationResponse(params: {
2244
+ serverSetup: string;
2245
+ loginHandle: string;
2246
+ registrationRequest: string;
2247
+ }): Promise<{
2248
+ registrationResponse: string;
2249
+ }>;
2250
+ declare function finishRemoteOpaqueRegistration(params: {
2251
+ password: string;
2252
+ clientRegistrationState: string;
2253
+ registrationResponse: string;
2254
+ loginHandle: string;
2255
+ realmId: string;
2256
+ expectedServerPublicKey?: string;
2257
+ }): Promise<RemoteOpaqueRegistrationFinishResult>;
2258
+ declare function startRemoteOpaqueLogin(password: string): Promise<RemoteOpaqueClientLoginStart>;
2259
+ declare function startRemoteOpaqueServerLogin(params: {
2260
+ serverSetup: string;
2261
+ registrationRecord: string;
2262
+ startLoginRequest: string;
2263
+ loginHandle: string;
2264
+ realmId: string;
2265
+ }): Promise<RemoteOpaqueLoginStartResult>;
2266
+ declare function finishRemoteOpaqueLogin(params: {
2267
+ password: string;
2268
+ clientLoginState: string;
2269
+ loginResponse: string;
2270
+ loginHandle: string;
2271
+ realmId: string;
2272
+ expectedServerPublicKey?: string;
2273
+ }): Promise<RemoteOpaqueLoginFinishResult | null>;
2274
+ declare function finishRemoteOpaqueServerLogin(params: {
2275
+ serverLoginState: string;
2276
+ finishLoginRequest: string;
2277
+ loginHandle: string;
2278
+ realmId: string;
2279
+ }): Promise<{
2280
+ sessionKey: string;
2281
+ }>;
2282
+ declare function encodeRemoteStoredSecret(secret: Uint8Array): string;
2283
+ declare function decodeRemoteStoredSecret(secret: string): Uint8Array;
2284
+ declare function deriveRemoteStoredAccessMaterial(storedSecret: string): Promise<RemoteAuthMaterial>;
2285
+ declare function deriveRemoteAccessStorageSecret(username: string, password: string, realmId: string): Promise<string>;
2286
+ declare function deriveRemoteAccessMaterial(username: string, password: string, realmId: string): Promise<RemoteCredentialMaterial>;
2287
+ declare function deriveRemoteAuthMaterial(username: string, password: string, realmId: string): Promise<RemoteCredentialMaterial>;
2288
+ declare function buildRemoteAuthChallengeMessage(binding: RemoteAuthChallengeBinding): Uint8Array;
2289
+ declare function signRemoteAuthChallenge(secretKey: Uint8Array, binding: RemoteAuthChallengeBinding): string;
2290
+ declare function verifyRemoteAuthChallengeSignature(publicKey: Uint8Array, signature: Uint8Array, binding: RemoteAuthChallengeBinding): boolean;
2291
+ declare function generateRemoteRpcSigningKeyPair(): {
2292
+ publicKey: string;
2293
+ secretKey: string;
2294
+ };
2295
+ declare function signRemoteRpcResult(params: {
2296
+ machineId: string;
2297
+ requestId: string;
2298
+ encryptedResult: string;
2299
+ secretKey: Uint8Array | string;
2300
+ }): string;
2301
+ declare function verifyRemoteRpcResultSignature(params: {
2302
+ machineId: string;
2303
+ requestId: string;
2304
+ encryptedResult: string;
2305
+ signature: Uint8Array | string;
2306
+ publicKey: Uint8Array | string;
2307
+ }): boolean;
2308
+ declare function encryptRemotePayload(key: Uint8Array, payload: unknown): Promise<string>;
2309
+ declare function decryptRemotePayload<T>(key: Uint8Array, encoded: string): Promise<T>;
2310
+
2311
+ declare const RemoteRpcEnvelopeSchema: z.ZodObject<{
2312
+ requestId: z.ZodString;
2313
+ body: z.ZodUnknown;
2314
+ }, "strip", z.ZodTypeAny, {
2315
+ requestId: string;
2316
+ body?: unknown;
2317
+ }, {
2318
+ requestId: string;
2319
+ body?: unknown;
2320
+ }>;
2321
+ type RemoteRpcEnvelope = z.infer<typeof RemoteRpcEnvelopeSchema>;
2322
+ declare const RemoteRpcResultEnvelopeSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
2323
+ ok: z.ZodLiteral<true>;
2324
+ requestId: z.ZodString;
2325
+ body: z.ZodUnknown;
2326
+ }, "strip", z.ZodTypeAny, {
2327
+ requestId: string;
2328
+ ok: true;
2329
+ body?: unknown;
2330
+ }, {
2331
+ requestId: string;
2332
+ ok: true;
2333
+ body?: unknown;
2334
+ }>, z.ZodObject<{
2335
+ ok: z.ZodLiteral<false>;
2336
+ requestId: z.ZodString;
2337
+ error: z.ZodString;
2338
+ }, "strip", z.ZodTypeAny, {
2339
+ requestId: string;
2340
+ ok: false;
2341
+ error: string;
2342
+ }, {
2343
+ requestId: string;
2344
+ ok: false;
2345
+ error: string;
2346
+ }>]>;
2347
+ type RemoteRpcResultEnvelope = z.infer<typeof RemoteRpcResultEnvelopeSchema>;
2348
+ declare const RemoteMachineMetadataSchema: z.ZodObject<{
2349
+ machineId: z.ZodString;
2350
+ label: z.ZodString;
2351
+ host: z.ZodString;
2352
+ platform: z.ZodString;
2353
+ codexDir: z.ZodString;
2354
+ cliVersion: z.ZodString;
2355
+ rpcSigningPublicKey: z.ZodString;
2356
+ }, "strip", z.ZodTypeAny, {
2357
+ machineId: string;
2358
+ label: string;
2359
+ host: string;
2360
+ platform: string;
2361
+ codexDir: string;
2362
+ cliVersion: string;
2363
+ rpcSigningPublicKey: string;
2364
+ }, {
2365
+ machineId: string;
2366
+ label: string;
2367
+ host: string;
2368
+ platform: string;
2369
+ codexDir: string;
2370
+ cliVersion: string;
2371
+ rpcSigningPublicKey: string;
2372
+ }>;
2373
+ type RemoteMachineMetadata = z.infer<typeof RemoteMachineMetadataSchema>;
2374
+ declare const RemoteMachineStateSchema: z.ZodObject<{
2375
+ status: z.ZodEnum<["running", "offline", "error"]>;
2376
+ connectedAt: z.ZodNumber;
2377
+ lastHeartbeatAt: z.ZodNumber;
2378
+ localWebUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2379
+ }, "strip", z.ZodTypeAny, {
2380
+ status: "error" | "running" | "offline";
2381
+ connectedAt: number;
2382
+ lastHeartbeatAt: number;
2383
+ localWebUrl?: string | null | undefined;
2384
+ }, {
2385
+ status: "error" | "running" | "offline";
2386
+ connectedAt: number;
2387
+ lastHeartbeatAt: number;
2388
+ localWebUrl?: string | null | undefined;
2389
+ }>;
2390
+ type RemoteMachineState = z.infer<typeof RemoteMachineStateSchema>;
2391
+ declare const RemoteMachineDescriptionSchema: z.ZodObject<{
2392
+ id: z.ZodString;
2393
+ metadata: z.ZodObject<{
2394
+ machineId: z.ZodString;
2395
+ label: z.ZodString;
2396
+ host: z.ZodString;
2397
+ platform: z.ZodString;
2398
+ codexDir: z.ZodString;
2399
+ cliVersion: z.ZodString;
2400
+ rpcSigningPublicKey: z.ZodString;
2401
+ }, "strip", z.ZodTypeAny, {
2402
+ machineId: string;
2403
+ label: string;
2404
+ host: string;
2405
+ platform: string;
2406
+ codexDir: string;
2407
+ cliVersion: string;
2408
+ rpcSigningPublicKey: string;
2409
+ }, {
2410
+ machineId: string;
2411
+ label: string;
2412
+ host: string;
2413
+ platform: string;
2414
+ codexDir: string;
2415
+ cliVersion: string;
2416
+ rpcSigningPublicKey: string;
2417
+ }>;
2418
+ state: z.ZodNullable<z.ZodObject<{
2419
+ status: z.ZodEnum<["running", "offline", "error"]>;
2420
+ connectedAt: z.ZodNumber;
2421
+ lastHeartbeatAt: z.ZodNumber;
2422
+ localWebUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2423
+ }, "strip", z.ZodTypeAny, {
2424
+ status: "error" | "running" | "offline";
2425
+ connectedAt: number;
2426
+ lastHeartbeatAt: number;
2427
+ localWebUrl?: string | null | undefined;
2428
+ }, {
2429
+ status: "error" | "running" | "offline";
2430
+ connectedAt: number;
2431
+ lastHeartbeatAt: number;
2432
+ localWebUrl?: string | null | undefined;
2433
+ }>>;
2434
+ active: z.ZodBoolean;
2435
+ activeAt: z.ZodNumber;
2436
+ }, "strip", z.ZodTypeAny, {
2437
+ id: string;
2438
+ metadata: {
2439
+ machineId: string;
2440
+ label: string;
2441
+ host: string;
2442
+ platform: string;
2443
+ codexDir: string;
2444
+ cliVersion: string;
2445
+ rpcSigningPublicKey: string;
2446
+ };
2447
+ active: boolean;
2448
+ activeAt: number;
2449
+ state: {
2450
+ status: "error" | "running" | "offline";
2451
+ connectedAt: number;
2452
+ lastHeartbeatAt: number;
2453
+ localWebUrl?: string | null | undefined;
2454
+ } | null;
2455
+ }, {
2456
+ id: string;
2457
+ metadata: {
2458
+ machineId: string;
2459
+ label: string;
2460
+ host: string;
2461
+ platform: string;
2462
+ codexDir: string;
2463
+ cliVersion: string;
2464
+ rpcSigningPublicKey: string;
2465
+ };
2466
+ active: boolean;
2467
+ activeAt: number;
2468
+ state: {
2469
+ status: "error" | "running" | "offline";
2470
+ connectedAt: number;
2471
+ lastHeartbeatAt: number;
2472
+ localWebUrl?: string | null | undefined;
2473
+ } | null;
2474
+ }>;
2475
+ type RemoteMachineDescription = z.infer<typeof RemoteMachineDescriptionSchema>;
2476
+
2477
+ declare const RemoteAuthErrorCode: {
2478
+ readonly accountNotFound: "remote_account_not_found";
2479
+ readonly accountMismatch: "remote_account_mismatch";
2480
+ readonly setupTokensMissing: "remote_setup_tokens_missing";
2481
+ readonly setupTokenInvalid: "remote_setup_token_invalid";
2482
+ readonly loginAlreadyBound: "remote_login_already_bound";
2483
+ readonly machineAlreadyBound: "remote_machine_already_bound";
2484
+ readonly invalidLogin: "remote_invalid_login";
2485
+ readonly invalidRegister: "remote_invalid_register";
2486
+ readonly invalidLoginState: "remote_invalid_login_state";
2487
+ readonly adminPasswordInvalid: "remote_admin_password_invalid";
2488
+ readonly authUpgradeRequired: "remote_auth_upgrade_required";
2489
+ };
2490
+ type RemoteAuthErrorCode = (typeof RemoteAuthErrorCode)[keyof typeof RemoteAuthErrorCode];
2491
+ type RemoteAuthHintContext = "cli" | "browser" | "admin";
2492
+ declare function isRemoteAuthErrorCode(value: unknown): value is RemoteAuthErrorCode;
2493
+ declare function getRemoteAuthHint(params: {
2494
+ code?: string | null;
2495
+ error?: string | null;
2496
+ context: RemoteAuthHintContext;
2497
+ }): string;
2498
+
2499
+ export { CoreUpdateBodySchema, CoreUpdateContainerSchema, MessageContentSchema, MessageMetaSchema, RemoteAuthErrorCode, RemoteMachineDescriptionSchema, RemoteMachineMetadataSchema, RemoteMachineStateSchema, RemoteRpcEnvelopeSchema, RemoteRpcResultEnvelopeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSessionBodySchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, buildRemoteAuthChallengeMessage, createEnvelope, createRemoteOpaqueRegistrationResponse, createRemoteOpaqueServerSetup, decodeBase64, decodeRemoteStoredSecret, decryptRemotePayload, deriveRemoteAccessMaterial, deriveRemoteAccessStorageSecret, deriveRemoteAuthMaterial, deriveRemoteAuthMaterialFromSecret, deriveRemoteLoginHandle, deriveRemoteRelayKeyFromExportKey, deriveRemoteStoredAccessMaterial, encodeBase64, encodeRemoteStoredSecret, encryptRemotePayload, finishRemoteOpaqueLogin, finishRemoteOpaqueRegistration, finishRemoteOpaqueServerLogin, generateRemoteRpcSigningKeyPair, getRemoteAuthHint, getRemoteOpaqueServerPublicKey, isRemoteAuthErrorCode, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStopEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, signRemoteAuthChallenge, signRemoteRpcResult, startRemoteOpaqueLogin, startRemoteOpaqueRegistration, startRemoteOpaqueServerLogin, verifyRemoteAuthChallengeSignature, verifyRemoteRpcResultSignature };
2500
+ export type { CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, MessageContent, MessageMeta, RemoteAuthChallengeBinding, RemoteAuthClientKind, RemoteAuthHintContext, RemoteAuthMaterial, RemoteCredentialMaterial, RemoteMachineDescription, RemoteMachineMetadata, RemoteMachineState, RemoteOpaqueClientLoginStart, RemoteOpaqueClientRegistrationStart, RemoteOpaqueLoginFinishResult, RemoteOpaqueLoginStartResult, RemoteOpaqueRegistrationFinishResult, RemoteRpcEnvelope, RemoteRpcResultEnvelope, SessionEnvelope, SessionEvent, SessionMessage, SessionMessageContent, SessionProtocolMessage, SessionRole, SessionTurnEndStatus, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue };