@operla-ai/sdk 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,23 +6,11 @@ export type ListData = {
6
6
  path?: never;
7
7
  query?: {
8
8
  /**
9
- * Filter: only list conversations linked to this entity.
9
+ * Target a specific entity (under the caller's organization).
10
10
  */
11
11
  entityId?: string;
12
- /**
13
- * Filter: only list conversations in this status.
14
- */
15
- status?: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
16
- /**
17
- * Max number of conversations to return (1-100, default 20).
18
- */
19
- limit?: number;
20
- /**
21
- * Number of conversations to skip for pagination (default 0).
22
- */
23
- offset?: number | null;
24
12
  };
25
- url: '/conversations';
13
+ url: '/agents';
26
14
  };
27
15
  export type ListErrors = {
28
16
  /**
@@ -62,88 +50,245 @@ export type ListResponses = {
62
50
  * Successful response
63
51
  */
64
52
  200: {
65
- /**
66
- * Conversations matching the query, sorted by last activity (most recent first).
67
- */
68
- conversations: Array<{
53
+ agents: Array<{
54
+ name: string;
55
+ label: string;
56
+ scope: {
57
+ level: 'global' | 'organization' | 'entity';
58
+ organizationId?: string;
59
+ entityId?: string;
60
+ };
69
61
  /**
70
- * Conversation ID (format: conv_xxxxxxxxxxxx).
62
+ * Version of the resolved config at this scope.
71
63
  */
72
- conversationId: string;
64
+ version: number;
73
65
  /**
74
- * Organization linked to the conversation (when you use organizations).
66
+ * True when an override draft exists at this scope.
75
67
  */
68
+ hasDraft: boolean;
69
+ }>;
70
+ };
71
+ };
72
+ export type ListResponse = ListResponses[keyof ListResponses];
73
+ export type CreateData = {
74
+ body?: {
75
+ /**
76
+ * Human-readable label shown in the dashboard. The machine name is derived from this (slugified, prefixed with `specialist_`).
77
+ */
78
+ label: string;
79
+ /**
80
+ * System prompt for the agent.
81
+ */
82
+ prompt: string;
83
+ /**
84
+ * Hard rules to attach to the agent at creation.
85
+ */
86
+ hardRules?: Array<{
87
+ name: string;
88
+ instruction: string;
89
+ triggers?: {
90
+ intents?: Array<string>;
91
+ };
92
+ priority?: number;
93
+ disabled?: boolean;
94
+ }>;
95
+ };
96
+ path?: never;
97
+ query?: never;
98
+ url: '/agents';
99
+ };
100
+ export type CreateErrors = {
101
+ /**
102
+ * Bad request
103
+ */
104
+ 400: {
105
+ statusCode: number;
106
+ error: {
107
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
108
+ message: string;
109
+ };
110
+ };
111
+ /**
112
+ * Authentication required
113
+ */
114
+ 401: {
115
+ statusCode: number;
116
+ error: {
117
+ code: 'AUTH';
118
+ message: string;
119
+ };
120
+ };
121
+ /**
122
+ * Insufficient permissions
123
+ */
124
+ 403: {
125
+ statusCode: number;
126
+ error: {
127
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
128
+ message: string;
129
+ };
130
+ };
131
+ };
132
+ export type CreateError = CreateErrors[keyof CreateErrors];
133
+ export type CreateResponses = {
134
+ /**
135
+ * Successful response
136
+ */
137
+ 200: {
138
+ name: string;
139
+ label: string;
140
+ scope: {
141
+ level: 'global' | 'organization' | 'entity';
76
142
  organizationId?: string;
77
- /**
78
- * Current lifecycle status of the conversation.
79
- */
80
- status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
81
- /**
82
- * Short human-readable subject computed from the first messages or the user's identity.
83
- */
84
- subject: string;
85
- /**
86
- * The person in the conversation, if identified. Null when no user is known yet.
87
- */
88
- user: {
89
- /**
90
- * Unique identifier of the person in the conversation, in your system.
91
- */
92
- userId: string;
93
- /**
94
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
95
- */
96
- resolved?: boolean;
97
- /**
98
- * Custom data attached to the user (name, email, account info, etc.).
99
- */
100
- data?: {
101
- [key: string]: unknown;
102
- };
103
- } | null;
104
- /**
105
- * Entity linked to the conversation (when you use entities).
106
- */
107
143
  entityId?: string;
108
- /**
109
- * Total number of messages exchanged so far (user + agent).
110
- */
111
- messageCount: number;
112
- /**
113
- * ISO timestamp of the last message, or null if no messages yet.
114
- */
115
- lastMessageAt: string | null;
116
- /**
117
- * ISO timestamp when the conversation was created.
118
- */
119
- createdAt: string;
120
- /**
121
- * ISO timestamp of the last modification (message, status change, etc.).
122
- */
123
- updatedAt: string;
124
- }>;
144
+ };
125
145
  /**
126
- * Total number of conversations matching the query (across all pages).
146
+ * The agent config the runtime sees at the request scope, after cascade resolution.
127
147
  */
128
- total: number;
148
+ resolved: {
149
+ version: number;
150
+ prompt?: string;
151
+ hardRules?: Array<{
152
+ name: string;
153
+ instruction: string;
154
+ triggers?: {
155
+ intents?: Array<string>;
156
+ };
157
+ priority?: number;
158
+ disabled?: boolean;
159
+ }>;
160
+ userContextConfig?: {
161
+ [key: string]: boolean;
162
+ };
163
+ responseConfig?: {
164
+ email?: {
165
+ greeting?: string;
166
+ signature?: string;
167
+ tone?: 'empathetic' | 'formal' | 'friendly';
168
+ addressForm?: 'formal' | 'informal';
169
+ allowEmojis?: boolean;
170
+ };
171
+ chat?: {
172
+ greeting?: string;
173
+ signature?: string;
174
+ tone?: 'empathetic' | 'formal' | 'friendly';
175
+ addressForm?: 'formal' | 'informal';
176
+ allowEmojis?: boolean;
177
+ };
178
+ };
179
+ message?: string;
180
+ publishedAt?: string;
181
+ updatedAt?: string;
182
+ };
129
183
  /**
130
- * Page size applied to this response.
184
+ * Override draft at this scope, when one exists.
131
185
  */
132
- limit: number;
186
+ draft?: {
187
+ version: number;
188
+ prompt?: string;
189
+ hardRules?: Array<{
190
+ name: string;
191
+ instruction: string;
192
+ triggers?: {
193
+ intents?: Array<string>;
194
+ };
195
+ priority?: number;
196
+ disabled?: boolean;
197
+ }>;
198
+ userContextConfig?: {
199
+ [key: string]: boolean;
200
+ };
201
+ responseConfig?: {
202
+ email?: {
203
+ greeting?: string;
204
+ signature?: string;
205
+ tone?: 'empathetic' | 'formal' | 'friendly';
206
+ addressForm?: 'formal' | 'informal';
207
+ allowEmojis?: boolean;
208
+ };
209
+ chat?: {
210
+ greeting?: string;
211
+ signature?: string;
212
+ tone?: 'empathetic' | 'formal' | 'friendly';
213
+ addressForm?: 'formal' | 'informal';
214
+ allowEmojis?: boolean;
215
+ };
216
+ };
217
+ message?: string;
218
+ publishedAt?: string;
219
+ updatedAt?: string;
220
+ };
221
+ };
222
+ };
223
+ export type CreateResponse = CreateResponses[keyof CreateResponses];
224
+ export type DeleteData = {
225
+ body?: never;
226
+ path: {
133
227
  /**
134
- * Offset applied to this response.
228
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
135
229
  */
136
- offset: number;
230
+ name: string;
137
231
  };
232
+ query?: never;
233
+ url: '/agents/{name}';
138
234
  };
139
- export type ListResponse = ListResponses[keyof ListResponses];
235
+ export type DeleteErrors = {
236
+ /**
237
+ * Bad request
238
+ */
239
+ 400: {
240
+ statusCode: number;
241
+ error: {
242
+ code: 'MISSING-ORG';
243
+ message: string;
244
+ };
245
+ };
246
+ /**
247
+ * Authentication required
248
+ */
249
+ 401: {
250
+ statusCode: number;
251
+ error: {
252
+ code: 'AUTH';
253
+ message: string;
254
+ };
255
+ };
256
+ /**
257
+ * Insufficient permissions
258
+ */
259
+ 403: {
260
+ statusCode: number;
261
+ error: {
262
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
263
+ message: string;
264
+ };
265
+ };
266
+ };
267
+ export type DeleteError = DeleteErrors[keyof DeleteErrors];
268
+ export type DeleteResponses = {
269
+ /**
270
+ * Successful response
271
+ */
272
+ 200: {
273
+ message: string;
274
+ };
275
+ };
276
+ export type DeleteResponse = DeleteResponses[keyof DeleteResponses];
140
277
  export type GetData = {
141
278
  body?: never;
142
279
  path: {
143
- conversationId: string;
280
+ /**
281
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
282
+ */
283
+ name: string;
144
284
  };
145
- query?: never;
146
- url: '/conversations/{conversationId}';
285
+ query?: {
286
+ /**
287
+ * Target a specific entity (under the caller's organization).
288
+ */
289
+ entityId?: string;
290
+ };
291
+ url: '/agents/{name}';
147
292
  };
