@collective-intelligence/external-apps-client-sdk 0.3.5 → 0.3.8

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,2847 @@
1
+ import * as Schema from "effect/Schema";
2
+ import * as Config from "effect/Config";
3
+ import * as Context from "effect/Context";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Layer from "effect/Layer";
6
+ import * as Stream from "effect/Stream";
7
+ import "effect/ManagedRuntime";
8
+ type ExternalAppChatConversationsListData = {
9
+ body?: never;
10
+ headers: {
11
+ authorization?: string;
12
+ 'x-organization-id': string;
13
+ };
14
+ path?: never;
15
+ query?: {
16
+ historyScope?: Array<string>;
17
+ };
18
+ url: '/application/v1/chat/conversations';
19
+ };
20
+ type ExternalAppChatConversationsListResponses = {
21
+ /**
22
+ * Success
23
+ */
24
+ 200: {
25
+ data: Array<{
26
+ agentId: string | null;
27
+ createdAt: string | null;
28
+ id: string;
29
+ lastActivityAt: string | null;
30
+ lastActivityInvocationId: string | null;
31
+ memoryEnabled: boolean;
32
+ organizationId: string;
33
+ projectId: string | null;
34
+ title: string;
35
+ updatedAt: string | null;
36
+ userId: string;
37
+ origin: {
38
+ id: string;
39
+ kind: 'studio_app' | 'external_app';
40
+ };
41
+ }>;
42
+ };
43
+ };
44
+ type ExternalAppChatConversationsListResponse = ExternalAppChatConversationsListResponses[keyof ExternalAppChatConversationsListResponses];
45
+ type ExternalAppChatConversationsCreateData = {
46
+ body: {
47
+ agentId?: string;
48
+ projectId?: string;
49
+ title?: string;
50
+ };
51
+ headers: {
52
+ authorization?: string;
53
+ 'x-organization-id': string;
54
+ };
55
+ path?: never;
56
+ query?: never;
57
+ url: '/application/v1/chat/conversations';
58
+ };
59
+ type ExternalAppChatConversationsCreateResponses = {
60
+ /**
61
+ * Success
62
+ */
63
+ 201: {
64
+ agentId: string | null;
65
+ createdAt: string | null;
66
+ id: string;
67
+ lastActivityAt: string | null;
68
+ lastActivityInvocationId: string | null;
69
+ memoryEnabled: boolean;
70
+ organizationId: string;
71
+ projectId: string | null;
72
+ title: string;
73
+ updatedAt: string | null;
74
+ userId: string;
75
+ origin: {
76
+ id: string;
77
+ kind: 'studio_app' | 'external_app';
78
+ };
79
+ };
80
+ };
81
+ type ExternalAppChatConversationsCreateResponse = ExternalAppChatConversationsCreateResponses[keyof ExternalAppChatConversationsCreateResponses];
82
+ type ExternalAppChatConversationsDeleteData = {
83
+ body?: never;
84
+ headers: {
85
+ authorization?: string;
86
+ 'x-organization-id': string;
87
+ };
88
+ path: {
89
+ conversationId: string;
90
+ };
91
+ query?: never;
92
+ url: '/application/v1/chat/conversations/{conversationId}';
93
+ };
94
+ type ExternalAppChatConversationsDeleteResponses = {
95
+ /**
96
+ * <No Content>
97
+ */
98
+ 204: void;
99
+ };
100
+ type ExternalAppChatConversationsDeleteResponse = ExternalAppChatConversationsDeleteResponses[keyof ExternalAppChatConversationsDeleteResponses];
101
+ type ExternalAppChatConversationsGetData = {
102
+ body?: never;
103
+ headers: {
104
+ authorization?: string;
105
+ 'x-organization-id': string;
106
+ };
107
+ path: {
108
+ conversationId: string;
109
+ };
110
+ query?: never;
111
+ url: '/application/v1/chat/conversations/{conversationId}';
112
+ };
113
+ type ExternalAppChatConversationsGetResponses = {
114
+ /**
115
+ * Success
116
+ */
117
+ 200: {
118
+ agentId: string | null;
119
+ createdAt: string | null;
120
+ id: string;
121
+ lastActivityAt: string | null;
122
+ lastActivityInvocationId: string | null;
123
+ memoryEnabled: boolean;
124
+ organizationId: string;
125
+ projectId: string | null;
126
+ title: string;
127
+ updatedAt: string | null;
128
+ userId: string;
129
+ origin: {
130
+ id: string;
131
+ kind: 'studio_app' | 'external_app';
132
+ };
133
+ };
134
+ };
135
+ type ExternalAppChatConversationsGetResponse = ExternalAppChatConversationsGetResponses[keyof ExternalAppChatConversationsGetResponses];
136
+ type ExternalAppChatConversationsUpdateData = {
137
+ body: {
138
+ memoryEnabled?: boolean;
139
+ projectId?: string | null;
140
+ title?: string;
141
+ };
142
+ headers: {
143
+ authorization?: string;
144
+ 'x-organization-id': string;
145
+ };
146
+ path: {
147
+ conversationId: string;
148
+ };
149
+ query?: never;
150
+ url: '/application/v1/chat/conversations/{conversationId}';
151
+ };
152
+ type ExternalAppChatConversationsUpdateResponses = {
153
+ /**
154
+ * Success
155
+ */
156
+ 200: {
157
+ agentId: string | null;
158
+ createdAt: string | null;
159
+ id: string;
160
+ lastActivityAt: string | null;
161
+ lastActivityInvocationId: string | null;
162
+ memoryEnabled: boolean;
163
+ organizationId: string;
164
+ projectId: string | null;
165
+ title: string;
166
+ updatedAt: string | null;
167
+ userId: string;
168
+ origin: {
169
+ id: string;
170
+ kind: 'studio_app' | 'external_app';
171
+ };
172
+ };
173
+ };
174
+ type ExternalAppChatConversationsUpdateResponse = ExternalAppChatConversationsUpdateResponses[keyof ExternalAppChatConversationsUpdateResponses];
175
+ type ExternalAppChatChatTurnData = {
176
+ body: {
177
+ attachmentIds?: Array<string>;
178
+ clientTurnId?: string;
179
+ conversationId?: string;
180
+ directTool?: {
181
+ handle: string;
182
+ input: {
183
+ [key: string]: unknown;
184
+ };
185
+ };
186
+ message: string;
187
+ selectedCapabilities?: Array<{
188
+ id: string;
189
+ kind: 'skill' | 'tool';
190
+ }>;
191
+ selectedReportRunId?: string;
192
+ };
193
+ headers: {
194
+ authorization?: string;
195
+ 'x-organization-id': string;
196
+ };
197
+ path?: never;
198
+ query?: never;
199
+ url: '/application/v1/chat/chat/turns';
200
+ };
201
+ type ExternalAppChatChatTurnResponses = {
202
+ /**
203
+ * Success
204
+ */
205
+ 200: {
206
+ conversationId: string;
207
+ invocationId: string;
208
+ output: string;
209
+ status: 'cancelled' | 'completed' | 'error' | 'running' | 'waiting_for_approval';
210
+ } | {
211
+ conversationId: string;
212
+ outcome: 'queued';
213
+ queuedMessageId: string;
214
+ revision: number;
215
+ };
216
+ };
217
+ type ExternalAppChatChatTurnResponse = ExternalAppChatChatTurnResponses[keyof ExternalAppChatChatTurnResponses];
218
+ type ExternalAppChatChatStreamData = {
219
+ body: {
220
+ attachmentIds?: Array<string>;
221
+ clientTurnId?: string;
222
+ conversationId?: string;
223
+ directTool?: {
224
+ handle: string;
225
+ input: {
226
+ [key: string]: unknown;
227
+ };
228
+ };
229
+ message: string;
230
+ selectedCapabilities?: Array<{
231
+ id: string;
232
+ kind: 'skill' | 'tool';
233
+ }>;
234
+ selectedReportRunId?: string;
235
+ };
236
+ headers: {
237
+ authorization?: string;
238
+ 'x-organization-id': string;
239
+ };
240
+ path?: never;
241
+ query?: never;
242
+ url: '/application/v1/chat/chat/stream';
243
+ };
244
+ type ExternalAppChatChatStreamResponses = {
245
+ /**
246
+ * Success
247
+ */
248
+ 200: {
249
+ data: string;
250
+ event: 'turn_result';
251
+ id?: string;
252
+ } | {
253
+ data: string;
254
+ event: 'approval_result';
255
+ id?: string;
256
+ } | {
257
+ data: string;
258
+ event: 'error';
259
+ id?: string;
260
+ };
261
+ };
262
+ type ExternalAppChatChatStreamResponse = ExternalAppChatChatStreamResponses[keyof ExternalAppChatChatStreamResponses];
263
+ type ExternalAppChatChatCancelTurnData = {
264
+ body?: never;
265
+ headers: {
266
+ authorization?: string;
267
+ 'x-organization-id': string;
268
+ };
269
+ path: {
270
+ invocationId: string;
271
+ };
272
+ query?: never;
273
+ url: '/application/v1/chat/chat/turns/{invocationId}/cancel';
274
+ };
275
+ type ExternalAppChatChatCancelTurnResponses = {
276
+ /**
277
+ * Success
278
+ */
279
+ 200: {
280
+ invocationId: string;
281
+ status: 'cancelled' | 'completed' | 'error' | 'running' | 'waiting_for_approval';
282
+ };
283
+ };
284
+ type ExternalAppChatChatCancelTurnResponse = ExternalAppChatChatCancelTurnResponses[keyof ExternalAppChatChatCancelTurnResponses];
285
+ type ExternalAppChatChatSendSteeringMessageData = {
286
+ body: {
287
+ clientMessageId: string;
288
+ content: string;
289
+ invocationId: string;
290
+ };
291
+ headers: {
292
+ authorization?: string;
293
+ 'x-organization-id': string;
294
+ };
295
+ path: {
296
+ conversationId: string;
297
+ };
298
+ query?: never;
299
+ url: '/application/v1/chat/chat/conversations/{conversationId}/steering-messages';
300
+ };
301
+ type ExternalAppChatChatSendSteeringMessageResponses = {
302
+ /**
303
+ * Success
304
+ */
305
+ 200: {
306
+ conversationId: string;
307
+ invocationId: string;
308
+ outcome: 'started';
309
+ status: 'cancelled' | 'completed' | 'error' | 'running' | 'waiting_for_approval';
310
+ } | {
311
+ conversationId: string;
312
+ invocationId: string;
313
+ outcome: 'steered';
314
+ status: 'cancelled' | 'completed' | 'error' | 'running' | 'waiting_for_approval';
315
+ steeringMessageId: string;
316
+ } | {
317
+ conversationId: string;
318
+ outcome: 'queued';
319
+ queuedMessageId: string;
320
+ revision: number;
321
+ };
322
+ };
323
+ type ExternalAppChatChatSendSteeringMessageResponse = ExternalAppChatChatSendSteeringMessageResponses[keyof ExternalAppChatChatSendSteeringMessageResponses];
324
+ type ExternalAppChatChatListQueuedMessagesData = {
325
+ body?: never;
326
+ headers: {
327
+ authorization?: string;
328
+ 'x-organization-id': string;
329
+ };
330
+ path: {
331
+ conversationId: string;
332
+ };
333
+ query?: never;
334
+ url: '/application/v1/chat/chat/conversations/{conversationId}/queued-messages';
335
+ };
336
+ type ExternalAppChatChatListQueuedMessagesResponses = {
337
+ /**
338
+ * Success
339
+ */
340
+ 200: {
341
+ data: Array<{
342
+ content: string;
343
+ createdAt: string;
344
+ id: string;
345
+ invocationId: string | null;
346
+ position: number;
347
+ revision: number;
348
+ status: 'waiting' | 'claimed' | 'removed';
349
+ }>;
350
+ };
351
+ };
352
+ type ExternalAppChatChatListQueuedMessagesResponse = ExternalAppChatChatListQueuedMessagesResponses[keyof ExternalAppChatChatListQueuedMessagesResponses];
353
+ type ExternalAppChatChatQueueMessageData = {
354
+ body: {
355
+ clientMessageId: string;
356
+ content: string;
357
+ };
358
+ headers: {
359
+ authorization?: string;
360
+ 'x-organization-id': string;
361
+ };
362
+ path: {
363
+ conversationId: string;
364
+ };
365
+ query?: never;
366
+ url: '/application/v1/chat/chat/conversations/{conversationId}/queued-messages';
367
+ };
368
+ type ExternalAppChatChatQueueMessageResponses = {
369
+ /**
370
+ * Success
371
+ */
372
+ 200: {
373
+ conversationId: string;
374
+ outcome: 'queued';
375
+ queuedMessage: {
376
+ content: string;
377
+ createdAt: string;
378
+ id: string;
379
+ invocationId: string | null;
380
+ position: number;
381
+ revision: number;
382
+ status: 'waiting' | 'claimed' | 'removed';
383
+ };
384
+ } | {
385
+ conversationId: string;
386
+ invocationId?: string;
387
+ outcome: 'started';
388
+ queuedMessageId?: string;
389
+ } | {
390
+ conversationId: string;
391
+ invocationId: string;
392
+ outcome: 'steered';
393
+ steeringMessageId: string;
394
+ };
395
+ };
396
+ type ExternalAppChatChatQueueMessageResponse = ExternalAppChatChatQueueMessageResponses[keyof ExternalAppChatChatQueueMessageResponses];
397
+ type ExternalAppChatChatRemoveQueuedMessageData = {
398
+ body?: never;
399
+ headers: {
400
+ authorization?: string;
401
+ 'x-organization-id': string;
402
+ };
403
+ path: {
404
+ conversationId: string;
405
+ queuedMessageId: string;
406
+ };
407
+ query: {
408
+ revision: string;
409
+ };
410
+ url: '/application/v1/chat/chat/conversations/{conversationId}/queued-messages/{queuedMessageId}';
411
+ };
412
+ type ExternalAppChatChatRemoveQueuedMessageResponses = {
413
+ /**
414
+ * <No Content>
415
+ */
416
+ 204: void;
417
+ };
418
+ type ExternalAppChatChatRemoveQueuedMessageResponse = ExternalAppChatChatRemoveQueuedMessageResponses[keyof ExternalAppChatChatRemoveQueuedMessageResponses];
419
+ type ExternalAppChatChatUpdateQueuedMessageData = {
420
+ body: {
421
+ content: string;
422
+ revision: number;
423
+ };
424
+ headers: {
425
+ authorization?: string;
426
+ 'x-organization-id': string;
427
+ };
428
+ path: {
429
+ conversationId: string;
430
+ queuedMessageId: string;
431
+ };
432
+ query?: never;
433
+ url: '/application/v1/chat/chat/conversations/{conversationId}/queued-messages/{queuedMessageId}';
434
+ };
435
+ type ExternalAppChatChatUpdateQueuedMessageResponses = {
436
+ /**
437
+ * Success
438
+ */
439
+ 200: {
440
+ content: string;
441
+ createdAt: string;
442
+ id: string;
443
+ invocationId: string | null;
444
+ position: number;
445
+ revision: number;
446
+ status: 'waiting' | 'claimed' | 'removed';
447
+ };
448
+ };
449
+ type ExternalAppChatChatUpdateQueuedMessageResponse = ExternalAppChatChatUpdateQueuedMessageResponses[keyof ExternalAppChatChatUpdateQueuedMessageResponses];
450
+ type ExternalAppChatChatPlaceContextData = {
451
+ body?: never;
452
+ headers: {
453
+ authorization?: string;
454
+ 'x-organization-id': string;
455
+ };
456
+ path?: never;
457
+ query?: never;
458
+ url: '/application/v1/chat/chat/place-context';
459
+ };
460
+ type ExternalAppChatChatPlaceContextResponses = {
461
+ /**
462
+ * Success
463
+ */
464
+ 200: {
465
+ places: Array<{
466
+ id: string;
467
+ kind: 'studio_app' | 'external_app';
468
+ name: string | null;
469
+ }>;
470
+ readAloud: boolean;
471
+ voiceInputMode?: 'local' | 'remote';
472
+ };
473
+ };
474
+ type ExternalAppChatChatPlaceContextResponse = ExternalAppChatChatPlaceContextResponses[keyof ExternalAppChatChatPlaceContextResponses];
475
+ type ExternalAppChatExecutionPresentationGetData = {
476
+ body?: never;
477
+ headers: {
478
+ authorization?: string;
479
+ 'x-organization-id': string;
480
+ 'last-event-id'?: string;
481
+ };
482
+ path: {
483
+ invocationId: string;
484
+ };
485
+ query?: {
486
+ afterSequence?: string;
487
+ };
488
+ url: '/application/v1/chat/executions/{invocationId}/presentation';
489
+ };
490
+ type ExternalAppChatExecutionPresentationGetResponses = {
491
+ /**
492
+ * Success
493
+ */
494
+ 200: {
495
+ changed: boolean;
496
+ latestSequence: number;
497
+ presentation: {
498
+ finalOutputIdentity: string | null;
499
+ sequence: number;
500
+ state: 'closed';
501
+ } | {
502
+ additionalWaitingCount: number;
503
+ attempt: number;
504
+ invocationId: string;
505
+ requestId: string | null;
506
+ sequence: number;
507
+ state: 'actionable';
508
+ waitKind: 'approval' | 'input' | 'permission';
509
+ workGroupId: string | null;
510
+ workItemId: string | null;
511
+ } | {
512
+ completedCount: number | null;
513
+ expectedCount: number | null;
514
+ failedCount: number | null;
515
+ messageKey: string | null;
516
+ phase: string | null;
517
+ safeParameters: {
518
+ [key: string]: string | number | boolean | null;
519
+ };
520
+ sequence: number;
521
+ state: 'progress';
522
+ succeededCount: number | null;
523
+ waitingCount: number | null;
524
+ } | {
525
+ outcome: string;
526
+ sequence: number;
527
+ state: 'output_pending';
528
+ };
529
+ rootInvocationId: string;
530
+ };
531
+ };
532
+ type ExternalAppChatExecutionPresentationGetResponse = ExternalAppChatExecutionPresentationGetResponses[keyof ExternalAppChatExecutionPresentationGetResponses];
533
+ type ExternalAppChatExecutionPresentationStreamData = {
534
+ body?: never;
535
+ headers: {
536
+ authorization?: string;
537
+ 'x-organization-id': string;
538
+ 'last-event-id'?: string;
539
+ };
540
+ path: {
541
+ invocationId: string;
542
+ };
543
+ query?: {
544
+ afterSequence?: string;
545
+ };
546
+ url: '/application/v1/chat/executions/{invocationId}/presentation/stream';
547
+ };
548
+ type ExternalAppChatExecutionPresentationStreamResponses = {
549
+ /**
550
+ * Success
551
+ */
552
+ 200: {
553
+ data: string;
554
+ event: 'presentation';
555
+ id?: string;
556
+ };
557
+ };
558
+ type ExternalAppChatExecutionPresentationStreamResponse = ExternalAppChatExecutionPresentationStreamResponses[keyof ExternalAppChatExecutionPresentationStreamResponses];
559
+ type ExternalAppChatConversationTranscriptGetData = {
560
+ body?: never;
561
+ headers: {
562
+ authorization?: string;
563
+ 'x-organization-id': string;
564
+ };
565
+ path: {
566
+ conversationId: string;
567
+ };
568
+ query?: never;
569
+ url: '/application/v1/chat/conversations/{conversationId}/transcript';
570
+ };
571
+ type ExternalAppChatConversationTranscriptGetResponses = {
572
+ /**
573
+ * Success
574
+ */
575
+ 200: {
576
+ agentTurns: Array<{
577
+ completedAt: string | null;
578
+ createdAt: string;
579
+ input: string;
580
+ message: string | null;
581
+ sequence: number;
582
+ status: 'pending' | 'completed' | 'failed' | 'cancelled';
583
+ turnId: string;
584
+ }>;
585
+ conversation: {
586
+ agent: {
587
+ displayName: string;
588
+ id: string;
589
+ } | null;
590
+ compaction: {
591
+ active: boolean;
592
+ activeSummary: {
593
+ id: string;
594
+ status: string;
595
+ summary: string;
596
+ trigger: string;
597
+ } | null;
598
+ boundary: {
599
+ compactedThroughInvocationId: string | null;
600
+ coveredInvocationCount: number;
601
+ coveredMessageCount: number;
602
+ } | null;
603
+ };
604
+ contextUsage: {
605
+ estimatedCharacters: number;
606
+ fillRatio: number;
607
+ thresholdCharacters: number;
608
+ };
609
+ id: string;
610
+ title: string;
611
+ };
612
+ messages: Array<{
613
+ approvalRequestId: string | null;
614
+ attachments: Array<{
615
+ characterCount: number;
616
+ contentType: string | null;
617
+ extension: string | null;
618
+ extractionStatus: string;
619
+ filename: string;
620
+ id: string;
621
+ mediaUrl: string | null;
622
+ sizeBytes: number;
623
+ truncated: boolean;
624
+ unavailableReason: string | null;
625
+ }>;
626
+ content: string;
627
+ conversationId: string;
628
+ currentUserFeedback?: {
629
+ sentiment: 'positive' | 'negative' | null;
630
+ submitterNote: string | null;
631
+ };
632
+ feedbackTargetId?: string;
633
+ invocationId: string;
634
+ processingEvents: Array<{
635
+ data: {
636
+ [key: string]: unknown;
637
+ };
638
+ event: string;
639
+ }>;
640
+ role: 'assistant' | 'user';
641
+ run?: {
642
+ approvalRequestId: string | null;
643
+ conversationId: string;
644
+ durationMs: number;
645
+ inputTokens: number;
646
+ invocationId: string;
647
+ memoryEvidence: {
648
+ events: Array<{
649
+ category: string | null;
650
+ conversationId: string | null;
651
+ invocationId: string | null;
652
+ kind: string;
653
+ lifecycleStatus: string | null;
654
+ memoryId: string | null;
655
+ reason: string | null;
656
+ scope: string | null;
657
+ }>;
658
+ } | null;
659
+ model: string | null;
660
+ output: string;
661
+ outputTokens: number;
662
+ permissionWait: {
663
+ capabilityKind: 'skill' | 'tool';
664
+ invocationId: string;
665
+ subjectId: string;
666
+ } | null;
667
+ processingEvents: Array<{
668
+ data: {
669
+ [key: string]: unknown;
670
+ };
671
+ event: string;
672
+ }>;
673
+ skillOutcome: string | null;
674
+ status: string;
675
+ toolTrace: Array<{
676
+ displayName: string | null;
677
+ displayParts: Array<{
678
+ data: unknown;
679
+ description: string | null;
680
+ metadata: {
681
+ [key: string]: unknown;
682
+ };
683
+ title: string | null;
684
+ type: string;
685
+ }>;
686
+ durationMs: number | null;
687
+ error: string | null;
688
+ fqn: string | null;
689
+ toolId: string | null;
690
+ }>;
691
+ userInteraction: {
692
+ allowFreeText: boolean;
693
+ id: string;
694
+ kind: 'approval' | 'question';
695
+ mode: 'open' | 'single_choice' | null;
696
+ operation: {
697
+ displayName: string;
698
+ kind: 'tool';
699
+ toolFqn: string;
700
+ toolId: string;
701
+ } | null;
702
+ options: Array<{
703
+ description: string | null;
704
+ id: string;
705
+ label: string;
706
+ }>;
707
+ preview: string | null;
708
+ prompt: string;
709
+ safePreview: string | null;
710
+ status: 'pending' | 'responding' | 'completed' | 'cancelled' | 'failed';
711
+ summary: string | null;
712
+ } | null;
713
+ };
714
+ status: string;
715
+ toolDisplay: {
716
+ kind: 'text';
717
+ text: string;
718
+ } | {
719
+ kind: 'unavailable';
720
+ };
721
+ }>;
722
+ steeringMessages: Array<{
723
+ attachments: Array<{
724
+ characterCount: number;
725
+ contentType: string | null;
726
+ extension: string | null;
727
+ extractionStatus: string;
728
+ filename: string;
729
+ id: string;
730
+ mediaUrl: string | null;
731
+ sizeBytes: number;
732
+ truncated: boolean;
733
+ unavailableReason: string | null;
734
+ }>;
735
+ claimedAt: string | null;
736
+ content: string;
737
+ id: string;
738
+ invocationId: string;
739
+ }>;
740
+ };
741
+ };
742
+ type ExternalAppChatConversationTranscriptGetResponse = ExternalAppChatConversationTranscriptGetResponses[keyof ExternalAppChatConversationTranscriptGetResponses];
743
+ type ExternalAppChatAgentsListData = {
744
+ body?: never;
745
+ headers: {
746
+ authorization?: string;
747
+ 'x-organization-id': string;
748
+ };
749
+ path?: never;
750
+ query?: never;
751
+ url: '/application/v1/chat/agents';
752
+ };
753
+ type ExternalAppChatAgentsListResponses = {
754
+ /**
755
+ * Success
756
+ */
757
+ 200: {
758
+ data: Array<{
759
+ agentType: 'organization' | 'personal';
760
+ degraded: boolean;
761
+ displayName: string;
762
+ id: string;
763
+ paused: boolean;
764
+ responsibility: string;
765
+ }>;
766
+ };
767
+ };
768
+ type ExternalAppChatAgentsListResponse = ExternalAppChatAgentsListResponses[keyof ExternalAppChatAgentsListResponses];
769
+ type ExternalAppChatSkillsListData = {
770
+ body?: never;
771
+ headers: {
772
+ authorization?: string;
773
+ 'x-organization-id': string;
774
+ };
775
+ path?: never;
776
+ query?: never;
777
+ url: '/application/v1/chat/skills';
778
+ };
779
+ type ExternalAppChatSkillsListResponses = {
780
+ /**
781
+ * Success
782
+ */
783
+ 200: {
784
+ data: Array<{
785
+ dataAccess: {
786
+ datasets?: 'user' | 'skill';
787
+ documents?: 'user' | 'skill';
788
+ knowledge?: 'user' | 'skill';
789
+ } | null;
790
+ description: string | null;
791
+ fqn: string;
792
+ id: string;
793
+ name: string;
794
+ slug: string;
795
+ }>;
796
+ };
797
+ };
798
+ type ExternalAppChatSkillsListResponse = ExternalAppChatSkillsListResponses[keyof ExternalAppChatSkillsListResponses];
799
+ type ExternalAppChatToolsListData = {
800
+ body?: never;
801
+ headers: {
802
+ authorization?: string;
803
+ 'x-organization-id': string;
804
+ };
805
+ path?: never;
806
+ query?: {
807
+ conversationId?: string;
808
+ usageScope?: 'chat' | 'skill' | 'automation';
809
+ };
810
+ url: '/application/v1/chat/tools';
811
+ };
812
+ type ExternalAppChatToolsListResponses = {
813
+ /**
814
+ * Success
815
+ */
816
+ 200: {
817
+ data: Array<{
818
+ collectionId: string | null;
819
+ description: string;
820
+ displayName: string;
821
+ fqn: string;
822
+ id: string;
823
+ inputSchema: {
824
+ [key: string]: unknown;
825
+ };
826
+ }>;
827
+ };
828
+ };
829
+ type ExternalAppChatToolsListResponse = ExternalAppChatToolsListResponses[keyof ExternalAppChatToolsListResponses];
830
+ type ExternalAppChatAgentConversationsSubmitTurnData = {
831
+ body: {
832
+ idempotencyKey: string;
833
+ message: string;
834
+ };
835
+ headers: {
836
+ authorization?: string;
837
+ 'x-organization-id': string;
838
+ };
839
+ path: {
840
+ conversationId: string;
841
+ };
842
+ query?: never;
843
+ url: '/application/v1/chat/conversations/{conversationId}/agent-turns';
844
+ };
845
+ type ExternalAppChatAgentConversationsSubmitTurnResponses = {
846
+ /**
847
+ * Success
848
+ */
849
+ 202: {
850
+ activationId: string;
851
+ activationState: string;
852
+ activityId: string;
853
+ queuedWhilePaused: boolean;
854
+ reason: string | null;
855
+ runId: string;
856
+ runState: string;
857
+ turnId: string;
858
+ };
859
+ };
860
+ type ExternalAppChatAgentConversationsSubmitTurnResponse = ExternalAppChatAgentConversationsSubmitTurnResponses[keyof ExternalAppChatAgentConversationsSubmitTurnResponses];
861
+ type ExternalAppChatAgentConversationsCloseData = {
862
+ body: {
863
+ idempotencyKey: string;
864
+ };
865
+ headers: {
866
+ authorization?: string;
867
+ 'x-organization-id': string;
868
+ };
869
+ path: {
870
+ conversationId: string;
871
+ };
872
+ query?: never;
873
+ url: '/application/v1/chat/conversations/{conversationId}/agent-close';
874
+ };
875
+ type ExternalAppChatAgentConversationsCloseResponses = {
876
+ /**
877
+ * Success
878
+ */
879
+ 202: {
880
+ conversationId: string;
881
+ outcome: 'accepted';
882
+ receiptId: string;
883
+ };
884
+ };
885
+ type ExternalAppChatAgentConversationsCloseResponse = ExternalAppChatAgentConversationsCloseResponses[keyof ExternalAppChatAgentConversationsCloseResponses];
886
+ type ExternalAppChatAgentConversationsCancelTurnData = {
887
+ body: {
888
+ idempotencyKey: string;
889
+ };
890
+ headers: {
891
+ authorization?: string;
892
+ 'x-organization-id': string;
893
+ };
894
+ path: {
895
+ conversationId: string;
896
+ turnId: string;
897
+ };
898
+ query?: never;
899
+ url: '/application/v1/chat/conversations/{conversationId}/agent-turns/{turnId}/cancel';
900
+ };
901
+ type ExternalAppChatAgentConversationsCancelTurnResponses = {
902
+ /**
903
+ * Success
904
+ */
905
+ 202: {
906
+ conversationId: string;
907
+ outcome: 'accepted';
908
+ receiptId: string;
909
+ };
910
+ };
911
+ type ExternalAppChatAgentConversationsCancelTurnResponse = ExternalAppChatAgentConversationsCancelTurnResponses[keyof ExternalAppChatAgentConversationsCancelTurnResponses];
912
+ type ExternalAppChatAttachmentsUploadData = {
913
+ body: {
914
+ files: Array<Blob | File>;
915
+ };
916
+ headers: {
917
+ authorization?: string;
918
+ 'x-organization-id': string;
919
+ };
920
+ path: {
921
+ conversationId: string;
922
+ };
923
+ query?: never;
924
+ url: '/application/v1/chat/conversations/{conversationId}/attachments';
925
+ };
926
+ type ExternalAppChatAttachmentsUploadResponses = {
927
+ /**
928
+ * Success
929
+ */
930
+ 201: {
931
+ attachments: Array<{
932
+ characterCount: number;
933
+ contentType: string | null;
934
+ extension: string | null;
935
+ extractionStatus: string;
936
+ filename: string;
937
+ id: string;
938
+ sizeBytes: number;
939
+ truncated: boolean;
940
+ unavailableReason: string | null;
941
+ }>;
942
+ };
943
+ };
944
+ type ExternalAppChatAttachmentsUploadResponse = ExternalAppChatAttachmentsUploadResponses[keyof ExternalAppChatAttachmentsUploadResponses];
945
+ type ExternalAppChatAttachmentsDownloadUrlData = {
946
+ body?: never;
947
+ headers: {
948
+ authorization?: string;
949
+ 'x-organization-id': string;
950
+ };
951
+ path: {
952
+ attachmentId: string;
953
+ conversationId: string;
954
+ };
955
+ query?: never;
956
+ url: '/application/v1/chat/conversations/{conversationId}/attachments/{attachmentId}/download-url';
957
+ };
958
+ type ExternalAppChatAttachmentsDownloadUrlResponses = {
959
+ /**
960
+ * Success
961
+ */
962
+ 200: {
963
+ expiresIn: number;
964
+ url: string;
965
+ };
966
+ };
967
+ type ExternalAppChatAttachmentsDownloadUrlResponse = ExternalAppChatAttachmentsDownloadUrlResponses[keyof ExternalAppChatAttachmentsDownloadUrlResponses];
968
+ type ExternalAppChatAnswerFeedbackClearData = {
969
+ body?: never;
970
+ headers: {
971
+ authorization?: string;
972
+ 'x-organization-id': string;
973
+ };
974
+ path: {
975
+ invocationId: string;
976
+ };
977
+ query?: never;
978
+ url: '/application/v1/chat/answers/{invocationId}/feedback';
979
+ };
980
+ type ExternalAppChatAnswerFeedbackClearResponses = {
981
+ /**
982
+ * Success
983
+ */
984
+ 200: {
985
+ currentUserFeedback: {
986
+ sentiment: 'positive' | 'negative' | null;
987
+ submitterNote: string | null;
988
+ };
989
+ feedbackTargetId: string;
990
+ };
991
+ };
992
+ type ExternalAppChatAnswerFeedbackClearResponse = ExternalAppChatAnswerFeedbackClearResponses[keyof ExternalAppChatAnswerFeedbackClearResponses];
993
+ type ExternalAppChatAnswerFeedbackUpsertData = {
994
+ body: {
995
+ sentiment: 'positive' | 'negative';
996
+ submitterNote?: string;
997
+ };
998
+ headers: {
999
+ authorization?: string;
1000
+ 'x-organization-id': string;
1001
+ };
1002
+ path: {
1003
+ invocationId: string;
1004
+ };
1005
+ query?: never;
1006
+ url: '/application/v1/chat/answers/{invocationId}/feedback';
1007
+ };
1008
+ type ExternalAppChatAnswerFeedbackUpsertResponses = {
1009
+ /**
1010
+ * Success
1011
+ */
1012
+ 200: {
1013
+ currentUserFeedback: {
1014
+ sentiment: 'positive' | 'negative' | null;
1015
+ submitterNote: string | null;
1016
+ };
1017
+ feedbackTargetId: string;
1018
+ };
1019
+ };
1020
+ type ExternalAppChatAnswerFeedbackUpsertResponse = ExternalAppChatAnswerFeedbackUpsertResponses[keyof ExternalAppChatAnswerFeedbackUpsertResponses];
1021
+ type ExternalAppChatApprovalsSearchRequestsData = {
1022
+ body: {
1023
+ involvement?: 'mine' | 'requester' | 'reviewer';
1024
+ limit?: number;
1025
+ page?: number;
1026
+ status?: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
1027
+ };
1028
+ headers: {
1029
+ authorization?: string;
1030
+ 'x-organization-id': string;
1031
+ };
1032
+ path?: never;
1033
+ query?: never;
1034
+ url: '/application/v1/chat/approvals/requests/search';
1035
+ };
1036
+ type ExternalAppChatApprovalsSearchRequestsResponses = {
1037
+ /**
1038
+ * Success
1039
+ */
1040
+ 200: {
1041
+ data: Array<{
1042
+ approvalRuleId: string | null;
1043
+ approvalRuleName: string | null;
1044
+ createdAt: string | null;
1045
+ decisions: Array<{
1046
+ approverName: string | null;
1047
+ approverUserId: string;
1048
+ comment: string | null;
1049
+ decidedAt: string | null;
1050
+ id: string;
1051
+ status: string;
1052
+ stepIndex: number | null;
1053
+ stepSubjectId: string | null;
1054
+ stepSubjectKind: string | null;
1055
+ }>;
1056
+ description: string | null;
1057
+ expiresAt: string | null;
1058
+ id: string;
1059
+ invocationId: string;
1060
+ myApprovalRequired: boolean;
1061
+ resolvedAt: string | null;
1062
+ ruleSnapshot: {
1063
+ allowInvokerApproval: boolean;
1064
+ expiresInSeconds: number | null;
1065
+ requireAllSteps: boolean;
1066
+ steps: Array<{
1067
+ grantee: {
1068
+ kind: 'organization';
1069
+ } | {
1070
+ kind: 'user';
1071
+ userId: string;
1072
+ } | {
1073
+ coverage: 'direct' | 'inherited';
1074
+ groupId: string;
1075
+ kind: 'group';
1076
+ };
1077
+ requiredApprovals: number;
1078
+ }>;
1079
+ };
1080
+ skillId: string | null;
1081
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
1082
+ subjectId: string | null;
1083
+ subjectType: string;
1084
+ title: string;
1085
+ updatedAt: string | null;
1086
+ userId: string | null;
1087
+ userName: string | null;
1088
+ participation: 'requester' | 'reviewer' | 'both';
1089
+ }>;
1090
+ paging: {
1091
+ page: number;
1092
+ pageSize: number;
1093
+ totalItems: number;
1094
+ totalPages: number;
1095
+ };
1096
+ };
1097
+ };
1098
+ type ExternalAppChatApprovalsSearchRequestsResponse = ExternalAppChatApprovalsSearchRequestsResponses[keyof ExternalAppChatApprovalsSearchRequestsResponses];
1099
+ type ExternalAppChatApprovalsSearchData = {
1100
+ body?: never;
1101
+ headers: {
1102
+ authorization?: string;
1103
+ 'x-organization-id': string;
1104
+ };
1105
+ path?: never;
1106
+ query?: never;
1107
+ url: '/application/v1/chat/approvals/search';
1108
+ };
1109
+ type ExternalAppChatApprovalsSearchResponses = {
1110
+ /**
1111
+ * Success
1112
+ */
1113
+ 200: {
1114
+ canViewAll: boolean;
1115
+ data: Array<{
1116
+ approvalRuleId: string | null;
1117
+ approvalRuleName: string | null;
1118
+ createdAt: string | null;
1119
+ decisions: Array<{
1120
+ approverName: string | null;
1121
+ approverUserId: string;
1122
+ comment: string | null;
1123
+ decidedAt: string | null;
1124
+ id: string;
1125
+ status: string;
1126
+ stepIndex: number | null;
1127
+ stepSubjectId: string | null;
1128
+ stepSubjectKind: string | null;
1129
+ }>;
1130
+ description: string | null;
1131
+ expiresAt: string | null;
1132
+ id: string;
1133
+ invocationId: string;
1134
+ myApprovalRequired: boolean;
1135
+ resolvedAt: string | null;
1136
+ ruleSnapshot: {
1137
+ allowInvokerApproval: boolean;
1138
+ expiresInSeconds: number | null;
1139
+ requireAllSteps: boolean;
1140
+ steps: Array<{
1141
+ grantee: {
1142
+ kind: 'organization';
1143
+ } | {
1144
+ kind: 'user';
1145
+ userId: string;
1146
+ } | {
1147
+ coverage: 'direct' | 'inherited';
1148
+ groupId: string;
1149
+ kind: 'group';
1150
+ };
1151
+ requiredApprovals: number;
1152
+ }>;
1153
+ };
1154
+ skillId: string | null;
1155
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
1156
+ subjectId: string | null;
1157
+ subjectType: string;
1158
+ title: string;
1159
+ updatedAt: string | null;
1160
+ userId: string | null;
1161
+ userName: string | null;
1162
+ }>;
1163
+ paging: {
1164
+ page: number;
1165
+ pageSize: number;
1166
+ totalItems: number;
1167
+ totalPages: number;
1168
+ };
1169
+ };
1170
+ };
1171
+ type ExternalAppChatApprovalsSearchResponse = ExternalAppChatApprovalsSearchResponses[keyof ExternalAppChatApprovalsSearchResponses];
1172
+ type ExternalAppChatApprovalsGetData = {
1173
+ body?: never;
1174
+ headers: {
1175
+ authorization?: string;
1176
+ 'x-organization-id': string;
1177
+ };
1178
+ path: {
1179
+ approvalId: string;
1180
+ };
1181
+ query?: never;
1182
+ url: '/application/v1/chat/approvals/{approvalId}';
1183
+ };
1184
+ type ExternalAppChatApprovalsGetResponses = {
1185
+ /**
1186
+ * Success
1187
+ */
1188
+ 200: {
1189
+ actionContext: {
1190
+ action: {
1191
+ disclosure?: 'author';
1192
+ value: string;
1193
+ visibility: 'visible';
1194
+ } | {
1195
+ reason: 'secret' | 'privacy' | 'unavailable';
1196
+ visibility: 'omitted';
1197
+ };
1198
+ consequences: {
1199
+ approve: {
1200
+ disclosure?: 'author';
1201
+ value: string;
1202
+ visibility: 'visible';
1203
+ } | {
1204
+ reason: 'secret' | 'privacy' | 'unavailable';
1205
+ visibility: 'omitted';
1206
+ };
1207
+ reject: {
1208
+ disclosure?: 'author';
1209
+ value: string;
1210
+ visibility: 'visible';
1211
+ } | {
1212
+ reason: 'secret' | 'privacy' | 'unavailable';
1213
+ visibility: 'omitted';
1214
+ };
1215
+ };
1216
+ kind: 'notification' | 'tool' | 'workflow';
1217
+ limitations: Array<string>;
1218
+ notification: {
1219
+ body: {
1220
+ disclosure?: 'author';
1221
+ value: string;
1222
+ visibility: 'visible';
1223
+ } | {
1224
+ reason: 'secret' | 'privacy' | 'unavailable';
1225
+ visibility: 'omitted';
1226
+ };
1227
+ destinations: Array<{
1228
+ disclosure?: 'author';
1229
+ value: string;
1230
+ visibility: 'visible';
1231
+ } | {
1232
+ reason: 'secret' | 'privacy' | 'unavailable';
1233
+ visibility: 'omitted';
1234
+ }>;
1235
+ recipients: Array<{
1236
+ disclosure?: 'author';
1237
+ value: string;
1238
+ visibility: 'visible';
1239
+ } | {
1240
+ reason: 'secret' | 'privacy' | 'unavailable';
1241
+ visibility: 'omitted';
1242
+ }>;
1243
+ title: {
1244
+ disclosure?: 'author';
1245
+ value: string;
1246
+ visibility: 'visible';
1247
+ } | {
1248
+ reason: 'secret' | 'privacy' | 'unavailable';
1249
+ visibility: 'omitted';
1250
+ };
1251
+ } | null;
1252
+ purpose: {
1253
+ disclosure?: 'author';
1254
+ value: string;
1255
+ visibility: 'visible';
1256
+ } | {
1257
+ reason: 'secret' | 'privacy' | 'unavailable';
1258
+ visibility: 'omitted';
1259
+ };
1260
+ requester: {
1261
+ disclosure?: 'author';
1262
+ value: string;
1263
+ visibility: 'visible';
1264
+ } | {
1265
+ reason: 'secret' | 'privacy' | 'unavailable';
1266
+ visibility: 'omitted';
1267
+ } | null;
1268
+ source: {
1269
+ kind: 'skill' | 'workflow';
1270
+ label: {
1271
+ disclosure?: 'author';
1272
+ value: string;
1273
+ visibility: 'visible';
1274
+ } | {
1275
+ reason: 'secret' | 'privacy' | 'unavailable';
1276
+ visibility: 'omitted';
1277
+ };
1278
+ } | null;
1279
+ tool: {
1280
+ name: {
1281
+ disclosure?: 'author';
1282
+ value: string;
1283
+ visibility: 'visible';
1284
+ } | {
1285
+ reason: 'secret' | 'privacy' | 'unavailable';
1286
+ visibility: 'omitted';
1287
+ };
1288
+ } | null;
1289
+ version: 1;
1290
+ workflow: {
1291
+ boundary: {
1292
+ disclosure?: 'author';
1293
+ value: string;
1294
+ visibility: 'visible';
1295
+ } | {
1296
+ reason: 'secret' | 'privacy' | 'unavailable';
1297
+ visibility: 'omitted';
1298
+ } | null;
1299
+ steps: Array<{
1300
+ label: {
1301
+ disclosure?: 'author';
1302
+ value: string;
1303
+ visibility: 'visible';
1304
+ } | {
1305
+ reason: 'secret' | 'privacy' | 'unavailable';
1306
+ visibility: 'omitted';
1307
+ };
1308
+ outcome: {
1309
+ disclosure?: 'author';
1310
+ value: string;
1311
+ visibility: 'visible';
1312
+ } | {
1313
+ reason: 'secret' | 'privacy' | 'unavailable';
1314
+ visibility: 'omitted';
1315
+ };
1316
+ }>;
1317
+ } | null;
1318
+ } | null;
1319
+ actions: {
1320
+ canApprove: boolean;
1321
+ canReject: boolean;
1322
+ };
1323
+ decisions: Array<{
1324
+ actorLabel: string;
1325
+ decidedAt: string;
1326
+ decision: 'approved' | 'rejected';
1327
+ }>;
1328
+ eligibilityBasis: 'direct_user' | 'group_member' | null;
1329
+ executionDisposition: 'not_executed_destination_changed' | null;
1330
+ expiresAt: string | null;
1331
+ id: string;
1332
+ replacementForRequestId: string | null;
1333
+ replacementRequestId: string | null;
1334
+ rule: {
1335
+ mode: 'all' | 'any';
1336
+ satisfied: boolean;
1337
+ steps: Array<{
1338
+ approved: number;
1339
+ label: string;
1340
+ required: number;
1341
+ satisfied: boolean;
1342
+ }>;
1343
+ };
1344
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
1345
+ terminalReason: string | null;
1346
+ viewerBasis: 'eligible_approver' | 'previous_approver' | 'invoker' | 'chat_viewer' | 'execution_viewer';
1347
+ };
1348
+ };
1349
+ type ExternalAppChatApprovalsGetResponse = ExternalAppChatApprovalsGetResponses[keyof ExternalAppChatApprovalsGetResponses];
1350
+ type ExternalAppChatApprovalsDecideData = {
1351
+ body: {
1352
+ comment?: string | null;
1353
+ decision: 'approved' | 'rejected';
1354
+ };
1355
+ headers: {
1356
+ authorization?: string;
1357
+ 'x-organization-id': string;
1358
+ };
1359
+ path: {
1360
+ approvalId: string;
1361
+ };
1362
+ query?: never;
1363
+ url: '/application/v1/chat/approvals/{approvalId}/decision';
1364
+ };
1365
+ type ExternalAppChatApprovalsDecideResponses = {
1366
+ /**
1367
+ * Success
1368
+ */
1369
+ 200: {
1370
+ approval: {
1371
+ approvalRuleId: string | null;
1372
+ approvalRuleName: string | null;
1373
+ createdAt: string | null;
1374
+ decisions: Array<{
1375
+ approverName: string | null;
1376
+ approverUserId: string;
1377
+ comment: string | null;
1378
+ decidedAt: string | null;
1379
+ id: string;
1380
+ status: string;
1381
+ stepIndex: number | null;
1382
+ stepSubjectId: string | null;
1383
+ stepSubjectKind: string | null;
1384
+ }>;
1385
+ description: string | null;
1386
+ expiresAt: string | null;
1387
+ id: string;
1388
+ invocationId: string;
1389
+ myApprovalRequired: boolean;
1390
+ resolvedAt: string | null;
1391
+ ruleSnapshot: {
1392
+ allowInvokerApproval: boolean;
1393
+ expiresInSeconds: number | null;
1394
+ requireAllSteps: boolean;
1395
+ steps: Array<{
1396
+ grantee: {
1397
+ kind: 'organization';
1398
+ } | {
1399
+ kind: 'user';
1400
+ userId: string;
1401
+ } | {
1402
+ coverage: 'direct' | 'inherited';
1403
+ groupId: string;
1404
+ kind: 'group';
1405
+ };
1406
+ requiredApprovals: number;
1407
+ }>;
1408
+ };
1409
+ skillId: string | null;
1410
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
1411
+ subjectId: string | null;
1412
+ subjectType: string;
1413
+ title: string;
1414
+ updatedAt: string | null;
1415
+ userId: string | null;
1416
+ userName: string | null;
1417
+ };
1418
+ approvalResult: {
1419
+ conversationId: string | null;
1420
+ kind: 'approval_recorded' | 'continued' | 'continuation_in_progress' | 'reconciliation_required' | 'already_approved' | 'already_decided';
1421
+ } | null;
1422
+ messages: Array<unknown>;
1423
+ run: unknown | null;
1424
+ };
1425
+ };
1426
+ type ExternalAppChatApprovalsDecideResponse = ExternalAppChatApprovalsDecideResponses[keyof ExternalAppChatApprovalsDecideResponses];
1427
+ type ExternalAppChatApprovalsRejectData = {
1428
+ body: {
1429
+ reason: string;
1430
+ };
1431
+ headers: {
1432
+ authorization?: string;
1433
+ 'x-organization-id': string;
1434
+ };
1435
+ path: {
1436
+ approvalId: string;
1437
+ };
1438
+ query?: never;
1439
+ url: '/application/v1/chat/approvals/{approvalId}/reject';
1440
+ };
1441
+ type ExternalAppChatApprovalsRejectResponses = {
1442
+ /**
1443
+ * Success
1444
+ */
1445
+ 200: {
1446
+ cause: 'invoker_withdrawal' | 'rejected';
1447
+ reason: string;
1448
+ requestId: string;
1449
+ resolvedAt: string;
1450
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
1451
+ };
1452
+ };
1453
+ type ExternalAppChatApprovalsRejectResponse = ExternalAppChatApprovalsRejectResponses[keyof ExternalAppChatApprovalsRejectResponses];
1454
+ type ExternalAppChatApprovalsWithdrawData = {
1455
+ body: {
1456
+ reason: string;
1457
+ };
1458
+ headers: {
1459
+ authorization?: string;
1460
+ 'x-organization-id': string;
1461
+ };
1462
+ path: {
1463
+ approvalId: string;
1464
+ };
1465
+ query?: never;
1466
+ url: '/application/v1/chat/approvals/{approvalId}/withdraw';
1467
+ };
1468
+ type ExternalAppChatApprovalsWithdrawResponses = {
1469
+ /**
1470
+ * Success
1471
+ */
1472
+ 200: {
1473
+ cause: 'invoker_withdrawal' | 'rejected';
1474
+ reason: string;
1475
+ requestId: string;
1476
+ resolvedAt: string;
1477
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
1478
+ };
1479
+ };
1480
+ type ExternalAppChatApprovalsWithdrawResponse = ExternalAppChatApprovalsWithdrawResponses[keyof ExternalAppChatApprovalsWithdrawResponses];
1481
+ type ExternalAppChatCapabilitiesAttachmentCapabilitiesData = {
1482
+ body?: never;
1483
+ headers: {
1484
+ authorization?: string;
1485
+ 'x-organization-id': string;
1486
+ };
1487
+ path?: never;
1488
+ query?: never;
1489
+ url: '/application/v1/chat/attachment-capabilities';
1490
+ };
1491
+ type ExternalAppChatCapabilitiesAttachmentCapabilitiesResponses = {
1492
+ /**
1493
+ * Success
1494
+ */
1495
+ 200: {
1496
+ fileTypes: Array<{
1497
+ extension: string;
1498
+ mediaTypes: Array<string>;
1499
+ }>;
1500
+ projectFileTypes: Array<{
1501
+ extension: string;
1502
+ mediaTypes: Array<string>;
1503
+ }>;
1504
+ };
1505
+ };
1506
+ type ExternalAppChatCapabilitiesAttachmentCapabilitiesResponse = ExternalAppChatCapabilitiesAttachmentCapabilitiesResponses[keyof ExternalAppChatCapabilitiesAttachmentCapabilitiesResponses];
1507
+ type ExternalAppChatCapabilityPermissionsDecideWaitData = {
1508
+ body: {
1509
+ decision: 'allow_always' | 'allow_this_conversation' | 'deny';
1510
+ };
1511
+ headers: {
1512
+ authorization?: string;
1513
+ 'x-organization-id': string;
1514
+ };
1515
+ path: {
1516
+ invocationId: string;
1517
+ };
1518
+ query?: never;
1519
+ url: '/application/v1/chat/capability-permission-waits/{invocationId}/decision';
1520
+ };
1521
+ type ExternalAppChatCapabilityPermissionsDecideWaitResponses = {
1522
+ /**
1523
+ * Success
1524
+ */
1525
+ 200: {
1526
+ capabilityKind: string;
1527
+ conversationId: string | null;
1528
+ decision: 'allow' | 'deny';
1529
+ id: string;
1530
+ scope: 'always' | 'conversation';
1531
+ subjectId: string;
1532
+ };
1533
+ };
1534
+ type ExternalAppChatCapabilityPermissionsDecideWaitResponse = ExternalAppChatCapabilityPermissionsDecideWaitResponses[keyof ExternalAppChatCapabilityPermissionsDecideWaitResponses];
1535
+ type ExternalAppChatCapabilityPermissionsListData = {
1536
+ body?: never;
1537
+ headers: {
1538
+ authorization?: string;
1539
+ 'x-organization-id': string;
1540
+ };
1541
+ path?: never;
1542
+ query?: never;
1543
+ url: '/application/v1/chat/capability-permissions';
1544
+ };
1545
+ type ExternalAppChatCapabilityPermissionsListResponses = {
1546
+ /**
1547
+ * Success
1548
+ */
1549
+ 200: {
1550
+ data: Array<{
1551
+ capabilityKind: string;
1552
+ conversationId: string | null;
1553
+ decision: 'allow' | 'deny';
1554
+ id: string;
1555
+ scope: 'always' | 'conversation';
1556
+ subjectId: string;
1557
+ }>;
1558
+ };
1559
+ };
1560
+ type ExternalAppChatCapabilityPermissionsListResponse = ExternalAppChatCapabilityPermissionsListResponses[keyof ExternalAppChatCapabilityPermissionsListResponses];
1561
+ type ExternalAppChatCapabilityPermissionsRevokeData = {
1562
+ body?: never;
1563
+ headers: {
1564
+ authorization?: string;
1565
+ 'x-organization-id': string;
1566
+ };
1567
+ path: {
1568
+ permissionId: string;
1569
+ };
1570
+ query?: never;
1571
+ url: '/application/v1/chat/capability-permissions/{permissionId}';
1572
+ };
1573
+ type ExternalAppChatCapabilityPermissionsRevokeResponses = {
1574
+ /**
1575
+ * <No Content>
1576
+ */
1577
+ 204: void;
1578
+ };
1579
+ type ExternalAppChatCapabilityPermissionsRevokeResponse = ExternalAppChatCapabilityPermissionsRevokeResponses[keyof ExternalAppChatCapabilityPermissionsRevokeResponses];
1580
+ type ExternalAppChatCapabilityPermissionsUpdateData = {
1581
+ body: {
1582
+ decision: 'allow' | 'deny';
1583
+ };
1584
+ headers: {
1585
+ authorization?: string;
1586
+ 'x-organization-id': string;
1587
+ };
1588
+ path: {
1589
+ permissionId: string;
1590
+ };
1591
+ query?: never;
1592
+ url: '/application/v1/chat/capability-permissions/{permissionId}';
1593
+ };
1594
+ type ExternalAppChatCapabilityPermissionsUpdateResponses = {
1595
+ /**
1596
+ * Success
1597
+ */
1598
+ 200: {
1599
+ capabilityKind: string;
1600
+ conversationId: string | null;
1601
+ decision: 'allow' | 'deny';
1602
+ id: string;
1603
+ scope: 'always' | 'conversation';
1604
+ subjectId: string;
1605
+ };
1606
+ };
1607
+ type ExternalAppChatCapabilityPermissionsUpdateResponse = ExternalAppChatCapabilityPermissionsUpdateResponses[keyof ExternalAppChatCapabilityPermissionsUpdateResponses];
1608
+ type ExternalAppChatConversationArtifactsProgressData = {
1609
+ body?: never;
1610
+ headers: {
1611
+ authorization?: string;
1612
+ 'x-organization-id': string;
1613
+ };
1614
+ path: {
1615
+ conversationId: string;
1616
+ };
1617
+ query?: never;
1618
+ url: '/application/v1/chat/conversations/{conversationId}/artifact-progress';
1619
+ };
1620
+ type ExternalAppChatConversationArtifactsProgressResponses = {
1621
+ /**
1622
+ * Success
1623
+ */
1624
+ 200: {
1625
+ currentArtifact: {
1626
+ artifactId: string;
1627
+ contentType: string | null;
1628
+ filename: string;
1629
+ role: string;
1630
+ sourceKind: string;
1631
+ } | null;
1632
+ failed: number;
1633
+ leased: number;
1634
+ pending: number;
1635
+ processed: number;
1636
+ skipped: number;
1637
+ };
1638
+ };
1639
+ type ExternalAppChatConversationArtifactsProgressResponse = ExternalAppChatConversationArtifactsProgressResponses[keyof ExternalAppChatConversationArtifactsProgressResponses];
1640
+ type ExternalAppChatConversationCompactionGetData = {
1641
+ body?: never;
1642
+ headers: {
1643
+ authorization?: string;
1644
+ 'x-organization-id': string;
1645
+ };
1646
+ path: {
1647
+ conversationId: string;
1648
+ };
1649
+ query?: never;
1650
+ url: '/application/v1/chat/conversations/{conversationId}/compaction';
1651
+ };
1652
+ type ExternalAppChatConversationCompactionGetResponses = {
1653
+ /**
1654
+ * Success
1655
+ */
1656
+ 200: {
1657
+ compaction: {
1658
+ active: boolean;
1659
+ activeSummary: {
1660
+ id: string;
1661
+ status: string;
1662
+ summary: string;
1663
+ trigger: string;
1664
+ } | null;
1665
+ boundary: {
1666
+ compactedThroughInvocationId: string | null;
1667
+ coveredInvocationCount: number;
1668
+ coveredMessageCount: number;
1669
+ } | null;
1670
+ };
1671
+ conversation: {
1672
+ agentId: string | null;
1673
+ createdAt: string | null;
1674
+ id: string;
1675
+ lastActivityAt: string | null;
1676
+ lastActivityInvocationId: string | null;
1677
+ memoryEnabled: boolean;
1678
+ organizationId: string;
1679
+ projectId: string | null;
1680
+ title: string;
1681
+ updatedAt: string | null;
1682
+ userId: string;
1683
+ origin: {
1684
+ id: string;
1685
+ kind: 'studio_app' | 'external_app';
1686
+ };
1687
+ };
1688
+ };
1689
+ };
1690
+ type ExternalAppChatConversationCompactionGetResponse = ExternalAppChatConversationCompactionGetResponses[keyof ExternalAppChatConversationCompactionGetResponses];
1691
+ type ExternalAppChatConversationCompactionCompactData = {
1692
+ body?: never;
1693
+ headers: {
1694
+ authorization?: string;
1695
+ 'x-organization-id': string;
1696
+ };
1697
+ path: {
1698
+ conversationId: string;
1699
+ };
1700
+ query?: never;
1701
+ url: '/application/v1/chat/conversations/{conversationId}/compactions';
1702
+ };
1703
+ type ExternalAppChatConversationCompactionCompactResponses = {
1704
+ /**
1705
+ * Success
1706
+ */
1707
+ 200: {
1708
+ compaction: {
1709
+ active: boolean;
1710
+ activeSummary: {
1711
+ id: string;
1712
+ status: string;
1713
+ summary: string;
1714
+ trigger: string;
1715
+ } | null;
1716
+ boundary: {
1717
+ compactedThroughInvocationId: string | null;
1718
+ coveredInvocationCount: number;
1719
+ coveredMessageCount: number;
1720
+ } | null;
1721
+ };
1722
+ conversation: {
1723
+ agentId: string | null;
1724
+ createdAt: string | null;
1725
+ id: string;
1726
+ lastActivityAt: string | null;
1727
+ lastActivityInvocationId: string | null;
1728
+ memoryEnabled: boolean;
1729
+ organizationId: string;
1730
+ projectId: string | null;
1731
+ title: string;
1732
+ updatedAt: string | null;
1733
+ userId: string;
1734
+ origin: {
1735
+ id: string;
1736
+ kind: 'studio_app' | 'external_app';
1737
+ };
1738
+ };
1739
+ };
1740
+ };
1741
+ type ExternalAppChatConversationCompactionCompactResponse = ExternalAppChatConversationCompactionCompactResponses[keyof ExternalAppChatConversationCompactionCompactResponses];
1742
+ type ExternalAppChatConversationCompactionRegenerateData = {
1743
+ body?: never;
1744
+ headers: {
1745
+ authorization?: string;
1746
+ 'x-organization-id': string;
1747
+ };
1748
+ path: {
1749
+ conversationId: string;
1750
+ };
1751
+ query?: never;
1752
+ url: '/application/v1/chat/conversations/{conversationId}/compactions/regenerate';
1753
+ };
1754
+ type ExternalAppChatConversationCompactionRegenerateResponses = {
1755
+ /**
1756
+ * Success
1757
+ */
1758
+ 200: {
1759
+ compaction: {
1760
+ active: boolean;
1761
+ activeSummary: {
1762
+ id: string;
1763
+ status: string;
1764
+ summary: string;
1765
+ trigger: string;
1766
+ } | null;
1767
+ boundary: {
1768
+ compactedThroughInvocationId: string | null;
1769
+ coveredInvocationCount: number;
1770
+ coveredMessageCount: number;
1771
+ } | null;
1772
+ };
1773
+ conversation: {
1774
+ agentId: string | null;
1775
+ createdAt: string | null;
1776
+ id: string;
1777
+ lastActivityAt: string | null;
1778
+ lastActivityInvocationId: string | null;
1779
+ memoryEnabled: boolean;
1780
+ organizationId: string;
1781
+ projectId: string | null;
1782
+ title: string;
1783
+ updatedAt: string | null;
1784
+ userId: string;
1785
+ origin: {
1786
+ id: string;
1787
+ kind: 'studio_app' | 'external_app';
1788
+ };
1789
+ };
1790
+ };
1791
+ };
1792
+ type ExternalAppChatConversationCompactionRegenerateResponse = ExternalAppChatConversationCompactionRegenerateResponses[keyof ExternalAppChatConversationCompactionRegenerateResponses];
1793
+ type ExternalAppChatConversationCompactionResetData = {
1794
+ body?: never;
1795
+ headers: {
1796
+ authorization?: string;
1797
+ 'x-organization-id': string;
1798
+ };
1799
+ path: {
1800
+ conversationId: string;
1801
+ };
1802
+ query?: never;
1803
+ url: '/application/v1/chat/conversations/{conversationId}/compactions/active';
1804
+ };
1805
+ type ExternalAppChatConversationCompactionResetResponses = {
1806
+ /**
1807
+ * Success
1808
+ */
1809
+ 200: {
1810
+ compaction: {
1811
+ active: boolean;
1812
+ activeSummary: {
1813
+ id: string;
1814
+ status: string;
1815
+ summary: string;
1816
+ trigger: string;
1817
+ } | null;
1818
+ boundary: {
1819
+ compactedThroughInvocationId: string | null;
1820
+ coveredInvocationCount: number;
1821
+ coveredMessageCount: number;
1822
+ } | null;
1823
+ };
1824
+ conversation: {
1825
+ agentId: string | null;
1826
+ createdAt: string | null;
1827
+ id: string;
1828
+ lastActivityAt: string | null;
1829
+ lastActivityInvocationId: string | null;
1830
+ memoryEnabled: boolean;
1831
+ organizationId: string;
1832
+ projectId: string | null;
1833
+ title: string;
1834
+ updatedAt: string | null;
1835
+ userId: string;
1836
+ origin: {
1837
+ id: string;
1838
+ kind: 'studio_app' | 'external_app';
1839
+ };
1840
+ };
1841
+ };
1842
+ };
1843
+ type ExternalAppChatConversationCompactionResetResponse = ExternalAppChatConversationCompactionResetResponses[keyof ExternalAppChatConversationCompactionResetResponses];
1844
+ type ExternalAppChatEvidenceNavigationResolveData = {
1845
+ body: {
1846
+ evidenceId: string;
1847
+ navigation: {
1848
+ entityId: string;
1849
+ kind: 'entity';
1850
+ } | {
1851
+ fileId: string;
1852
+ kind: 'file';
1853
+ } | {
1854
+ kind: 'external_url';
1855
+ url: string;
1856
+ };
1857
+ };
1858
+ headers: {
1859
+ authorization?: string;
1860
+ 'x-organization-id': string;
1861
+ };
1862
+ path: {
1863
+ invocationId: string;
1864
+ };
1865
+ query?: never;
1866
+ url: '/application/v1/chat/invocations/{invocationId}/evidence-navigation';
1867
+ };
1868
+ type ExternalAppChatEvidenceNavigationResolveResponses = {
1869
+ /**
1870
+ * Success
1871
+ */
1872
+ 200: {
1873
+ target: {
1874
+ entityId: string;
1875
+ kind: 'entity';
1876
+ } | {
1877
+ fileId: string;
1878
+ kind: 'file';
1879
+ mediaUrl?: string;
1880
+ } | {
1881
+ kind: 'external_url';
1882
+ url: string;
1883
+ } | null;
1884
+ };
1885
+ };
1886
+ type ExternalAppChatEvidenceNavigationResolveResponse = ExternalAppChatEvidenceNavigationResolveResponses[keyof ExternalAppChatEvidenceNavigationResolveResponses];
1887
+ type ExternalAppChatInteractionsRespondData = {
1888
+ body: {
1889
+ action?: 'answer' | 'approve' | 'revise' | null;
1890
+ optionId?: string | null;
1891
+ text?: string | null;
1892
+ };
1893
+ headers: {
1894
+ authorization?: string;
1895
+ 'x-organization-id': string;
1896
+ };
1897
+ path: {
1898
+ interactionId: string;
1899
+ };
1900
+ query?: never;
1901
+ url: '/application/v1/chat/interactions/{interactionId}/response';
1902
+ };
1903
+ type ExternalAppChatInteractionsRespondResponses = {
1904
+ /**
1905
+ * Success
1906
+ */
1907
+ 200: {
1908
+ id: string;
1909
+ invocationId: string;
1910
+ status: 'completed' | 'pending' | 'responding';
1911
+ };
1912
+ };
1913
+ type ExternalAppChatInteractionsRespondResponse = ExternalAppChatInteractionsRespondResponses[keyof ExternalAppChatInteractionsRespondResponses];
1914
+ type ExternalAppChatInteractionsStreamData = {
1915
+ body: {
1916
+ action?: 'answer' | 'approve' | 'revise' | null;
1917
+ optionId?: string | null;
1918
+ text?: string | null;
1919
+ };
1920
+ headers: {
1921
+ authorization?: string;
1922
+ 'x-organization-id': string;
1923
+ };
1924
+ path: {
1925
+ interactionId: string;
1926
+ };
1927
+ query?: never;
1928
+ url: '/application/v1/chat/interactions/{interactionId}/response/stream';
1929
+ };
1930
+ type ExternalAppChatInteractionsStreamResponses = {
1931
+ /**
1932
+ * Success
1933
+ */
1934
+ 200: {
1935
+ data: string;
1936
+ event: 'interaction_result';
1937
+ id?: string;
1938
+ };
1939
+ };
1940
+ type ExternalAppChatInteractionsStreamResponse = ExternalAppChatInteractionsStreamResponses[keyof ExternalAppChatInteractionsStreamResponses];
1941
+ type ExternalAppChatProjectsListData = {
1942
+ body?: never;
1943
+ headers: {
1944
+ authorization?: string;
1945
+ 'x-organization-id': string;
1946
+ };
1947
+ path?: never;
1948
+ query?: never;
1949
+ url: '/application/v1/chat/projects';
1950
+ };
1951
+ type ExternalAppChatProjectsListResponses = {
1952
+ /**
1953
+ * Success
1954
+ */
1955
+ 200: {
1956
+ data: Array<{
1957
+ createdAt: string;
1958
+ id: string;
1959
+ instructions: string | null;
1960
+ name: string;
1961
+ updatedAt: string;
1962
+ }>;
1963
+ };
1964
+ };
1965
+ type ExternalAppChatProjectsListResponse = ExternalAppChatProjectsListResponses[keyof ExternalAppChatProjectsListResponses];
1966
+ type ExternalAppChatProjectsCreateData = {
1967
+ body: {
1968
+ name: string;
1969
+ };
1970
+ headers: {
1971
+ authorization?: string;
1972
+ 'x-organization-id': string;
1973
+ };
1974
+ path?: never;
1975
+ query?: never;
1976
+ url: '/application/v1/chat/projects';
1977
+ };
1978
+ type ExternalAppChatProjectsCreateResponses = {
1979
+ /**
1980
+ * Success
1981
+ */
1982
+ 201: {
1983
+ createdAt: string;
1984
+ id: string;
1985
+ instructions: string | null;
1986
+ name: string;
1987
+ updatedAt: string;
1988
+ };
1989
+ };
1990
+ type ExternalAppChatProjectsCreateResponse = ExternalAppChatProjectsCreateResponses[keyof ExternalAppChatProjectsCreateResponses];
1991
+ type ExternalAppChatProjectsDeleteData = {
1992
+ body?: never;
1993
+ headers: {
1994
+ authorization?: string;
1995
+ 'x-organization-id': string;
1996
+ };
1997
+ path: {
1998
+ projectId: string;
1999
+ };
2000
+ query?: never;
2001
+ url: '/application/v1/chat/projects/{projectId}';
2002
+ };
2003
+ type ExternalAppChatProjectsDeleteResponses = {
2004
+ /**
2005
+ * <No Content>
2006
+ */
2007
+ 204: void;
2008
+ };
2009
+ type ExternalAppChatProjectsDeleteResponse = ExternalAppChatProjectsDeleteResponses[keyof ExternalAppChatProjectsDeleteResponses];
2010
+ type ExternalAppChatProjectsUpdateData = {
2011
+ body: {
2012
+ instructions?: string | null;
2013
+ name?: string;
2014
+ };
2015
+ headers: {
2016
+ authorization?: string;
2017
+ 'x-organization-id': string;
2018
+ };
2019
+ path: {
2020
+ projectId: string;
2021
+ };
2022
+ query?: never;
2023
+ url: '/application/v1/chat/projects/{projectId}';
2024
+ };
2025
+ type ExternalAppChatProjectsUpdateResponses = {
2026
+ /**
2027
+ * Success
2028
+ */
2029
+ 200: {
2030
+ createdAt: string;
2031
+ id: string;
2032
+ instructions: string | null;
2033
+ name: string;
2034
+ updatedAt: string;
2035
+ };
2036
+ };
2037
+ type ExternalAppChatProjectsUpdateResponse = ExternalAppChatProjectsUpdateResponses[keyof ExternalAppChatProjectsUpdateResponses];
2038
+ type ExternalAppChatProjectsListFilesData = {
2039
+ body?: never;
2040
+ headers: {
2041
+ authorization?: string;
2042
+ 'x-organization-id': string;
2043
+ };
2044
+ path: {
2045
+ projectId: string;
2046
+ };
2047
+ query?: never;
2048
+ url: '/application/v1/chat/projects/{projectId}/files';
2049
+ };
2050
+ type ExternalAppChatProjectsListFilesResponses = {
2051
+ /**
2052
+ * Success
2053
+ */
2054
+ 200: {
2055
+ files: Array<{
2056
+ contentType: string | null;
2057
+ createdAt: string;
2058
+ /**
2059
+ * `failed`: the file gave no text, so no turn gets it.
2060
+ */
2061
+ extractionState: 'available' | 'truncated' | 'failed';
2062
+ filename: string;
2063
+ id: string;
2064
+ inContext: boolean;
2065
+ sizeBytes: number;
2066
+ }>;
2067
+ maxCharacters: number;
2068
+ usedCharacters: number;
2069
+ };
2070
+ };
2071
+ type ExternalAppChatProjectsListFilesResponse = ExternalAppChatProjectsListFilesResponses[keyof ExternalAppChatProjectsListFilesResponses];
2072
+ type ExternalAppChatProjectsUploadFileData = {
2073
+ body: {
2074
+ file: Blob | File;
2075
+ };
2076
+ headers: {
2077
+ authorization?: string;
2078
+ 'x-organization-id': string;
2079
+ };
2080
+ path: {
2081
+ projectId: string;
2082
+ };
2083
+ query?: never;
2084
+ url: '/application/v1/chat/projects/{projectId}/files';
2085
+ };
2086
+ type ExternalAppChatProjectsUploadFileResponses = {
2087
+ /**
2088
+ * Success
2089
+ */
2090
+ 201: {
2091
+ contentType: string | null;
2092
+ createdAt: string;
2093
+ /**
2094
+ * `failed`: the file gave no text, so no turn gets it.
2095
+ */
2096
+ extractionState: 'available' | 'truncated' | 'failed';
2097
+ filename: string;
2098
+ id: string;
2099
+ inContext: boolean;
2100
+ sizeBytes: number;
2101
+ };
2102
+ };
2103
+ type ExternalAppChatProjectsUploadFileResponse = ExternalAppChatProjectsUploadFileResponses[keyof ExternalAppChatProjectsUploadFileResponses];
2104
+ type ExternalAppChatProjectsDeleteFileData = {
2105
+ body?: never;
2106
+ headers: {
2107
+ authorization?: string;
2108
+ 'x-organization-id': string;
2109
+ };
2110
+ path: {
2111
+ fileId: string;
2112
+ projectId: string;
2113
+ };
2114
+ query?: never;
2115
+ url: '/application/v1/chat/projects/{projectId}/files/{fileId}';
2116
+ };
2117
+ type ExternalAppChatProjectsDeleteFileResponses = {
2118
+ /**
2119
+ * <No Content>
2120
+ */
2121
+ 204: void;
2122
+ };
2123
+ type ExternalAppChatProjectsDeleteFileResponse = ExternalAppChatProjectsDeleteFileResponses[keyof ExternalAppChatProjectsDeleteFileResponses];
2124
+ type ExternalAppChatProjectsFileDownloadUrlData = {
2125
+ body?: never;
2126
+ headers: {
2127
+ authorization?: string;
2128
+ 'x-organization-id': string;
2129
+ };
2130
+ path: {
2131
+ fileId: string;
2132
+ projectId: string;
2133
+ };
2134
+ query?: never;
2135
+ url: '/application/v1/chat/projects/{projectId}/files/{fileId}/download-url';
2136
+ };
2137
+ type ExternalAppChatProjectsFileDownloadUrlResponses = {
2138
+ /**
2139
+ * Success
2140
+ */
2141
+ 200: {
2142
+ expiresIn: number;
2143
+ url: string;
2144
+ };
2145
+ };
2146
+ type ExternalAppChatProjectsFileDownloadUrlResponse = ExternalAppChatProjectsFileDownloadUrlResponses[keyof ExternalAppChatProjectsFileDownloadUrlResponses];
2147
+ type ExternalAppChatSpeechCreateClipData = {
2148
+ body: {
2149
+ contentType: string;
2150
+ size: number;
2151
+ };
2152
+ headers: {
2153
+ authorization?: string;
2154
+ 'x-organization-id': string;
2155
+ };
2156
+ path?: never;
2157
+ query?: never;
2158
+ url: '/application/v1/chat/speech/clips';
2159
+ };
2160
+ type ExternalAppChatSpeechCreateClipResponses = {
2161
+ /**
2162
+ * Success
2163
+ */
2164
+ 200: {
2165
+ clipId: string;
2166
+ headers: {
2167
+ [key: string]: string;
2168
+ };
2169
+ method: 'PUT';
2170
+ url: string;
2171
+ };
2172
+ };
2173
+ type ExternalAppChatSpeechCreateClipResponse = ExternalAppChatSpeechCreateClipResponses[keyof ExternalAppChatSpeechCreateClipResponses];
2174
+ type ExternalAppChatSpeechTranscribeData = {
2175
+ body: {
2176
+ clipId: string;
2177
+ };
2178
+ headers: {
2179
+ authorization?: string;
2180
+ 'x-organization-id': string;
2181
+ };
2182
+ path?: never;
2183
+ query?: never;
2184
+ url: '/application/v1/chat/speech/transcriptions';
2185
+ };
2186
+ type ExternalAppChatSpeechTranscribeResponses = {
2187
+ /**
2188
+ * Success
2189
+ */
2190
+ 200: {
2191
+ text: string;
2192
+ };
2193
+ };
2194
+ type ExternalAppChatSpeechTranscribeResponse = ExternalAppChatSpeechTranscribeResponses[keyof ExternalAppChatSpeechTranscribeResponses];
2195
+ type ExternalAppChatSpeechReadAloudPartData = {
2196
+ body?: never;
2197
+ headers: {
2198
+ authorization?: string;
2199
+ 'x-organization-id': string;
2200
+ };
2201
+ path: {
2202
+ invocationId: string;
2203
+ partIndex: string;
2204
+ };
2205
+ query?: never;
2206
+ url: '/application/v1/chat/speech/read-aloud/{invocationId}/parts/{partIndex}';
2207
+ };
2208
+ type ExternalAppChatSpeechReadAloudPartResponses = {
2209
+ /**
2210
+ * Success
2211
+ */
2212
+ 200: {
2213
+ partCount: number;
2214
+ url: string;
2215
+ };
2216
+ };
2217
+ type ExternalAppChatSpeechReadAloudPartResponse = ExternalAppChatSpeechReadAloudPartResponses[keyof ExternalAppChatSpeechReadAloudPartResponses];
2218
+ type ExternalAppChatSpeechAvailabilityData = {
2219
+ body?: never;
2220
+ headers: {
2221
+ authorization?: string;
2222
+ 'x-organization-id': string;
2223
+ };
2224
+ path?: never;
2225
+ query?: never;
2226
+ url: '/application/v1/chat/speech/availability';
2227
+ };
2228
+ type ExternalAppChatSpeechAvailabilityResponses = {
2229
+ /**
2230
+ * Success
2231
+ */
2232
+ 200: {
2233
+ readAloud: boolean;
2234
+ remoteTranscription: boolean;
2235
+ };
2236
+ };
2237
+ type ExternalAppChatSpeechAvailabilityResponse = ExternalAppChatSpeechAvailabilityResponses[keyof ExternalAppChatSpeechAvailabilityResponses];
2238
+ type JsonValue$1 = boolean | null | number | readonly JsonValue$1[] | Readonly<{
2239
+ readonly [key: string]: JsonValue$1;
2240
+ }> | string;
2241
+ type JsonObject = Readonly<Record<string, JsonValue$1>>;
2242
+ type WorkflowInvokeTarget = {
2243
+ workflowId: string;
2244
+ workflowFqn?: never;
2245
+ } | {
2246
+ workflowFqn: string;
2247
+ workflowId?: never;
2248
+ };
2249
+ /** Addresses an Agent by its UUID or its in-organization FQN. */
2250
+ type AgentInvokeTarget = {
2251
+ agentId: string;
2252
+ agentFqn?: never;
2253
+ } | {
2254
+ agentFqn: string;
2255
+ agentId?: never;
2256
+ };
2257
+ /** Starts a conversation with an Agent, or continues an existing one. */
2258
+ type ConversationContinueTarget = (AgentInvokeTarget & {
2259
+ conversationId?: never;
2260
+ }) | {
2261
+ agentFqn?: never;
2262
+ agentId?: never;
2263
+ conversationId: string;
2264
+ };
2265
+ type ConversationTurnStatus = "accepted" | "cancelled" | "failed" | "running" | "succeeded";
2266
+ /**
2267
+ * One conversation turn: the application's input, the Agent's final message
2268
+ * once its run succeeded, and the Agent Output the run saved, if any.
2269
+ * `runId` identifies the turn and its producing run.
2270
+ */
2271
+ interface ConversationTurn {
2272
+ completedAt: string | null;
2273
+ createdAt: string;
2274
+ input: unknown;
2275
+ message: string | null;
2276
+ output?: unknown;
2277
+ runId: string;
2278
+ status: ConversationTurnStatus;
2279
+ }
2280
+ interface ConversationHistory {
2281
+ agentId: string;
2282
+ conversationId: string;
2283
+ createdAt: string;
2284
+ turns: ConversationTurn[];
2285
+ }
2286
+ interface QueryFilter {
2287
+ caseSensitive?: boolean;
2288
+ field: string;
2289
+ op: "eq" | "neq" | "in" | "contains" | "gt" | "gte" | "lt" | "lte" | "exists";
2290
+ value?: unknown;
2291
+ }
2292
+ interface SearchQuery {
2293
+ cursor?: string;
2294
+ entitySchemaId: string;
2295
+ fields?: string[];
2296
+ filters?: QueryFilter[];
2297
+ limit?: number;
2298
+ text?: string;
2299
+ }
2300
+ type KnowledgeQuery = {
2301
+ entityId: string;
2302
+ op: "get";
2303
+ } | (SearchQuery & {
2304
+ op: "search";
2305
+ }) | {
2306
+ entitySchemaId: string;
2307
+ fields: string[];
2308
+ filters?: QueryFilter[];
2309
+ op: "facets";
2310
+ text?: string;
2311
+ } | (SearchQuery & {
2312
+ op: "autocomplete";
2313
+ });
2314
+ /** The `path`, `query` and `body` of a generated operation; the transport sets its headers and URL. */
2315
+ type ChatRequest<Data> = Omit<Data, "headers" | "url">;
2316
+ interface ChatOperation<Data extends Readonly<{
2317
+ url: string;
2318
+ }>, Output> {
2319
+ readonly input: ChatRequest<Data>;
2320
+ readonly output: Output;
2321
+ readonly url: Data["url"];
2322
+ }
2323
+ /**
2324
+ * A generated upload request whose body takes named `File` values: CI reads
2325
+ * the type of each file from the extension of its name, so a plain `Blob`
2326
+ * is refused.
2327
+ */
2328
+ type NamedFileUpload<Data extends Readonly<{
2329
+ url: string;
2330
+ }>, Body> = Omit<Data, "body"> & Readonly<{
2331
+ body: Body;
2332
+ }>;
2333
+ /**
2334
+ * The External App chat operations under `/application/v1/chat/...`: each
2335
+ * `chat_*` id with the request and the success body of its generated
2336
+ * operation. An event-stream operation answers the frames of its one
2337
+ * connection, and the `data` of a frame is JSON text. Only a signed-in app
2338
+ * user may chat, so a confidential server client has no chat operation (Q102).
2339
+ */
2340
+ interface ExternalApplicationChatOperations {
2341
+ readonly chat_conversations_list: ChatOperation<ExternalAppChatConversationsListData, ExternalAppChatConversationsListResponse>;
2342
+ readonly chat_conversations_create: ChatOperation<ExternalAppChatConversationsCreateData, ExternalAppChatConversationsCreateResponse>;
2343
+ readonly chat_conversations_get: ChatOperation<ExternalAppChatConversationsGetData, ExternalAppChatConversationsGetResponse>;
2344
+ readonly chat_conversations_update: ChatOperation<ExternalAppChatConversationsUpdateData, ExternalAppChatConversationsUpdateResponse>;
2345
+ readonly chat_conversations_delete: ChatOperation<ExternalAppChatConversationsDeleteData, ExternalAppChatConversationsDeleteResponse>;
2346
+ readonly chat_conversations_transcript: ChatOperation<ExternalAppChatConversationTranscriptGetData, ExternalAppChatConversationTranscriptGetResponse>;
2347
+ readonly chat_turns_submit: ChatOperation<ExternalAppChatChatTurnData, ExternalAppChatChatTurnResponse>;
2348
+ readonly chat_turns_stream: ChatOperation<ExternalAppChatChatStreamData, AsyncIterable<ExternalAppChatChatStreamResponse>>;
2349
+ readonly chat_turns_cancel: ChatOperation<ExternalAppChatChatCancelTurnData, ExternalAppChatChatCancelTurnResponse>;
2350
+ /** A message to the running answer; with no running answer it starts a turn. */
2351
+ readonly chat_steering_messages_send: ChatOperation<ExternalAppChatChatSendSteeringMessageData, ExternalAppChatChatSendSteeringMessageResponse>;
2352
+ /** "Send after this answer": a Queued Message that runs after the running answer. */
2353
+ readonly chat_queued_messages_create: ChatOperation<ExternalAppChatChatQueueMessageData, ExternalAppChatChatQueueMessageResponse>;
2354
+ readonly chat_queued_messages_list: ChatOperation<ExternalAppChatChatListQueuedMessagesData, ExternalAppChatChatListQueuedMessagesResponse>;
2355
+ readonly chat_queued_messages_update: ChatOperation<ExternalAppChatChatUpdateQueuedMessageData, ExternalAppChatChatUpdateQueuedMessageResponse>;
2356
+ readonly chat_queued_messages_delete: ChatOperation<ExternalAppChatChatRemoveQueuedMessageData, ExternalAppChatChatRemoveQueuedMessageResponse>;
2357
+ readonly chat_place_context_get: ChatOperation<ExternalAppChatChatPlaceContextData, ExternalAppChatChatPlaceContextResponse>;
2358
+ readonly chat_presentation_get: ChatOperation<ExternalAppChatExecutionPresentationGetData, ExternalAppChatExecutionPresentationGetResponse>;
2359
+ readonly chat_presentation_stream: ChatOperation<ExternalAppChatExecutionPresentationStreamData, AsyncIterable<ExternalAppChatExecutionPresentationStreamResponse>>;
2360
+ readonly chat_agents_list: ChatOperation<ExternalAppChatAgentsListData, ExternalAppChatAgentsListResponse>;
2361
+ readonly chat_skills_list: ChatOperation<ExternalAppChatSkillsListData, ExternalAppChatSkillsListResponse>;
2362
+ readonly chat_tools_list: ChatOperation<ExternalAppChatToolsListData, ExternalAppChatToolsListResponse>;
2363
+ readonly chat_agent_conversations_submit_turn: ChatOperation<ExternalAppChatAgentConversationsSubmitTurnData, ExternalAppChatAgentConversationsSubmitTurnResponse>;
2364
+ readonly chat_agent_conversations_cancel_turn: ChatOperation<ExternalAppChatAgentConversationsCancelTurnData, ExternalAppChatAgentConversationsCancelTurnResponse>;
2365
+ readonly chat_agent_conversations_close: ChatOperation<ExternalAppChatAgentConversationsCloseData, ExternalAppChatAgentConversationsCloseResponse>;
2366
+ readonly chat_attachments_upload: ChatOperation<NamedFileUpload<ExternalAppChatAttachmentsUploadData, Readonly<{
2367
+ files: readonly File[];
2368
+ }>>, ExternalAppChatAttachmentsUploadResponse>;
2369
+ readonly chat_attachments_download_url: ChatOperation<ExternalAppChatAttachmentsDownloadUrlData, ExternalAppChatAttachmentsDownloadUrlResponse>;
2370
+ readonly chat_attachments_capabilities: ChatOperation<ExternalAppChatCapabilitiesAttachmentCapabilitiesData, ExternalAppChatCapabilitiesAttachmentCapabilitiesResponse>;
2371
+ readonly chat_feedback_upsert: ChatOperation<ExternalAppChatAnswerFeedbackUpsertData, ExternalAppChatAnswerFeedbackUpsertResponse>;
2372
+ readonly chat_feedback_clear: ChatOperation<ExternalAppChatAnswerFeedbackClearData, ExternalAppChatAnswerFeedbackClearResponse>;
2373
+ readonly chat_approvals_search_requests: ChatOperation<ExternalAppChatApprovalsSearchRequestsData, ExternalAppChatApprovalsSearchRequestsResponse>;
2374
+ readonly chat_approvals_search: ChatOperation<ExternalAppChatApprovalsSearchData, ExternalAppChatApprovalsSearchResponse>;
2375
+ readonly chat_approvals_get: ChatOperation<ExternalAppChatApprovalsGetData, ExternalAppChatApprovalsGetResponse>;
2376
+ readonly chat_approvals_decide: ChatOperation<ExternalAppChatApprovalsDecideData, ExternalAppChatApprovalsDecideResponse>;
2377
+ readonly chat_approvals_reject: ChatOperation<ExternalAppChatApprovalsRejectData, ExternalAppChatApprovalsRejectResponse>;
2378
+ readonly chat_approvals_withdraw: ChatOperation<ExternalAppChatApprovalsWithdrawData, ExternalAppChatApprovalsWithdrawResponse>;
2379
+ readonly chat_permissions_decide_wait: ChatOperation<ExternalAppChatCapabilityPermissionsDecideWaitData, ExternalAppChatCapabilityPermissionsDecideWaitResponse>;
2380
+ readonly chat_permissions_list: ChatOperation<ExternalAppChatCapabilityPermissionsListData, ExternalAppChatCapabilityPermissionsListResponse>;
2381
+ readonly chat_permissions_update: ChatOperation<ExternalAppChatCapabilityPermissionsUpdateData, ExternalAppChatCapabilityPermissionsUpdateResponse>;
2382
+ readonly chat_permissions_revoke: ChatOperation<ExternalAppChatCapabilityPermissionsRevokeData, ExternalAppChatCapabilityPermissionsRevokeResponse>;
2383
+ readonly chat_artifacts_progress: ChatOperation<ExternalAppChatConversationArtifactsProgressData, ExternalAppChatConversationArtifactsProgressResponse>;
2384
+ readonly chat_compaction_get: ChatOperation<ExternalAppChatConversationCompactionGetData, ExternalAppChatConversationCompactionGetResponse>;
2385
+ readonly chat_compaction_compact: ChatOperation<ExternalAppChatConversationCompactionCompactData, ExternalAppChatConversationCompactionCompactResponse>;
2386
+ readonly chat_compaction_regenerate: ChatOperation<ExternalAppChatConversationCompactionRegenerateData, ExternalAppChatConversationCompactionRegenerateResponse>;
2387
+ readonly chat_compaction_reset: ChatOperation<ExternalAppChatConversationCompactionResetData, ExternalAppChatConversationCompactionResetResponse>;
2388
+ readonly chat_evidence_resolve: ChatOperation<ExternalAppChatEvidenceNavigationResolveData, ExternalAppChatEvidenceNavigationResolveResponse>;
2389
+ readonly chat_interactions_respond: ChatOperation<ExternalAppChatInteractionsRespondData, ExternalAppChatInteractionsRespondResponse>;
2390
+ readonly chat_interactions_stream: ChatOperation<ExternalAppChatInteractionsStreamData, AsyncIterable<ExternalAppChatInteractionsStreamResponse>>;
2391
+ readonly chat_projects_list: ChatOperation<ExternalAppChatProjectsListData, ExternalAppChatProjectsListResponse>;
2392
+ readonly chat_projects_create: ChatOperation<ExternalAppChatProjectsCreateData, ExternalAppChatProjectsCreateResponse>;
2393
+ readonly chat_projects_update: ChatOperation<ExternalAppChatProjectsUpdateData, ExternalAppChatProjectsUpdateResponse>;
2394
+ readonly chat_projects_delete: ChatOperation<ExternalAppChatProjectsDeleteData, ExternalAppChatProjectsDeleteResponse>;
2395
+ readonly chat_projects_list_files: ChatOperation<ExternalAppChatProjectsListFilesData, ExternalAppChatProjectsListFilesResponse>;
2396
+ readonly chat_projects_upload_file: ChatOperation<NamedFileUpload<ExternalAppChatProjectsUploadFileData, Readonly<{
2397
+ file: File;
2398
+ }>>, ExternalAppChatProjectsUploadFileResponse>;
2399
+ readonly chat_projects_delete_file: ChatOperation<ExternalAppChatProjectsDeleteFileData, ExternalAppChatProjectsDeleteFileResponse>;
2400
+ readonly chat_projects_file_download_url: ChatOperation<ExternalAppChatProjectsFileDownloadUrlData, ExternalAppChatProjectsFileDownloadUrlResponse>;
2401
+ /** A presigned upload for one voice clip; the client puts the bytes there. */
2402
+ readonly chat_speech_create_clip: ChatOperation<ExternalAppChatSpeechCreateClipData, ExternalAppChatSpeechCreateClipResponse>;
2403
+ /** The text of an uploaded clip; the clip is dropped after it. */
2404
+ readonly chat_speech_transcribe: ChatOperation<ExternalAppChatSpeechTranscribeData, ExternalAppChatSpeechTranscribeResponse>;
2405
+ readonly chat_speech_availability: ChatOperation<ExternalAppChatSpeechAvailabilityData, ExternalAppChatSpeechAvailabilityResponse>;
2406
+ /** One part of an answer read aloud: its count of parts and the signed URL of its audio. */
2407
+ readonly chat_speech_read_aloud_part: ChatOperation<ExternalAppChatSpeechReadAloudPartData, ExternalAppChatSpeechReadAloudPartResponse>;
2408
+ }
2409
+ type ExternalApplicationChatOperationId = keyof ExternalApplicationChatOperations;
2410
+ type ExternalApplicationOperationRequest = {
2411
+ input: JsonObject | unknown[];
2412
+ operationId: "context_get";
2413
+ } | {
2414
+ input: {
2415
+ query: KnowledgeQuery;
2416
+ };
2417
+ operationId: "knowledge_query";
2418
+ } | {
2419
+ input: {
2420
+ schemaId: string;
2421
+ };
2422
+ operationId: "knowledge_get_entity_schema_snapshot";
2423
+ } | {
2424
+ input: SearchQuery;
2425
+ operationId: "knowledge_search_entities";
2426
+ } | {
2427
+ input: {
2428
+ entitySchemaId: string;
2429
+ fields: string[];
2430
+ filters?: QueryFilter[];
2431
+ text?: string;
2432
+ };
2433
+ operationId: "knowledge_facets";
2434
+ } | {
2435
+ input: {
2436
+ entitySchemaId: string;
2437
+ };
2438
+ operationId: "knowledge_get_schema_query_context";
2439
+ } | {
2440
+ input: SearchQuery;
2441
+ operationId: "knowledge_autocomplete";
2442
+ } | {
2443
+ input: {
2444
+ entityId: string;
2445
+ };
2446
+ operationId: "knowledge_get_entity";
2447
+ } | {
2448
+ input: {
2449
+ entity: {
2450
+ data: JsonObject;
2451
+ description?: string;
2452
+ entitySchemaId: string;
2453
+ name: string;
2454
+ };
2455
+ idempotencyKey: string;
2456
+ };
2457
+ operationId: "knowledge_create_entity";
2458
+ } | {
2459
+ input: {
2460
+ entity: {
2461
+ data?: JsonObject;
2462
+ description?: string;
2463
+ name?: string;
2464
+ };
2465
+ entityId: string;
2466
+ expectedVersion: number;
2467
+ idempotencyKey: string;
2468
+ };
2469
+ operationId: "knowledge_update_entity";
2470
+ } | {
2471
+ input: {
2472
+ entity: {
2473
+ data: JsonObject;
2474
+ description?: string;
2475
+ entitySchemaId: string;
2476
+ name: string;
2477
+ };
2478
+ entitySchemaId: string;
2479
+ externalIdentity: {
2480
+ source: string;
2481
+ value: string;
2482
+ };
2483
+ idempotencyKey: string;
2484
+ };
2485
+ operationId: "knowledge_upsert_entity";
2486
+ } | {
2487
+ input: {
2488
+ entityId: string;
2489
+ expectedVersion: number;
2490
+ idempotencyKey: string;
2491
+ };
2492
+ operationId: "knowledge_delete_entity";
2493
+ } | {
2494
+ input: {
2495
+ filter?: JsonObject;
2496
+ };
2497
+ operationId: "agents_list";
2498
+ } | {
2499
+ input: {
2500
+ idempotencyKey: string;
2501
+ input: unknown;
2502
+ } & AgentInvokeTarget;
2503
+ operationId: "agents_invoke";
2504
+ } | {
2505
+ input: {
2506
+ filter?: JsonObject;
2507
+ };
2508
+ operationId: "skills_list";
2509
+ } | {
2510
+ input: {
2511
+ idempotencyKey: string;
2512
+ input: unknown;
2513
+ skillId: string;
2514
+ };
2515
+ operationId: "skills_invoke";
2516
+ } | {
2517
+ input: {
2518
+ filter?: JsonObject;
2519
+ };
2520
+ operationId: "workflows_list";
2521
+ } | {
2522
+ input: {
2523
+ idempotencyKey: string;
2524
+ input: unknown;
2525
+ } & WorkflowInvokeTarget;
2526
+ operationId: "workflows_invoke";
2527
+ } | {
2528
+ input: {
2529
+ runId: string;
2530
+ };
2531
+ operationId: "runs_get";
2532
+ } | {
2533
+ input: {
2534
+ afterCursor?: string;
2535
+ runId: string;
2536
+ };
2537
+ operationId: "runs_stream";
2538
+ } | {
2539
+ input: {
2540
+ runId: string;
2541
+ };
2542
+ operationId: "runs_cancel";
2543
+ } | {
2544
+ input: {
2545
+ contentBase64: string;
2546
+ contentType: string;
2547
+ fileName: string;
2548
+ runId: string;
2549
+ sizeBytes: number;
2550
+ };
2551
+ operationId: "attachments_upload";
2552
+ } | {
2553
+ input: {
2554
+ attachmentId: string;
2555
+ runId: string;
2556
+ };
2557
+ operationId: "attachments_download_url";
2558
+ } | {
2559
+ input: {
2560
+ idempotencyKey: string;
2561
+ input: unknown;
2562
+ } & ConversationContinueTarget;
2563
+ operationId: "conversations_continue";
2564
+ } | {
2565
+ input: {
2566
+ conversationId: string;
2567
+ };
2568
+ operationId: "conversations_history";
2569
+ };
2570
+ interface EnvelopeSuccess<Id extends string, Result> {
2571
+ correlationId: string;
2572
+ operationId: Id;
2573
+ result: Result;
2574
+ }
2575
+ type ExternalApplicationOperationSuccess = EnvelopeSuccess<"context_get", JsonObject> | EnvelopeSuccess<"knowledge_query", JsonObject> | EnvelopeSuccess<"knowledge_get_entity_schema_snapshot", JsonObject> | EnvelopeSuccess<"knowledge_search_entities", JsonObject> | EnvelopeSuccess<"knowledge_facets", JsonObject> | EnvelopeSuccess<"knowledge_get_schema_query_context", JsonObject> | EnvelopeSuccess<"knowledge_autocomplete", JsonObject> | EnvelopeSuccess<"knowledge_get_entity", JsonObject> | EnvelopeSuccess<"knowledge_create_entity", JsonObject> | EnvelopeSuccess<"knowledge_update_entity", JsonObject> | EnvelopeSuccess<"knowledge_upsert_entity", JsonObject> | EnvelopeSuccess<"knowledge_delete_entity", JsonObject> | EnvelopeSuccess<"agents_list", JsonObject> | EnvelopeSuccess<"agents_invoke", {
2576
+ runId: string;
2577
+ }> | EnvelopeSuccess<"skills_list", JsonObject> | EnvelopeSuccess<"skills_invoke", {
2578
+ runId: string;
2579
+ }> | EnvelopeSuccess<"workflows_list", JsonObject> | EnvelopeSuccess<"workflows_invoke", {
2580
+ runId: string;
2581
+ }> | EnvelopeSuccess<"runs_get", JsonObject> | EnvelopeSuccess<"runs_stream", {
2582
+ events: JsonObject[];
2583
+ nextCursor: string | null;
2584
+ }> | EnvelopeSuccess<"runs_cancel", JsonObject> | EnvelopeSuccess<"attachments_upload", {
2585
+ attachmentId: string;
2586
+ }> | EnvelopeSuccess<"attachments_download_url", {
2587
+ expiresAt: string;
2588
+ url: string;
2589
+ }> | EnvelopeSuccess<"conversations_continue", {
2590
+ conversationId: string;
2591
+ runId: string;
2592
+ }> | EnvelopeSuccess<"conversations_history", ConversationHistory>;
2593
+ declare const storageFileIdBrand: unique symbol;
2594
+ /** A durable private file of the application's Organization. */
2595
+ type StorageFileId = string & Readonly<{
2596
+ [storageFileIdBrand]: "StorageFileId";
2597
+ }>;
2598
+ /**
2599
+ * One file of up to 10 MiB, base64-encoded. CI accepts the content types
2600
+ * `application/pdf`, `image/jpeg` and `image/png`.
2601
+ */
2602
+ interface DurableFileUpload {
2603
+ contentBase64: string;
2604
+ contentType: string;
2605
+ fileName: string;
2606
+ sizeBytes: number;
2607
+ }
2608
+ interface ExternalApplicationServiceOperationRequest {
2609
+ input: DurableFileUpload;
2610
+ operationId: "files_upload";
2611
+ }
2612
+ type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"files_upload", {
2613
+ storageFileId: StorageFileId;
2614
+ }>;
2615
+ /** Every operation a confidential server client may invoke. */
2616
+ type ExternalApplicationServerOperationRequest = ExternalApplicationOperationRequest | ExternalApplicationServiceOperationRequest;
2617
+ type ExternalApplicationOperationId = ExternalApplicationOperationRequest["operationId"];
2618
+ type ExternalApplicationServerOperationId = ExternalApplicationServerOperationRequest["operationId"];
2619
+ type ExternalApplicationOperationRequestFor<Id extends ExternalApplicationServerOperationId> = Extract<ExternalApplicationServerOperationRequest, {
2620
+ operationId: Id;
2621
+ }>;
2622
+ type ExternalApplicationOperationSuccessFor<Id extends ExternalApplicationServerOperationId> = Extract<ExternalApplicationOperationSuccess | ExternalApplicationServiceOperationSuccess, {
2623
+ operationId: Id;
2624
+ }>;
2625
+ type JsonValue = null | boolean | number | string | readonly JsonValue[] | Readonly<{
2626
+ [key: string]: JsonValue;
2627
+ }>;
2628
+ /** Codes of the Expected Errors that CI returns. The `CiErrorCode` Schema of `./effect` uses this list. */
2629
+ declare const ciErrorCodes: readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"];
2630
+ type CiErrorCode$1 = (typeof ciErrorCodes)[number];
2631
+ type CiError$1 = Readonly<{
2632
+ code: CiErrorCode$1;
2633
+ message: string;
2634
+ retryable: boolean;
2635
+ details?: Readonly<Record<string, JsonValue>>;
2636
+ }>;
2637
+ type CiResult<Value> = Readonly<{
2638
+ correlationId: string;
2639
+ ok: true;
2640
+ value: Value;
2641
+ }> | Readonly<{
2642
+ correlationId: string;
2643
+ error: CiError$1;
2644
+ ok: false;
2645
+ }>;
2646
+ /** One operation request; a chat operation takes its generated `path`, `query` and `body`. */
2647
+ type OperationRequest<Id extends ClientOperationId> = Id extends ExternalApplicationOperationId ? ExternalApplicationOperationRequestFor<Id> : {
2648
+ input: ClientOperationMap[Id]["input"];
2649
+ operationId: Id;
2650
+ };
2651
+ type OperationSuccess<Id extends ClientOperationId> = Id extends ExternalApplicationOperationId ? ExternalApplicationOperationSuccessFor<Id> : EnvelopeSuccess<Id, ClientOperationMap[Id]["output"]>;
2652
+ /** Code of an Expected Error that CI returns for an operation. */
2653
+ declare const CiErrorCode: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
2654
+ type CiErrorCode = typeof CiErrorCode.Type;
2655
+ /** Code of an Expected Error of the federated sign-in flow. */
2656
+ declare const FederatedAuthErrorCode: Schema.Literals<readonly ["configuration_error", "invalid_return_target", "invalid_callback", "invalid_state", "transaction_expired", "authorization_failed", "token_exchange_failed", "reauthorization_required"]>;
2657
+ type FederatedAuthErrorCode = typeof FederatedAuthErrorCode.Type;
2658
+ declare const CiError_base: Schema.Class<CiError, Schema.TaggedStruct<"CiError", {
2659
+ readonly code: Schema.Literals<readonly ["unauthenticated", "forbidden", "not_found", "conflict", "invalid_request", "rate_limited", "unavailable", "internal"]>;
2660
+ readonly details: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
2661
+ readonly message: Schema.String;
2662
+ readonly retryable: Schema.Boolean;
2663
+ }>, import("effect/Cause").YieldableError>;
2664
+ /** An Expected Error that CI returns for an operation. */
2665
+ declare class CiError extends CiError_base {}
2666
+ type FederatedAuthErrorFields = Readonly<{
2667
+ code: FederatedAuthErrorCode;
2668
+ message: string;
2669
+ }>;
2670
+ declare const FederatedAuthError_base: Schema.Class<FederatedAuthError, Schema.TaggedStruct<"FederatedAuthError", {
2671
+ readonly code: Schema.Literals<readonly ["configuration_error", "invalid_return_target", "invalid_callback", "invalid_state", "transaction_expired", "authorization_failed", "token_exchange_failed", "reauthorization_required"]>;
2672
+ readonly message: Schema.String;
2673
+ }>, import("effect/Cause").YieldableError>;
2674
+ /** An Expected Error of the federated sign-in flow. */
2675
+ declare class FederatedAuthError extends FederatedAuthError_base {
2676
+ constructor(fields: FederatedAuthErrorFields, options?: Schema.MakeOptions);
2677
+ /** The positional form that `.` callers used before the tagged class. */
2678
+ constructor(code: FederatedAuthErrorCode, message: string);
2679
+ }
2680
+ declare const CiTransportError_base: Schema.Class<CiTransportError, Schema.TaggedStruct<"CiTransportError", {
2681
+ readonly cause: Schema.Defect;
2682
+ }>, import("effect/Cause").YieldableError>;
2683
+ /** The request did not reach CI, or CI's response was not readable. */
2684
+ declare class CiTransportError extends CiTransportError_base {}
2685
+ /** Generated, curated external-application operation authority: the application and the chat operations. */
2686
+ declare const clientOperationIds: readonly ["context_get", "knowledge_query", "knowledge_get_entity_schema_snapshot", "knowledge_search_entities", "knowledge_facets", "knowledge_get_schema_query_context", "knowledge_autocomplete", "knowledge_get_entity", "knowledge_create_entity", "knowledge_update_entity", "knowledge_upsert_entity", "knowledge_delete_entity", "agents_list", "agents_invoke", "skills_list", "skills_invoke", "workflows_list", "workflows_invoke", "runs_get", "runs_stream", "runs_cancel", "attachments_upload", "attachments_download_url", "conversations_continue", "conversations_history", "chat_conversations_list", "chat_conversations_create", "chat_conversations_get", "chat_conversations_update", "chat_conversations_delete", "chat_conversations_transcript", "chat_turns_submit", "chat_turns_stream", "chat_turns_cancel", "chat_steering_messages_send", "chat_queued_messages_create", "chat_queued_messages_list", "chat_queued_messages_update", "chat_queued_messages_delete", "chat_place_context_get", "chat_presentation_get", "chat_presentation_stream", "chat_agents_list", "chat_skills_list", "chat_tools_list", "chat_agent_conversations_submit_turn", "chat_agent_conversations_cancel_turn", "chat_agent_conversations_close", "chat_attachments_upload", "chat_attachments_download_url", "chat_attachments_capabilities", "chat_feedback_upsert", "chat_feedback_clear", "chat_approvals_search_requests", "chat_approvals_search", "chat_approvals_get", "chat_approvals_decide", "chat_approvals_reject", "chat_approvals_withdraw", "chat_permissions_decide_wait", "chat_permissions_list", "chat_permissions_update", "chat_permissions_revoke", "chat_artifacts_progress", "chat_compaction_get", "chat_compaction_compact", "chat_compaction_regenerate", "chat_compaction_reset", "chat_evidence_resolve", "chat_interactions_respond", "chat_interactions_stream", "chat_projects_list", "chat_projects_create", "chat_projects_update", "chat_projects_delete", "chat_projects_list_files", "chat_projects_upload_file", "chat_projects_delete_file", "chat_projects_file_download_url", "chat_speech_create_clip", "chat_speech_transcribe", "chat_speech_availability", "chat_speech_read_aloud_part"];
2687
+ type ClientOperationId = ExternalApplicationOperationId | ExternalApplicationChatOperationId;
2688
+ declare const isClientOperationId: (value: string) => value is ClientOperationId;
2689
+ interface ClientOperationDefinition<Input, Output> {
2690
+ readonly input: Input;
2691
+ readonly output: Output;
2692
+ }
2693
+ type ClientOperationMap = Readonly<{ [Id in ExternalApplicationOperationId]: ClientOperationDefinition<ExternalApplicationOperationRequestFor<Id>["input"], ExternalApplicationOperationSuccessFor<Id>["result"]>; } & { [Id in ExternalApplicationChatOperationId]: ClientOperationDefinition<ExternalApplicationChatOperations[Id]["input"], ExternalApplicationChatOperations[Id]["output"]>; }>;
2694
+ type ClientOperationInput<Operations extends ClientOperationMap, Id extends ClientOperationId> = Operations[Id]["input"];
2695
+ type ClientOperationOutput<Operations extends ClientOperationMap, Id extends ClientOperationId> = Operations[Id]["output"];
2696
+ type OperationExecutionOptions = Readonly<{
2697
+ organizationId: string;
2698
+ signal?: AbortSignal;
2699
+ }>;
2700
+ interface TypedOperationExecutor<Operations extends ClientOperationMap> {
2701
+ readonly execute: <Id extends ClientOperationId>(operationId: Id, input: ClientOperationInput<Operations, Id>, options?: OperationExecutionOptions) => Promise<CiResult<ClientOperationOutput<Operations, Id>>>;
2702
+ }
2703
+ type ServerSessionAuthOptions = Readonly<{
2704
+ basePath: string;
2705
+ fetch?: ClientFetch;
2706
+ navigate?: (url: string) => void;
2707
+ now?: () => number;
2708
+ origin?: string;
2709
+ }>;
2710
+ /**
2711
+ * Browser session client for a sealed-cookie BFF. The access token never
2712
+ * leaves the server. A bad option throws `FederatedAuthError`
2713
+ * `configuration_error`. `close` disposes the runtime of the client.
2714
+ */
2715
+ declare const createServerSessionAuth: (options: ServerSessionAuthOptions) => FederatedAuth & Readonly<{
2716
+ close: () => Promise<void>;
2717
+ }>;
2718
+ type ReturnTarget = Readonly<{
2719
+ returnTo: string;
2720
+ }>;
2721
+ type FederatedAuthValue = Readonly<{
2722
+ beginLogin: (options: ReturnTarget) => Effect.Effect<string, FederatedAuthError>;
2723
+ completeLogin: (callbackUrl: string) => Effect.Effect<ReturnTarget, FederatedAuthError | CiTransportError>;
2724
+ getAccessToken: Effect.Effect<string, FederatedAuthError>;
2725
+ logout: Effect.Effect<void>;
2726
+ reauthorize: (options?: Readonly<{
2727
+ returnTo?: string;
2728
+ }>) => Effect.Effect<string, FederatedAuthError>;
2729
+ /** The current state, read at once. */
2730
+ getState: () => FederatedAuthState;
2731
+ /** Calls `listener` at each state change, in the call that changes it. */
2732
+ subscribe: (listener: (state: FederatedAuthState) => void) => () => void;
2733
+ /** Each state change, from the subscription on. */
2734
+ changes: Stream.Stream<FederatedAuthState>;
2735
+ }>;
2736
+ declare const FederatedAuth_base: Context.ServiceClass<FederatedAuth$1, "@collective-intelligence/external-apps-client-sdk/FederatedAuth", Readonly<{
2737
+ beginLogin: (options: ReturnTarget) => Effect.Effect<string, FederatedAuthError>;
2738
+ completeLogin: (callbackUrl: string) => Effect.Effect<ReturnTarget, FederatedAuthError | CiTransportError>;
2739
+ getAccessToken: Effect.Effect<string, FederatedAuthError>;
2740
+ logout: Effect.Effect<void>;
2741
+ reauthorize: (options?: Readonly<{
2742
+ returnTo?: string;
2743
+ }>) => Effect.Effect<string, FederatedAuthError>;
2744
+ /** The current state, read at once. */
2745
+ getState: () => FederatedAuthState;
2746
+ /** Calls `listener` at each state change, in the call that changes it. */
2747
+ subscribe: (listener: (state: FederatedAuthState) => void) => () => void;
2748
+ /** Each state change, from the subscription on. */
2749
+ changes: Stream.Stream<FederatedAuthState>;
2750
+ }>>;
2751
+ declare class FederatedAuth$1 extends FederatedAuth_base {}
2752
+ /** `FederatedAuth` of browser federated sign-in; a bad option fails with `configuration_error`. */
2753
+ declare const layerFederated: (options: FederatedAuthOptions) => Layer.Layer<FederatedAuth$1, FederatedAuthError, never>;
2754
+ /** `FederatedAuth` of a sealed-cookie BFF session; a bad option fails with `configuration_error`. */
2755
+ declare const layerServerSession: (options: ServerSessionAuthOptions) => Layer.Layer<FederatedAuth$1, FederatedAuthError, never>;
2756
+ /** `layerFederated` with options that Effect `Config` reads. */
2757
+ declare const layerFederatedConfig: (config: Config.Wrap<FederatedAuthOptions>) => Layer.Layer<FederatedAuth$1, Config.ConfigError | FederatedAuthError, never>;
2758
+ /** `layerServerSession` with options that Effect `Config` reads. */
2759
+ declare const layerServerSessionConfig: (config: Config.Wrap<ServerSessionAuthOptions>) => Layer.Layer<FederatedAuth$1, Config.ConfigError | FederatedAuthError, never>;
2760
+ /**
2761
+ * The signed-in CI user as the application's BFF reports it: the fields of
2762
+ * CI's `/oauth/identity`, read live by the server, plus email and name.
2763
+ */
2764
+ type FederatedSessionIdentity = Readonly<{
2765
+ appId: string;
2766
+ email: string | null;
2767
+ /**
2768
+ * A person is a member or a guest of one Organization, never both; null
2769
+ * for a tenant user without a membership.
2770
+ */
2771
+ kind: "member" | "guest" | null;
2772
+ name: string | null;
2773
+ organizationId: string;
2774
+ userId: string;
2775
+ }>;
2776
+ type FederatedAuthState = Readonly<{
2777
+ status: "anonymous";
2778
+ }> | Readonly<{
2779
+ status: "redirecting";
2780
+ }> | Readonly<{
2781
+ expiresAt: number;
2782
+ identity?: FederatedSessionIdentity;
2783
+ status: "authenticated";
2784
+ }> | Readonly<{
2785
+ status: "expired";
2786
+ }> | Readonly<{
2787
+ error: FederatedAuthError;
2788
+ status: "error";
2789
+ }>;
2790
+ type FederatedAuth = Readonly<{
2791
+ beginLogin: (options: Readonly<{
2792
+ returnTo: string;
2793
+ }>) => Promise<string>;
2794
+ completeLogin: (callbackUrl: string) => Promise<Readonly<{
2795
+ returnTo: string;
2796
+ }>>;
2797
+ getAccessToken: () => Promise<string>;
2798
+ getState: () => FederatedAuthState;
2799
+ logout: () => Promise<void>;
2800
+ reauthorize: (options?: Readonly<{
2801
+ returnTo?: string;
2802
+ }>) => Promise<string>;
2803
+ subscribe: (listener: (state: FederatedAuthState) => void) => () => void;
2804
+ }>;
2805
+ type ClientFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
2806
+ type FederatedAuthOptions = Readonly<{
2807
+ clientId: string;
2808
+ crypto?: Pick<Crypto, "getRandomValues" | "subtle">;
2809
+ fetch?: ClientFetch;
2810
+ navigate?: (url: string) => void;
2811
+ now?: () => number;
2812
+ redirectUri: string;
2813
+ sessionStorage?: Pick<Storage, "getItem" | "removeItem" | "setItem">;
2814
+ tenantUrl: string;
2815
+ }>;
2816
+ /**
2817
+ * Browser federated sign-in with PKCE; the access token stays in memory. A
2818
+ * bad option throws `FederatedAuthError` `configuration_error`. Methods
2819
+ * reject with `FederatedAuthError`, or with `CiTransportError` when the
2820
+ * tenant cannot be reached. `close` disposes the runtime of the client.
2821
+ */
2822
+ declare const createFederatedAuth: (options: FederatedAuthOptions) => FederatedAuth & Readonly<{
2823
+ close: () => Promise<void>;
2824
+ }>;
2825
+ type ProxyAuthentication = Readonly<{
2826
+ auth: Readonly<{
2827
+ getAccessToken: () => Promise<string> | string;
2828
+ }>;
2829
+ mode: "federated";
2830
+ }> | Readonly<{
2831
+ credentials?: RequestCredentials;
2832
+ mode: "server_delegated";
2833
+ }>;
2834
+ type ProxyTransportOptions = Readonly<{
2835
+ authentication: ProxyAuthentication;
2836
+ fetch?: ClientFetch;
2837
+ path: string;
2838
+ serverUrl: string;
2839
+ }>;
2840
+ /**
2841
+ * The Vanilla Facade of `CiClient.layerProxy`, in a runtime of its own;
2842
+ * `close` disposes it. A bad `serverUrl` or `path` throws `TypeError`.
2843
+ */
2844
+ declare const createProxyTransport: <Operations extends ClientOperationMap>(options: ProxyTransportOptions) => TypedOperationExecutor<Operations> & Readonly<{
2845
+ close: () => Promise<void>;
2846
+ }>;
2847
+ export { FederatedAuthError as A, ConversationHistory as B, OperationExecutionOptions as C, CiError as D, isClientOperationId as E, JsonValue as F, SearchQuery as G, JsonObject as H, OperationRequest as I, WorkflowInvokeTarget as K, OperationSuccess as L, CiError$1 as M, CiErrorCode$1 as N, CiErrorCode as O, CiResult as P, AgentInvokeTarget as R, ClientOperationOutput as S, clientOperationIds as T, KnowledgeQuery as U, ExternalApplicationChatOperationId as V, QueryFilter as W, createServerSessionAuth as _, FederatedAuth as a, ClientOperationInput as b, FederatedSessionIdentity as c, FederatedAuthValue as d, layerFederated as f, ServerSessionAuthOptions as g, layerServerSessionConfig as h, ClientFetch as i, FederatedAuthErrorCode as j, CiTransportError as k, createFederatedAuth as l, layerServerSession as m, ProxyTransportOptions as n, FederatedAuthOptions as o, layerFederatedConfig as p, createProxyTransport as r, FederatedAuthState as s, ProxyAuthentication as t, FederatedAuth$1 as u, ClientOperationDefinition as v, TypedOperationExecutor as w, ClientOperationMap as x, ClientOperationId as y, ConversationContinueTarget as z };