@quantiya/codevibe-core 2.0.89 → 2.0.91

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,1544 @@
1
+ import { z } from 'zod';
2
+ import type { ConfirmDesktopSyncRetirementInput } from '../appsync/sync-session-retirement';
3
+ declare const scopeSchema: z.ZodObject<{
4
+ sessionId: z.ZodString;
5
+ sessionGenerationId: z.ZodString;
6
+ expectedSessionKeyGen: z.ZodString;
7
+ }, "strict", z.ZodTypeAny, {
8
+ sessionId: string;
9
+ sessionGenerationId: string;
10
+ expectedSessionKeyGen: string;
11
+ }, {
12
+ sessionId: string;
13
+ sessionGenerationId: string;
14
+ expectedSessionKeyGen: string;
15
+ }>;
16
+ declare const stableSchema: z.ZodObject<{
17
+ userId: z.ZodString;
18
+ environment: z.ZodEnum<["development", "production"]>;
19
+ deviceId: z.ZodString;
20
+ nativeThreadId: z.ZodString;
21
+ }, "strict", z.ZodTypeAny, {
22
+ deviceId: string;
23
+ environment: "production" | "development";
24
+ userId: string;
25
+ nativeThreadId: string;
26
+ }, {
27
+ deviceId: string;
28
+ environment: "production" | "development";
29
+ userId: string;
30
+ nativeThreadId: string;
31
+ }>;
32
+ declare const ownerSchema: z.ZodObject<{
33
+ token: z.ZodString;
34
+ pid: z.ZodNumber;
35
+ host: z.ZodString;
36
+ scope: z.ZodObject<{
37
+ sessionId: z.ZodString;
38
+ sessionGenerationId: z.ZodString;
39
+ expectedSessionKeyGen: z.ZodString;
40
+ }, "strict", z.ZodTypeAny, {
41
+ sessionId: string;
42
+ sessionGenerationId: string;
43
+ expectedSessionKeyGen: string;
44
+ }, {
45
+ sessionId: string;
46
+ sessionGenerationId: string;
47
+ expectedSessionKeyGen: string;
48
+ }>;
49
+ }, "strict", z.ZodTypeAny, {
50
+ host: string;
51
+ pid: number;
52
+ token: string;
53
+ scope: {
54
+ sessionId: string;
55
+ sessionGenerationId: string;
56
+ expectedSessionKeyGen: string;
57
+ };
58
+ }, {
59
+ host: string;
60
+ pid: number;
61
+ token: string;
62
+ scope: {
63
+ sessionId: string;
64
+ sessionGenerationId: string;
65
+ expectedSessionKeyGen: string;
66
+ };
67
+ }>;
68
+ declare const eventSchema: z.ZodObject<{
69
+ eventId: z.ZodEffects<z.ZodString, string, string>;
70
+ timestamp: z.ZodString;
71
+ sessionId: z.ZodString;
72
+ sessionGenerationId: z.ZodNullable<z.ZodString>;
73
+ syncLifecycleVersion: z.ZodOptional<z.ZodLiteral<1>>;
74
+ source: z.ZodLiteral<"MOBILE">;
75
+ type: z.ZodEnum<["USER_PROMPT", "PROMPT_RESPONSE"]>;
76
+ payloadJson: z.ZodString;
77
+ }, "strict", z.ZodTypeAny, {
78
+ source: "MOBILE";
79
+ eventId: string;
80
+ sessionId: string;
81
+ sessionGenerationId: string | null;
82
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
83
+ timestamp: string;
84
+ payloadJson: string;
85
+ syncLifecycleVersion?: 1 | undefined;
86
+ }, {
87
+ source: "MOBILE";
88
+ eventId: string;
89
+ sessionId: string;
90
+ sessionGenerationId: string | null;
91
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
92
+ timestamp: string;
93
+ payloadJson: string;
94
+ syncLifecycleVersion?: 1 | undefined;
95
+ }>;
96
+ declare const approvalDecisionSchema: z.ZodUnion<[z.ZodEnum<["accept", "acceptForSession", "cancel", "decline"]>, z.ZodObject<{
97
+ acceptWithExecpolicyAmendment: z.ZodObject<{
98
+ execpolicy_amendment: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
99
+ }, "strict", z.ZodTypeAny, {
100
+ execpolicy_amendment: string[];
101
+ }, {
102
+ execpolicy_amendment: string[];
103
+ }>;
104
+ }, "strict", z.ZodTypeAny, {
105
+ acceptWithExecpolicyAmendment: {
106
+ execpolicy_amendment: string[];
107
+ };
108
+ }, {
109
+ acceptWithExecpolicyAmendment: {
110
+ execpolicy_amendment: string[];
111
+ };
112
+ }>]>;
113
+ declare const controlSchema: z.ZodObject<{
114
+ key: z.ZodString;
115
+ scope: z.ZodObject<{
116
+ sessionId: z.ZodString;
117
+ sessionGenerationId: z.ZodString;
118
+ expectedSessionKeyGen: z.ZodString;
119
+ }, "strict", z.ZodTypeAny, {
120
+ sessionId: string;
121
+ sessionGenerationId: string;
122
+ expectedSessionKeyGen: string;
123
+ }, {
124
+ sessionId: string;
125
+ sessionGenerationId: string;
126
+ expectedSessionKeyGen: string;
127
+ }>;
128
+ nativeInstanceId: z.ZodString;
129
+ threadId: z.ZodString;
130
+ turnId: z.ZodString;
131
+ itemId: z.ZodString;
132
+ kind: z.ZodEnum<["async", "command", "file"]>;
133
+ detailsJson: z.ZodString;
134
+ raiseJson: z.ZodString;
135
+ state: z.ZodEnum<["OPEN", "PAUSED", "UNCERTAIN", "RESOLVED", "SESSION_ENDED", "REHOMED"]>;
136
+ cloudResolved: z.ZodBoolean;
137
+ nativeResolutionSha256: z.ZodNullable<z.ZodString>;
138
+ nativeResolutionJson: z.ZodNullable<z.ZodString>;
139
+ answerEventId: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
140
+ }, "strict", z.ZodTypeAny, {
141
+ kind: "file" | "command" | "async";
142
+ key: string;
143
+ state: "PAUSED" | "RESOLVED" | "UNCERTAIN" | "OPEN" | "SESSION_ENDED" | "REHOMED";
144
+ turnId: string;
145
+ scope: {
146
+ sessionId: string;
147
+ sessionGenerationId: string;
148
+ expectedSessionKeyGen: string;
149
+ };
150
+ nativeInstanceId: string;
151
+ threadId: string;
152
+ itemId: string;
153
+ detailsJson: string;
154
+ raiseJson: string;
155
+ cloudResolved: boolean;
156
+ nativeResolutionSha256: string | null;
157
+ nativeResolutionJson: string | null;
158
+ answerEventId: string | null;
159
+ }, {
160
+ kind: "file" | "command" | "async";
161
+ key: string;
162
+ state: "PAUSED" | "RESOLVED" | "UNCERTAIN" | "OPEN" | "SESSION_ENDED" | "REHOMED";
163
+ turnId: string;
164
+ scope: {
165
+ sessionId: string;
166
+ sessionGenerationId: string;
167
+ expectedSessionKeyGen: string;
168
+ };
169
+ nativeInstanceId: string;
170
+ threadId: string;
171
+ itemId: string;
172
+ detailsJson: string;
173
+ raiseJson: string;
174
+ cloudResolved: boolean;
175
+ nativeResolutionSha256: string | null;
176
+ nativeResolutionJson: string | null;
177
+ answerEventId: string | null;
178
+ }>;
179
+ declare const rejectionSchema: z.ZodObject<{
180
+ event: z.ZodObject<Omit<{
181
+ eventId: z.ZodEffects<z.ZodString, string, string>;
182
+ timestamp: z.ZodString;
183
+ sessionId: z.ZodString;
184
+ sessionGenerationId: z.ZodNullable<z.ZodString>;
185
+ syncLifecycleVersion: z.ZodOptional<z.ZodLiteral<1>>;
186
+ source: z.ZodLiteral<"MOBILE">;
187
+ type: z.ZodEnum<["USER_PROMPT", "PROMPT_RESPONSE"]>;
188
+ payloadJson: z.ZodString;
189
+ }, "payloadJson">, "strict", z.ZodTypeAny, {
190
+ source: "MOBILE";
191
+ eventId: string;
192
+ sessionId: string;
193
+ sessionGenerationId: string | null;
194
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
195
+ timestamp: string;
196
+ syncLifecycleVersion?: 1 | undefined;
197
+ }, {
198
+ source: "MOBILE";
199
+ eventId: string;
200
+ sessionId: string;
201
+ sessionGenerationId: string | null;
202
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
203
+ timestamp: string;
204
+ syncLifecycleVersion?: 1 | undefined;
205
+ }>;
206
+ eventSha256: z.ZodString;
207
+ scope: z.ZodObject<{
208
+ sessionId: z.ZodString;
209
+ sessionGenerationId: z.ZodString;
210
+ expectedSessionKeyGen: z.ZodString;
211
+ }, "strict", z.ZodTypeAny, {
212
+ sessionId: string;
213
+ sessionGenerationId: string;
214
+ expectedSessionKeyGen: string;
215
+ }, {
216
+ sessionId: string;
217
+ sessionGenerationId: string;
218
+ expectedSessionKeyGen: string;
219
+ }>;
220
+ controlKey: z.ZodNullable<z.ZodString>;
221
+ winningEventId: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
222
+ reason: z.ZodEnum<["ALREADY_ANSWERED", "NOT_APPLIED"]>;
223
+ raiseJson: z.ZodString;
224
+ noticeOutcome: z.ZodEnum<["MISSING", "ACCEPTED", "OMITTED"]>;
225
+ noticeResolved: z.ZodBoolean;
226
+ cloudDelivered: z.ZodBoolean;
227
+ }, "strict", z.ZodTypeAny, {
228
+ reason: "ALREADY_ANSWERED" | "NOT_APPLIED";
229
+ event: {
230
+ source: "MOBILE";
231
+ eventId: string;
232
+ sessionId: string;
233
+ sessionGenerationId: string | null;
234
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
235
+ timestamp: string;
236
+ syncLifecycleVersion?: 1 | undefined;
237
+ };
238
+ scope: {
239
+ sessionId: string;
240
+ sessionGenerationId: string;
241
+ expectedSessionKeyGen: string;
242
+ };
243
+ eventSha256: string;
244
+ controlKey: string | null;
245
+ raiseJson: string;
246
+ winningEventId: string | null;
247
+ noticeOutcome: "ACCEPTED" | "OMITTED" | "MISSING";
248
+ noticeResolved: boolean;
249
+ cloudDelivered: boolean;
250
+ }, {
251
+ reason: "ALREADY_ANSWERED" | "NOT_APPLIED";
252
+ event: {
253
+ source: "MOBILE";
254
+ eventId: string;
255
+ sessionId: string;
256
+ sessionGenerationId: string | null;
257
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
258
+ timestamp: string;
259
+ syncLifecycleVersion?: 1 | undefined;
260
+ };
261
+ scope: {
262
+ sessionId: string;
263
+ sessionGenerationId: string;
264
+ expectedSessionKeyGen: string;
265
+ };
266
+ eventSha256: string;
267
+ controlKey: string | null;
268
+ raiseJson: string;
269
+ winningEventId: string | null;
270
+ noticeOutcome: "ACCEPTED" | "OMITTED" | "MISSING";
271
+ noticeResolved: boolean;
272
+ cloudDelivered: boolean;
273
+ }>;
274
+ declare const recordSchema: z.ZodObject<{
275
+ version: z.ZodLiteral<1>;
276
+ stable: z.ZodObject<{
277
+ userId: z.ZodString;
278
+ environment: z.ZodEnum<["development", "production"]>;
279
+ deviceId: z.ZodString;
280
+ nativeThreadId: z.ZodString;
281
+ }, "strict", z.ZodTypeAny, {
282
+ deviceId: string;
283
+ environment: "production" | "development";
284
+ userId: string;
285
+ nativeThreadId: string;
286
+ }, {
287
+ deviceId: string;
288
+ environment: "production" | "development";
289
+ userId: string;
290
+ nativeThreadId: string;
291
+ }>;
292
+ revision: z.ZodNumber;
293
+ owner: z.ZodObject<{
294
+ token: z.ZodString;
295
+ pid: z.ZodNumber;
296
+ host: z.ZodString;
297
+ scope: z.ZodObject<{
298
+ sessionId: z.ZodString;
299
+ sessionGenerationId: z.ZodString;
300
+ expectedSessionKeyGen: z.ZodString;
301
+ }, "strict", z.ZodTypeAny, {
302
+ sessionId: string;
303
+ sessionGenerationId: string;
304
+ expectedSessionKeyGen: string;
305
+ }, {
306
+ sessionId: string;
307
+ sessionGenerationId: string;
308
+ expectedSessionKeyGen: string;
309
+ }>;
310
+ }, "strict", z.ZodTypeAny, {
311
+ host: string;
312
+ pid: number;
313
+ token: string;
314
+ scope: {
315
+ sessionId: string;
316
+ sessionGenerationId: string;
317
+ expectedSessionKeyGen: string;
318
+ };
319
+ }, {
320
+ host: string;
321
+ pid: number;
322
+ token: string;
323
+ scope: {
324
+ sessionId: string;
325
+ sessionGenerationId: string;
326
+ expectedSessionKeyGen: string;
327
+ };
328
+ }>;
329
+ handoffTo: z.ZodNullable<z.ZodString>;
330
+ scopes: z.ZodArray<z.ZodObject<{
331
+ scope: z.ZodObject<{
332
+ sessionId: z.ZodString;
333
+ sessionGenerationId: z.ZodString;
334
+ expectedSessionKeyGen: z.ZodString;
335
+ }, "strict", z.ZodTypeAny, {
336
+ sessionId: string;
337
+ sessionGenerationId: string;
338
+ expectedSessionKeyGen: string;
339
+ }, {
340
+ sessionId: string;
341
+ sessionGenerationId: string;
342
+ expectedSessionKeyGen: string;
343
+ }>;
344
+ state: z.ZodEnum<["OPEN", "CLOSED"]>;
345
+ closureReason: z.ZodOptional<z.ZodEnum<["TERMINAL", "BACKEND_REPLACED"]>>;
346
+ }, "strict", z.ZodTypeAny, {
347
+ state: "CLOSED" | "OPEN";
348
+ scope: {
349
+ sessionId: string;
350
+ sessionGenerationId: string;
351
+ expectedSessionKeyGen: string;
352
+ };
353
+ closureReason?: "TERMINAL" | "BACKEND_REPLACED" | undefined;
354
+ }, {
355
+ state: "CLOSED" | "OPEN";
356
+ scope: {
357
+ sessionId: string;
358
+ sessionGenerationId: string;
359
+ expectedSessionKeyGen: string;
360
+ };
361
+ closureReason?: "TERMINAL" | "BACKEND_REPLACED" | undefined;
362
+ }>, "many">;
363
+ entries: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
364
+ kind: z.ZodLiteral<"INPUT">;
365
+ phase: z.ZodEnum<["PREPARED", "ATTEMPTED", "UNCERTAIN", "RECEIPTED"]>;
366
+ bodyJson: z.ZodString;
367
+ event: z.ZodObject<{
368
+ eventId: z.ZodEffects<z.ZodString, string, string>;
369
+ timestamp: z.ZodString;
370
+ sessionId: z.ZodString;
371
+ sessionGenerationId: z.ZodNullable<z.ZodString>;
372
+ syncLifecycleVersion: z.ZodOptional<z.ZodLiteral<1>>;
373
+ source: z.ZodLiteral<"MOBILE">;
374
+ type: z.ZodEnum<["USER_PROMPT", "PROMPT_RESPONSE"]>;
375
+ payloadJson: z.ZodString;
376
+ }, "strict", z.ZodTypeAny, {
377
+ source: "MOBILE";
378
+ eventId: string;
379
+ sessionId: string;
380
+ sessionGenerationId: string | null;
381
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
382
+ timestamp: string;
383
+ payloadJson: string;
384
+ syncLifecycleVersion?: 1 | undefined;
385
+ }, {
386
+ source: "MOBILE";
387
+ eventId: string;
388
+ sessionId: string;
389
+ sessionGenerationId: string | null;
390
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
391
+ timestamp: string;
392
+ payloadJson: string;
393
+ syncLifecycleVersion?: 1 | undefined;
394
+ }>;
395
+ eventSha256: z.ZodString;
396
+ scope: z.ZodObject<{
397
+ sessionId: z.ZodString;
398
+ sessionGenerationId: z.ZodString;
399
+ expectedSessionKeyGen: z.ZodString;
400
+ }, "strict", z.ZodTypeAny, {
401
+ sessionId: string;
402
+ sessionGenerationId: string;
403
+ expectedSessionKeyGen: string;
404
+ }, {
405
+ sessionId: string;
406
+ sessionGenerationId: string;
407
+ expectedSessionKeyGen: string;
408
+ }>;
409
+ binding: z.ZodObject<{
410
+ kind: z.ZodEnum<["user", "async", "approval"]>;
411
+ threadId: z.ZodString;
412
+ nativeId: z.ZodString;
413
+ turnId: z.ZodNullable<z.ZodString>;
414
+ intentSha256: z.ZodString;
415
+ receiptMatchSha256: z.ZodString;
416
+ approval: z.ZodNullable<z.ZodObject<{
417
+ nativeInstanceId: z.ZodString;
418
+ requestId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
419
+ method: z.ZodEnum<["command", "file"]>;
420
+ decision: z.ZodUnion<[z.ZodEnum<["accept", "acceptForSession", "cancel", "decline"]>, z.ZodObject<{
421
+ acceptWithExecpolicyAmendment: z.ZodObject<{
422
+ execpolicy_amendment: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
423
+ }, "strict", z.ZodTypeAny, {
424
+ execpolicy_amendment: string[];
425
+ }, {
426
+ execpolicy_amendment: string[];
427
+ }>;
428
+ }, "strict", z.ZodTypeAny, {
429
+ acceptWithExecpolicyAmendment: {
430
+ execpolicy_amendment: string[];
431
+ };
432
+ }, {
433
+ acceptWithExecpolicyAmendment: {
434
+ execpolicy_amendment: string[];
435
+ };
436
+ }>]>;
437
+ detailsSha256: z.ZodString;
438
+ }, "strict", z.ZodTypeAny, {
439
+ method: "file" | "command";
440
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
441
+ acceptWithExecpolicyAmendment: {
442
+ execpolicy_amendment: string[];
443
+ };
444
+ };
445
+ nativeInstanceId: string;
446
+ requestId: string | number;
447
+ detailsSha256: string;
448
+ }, {
449
+ method: "file" | "command";
450
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
451
+ acceptWithExecpolicyAmendment: {
452
+ execpolicy_amendment: string[];
453
+ };
454
+ };
455
+ nativeInstanceId: string;
456
+ requestId: string | number;
457
+ detailsSha256: string;
458
+ }>>;
459
+ }, "strict", z.ZodTypeAny, {
460
+ kind: "user" | "approval" | "async";
461
+ turnId: string | null;
462
+ approval: {
463
+ method: "file" | "command";
464
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
465
+ acceptWithExecpolicyAmendment: {
466
+ execpolicy_amendment: string[];
467
+ };
468
+ };
469
+ nativeInstanceId: string;
470
+ requestId: string | number;
471
+ detailsSha256: string;
472
+ } | null;
473
+ threadId: string;
474
+ nativeId: string;
475
+ intentSha256: string;
476
+ receiptMatchSha256: string;
477
+ }, {
478
+ kind: "user" | "approval" | "async";
479
+ turnId: string | null;
480
+ approval: {
481
+ method: "file" | "command";
482
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
483
+ acceptWithExecpolicyAmendment: {
484
+ execpolicy_amendment: string[];
485
+ };
486
+ };
487
+ nativeInstanceId: string;
488
+ requestId: string | number;
489
+ detailsSha256: string;
490
+ } | null;
491
+ threadId: string;
492
+ nativeId: string;
493
+ intentSha256: string;
494
+ receiptMatchSha256: string;
495
+ }>;
496
+ controlKey: z.ZodNullable<z.ZodString>;
497
+ cloudAck: z.ZodEnum<["MISSING", "EXECUTED"]>;
498
+ nativeReceiptSha256: z.ZodNullable<z.ZodString>;
499
+ }, "strict", z.ZodTypeAny, {
500
+ kind: "INPUT";
501
+ phase: "ATTEMPTED" | "UNCERTAIN" | "PREPARED" | "RECEIPTED";
502
+ event: {
503
+ source: "MOBILE";
504
+ eventId: string;
505
+ sessionId: string;
506
+ sessionGenerationId: string | null;
507
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
508
+ timestamp: string;
509
+ payloadJson: string;
510
+ syncLifecycleVersion?: 1 | undefined;
511
+ };
512
+ scope: {
513
+ sessionId: string;
514
+ sessionGenerationId: string;
515
+ expectedSessionKeyGen: string;
516
+ };
517
+ eventSha256: string;
518
+ bodyJson: string;
519
+ binding: {
520
+ kind: "user" | "approval" | "async";
521
+ turnId: string | null;
522
+ approval: {
523
+ method: "file" | "command";
524
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
525
+ acceptWithExecpolicyAmendment: {
526
+ execpolicy_amendment: string[];
527
+ };
528
+ };
529
+ nativeInstanceId: string;
530
+ requestId: string | number;
531
+ detailsSha256: string;
532
+ } | null;
533
+ threadId: string;
534
+ nativeId: string;
535
+ intentSha256: string;
536
+ receiptMatchSha256: string;
537
+ };
538
+ controlKey: string | null;
539
+ cloudAck: "EXECUTED" | "MISSING";
540
+ nativeReceiptSha256: string | null;
541
+ }, {
542
+ kind: "INPUT";
543
+ phase: "ATTEMPTED" | "UNCERTAIN" | "PREPARED" | "RECEIPTED";
544
+ event: {
545
+ source: "MOBILE";
546
+ eventId: string;
547
+ sessionId: string;
548
+ sessionGenerationId: string | null;
549
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
550
+ timestamp: string;
551
+ payloadJson: string;
552
+ syncLifecycleVersion?: 1 | undefined;
553
+ };
554
+ scope: {
555
+ sessionId: string;
556
+ sessionGenerationId: string;
557
+ expectedSessionKeyGen: string;
558
+ };
559
+ eventSha256: string;
560
+ bodyJson: string;
561
+ binding: {
562
+ kind: "user" | "approval" | "async";
563
+ turnId: string | null;
564
+ approval: {
565
+ method: "file" | "command";
566
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
567
+ acceptWithExecpolicyAmendment: {
568
+ execpolicy_amendment: string[];
569
+ };
570
+ };
571
+ nativeInstanceId: string;
572
+ requestId: string | number;
573
+ detailsSha256: string;
574
+ } | null;
575
+ threadId: string;
576
+ nativeId: string;
577
+ intentSha256: string;
578
+ receiptMatchSha256: string;
579
+ };
580
+ controlKey: string | null;
581
+ cloudAck: "EXECUTED" | "MISSING";
582
+ nativeReceiptSha256: string | null;
583
+ }>, z.ZodObject<{
584
+ event: z.ZodObject<Omit<{
585
+ eventId: z.ZodEffects<z.ZodString, string, string>;
586
+ timestamp: z.ZodString;
587
+ sessionId: z.ZodString;
588
+ sessionGenerationId: z.ZodNullable<z.ZodString>;
589
+ syncLifecycleVersion: z.ZodOptional<z.ZodLiteral<1>>;
590
+ source: z.ZodLiteral<"MOBILE">;
591
+ type: z.ZodEnum<["USER_PROMPT", "PROMPT_RESPONSE"]>;
592
+ payloadJson: z.ZodString;
593
+ }, "payloadJson">, "strict", z.ZodTypeAny, {
594
+ source: "MOBILE";
595
+ eventId: string;
596
+ sessionId: string;
597
+ sessionGenerationId: string | null;
598
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
599
+ timestamp: string;
600
+ syncLifecycleVersion?: 1 | undefined;
601
+ }, {
602
+ source: "MOBILE";
603
+ eventId: string;
604
+ sessionId: string;
605
+ sessionGenerationId: string | null;
606
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
607
+ timestamp: string;
608
+ syncLifecycleVersion?: 1 | undefined;
609
+ }>;
610
+ kind: z.ZodLiteral<"RETIRED_EVIDENCE">;
611
+ outcome: z.ZodEnum<["NATIVE_CONFIRMED", "NOT_SENT", "UNKNOWN"]>;
612
+ eventSha256: z.ZodString;
613
+ scope: z.ZodObject<{
614
+ sessionId: z.ZodString;
615
+ sessionGenerationId: z.ZodString;
616
+ expectedSessionKeyGen: z.ZodString;
617
+ }, "strict", z.ZodTypeAny, {
618
+ sessionId: string;
619
+ sessionGenerationId: string;
620
+ expectedSessionKeyGen: string;
621
+ }, {
622
+ sessionId: string;
623
+ sessionGenerationId: string;
624
+ expectedSessionKeyGen: string;
625
+ }>;
626
+ binding: z.ZodObject<{
627
+ kind: z.ZodEnum<["user", "async", "approval"]>;
628
+ threadId: z.ZodString;
629
+ nativeId: z.ZodString;
630
+ turnId: z.ZodNullable<z.ZodString>;
631
+ intentSha256: z.ZodString;
632
+ receiptMatchSha256: z.ZodString;
633
+ approval: z.ZodNullable<z.ZodObject<{
634
+ nativeInstanceId: z.ZodString;
635
+ requestId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
636
+ method: z.ZodEnum<["command", "file"]>;
637
+ decision: z.ZodUnion<[z.ZodEnum<["accept", "acceptForSession", "cancel", "decline"]>, z.ZodObject<{
638
+ acceptWithExecpolicyAmendment: z.ZodObject<{
639
+ execpolicy_amendment: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
640
+ }, "strict", z.ZodTypeAny, {
641
+ execpolicy_amendment: string[];
642
+ }, {
643
+ execpolicy_amendment: string[];
644
+ }>;
645
+ }, "strict", z.ZodTypeAny, {
646
+ acceptWithExecpolicyAmendment: {
647
+ execpolicy_amendment: string[];
648
+ };
649
+ }, {
650
+ acceptWithExecpolicyAmendment: {
651
+ execpolicy_amendment: string[];
652
+ };
653
+ }>]>;
654
+ detailsSha256: z.ZodString;
655
+ }, "strict", z.ZodTypeAny, {
656
+ method: "file" | "command";
657
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
658
+ acceptWithExecpolicyAmendment: {
659
+ execpolicy_amendment: string[];
660
+ };
661
+ };
662
+ nativeInstanceId: string;
663
+ requestId: string | number;
664
+ detailsSha256: string;
665
+ }, {
666
+ method: "file" | "command";
667
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
668
+ acceptWithExecpolicyAmendment: {
669
+ execpolicy_amendment: string[];
670
+ };
671
+ };
672
+ nativeInstanceId: string;
673
+ requestId: string | number;
674
+ detailsSha256: string;
675
+ }>>;
676
+ }, "strict", z.ZodTypeAny, {
677
+ kind: "user" | "approval" | "async";
678
+ turnId: string | null;
679
+ approval: {
680
+ method: "file" | "command";
681
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
682
+ acceptWithExecpolicyAmendment: {
683
+ execpolicy_amendment: string[];
684
+ };
685
+ };
686
+ nativeInstanceId: string;
687
+ requestId: string | number;
688
+ detailsSha256: string;
689
+ } | null;
690
+ threadId: string;
691
+ nativeId: string;
692
+ intentSha256: string;
693
+ receiptMatchSha256: string;
694
+ }, {
695
+ kind: "user" | "approval" | "async";
696
+ turnId: string | null;
697
+ approval: {
698
+ method: "file" | "command";
699
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
700
+ acceptWithExecpolicyAmendment: {
701
+ execpolicy_amendment: string[];
702
+ };
703
+ };
704
+ nativeInstanceId: string;
705
+ requestId: string | number;
706
+ detailsSha256: string;
707
+ } | null;
708
+ threadId: string;
709
+ nativeId: string;
710
+ intentSha256: string;
711
+ receiptMatchSha256: string;
712
+ }>;
713
+ controlKey: z.ZodNullable<z.ZodString>;
714
+ cloudAck: z.ZodEnum<["MISSING", "EXECUTED"]>;
715
+ nativeReceiptSha256: z.ZodNullable<z.ZodString>;
716
+ }, "strict", z.ZodTypeAny, {
717
+ kind: "RETIRED_EVIDENCE";
718
+ outcome: "NATIVE_CONFIRMED" | "NOT_SENT" | "UNKNOWN";
719
+ event: {
720
+ source: "MOBILE";
721
+ eventId: string;
722
+ sessionId: string;
723
+ sessionGenerationId: string | null;
724
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
725
+ timestamp: string;
726
+ syncLifecycleVersion?: 1 | undefined;
727
+ };
728
+ scope: {
729
+ sessionId: string;
730
+ sessionGenerationId: string;
731
+ expectedSessionKeyGen: string;
732
+ };
733
+ eventSha256: string;
734
+ binding: {
735
+ kind: "user" | "approval" | "async";
736
+ turnId: string | null;
737
+ approval: {
738
+ method: "file" | "command";
739
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
740
+ acceptWithExecpolicyAmendment: {
741
+ execpolicy_amendment: string[];
742
+ };
743
+ };
744
+ nativeInstanceId: string;
745
+ requestId: string | number;
746
+ detailsSha256: string;
747
+ } | null;
748
+ threadId: string;
749
+ nativeId: string;
750
+ intentSha256: string;
751
+ receiptMatchSha256: string;
752
+ };
753
+ controlKey: string | null;
754
+ cloudAck: "EXECUTED" | "MISSING";
755
+ nativeReceiptSha256: string | null;
756
+ }, {
757
+ kind: "RETIRED_EVIDENCE";
758
+ outcome: "NATIVE_CONFIRMED" | "NOT_SENT" | "UNKNOWN";
759
+ event: {
760
+ source: "MOBILE";
761
+ eventId: string;
762
+ sessionId: string;
763
+ sessionGenerationId: string | null;
764
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
765
+ timestamp: string;
766
+ syncLifecycleVersion?: 1 | undefined;
767
+ };
768
+ scope: {
769
+ sessionId: string;
770
+ sessionGenerationId: string;
771
+ expectedSessionKeyGen: string;
772
+ };
773
+ eventSha256: string;
774
+ binding: {
775
+ kind: "user" | "approval" | "async";
776
+ turnId: string | null;
777
+ approval: {
778
+ method: "file" | "command";
779
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
780
+ acceptWithExecpolicyAmendment: {
781
+ execpolicy_amendment: string[];
782
+ };
783
+ };
784
+ nativeInstanceId: string;
785
+ requestId: string | number;
786
+ detailsSha256: string;
787
+ } | null;
788
+ threadId: string;
789
+ nativeId: string;
790
+ intentSha256: string;
791
+ receiptMatchSha256: string;
792
+ };
793
+ controlKey: string | null;
794
+ cloudAck: "EXECUTED" | "MISSING";
795
+ nativeReceiptSha256: string | null;
796
+ }>]>, "many">;
797
+ controls: z.ZodArray<z.ZodObject<{
798
+ key: z.ZodString;
799
+ scope: z.ZodObject<{
800
+ sessionId: z.ZodString;
801
+ sessionGenerationId: z.ZodString;
802
+ expectedSessionKeyGen: z.ZodString;
803
+ }, "strict", z.ZodTypeAny, {
804
+ sessionId: string;
805
+ sessionGenerationId: string;
806
+ expectedSessionKeyGen: string;
807
+ }, {
808
+ sessionId: string;
809
+ sessionGenerationId: string;
810
+ expectedSessionKeyGen: string;
811
+ }>;
812
+ nativeInstanceId: z.ZodString;
813
+ threadId: z.ZodString;
814
+ turnId: z.ZodString;
815
+ itemId: z.ZodString;
816
+ kind: z.ZodEnum<["async", "command", "file"]>;
817
+ detailsJson: z.ZodString;
818
+ raiseJson: z.ZodString;
819
+ state: z.ZodEnum<["OPEN", "PAUSED", "UNCERTAIN", "RESOLVED", "SESSION_ENDED", "REHOMED"]>;
820
+ cloudResolved: z.ZodBoolean;
821
+ nativeResolutionSha256: z.ZodNullable<z.ZodString>;
822
+ nativeResolutionJson: z.ZodNullable<z.ZodString>;
823
+ answerEventId: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
824
+ }, "strict", z.ZodTypeAny, {
825
+ kind: "file" | "command" | "async";
826
+ key: string;
827
+ state: "PAUSED" | "RESOLVED" | "UNCERTAIN" | "OPEN" | "SESSION_ENDED" | "REHOMED";
828
+ turnId: string;
829
+ scope: {
830
+ sessionId: string;
831
+ sessionGenerationId: string;
832
+ expectedSessionKeyGen: string;
833
+ };
834
+ nativeInstanceId: string;
835
+ threadId: string;
836
+ itemId: string;
837
+ detailsJson: string;
838
+ raiseJson: string;
839
+ cloudResolved: boolean;
840
+ nativeResolutionSha256: string | null;
841
+ nativeResolutionJson: string | null;
842
+ answerEventId: string | null;
843
+ }, {
844
+ kind: "file" | "command" | "async";
845
+ key: string;
846
+ state: "PAUSED" | "RESOLVED" | "UNCERTAIN" | "OPEN" | "SESSION_ENDED" | "REHOMED";
847
+ turnId: string;
848
+ scope: {
849
+ sessionId: string;
850
+ sessionGenerationId: string;
851
+ expectedSessionKeyGen: string;
852
+ };
853
+ nativeInstanceId: string;
854
+ threadId: string;
855
+ itemId: string;
856
+ detailsJson: string;
857
+ raiseJson: string;
858
+ cloudResolved: boolean;
859
+ nativeResolutionSha256: string | null;
860
+ nativeResolutionJson: string | null;
861
+ answerEventId: string | null;
862
+ }>, "many">;
863
+ rejections: z.ZodDefault<z.ZodArray<z.ZodObject<{
864
+ event: z.ZodObject<Omit<{
865
+ eventId: z.ZodEffects<z.ZodString, string, string>;
866
+ timestamp: z.ZodString;
867
+ sessionId: z.ZodString;
868
+ sessionGenerationId: z.ZodNullable<z.ZodString>;
869
+ syncLifecycleVersion: z.ZodOptional<z.ZodLiteral<1>>;
870
+ source: z.ZodLiteral<"MOBILE">;
871
+ type: z.ZodEnum<["USER_PROMPT", "PROMPT_RESPONSE"]>;
872
+ payloadJson: z.ZodString;
873
+ }, "payloadJson">, "strict", z.ZodTypeAny, {
874
+ source: "MOBILE";
875
+ eventId: string;
876
+ sessionId: string;
877
+ sessionGenerationId: string | null;
878
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
879
+ timestamp: string;
880
+ syncLifecycleVersion?: 1 | undefined;
881
+ }, {
882
+ source: "MOBILE";
883
+ eventId: string;
884
+ sessionId: string;
885
+ sessionGenerationId: string | null;
886
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
887
+ timestamp: string;
888
+ syncLifecycleVersion?: 1 | undefined;
889
+ }>;
890
+ eventSha256: z.ZodString;
891
+ scope: z.ZodObject<{
892
+ sessionId: z.ZodString;
893
+ sessionGenerationId: z.ZodString;
894
+ expectedSessionKeyGen: z.ZodString;
895
+ }, "strict", z.ZodTypeAny, {
896
+ sessionId: string;
897
+ sessionGenerationId: string;
898
+ expectedSessionKeyGen: string;
899
+ }, {
900
+ sessionId: string;
901
+ sessionGenerationId: string;
902
+ expectedSessionKeyGen: string;
903
+ }>;
904
+ controlKey: z.ZodNullable<z.ZodString>;
905
+ winningEventId: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
906
+ reason: z.ZodEnum<["ALREADY_ANSWERED", "NOT_APPLIED"]>;
907
+ raiseJson: z.ZodString;
908
+ noticeOutcome: z.ZodEnum<["MISSING", "ACCEPTED", "OMITTED"]>;
909
+ noticeResolved: z.ZodBoolean;
910
+ cloudDelivered: z.ZodBoolean;
911
+ }, "strict", z.ZodTypeAny, {
912
+ reason: "ALREADY_ANSWERED" | "NOT_APPLIED";
913
+ event: {
914
+ source: "MOBILE";
915
+ eventId: string;
916
+ sessionId: string;
917
+ sessionGenerationId: string | null;
918
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
919
+ timestamp: string;
920
+ syncLifecycleVersion?: 1 | undefined;
921
+ };
922
+ scope: {
923
+ sessionId: string;
924
+ sessionGenerationId: string;
925
+ expectedSessionKeyGen: string;
926
+ };
927
+ eventSha256: string;
928
+ controlKey: string | null;
929
+ raiseJson: string;
930
+ winningEventId: string | null;
931
+ noticeOutcome: "ACCEPTED" | "OMITTED" | "MISSING";
932
+ noticeResolved: boolean;
933
+ cloudDelivered: boolean;
934
+ }, {
935
+ reason: "ALREADY_ANSWERED" | "NOT_APPLIED";
936
+ event: {
937
+ source: "MOBILE";
938
+ eventId: string;
939
+ sessionId: string;
940
+ sessionGenerationId: string | null;
941
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
942
+ timestamp: string;
943
+ syncLifecycleVersion?: 1 | undefined;
944
+ };
945
+ scope: {
946
+ sessionId: string;
947
+ sessionGenerationId: string;
948
+ expectedSessionKeyGen: string;
949
+ };
950
+ eventSha256: string;
951
+ controlKey: string | null;
952
+ raiseJson: string;
953
+ winningEventId: string | null;
954
+ noticeOutcome: "ACCEPTED" | "OMITTED" | "MISSING";
955
+ noticeResolved: boolean;
956
+ cloudDelivered: boolean;
957
+ }>, "many">>;
958
+ diagnostic: z.ZodObject<{
959
+ nativeConfirmedCloudAckMissing: z.ZodNumber;
960
+ notSent: z.ZodNumber;
961
+ }, "strict", z.ZodTypeAny, {
962
+ nativeConfirmedCloudAckMissing: number;
963
+ notSent: number;
964
+ }, {
965
+ nativeConfirmedCloudAckMissing: number;
966
+ notSent: number;
967
+ }>;
968
+ }, "strict", z.ZodTypeAny, {
969
+ owner: {
970
+ host: string;
971
+ pid: number;
972
+ token: string;
973
+ scope: {
974
+ sessionId: string;
975
+ sessionGenerationId: string;
976
+ expectedSessionKeyGen: string;
977
+ };
978
+ };
979
+ entries: ({
980
+ kind: "INPUT";
981
+ phase: "ATTEMPTED" | "UNCERTAIN" | "PREPARED" | "RECEIPTED";
982
+ event: {
983
+ source: "MOBILE";
984
+ eventId: string;
985
+ sessionId: string;
986
+ sessionGenerationId: string | null;
987
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
988
+ timestamp: string;
989
+ payloadJson: string;
990
+ syncLifecycleVersion?: 1 | undefined;
991
+ };
992
+ scope: {
993
+ sessionId: string;
994
+ sessionGenerationId: string;
995
+ expectedSessionKeyGen: string;
996
+ };
997
+ eventSha256: string;
998
+ bodyJson: string;
999
+ binding: {
1000
+ kind: "user" | "approval" | "async";
1001
+ turnId: string | null;
1002
+ approval: {
1003
+ method: "file" | "command";
1004
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
1005
+ acceptWithExecpolicyAmendment: {
1006
+ execpolicy_amendment: string[];
1007
+ };
1008
+ };
1009
+ nativeInstanceId: string;
1010
+ requestId: string | number;
1011
+ detailsSha256: string;
1012
+ } | null;
1013
+ threadId: string;
1014
+ nativeId: string;
1015
+ intentSha256: string;
1016
+ receiptMatchSha256: string;
1017
+ };
1018
+ controlKey: string | null;
1019
+ cloudAck: "EXECUTED" | "MISSING";
1020
+ nativeReceiptSha256: string | null;
1021
+ } | {
1022
+ kind: "RETIRED_EVIDENCE";
1023
+ outcome: "NATIVE_CONFIRMED" | "NOT_SENT" | "UNKNOWN";
1024
+ event: {
1025
+ source: "MOBILE";
1026
+ eventId: string;
1027
+ sessionId: string;
1028
+ sessionGenerationId: string | null;
1029
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
1030
+ timestamp: string;
1031
+ syncLifecycleVersion?: 1 | undefined;
1032
+ };
1033
+ scope: {
1034
+ sessionId: string;
1035
+ sessionGenerationId: string;
1036
+ expectedSessionKeyGen: string;
1037
+ };
1038
+ eventSha256: string;
1039
+ binding: {
1040
+ kind: "user" | "approval" | "async";
1041
+ turnId: string | null;
1042
+ approval: {
1043
+ method: "file" | "command";
1044
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
1045
+ acceptWithExecpolicyAmendment: {
1046
+ execpolicy_amendment: string[];
1047
+ };
1048
+ };
1049
+ nativeInstanceId: string;
1050
+ requestId: string | number;
1051
+ detailsSha256: string;
1052
+ } | null;
1053
+ threadId: string;
1054
+ nativeId: string;
1055
+ intentSha256: string;
1056
+ receiptMatchSha256: string;
1057
+ };
1058
+ controlKey: string | null;
1059
+ cloudAck: "EXECUTED" | "MISSING";
1060
+ nativeReceiptSha256: string | null;
1061
+ })[];
1062
+ version: 1;
1063
+ revision: number;
1064
+ stable: {
1065
+ deviceId: string;
1066
+ environment: "production" | "development";
1067
+ userId: string;
1068
+ nativeThreadId: string;
1069
+ };
1070
+ handoffTo: string | null;
1071
+ scopes: {
1072
+ state: "CLOSED" | "OPEN";
1073
+ scope: {
1074
+ sessionId: string;
1075
+ sessionGenerationId: string;
1076
+ expectedSessionKeyGen: string;
1077
+ };
1078
+ closureReason?: "TERMINAL" | "BACKEND_REPLACED" | undefined;
1079
+ }[];
1080
+ controls: {
1081
+ kind: "file" | "command" | "async";
1082
+ key: string;
1083
+ state: "PAUSED" | "RESOLVED" | "UNCERTAIN" | "OPEN" | "SESSION_ENDED" | "REHOMED";
1084
+ turnId: string;
1085
+ scope: {
1086
+ sessionId: string;
1087
+ sessionGenerationId: string;
1088
+ expectedSessionKeyGen: string;
1089
+ };
1090
+ nativeInstanceId: string;
1091
+ threadId: string;
1092
+ itemId: string;
1093
+ detailsJson: string;
1094
+ raiseJson: string;
1095
+ cloudResolved: boolean;
1096
+ nativeResolutionSha256: string | null;
1097
+ nativeResolutionJson: string | null;
1098
+ answerEventId: string | null;
1099
+ }[];
1100
+ rejections: {
1101
+ reason: "ALREADY_ANSWERED" | "NOT_APPLIED";
1102
+ event: {
1103
+ source: "MOBILE";
1104
+ eventId: string;
1105
+ sessionId: string;
1106
+ sessionGenerationId: string | null;
1107
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
1108
+ timestamp: string;
1109
+ syncLifecycleVersion?: 1 | undefined;
1110
+ };
1111
+ scope: {
1112
+ sessionId: string;
1113
+ sessionGenerationId: string;
1114
+ expectedSessionKeyGen: string;
1115
+ };
1116
+ eventSha256: string;
1117
+ controlKey: string | null;
1118
+ raiseJson: string;
1119
+ winningEventId: string | null;
1120
+ noticeOutcome: "ACCEPTED" | "OMITTED" | "MISSING";
1121
+ noticeResolved: boolean;
1122
+ cloudDelivered: boolean;
1123
+ }[];
1124
+ diagnostic: {
1125
+ nativeConfirmedCloudAckMissing: number;
1126
+ notSent: number;
1127
+ };
1128
+ }, {
1129
+ owner: {
1130
+ host: string;
1131
+ pid: number;
1132
+ token: string;
1133
+ scope: {
1134
+ sessionId: string;
1135
+ sessionGenerationId: string;
1136
+ expectedSessionKeyGen: string;
1137
+ };
1138
+ };
1139
+ entries: ({
1140
+ kind: "INPUT";
1141
+ phase: "ATTEMPTED" | "UNCERTAIN" | "PREPARED" | "RECEIPTED";
1142
+ event: {
1143
+ source: "MOBILE";
1144
+ eventId: string;
1145
+ sessionId: string;
1146
+ sessionGenerationId: string | null;
1147
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
1148
+ timestamp: string;
1149
+ payloadJson: string;
1150
+ syncLifecycleVersion?: 1 | undefined;
1151
+ };
1152
+ scope: {
1153
+ sessionId: string;
1154
+ sessionGenerationId: string;
1155
+ expectedSessionKeyGen: string;
1156
+ };
1157
+ eventSha256: string;
1158
+ bodyJson: string;
1159
+ binding: {
1160
+ kind: "user" | "approval" | "async";
1161
+ turnId: string | null;
1162
+ approval: {
1163
+ method: "file" | "command";
1164
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
1165
+ acceptWithExecpolicyAmendment: {
1166
+ execpolicy_amendment: string[];
1167
+ };
1168
+ };
1169
+ nativeInstanceId: string;
1170
+ requestId: string | number;
1171
+ detailsSha256: string;
1172
+ } | null;
1173
+ threadId: string;
1174
+ nativeId: string;
1175
+ intentSha256: string;
1176
+ receiptMatchSha256: string;
1177
+ };
1178
+ controlKey: string | null;
1179
+ cloudAck: "EXECUTED" | "MISSING";
1180
+ nativeReceiptSha256: string | null;
1181
+ } | {
1182
+ kind: "RETIRED_EVIDENCE";
1183
+ outcome: "NATIVE_CONFIRMED" | "NOT_SENT" | "UNKNOWN";
1184
+ event: {
1185
+ source: "MOBILE";
1186
+ eventId: string;
1187
+ sessionId: string;
1188
+ sessionGenerationId: string | null;
1189
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
1190
+ timestamp: string;
1191
+ syncLifecycleVersion?: 1 | undefined;
1192
+ };
1193
+ scope: {
1194
+ sessionId: string;
1195
+ sessionGenerationId: string;
1196
+ expectedSessionKeyGen: string;
1197
+ };
1198
+ eventSha256: string;
1199
+ binding: {
1200
+ kind: "user" | "approval" | "async";
1201
+ turnId: string | null;
1202
+ approval: {
1203
+ method: "file" | "command";
1204
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
1205
+ acceptWithExecpolicyAmendment: {
1206
+ execpolicy_amendment: string[];
1207
+ };
1208
+ };
1209
+ nativeInstanceId: string;
1210
+ requestId: string | number;
1211
+ detailsSha256: string;
1212
+ } | null;
1213
+ threadId: string;
1214
+ nativeId: string;
1215
+ intentSha256: string;
1216
+ receiptMatchSha256: string;
1217
+ };
1218
+ controlKey: string | null;
1219
+ cloudAck: "EXECUTED" | "MISSING";
1220
+ nativeReceiptSha256: string | null;
1221
+ })[];
1222
+ version: 1;
1223
+ revision: number;
1224
+ stable: {
1225
+ deviceId: string;
1226
+ environment: "production" | "development";
1227
+ userId: string;
1228
+ nativeThreadId: string;
1229
+ };
1230
+ handoffTo: string | null;
1231
+ scopes: {
1232
+ state: "CLOSED" | "OPEN";
1233
+ scope: {
1234
+ sessionId: string;
1235
+ sessionGenerationId: string;
1236
+ expectedSessionKeyGen: string;
1237
+ };
1238
+ closureReason?: "TERMINAL" | "BACKEND_REPLACED" | undefined;
1239
+ }[];
1240
+ controls: {
1241
+ kind: "file" | "command" | "async";
1242
+ key: string;
1243
+ state: "PAUSED" | "RESOLVED" | "UNCERTAIN" | "OPEN" | "SESSION_ENDED" | "REHOMED";
1244
+ turnId: string;
1245
+ scope: {
1246
+ sessionId: string;
1247
+ sessionGenerationId: string;
1248
+ expectedSessionKeyGen: string;
1249
+ };
1250
+ nativeInstanceId: string;
1251
+ threadId: string;
1252
+ itemId: string;
1253
+ detailsJson: string;
1254
+ raiseJson: string;
1255
+ cloudResolved: boolean;
1256
+ nativeResolutionSha256: string | null;
1257
+ nativeResolutionJson: string | null;
1258
+ answerEventId: string | null;
1259
+ }[];
1260
+ diagnostic: {
1261
+ nativeConfirmedCloudAckMissing: number;
1262
+ notSent: number;
1263
+ };
1264
+ rejections?: {
1265
+ reason: "ALREADY_ANSWERED" | "NOT_APPLIED";
1266
+ event: {
1267
+ source: "MOBILE";
1268
+ eventId: string;
1269
+ sessionId: string;
1270
+ sessionGenerationId: string | null;
1271
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
1272
+ timestamp: string;
1273
+ syncLifecycleVersion?: 1 | undefined;
1274
+ };
1275
+ scope: {
1276
+ sessionId: string;
1277
+ sessionGenerationId: string;
1278
+ expectedSessionKeyGen: string;
1279
+ };
1280
+ eventSha256: string;
1281
+ controlKey: string | null;
1282
+ raiseJson: string;
1283
+ winningEventId: string | null;
1284
+ noticeOutcome: "ACCEPTED" | "OMITTED" | "MISSING";
1285
+ noticeResolved: boolean;
1286
+ cloudDelivered: boolean;
1287
+ }[] | undefined;
1288
+ }>;
1289
+ declare const intentSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1290
+ kind: z.ZodLiteral<"user">;
1291
+ threadId: z.ZodString;
1292
+ clientId: z.ZodEffects<z.ZodString, string, string>;
1293
+ contentJson: z.ZodString;
1294
+ }, "strict", z.ZodTypeAny, {
1295
+ kind: "user";
1296
+ threadId: string;
1297
+ clientId: string;
1298
+ contentJson: string;
1299
+ }, {
1300
+ kind: "user";
1301
+ threadId: string;
1302
+ clientId: string;
1303
+ contentJson: string;
1304
+ }>, z.ZodObject<{
1305
+ kind: z.ZodLiteral<"async">;
1306
+ threadId: z.ZodString;
1307
+ questionItemId: z.ZodString;
1308
+ output: z.ZodString;
1309
+ }, "strict", z.ZodTypeAny, {
1310
+ kind: "async";
1311
+ output: string;
1312
+ threadId: string;
1313
+ questionItemId: string;
1314
+ }, {
1315
+ kind: "async";
1316
+ output: string;
1317
+ threadId: string;
1318
+ questionItemId: string;
1319
+ }>, z.ZodObject<{
1320
+ kind: z.ZodLiteral<"approval">;
1321
+ threadId: z.ZodString;
1322
+ turnId: z.ZodString;
1323
+ itemId: z.ZodString;
1324
+ nativeInstanceId: z.ZodString;
1325
+ requestId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1326
+ method: z.ZodEnum<["command", "file"]>;
1327
+ decision: z.ZodUnion<[z.ZodEnum<["accept", "acceptForSession", "cancel", "decline"]>, z.ZodObject<{
1328
+ acceptWithExecpolicyAmendment: z.ZodObject<{
1329
+ execpolicy_amendment: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
1330
+ }, "strict", z.ZodTypeAny, {
1331
+ execpolicy_amendment: string[];
1332
+ }, {
1333
+ execpolicy_amendment: string[];
1334
+ }>;
1335
+ }, "strict", z.ZodTypeAny, {
1336
+ acceptWithExecpolicyAmendment: {
1337
+ execpolicy_amendment: string[];
1338
+ };
1339
+ }, {
1340
+ acceptWithExecpolicyAmendment: {
1341
+ execpolicy_amendment: string[];
1342
+ };
1343
+ }>]>;
1344
+ detailsSha256: z.ZodString;
1345
+ }, "strict", z.ZodTypeAny, {
1346
+ method: "file" | "command";
1347
+ kind: "approval";
1348
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
1349
+ acceptWithExecpolicyAmendment: {
1350
+ execpolicy_amendment: string[];
1351
+ };
1352
+ };
1353
+ turnId: string;
1354
+ nativeInstanceId: string;
1355
+ requestId: string | number;
1356
+ detailsSha256: string;
1357
+ threadId: string;
1358
+ itemId: string;
1359
+ }, {
1360
+ method: "file" | "command";
1361
+ kind: "approval";
1362
+ decision: "accept" | "acceptForSession" | "cancel" | "decline" | {
1363
+ acceptWithExecpolicyAmendment: {
1364
+ execpolicy_amendment: string[];
1365
+ };
1366
+ };
1367
+ turnId: string;
1368
+ nativeInstanceId: string;
1369
+ requestId: string | number;
1370
+ detailsSha256: string;
1371
+ threadId: string;
1372
+ itemId: string;
1373
+ }>]>;
1374
+ export type CodexNativeScope = z.infer<typeof scopeSchema>;
1375
+ export type CodexNativeStableIdentity = z.infer<typeof stableSchema>;
1376
+ export type CodexNativeOwner = z.infer<typeof ownerSchema>;
1377
+ export type CodexNativeEvent = z.infer<typeof eventSchema>;
1378
+ export type CodexNativeControl = z.infer<typeof controlSchema>;
1379
+ export type CodexNativeIntent = z.infer<typeof intentSchema>;
1380
+ export type CodexNativeState = z.infer<typeof recordSchema>;
1381
+ export type CodexNativeEntry = CodexNativeState['entries'][number];
1382
+ export type CodexNativeRejection = z.infer<typeof rejectionSchema>;
1383
+ export type CodexNativeApprovalDecision = z.infer<typeof approvalDecisionSchema>;
1384
+ export interface CodexNativeStateOptions {
1385
+ identity: CodexNativeStableIdentity;
1386
+ /** Stable installed data path. Private tests may supply their recorded root. */
1387
+ root?: string;
1388
+ readPrivateKey(): Promise<string | null>;
1389
+ assertAccount(): void;
1390
+ /** Caller must use the existing authenticated canonical Session read. */
1391
+ assertActiveScope(scope: CodexNativeScope): Promise<void>;
1392
+ }
1393
+ export declare class CodexNativeStateError extends Error {
1394
+ readonly code: string;
1395
+ constructor(code: string);
1396
+ }
1397
+ /** Exact JSON input, never a terminal-label catalogue. Mutable cloud delivery
1398
+ * status is intentionally outside the immutable input identity. */
1399
+ export declare function snapshotCodexNativeEvent(value: {
1400
+ eventId: string;
1401
+ timestamp: string;
1402
+ sessionId: string;
1403
+ sessionGenerationId?: string | null;
1404
+ syncLifecycleVersion?: number;
1405
+ source: string;
1406
+ type: string;
1407
+ content?: string | null;
1408
+ metadata?: unknown;
1409
+ attachments?: unknown;
1410
+ isEncrypted?: boolean | null;
1411
+ promptId?: string;
1412
+ encryptionVersion?: number;
1413
+ }): CodexNativeEvent;
1414
+ export declare class CodexNativeStateStore {
1415
+ private readonly options;
1416
+ readonly file: string;
1417
+ private readonly stable;
1418
+ private readonly root;
1419
+ private readonly context;
1420
+ private ingressClosed;
1421
+ private claimedOwnerToken;
1422
+ constructor(options: CodexNativeStateOptions);
1423
+ private directory;
1424
+ private locked;
1425
+ private validate;
1426
+ private read;
1427
+ private write;
1428
+ private owned;
1429
+ private mutate;
1430
+ private open;
1431
+ private active;
1432
+ /** First owner or exact successor. A live writer must explicitly close/join
1433
+ * and authorize this token. ESRCH on the recorded same-host PID is required
1434
+ * for crash takeover; age,heartbeat lag and unknown PID state never suffice. */
1435
+ claim(value: CodexNativeOwner): Promise<void>;
1436
+ snapshot(owner: CodexNativeOwner): Promise<CodexNativeState>;
1437
+ close(owner: CodexNativeOwner, reason?: 'TERMINAL' | 'BACKEND_REPLACED'): Promise<void>;
1438
+ private endControls;
1439
+ authorizeHandoff(owner: CodexNativeOwner, nextToken: string, join: () => Promise<void>): Promise<void>;
1440
+ putControl(owner: CodexNativeOwner, value: CodexNativeControl): Promise<void>;
1441
+ /** Only a live backend-row replacement can re-home presentation. The old
1442
+ * scope/input remains closed and unchanged;its exact E1 closure must already
1443
+ * be acknowledged. A normal terminal resume is never re-home authority. */
1444
+ rehomeControl(owner: CodexNativeOwner, previousKey: string, value: CodexNativeControl): Promise<void>;
1445
+ pauseControl(owner: CodexNativeOwner, controlKey: string, paused: boolean): Promise<void>;
1446
+ /** Approval preemption and answer reservation share one durable lock. An
1447
+ * answer committed first is no longer pausable; it is not a handler error.
1448
+ * Conversely a pause committed first still prevents prepare from sending. */
1449
+ pauseOpenQuestions(owner: CodexNativeOwner): Promise<void>;
1450
+ prepare(owner: CodexNativeOwner, value: CodexNativeEvent, intentValue: CodexNativeIntent, controlKey?: string | null): Promise<'COMMITTED' | 'DUPLICATE'>;
1451
+ /** The same lock as answer reservation decides a losing explicit reply.
1452
+ * Missing/paused controls and existing native attempts are never reclassified. */
1453
+ rejectAnsweredControl(owner: CodexNativeOwner, value: CodexNativeEvent, promptId: string): Promise<CodexNativeRejection | null>;
1454
+ /** A deterministic binding refusal before prepare/send is terminal for this
1455
+ * exact event. The lock proves no native attempt exists; it never creates a
1456
+ * control reservation, replay payload, or EXECUTED acknowledgement. */
1457
+ rejectUnappliedInput(owner: CodexNativeOwner, value: CodexNativeEvent): Promise<CodexNativeRejection | null>;
1458
+ acknowledgeRejectionNotice(owner: CodexNativeOwner, eventId: string, outcome: 'ACCEPTED' | 'OMITTED'): Promise<void>;
1459
+ resolveRejectionNotice(owner: CodexNativeOwner, eventId: string): Promise<void>;
1460
+ acknowledgeRejectedDelivery(owner: CodexNativeOwner, eventId: string, value: unknown): Promise<void>;
1461
+ /** Shared eligibility for every saved input, including async questions and
1462
+ * native approvals. A closed/paused control is normal retained work, not
1463
+ * authority to send or an error that may monopolize the recovery queue. */
1464
+ private preparedIntent;
1465
+ /** Local read-only preflight before decode or cloud DELIVERED. Do not poll
1466
+ * the backend for permanently retained closed controls on every tick.
1467
+ * prepare/beginAttempt retain their independent canonical active-scope
1468
+ * checks; this read cannot authorize a send. */
1469
+ canAttempt(owner: CodexNativeOwner, eventId: string): Promise<boolean>;
1470
+ /** The only initial-attempt gate. A successful return is an intent to send
1471
+ * ONCE,not a native acknowledgement. The caller must not retry a failed RPC. */
1472
+ beginAttempt(owner: CodexNativeOwner, eventId: string): Promise<CodexNativeIntent | null>;
1473
+ markUncertain(owner: CodexNativeOwner, eventId: string): Promise<void>;
1474
+ /** Only the current dispatcher may release its reservation BEFORE entering
1475
+ * send. A crash or any call into native send must retain ATTEMPTED/UNCERTAIN;
1476
+ * neither a failed RPC nor a missing receipt is proof that nothing was sent.
1477
+ * Exact owner,scope and body prevent releasing another admission's attempt. */
1478
+ deferUnsentAttempt(owner: CodexNativeOwner, eventId: string, intent: CodexNativeIntent): Promise<void>;
1479
+ /** Persisted original native receipts can reconcile under a successor,even
1480
+ * when the lost turn/start response never supplied a turn ID. No RPC retry. */
1481
+ reconcile(owner: CodexNativeOwner, eventId: string, receipt: {
1482
+ threadId: string;
1483
+ turnId: string;
1484
+ item: unknown;
1485
+ }): Promise<void>;
1486
+ acknowledgeControlClosure(owner: CodexNativeOwner, controlKey: string, receipt: unknown): Promise<void>;
1487
+ /** Invoke the existing public SDK lifecycle with the exact retained owner.
1488
+ * Its true result means verified resolution,including publication recovery;
1489
+ * it is not converted into a fabricated wire receipt or native execution. */
1490
+ resolveControl(owner: CodexNativeOwner, controlKey: string, resolve: (input: {
1491
+ sessionId: string;
1492
+ promptId: string;
1493
+ ownerToken: string;
1494
+ }) => Promise<boolean>): Promise<boolean>;
1495
+ /** Structured output can originate from another native client. It may close
1496
+ * this exact question,but must not mark a mobile Event executed by inference. */
1497
+ observeQuestionResolution(owner: CodexNativeOwner, controlKey: string, receipt: {
1498
+ threadId: string;
1499
+ turnId: string;
1500
+ item: unknown;
1501
+ }): Promise<void>;
1502
+ /** An interrupted native turn withdraws its unanswered questions. This is
1503
+ * presentation closure, never proof that a mobile answer executed. */
1504
+ observeQuestionInterruption(owner: CodexNativeOwner, controlKey: string, receipt: {
1505
+ nativeInstanceId: string;
1506
+ message: unknown;
1507
+ }): Promise<void>;
1508
+ /** Only an exact signed status receipt can record cloud execution. Native
1509
+ * proof is independently required;an RPC write or DELIVERED is not enough. */
1510
+ acknowledgeInputExecution(owner: CodexNativeOwner, eventId: string, value: unknown): Promise<void>;
1511
+ private approvalResolution;
1512
+ /** A resolved native dialog closes its presentation,but is not by itself
1513
+ * proof that this mobile decision won a competing desktop response. */
1514
+ observeApprovalResolution(owner: CodexNativeOwner, controlKey: string, receipt: {
1515
+ nativeInstanceId: string;
1516
+ message: unknown;
1517
+ }): Promise<void>;
1518
+ /** An exact terminal native item can close presentation after a missed
1519
+ * callback notification. It does NOT prove which mobile decision won,so
1520
+ * this deliberately supplies no serverRequest/resolved proof to an input. */
1521
+ observeApprovalTerminalItem(owner: CodexNativeOwner, controlKey: string, receipt: {
1522
+ nativeInstanceId: string;
1523
+ message: unknown;
1524
+ }): Promise<void>;
1525
+ /** The native resolved notice plus an exact matching typed outcome is
1526
+ * required. An RPC/socket write,model prose,or opposite desktop outcome
1527
+ * cannot manufacture execution. Cancel also requires native interruption. */
1528
+ reconcileApproval(owner: CodexNativeOwner, eventId: string, receipt: {
1529
+ nativeInstanceId: string;
1530
+ resolved?: unknown;
1531
+ completed: unknown;
1532
+ turnCompleted?: unknown;
1533
+ }): Promise<void>;
1534
+ /** No cached proof. Snapshot comparison after the network await prevents a
1535
+ * fresh authority result from authorizing a different cleanup target set. */
1536
+ retirePayloads(owner: CodexNativeOwner, scope: CodexNativeScope, join: () => Promise<void>, confirm: (input: ConfirmDesktopSyncRetirementInput) => Promise<unknown>): Promise<number>;
1537
+ private requireClosed;
1538
+ pruneSettled(owner: CodexNativeOwner, scope: CodexNativeScope, confirm: (input: ConfirmDesktopSyncRetirementInput) => Promise<unknown>): Promise<number>;
1539
+ /** Remove the last empty per-thread owner record only after every remaining
1540
+ * closed scope has fresh retirement authority. Pending/native-control state
1541
+ * makes this a refusal,not an eviction policy or a background cleanup task. */
1542
+ removeSettled(owner: CodexNativeOwner, join: () => Promise<void>, confirm: (input: ConfirmDesktopSyncRetirementInput) => Promise<unknown>): Promise<void>;
1543
+ }
1544
+ export {};