148
293
  export type GetErrors = {
149
294
  /**
@@ -152,7 +297,7 @@ export type GetErrors = {
152
297
  400: {
153
298
  statusCode: number;
154
299
  error: {
155
- code: 'MISSING-ORG';
300
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
156
301
  message: string;
157
302
  };
158
303
  };
@@ -183,159 +328,1531 @@ export type GetResponses = {
183
328
  * Successful response
184
329
  */
185
330
  200: {
331
+ name: string;
332
+ label: string;
333
+ scope: {
334
+ level: 'global' | 'organization' | 'entity';
335
+ organizationId?: string;
336
+ entityId?: string;
337
+ };
186
338
  /**
187
- * Conversation ID (format: conv_xxxxxxxxxxxx).
339
+ * The agent config the runtime sees at the request scope, after cascade resolution.
188
340
  */
189
- conversationId: string;
341
+ resolved: {
342
+ version: number;
343
+ prompt?: string;
344
+ hardRules?: Array<{
345
+ name: string;
346
+ instruction: string;
347
+ triggers?: {
348
+ intents?: Array<string>;
349
+ };
350
+ priority?: number;
351
+ disabled?: boolean;
352
+ }>;
353
+ userContextConfig?: {
354
+ [key: string]: boolean;
355
+ };
356
+ responseConfig?: {
357
+ email?: {
358
+ greeting?: string;
359
+ signature?: string;
360
+ tone?: 'empathetic' | 'formal' | 'friendly';
361
+ addressForm?: 'formal' | 'informal';
362
+ allowEmojis?: boolean;
363
+ };
364
+ chat?: {
365
+ greeting?: string;
366
+ signature?: string;
367
+ tone?: 'empathetic' | 'formal' | 'friendly';
368
+ addressForm?: 'formal' | 'informal';
369
+ allowEmojis?: boolean;
370
+ };
371
+ };
372
+ message?: string;
373
+ publishedAt?: string;
374
+ updatedAt?: string;
375
+ };
190
376
  /**
191
- * Organization linked to the conversation (when you use organizations).
377
+ * Override draft at this scope, when one exists.
192
378
  */
193
- organizationId?: string;
379
+ draft?: {
380
+ version: number;
381
+ prompt?: string;
382
+ hardRules?: Array<{
383
+ name: string;
384
+ instruction: string;
385
+ triggers?: {
386
+ intents?: Array<string>;
387
+ };
388
+ priority?: number;
389
+ disabled?: boolean;
390
+ }>;
391
+ userContextConfig?: {
392
+ [key: string]: boolean;
393
+ };
394
+ responseConfig?: {
395
+ email?: {
396
+ greeting?: string;
397
+ signature?: string;
398
+ tone?: 'empathetic' | 'formal' | 'friendly';
399
+ addressForm?: 'formal' | 'informal';
400
+ allowEmojis?: boolean;
401
+ };
402
+ chat?: {
403
+ greeting?: string;
404
+ signature?: string;
405
+ tone?: 'empathetic' | 'formal' | 'friendly';
406
+ addressForm?: 'formal' | 'informal';
407
+ allowEmojis?: boolean;
408
+ };
409
+ };
410
+ message?: string;
411
+ publishedAt?: string;
412
+ updatedAt?: string;
413
+ };
414
+ };
415
+ };
416
+ export type GetResponse = GetResponses[keyof GetResponses];
417
+ export type UpdateData = {
418
+ body?: {
194
419
  /**
195
- * Current lifecycle status of the conversation.
420
+ * System prompt for the agent.
196
421
  */
197
- status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
422
+ prompt?: string;
198
423
  /**
199
- * Short human-readable subject computed from the first messages or the user's identity.
424
+ * Hard rules enforced after the LLM call. Names act as merge keys when overriding the cascade.
200
425
  */
201
- subject: string;
426
+ hardRules?: Array<{
427
+ name: string;
428
+ instruction: string;
429
+ triggers?: {
430
+ intents?: Array<string>;
431
+ };
432
+ priority?: number;
433
+ disabled?: boolean;
434
+ }>;
202
435
  /**
203
- * The person in the conversation, if identified. Null when no user is known yet.
436
+ * Toggle which user-context fields are exposed to the agent.
204
437
  */
205
- user: {
206
- /**
207
- * Unique identifier of the person in the conversation, in your system.
208
- */
209
- userId: string;
210
- /**
211
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
212
- */
213
- resolved?: boolean;
214
- /**
215
- * Custom data attached to the user (name, email, account info, etc.).
216
- */
217
- data?: {
218
- [key: string]: unknown;
219
- };
220
- } | null;
438
+ userContextConfig?: {
439
+ [key: string]: boolean;
440
+ };
221
441
  /**
222
- * Entity linked to the conversation (when you use entities).
442
+ * Per-channel writing style. Only meaningful on the response agent. Sparse: omitted fields inherit from the cascade.
223
443
  */
224
- entityId?: string;
444
+ responseConfig?: {
445
+ email?: {
446
+ greeting?: string;
447
+ signature?: string;
448
+ tone?: 'empathetic' | 'formal' | 'friendly';
449
+ addressForm?: 'formal' | 'informal';
450
+ allowEmojis?: boolean;
451
+ };
452
+ chat?: {
453
+ greeting?: string;
454
+ signature?: string;
455
+ tone?: 'empathetic' | 'formal' | 'friendly';
456
+ addressForm?: 'formal' | 'informal';
457
+ allowEmojis?: boolean;
458
+ };
459
+ };
225
460
  /**
226
- * Total number of messages exchanged so far (user + agent).
461
+ * When true, the changes are written to draft and immediately promoted to published (a version snapshot is still created so rollback remains possible). When false (default), the changes stay in draft until you publish them via the dashboard.
227
462
  */
228
- messageCount: number;
463
+ publish?: boolean;
464
+ };
465
+ path: {
229
466
  /**
230
- * ISO timestamp of the last message, or null if no messages yet.
467
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
231
468
  */
232
- lastMessageAt: string | null;
469
+ name: string;
470
+ };
471
+ query?: {
233
472
  /**
234
- * ISO timestamp when the conversation was created.
473
+ * Target a specific entity (under the caller's organization).
235
474
  */
236
- createdAt: string;
475
+ entityId?: string;
476
+ };
477
+ url: '/agents/{name}';
478
+ };
479
+ export type UpdateErrors = {
480
+ /**
481
+ * Bad request
482
+ */
483
+ 400: {
484
+ statusCode: number;
485
+ error: {
486
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
487
+ message: string;
488
+ };
489
+ };
490
+ /**
491
+ * Authentication required
492
+ */
493
+ 401: {
494
+ statusCode: number;
495
+ error: {
496
+ code: 'AUTH';
497
+ message: string;
498
+ };
499
+ };
500
+ /**
501
+ * Insufficient permissions
502
+ */
503
+ 403: {
504
+ statusCode: number;
505
+ error: {
506
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
507
+ message: string;
508
+ };
509
+ };
510
+ };
511
+ export type UpdateError = UpdateErrors[keyof UpdateErrors];
512
+ export type UpdateResponses = {
513
+ /**
514
+ * Successful response
515
+ */
516
+ 200: {
517
+ name: string;
518
+ label: string;
519
+ scope: {
520
+ level: 'global' | 'organization' | 'entity';
521
+ organizationId?: string;
522
+ entityId?: string;
523
+ };
237
524
  /**
238
- * ISO timestamp of the last modification (message, status change, etc.).
525
+ * The agent config the runtime sees at the request scope, after cascade resolution.
239
526
  */
240
- updatedAt: string;
527
+ resolved: {
528
+ version: number;
529
+ prompt?: string;
530
+ hardRules?: Array<{
531
+ name: string;
532
+ instruction: string;
533
+ triggers?: {
534
+ intents?: Array<string>;
535
+ };
536
+ priority?: number;
537
+ disabled?: boolean;
538
+ }>;
539
+ userContextConfig?: {
540
+ [key: string]: boolean;
541
+ };
542
+ responseConfig?: {
543
+ email?: {
544
+ greeting?: string;
545
+ signature?: string;
546
+ tone?: 'empathetic' | 'formal' | 'friendly';
547
+ addressForm?: 'formal' | 'informal';
548
+ allowEmojis?: boolean;
549
+ };
550
+ chat?: {
551
+ greeting?: string;
552
+ signature?: string;
553
+ tone?: 'empathetic' | 'formal' | 'friendly';
554
+ addressForm?: 'formal' | 'informal';
555
+ allowEmojis?: boolean;
556
+ };
557
+ };
558
+ message?: string;
559
+ publishedAt?: string;
560
+ updatedAt?: string;
561
+ };
241
562
  /**
242
- * Full message history in chronological order.
563
+ * Override draft at this scope, when one exists.
243
564
  */
244
- thread: Array<{
245
- /**
246
- * Who emitted the message — the user or your AI agent.
247
- */
248
- role: 'user' | 'agent';
249
- /**
250
- * Message body.
251
- */
252
- content: string;
253
- /**
254
- * ISO timestamp when the message was recorded.
255
- */
256
- timestamp: string;
257
- /**
258
- * Display name of the author (when available).
259
- */
260
- authorName?: string;
261
- }>;
565
+ draft?: {
566
+ version: number;
567
+ prompt?: string;
568
+ hardRules?: Array<{
569
+ name: string;
570
+ instruction: string;
571
+ triggers?: {
572
+ intents?: Array<string>;
573
+ };
574
+ priority?: number;
575
+ disabled?: boolean;
576
+ }>;
577
+ userContextConfig?: {
578
+ [key: string]: boolean;
579
+ };
580
+ responseConfig?: {
581
+ email?: {
582
+ greeting?: string;
583
+ signature?: string;
584
+ tone?: 'empathetic' | 'formal' | 'friendly';
585
+ addressForm?: 'formal' | 'informal';
586
+ allowEmojis?: boolean;
587
+ };
588
+ chat?: {
589
+ greeting?: string;
590
+ signature?: string;
591
+ tone?: 'empathetic' | 'formal' | 'friendly';
592
+ addressForm?: 'formal' | 'informal';
593
+ allowEmojis?: boolean;
594
+ };
595
+ };
596
+ message?: string;
597
+ publishedAt?: string;
598
+ updatedAt?: string;
599
+ };
600
+ };
601
+ };
602
+ export type UpdateResponse = UpdateResponses[keyof UpdateResponses];
603
+ export type DeleteOverrideData = {
604
+ body?: never;
605
+ path: {
262
606
  /**
263
- * Origin tag provided when the conversation was created.
607
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
264
608
  */
265
- source?: string;
609
+ name: string;
610
+ };
611
+ query?: {
266
612
  /**
267
- * Cross-reference ID in your external ticketing system (e.g. Zendesk), when applicable.
613
+ * Target a specific entity (under the caller's organization).
268
614
  */
269
- externalTicketId?: string;
615
+ entityId?: string;
270
616
  };
617
+ url: '/agents/{name}/overrides';
271
618
  };
