@winmatrix/protocol 1.0.5 → 1.0.7

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,1656 @@
1
+ import { z } from 'zod';
2
+ export declare const TERMINAL_SCHEMA_VERSION = 1;
3
+ export declare const MAX_SYNC_CONVERSATIONS = 20;
4
+ export declare const ConversationTurnTerminalStatusSchema: z.ZodEnum<["completed", "failed", "stopped", "waiting_user_input"]>;
5
+ export declare const ConversationRuntimePhaseSchema: z.ZodEnum<["idle", "running", "waiting_async", "waiting_user_input", "completed", "failed", "stopped"]>;
6
+ export declare const ConnectionStatusSchema: z.ZodEnum<["connecting", "syncing", "connected", "reconnecting", "degraded", "closed_by_user"]>;
7
+ export declare const TriggerIdentitySchema: z.ZodObject<{
8
+ triggerUserMessageId: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ triggerUserMessageId?: string | undefined;
11
+ }, {
12
+ triggerUserMessageId?: string | undefined;
13
+ }>;
14
+ export declare const ConversationTerminalMessageSchema: z.ZodObject<{
15
+ messageId: z.ZodString;
16
+ role: z.ZodLiteral<"assistant">;
17
+ content: z.ZodString;
18
+ createdAt: z.ZodString;
19
+ }, "strip", z.ZodTypeAny, {
20
+ content: string;
21
+ createdAt: string;
22
+ role: "assistant";
23
+ messageId: string;
24
+ }, {
25
+ content: string;
26
+ createdAt: string;
27
+ role: "assistant";
28
+ messageId: string;
29
+ }>;
30
+ export declare const ConversationHumanInteractionProjectionSchema: z.ZodObject<{
31
+ interactionId: z.ZodString;
32
+ requestKey: z.ZodString;
33
+ agentRunId: z.ZodString;
34
+ intent: z.ZodEnum<["ask", "decide"]>;
35
+ answerChannel: z.ZodEnum<["chat", "workitem", "both"]>;
36
+ kind: z.ZodEnum<["clarification", "approval", "risk_confirmation", "credential_request", "acceptance"]>;
37
+ status: z.ZodEnum<["open", "resolving", "answered", "approved", "rejected", "cancelled", "expired", "delivery_failed"]>;
38
+ question: z.ZodString;
39
+ responseSchema: z.ZodOptional<z.ZodObject<{
40
+ version: z.ZodNumber;
41
+ submitLabel: z.ZodString;
42
+ fields: z.ZodArray<z.ZodObject<{
43
+ key: z.ZodString;
44
+ label: z.ZodString;
45
+ control: z.ZodEnum<["text", "textarea", "number", "select", "multi_select"]>;
46
+ description: z.ZodOptional<z.ZodString>;
47
+ required: z.ZodBoolean;
48
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>;
49
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
+ value: z.ZodString;
51
+ label: z.ZodString;
52
+ description: z.ZodOptional<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ value: string;
55
+ label: string;
56
+ description?: string | undefined;
57
+ }, {
58
+ value: string;
59
+ label: string;
60
+ description?: string | undefined;
61
+ }>, "many">>;
62
+ validation: z.ZodOptional<z.ZodObject<{
63
+ minLength: z.ZodOptional<z.ZodNumber>;
64
+ maxLength: z.ZodOptional<z.ZodNumber>;
65
+ min: z.ZodOptional<z.ZodNumber>;
66
+ max: z.ZodOptional<z.ZodNumber>;
67
+ maxItems: z.ZodOptional<z.ZodNumber>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ min?: number | undefined;
70
+ max?: number | undefined;
71
+ minLength?: number | undefined;
72
+ maxLength?: number | undefined;
73
+ maxItems?: number | undefined;
74
+ }, {
75
+ min?: number | undefined;
76
+ max?: number | undefined;
77
+ minLength?: number | undefined;
78
+ maxLength?: number | undefined;
79
+ maxItems?: number | undefined;
80
+ }>>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ label: string;
83
+ required: boolean;
84
+ key: string;
85
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
86
+ options?: {
87
+ value: string;
88
+ label: string;
89
+ description?: string | undefined;
90
+ }[] | undefined;
91
+ validation?: {
92
+ min?: number | undefined;
93
+ max?: number | undefined;
94
+ minLength?: number | undefined;
95
+ maxLength?: number | undefined;
96
+ maxItems?: number | undefined;
97
+ } | undefined;
98
+ description?: string | undefined;
99
+ defaultValue?: string | number | string[] | undefined;
100
+ }, {
101
+ label: string;
102
+ required: boolean;
103
+ key: string;
104
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
105
+ options?: {
106
+ value: string;
107
+ label: string;
108
+ description?: string | undefined;
109
+ }[] | undefined;
110
+ validation?: {
111
+ min?: number | undefined;
112
+ max?: number | undefined;
113
+ minLength?: number | undefined;
114
+ maxLength?: number | undefined;
115
+ maxItems?: number | undefined;
116
+ } | undefined;
117
+ description?: string | undefined;
118
+ defaultValue?: string | number | string[] | undefined;
119
+ }>, "many">;
120
+ }, "strip", z.ZodTypeAny, {
121
+ version: number;
122
+ submitLabel: string;
123
+ fields: {
124
+ label: string;
125
+ required: boolean;
126
+ key: string;
127
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
128
+ options?: {
129
+ value: string;
130
+ label: string;
131
+ description?: string | undefined;
132
+ }[] | undefined;
133
+ validation?: {
134
+ min?: number | undefined;
135
+ max?: number | undefined;
136
+ minLength?: number | undefined;
137
+ maxLength?: number | undefined;
138
+ maxItems?: number | undefined;
139
+ } | undefined;
140
+ description?: string | undefined;
141
+ defaultValue?: string | number | string[] | undefined;
142
+ }[];
143
+ }, {
144
+ version: number;
145
+ submitLabel: string;
146
+ fields: {
147
+ label: string;
148
+ required: boolean;
149
+ key: string;
150
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
151
+ options?: {
152
+ value: string;
153
+ label: string;
154
+ description?: string | undefined;
155
+ }[] | undefined;
156
+ validation?: {
157
+ min?: number | undefined;
158
+ max?: number | undefined;
159
+ minLength?: number | undefined;
160
+ maxLength?: number | undefined;
161
+ maxItems?: number | undefined;
162
+ } | undefined;
163
+ description?: string | undefined;
164
+ defaultValue?: string | number | string[] | undefined;
165
+ }[];
166
+ }>>;
167
+ reasonCode: z.ZodString;
168
+ version: z.ZodNumber;
169
+ allowedActions: z.ZodArray<z.ZodEnum<["submit_form", "approve", "reject", "credential_ready", "cancel"]>, "many">;
170
+ stepId: z.ZodOptional<z.ZodString>;
171
+ briefId: z.ZodOptional<z.ZodString>;
172
+ workerExecutionId: z.ZodOptional<z.ZodString>;
173
+ canAnswer: z.ZodBoolean;
174
+ canCancel: z.ZodBoolean;
175
+ lastErrorCode: z.ZodOptional<z.ZodString>;
176
+ resolvedAt: z.ZodOptional<z.ZodString>;
177
+ }, "strip", z.ZodTypeAny, {
178
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
179
+ version: number;
180
+ interactionId: string;
181
+ question: string;
182
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
183
+ requestKey: string;
184
+ agentRunId: string;
185
+ intent: "ask" | "decide";
186
+ answerChannel: "chat" | "workitem" | "both";
187
+ reasonCode: string;
188
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
189
+ canAnswer: boolean;
190
+ canCancel: boolean;
191
+ responseSchema?: {
192
+ version: number;
193
+ submitLabel: string;
194
+ fields: {
195
+ label: string;
196
+ required: boolean;
197
+ key: string;
198
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
199
+ options?: {
200
+ value: string;
201
+ label: string;
202
+ description?: string | undefined;
203
+ }[] | undefined;
204
+ validation?: {
205
+ min?: number | undefined;
206
+ max?: number | undefined;
207
+ minLength?: number | undefined;
208
+ maxLength?: number | undefined;
209
+ maxItems?: number | undefined;
210
+ } | undefined;
211
+ description?: string | undefined;
212
+ defaultValue?: string | number | string[] | undefined;
213
+ }[];
214
+ } | undefined;
215
+ stepId?: string | undefined;
216
+ briefId?: string | undefined;
217
+ workerExecutionId?: string | undefined;
218
+ lastErrorCode?: string | undefined;
219
+ resolvedAt?: string | undefined;
220
+ }, {
221
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
222
+ version: number;
223
+ interactionId: string;
224
+ question: string;
225
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
226
+ requestKey: string;
227
+ agentRunId: string;
228
+ intent: "ask" | "decide";
229
+ answerChannel: "chat" | "workitem" | "both";
230
+ reasonCode: string;
231
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
232
+ canAnswer: boolean;
233
+ canCancel: boolean;
234
+ responseSchema?: {
235
+ version: number;
236
+ submitLabel: string;
237
+ fields: {
238
+ label: string;
239
+ required: boolean;
240
+ key: string;
241
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
242
+ options?: {
243
+ value: string;
244
+ label: string;
245
+ description?: string | undefined;
246
+ }[] | undefined;
247
+ validation?: {
248
+ min?: number | undefined;
249
+ max?: number | undefined;
250
+ minLength?: number | undefined;
251
+ maxLength?: number | undefined;
252
+ maxItems?: number | undefined;
253
+ } | undefined;
254
+ description?: string | undefined;
255
+ defaultValue?: string | number | string[] | undefined;
256
+ }[];
257
+ } | undefined;
258
+ stepId?: string | undefined;
259
+ briefId?: string | undefined;
260
+ workerExecutionId?: string | undefined;
261
+ lastErrorCode?: string | undefined;
262
+ resolvedAt?: string | undefined;
263
+ }>;
264
+ export declare const TerminalErrorStructureSchema: z.ZodObject<{
265
+ code: z.ZodString;
266
+ message: z.ZodString;
267
+ }, "strip", z.ZodTypeAny, {
268
+ code: string;
269
+ message: string;
270
+ }, {
271
+ code: string;
272
+ message: string;
273
+ }>;
274
+ export declare const ConversationTurnTerminalV1Schema: z.ZodObject<{
275
+ type: z.ZodLiteral<"conversation:turn_terminal">;
276
+ schemaVersion: z.ZodLiteral<1>;
277
+ conversationId: z.ZodString;
278
+ runId: z.ZodString;
279
+ status: z.ZodEnum<["completed", "failed", "stopped", "waiting_user_input"]>;
280
+ triggerUserMessageId: z.ZodOptional<z.ZodString>;
281
+ assistantMessage: z.ZodOptional<z.ZodObject<{
282
+ messageId: z.ZodString;
283
+ role: z.ZodLiteral<"assistant">;
284
+ content: z.ZodString;
285
+ createdAt: z.ZodString;
286
+ }, "strip", z.ZodTypeAny, {
287
+ content: string;
288
+ createdAt: string;
289
+ role: "assistant";
290
+ messageId: string;
291
+ }, {
292
+ content: string;
293
+ createdAt: string;
294
+ role: "assistant";
295
+ messageId: string;
296
+ }>>;
297
+ error: z.ZodOptional<z.ZodObject<{
298
+ code: z.ZodString;
299
+ message: z.ZodString;
300
+ }, "strip", z.ZodTypeAny, {
301
+ code: string;
302
+ message: string;
303
+ }, {
304
+ code: string;
305
+ message: string;
306
+ }>>;
307
+ humanInteraction: z.ZodOptional<z.ZodObject<{
308
+ interactionId: z.ZodString;
309
+ requestKey: z.ZodString;
310
+ agentRunId: z.ZodString;
311
+ intent: z.ZodEnum<["ask", "decide"]>;
312
+ answerChannel: z.ZodEnum<["chat", "workitem", "both"]>;
313
+ kind: z.ZodEnum<["clarification", "approval", "risk_confirmation", "credential_request", "acceptance"]>;
314
+ status: z.ZodEnum<["open", "resolving", "answered", "approved", "rejected", "cancelled", "expired", "delivery_failed"]>;
315
+ question: z.ZodString;
316
+ responseSchema: z.ZodOptional<z.ZodObject<{
317
+ version: z.ZodNumber;
318
+ submitLabel: z.ZodString;
319
+ fields: z.ZodArray<z.ZodObject<{
320
+ key: z.ZodString;
321
+ label: z.ZodString;
322
+ control: z.ZodEnum<["text", "textarea", "number", "select", "multi_select"]>;
323
+ description: z.ZodOptional<z.ZodString>;
324
+ required: z.ZodBoolean;
325
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>;
326
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
327
+ value: z.ZodString;
328
+ label: z.ZodString;
329
+ description: z.ZodOptional<z.ZodString>;
330
+ }, "strip", z.ZodTypeAny, {
331
+ value: string;
332
+ label: string;
333
+ description?: string | undefined;
334
+ }, {
335
+ value: string;
336
+ label: string;
337
+ description?: string | undefined;
338
+ }>, "many">>;
339
+ validation: z.ZodOptional<z.ZodObject<{
340
+ minLength: z.ZodOptional<z.ZodNumber>;
341
+ maxLength: z.ZodOptional<z.ZodNumber>;
342
+ min: z.ZodOptional<z.ZodNumber>;
343
+ max: z.ZodOptional<z.ZodNumber>;
344
+ maxItems: z.ZodOptional<z.ZodNumber>;
345
+ }, "strip", z.ZodTypeAny, {
346
+ min?: number | undefined;
347
+ max?: number | undefined;
348
+ minLength?: number | undefined;
349
+ maxLength?: number | undefined;
350
+ maxItems?: number | undefined;
351
+ }, {
352
+ min?: number | undefined;
353
+ max?: number | undefined;
354
+ minLength?: number | undefined;
355
+ maxLength?: number | undefined;
356
+ maxItems?: number | undefined;
357
+ }>>;
358
+ }, "strip", z.ZodTypeAny, {
359
+ label: string;
360
+ required: boolean;
361
+ key: string;
362
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
363
+ options?: {
364
+ value: string;
365
+ label: string;
366
+ description?: string | undefined;
367
+ }[] | undefined;
368
+ validation?: {
369
+ min?: number | undefined;
370
+ max?: number | undefined;
371
+ minLength?: number | undefined;
372
+ maxLength?: number | undefined;
373
+ maxItems?: number | undefined;
374
+ } | undefined;
375
+ description?: string | undefined;
376
+ defaultValue?: string | number | string[] | undefined;
377
+ }, {
378
+ label: string;
379
+ required: boolean;
380
+ key: string;
381
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
382
+ options?: {
383
+ value: string;
384
+ label: string;
385
+ description?: string | undefined;
386
+ }[] | undefined;
387
+ validation?: {
388
+ min?: number | undefined;
389
+ max?: number | undefined;
390
+ minLength?: number | undefined;
391
+ maxLength?: number | undefined;
392
+ maxItems?: number | undefined;
393
+ } | undefined;
394
+ description?: string | undefined;
395
+ defaultValue?: string | number | string[] | undefined;
396
+ }>, "many">;
397
+ }, "strip", z.ZodTypeAny, {
398
+ version: number;
399
+ submitLabel: string;
400
+ fields: {
401
+ label: string;
402
+ required: boolean;
403
+ key: string;
404
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
405
+ options?: {
406
+ value: string;
407
+ label: string;
408
+ description?: string | undefined;
409
+ }[] | undefined;
410
+ validation?: {
411
+ min?: number | undefined;
412
+ max?: number | undefined;
413
+ minLength?: number | undefined;
414
+ maxLength?: number | undefined;
415
+ maxItems?: number | undefined;
416
+ } | undefined;
417
+ description?: string | undefined;
418
+ defaultValue?: string | number | string[] | undefined;
419
+ }[];
420
+ }, {
421
+ version: number;
422
+ submitLabel: string;
423
+ fields: {
424
+ label: string;
425
+ required: boolean;
426
+ key: string;
427
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
428
+ options?: {
429
+ value: string;
430
+ label: string;
431
+ description?: string | undefined;
432
+ }[] | undefined;
433
+ validation?: {
434
+ min?: number | undefined;
435
+ max?: number | undefined;
436
+ minLength?: number | undefined;
437
+ maxLength?: number | undefined;
438
+ maxItems?: number | undefined;
439
+ } | undefined;
440
+ description?: string | undefined;
441
+ defaultValue?: string | number | string[] | undefined;
442
+ }[];
443
+ }>>;
444
+ reasonCode: z.ZodString;
445
+ version: z.ZodNumber;
446
+ allowedActions: z.ZodArray<z.ZodEnum<["submit_form", "approve", "reject", "credential_ready", "cancel"]>, "many">;
447
+ stepId: z.ZodOptional<z.ZodString>;
448
+ briefId: z.ZodOptional<z.ZodString>;
449
+ workerExecutionId: z.ZodOptional<z.ZodString>;
450
+ canAnswer: z.ZodBoolean;
451
+ canCancel: z.ZodBoolean;
452
+ lastErrorCode: z.ZodOptional<z.ZodString>;
453
+ resolvedAt: z.ZodOptional<z.ZodString>;
454
+ }, "strip", z.ZodTypeAny, {
455
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
456
+ version: number;
457
+ interactionId: string;
458
+ question: string;
459
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
460
+ requestKey: string;
461
+ agentRunId: string;
462
+ intent: "ask" | "decide";
463
+ answerChannel: "chat" | "workitem" | "both";
464
+ reasonCode: string;
465
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
466
+ canAnswer: boolean;
467
+ canCancel: boolean;
468
+ responseSchema?: {
469
+ version: number;
470
+ submitLabel: string;
471
+ fields: {
472
+ label: string;
473
+ required: boolean;
474
+ key: string;
475
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
476
+ options?: {
477
+ value: string;
478
+ label: string;
479
+ description?: string | undefined;
480
+ }[] | undefined;
481
+ validation?: {
482
+ min?: number | undefined;
483
+ max?: number | undefined;
484
+ minLength?: number | undefined;
485
+ maxLength?: number | undefined;
486
+ maxItems?: number | undefined;
487
+ } | undefined;
488
+ description?: string | undefined;
489
+ defaultValue?: string | number | string[] | undefined;
490
+ }[];
491
+ } | undefined;
492
+ stepId?: string | undefined;
493
+ briefId?: string | undefined;
494
+ workerExecutionId?: string | undefined;
495
+ lastErrorCode?: string | undefined;
496
+ resolvedAt?: string | undefined;
497
+ }, {
498
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
499
+ version: number;
500
+ interactionId: string;
501
+ question: string;
502
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
503
+ requestKey: string;
504
+ agentRunId: string;
505
+ intent: "ask" | "decide";
506
+ answerChannel: "chat" | "workitem" | "both";
507
+ reasonCode: string;
508
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
509
+ canAnswer: boolean;
510
+ canCancel: boolean;
511
+ responseSchema?: {
512
+ version: number;
513
+ submitLabel: string;
514
+ fields: {
515
+ label: string;
516
+ required: boolean;
517
+ key: string;
518
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
519
+ options?: {
520
+ value: string;
521
+ label: string;
522
+ description?: string | undefined;
523
+ }[] | undefined;
524
+ validation?: {
525
+ min?: number | undefined;
526
+ max?: number | undefined;
527
+ minLength?: number | undefined;
528
+ maxLength?: number | undefined;
529
+ maxItems?: number | undefined;
530
+ } | undefined;
531
+ description?: string | undefined;
532
+ defaultValue?: string | number | string[] | undefined;
533
+ }[];
534
+ } | undefined;
535
+ stepId?: string | undefined;
536
+ briefId?: string | undefined;
537
+ workerExecutionId?: string | undefined;
538
+ lastErrorCode?: string | undefined;
539
+ resolvedAt?: string | undefined;
540
+ }>>;
541
+ stateUpdatedAt: z.ZodString;
542
+ }, "strip", z.ZodTypeAny, {
543
+ type: "conversation:turn_terminal";
544
+ status: "completed" | "failed" | "stopped" | "waiting_user_input";
545
+ schemaVersion: 1;
546
+ conversationId: string;
547
+ runId: string;
548
+ stateUpdatedAt: string;
549
+ error?: {
550
+ code: string;
551
+ message: string;
552
+ } | undefined;
553
+ triggerUserMessageId?: string | undefined;
554
+ assistantMessage?: {
555
+ content: string;
556
+ createdAt: string;
557
+ role: "assistant";
558
+ messageId: string;
559
+ } | undefined;
560
+ humanInteraction?: {
561
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
562
+ version: number;
563
+ interactionId: string;
564
+ question: string;
565
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
566
+ requestKey: string;
567
+ agentRunId: string;
568
+ intent: "ask" | "decide";
569
+ answerChannel: "chat" | "workitem" | "both";
570
+ reasonCode: string;
571
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
572
+ canAnswer: boolean;
573
+ canCancel: boolean;
574
+ responseSchema?: {
575
+ version: number;
576
+ submitLabel: string;
577
+ fields: {
578
+ label: string;
579
+ required: boolean;
580
+ key: string;
581
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
582
+ options?: {
583
+ value: string;
584
+ label: string;
585
+ description?: string | undefined;
586
+ }[] | undefined;
587
+ validation?: {
588
+ min?: number | undefined;
589
+ max?: number | undefined;
590
+ minLength?: number | undefined;
591
+ maxLength?: number | undefined;
592
+ maxItems?: number | undefined;
593
+ } | undefined;
594
+ description?: string | undefined;
595
+ defaultValue?: string | number | string[] | undefined;
596
+ }[];
597
+ } | undefined;
598
+ stepId?: string | undefined;
599
+ briefId?: string | undefined;
600
+ workerExecutionId?: string | undefined;
601
+ lastErrorCode?: string | undefined;
602
+ resolvedAt?: string | undefined;
603
+ } | undefined;
604
+ }, {
605
+ type: "conversation:turn_terminal";
606
+ status: "completed" | "failed" | "stopped" | "waiting_user_input";
607
+ schemaVersion: 1;
608
+ conversationId: string;
609
+ runId: string;
610
+ stateUpdatedAt: string;
611
+ error?: {
612
+ code: string;
613
+ message: string;
614
+ } | undefined;
615
+ triggerUserMessageId?: string | undefined;
616
+ assistantMessage?: {
617
+ content: string;
618
+ createdAt: string;
619
+ role: "assistant";
620
+ messageId: string;
621
+ } | undefined;
622
+ humanInteraction?: {
623
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
624
+ version: number;
625
+ interactionId: string;
626
+ question: string;
627
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
628
+ requestKey: string;
629
+ agentRunId: string;
630
+ intent: "ask" | "decide";
631
+ answerChannel: "chat" | "workitem" | "both";
632
+ reasonCode: string;
633
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
634
+ canAnswer: boolean;
635
+ canCancel: boolean;
636
+ responseSchema?: {
637
+ version: number;
638
+ submitLabel: string;
639
+ fields: {
640
+ label: string;
641
+ required: boolean;
642
+ key: string;
643
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
644
+ options?: {
645
+ value: string;
646
+ label: string;
647
+ description?: string | undefined;
648
+ }[] | undefined;
649
+ validation?: {
650
+ min?: number | undefined;
651
+ max?: number | undefined;
652
+ minLength?: number | undefined;
653
+ maxLength?: number | undefined;
654
+ maxItems?: number | undefined;
655
+ } | undefined;
656
+ description?: string | undefined;
657
+ defaultValue?: string | number | string[] | undefined;
658
+ }[];
659
+ } | undefined;
660
+ stepId?: string | undefined;
661
+ briefId?: string | undefined;
662
+ workerExecutionId?: string | undefined;
663
+ lastErrorCode?: string | undefined;
664
+ resolvedAt?: string | undefined;
665
+ } | undefined;
666
+ }>;
667
+ export declare const ConnectionSyncConversationEntrySchema: z.ZodObject<{
668
+ conversationId: z.ZodString;
669
+ expectedRunId: z.ZodOptional<z.ZodString>;
670
+ expectedTriggerUserMessageId: z.ZodOptional<z.ZodString>;
671
+ }, "strip", z.ZodTypeAny, {
672
+ conversationId: string;
673
+ expectedRunId?: string | undefined;
674
+ expectedTriggerUserMessageId?: string | undefined;
675
+ }, {
676
+ conversationId: string;
677
+ expectedRunId?: string | undefined;
678
+ expectedTriggerUserMessageId?: string | undefined;
679
+ }>;
680
+ export declare const ConnectionSyncV1Schema: z.ZodObject<{
681
+ type: z.ZodLiteral<"connection:sync">;
682
+ schemaVersion: z.ZodLiteral<1>;
683
+ connectionGeneration: z.ZodNumber;
684
+ conversations: z.ZodArray<z.ZodObject<{
685
+ conversationId: z.ZodString;
686
+ expectedRunId: z.ZodOptional<z.ZodString>;
687
+ expectedTriggerUserMessageId: z.ZodOptional<z.ZodString>;
688
+ }, "strip", z.ZodTypeAny, {
689
+ conversationId: string;
690
+ expectedRunId?: string | undefined;
691
+ expectedTriggerUserMessageId?: string | undefined;
692
+ }, {
693
+ conversationId: string;
694
+ expectedRunId?: string | undefined;
695
+ expectedTriggerUserMessageId?: string | undefined;
696
+ }>, "many">;
697
+ }, "strip", z.ZodTypeAny, {
698
+ type: "connection:sync";
699
+ schemaVersion: 1;
700
+ connectionGeneration: number;
701
+ conversations: {
702
+ conversationId: string;
703
+ expectedRunId?: string | undefined;
704
+ expectedTriggerUserMessageId?: string | undefined;
705
+ }[];
706
+ }, {
707
+ type: "connection:sync";
708
+ schemaVersion: 1;
709
+ connectionGeneration: number;
710
+ conversations: {
711
+ conversationId: string;
712
+ expectedRunId?: string | undefined;
713
+ expectedTriggerUserMessageId?: string | undefined;
714
+ }[];
715
+ }>;
716
+ export declare const ConversationRuntimeSnapshotSchema: z.ZodObject<{
717
+ conversationId: z.ZodString;
718
+ runId: z.ZodOptional<z.ZodString>;
719
+ phase: z.ZodEnum<["idle", "running", "waiting_async", "waiting_user_input", "completed", "failed", "stopped"]>;
720
+ triggerUserMessageId: z.ZodOptional<z.ZodString>;
721
+ assistantMessage: z.ZodOptional<z.ZodObject<{
722
+ messageId: z.ZodString;
723
+ role: z.ZodLiteral<"assistant">;
724
+ content: z.ZodString;
725
+ createdAt: z.ZodString;
726
+ }, "strip", z.ZodTypeAny, {
727
+ content: string;
728
+ createdAt: string;
729
+ role: "assistant";
730
+ messageId: string;
731
+ }, {
732
+ content: string;
733
+ createdAt: string;
734
+ role: "assistant";
735
+ messageId: string;
736
+ }>>;
737
+ humanInteraction: z.ZodOptional<z.ZodObject<{
738
+ interactionId: z.ZodString;
739
+ requestKey: z.ZodString;
740
+ agentRunId: z.ZodString;
741
+ intent: z.ZodEnum<["ask", "decide"]>;
742
+ answerChannel: z.ZodEnum<["chat", "workitem", "both"]>;
743
+ kind: z.ZodEnum<["clarification", "approval", "risk_confirmation", "credential_request", "acceptance"]>;
744
+ status: z.ZodEnum<["open", "resolving", "answered", "approved", "rejected", "cancelled", "expired", "delivery_failed"]>;
745
+ question: z.ZodString;
746
+ responseSchema: z.ZodOptional<z.ZodObject<{
747
+ version: z.ZodNumber;
748
+ submitLabel: z.ZodString;
749
+ fields: z.ZodArray<z.ZodObject<{
750
+ key: z.ZodString;
751
+ label: z.ZodString;
752
+ control: z.ZodEnum<["text", "textarea", "number", "select", "multi_select"]>;
753
+ description: z.ZodOptional<z.ZodString>;
754
+ required: z.ZodBoolean;
755
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>;
756
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
757
+ value: z.ZodString;
758
+ label: z.ZodString;
759
+ description: z.ZodOptional<z.ZodString>;
760
+ }, "strip", z.ZodTypeAny, {
761
+ value: string;
762
+ label: string;
763
+ description?: string | undefined;
764
+ }, {
765
+ value: string;
766
+ label: string;
767
+ description?: string | undefined;
768
+ }>, "many">>;
769
+ validation: z.ZodOptional<z.ZodObject<{
770
+ minLength: z.ZodOptional<z.ZodNumber>;
771
+ maxLength: z.ZodOptional<z.ZodNumber>;
772
+ min: z.ZodOptional<z.ZodNumber>;
773
+ max: z.ZodOptional<z.ZodNumber>;
774
+ maxItems: z.ZodOptional<z.ZodNumber>;
775
+ }, "strip", z.ZodTypeAny, {
776
+ min?: number | undefined;
777
+ max?: number | undefined;
778
+ minLength?: number | undefined;
779
+ maxLength?: number | undefined;
780
+ maxItems?: number | undefined;
781
+ }, {
782
+ min?: number | undefined;
783
+ max?: number | undefined;
784
+ minLength?: number | undefined;
785
+ maxLength?: number | undefined;
786
+ maxItems?: number | undefined;
787
+ }>>;
788
+ }, "strip", z.ZodTypeAny, {
789
+ label: string;
790
+ required: boolean;
791
+ key: string;
792
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
793
+ options?: {
794
+ value: string;
795
+ label: string;
796
+ description?: string | undefined;
797
+ }[] | undefined;
798
+ validation?: {
799
+ min?: number | undefined;
800
+ max?: number | undefined;
801
+ minLength?: number | undefined;
802
+ maxLength?: number | undefined;
803
+ maxItems?: number | undefined;
804
+ } | undefined;
805
+ description?: string | undefined;
806
+ defaultValue?: string | number | string[] | undefined;
807
+ }, {
808
+ label: string;
809
+ required: boolean;
810
+ key: string;
811
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
812
+ options?: {
813
+ value: string;
814
+ label: string;
815
+ description?: string | undefined;
816
+ }[] | undefined;
817
+ validation?: {
818
+ min?: number | undefined;
819
+ max?: number | undefined;
820
+ minLength?: number | undefined;
821
+ maxLength?: number | undefined;
822
+ maxItems?: number | undefined;
823
+ } | undefined;
824
+ description?: string | undefined;
825
+ defaultValue?: string | number | string[] | undefined;
826
+ }>, "many">;
827
+ }, "strip", z.ZodTypeAny, {
828
+ version: number;
829
+ submitLabel: string;
830
+ fields: {
831
+ label: string;
832
+ required: boolean;
833
+ key: string;
834
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
835
+ options?: {
836
+ value: string;
837
+ label: string;
838
+ description?: string | undefined;
839
+ }[] | undefined;
840
+ validation?: {
841
+ min?: number | undefined;
842
+ max?: number | undefined;
843
+ minLength?: number | undefined;
844
+ maxLength?: number | undefined;
845
+ maxItems?: number | undefined;
846
+ } | undefined;
847
+ description?: string | undefined;
848
+ defaultValue?: string | number | string[] | undefined;
849
+ }[];
850
+ }, {
851
+ version: number;
852
+ submitLabel: string;
853
+ fields: {
854
+ label: string;
855
+ required: boolean;
856
+ key: string;
857
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
858
+ options?: {
859
+ value: string;
860
+ label: string;
861
+ description?: string | undefined;
862
+ }[] | undefined;
863
+ validation?: {
864
+ min?: number | undefined;
865
+ max?: number | undefined;
866
+ minLength?: number | undefined;
867
+ maxLength?: number | undefined;
868
+ maxItems?: number | undefined;
869
+ } | undefined;
870
+ description?: string | undefined;
871
+ defaultValue?: string | number | string[] | undefined;
872
+ }[];
873
+ }>>;
874
+ reasonCode: z.ZodString;
875
+ version: z.ZodNumber;
876
+ allowedActions: z.ZodArray<z.ZodEnum<["submit_form", "approve", "reject", "credential_ready", "cancel"]>, "many">;
877
+ stepId: z.ZodOptional<z.ZodString>;
878
+ briefId: z.ZodOptional<z.ZodString>;
879
+ workerExecutionId: z.ZodOptional<z.ZodString>;
880
+ canAnswer: z.ZodBoolean;
881
+ canCancel: z.ZodBoolean;
882
+ lastErrorCode: z.ZodOptional<z.ZodString>;
883
+ resolvedAt: z.ZodOptional<z.ZodString>;
884
+ }, "strip", z.ZodTypeAny, {
885
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
886
+ version: number;
887
+ interactionId: string;
888
+ question: string;
889
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
890
+ requestKey: string;
891
+ agentRunId: string;
892
+ intent: "ask" | "decide";
893
+ answerChannel: "chat" | "workitem" | "both";
894
+ reasonCode: string;
895
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
896
+ canAnswer: boolean;
897
+ canCancel: boolean;
898
+ responseSchema?: {
899
+ version: number;
900
+ submitLabel: string;
901
+ fields: {
902
+ label: string;
903
+ required: boolean;
904
+ key: string;
905
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
906
+ options?: {
907
+ value: string;
908
+ label: string;
909
+ description?: string | undefined;
910
+ }[] | undefined;
911
+ validation?: {
912
+ min?: number | undefined;
913
+ max?: number | undefined;
914
+ minLength?: number | undefined;
915
+ maxLength?: number | undefined;
916
+ maxItems?: number | undefined;
917
+ } | undefined;
918
+ description?: string | undefined;
919
+ defaultValue?: string | number | string[] | undefined;
920
+ }[];
921
+ } | undefined;
922
+ stepId?: string | undefined;
923
+ briefId?: string | undefined;
924
+ workerExecutionId?: string | undefined;
925
+ lastErrorCode?: string | undefined;
926
+ resolvedAt?: string | undefined;
927
+ }, {
928
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
929
+ version: number;
930
+ interactionId: string;
931
+ question: string;
932
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
933
+ requestKey: string;
934
+ agentRunId: string;
935
+ intent: "ask" | "decide";
936
+ answerChannel: "chat" | "workitem" | "both";
937
+ reasonCode: string;
938
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
939
+ canAnswer: boolean;
940
+ canCancel: boolean;
941
+ responseSchema?: {
942
+ version: number;
943
+ submitLabel: string;
944
+ fields: {
945
+ label: string;
946
+ required: boolean;
947
+ key: string;
948
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
949
+ options?: {
950
+ value: string;
951
+ label: string;
952
+ description?: string | undefined;
953
+ }[] | undefined;
954
+ validation?: {
955
+ min?: number | undefined;
956
+ max?: number | undefined;
957
+ minLength?: number | undefined;
958
+ maxLength?: number | undefined;
959
+ maxItems?: number | undefined;
960
+ } | undefined;
961
+ description?: string | undefined;
962
+ defaultValue?: string | number | string[] | undefined;
963
+ }[];
964
+ } | undefined;
965
+ stepId?: string | undefined;
966
+ briefId?: string | undefined;
967
+ workerExecutionId?: string | undefined;
968
+ lastErrorCode?: string | undefined;
969
+ resolvedAt?: string | undefined;
970
+ }>>;
971
+ error: z.ZodOptional<z.ZodObject<{
972
+ code: z.ZodString;
973
+ message: z.ZodString;
974
+ }, "strip", z.ZodTypeAny, {
975
+ code: string;
976
+ message: string;
977
+ }, {
978
+ code: string;
979
+ message: string;
980
+ }>>;
981
+ stateUpdatedAt: z.ZodString;
982
+ }, "strip", z.ZodTypeAny, {
983
+ conversationId: string;
984
+ stateUpdatedAt: string;
985
+ phase: "running" | "completed" | "failed" | "stopped" | "waiting_user_input" | "idle" | "waiting_async";
986
+ error?: {
987
+ code: string;
988
+ message: string;
989
+ } | undefined;
990
+ runId?: string | undefined;
991
+ triggerUserMessageId?: string | undefined;
992
+ assistantMessage?: {
993
+ content: string;
994
+ createdAt: string;
995
+ role: "assistant";
996
+ messageId: string;
997
+ } | undefined;
998
+ humanInteraction?: {
999
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1000
+ version: number;
1001
+ interactionId: string;
1002
+ question: string;
1003
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1004
+ requestKey: string;
1005
+ agentRunId: string;
1006
+ intent: "ask" | "decide";
1007
+ answerChannel: "chat" | "workitem" | "both";
1008
+ reasonCode: string;
1009
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1010
+ canAnswer: boolean;
1011
+ canCancel: boolean;
1012
+ responseSchema?: {
1013
+ version: number;
1014
+ submitLabel: string;
1015
+ fields: {
1016
+ label: string;
1017
+ required: boolean;
1018
+ key: string;
1019
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1020
+ options?: {
1021
+ value: string;
1022
+ label: string;
1023
+ description?: string | undefined;
1024
+ }[] | undefined;
1025
+ validation?: {
1026
+ min?: number | undefined;
1027
+ max?: number | undefined;
1028
+ minLength?: number | undefined;
1029
+ maxLength?: number | undefined;
1030
+ maxItems?: number | undefined;
1031
+ } | undefined;
1032
+ description?: string | undefined;
1033
+ defaultValue?: string | number | string[] | undefined;
1034
+ }[];
1035
+ } | undefined;
1036
+ stepId?: string | undefined;
1037
+ briefId?: string | undefined;
1038
+ workerExecutionId?: string | undefined;
1039
+ lastErrorCode?: string | undefined;
1040
+ resolvedAt?: string | undefined;
1041
+ } | undefined;
1042
+ }, {
1043
+ conversationId: string;
1044
+ stateUpdatedAt: string;
1045
+ phase: "running" | "completed" | "failed" | "stopped" | "waiting_user_input" | "idle" | "waiting_async";
1046
+ error?: {
1047
+ code: string;
1048
+ message: string;
1049
+ } | undefined;
1050
+ runId?: string | undefined;
1051
+ triggerUserMessageId?: string | undefined;
1052
+ assistantMessage?: {
1053
+ content: string;
1054
+ createdAt: string;
1055
+ role: "assistant";
1056
+ messageId: string;
1057
+ } | undefined;
1058
+ humanInteraction?: {
1059
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1060
+ version: number;
1061
+ interactionId: string;
1062
+ question: string;
1063
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1064
+ requestKey: string;
1065
+ agentRunId: string;
1066
+ intent: "ask" | "decide";
1067
+ answerChannel: "chat" | "workitem" | "both";
1068
+ reasonCode: string;
1069
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1070
+ canAnswer: boolean;
1071
+ canCancel: boolean;
1072
+ responseSchema?: {
1073
+ version: number;
1074
+ submitLabel: string;
1075
+ fields: {
1076
+ label: string;
1077
+ required: boolean;
1078
+ key: string;
1079
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1080
+ options?: {
1081
+ value: string;
1082
+ label: string;
1083
+ description?: string | undefined;
1084
+ }[] | undefined;
1085
+ validation?: {
1086
+ min?: number | undefined;
1087
+ max?: number | undefined;
1088
+ minLength?: number | undefined;
1089
+ maxLength?: number | undefined;
1090
+ maxItems?: number | undefined;
1091
+ } | undefined;
1092
+ description?: string | undefined;
1093
+ defaultValue?: string | number | string[] | undefined;
1094
+ }[];
1095
+ } | undefined;
1096
+ stepId?: string | undefined;
1097
+ briefId?: string | undefined;
1098
+ workerExecutionId?: string | undefined;
1099
+ lastErrorCode?: string | undefined;
1100
+ resolvedAt?: string | undefined;
1101
+ } | undefined;
1102
+ }>;
1103
+ export declare const ConnectionSyncResultV1Schema: z.ZodObject<{
1104
+ type: z.ZodLiteral<"connection:sync_result">;
1105
+ schemaVersion: z.ZodLiteral<1>;
1106
+ connectionGeneration: z.ZodNumber;
1107
+ snapshots: z.ZodArray<z.ZodObject<{
1108
+ conversationId: z.ZodString;
1109
+ runId: z.ZodOptional<z.ZodString>;
1110
+ phase: z.ZodEnum<["idle", "running", "waiting_async", "waiting_user_input", "completed", "failed", "stopped"]>;
1111
+ triggerUserMessageId: z.ZodOptional<z.ZodString>;
1112
+ assistantMessage: z.ZodOptional<z.ZodObject<{
1113
+ messageId: z.ZodString;
1114
+ role: z.ZodLiteral<"assistant">;
1115
+ content: z.ZodString;
1116
+ createdAt: z.ZodString;
1117
+ }, "strip", z.ZodTypeAny, {
1118
+ content: string;
1119
+ createdAt: string;
1120
+ role: "assistant";
1121
+ messageId: string;
1122
+ }, {
1123
+ content: string;
1124
+ createdAt: string;
1125
+ role: "assistant";
1126
+ messageId: string;
1127
+ }>>;
1128
+ humanInteraction: z.ZodOptional<z.ZodObject<{
1129
+ interactionId: z.ZodString;
1130
+ requestKey: z.ZodString;
1131
+ agentRunId: z.ZodString;
1132
+ intent: z.ZodEnum<["ask", "decide"]>;
1133
+ answerChannel: z.ZodEnum<["chat", "workitem", "both"]>;
1134
+ kind: z.ZodEnum<["clarification", "approval", "risk_confirmation", "credential_request", "acceptance"]>;
1135
+ status: z.ZodEnum<["open", "resolving", "answered", "approved", "rejected", "cancelled", "expired", "delivery_failed"]>;
1136
+ question: z.ZodString;
1137
+ responseSchema: z.ZodOptional<z.ZodObject<{
1138
+ version: z.ZodNumber;
1139
+ submitLabel: z.ZodString;
1140
+ fields: z.ZodArray<z.ZodObject<{
1141
+ key: z.ZodString;
1142
+ label: z.ZodString;
1143
+ control: z.ZodEnum<["text", "textarea", "number", "select", "multi_select"]>;
1144
+ description: z.ZodOptional<z.ZodString>;
1145
+ required: z.ZodBoolean;
1146
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>;
1147
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
1148
+ value: z.ZodString;
1149
+ label: z.ZodString;
1150
+ description: z.ZodOptional<z.ZodString>;
1151
+ }, "strip", z.ZodTypeAny, {
1152
+ value: string;
1153
+ label: string;
1154
+ description?: string | undefined;
1155
+ }, {
1156
+ value: string;
1157
+ label: string;
1158
+ description?: string | undefined;
1159
+ }>, "many">>;
1160
+ validation: z.ZodOptional<z.ZodObject<{
1161
+ minLength: z.ZodOptional<z.ZodNumber>;
1162
+ maxLength: z.ZodOptional<z.ZodNumber>;
1163
+ min: z.ZodOptional<z.ZodNumber>;
1164
+ max: z.ZodOptional<z.ZodNumber>;
1165
+ maxItems: z.ZodOptional<z.ZodNumber>;
1166
+ }, "strip", z.ZodTypeAny, {
1167
+ min?: number | undefined;
1168
+ max?: number | undefined;
1169
+ minLength?: number | undefined;
1170
+ maxLength?: number | undefined;
1171
+ maxItems?: number | undefined;
1172
+ }, {
1173
+ min?: number | undefined;
1174
+ max?: number | undefined;
1175
+ minLength?: number | undefined;
1176
+ maxLength?: number | undefined;
1177
+ maxItems?: number | undefined;
1178
+ }>>;
1179
+ }, "strip", z.ZodTypeAny, {
1180
+ label: string;
1181
+ required: boolean;
1182
+ key: string;
1183
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1184
+ options?: {
1185
+ value: string;
1186
+ label: string;
1187
+ description?: string | undefined;
1188
+ }[] | undefined;
1189
+ validation?: {
1190
+ min?: number | undefined;
1191
+ max?: number | undefined;
1192
+ minLength?: number | undefined;
1193
+ maxLength?: number | undefined;
1194
+ maxItems?: number | undefined;
1195
+ } | undefined;
1196
+ description?: string | undefined;
1197
+ defaultValue?: string | number | string[] | undefined;
1198
+ }, {
1199
+ label: string;
1200
+ required: boolean;
1201
+ key: string;
1202
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1203
+ options?: {
1204
+ value: string;
1205
+ label: string;
1206
+ description?: string | undefined;
1207
+ }[] | undefined;
1208
+ validation?: {
1209
+ min?: number | undefined;
1210
+ max?: number | undefined;
1211
+ minLength?: number | undefined;
1212
+ maxLength?: number | undefined;
1213
+ maxItems?: number | undefined;
1214
+ } | undefined;
1215
+ description?: string | undefined;
1216
+ defaultValue?: string | number | string[] | undefined;
1217
+ }>, "many">;
1218
+ }, "strip", z.ZodTypeAny, {
1219
+ version: number;
1220
+ submitLabel: string;
1221
+ fields: {
1222
+ label: string;
1223
+ required: boolean;
1224
+ key: string;
1225
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1226
+ options?: {
1227
+ value: string;
1228
+ label: string;
1229
+ description?: string | undefined;
1230
+ }[] | undefined;
1231
+ validation?: {
1232
+ min?: number | undefined;
1233
+ max?: number | undefined;
1234
+ minLength?: number | undefined;
1235
+ maxLength?: number | undefined;
1236
+ maxItems?: number | undefined;
1237
+ } | undefined;
1238
+ description?: string | undefined;
1239
+ defaultValue?: string | number | string[] | undefined;
1240
+ }[];
1241
+ }, {
1242
+ version: number;
1243
+ submitLabel: string;
1244
+ fields: {
1245
+ label: string;
1246
+ required: boolean;
1247
+ key: string;
1248
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1249
+ options?: {
1250
+ value: string;
1251
+ label: string;
1252
+ description?: string | undefined;
1253
+ }[] | undefined;
1254
+ validation?: {
1255
+ min?: number | undefined;
1256
+ max?: number | undefined;
1257
+ minLength?: number | undefined;
1258
+ maxLength?: number | undefined;
1259
+ maxItems?: number | undefined;
1260
+ } | undefined;
1261
+ description?: string | undefined;
1262
+ defaultValue?: string | number | string[] | undefined;
1263
+ }[];
1264
+ }>>;
1265
+ reasonCode: z.ZodString;
1266
+ version: z.ZodNumber;
1267
+ allowedActions: z.ZodArray<z.ZodEnum<["submit_form", "approve", "reject", "credential_ready", "cancel"]>, "many">;
1268
+ stepId: z.ZodOptional<z.ZodString>;
1269
+ briefId: z.ZodOptional<z.ZodString>;
1270
+ workerExecutionId: z.ZodOptional<z.ZodString>;
1271
+ canAnswer: z.ZodBoolean;
1272
+ canCancel: z.ZodBoolean;
1273
+ lastErrorCode: z.ZodOptional<z.ZodString>;
1274
+ resolvedAt: z.ZodOptional<z.ZodString>;
1275
+ }, "strip", z.ZodTypeAny, {
1276
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1277
+ version: number;
1278
+ interactionId: string;
1279
+ question: string;
1280
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1281
+ requestKey: string;
1282
+ agentRunId: string;
1283
+ intent: "ask" | "decide";
1284
+ answerChannel: "chat" | "workitem" | "both";
1285
+ reasonCode: string;
1286
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1287
+ canAnswer: boolean;
1288
+ canCancel: boolean;
1289
+ responseSchema?: {
1290
+ version: number;
1291
+ submitLabel: string;
1292
+ fields: {
1293
+ label: string;
1294
+ required: boolean;
1295
+ key: string;
1296
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1297
+ options?: {
1298
+ value: string;
1299
+ label: string;
1300
+ description?: string | undefined;
1301
+ }[] | undefined;
1302
+ validation?: {
1303
+ min?: number | undefined;
1304
+ max?: number | undefined;
1305
+ minLength?: number | undefined;
1306
+ maxLength?: number | undefined;
1307
+ maxItems?: number | undefined;
1308
+ } | undefined;
1309
+ description?: string | undefined;
1310
+ defaultValue?: string | number | string[] | undefined;
1311
+ }[];
1312
+ } | undefined;
1313
+ stepId?: string | undefined;
1314
+ briefId?: string | undefined;
1315
+ workerExecutionId?: string | undefined;
1316
+ lastErrorCode?: string | undefined;
1317
+ resolvedAt?: string | undefined;
1318
+ }, {
1319
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1320
+ version: number;
1321
+ interactionId: string;
1322
+ question: string;
1323
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1324
+ requestKey: string;
1325
+ agentRunId: string;
1326
+ intent: "ask" | "decide";
1327
+ answerChannel: "chat" | "workitem" | "both";
1328
+ reasonCode: string;
1329
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1330
+ canAnswer: boolean;
1331
+ canCancel: boolean;
1332
+ responseSchema?: {
1333
+ version: number;
1334
+ submitLabel: string;
1335
+ fields: {
1336
+ label: string;
1337
+ required: boolean;
1338
+ key: string;
1339
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1340
+ options?: {
1341
+ value: string;
1342
+ label: string;
1343
+ description?: string | undefined;
1344
+ }[] | undefined;
1345
+ validation?: {
1346
+ min?: number | undefined;
1347
+ max?: number | undefined;
1348
+ minLength?: number | undefined;
1349
+ maxLength?: number | undefined;
1350
+ maxItems?: number | undefined;
1351
+ } | undefined;
1352
+ description?: string | undefined;
1353
+ defaultValue?: string | number | string[] | undefined;
1354
+ }[];
1355
+ } | undefined;
1356
+ stepId?: string | undefined;
1357
+ briefId?: string | undefined;
1358
+ workerExecutionId?: string | undefined;
1359
+ lastErrorCode?: string | undefined;
1360
+ resolvedAt?: string | undefined;
1361
+ }>>;
1362
+ error: z.ZodOptional<z.ZodObject<{
1363
+ code: z.ZodString;
1364
+ message: z.ZodString;
1365
+ }, "strip", z.ZodTypeAny, {
1366
+ code: string;
1367
+ message: string;
1368
+ }, {
1369
+ code: string;
1370
+ message: string;
1371
+ }>>;
1372
+ stateUpdatedAt: z.ZodString;
1373
+ }, "strip", z.ZodTypeAny, {
1374
+ conversationId: string;
1375
+ stateUpdatedAt: string;
1376
+ phase: "running" | "completed" | "failed" | "stopped" | "waiting_user_input" | "idle" | "waiting_async";
1377
+ error?: {
1378
+ code: string;
1379
+ message: string;
1380
+ } | undefined;
1381
+ runId?: string | undefined;
1382
+ triggerUserMessageId?: string | undefined;
1383
+ assistantMessage?: {
1384
+ content: string;
1385
+ createdAt: string;
1386
+ role: "assistant";
1387
+ messageId: string;
1388
+ } | undefined;
1389
+ humanInteraction?: {
1390
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1391
+ version: number;
1392
+ interactionId: string;
1393
+ question: string;
1394
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1395
+ requestKey: string;
1396
+ agentRunId: string;
1397
+ intent: "ask" | "decide";
1398
+ answerChannel: "chat" | "workitem" | "both";
1399
+ reasonCode: string;
1400
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1401
+ canAnswer: boolean;
1402
+ canCancel: boolean;
1403
+ responseSchema?: {
1404
+ version: number;
1405
+ submitLabel: string;
1406
+ fields: {
1407
+ label: string;
1408
+ required: boolean;
1409
+ key: string;
1410
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1411
+ options?: {
1412
+ value: string;
1413
+ label: string;
1414
+ description?: string | undefined;
1415
+ }[] | undefined;
1416
+ validation?: {
1417
+ min?: number | undefined;
1418
+ max?: number | undefined;
1419
+ minLength?: number | undefined;
1420
+ maxLength?: number | undefined;
1421
+ maxItems?: number | undefined;
1422
+ } | undefined;
1423
+ description?: string | undefined;
1424
+ defaultValue?: string | number | string[] | undefined;
1425
+ }[];
1426
+ } | undefined;
1427
+ stepId?: string | undefined;
1428
+ briefId?: string | undefined;
1429
+ workerExecutionId?: string | undefined;
1430
+ lastErrorCode?: string | undefined;
1431
+ resolvedAt?: string | undefined;
1432
+ } | undefined;
1433
+ }, {
1434
+ conversationId: string;
1435
+ stateUpdatedAt: string;
1436
+ phase: "running" | "completed" | "failed" | "stopped" | "waiting_user_input" | "idle" | "waiting_async";
1437
+ error?: {
1438
+ code: string;
1439
+ message: string;
1440
+ } | undefined;
1441
+ runId?: string | undefined;
1442
+ triggerUserMessageId?: string | undefined;
1443
+ assistantMessage?: {
1444
+ content: string;
1445
+ createdAt: string;
1446
+ role: "assistant";
1447
+ messageId: string;
1448
+ } | undefined;
1449
+ humanInteraction?: {
1450
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1451
+ version: number;
1452
+ interactionId: string;
1453
+ question: string;
1454
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1455
+ requestKey: string;
1456
+ agentRunId: string;
1457
+ intent: "ask" | "decide";
1458
+ answerChannel: "chat" | "workitem" | "both";
1459
+ reasonCode: string;
1460
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1461
+ canAnswer: boolean;
1462
+ canCancel: boolean;
1463
+ responseSchema?: {
1464
+ version: number;
1465
+ submitLabel: string;
1466
+ fields: {
1467
+ label: string;
1468
+ required: boolean;
1469
+ key: string;
1470
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1471
+ options?: {
1472
+ value: string;
1473
+ label: string;
1474
+ description?: string | undefined;
1475
+ }[] | undefined;
1476
+ validation?: {
1477
+ min?: number | undefined;
1478
+ max?: number | undefined;
1479
+ minLength?: number | undefined;
1480
+ maxLength?: number | undefined;
1481
+ maxItems?: number | undefined;
1482
+ } | undefined;
1483
+ description?: string | undefined;
1484
+ defaultValue?: string | number | string[] | undefined;
1485
+ }[];
1486
+ } | undefined;
1487
+ stepId?: string | undefined;
1488
+ briefId?: string | undefined;
1489
+ workerExecutionId?: string | undefined;
1490
+ lastErrorCode?: string | undefined;
1491
+ resolvedAt?: string | undefined;
1492
+ } | undefined;
1493
+ }>, "many">;
1494
+ resultStatus: z.ZodEnum<["ok", "degraded", "inconsistent"]>;
1495
+ }, "strip", z.ZodTypeAny, {
1496
+ type: "connection:sync_result";
1497
+ schemaVersion: 1;
1498
+ connectionGeneration: number;
1499
+ snapshots: {
1500
+ conversationId: string;
1501
+ stateUpdatedAt: string;
1502
+ phase: "running" | "completed" | "failed" | "stopped" | "waiting_user_input" | "idle" | "waiting_async";
1503
+ error?: {
1504
+ code: string;
1505
+ message: string;
1506
+ } | undefined;
1507
+ runId?: string | undefined;
1508
+ triggerUserMessageId?: string | undefined;
1509
+ assistantMessage?: {
1510
+ content: string;
1511
+ createdAt: string;
1512
+ role: "assistant";
1513
+ messageId: string;
1514
+ } | undefined;
1515
+ humanInteraction?: {
1516
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1517
+ version: number;
1518
+ interactionId: string;
1519
+ question: string;
1520
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1521
+ requestKey: string;
1522
+ agentRunId: string;
1523
+ intent: "ask" | "decide";
1524
+ answerChannel: "chat" | "workitem" | "both";
1525
+ reasonCode: string;
1526
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1527
+ canAnswer: boolean;
1528
+ canCancel: boolean;
1529
+ responseSchema?: {
1530
+ version: number;
1531
+ submitLabel: string;
1532
+ fields: {
1533
+ label: string;
1534
+ required: boolean;
1535
+ key: string;
1536
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1537
+ options?: {
1538
+ value: string;
1539
+ label: string;
1540
+ description?: string | undefined;
1541
+ }[] | undefined;
1542
+ validation?: {
1543
+ min?: number | undefined;
1544
+ max?: number | undefined;
1545
+ minLength?: number | undefined;
1546
+ maxLength?: number | undefined;
1547
+ maxItems?: number | undefined;
1548
+ } | undefined;
1549
+ description?: string | undefined;
1550
+ defaultValue?: string | number | string[] | undefined;
1551
+ }[];
1552
+ } | undefined;
1553
+ stepId?: string | undefined;
1554
+ briefId?: string | undefined;
1555
+ workerExecutionId?: string | undefined;
1556
+ lastErrorCode?: string | undefined;
1557
+ resolvedAt?: string | undefined;
1558
+ } | undefined;
1559
+ }[];
1560
+ resultStatus: "ok" | "degraded" | "inconsistent";
1561
+ }, {
1562
+ type: "connection:sync_result";
1563
+ schemaVersion: 1;
1564
+ connectionGeneration: number;
1565
+ snapshots: {
1566
+ conversationId: string;
1567
+ stateUpdatedAt: string;
1568
+ phase: "running" | "completed" | "failed" | "stopped" | "waiting_user_input" | "idle" | "waiting_async";
1569
+ error?: {
1570
+ code: string;
1571
+ message: string;
1572
+ } | undefined;
1573
+ runId?: string | undefined;
1574
+ triggerUserMessageId?: string | undefined;
1575
+ assistantMessage?: {
1576
+ content: string;
1577
+ createdAt: string;
1578
+ role: "assistant";
1579
+ messageId: string;
1580
+ } | undefined;
1581
+ humanInteraction?: {
1582
+ status: "rejected" | "answered" | "expired" | "cancelled" | "open" | "resolving" | "approved" | "delivery_failed";
1583
+ version: number;
1584
+ interactionId: string;
1585
+ question: string;
1586
+ kind: "clarification" | "approval" | "risk_confirmation" | "credential_request" | "acceptance";
1587
+ requestKey: string;
1588
+ agentRunId: string;
1589
+ intent: "ask" | "decide";
1590
+ answerChannel: "chat" | "workitem" | "both";
1591
+ reasonCode: string;
1592
+ allowedActions: ("cancel" | "submit_form" | "approve" | "reject" | "credential_ready")[];
1593
+ canAnswer: boolean;
1594
+ canCancel: boolean;
1595
+ responseSchema?: {
1596
+ version: number;
1597
+ submitLabel: string;
1598
+ fields: {
1599
+ label: string;
1600
+ required: boolean;
1601
+ key: string;
1602
+ control: "number" | "text" | "select" | "textarea" | "multi_select";
1603
+ options?: {
1604
+ value: string;
1605
+ label: string;
1606
+ description?: string | undefined;
1607
+ }[] | undefined;
1608
+ validation?: {
1609
+ min?: number | undefined;
1610
+ max?: number | undefined;
1611
+ minLength?: number | undefined;
1612
+ maxLength?: number | undefined;
1613
+ maxItems?: number | undefined;
1614
+ } | undefined;
1615
+ description?: string | undefined;
1616
+ defaultValue?: string | number | string[] | undefined;
1617
+ }[];
1618
+ } | undefined;
1619
+ stepId?: string | undefined;
1620
+ briefId?: string | undefined;
1621
+ workerExecutionId?: string | undefined;
1622
+ lastErrorCode?: string | undefined;
1623
+ resolvedAt?: string | undefined;
1624
+ } | undefined;
1625
+ }[];
1626
+ resultStatus: "ok" | "degraded" | "inconsistent";
1627
+ }>;
1628
+ export declare const ConversationStateStreamPayloadSchema: z.ZodObject<{
1629
+ mode: z.ZodEnum<["interactive", "coordinator", "cdw", "react"]>;
1630
+ pipelineStatus: z.ZodOptional<z.ZodEnum<["running", "completed", "failed", "waiting_user_input", "waiting_async"]>>;
1631
+ triggerUserMessageId: z.ZodOptional<z.ZodString>;
1632
+ }, "strip", z.ZodTypeAny, {
1633
+ mode: "interactive" | "coordinator" | "cdw" | "react";
1634
+ triggerUserMessageId?: string | undefined;
1635
+ pipelineStatus?: "running" | "completed" | "failed" | "waiting_user_input" | "waiting_async" | undefined;
1636
+ }, {
1637
+ mode: "interactive" | "coordinator" | "cdw" | "react";
1638
+ triggerUserMessageId?: string | undefined;
1639
+ pipelineStatus?: "running" | "completed" | "failed" | "waiting_user_input" | "waiting_async" | undefined;
1640
+ }>;
1641
+ export declare function parseConnectionSyncV1(raw: unknown): ConnectionSyncV1 | null;
1642
+ export declare function isConversationTurnTerminal(raw: unknown): raw is ConversationTurnTerminalV1;
1643
+ export declare function isConnectionSyncResult(raw: unknown): raw is ConnectionSyncResultV1;
1644
+ export type ConversationTurnTerminalStatus = z.infer<typeof ConversationTurnTerminalStatusSchema>;
1645
+ export type ConversationRuntimePhase = z.infer<typeof ConversationRuntimePhaseSchema>;
1646
+ export type ConnectionStatus = z.infer<typeof ConnectionStatusSchema>;
1647
+ export type ConversationTerminalMessage = z.infer<typeof ConversationTerminalMessageSchema>;
1648
+ export type ConversationHumanInteractionProjection = z.infer<typeof ConversationHumanInteractionProjectionSchema>;
1649
+ export type TerminalErrorStructure = z.infer<typeof TerminalErrorStructureSchema>;
1650
+ export type ConversationTurnTerminalV1 = z.infer<typeof ConversationTurnTerminalV1Schema>;
1651
+ export type ConnectionSyncConversationEntry = z.infer<typeof ConnectionSyncConversationEntrySchema>;
1652
+ export type ConnectionSyncV1 = z.infer<typeof ConnectionSyncV1Schema>;
1653
+ export type ConversationRuntimeSnapshot = z.infer<typeof ConversationRuntimeSnapshotSchema>;
1654
+ export type ConnectionSyncResultV1 = z.infer<typeof ConnectionSyncResultV1Schema>;
1655
+ export type ConversationStateStreamPayload = z.infer<typeof ConversationStateStreamPayloadSchema>;
1656
+ //# sourceMappingURL=conversationTerminal.d.ts.map