272
- export type GetResponse = GetResponses[keyof GetResponses];
273
- export type SendMessageData = {
619
+ export type DeleteOverrideErrors = {
620
+ /**
621
+ * Bad request
622
+ */
623
+ 400: {
624
+ statusCode: number;
625
+ error: {
626
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
627
+ message: string;
628
+ };
629
+ };
630
+ /**
631
+ * Authentication required
632
+ */
633
+ 401: {
634
+ statusCode: number;
635
+ error: {
636
+ code: 'AUTH';
637
+ message: string;
638
+ };
639
+ };
640
+ /**
641
+ * Insufficient permissions
642
+ */
643
+ 403: {
644
+ statusCode: number;
645
+ error: {
646
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
647
+ message: string;
648
+ };
649
+ };
650
+ };
651
+ export type DeleteOverrideError = DeleteOverrideErrors[keyof DeleteOverrideErrors];
652
+ export type DeleteOverrideResponses = {
653
+ /**
654
+ * Successful response
655
+ */
656
+ 200: {
657
+ message: string;
658
+ };
659
+ };
660
+ export type DeleteOverrideResponse = DeleteOverrideResponses[keyof DeleteOverrideResponses];
661
+ export type PublishData = {
274
662
  body?: {
275
663
  /**
276
- * Message text sent by the user.
664
+ * Optional changelog message attached to the new version.
277
665
  */
278
- message: string;
666
+ message?: string;
667
+ };
668
+ path: {
279
669
  /**
280
- * Conversation ID (format: conv_xxxxxxxxxxxx). Omit on the first call — the server generates one and returns it.
670
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
281
671
  */
282
- conversationId?: string;
672
+ name: string;
673
+ };
674
+ query?: {
283
675
  /**
284
- * Link the conversation to an entity (only applied when creating the conversation; ignored on subsequent messages for the same conversationId).
676
+ * Target a specific entity (under the caller's organization).
285
677
  */
286
678
  entityId?: string;
679
+ };
680
+ url: '/agents/{name}/publish';
681
+ };
682
+ export type PublishErrors = {
683
+ /**
684
+ * Bad request
685
+ */
686
+ 400: {
687
+ statusCode: number;
688
+ error: {
689
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
690
+ message: string;
691
+ };
692
+ };
693
+ /**
694
+ * Authentication required
695
+ */
696
+ 401: {
697
+ statusCode: number;
698
+ error: {
699
+ code: 'AUTH';
700
+ message: string;
701
+ };
702
+ };
703
+ /**
704
+ * Insufficient permissions
705
+ */
706
+ 403: {
707
+ statusCode: number;
708
+ error: {
709
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
710
+ message: string;
711
+ };
712
+ };
713
+ };
714
+ export type PublishError = PublishErrors[keyof PublishErrors];
715
+ export type PublishResponses = {
716
+ /**
717
+ * Successful response
718
+ */
719
+ 200: {
720
+ name: string;
721
+ label: string;
722
+ scope: {
723
+ level: 'global' | 'organization' | 'entity';
724
+ organizationId?: string;
725
+ entityId?: string;
726
+ };
287
727
  /**
288
- * The user sending the message. Set `resolved: true` on the user object to skip identity resolution when you already have a complete profile.
728
+ * The agent config the runtime sees at the request scope, after cascade resolution.
289
729
  */
290
- user?: {
291
- /**
292
- * Unique identifier of the person in the conversation, in your system.
293
- */
294
- userId: string;
295
- /**
296
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
297
- */
298
- resolved?: boolean;
299
- /**
300
- * Custom data attached to the user (name, email, account info, etc.).
301
- */
302
- data?: {
303
- [key: string]: unknown;
730
+ resolved: {
731
+ version: number;
732
+ prompt?: string;
733
+ hardRules?: Array<{
734
+ name: string;
735
+ instruction: string;
736
+ triggers?: {
737
+ intents?: Array<string>;
738
+ };
739
+ priority?: number;
740
+ disabled?: boolean;
741
+ }>;
742
+ userContextConfig?: {
743
+ [key: string]: boolean;
304
744
  };
745
+ responseConfig?: {
746
+ email?: {
747
+ greeting?: string;
748
+ signature?: string;
749
+ tone?: 'empathetic' | 'formal' | 'friendly';
750
+ addressForm?: 'formal' | 'informal';
751
+ allowEmojis?: boolean;
752
+ };
753
+ chat?: {
754
+ greeting?: string;
755
+ signature?: string;
756
+ tone?: 'empathetic' | 'formal' | 'friendly';
757
+ addressForm?: 'formal' | 'informal';
758
+ allowEmojis?: boolean;
759
+ };
760
+ };
761
+ message?: string;
762
+ publishedAt?: string;
763
+ updatedAt?: string;
764
+ };
765
+ /**
766
+ * Override draft at this scope, when one exists.
767
+ */
768
+ draft?: {
769
+ version: number;
770
+ prompt?: string;
771
+ hardRules?: Array<{
772
+ name: string;
773
+ instruction: string;
774
+ triggers?: {
775
+ intents?: Array<string>;
776
+ };
777
+ priority?: number;
778
+ disabled?: boolean;
779
+ }>;
780
+ userContextConfig?: {
781
+ [key: string]: boolean;
782
+ };
783
+ responseConfig?: {
784
+ email?: {
785
+ greeting?: string;
786
+ signature?: string;
787
+ tone?: 'empathetic' | 'formal' | 'friendly';
788
+ addressForm?: 'formal' | 'informal';
789
+ allowEmojis?: boolean;
790
+ };
791
+ chat?: {
792
+ greeting?: string;
793
+ signature?: string;
794
+ tone?: 'empathetic' | 'formal' | 'friendly';
795
+ addressForm?: 'formal' | 'informal';
796
+ allowEmojis?: boolean;
797
+ };
798
+ };
799
+ message?: string;
800
+ publishedAt?: string;
801
+ updatedAt?: string;
802
+ };
803
+ };
804
+ };
805
+ export type PublishResponse = PublishResponses[keyof PublishResponses];
806
+ export type RollbackData = {
807
+ body?: {
808
+ /**
809
+ * Archived version number to restore as the new published.
810
+ */
811
+ targetVersion: number;
812
+ };
813
+ path: {
814
+ /**
815
+ * Agent name (e.g. `orchestrator`, `response`, `specialist_billing`).
816
+ */
817
+ name: string;
818
+ };
819
+ query?: {
820
+ /**
821
+ * Target a specific entity (under the caller's organization).
822
+ */
823
+ entityId?: string;
824
+ };
825
+ url: '/agents/{name}/rollback';
826
+ };
827
+ export type RollbackErrors = {
828
+ /**
829
+ * Bad request
830
+ */
831
+ 400: {
832
+ statusCode: number;
833
+ error: {
834
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
835
+ message: string;
836
+ };
837
+ };
838
+ /**
839
+ * Authentication required
840
+ */
841
+ 401: {
842
+ statusCode: number;
843
+ error: {
844
+ code: 'AUTH';
845
+ message: string;
305
846
  };
847
+ };
848
+ /**
849
+ * Insufficient permissions
850
+ */
851
+ 403: {
852
+ statusCode: number;
853
+ error: {
854
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
855
+ message: string;
856
+ };
857
+ };
858
+ };
859
+ export type RollbackError = RollbackErrors[keyof RollbackErrors];
860
+ export type RollbackResponses = {
861
+ /**
862
+ * Successful response
863
+ */
864
+ 200: {
865
+ name: string;
866
+ label: string;
867
+ scope: {
868
+ level: 'global' | 'organization' | 'entity';
869
+ organizationId?: string;
870
+ entityId?: string;
871
+ };
872
+ /**
873
+ * The agent config the runtime sees at the request scope, after cascade resolution.
874
+ */
875
+ resolved: {
876
+ version: number;
877
+ prompt?: string;
878
+ hardRules?: Array<{
879
+ name: string;
880
+ instruction: string;
881
+ triggers?: {
882
+ intents?: Array<string>;
883
+ };
884
+ priority?: number;
885
+ disabled?: boolean;
886
+ }>;
887
+ userContextConfig?: {
888
+ [key: string]: boolean;
889
+ };
890
+ responseConfig?: {
891
+ email?: {
892
+ greeting?: string;
893
+ signature?: string;
894
+ tone?: 'empathetic' | 'formal' | 'friendly';
895
+ addressForm?: 'formal' | 'informal';
896
+ allowEmojis?: boolean;
897
+ };
898
+ chat?: {
899
+ greeting?: string;
900
+ signature?: string;
901
+ tone?: 'empathetic' | 'formal' | 'friendly';
902
+ addressForm?: 'formal' | 'informal';
903
+ allowEmojis?: boolean;
904
+ };
905
+ };
906
+ message?: string;
907
+ publishedAt?: string;
908
+ updatedAt?: string;
909
+ };
910
+ /**
911
+ * Override draft at this scope, when one exists.
912
+ */
913
+ draft?: {
914
+ version: number;
915
+ prompt?: string;
916
+ hardRules?: Array<{
917
+ name: string;
918
+ instruction: string;
919
+ triggers?: {
920
+ intents?: Array<string>;
921
+ };
922
+ priority?: number;
923
+ disabled?: boolean;
924
+ }>;
925
+ userContextConfig?: {
926
+ [key: string]: boolean;
927
+ };
928
+ responseConfig?: {
929
+ email?: {
930
+ greeting?: string;
931
+ signature?: string;
932
+ tone?: 'empathetic' | 'formal' | 'friendly';
933
+ addressForm?: 'formal' | 'informal';
934
+ allowEmojis?: boolean;
935
+ };
936
+ chat?: {
937
+ greeting?: string;
938
+ signature?: string;
939
+ tone?: 'empathetic' | 'formal' | 'friendly';
940
+ addressForm?: 'formal' | 'informal';
941
+ allowEmojis?: boolean;
942
+ };
943
+ };
944
+ message?: string;
945
+ publishedAt?: string;
946
+ updatedAt?: string;
947
+ };
948
+ };
949
+ };
950
+ export type RollbackResponse = RollbackResponses[keyof RollbackResponses];
951
+ export type List2Data = {
952
+ body?: never;
953
+ path?: never;
954
+ query?: {
955
+ /**
956
+ * Max number of items to return per page (1-100).
957
+ */
958
+ limit?: number;
959
+ /**
960
+ * Number of items to skip for pagination.
961
+ */
962
+ offset?: number | null;
963
+ /**
964
+ * Target a specific entity (under the caller's organization).
965
+ */
966
+ entityId?: string;
967
+ /**
968
+ * Only list conversations in this status.
969
+ */
970
+ status?: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
971
+ };
972
+ url: '/conversations';
973
+ };
974
+ export type List2Errors = {
975
+ /**
976
+ * Bad request
977
+ */
978
+ 400: {
979
+ statusCode: number;
980
+ error: {
981
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
982
+ message: string;
983
+ };
984
+ };
985
+ /**
986
+ * Authentication required
987
+ */
988
+ 401: {
989
+ statusCode: number;
990
+ error: {
991
+ code: 'AUTH';
992
+ message: string;
993
+ };
994
+ };
995
+ /**
996
+ * Insufficient permissions
997
+ */
998
+ 403: {
999
+ statusCode: number;
1000
+ error: {
1001
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1002
+ message: string;
1003
+ };
1004
+ };
1005
+ };
1006
+ export type List2Error = List2Errors[keyof List2Errors];
1007
+ export type List2Responses = {
1008
+ /**
1009
+ * Successful response
1010
+ */
1011
+ 200: {
1012
+ conversations: Array<{
1013
+ /**
1014
+ * Conversation ID (format: conv_xxxxxxxxxxxx).
1015
+ */
1016
+ conversationId: string;
1017
+ /**
1018
+ * Organization linked to the conversation (when you use organizations).
1019
+ */
1020
+ organizationId?: string;
1021
+ /**
1022
+ * Current lifecycle status of the conversation.
1023
+ */
1024
+ status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
1025
+ /**
1026
+ * Short human-readable subject computed from the first messages or the user's identity.
1027
+ */
1028
+ subject: string;
1029
+ /**
1030
+ * The person in the conversation, if identified. Null when no user is known yet. Custom user `data` is omitted here — fetch a single conversation to get it.
1031
+ */
1032
+ user: {
1033
+ /**
1034
+ * Unique identifier of the person in the conversation, in your system.
1035
+ */
1036
+ userId: string;
1037
+ /**
1038
+ * Whether the user is fully identified.
1039
+ */
1040
+ resolved?: boolean;
1041
+ } | null;
1042
+ /**
1043
+ * Entity linked to the conversation (when you use entities).
1044
+ */
1045
+ entityId?: string;
1046
+ /**
1047
+ * Total number of messages exchanged so far (user + agent).
1048
+ */
1049
+ messageCount: number;
1050
+ /**
1051
+ * ISO timestamp of the last message, or null if no messages yet.
1052
+ */
1053
+ lastMessageAt: string | null;
1054
+ /**
1055
+ * ISO timestamp when the conversation was created.
1056
+ */
1057
+ createdAt: string;
1058
+ /**
1059
+ * ISO timestamp of the last modification (message, status change, etc.).
1060
+ */
1061
+ updatedAt: string;
1062
+ }>;
1063
+ /**
1064
+ * Total number of items matching the query.
1065
+ */
1066
+ total: number;
1067
+ /**
1068
+ * Page size applied to this response.
1069
+ */
1070
+ limit: number;
1071
+ /**
1072
+ * Offset applied to this response.
1073
+ */
1074
+ offset: number;
1075
+ };
1076
+ };
1077
+ export type List2Response = List2Responses[keyof List2Responses];
1078
+ export type Get2Data = {
1079
+ body?: never;
1080
+ path: {
1081
+ /**
1082
+ * Conversation ID (format: `conv_xxxxxxxxxxxx`).
1083
+ */
1084
+ conversationId: string;
1085
+ };
1086
+ query?: never;
1087
+ url: '/conversations/{conversationId}';
1088
+ };
1089
+ export type Get2Errors = {
1090
+ /**
1091
+ * Bad request
1092
+ */
1093
+ 400: {
1094
+ statusCode: number;
1095
+ error: {
1096
+ code: 'MISSING-ORG';
1097
+ message: string;
1098
+ };
1099
+ };
1100
+ /**
1101
+ * Authentication required
1102
+ */
1103
+ 401: {
1104
+ statusCode: number;
1105
+ error: {
1106
+ code: 'AUTH';
1107
+ message: string;
1108
+ };
1109
+ };
1110
+ /**
1111
+ * Insufficient permissions
1112
+ */
1113
+ 403: {
1114
+ statusCode: number;
1115
+ error: {
1116
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1117
+ message: string;
1118
+ };
1119
+ };
1120
+ };
1121
+ export type Get2Error = Get2Errors[keyof Get2Errors];
1122
+ export type Get2Responses = {
1123
+ /**
1124
+ * Successful response
1125
+ */
1126
+ 200: {
1127
+ /**
1128
+ * Conversation ID (format: conv_xxxxxxxxxxxx).
1129
+ */
1130
+ conversationId: string;
1131
+ /**
1132
+ * Organization linked to the conversation (when you use organizations).
1133
+ */
1134
+ organizationId?: string;
1135
+ /**
1136
+ * Current lifecycle status of the conversation.
1137
+ */
1138
+ status: 'pending' | 'processing' | 'awaiting_validation' | 'awaiting_user' | 'resolved' | 'closed' | 'failed' | 'escalated' | 'spam';
1139
+ /**
1140
+ * Short human-readable subject computed from the first messages or the user's identity.
1141
+ */
1142
+ subject: string;
1143
+ /**
1144
+ * The person in the conversation, if identified. Null when no user is known yet.
1145
+ */
1146
+ user: {
1147
+ /**
1148
+ * Unique identifier of the person in the conversation, in your system.
1149
+ */
1150
+ userId: string;
1151
+ /**
1152
+ * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
1153
+ */
1154
+ resolved?: boolean;
1155
+ /**
1156
+ * Custom data attached to the user (name, email, account info, etc.).
1157
+ */
1158
+ data?: {
1159
+ [key: string]: unknown;
1160
+ };
1161
+ } | null;
1162
+ /**
1163
+ * Entity linked to the conversation (when you use entities).
1164
+ */
1165
+ entityId?: string;
1166
+ /**
1167
+ * Total number of messages exchanged so far (user + agent).
1168
+ */
1169
+ messageCount: number;
1170
+ /**
1171
+ * ISO timestamp of the last message, or null if no messages yet.
1172
+ */
1173
+ lastMessageAt: string | null;
1174
+ /**
1175
+ * ISO timestamp when the conversation was created.
1176
+ */
1177
+ createdAt: string;
1178
+ /**
1179
+ * ISO timestamp of the last modification (message, status change, etc.).
1180
+ */
1181
+ updatedAt: string;
1182
+ /**
1183
+ * Full message history in chronological order.
1184
+ */
1185
+ thread: Array<{
1186
+ /**
1187
+ * Who emitted the message — the user or your AI agent.
1188
+ */
1189
+ role: 'user' | 'agent';
1190
+ /**
1191
+ * Message body.
1192
+ */
1193
+ content: string;
1194
+ /**
1195
+ * ISO timestamp when the message was recorded.
1196
+ */
1197
+ timestamp: string;
1198
+ /**
1199
+ * Display name of the author (when available).
1200
+ */
1201
+ authorName?: string;
1202
+ }>;
1203
+ /**
1204
+ * Origin tag provided when the conversation was created.
1205
+ */
1206
+ source?: string;
1207
+ /**
1208
+ * Cross-reference ID in your external ticketing system (e.g. Zendesk), when applicable.
1209
+ */
1210
+ externalTicketId?: string;
1211
+ };
1212
+ };
1213
+ export type Get2Response = Get2Responses[keyof Get2Responses];
1214
+ export type SendMessageData = {
1215
+ body?: {
1216
+ /**
1217
+ * Message text sent by the user.
1218
+ */
1219
+ message: string;
1220
+ /**
1221
+ * Conversation ID (format: conv_xxxxxxxxxxxx). Omit on the first call — the server generates one and returns it.
1222
+ */
1223
+ conversationId?: string;
1224
+ /**
1225
+ * Link the conversation to an entity (only applied when creating the conversation; ignored on subsequent messages for the same conversationId).
1226
+ */
1227
+ entityId?: string;
1228
+ /**
1229
+ * The user sending the message. Set `resolved: true` on the user object to skip identity resolution when you already have a complete profile.
1230
+ */
1231
+ user?: {
1232
+ /**
1233
+ * Unique identifier of the person in the conversation, in your system.
1234
+ */
1235
+ userId: string;
1236
+ /**
1237
+ * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
1238
+ */
1239
+ resolved?: boolean;
1240
+ /**
1241
+ * Custom data attached to the user (name, email, account info, etc.).
1242
+ */
1243
+ data?: {
1244
+ [key: string]: unknown;
1245
+ };
1246
+ };
1247
+ /**
1248
+ * Overrides the configured KBs for this message. Not stored.
1249
+ */
1250
+ kbArticles?: Array<{
1251
+ /**
1252
+ * Article title shown to the agent.
1253
+ */
1254
+ title: string;
1255
+ /**
1256
+ * Article body (markdown-friendly).
1257
+ */
1258
+ content: string;
1259
+ /**
1260
+ * Intent identifiers this article serves. Empty or omitted = always-on. Otherwise the article is only injected when one of these intents is detected on the message.
1261
+ */
1262
+ intents?: Array<string>;
1263
+ }>;
1264
+ /**
1265
+ * Origin tag for the conversation (e.g. "website", "chat_page"). Stored on the conversation for analytics.
1266
+ */
1267
+ source?: string;
1268
+ /**
1269
+ * Custom key/value pairs attached to the conversation. Available as variables in your agent prompts.
1270
+ */
1271
+ metadata?: {
1272
+ [key: string]: string;
1273
+ };
1274
+ };
1275
+ path?: never;
1276
+ query?: never;
1277
+ url: '/conversations/messages';
1278
+ };
1279
+ export type SendMessageErrors = {
1280
+ /**
1281
+ * Bad request
1282
+ */
1283
+ 400: {
1284
+ statusCode: number;
1285
+ error: {
1286
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1287
+ message: string;
1288
+ };
1289
+ };
1290
+ /**
1291
+ * Authentication required
1292
+ */
1293
+ 401: {
1294
+ statusCode: number;
1295
+ error: {
1296
+ code: 'AUTH';
1297
+ message: string;
1298
+ };
1299
+ };
1300
+ /**
1301
+ * Insufficient permissions
1302
+ */
1303
+ 403: {
1304
+ statusCode: number;
1305
+ error: {
1306
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1307
+ message: string;
1308
+ };
1309
+ };
1310
+ };
1311
+ export type SendMessageError = SendMessageErrors[keyof SendMessageErrors];
1312
+ export type SendMessageResponses = {
1313
+ /**
1314
+ * Successful response
1315
+ */
1316
+ 200: {
1317
+ /**
1318
+ * Conversation ID — pass it back on subsequent calls to continue the conversation.
1319
+ */
1320
+ conversationId: string;
1321
+ /**
1322
+ * Organization linked to the conversation (when you use organizations).
1323
+ */
1324
+ organizationId?: string;
1325
+ /**
1326
+ * Index of the user message that was just processed. Pass this to [`validateResponse`](#tag/conversations/POST/conversations/{conversationId}/validate-response) if `mode` is `copilot` and you need to validate the response later.
1327
+ */
1328
+ messageIndex: number;
1329
+ /**
1330
+ * The person in the conversation, if identified. Null when no user is known yet.
1331
+ */
1332
+ user: {
1333
+ /**
1334
+ * Unique identifier of the person in the conversation, in your system.
1335
+ */
1336
+ userId: string;
1337
+ /**
1338
+ * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
1339
+ */
1340
+ resolved?: boolean;
1341
+ /**
1342
+ * Custom data attached to the user (name, email, account info, etc.).
1343
+ */
1344
+ data?: {
1345
+ [key: string]: unknown;
1346
+ };
1347
+ } | null;
1348
+ /**
1349
+ * Entity linked to the conversation (when you use entities).
1350
+ */
1351
+ entityId?: string;
1352
+ /**
1353
+ * AI-generated response to the user message.
1354
+ */
1355
+ content: string;
1356
+ /**
1357
+ * How the AI labels this response. `autopilot`: every involved intent and action is cleared for automation — safe to send the content as-is. `copilot`: at least one intent or action is configured for human review — hold the content for an agent to validate before sending. The actual delivery is up to you.
1358
+ */
1359
+ mode: 'autopilot' | 'copilot';
1360
+ /**
1361
+ * True when the conversation has been escalated to a human agent (hard-rule trigger, action failure, unidentifiable user, message limit reached, etc.). The `content` is then a notice for the user that their request was forwarded.
1362
+ */
1363
+ escalated: boolean;
1364
+ };
1365
+ };
1366
+ export type SendMessageResponse = SendMessageResponses[keyof SendMessageResponses];
1367
+ export type ValidateResponseData = {
1368
+ body?: {
1369
+ /**
1370
+ * Index of the user message whose AI response should be validated.
1371
+ */
1372
+ messageIndex: number;
1373
+ /**
1374
+ * Edited content to send instead of the original AI response. Omit to deliver the AI response as-is.
1375
+ */
1376
+ editedContent?: string;
1377
+ };
1378
+ path: {
1379
+ /**
1380
+ * Conversation ID (format: `conv_xxxxxxxxxxxx`).
1381
+ */
1382
+ conversationId: string;
1383
+ };
1384
+ query?: never;
1385
+ url: '/conversations/{conversationId}/validate-response';
1386
+ };
1387
+ export type ValidateResponseErrors = {
1388
+ /**
1389
+ * The response cannot be validated in its current state.
1390
+ */
1391
+ 400: {
1392
+ statusCode: number;
1393
+ error: {
1394
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON' | 'ALREADY_VALIDATED' | 'NO_RESPONSE';
1395
+ message: string;
1396
+ };
1397
+ };
1398
+ /**
1399
+ * Authentication required
1400
+ */
1401
+ 401: {
1402
+ statusCode: number;
1403
+ error: {
1404
+ code: 'AUTH';
1405
+ message: string;
1406
+ };
1407
+ };
1408
+ /**
1409
+ * Insufficient permissions
1410
+ */
1411
+ 403: {
1412
+ statusCode: number;
1413
+ error: {
1414
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1415
+ message: string;
1416
+ };
1417
+ };
1418
+ /**
1419
+ * Conversation or message at the given index does not exist.
1420
+ */
1421
+ 404: {
1422
+ statusCode: number;
1423
+ error: {
1424
+ code: 'NOT-FOUND';
1425
+ message: string;
1426
+ };
1427
+ };
1428
+ };
1429
+ export type ValidateResponseError = ValidateResponseErrors[keyof ValidateResponseErrors];
1430
+ export type ValidateResponseResponses = {
1431
+ /**
1432
+ * Successful response
1433
+ */
1434
+ 200: {
1435
+ /**
1436
+ * Outcome of every action attached to the response that was executed at validation time.
1437
+ */
1438
+ actionsExecuted: Array<{
1439
+ /**
1440
+ * Action type identifier.
1441
+ */
1442
+ type: string;
1443
+ /**
1444
+ * Whether the action ran successfully.
1445
+ */
1446
+ success: boolean;
1447
+ /**
1448
+ * Error message when the action failed.
1449
+ */
1450
+ error?: string;
1451
+ }>;
1452
+ };
1453
+ };
1454
+ export type ValidateResponseResponse = ValidateResponseResponses[keyof ValidateResponseResponses];
1455
+ export type AppendMessageData = {
1456
+ body?: {
1457
+ /**
1458
+ * Message text to append to the conversation thread.
1459
+ */
1460
+ content: string;
1461
+ /**
1462
+ * Who the message is attributed to. `user` to inject an end-user message; `agent` for an operator/human-agent reply that should appear alongside AI responses.
1463
+ */
1464
+ role: 'user' | 'agent';
1465
+ /**
1466
+ * Display name shown alongside the message (e.g. "Alice"). Falls back to the role's default when omitted.
1467
+ */
1468
+ authorName?: string;
1469
+ };
1470
+ path: {
1471
+ /**
1472
+ * Conversation ID (format: `conv_xxxxxxxxxxxx`).
1473
+ */
1474
+ conversationId: string;
1475
+ };
1476
+ query?: never;
1477
+ url: '/conversations/{conversationId}/messages';
1478
+ };
1479
+ export type AppendMessageErrors = {
1480
+ /**
1481
+ * Bad request
1482
+ */
1483
+ 400: {
1484
+ statusCode: number;
1485
+ error: {
1486
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1487
+ message: string;
1488
+ };
1489
+ };
1490
+ /**
1491
+ * Authentication required
1492
+ */
1493
+ 401: {
1494
+ statusCode: number;
1495
+ error: {
1496
+ code: 'AUTH';
1497
+ message: string;
1498
+ };
1499
+ };
1500
+ /**
1501
+ * Insufficient permissions
1502
+ */
1503
+ 403: {
1504
+ statusCode: number;
1505
+ error: {
1506
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1507
+ message: string;
1508
+ };
1509
+ };
1510
+ /**
1511
+ * Conversation does not exist.
1512
+ */
1513
+ 404: {
1514
+ statusCode: number;
1515
+ error: {
1516
+ code: 'NOT-FOUND';
1517
+ message: string;
1518
+ };
1519
+ };
1520
+ };
1521
+ export type AppendMessageError = AppendMessageErrors[keyof AppendMessageErrors];
1522
+ export type AppendMessageResponses = {
1523
+ /**
1524
+ * Successful response
1525
+ */
1526
+ 200: {
1527
+ /**
1528
+ * Index of the appended message in the conversation thread.
1529
+ */
1530
+ messageIndex: number;
1531
+ };
1532
+ };
1533
+ export type AppendMessageResponse = AppendMessageResponses[keyof AppendMessageResponses];
1534
+ export type List3Data = {
1535
+ body?: never;
1536
+ path?: never;
1537
+ query?: {
1538
+ /**
1539
+ * Max number of items to return per page (1-100).
1540
+ */
1541
+ limit?: number;
1542
+ /**
1543
+ * Number of items to skip for pagination.
1544
+ */
1545
+ offset?: number | null;
1546
+ };
1547
+ url: '/entities';
1548
+ };
1549
+ export type List3Errors = {
1550
+ /**
1551
+ * Bad request
1552
+ */
1553
+ 400: {
1554
+ statusCode: number;
1555
+ error: {
1556
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1557
+ message: string;
1558
+ };
1559
+ };
1560
+ /**
1561
+ * Authentication required
1562
+ */
1563
+ 401: {
1564
+ statusCode: number;
1565
+ error: {
1566
+ code: 'AUTH';
1567
+ message: string;
1568
+ };
1569
+ };
1570
+ /**
1571
+ * Insufficient permissions
1572
+ */
1573
+ 403: {
1574
+ statusCode: number;
1575
+ error: {
1576
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1577
+ message: string;
1578
+ };
1579
+ };
1580
+ };
1581
+ export type List3Error = List3Errors[keyof List3Errors];
1582
+ export type List3Responses = {
1583
+ /**
1584
+ * Successful response
1585
+ */
1586
+ 200: {
1587
+ entities: Array<{
1588
+ /**
1589
+ * Entity ID (format: ent_xxxxxxxxxxxx).
1590
+ */
1591
+ id: string;
1592
+ organizationId?: string | null;
1593
+ /**
1594
+ * Human-readable name of the entity.
1595
+ */
1596
+ name: string;
1597
+ /**
1598
+ * ISO timestamp when the entity was created.
1599
+ */
1600
+ createdAt: string;
1601
+ /**
1602
+ * ISO timestamp of the last update.
1603
+ */
1604
+ updatedAt: string;
1605
+ }>;
1606
+ /**
1607
+ * Total number of items matching the query.
1608
+ */
1609
+ total: number;
1610
+ /**
1611
+ * Page size applied to this response.
1612
+ */
1613
+ limit: number;
1614
+ /**
1615
+ * Offset applied to this response.
1616
+ */
1617
+ offset: number;
1618
+ };
1619
+ };
1620
+ export type List3Response = List3Responses[keyof List3Responses];
1621
+ export type Create2Data = {
1622
+ body?: {
1623
+ /**
1624
+ * Human-readable name of the entity.
1625
+ */
1626
+ name: string;
1627
+ /**
1628
+ * Free-form metadata attached to the entity (shape is up to you).
1629
+ */
1630
+ metadata?: {
1631
+ [key: string]: unknown;
1632
+ };
1633
+ };
1634
+ path?: never;
1635
+ query?: never;
1636
+ url: '/entities';
1637
+ };
1638
+ export type Create2Errors = {
1639
+ /**
1640
+ * Bad request
1641
+ */
1642
+ 400: {
1643
+ statusCode: number;
1644
+ error: {
1645
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
1646
+ message: string;
1647
+ };
1648
+ };
1649
+ /**
1650
+ * Authentication required
1651
+ */
1652
+ 401: {
1653
+ statusCode: number;
1654
+ error: {
1655
+ code: 'AUTH';
1656
+ message: string;
1657
+ };
1658
+ };
1659
+ /**
1660
+ * Insufficient permissions
1661
+ */
1662
+ 403: {
1663
+ statusCode: number;
1664
+ error: {
1665
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1666
+ message: string;
1667
+ };
1668
+ };
1669
+ };
1670
+ export type Create2Error = Create2Errors[keyof Create2Errors];
1671
+ export type Create2Responses = {
1672
+ /**
1673
+ * Successful response
1674
+ */
1675
+ 200: {
1676
+ /**
1677
+ * Entity ID (format: ent_xxxxxxxxxxxx).
1678
+ */
1679
+ id: string;
1680
+ organizationId?: string | null;
1681
+ /**
1682
+ * Human-readable name of the entity.
1683
+ */
1684
+ name: string;
1685
+ /**
1686
+ * ISO timestamp when the entity was created.
1687
+ */
1688
+ createdAt: string;
1689
+ /**
1690
+ * ISO timestamp of the last update.
1691
+ */
1692
+ updatedAt: string;
1693
+ /**
1694
+ * Free-form metadata attached to the entity (shape is up to you).
1695
+ */
1696
+ metadata?: {
1697
+ [key: string]: unknown;
1698
+ };
1699
+ };
1700
+ };
1701
+ export type Create2Response = Create2Responses[keyof Create2Responses];
1702
+ export type Delete2Data = {
1703
+ body?: never;
1704
+ path: {
1705
+ /**
1706
+ * Entity ID (format: `ent_xxxxxxxxxxxx`).
1707
+ */
1708
+ id: string;
1709
+ };
1710
+ query?: never;
1711
+ url: '/entities/{id}';
1712
+ };
1713
+ export type Delete2Errors = {
1714
+ /**
1715
+ * Bad request
1716
+ */
1717
+ 400: {
1718
+ statusCode: number;
1719
+ error: {
1720
+ code: 'MISSING-ORG';
1721
+ message: string;
1722
+ };
1723
+ };
1724
+ /**
1725
+ * Authentication required
1726
+ */
1727
+ 401: {
1728
+ statusCode: number;
1729
+ error: {
1730
+ code: 'AUTH';
1731
+ message: string;
1732
+ };
1733
+ };
1734
+ /**
1735
+ * Insufficient permissions
1736
+ */
1737
+ 403: {
1738
+ statusCode: number;
1739
+ error: {
1740
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1741
+ message: string;
1742
+ };
1743
+ };
1744
+ };
1745
+ export type Delete2Error = Delete2Errors[keyof Delete2Errors];
1746
+ export type Delete2Responses = {
1747
+ /**
1748
+ * Successful response
1749
+ */
1750
+ 200: {
1751
+ /**
1752
+ * Confirmation message.
1753
+ */
1754
+ message: string;
1755
+ };
1756
+ };
1757
+ export type Delete2Response = Delete2Responses[keyof Delete2Responses];
1758
+ export type Get3Data = {
1759
+ body?: never;
1760
+ path: {
1761
+ /**
1762
+ * Entity ID (format: `ent_xxxxxxxxxxxx`).
1763
+ */
1764
+ id: string;
1765
+ };
1766
+ query?: never;
1767
+ url: '/entities/{id}';
1768
+ };
1769
+ export type Get3Errors = {
1770
+ /**
1771
+ * Bad request
1772
+ */
1773
+ 400: {
1774
+ statusCode: number;
1775
+ error: {
1776
+ code: 'MISSING-ORG';
1777
+ message: string;
1778
+ };
1779
+ };
1780
+ /**
1781
+ * Authentication required
1782
+ */
1783
+ 401: {
1784
+ statusCode: number;
1785
+ error: {
1786
+ code: 'AUTH';
1787
+ message: string;
1788
+ };
1789
+ };
1790
+ /**
1791
+ * Insufficient permissions
1792
+ */
1793
+ 403: {
1794
+ statusCode: number;
1795
+ error: {
1796
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
1797
+ message: string;
1798
+ };
1799
+ };
1800
+ };
1801
+ export type Get3Error = Get3Errors[keyof Get3Errors];
1802
+ export type Get3Responses = {
1803
+ /**
1804
+ * Successful response
1805
+ */
1806
+ 200: {
1807
+ /**
1808
+ * Entity ID (format: ent_xxxxxxxxxxxx).
1809
+ */
1810
+ id: string;
1811
+ organizationId?: string | null;
1812
+ /**
1813
+ * Human-readable name of the entity.
1814
+ */
1815
+ name: string;
306
1816
  /**
307
- * Overrides the configured KBs for this message. Not stored.
1817
+ * ISO timestamp when the entity was created.
308
1818
  */
309
- kbArticles?: Array<{
310
- /**
311
- * Article title shown to the agent.
312
- */
313
- title: string;
314
- /**
315
- * Article body (markdown-friendly).
316
- */
317
- content: string;
318
- /**
319
- * Intent identifiers this article serves. Empty or omitted = always-on. Otherwise the article is only injected when one of these intents is detected on the message.
320
- */
321
- intents?: Array<string>;
322
- }>;
1819
+ createdAt: string;
323
1820
  /**
324
- * Origin tag for the conversation (e.g. "website", "chat_page"). Stored on the conversation for analytics.
1821
+ * ISO timestamp of the last update.
325
1822
  */
326
- source?: string;
1823
+ updatedAt: string;
327
1824
  /**
328
- * Custom key/value pairs attached to the conversation. Available as variables in your agent prompts.
1825
+ * Free-form metadata attached to the entity (shape is up to you).
329
1826
  */
330
1827
  metadata?: {
331
- [key: string]: string;
1828
+ [key: string]: unknown;
332
1829
  };
333
1830
  };
334
- path?: never;
1831
+ };
1832
+ export type Get3Response = Get3Responses[keyof Get3Responses];
1833
+ export type Update2Data = {
1834
+ body?: {
1835
+ /**
1836
+ * New name for the entity.
1837
+ */
1838
+ name?: string;
1839
+ /**
1840
+ * Replace the free-form metadata attached to the entity.
1841
+ */
1842
+ metadata?: {
1843
+ [key: string]: unknown;
1844
+ };
1845
+ };
1846
+ path: {
1847
+ /**
1848
+ * Entity ID (format: `ent_xxxxxxxxxxxx`).
1849
+ */
1850
+ id: string;
1851
+ };
335
1852
  query?: never;
336
- url: '/conversations/messages';
1853
+ url: '/entities/{id}';
337
1854
  };
338
- export type SendMessageErrors = {
1855
+ export type Update2Errors = {
339
1856
  /**
340
1857
  * Bad request
341
1858
  */
@@ -367,87 +1884,65 @@ export type SendMessageErrors = {
367
1884
  };
368
1885
  };
369
1886
  };
370
- export type SendMessageError = SendMessageErrors[keyof SendMessageErrors];
371
- export type SendMessageResponses = {
1887
+ export type Update2Error = Update2Errors[keyof Update2Errors];
1888
+ export type Update2Responses = {
372
1889
  /**
373
1890
  * Successful response
374
1891
  */
375
1892
  200: {
376
1893
  /**
377
- * Conversation ID — pass it back on subsequent calls to continue the conversation.
378
- */
379
- conversationId: string;
380
- /**
381
- * Organization linked to the conversation (when you use organizations).
382
- */
383
- organizationId?: string;
384
- /**
385
- * Index of the user message that was just processed. Pass this to `validateResponse` if `mode` is `copilot` and you need to validate the response later.
386
- */
387
- messageIndex: number;
388
- /**
389
- * The person in the conversation, if identified. Null when no user is known yet.
1894
+ * Entity ID (format: ent_xxxxxxxxxxxx).
390
1895
  */
391
- user: {
392
- /**
393
- * Unique identifier of the person in the conversation, in your system.
394
- */
395
- userId: string;
396
- /**
397
- * Whether the user is fully identified. Pass `true` to skip user resolution (you have a complete profile); pass `false` (or omit) to have us verify identity from the message. In responses, reflects the current state.
398
- */
399
- resolved?: boolean;
400
- /**
401
- * Custom data attached to the user (name, email, account info, etc.).
402
- */
403
- data?: {
404
- [key: string]: unknown;
405
- };
406
- } | null;
1896
+ id: string;
1897
+ organizationId?: string | null;
407
1898
  /**
408
- * Entity linked to the conversation (when you use entities).
1899
+ * Human-readable name of the entity.
409
1900
  */
410
- entityId?: string;
1901
+ name: string;
411
1902
  /**
412
- * AI-generated response to the user message.
1903
+ * ISO timestamp when the entity was created.
413
1904
  */
414
- content: string;
1905
+ createdAt: string;
415
1906
  /**
416
- * How the AI labels this response. `autopilot`: every involved intent and action is cleared for automation — safe to send the content as-is. `copilot`: at least one intent or action is configured for human review — hold the content for an agent to validate before sending. The actual delivery is up to you.
1907
+ * ISO timestamp of the last update.
417
1908
  */
418
- mode: 'autopilot' | 'copilot';
1909
+ updatedAt: string;
419
1910
  /**
420
- * True when the conversation has been escalated to a human agent (hard-rule trigger, action failure, unidentifiable user, message limit reached, etc.). The `content` is then a notice for the user that their request was forwarded.
1911
+ * Free-form metadata attached to the entity (shape is up to you).
421
1912
  */
422
- escalated: boolean;
1913
+ metadata?: {
1914
+ [key: string]: unknown;
1915
+ };
423
1916
  };
424
1917
  };
425
- export type SendMessageResponse = SendMessageResponses[keyof SendMessageResponses];
426
- export type ValidateResponseData = {
427
- body?: {
1918
+ export type Update2Response = Update2Responses[keyof Update2Responses];
1919
+ export type List4Data = {
1920
+ body?: never;
1921
+ path?: never;
1922
+ query?: {
428
1923
  /**
429
- * Index of the user message whose AI response should be validated.
1924
+ * Max number of items to return per page (1-100).
430
1925
  */
431
- messageIndex: number;
1926
+ limit?: number;
432
1927
  /**
433
- * Edited content to send instead of the original AI response. Omit to deliver the AI response as-is.
1928
+ * Number of items to skip for pagination.
434
1929
  */
435
- editedContent?: string;
436
- };
437
- path: {
438
- conversationId: string;
1930
+ offset?: number | null;
1931
+ /**
1932
+ * Target a specific entity (under the caller's organization).
1933
+ */
1934
+ entityId?: string;
439
1935
  };
440
- query?: never;
441
- url: '/conversations/{conversationId}/validate-response';
1936
+ url: '/kb';
442
1937
  };
443
- export type ValidateResponseErrors = {
1938
+ export type List4Errors = {
444
1939
  /**
445
- * The response cannot be validated in its current state.
1940
+ * Bad request
446
1941
  */
447
1942
  400: {
448
1943
  statusCode: number;
449
1944
  error: {
450
- code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON' | 'ALREADY_VALIDATED' | 'NO_RESPONSE';
1945
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
451
1946
  message: string;
452
1947
  };
453
1948
  };
@@ -471,55 +1966,67 @@ export type ValidateResponseErrors = {
471
1966
  message: string;
472
1967
  };
473
1968
  };
474
- /**
475
- * Conversation or message at the given index does not exist.
476
- */
477
- 404: {
478
- statusCode: number;
479
- error: {
480
- code: 'NOT-FOUND';
481
- message: string;
482
- };
483
- };
484
1969
  };
485
- export type ValidateResponseError = ValidateResponseErrors[keyof ValidateResponseErrors];
486
- export type ValidateResponseResponses = {
1970
+ export type List4Error = List4Errors[keyof List4Errors];
1971
+ export type List4Responses = {
487
1972
  /**
488
1973
  * Successful response
489
1974
  */
490
1975
  200: {
1976
+ articles: Array<{
1977
+ id: string;
1978
+ title: string;
1979
+ intents: Array<string>;
1980
+ scope: {
1981
+ level: 'global' | 'organization' | 'entity';
1982
+ organizationId?: string;
1983
+ entityId?: string;
1984
+ };
1985
+ version: number;
1986
+ hasDraft: boolean;
1987
+ publishedAt?: string;
1988
+ updatedAt: string;
1989
+ }>;
491
1990
  /**
492
- * Outcome of every action attached to the response that was executed at validation time.
1991
+ * Total number of items matching the query.
493
1992
  */
494
- actionsExecuted: Array<{
495
- /**
496
- * Action type identifier.
497
- */
498
- type: string;
499
- /**
500
- * Whether the action ran successfully.
501
- */
502
- success: boolean;
503
- /**
504
- * Error message when the action failed.
505
- */
506
- error?: string;
507
- }>;
1993
+ total: number;
1994
+ /**
1995
+ * Page size applied to this response.
1996
+ */
1997
+ limit: number;
1998
+ /**
1999
+ * Offset applied to this response.
2000
+ */
2001
+ offset: number;
508
2002
  };
509
2003
  };
510
- export type ValidateResponseResponse = ValidateResponseResponses[keyof ValidateResponseResponses];
511
- export type List2Data = {
512
- body?: never;
2004
+ export type List4Response = List4Responses[keyof List4Responses];
2005
+ export type Create3Data = {
2006
+ body?: {
2007
+ /**
2008
+ * Article title.
2009
+ */
2010
+ title: string;
2011
+ /**
2012
+ * Article body (Markdown).
2013
+ */
2014
+ content: string;
2015
+ /**
2016
+ * Intent IDs this article serves. Empty = always-on within its scope.
2017
+ */
2018
+ intents?: Array<string>;
2019
+ };
513
2020
  path?: never;
514
2021
  query?: {
515
2022
  /**
516
- * Filter: only list entities under this organization (when you use organizations).
2023
+ * Target a specific entity (under the caller's organization).
517
2024
  */
518
- organizationId?: string;
2025
+ entityId?: string;
519
2026
  };
520
- url: '/entities';
2027
+ url: '/kb';
521
2028
  };
522
- export type List2Errors = {
2029
+ export type Create3Errors = {
523
2030
  /**
524
2031
  * Bad request
525
2032
  */
@@ -551,72 +2058,113 @@ export type List2Errors = {
551
2058
  };
552
2059
  };
553
2060
  };
554
- export type List2Error = List2Errors[keyof List2Errors];
555
- export type List2Responses = {
2061
+ export type Create3Error = Create3Errors[keyof Create3Errors];
2062
+ export type Create3Responses = {
556
2063
  /**
557
2064
  * Successful response
558
2065
  */
559
2066
  200: {
560
2067
  /**
561
- * Entities matching the query.
2068
+ * KB article ID (format: kb_xxxxxxxxxxxx).
562
2069
  */
563
- entities: Array<{
564
- /**
565
- * Entity ID (format: ent_xxxxxxxxxxxx).
566
- */
567
- id: string;
568
- organizationId?: string | null;
569
- /**
570
- * Human-readable name of the entity.
571
- */
572
- name: string;
573
- /**
574
- * Free-form metadata attached to the entity (shape is up to you).
575
- */
576
- metadata?: {
577
- [key: string]: unknown;
578
- };
579
- /**
580
- * ISO timestamp when the entity was created.
581
- */
582
- createdAt: string;
583
- /**
584
- * ISO timestamp of the last update.
585
- */
586
- updatedAt: string;
587
- }>;
2070
+ id: string;
2071
+ scope: {
2072
+ level: 'global' | 'organization' | 'entity';
2073
+ organizationId?: string;
2074
+ entityId?: string;
2075
+ };
2076
+ intents: Array<string>;
2077
+ published: {
2078
+ version: number;
2079
+ title: string;
2080
+ content: string;
2081
+ publishedAt?: string;
2082
+ updatedAt?: string;
2083
+ };
2084
+ draft?: {
2085
+ version: number;
2086
+ title: string;
2087
+ content: string;
2088
+ publishedAt?: string;
2089
+ updatedAt?: string;
2090
+ };
2091
+ createdAt: string;
2092
+ updatedAt: string;
2093
+ };
2094
+ };
2095
+ export type Create3Response = Create3Responses[keyof Create3Responses];
2096
+ export type Delete3Data = {
2097
+ body?: never;
2098
+ path: {
588
2099
  /**
589
- * Total number of entities matching the query.
2100
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
590
2101
  */
591
- total: number;
2102
+ id: string;
2103
+ };
2104
+ query?: never;
2105
+ url: '/kb/{id}';
2106
+ };
2107
+ export type Delete3Errors = {
2108
+ /**
2109
+ * Bad request
2110
+ */
2111
+ 400: {
2112
+ statusCode: number;
2113
+ error: {
2114
+ code: 'MISSING-ORG';
2115
+ message: string;
2116
+ };
2117
+ };
2118
+ /**
2119
+ * Authentication required
2120
+ */
2121
+ 401: {
2122
+ statusCode: number;
2123
+ error: {
2124
+ code: 'AUTH';
2125
+ message: string;
2126
+ };
2127
+ };
2128
+ /**
2129
+ * Insufficient permissions
2130
+ */
2131
+ 403: {
2132
+ statusCode: number;
2133
+ error: {
2134
+ code: 'FORBIDDEN' | 'SCOPE-FORBIDDEN';
2135
+ message: string;
2136
+ };
592
2137
  };
593
2138
  };
594
- export type List2Response = List2Responses[keyof List2Responses];
595
- export type CreateData = {
596
- body?: {
597
- /**
598
- * Human-readable name of the entity.
599
- */
600
- name: string;
2139
+ export type Delete3Error = Delete3Errors[keyof Delete3Errors];
2140
+ export type Delete3Responses = {
2141
+ /**
2142
+ * Successful response
2143
+ */
2144
+ 200: {
2145
+ message: string;
2146
+ };
2147
+ };
2148
+ export type Delete3Response = Delete3Responses[keyof Delete3Responses];
2149
+ export type Get4Data = {
2150
+ body?: never;
2151
+ path: {
601
2152
  /**
602
- * Free-form metadata attached to the entity (shape is up to you).
2153
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
603
2154
  */
604
- metadata?: {
605
- [key: string]: unknown;
606
- };
2155
+ id: string;
607
2156
  };
608
- path?: never;
609
2157
  query?: never;
610
- url: '/entities';
2158
+ url: '/kb/{id}';
611
2159
  };
612
- export type CreateErrors = {
2160
+ export type Get4Errors = {
613
2161
  /**
614
2162
  * Bad request
615
2163
  */
616
2164
  400: {
617
2165
  statusCode: number;
618
2166
  error: {
619
- code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
2167
+ code: 'MISSING-ORG';
620
2168
  message: string;
621
2169
  };
622
2170
  };
@@ -641,54 +2189,77 @@ export type CreateErrors = {
641
2189
  };
642
2190
  };
643
2191
  };
644
- export type CreateError = CreateErrors[keyof CreateErrors];
645
- export type CreateResponses = {
2192
+ export type Get4Error = Get4Errors[keyof Get4Errors];
2193
+ export type Get4Responses = {
646
2194
  /**
647
2195
  * Successful response
648
2196
  */
649
2197
  200: {
650
2198
  /**
651
- * Entity ID (format: ent_xxxxxxxxxxxx).
2199
+ * KB article ID (format: kb_xxxxxxxxxxxx).
652
2200
  */
653
2201
  id: string;
654
- organizationId?: string | null;
2202
+ scope: {
2203
+ level: 'global' | 'organization' | 'entity';
2204
+ organizationId?: string;
2205
+ entityId?: string;
2206
+ };
2207
+ intents: Array<string>;
2208
+ published: {
2209
+ version: number;
2210
+ title: string;
2211
+ content: string;
2212
+ publishedAt?: string;
2213
+ updatedAt?: string;
2214
+ };
2215
+ draft?: {
2216
+ version: number;
2217
+ title: string;
2218
+ content: string;
2219
+ publishedAt?: string;
2220
+ updatedAt?: string;
2221
+ };
2222
+ createdAt: string;
2223
+ updatedAt: string;
2224
+ };
2225
+ };
2226
+ export type Get4Response = Get4Responses[keyof Get4Responses];
2227
+ export type Update3Data = {
2228
+ body?: {
655
2229
  /**
656
- * Human-readable name of the entity.
2230
+ * New article title.
657
2231
  */
658
- name: string;
2232
+ title?: string;
659
2233
  /**
660
- * Free-form metadata attached to the entity (shape is up to you).
2234
+ * New article body.
661
2235
  */
662
- metadata?: {
663
- [key: string]: unknown;
664
- };
2236
+ content?: string;
665
2237
  /**
666
- * ISO timestamp when the entity was created.
2238
+ * Replace the intents list. Pass `[]` to make the article always-on.
667
2239
  */
668
- createdAt: string;
2240
+ intents?: Array<string>;
669
2241
  /**
670
- * ISO timestamp of the last update.
2242
+ * When true and `title`/`content` is provided, the changes are written to draft and immediately promoted to published (a version snapshot is still created so rollback remains possible). When false (default), the content stays in draft. Routing changes (`intents`) bypass this flag.
671
2243
  */
672
- updatedAt: string;
2244
+ publish?: boolean;
673
2245
  };
674
- };
675
- export type CreateResponse = CreateResponses[keyof CreateResponses];
676
- export type DeleteData = {
677
- body?: never;
678
2246
  path: {
2247
+ /**
2248
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
2249
+ */
679
2250
  id: string;
680
2251
  };
681
2252
  query?: never;
682
- url: '/entities/{id}';
2253
+ url: '/kb/{id}';
683
2254
  };
684
- export type DeleteErrors = {
2255
+ export type Update3Errors = {
685
2256
  /**
686
2257
  * Bad request
687
2258
  */
688
2259
  400: {
689
2260
  statusCode: number;
690
2261
  error: {
691
- code: 'MISSING-ORG';
2262
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
692
2263
  message: string;
693
2264
  };
694
2265
  };
@@ -713,28 +2284,53 @@ export type DeleteErrors = {
713
2284
  };
714
2285
  };
715
2286
  };
716
- export type DeleteError = DeleteErrors[keyof DeleteErrors];
717
- export type DeleteResponses = {
2287
+ export type Update3Error = Update3Errors[keyof Update3Errors];
2288
+ export type Update3Responses = {
718
2289
  /**
719
2290
  * Successful response
720
2291
  */
721
2292
  200: {
722
2293
  /**
723
- * Confirmation message.
2294
+ * KB article ID (format: kb_xxxxxxxxxxxx).
724
2295
  */
725
- message: string;
2296
+ id: string;
2297
+ scope: {
2298
+ level: 'global' | 'organization' | 'entity';
2299
+ organizationId?: string;
2300
+ entityId?: string;
2301
+ };
2302
+ intents: Array<string>;
2303
+ published: {
2304
+ version: number;
2305
+ title: string;
2306
+ content: string;
2307
+ publishedAt?: string;
2308
+ updatedAt?: string;
2309
+ };
2310
+ draft?: {
2311
+ version: number;
2312
+ title: string;
2313
+ content: string;
2314
+ publishedAt?: string;
2315
+ updatedAt?: string;
2316
+ };
2317
+ createdAt: string;
2318
+ updatedAt: string;
726
2319
  };
727
2320
  };
728
- export type DeleteResponse = DeleteResponses[keyof DeleteResponses];
729
- export type Get2Data = {
2321
+ export type Update3Response = Update3Responses[keyof Update3Responses];
2322
+ export type Publish2Data = {
730
2323
  body?: never;
731
2324
  path: {
2325
+ /**
2326
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
2327
+ */
732
2328
  id: string;
733
2329
  };
734
2330
  query?: never;
735
- url: '/entities/{id}';
2331
+ url: '/kb/{id}/publish';
736
2332
  };
737
- export type Get2Errors = {
2333
+ export type Publish2Errors = {
738
2334
  /**
739
2335
  * Bad request
740
2336
  */
@@ -766,58 +2362,58 @@ export type Get2Errors = {
766
2362
  };
767
2363
  };
768
2364
  };
769
- export type Get2Error = Get2Errors[keyof Get2Errors];
770
- export type Get2Responses = {
2365
+ export type Publish2Error = Publish2Errors[keyof Publish2Errors];
2366
+ export type Publish2Responses = {
771
2367
  /**
772
2368
  * Successful response
773
2369
  */
774
2370
  200: {
775
2371
  /**
776
- * Entity ID (format: ent_xxxxxxxxxxxx).
2372
+ * KB article ID (format: kb_xxxxxxxxxxxx).
777
2373
  */
778
2374
  id: string;
779
- organizationId?: string | null;
780
- /**
781
- * Human-readable name of the entity.
782
- */
783
- name: string;
784
- /**
785
- * Free-form metadata attached to the entity (shape is up to you).
786
- */
787
- metadata?: {
788
- [key: string]: unknown;
2375
+ scope: {
2376
+ level: 'global' | 'organization' | 'entity';
2377
+ organizationId?: string;
2378
+ entityId?: string;
2379
+ };
2380
+ intents: Array<string>;
2381
+ published: {
2382
+ version: number;
2383
+ title: string;
2384
+ content: string;
2385
+ publishedAt?: string;
2386
+ updatedAt?: string;
2387
+ };
2388
+ draft?: {
2389
+ version: number;
2390
+ title: string;
2391
+ content: string;
2392
+ publishedAt?: string;
2393
+ updatedAt?: string;
789
2394
  };
790
- /**
791
- * ISO timestamp when the entity was created.
792
- */
793
2395
  createdAt: string;
794
- /**
795
- * ISO timestamp of the last update.
796
- */
797
2396
  updatedAt: string;
798
2397
  };
799
2398
  };
800
- export type Get2Response = Get2Responses[keyof Get2Responses];
801
- export type UpdateData = {
2399
+ export type Publish2Response = Publish2Responses[keyof Publish2Responses];
2400
+ export type Rollback2Data = {
802
2401
  body?: {
803
2402
  /**
804
- * New name for the entity.
805
- */
806
- name?: string;
807
- /**
808
- * Replace the free-form metadata attached to the entity.
2403
+ * Archived version number to restore as the new published.
809
2404
  */
810
- metadata?: {
811
- [key: string]: unknown;
812
- };
2405
+ targetVersion: number;
813
2406
  };
814
2407
  path: {
2408
+ /**
2409
+ * KB article ID (format: `kb_xxxxxxxxxxxx`).
2410
+ */
815
2411
  id: string;
816
2412
  };
817
2413
  query?: never;
818
- url: '/entities/{id}';
2414
+ url: '/kb/{id}/rollback';
819
2415
  };
820
- export type UpdateErrors = {
2416
+ export type Rollback2Errors = {
821
2417
  /**
822
2418
  * Bad request
823
2419
  */
@@ -849,52 +2445,64 @@ export type UpdateErrors = {
849
2445
  };
850
2446
  };
851
2447
  };
852
- export type UpdateError = UpdateErrors[keyof UpdateErrors];
853
- export type UpdateResponses = {
2448
+ export type Rollback2Error = Rollback2Errors[keyof Rollback2Errors];
2449
+ export type Rollback2Responses = {
854
2450
  /**
855
2451
  * Successful response
856
2452
  */
857
2453
  200: {
858
2454
  /**
859
- * Entity ID (format: ent_xxxxxxxxxxxx).
2455
+ * KB article ID (format: kb_xxxxxxxxxxxx).
860
2456
  */
861
2457
  id: string;
862
- organizationId?: string | null;
863
- /**
864
- * Human-readable name of the entity.
865
- */
866
- name: string;
867
- /**
868
- * Free-form metadata attached to the entity (shape is up to you).
869
- */
870
- metadata?: {
871
- [key: string]: unknown;
2458
+ scope: {
2459
+ level: 'global' | 'organization' | 'entity';
2460
+ organizationId?: string;
2461
+ entityId?: string;
2462
+ };
2463
+ intents: Array<string>;
2464
+ published: {
2465
+ version: number;
2466
+ title: string;
2467
+ content: string;
2468
+ publishedAt?: string;
2469
+ updatedAt?: string;
2470
+ };
2471
+ draft?: {
2472
+ version: number;
2473
+ title: string;
2474
+ content: string;
2475
+ publishedAt?: string;
2476
+ updatedAt?: string;
872
2477
  };
873
- /**
874
- * ISO timestamp when the entity was created.
875
- */
876
2478
  createdAt: string;
877
- /**
878
- * ISO timestamp of the last update.
879
- */
880
2479
  updatedAt: string;
881
2480
  };
882
2481
  };
883
- export type UpdateResponse = UpdateResponses[keyof UpdateResponses];
884
- export type List3Data = {
2482
+ export type Rollback2Response = Rollback2Responses[keyof Rollback2Responses];
2483
+ export type List5Data = {
885
2484
  body?: never;
886
2485
  path?: never;
887
- query?: never;
2486
+ query?: {
2487
+ /**
2488
+ * Max number of items to return per page (1-100).
2489
+ */
2490
+ limit?: number;
2491
+ /**
2492
+ * Number of items to skip for pagination.
2493
+ */
2494
+ offset?: number | null;
2495
+ };
888
2496
  url: '/organizations';
889
2497
  };
890
- export type List3Errors = {
2498
+ export type List5Errors = {
891
2499
  /**
892
2500
  * Bad request
893
2501
  */
894
2502
  400: {
895
2503
  statusCode: number;
896
2504
  error: {
897
- code: 'MISSING-ORG';
2505
+ code: 'MISSING-ORG' | 'VALIDATION' | 'INVALID-JSON';
898
2506
  message: string;
899
2507
  };
900
2508
  };
@@ -919,15 +2527,12 @@ export type List3Errors = {
919
2527
  };
920
2528
  };
921
2529
  };
922
- export type List3Error = List3Errors[keyof List3Errors];
923
- export type List3Responses = {
2530
+ export type List5Error = List5Errors[keyof List5Errors];
2531
+ export type List5Responses = {
924
2532
  /**
925
2533
  * Successful response
926
2534
  */
927
2535
  200: {
928
- /**
929
- * Organizations matching the query.
930
- */
931
2536
  organizations: Array<{
932
2537
  /**
933
2538
  * Organization ID (format: org_xxxxxxxxxxxx).
@@ -937,12 +2542,6 @@ export type List3Responses = {
937
2542
  * Human-readable name of the organization.
938
2543
  */
939
2544
  name: string;
940
- /**
941
- * Free-form metadata attached to the organization (shape is up to you).
942
- */
943
- metadata?: {
944
- [key: string]: unknown;
945
- };
946
2545
  /**
947
2546
  * ISO timestamp when the organization was created.
948
2547
  */
@@ -953,13 +2552,21 @@ export type List3Responses = {
953
2552
  updatedAt: string;
954
2553
  }>;
955
2554
  /**
956
- * Total number of organizations matching the query.
2555
+ * Total number of items matching the query.
957
2556
  */
958
2557
  total: number;
2558
+ /**
2559
+ * Page size applied to this response.
2560
+ */
2561
+ limit: number;
2562
+ /**
2563
+ * Offset applied to this response.
2564
+ */
2565
+ offset: number;
959
2566
  };
960
2567
  };
961
- export type List3Response = List3Responses[keyof List3Responses];
962
- export type Create2Data = {
2568
+ export type List5Response = List5Responses[keyof List5Responses];
2569
+ export type Create4Data = {
963
2570
  body?: {
964
2571
  /**
965
2572
  * Human-readable name of the organization (must be unique).
@@ -980,7 +2587,7 @@ export type Create2Data = {
980
2587
  query?: never;
981
2588
  url: '/organizations';
982
2589
  };
983
- export type Create2Errors = {
2590
+ export type Create4Errors = {
984
2591
  /**
985
2592
  * Bad request
986
2593
  */
@@ -1012,8 +2619,8 @@ export type Create2Errors = {
1012
2619
  };
1013
2620
  };
1014
2621
  };
1015
- export type Create2Error = Create2Errors[keyof Create2Errors];
1016
- export type Create2Responses = {
2622
+ export type Create4Error = Create4Errors[keyof Create4Errors];
2623
+ export type Create4Responses = {
1017
2624
  /**
1018
2625
  * Successful response
1019
2626
  */
@@ -1030,12 +2637,6 @@ export type Create2Responses = {
1030
2637
  * Human-readable name of the organization.
1031
2638
  */
1032
2639
  name: string;
1033
- /**
1034
- * Free-form metadata attached to the organization (shape is up to you).
1035
- */
1036
- metadata?: {
1037
- [key: string]: unknown;
1038
- };
1039
2640
  /**
1040
2641
  * ISO timestamp when the organization was created.
1041
2642
  */
@@ -1044,6 +2645,12 @@ export type Create2Responses = {
1044
2645
  * ISO timestamp of the last update.
1045
2646
  */
1046
2647
  updatedAt: string;
2648
+ /**
2649
+ * Free-form metadata attached to the organization (shape is up to you).
2650
+ */
2651
+ metadata?: {
2652
+ [key: string]: unknown;
2653
+ };
1047
2654
  };
1048
2655
  /**
1049
2656
  * Scoped API key for the newly-created organization — shown only once. Store it securely; it cannot be retrieved later. Present only when `generateApiKey: true` was passed in the request.
@@ -1051,16 +2658,19 @@ export type Create2Responses = {
1051
2658
  apiKey?: string;
1052
2659
  };
1053
2660
  };
1054
- export type Create2Response = Create2Responses[keyof Create2Responses];
1055
- export type Delete2Data = {
2661
+ export type Create4Response = Create4Responses[keyof Create4Responses];
2662
+ export type Delete4Data = {
1056
2663
  body?: never;
1057
2664
  path: {
2665
+ /**
2666
+ * Organization ID (format: `org_xxxxxxxxxxxx`).
2667
+ */
1058
2668
  id: string;
1059
2669
  };
1060
2670
  query?: never;
1061
2671
  url: '/organizations/{id}';
1062
2672
  };
1063
- export type Delete2Errors = {
2673
+ export type Delete4Errors = {
1064
2674
  /**
1065
2675
  * Bad request
1066
2676
  */
@@ -1092,8 +2702,8 @@ export type Delete2Errors = {
1092
2702
  };
1093
2703
  };
1094
2704
  };
1095
- export type Delete2Error = Delete2Errors[keyof Delete2Errors];
1096
- export type Delete2Responses = {
2705
+ export type Delete4Error = Delete4Errors[keyof Delete4Errors];
2706
+ export type Delete4Responses = {
1097
2707
  /**
1098
2708
  * Successful response
1099
2709
  */
@@ -1104,16 +2714,19 @@ export type Delete2Responses = {
1104
2714
  message: string;
1105
2715
  };
1106
2716
  };
1107
- export type Delete2Response = Delete2Responses[keyof Delete2Responses];
1108
- export type Get3Data = {
2717
+ export type Delete4Response = Delete4Responses[keyof Delete4Responses];
2718
+ export type Get5Data = {
1109
2719
  body?: never;
1110
2720
  path: {
2721
+ /**
2722
+ * Organization ID (format: `org_xxxxxxxxxxxx`).
2723
+ */
1111
2724
  id: string;
1112
2725
  };
1113
2726
  query?: never;
1114
2727
  url: '/organizations/{id}';
1115
2728
  };
1116
- export type Get3Errors = {
2729
+ export type Get5Errors = {
1117
2730
  /**
1118
2731
  * Bad request
1119
2732
  */
@@ -1145,8 +2758,8 @@ export type Get3Errors = {
1145
2758
  };
1146
2759
  };
1147
2760
  };
1148
- export type Get3Error = Get3Errors[keyof Get3Errors];
1149
- export type Get3Responses = {
2761
+ export type Get5Error = Get5Errors[keyof Get5Errors];
2762
+ export type Get5Responses = {
1150
2763
  /**
1151
2764
  * Successful response
1152
2765
  */
@@ -1159,12 +2772,6 @@ export type Get3Responses = {
1159
2772
  * Human-readable name of the organization.
1160
2773
  */
1161
2774
  name: string;
1162
- /**
1163
- * Free-form metadata attached to the organization (shape is up to you).
1164
- */
1165
- metadata?: {
1166
- [key: string]: unknown;
1167
- };
1168
2775
  /**
1169
2776
  * ISO timestamp when the organization was created.
1170
2777
  */
@@ -1173,10 +2780,16 @@ export type Get3Responses = {
1173
2780
  * ISO timestamp of the last update.
1174
2781
  */
1175
2782
  updatedAt: string;
2783
+ /**
2784
+ * Free-form metadata attached to the organization (shape is up to you).
2785
+ */
2786
+ metadata?: {
2787
+ [key: string]: unknown;
2788
+ };
1176
2789
  };
1177
2790
  };
1178
- export type Get3Response = Get3Responses[keyof Get3Responses];
1179
- export type Update2Data = {
2791
+ export type Get5Response = Get5Responses[keyof Get5Responses];
2792
+ export type Update4Data = {
1180
2793
  body?: {
1181
2794
  /**
1182
2795
  * New name for the organization.
@@ -1190,12 +2803,15 @@ export type Update2Data = {
1190
2803
  };
1191
2804
  };
1192
2805
  path: {
2806
+ /**
2807
+ * Organization ID (format: `org_xxxxxxxxxxxx`).
2808
+ */
1193
2809
  id: string;
1194
2810
  };
1195
2811
  query?: never;
1196
2812
  url: '/organizations/{id}';
1197
2813
  };
1198
- export type Update2Errors = {
2814
+ export type Update4Errors = {
1199
2815
  /**
1200
2816
  * Bad request
1201
2817
  */
@@ -1227,8 +2843,8 @@ export type Update2Errors = {
1227
2843
  };
1228
2844
  };
1229
2845
  };
1230
- export type Update2Error = Update2Errors[keyof Update2Errors];
1231
- export type Update2Responses = {
2846
+ export type Update4Error = Update4Errors[keyof Update4Errors];
2847
+ export type Update4Responses = {
1232
2848
  /**
1233
2849
  * Successful response
1234
2850
  */
@@ -1241,12 +2857,6 @@ export type Update2Responses = {
1241
2857
  * Human-readable name of the organization.
1242
2858
  */
1243
2859
  name: string;
1244
- /**
1245
- * Free-form metadata attached to the organization (shape is up to you).
1246
- */
1247
- metadata?: {
1248
- [key: string]: unknown;
1249
- };
1250
2860
  /**
1251
2861
  * ISO timestamp when the organization was created.
1252
2862
  */
@@ -1255,7 +2865,13 @@ export type Update2Responses = {
1255
2865
  * ISO timestamp of the last update.
1256
2866
  */
1257
2867
  updatedAt: string;
2868
+ /**
2869
+ * Free-form metadata attached to the organization (shape is up to you).
2870
+ */
2871
+ metadata?: {
2872
+ [key: string]: unknown;
2873
+ };
1258
2874
  };
1259
2875
  };
1260
- export type Update2Response = Update2Responses[keyof Update2Responses];
2876
+ export type Update4Response = Update4Responses[keyof Update4Responses];
1261
2877
  //# sourceMappingURL=types.gen.d.ts.map