@automagik/omni 2.260424.2 → 2.260427.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.
@@ -0,0 +1,2086 @@
1
+ /**
2
+ * Omni SDK Client
3
+ *
4
+ * Type-safe wrapper around the OpenAPI-generated types.
5
+ */
6
+ import type { components, operations, paths } from './types.generated';
7
+ export type Instance = components['schemas']['Instance'];
8
+ export type Person = components['schemas']['Person'];
9
+ export type Event = components['schemas']['Event'];
10
+ export type AccessRule = components['schemas']['AccessRule'];
11
+ export type Setting = components['schemas']['Setting'];
12
+ export type Provider = components['schemas']['Provider'];
13
+ export type HealthResponse = components['schemas']['HealthResponse'];
14
+ export type PaginationMeta = components['schemas']['PaginationMeta'];
15
+ export type Automation = components['schemas']['Automation'];
16
+ export type DeadLetter = components['schemas']['DeadLetter'];
17
+ export type WebhookSource = components['schemas']['WebhookSource'];
18
+ export type PayloadConfig = components['schemas']['PayloadConfig'];
19
+ export type ReplaySession = components['schemas']['ReplaySession'];
20
+ export type LogEntry = components['schemas']['LogEntry'];
21
+ export type EventMetrics = components['schemas']['EventMetrics'];
22
+ export type EventAnalytics = components['schemas']['EventAnalytics'];
23
+ export interface ChatSettings {
24
+ muted?: boolean;
25
+ muteUntil?: string;
26
+ pinned?: boolean;
27
+ archived?: boolean;
28
+ readOnly?: boolean;
29
+ slowMode?: number;
30
+ agentPaused?: boolean;
31
+ [key: string]: unknown;
32
+ }
33
+ export interface Chat {
34
+ id: string;
35
+ instanceId: string;
36
+ externalId: string;
37
+ chatType: string;
38
+ channel: string;
39
+ name?: string | null;
40
+ description?: string | null;
41
+ avatarUrl?: string | null;
42
+ /**
43
+ * Derived flag: true when the chat is a multi-party conversation
44
+ * (chatType group/community, or WhatsApp `@g.us` externalId). Computed
45
+ * server-side so clients can filter groups without platform-specific checks.
46
+ */
47
+ isGroup?: boolean;
48
+ isArchived: boolean;
49
+ settings?: ChatSettings | null;
50
+ createdAt: string;
51
+ updatedAt: string;
52
+ }
53
+ export interface Message {
54
+ id: string;
55
+ chatId: string;
56
+ externalId: string;
57
+ source: string;
58
+ messageType: string;
59
+ textContent?: string | null;
60
+ platformTimestamp: string;
61
+ isFromMe?: boolean;
62
+ createdAt: string;
63
+ updatedAt: string;
64
+ }
65
+ export interface ChatParticipant {
66
+ id: string;
67
+ chatId: string;
68
+ platformUserId: string;
69
+ displayName?: string | null;
70
+ avatarUrl?: string | null;
71
+ role?: string | null;
72
+ createdAt: string;
73
+ updatedAt: string;
74
+ }
75
+ export type Channel = 'whatsapp-baileys' | 'whatsapp-cloud' | 'discord' | 'slack' | 'telegram' | 'a2a' | 'gupshup' | 'twilio-whatsapp' | 'internal';
76
+ export interface PaginatedResponse<T> {
77
+ items: T[];
78
+ meta: PaginationMeta & {
79
+ total?: number;
80
+ };
81
+ }
82
+ export interface TurnItem {
83
+ id: string;
84
+ instanceId: string;
85
+ chatId: string;
86
+ messageId: string;
87
+ agentId: string;
88
+ apiKeyId: string;
89
+ status: string;
90
+ action: string | null;
91
+ nudgeCount: number;
92
+ messagesSent: number;
93
+ startedAt: string;
94
+ lastActivityAt: string;
95
+ closedAt: string | null;
96
+ closedReason: string | null;
97
+ metadata?: Record<string, unknown> | null;
98
+ }
99
+ export interface TurnListResponse {
100
+ items: TurnItem[];
101
+ total: number;
102
+ limit: number;
103
+ offset: number;
104
+ }
105
+ export interface TurnStats {
106
+ openCount: number;
107
+ totalCount: number;
108
+ avgDurationMs: number;
109
+ timeoutRate: number;
110
+ }
111
+ /** Batch job type */
112
+ export type BatchJobType = 'targeted_chat_sync' | 'time_based_batch' | 'media_redownload';
113
+ /** Job status */
114
+ export type BatchJobStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
115
+ /** Content types processable by batch jobs */
116
+ export type ProcessableContentType = 'audio' | 'image' | 'video' | 'document';
117
+ /** Batch job record */
118
+ export interface BatchJob {
119
+ id: string;
120
+ jobType: string;
121
+ instanceId: string;
122
+ status: string;
123
+ requestParams: Record<string, unknown>;
124
+ totalItems: number;
125
+ processedItems: number;
126
+ failedItems: number;
127
+ currentItem?: string | null;
128
+ progressPercent: number;
129
+ totalCostUsd?: number | null;
130
+ totalTokens?: number | null;
131
+ errorMessage?: string | null;
132
+ errors?: Array<{
133
+ itemId: string;
134
+ error: string;
135
+ }>;
136
+ createdAt: string;
137
+ startedAt?: string | null;
138
+ completedAt?: string | null;
139
+ }
140
+ /** Batch job status (lightweight for polling) */
141
+ export interface BatchJobStatusResponse {
142
+ id: string;
143
+ status: string;
144
+ totalItems: number;
145
+ processedItems: number;
146
+ failedItems: number;
147
+ skippedItems: number;
148
+ progressPercent: number;
149
+ currentItem?: string | null;
150
+ totalCostUsd?: number | null;
151
+ totalTokens?: number | null;
152
+ estimatedCompletion?: string | null;
153
+ startedAt?: string | null;
154
+ completedAt?: string | null;
155
+ }
156
+ /** Body for creating a batch job */
157
+ export interface CreateBatchJobBody {
158
+ jobType: BatchJobType;
159
+ instanceId: string;
160
+ chatId?: string;
161
+ daysBack?: number;
162
+ limit?: number;
163
+ contentTypes?: ProcessableContentType[];
164
+ force?: boolean;
165
+ /** Minimum random delay between items in ms (default: 1000) */
166
+ delayMinMs?: number;
167
+ /** Maximum random delay between items in ms (default: 3000) */
168
+ delayMaxMs?: number;
169
+ }
170
+ /** Query parameters for listing batch jobs */
171
+ export interface ListBatchJobsParams {
172
+ instanceId?: string;
173
+ status?: BatchJobStatus[];
174
+ jobType?: BatchJobType[];
175
+ limit?: number;
176
+ cursor?: string;
177
+ }
178
+ /** Cost estimation result */
179
+ export interface CostEstimate {
180
+ totalItems: number;
181
+ audioCount: number;
182
+ imageCount: number;
183
+ videoCount: number;
184
+ documentCount: number;
185
+ estimatedCostCents: number;
186
+ estimatedCostUsd: number;
187
+ estimatedDurationMinutes: number;
188
+ }
189
+ /**
190
+ * Client configuration
191
+ */
192
+ export interface OmniClientConfig {
193
+ /** Base URL of the API (e.g., 'http://localhost:8882') */
194
+ baseUrl: string;
195
+ /** API key for authentication */
196
+ apiKey: string;
197
+ /** Optional CLI version for request handshake header */
198
+ cliVersion?: string;
199
+ }
200
+ /**
201
+ * Query parameters for listing instances
202
+ */
203
+ export interface ListInstancesParams {
204
+ channel?: string;
205
+ status?: string;
206
+ limit?: number;
207
+ cursor?: string;
208
+ }
209
+ /**
210
+ * Body for creating an instance
211
+ */
212
+ export interface CreateInstanceBody {
213
+ name: string;
214
+ channel: Channel;
215
+ agentProviderId?: string;
216
+ agentId?: string;
217
+ twilioAccountSid?: string;
218
+ twilioAuthToken?: string;
219
+ twilioFrom?: string;
220
+ twilioMessagingServiceSid?: string;
221
+ twilioStatusCallbackUrl?: string;
222
+ twilioWebhookUrl?: string;
223
+ twilioValidateSignature?: boolean;
224
+ }
225
+ /**
226
+ * Body for sending a message
227
+ */
228
+ export interface SendMessageBody {
229
+ instanceId: string;
230
+ to: string;
231
+ text: string;
232
+ replyTo?: string;
233
+ threadId?: string;
234
+ }
235
+ /**
236
+ * Query parameters for listing events
237
+ */
238
+ export interface ListEventsParams {
239
+ channel?: string;
240
+ instanceId?: string;
241
+ eventType?: string;
242
+ since?: string;
243
+ until?: string;
244
+ search?: string;
245
+ limit?: number;
246
+ cursor?: string;
247
+ }
248
+ /**
249
+ * Query parameters for searching persons
250
+ */
251
+ export interface SearchPersonsParams {
252
+ search: string;
253
+ limit?: number;
254
+ }
255
+ /**
256
+ * Query parameters for listing access rules
257
+ */
258
+ export interface ListAccessRulesParams {
259
+ instanceId?: string;
260
+ type?: 'allow' | 'deny';
261
+ }
262
+ /**
263
+ * Body for creating an access rule
264
+ */
265
+ export interface CreateAccessRuleBody {
266
+ ruleType: 'allow' | 'deny';
267
+ instanceId?: string;
268
+ phonePattern?: string;
269
+ platformUserId?: string;
270
+ priority?: number;
271
+ action?: 'block' | 'silent_block' | 'allow';
272
+ reason?: string;
273
+ blockMessage?: string;
274
+ enabled?: boolean;
275
+ }
276
+ /**
277
+ * Parameters for checking access
278
+ */
279
+ export interface CheckAccessParams {
280
+ instanceId: string;
281
+ platformUserId: string;
282
+ channel: string;
283
+ }
284
+ /**
285
+ * Result of access check
286
+ */
287
+ export interface CheckAccessResult {
288
+ allowed: boolean;
289
+ reason: string | null;
290
+ rule?: AccessRule | null;
291
+ }
292
+ /**
293
+ * Pairing request item returned from list endpoint
294
+ */
295
+ export interface PairingRequestItem {
296
+ id: string;
297
+ instanceId: string;
298
+ platformUserId: string;
299
+ pairingCode: string;
300
+ expiresAt: string;
301
+ createdAt: string;
302
+ }
303
+ /**
304
+ * Result of pairing request action (approve/deny)
305
+ */
306
+ export interface PairingActionResult {
307
+ action: 'approve' | 'deny';
308
+ ruleId?: string;
309
+ reason?: string;
310
+ message?: string;
311
+ }
312
+ /**
313
+ * Query parameters for listing settings
314
+ */
315
+ export interface ListSettingsParams {
316
+ category?: string;
317
+ }
318
+ /**
319
+ * Query parameters for listing providers
320
+ */
321
+ export interface ListProvidersParams {
322
+ active?: boolean;
323
+ }
324
+ /**
325
+ * Provider schema type
326
+ * - agno: Agno AI orchestration platform
327
+ * - webhook: Webhook-based agent provider
328
+ * - openclaw: OpenClaw Gateway (WebSocket session-based agent runtime)
329
+ * - ag-ui: AG-UI protocol
330
+ * - claude-code: Claude Code agent provider
331
+ * - a2a: Agent-to-Agent protocol provider
332
+ * - nats-genie: NATS-based Genie provider (publishes to NATS topics)
333
+ */
334
+ export type ProviderSchema = 'agno' | 'webhook' | 'openclaw' | 'ag-ui' | 'claude-code' | 'a2a' | 'nats-genie';
335
+ /**
336
+ * Body for creating a provider
337
+ */
338
+ export interface NewAgentProvider {
339
+ name: string;
340
+ schema: ProviderSchema;
341
+ baseUrl: string;
342
+ apiKey?: string;
343
+ schemaConfig?: Record<string, unknown>;
344
+ defaultStream?: boolean;
345
+ defaultTimeout?: number;
346
+ supportsStreaming?: boolean;
347
+ supportsImages?: boolean;
348
+ supportsAudio?: boolean;
349
+ supportsDocuments?: boolean;
350
+ description?: string;
351
+ tags?: string[];
352
+ }
353
+ /**
354
+ * Provider health check result
355
+ */
356
+ export interface ProviderHealthResult {
357
+ healthy: boolean;
358
+ latency: number;
359
+ error?: string;
360
+ }
361
+ /**
362
+ * Agno agent entity
363
+ *
364
+ * agno 2.5+ returns `id` at the top level. `agent_id` is kept optional for
365
+ * backward compatibility with pre-2.5 deployments.
366
+ */
367
+ export interface AgnoAgent {
368
+ id: string;
369
+ /** @deprecated pre-agno-2.5 field; use `id` */
370
+ agent_id?: string;
371
+ name: string;
372
+ model?: {
373
+ provider?: string;
374
+ name?: string;
375
+ };
376
+ description?: string;
377
+ instructions?: string[];
378
+ }
379
+ /**
380
+ * Agno team entity
381
+ *
382
+ * agno 2.5+ returns `id` at the top level. `team_id` is kept optional for
383
+ * backward compatibility with pre-2.5 deployments.
384
+ */
385
+ export interface AgnoTeam {
386
+ id: string;
387
+ /** @deprecated pre-agno-2.5 field; use `id` */
388
+ team_id?: string;
389
+ name: string;
390
+ description?: string;
391
+ mode?: string;
392
+ members?: Array<{
393
+ agent_id: string;
394
+ id?: string;
395
+ role?: string;
396
+ }>;
397
+ }
398
+ /**
399
+ * Agno workflow entity
400
+ *
401
+ * agno 2.5+ returns `id` at the top level. `workflow_id` is kept optional for
402
+ * backward compatibility with pre-2.5 deployments.
403
+ */
404
+ export interface AgnoWorkflow {
405
+ id: string;
406
+ /** @deprecated pre-agno-2.5 field; use `id` */
407
+ workflow_id?: string;
408
+ name: string;
409
+ description?: string;
410
+ }
411
+ /**
412
+ * Query parameters for listing chats
413
+ */
414
+ export interface ListChatsParams {
415
+ instanceId?: string;
416
+ channel?: string;
417
+ chatType?: string;
418
+ excludeChatTypes?: string;
419
+ search?: string;
420
+ includeArchived?: boolean;
421
+ unreadOnly?: boolean;
422
+ sort?: 'activity' | 'unread' | 'name';
423
+ limit?: number;
424
+ cursor?: string;
425
+ pendingOnly?: boolean;
426
+ attentionOnly?: boolean;
427
+ label?: string;
428
+ includeHidden?: boolean;
429
+ }
430
+ /**
431
+ * Body for creating a chat
432
+ */
433
+ export interface CreateChatBody {
434
+ instanceId: string;
435
+ externalId: string;
436
+ chatType: string;
437
+ channel: Channel;
438
+ name?: string;
439
+ description?: string;
440
+ avatarUrl?: string;
441
+ canonicalId?: string;
442
+ parentChatId?: string;
443
+ settings?: Record<string, unknown>;
444
+ platformMetadata?: Record<string, unknown>;
445
+ }
446
+ /**
447
+ * Body for updating a chat
448
+ */
449
+ export interface UpdateChatBody {
450
+ name?: string;
451
+ description?: string;
452
+ avatarUrl?: string | null;
453
+ canonicalId?: string | null;
454
+ settings?: Record<string, unknown> | null;
455
+ platformMetadata?: Record<string, unknown> | null;
456
+ }
457
+ /**
458
+ * Body for adding a chat participant
459
+ */
460
+ export interface AddParticipantBody {
461
+ platformUserId: string;
462
+ displayName?: string;
463
+ avatarUrl?: string;
464
+ role?: string;
465
+ personId?: string;
466
+ platformIdentityId?: string;
467
+ platformMetadata?: Record<string, unknown>;
468
+ }
469
+ /**
470
+ * Query parameters for listing chat messages
471
+ */
472
+ export interface ListChatMessagesParams {
473
+ limit?: number;
474
+ before?: string;
475
+ after?: string;
476
+ mediaOnly?: boolean;
477
+ }
478
+ /**
479
+ * Query parameters for listing logs
480
+ */
481
+ export interface ListLogsParams {
482
+ modules?: string;
483
+ level?: 'debug' | 'info' | 'warn' | 'error';
484
+ limit?: number;
485
+ }
486
+ /**
487
+ * Query parameters for listing automations
488
+ */
489
+ export interface ListAutomationsParams {
490
+ enabled?: boolean;
491
+ }
492
+ /**
493
+ * Body for creating an automation
494
+ */
495
+ export interface CreateAutomationBody {
496
+ name: string;
497
+ description?: string;
498
+ triggerEventType: string;
499
+ triggerConditions?: Array<{
500
+ field: string;
501
+ operator: 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte' | 'contains' | 'not_contains' | 'exists' | 'not_exists' | 'regex';
502
+ value?: unknown;
503
+ }>;
504
+ /** Condition logic: 'and' (all must match) or 'or' (any must match). Defaults to 'and'. */
505
+ conditionLogic?: 'and' | 'or';
506
+ actions: Array<{
507
+ type: 'webhook' | 'send_message' | 'emit_event' | 'log' | 'call_agent';
508
+ config: Record<string, unknown>;
509
+ }>;
510
+ debounce?: Record<string, unknown>;
511
+ enabled?: boolean;
512
+ priority?: number;
513
+ }
514
+ /**
515
+ * Body for testing an automation
516
+ */
517
+ export interface TestAutomationBody {
518
+ event: {
519
+ type: string;
520
+ payload: Record<string, unknown>;
521
+ };
522
+ }
523
+ /**
524
+ * Query parameters for listing automation logs
525
+ */
526
+ export interface ListAutomationLogsParams {
527
+ limit?: number;
528
+ cursor?: string;
529
+ status?: 'success' | 'failed' | 'skipped';
530
+ eventType?: string;
531
+ automationId?: string;
532
+ }
533
+ /**
534
+ * Query parameters for listing dead letters
535
+ */
536
+ export interface ListDeadLettersParams {
537
+ status?: string;
538
+ eventType?: string;
539
+ since?: string;
540
+ until?: string;
541
+ limit?: number;
542
+ cursor?: string;
543
+ }
544
+ /**
545
+ * Body for resolving a dead letter
546
+ */
547
+ export interface ResolveDeadLetterBody {
548
+ note: string;
549
+ }
550
+ /**
551
+ * Query parameters for listing webhook sources
552
+ */
553
+ export interface ListWebhookSourcesParams {
554
+ enabled?: boolean;
555
+ }
556
+ /**
557
+ * Body for creating a webhook source
558
+ */
559
+ export interface CreateWebhookSourceBody {
560
+ name: string;
561
+ description?: string;
562
+ expectedHeaders?: Record<string, boolean>;
563
+ enabled?: boolean;
564
+ }
565
+ /**
566
+ * Body for triggering a custom event
567
+ */
568
+ export interface TriggerEventBody {
569
+ eventType: string;
570
+ payload: Record<string, unknown>;
571
+ correlationId?: string;
572
+ instanceId?: string;
573
+ }
574
+ /**
575
+ * Body for starting a replay
576
+ */
577
+ export interface StartReplayBody {
578
+ since: string;
579
+ until?: string;
580
+ eventTypes?: string[];
581
+ instanceId?: string;
582
+ limit?: number;
583
+ speedMultiplier?: number;
584
+ skipProcessed?: boolean;
585
+ dryRun?: boolean;
586
+ }
587
+ /**
588
+ * Body for updating payload config
589
+ */
590
+ export interface UpdatePayloadConfigBody {
591
+ storeWebhookRaw?: boolean;
592
+ storeAgentRequest?: boolean;
593
+ storeAgentResponse?: boolean;
594
+ storeChannelSend?: boolean;
595
+ storeError?: boolean;
596
+ retentionDays?: number;
597
+ }
598
+ /**
599
+ * Body for deleting payloads
600
+ */
601
+ export interface DeletePayloadsBody {
602
+ reason: string;
603
+ }
604
+ /**
605
+ * Body for sending media
606
+ */
607
+ export interface SendMediaBody {
608
+ instanceId: string;
609
+ to: string;
610
+ type: 'image' | 'audio' | 'video' | 'document';
611
+ url?: string;
612
+ base64?: string;
613
+ filename?: string;
614
+ caption?: string;
615
+ voiceNote?: boolean;
616
+ threadId?: string;
617
+ }
618
+ /**
619
+ * Body for sending a reaction
620
+ */
621
+ export interface SendReactionBody {
622
+ instanceId: string;
623
+ to: string;
624
+ messageId: string;
625
+ emoji: string;
626
+ }
627
+ /**
628
+ * Body for removing a reaction
629
+ */
630
+ export interface RemoveReactionBody {
631
+ instanceId: string;
632
+ emoji: string;
633
+ }
634
+ /**
635
+ * Body for forwarding a message
636
+ */
637
+ export interface SendForwardBody {
638
+ instanceId: string;
639
+ to: string;
640
+ messageId: string;
641
+ fromChatId: string;
642
+ }
643
+ /**
644
+ * Body for sending a sticker
645
+ */
646
+ export interface SendStickerBody {
647
+ instanceId: string;
648
+ to: string;
649
+ url?: string;
650
+ base64?: string;
651
+ }
652
+ /**
653
+ * Body for sending a contact
654
+ */
655
+ export interface SendContactBody {
656
+ instanceId: string;
657
+ to: string;
658
+ contact: {
659
+ name: string;
660
+ phone?: string;
661
+ email?: string;
662
+ organization?: string;
663
+ };
664
+ }
665
+ /**
666
+ * Body for sending a TTS voice note
667
+ */
668
+ export interface SendTtsBody {
669
+ instanceId: string;
670
+ to: string;
671
+ text: string;
672
+ voiceId?: string;
673
+ modelId?: string;
674
+ stability?: number;
675
+ similarityBoost?: number;
676
+ presenceDelay?: number;
677
+ }
678
+ /**
679
+ * TTS voice configuration
680
+ */
681
+ export interface TtsVoice {
682
+ voiceId: string;
683
+ name: string;
684
+ category?: string;
685
+ labels?: Record<string, string>;
686
+ }
687
+ /**
688
+ * TTS send response
689
+ */
690
+ export interface TtsResponse {
691
+ messageId: string;
692
+ status: string;
693
+ audioSizeKb: number;
694
+ durationMs: number;
695
+ timestamp: number;
696
+ }
697
+ /**
698
+ * Body for sending a location
699
+ */
700
+ export interface SendLocationBody {
701
+ instanceId: string;
702
+ to: string;
703
+ latitude: number;
704
+ longitude: number;
705
+ name?: string;
706
+ address?: string;
707
+ }
708
+ /**
709
+ * Body for sending a poll (Discord)
710
+ */
711
+ export interface SendPollBody {
712
+ instanceId: string;
713
+ to: string;
714
+ question: string;
715
+ answers: string[];
716
+ durationHours?: number;
717
+ multiSelect?: boolean;
718
+ replyTo?: string;
719
+ }
720
+ /**
721
+ * Body for sending an embed (Discord)
722
+ */
723
+ export interface SendEmbedBody {
724
+ instanceId: string;
725
+ to: string;
726
+ title?: string;
727
+ description?: string;
728
+ color?: number;
729
+ url?: string;
730
+ timestamp?: string;
731
+ footer?: {
732
+ text: string;
733
+ iconUrl?: string;
734
+ };
735
+ author?: {
736
+ name: string;
737
+ url?: string;
738
+ iconUrl?: string;
739
+ };
740
+ thumbnail?: string;
741
+ image?: string;
742
+ fields?: Array<{
743
+ name: string;
744
+ value: string;
745
+ inline?: boolean;
746
+ }>;
747
+ replyTo?: string;
748
+ }
749
+ /**
750
+ * Body for connecting an instance
751
+ */
752
+ export interface ConnectInstanceBody {
753
+ token?: string;
754
+ forceNewQr?: boolean;
755
+ twilioAccountSid?: string;
756
+ twilioAuthToken?: string;
757
+ twilioFrom?: string;
758
+ twilioMessagingServiceSid?: string;
759
+ twilioStatusCallbackUrl?: string;
760
+ twilioWebhookUrl?: string;
761
+ twilioValidateSignature?: boolean;
762
+ /** WhatsApp-specific connection options */
763
+ whatsapp?: {
764
+ /** Sync full message history on connect (default: true) */
765
+ syncFullHistory?: boolean;
766
+ };
767
+ }
768
+ /**
769
+ * Body for starting a sync
770
+ */
771
+ export interface StartSyncBody {
772
+ type: 'profile' | 'messages' | 'contacts' | 'groups' | 'all';
773
+ depth?: '7d' | '30d' | '90d' | '1y' | 'all';
774
+ channelId?: string;
775
+ downloadMedia?: boolean;
776
+ /** Specific chat JIDs for per-chat active sync (WhatsApp only). Omit for passive sync. */
777
+ chatJids?: string[];
778
+ }
779
+ /**
780
+ * Query parameters for listing syncs
781
+ */
782
+ export interface ListSyncsParams {
783
+ status?: string;
784
+ limit?: number;
785
+ }
786
+ /**
787
+ * Body for requesting a pairing code
788
+ */
789
+ export interface RequestPairingCodeBody {
790
+ phoneNumber: string;
791
+ }
792
+ /**
793
+ * Result of profile sync
794
+ */
795
+ export interface SyncProfileResult {
796
+ type: 'profile';
797
+ status: string;
798
+ profile: {
799
+ name?: string | null;
800
+ avatarUrl?: string | null;
801
+ bio?: string | null;
802
+ platformMetadata?: Record<string, unknown> | null;
803
+ syncedAt?: string | null;
804
+ } | null;
805
+ }
806
+ /**
807
+ * Sync job created response
808
+ */
809
+ export interface SyncJobCreated {
810
+ jobId: string;
811
+ instanceId: string;
812
+ type: string;
813
+ status: string;
814
+ config: Record<string, unknown>;
815
+ message: string;
816
+ }
817
+ /**
818
+ * Sync job summary (for list)
819
+ */
820
+ export interface SyncJobSummary {
821
+ jobId: string;
822
+ type: string;
823
+ status: string;
824
+ progressPercent?: number | null;
825
+ createdAt: string;
826
+ completedAt?: string | null;
827
+ }
828
+ /**
829
+ * Sync job status (detailed)
830
+ */
831
+ export interface SyncJobStatus {
832
+ jobId: string;
833
+ instanceId: string;
834
+ type: string;
835
+ status: string;
836
+ config: Record<string, unknown>;
837
+ progress?: Record<string, unknown> | null;
838
+ progressPercent?: number | null;
839
+ errorMessage?: string | null;
840
+ createdAt: string;
841
+ startedAt?: string | null;
842
+ completedAt?: string | null;
843
+ }
844
+ /**
845
+ * Auth validation response
846
+ */
847
+ export interface AuthValidateResponse {
848
+ valid: boolean;
849
+ keyPrefix: string;
850
+ keyName: string;
851
+ scopes: string[];
852
+ }
853
+ /** API key status */
854
+ export type ApiKeyStatus = 'active' | 'revoked' | 'expired';
855
+ /** API key record */
856
+ export interface ApiKeyRecord {
857
+ id: string;
858
+ name: string;
859
+ description?: string | null;
860
+ keyPrefix: string;
861
+ scopes: string[];
862
+ instanceIds?: string[] | null;
863
+ status: ApiKeyStatus;
864
+ rateLimit?: number | null;
865
+ expiresAt?: string | null;
866
+ lastUsedAt?: string | null;
867
+ usageCount: number;
868
+ revokedAt?: string | null;
869
+ revokedBy?: string | null;
870
+ revokeReason?: string | null;
871
+ createdAt: string;
872
+ createdBy?: string | null;
873
+ updatedAt: string;
874
+ }
875
+ /** Body for creating an API key */
876
+ export interface CreateApiKeyBody {
877
+ name: string;
878
+ description?: string;
879
+ scopes: string[];
880
+ instanceIds?: string[];
881
+ rateLimit?: number;
882
+ expiresAt?: string;
883
+ }
884
+ /** Body for updating an API key */
885
+ export interface UpdateApiKeyBody {
886
+ name?: string;
887
+ description?: string | null;
888
+ scopes?: string[];
889
+ instanceIds?: string[] | null;
890
+ rateLimit?: number | null;
891
+ expiresAt?: string | null;
892
+ }
893
+ /** Body for revoking an API key */
894
+ export interface RevokeApiKeyBody {
895
+ reason?: string;
896
+ revokedBy?: string;
897
+ }
898
+ /** Query parameters for listing API keys */
899
+ export interface ListApiKeysParams {
900
+ status?: ApiKeyStatus;
901
+ limit?: number;
902
+ }
903
+ /** Result of creating an API key (includes the plaintext key) */
904
+ export interface CreateApiKeyResult extends ApiKeyRecord {
905
+ plainTextKey: string;
906
+ }
907
+ /**
908
+ * Body for sending presence indicator
909
+ */
910
+ export interface SendPresenceBody {
911
+ instanceId: string;
912
+ to: string;
913
+ type: 'typing' | 'recording' | 'paused';
914
+ duration?: number;
915
+ }
916
+ /**
917
+ * Response from sending presence
918
+ */
919
+ export interface SendPresenceResult {
920
+ instanceId: string;
921
+ chatId: string;
922
+ type: string;
923
+ duration: number;
924
+ }
925
+ /**
926
+ * Body for marking a single message as read
927
+ */
928
+ export interface MarkMessageReadBody {
929
+ instanceId: string;
930
+ }
931
+ /**
932
+ * Body for marking multiple messages as read
933
+ */
934
+ export interface BatchMarkReadBody {
935
+ instanceId: string;
936
+ chatId: string;
937
+ messageIds: string[];
938
+ }
939
+ /**
940
+ * Body for marking entire chat as read
941
+ */
942
+ export interface MarkChatReadBody {
943
+ instanceId: string;
944
+ }
945
+ /**
946
+ * Response from marking messages as read
947
+ */
948
+ export interface MarkReadResult {
949
+ messageId?: string;
950
+ externalMessageId?: string;
951
+ chatId?: string;
952
+ instanceId?: string;
953
+ messageCount?: number;
954
+ }
955
+ /**
956
+ * Query parameters for listing contacts
957
+ */
958
+ export interface ListContactsParams {
959
+ limit?: number;
960
+ cursor?: string;
961
+ guildId?: string;
962
+ search?: string;
963
+ excludeGroups?: boolean;
964
+ }
965
+ /**
966
+ * Query parameters for listing groups
967
+ */
968
+ export interface ListGroupsParams {
969
+ limit?: number;
970
+ cursor?: string;
971
+ search?: string;
972
+ }
973
+ /**
974
+ * User profile from channel
975
+ */
976
+ export interface UserProfile {
977
+ platformUserId: string;
978
+ displayName?: string;
979
+ avatarUrl?: string;
980
+ bio?: string;
981
+ phone?: string;
982
+ platformMetadata?: Record<string, unknown>;
983
+ }
984
+ /**
985
+ * Contact from channel
986
+ */
987
+ export interface Contact {
988
+ platformUserId: string;
989
+ displayName?: string;
990
+ phone?: string;
991
+ avatarUrl?: string;
992
+ isGroup: boolean;
993
+ isBusiness?: boolean;
994
+ platformMetadata?: Record<string, unknown>;
995
+ }
996
+ /**
997
+ * Group from channel
998
+ */
999
+ export interface Group {
1000
+ externalId: string;
1001
+ name?: string;
1002
+ description?: string;
1003
+ memberCount?: number;
1004
+ createdAt?: string;
1005
+ avatarUrl?: string;
1006
+ platformMetadata?: Record<string, unknown>;
1007
+ }
1008
+ /**
1009
+ * Group member
1010
+ */
1011
+ export interface GroupMember {
1012
+ id: string;
1013
+ name?: string;
1014
+ role?: 'admin' | 'superadmin' | 'member';
1015
+ }
1016
+ /**
1017
+ * Create an Omni API client
1018
+ */
1019
+ export declare function createOmniClient(config: OmniClientConfig): {
1020
+ /**
1021
+ * Authentication
1022
+ */
1023
+ auth: {
1024
+ /**
1025
+ * Validate the current API key
1026
+ * Note: Uses type assertion until SDK types are regenerated
1027
+ */
1028
+ validate(): Promise<AuthValidateResponse>;
1029
+ };
1030
+ /**
1031
+ * Instance management
1032
+ */
1033
+ instances: {
1034
+ /**
1035
+ * List all instances
1036
+ */
1037
+ list(params?: ListInstancesParams): Promise<PaginatedResponse<Instance>>;
1038
+ /**
1039
+ * Get a single instance by ID
1040
+ */
1041
+ get(id: string): Promise<Instance>;
1042
+ /**
1043
+ * Create a new instance
1044
+ */
1045
+ create(body: CreateInstanceBody): Promise<Instance>;
1046
+ /**
1047
+ * Update an instance
1048
+ */
1049
+ update(id: string, body: Partial<Instance>): Promise<void>;
1050
+ /**
1051
+ * Delete an instance
1052
+ */
1053
+ delete(id: string): Promise<void>;
1054
+ /**
1055
+ * Get instance status
1056
+ */
1057
+ status(id: string): Promise<{
1058
+ state: string;
1059
+ isConnected: boolean;
1060
+ profileName?: string | null;
1061
+ }>;
1062
+ /**
1063
+ * Get QR code for WhatsApp instances
1064
+ */
1065
+ qr(id: string): Promise<{
1066
+ qr: string | null;
1067
+ expiresAt: string | null;
1068
+ message: string;
1069
+ }>;
1070
+ /**
1071
+ * Connect an instance
1072
+ */
1073
+ connect(id: string, body?: ConnectInstanceBody): Promise<{
1074
+ status: string;
1075
+ message: string;
1076
+ }>;
1077
+ /**
1078
+ * Disconnect an instance
1079
+ */
1080
+ disconnect(id: string): Promise<void>;
1081
+ /**
1082
+ * Restart an instance
1083
+ */
1084
+ restart(id: string, forceNewQr?: boolean): Promise<{
1085
+ status: string;
1086
+ message: string;
1087
+ }>;
1088
+ /**
1089
+ * Logout an instance (clear session)
1090
+ */
1091
+ logout(id: string): Promise<void>;
1092
+ /**
1093
+ * Request pairing code for WhatsApp
1094
+ */
1095
+ pair(id: string, body: RequestPairingCodeBody): Promise<{
1096
+ code: string;
1097
+ phoneNumber: string;
1098
+ message: string;
1099
+ expiresIn: number;
1100
+ }>;
1101
+ /**
1102
+ * Sync instance profile immediately
1103
+ */
1104
+ syncProfile(id: string): Promise<SyncProfileResult>;
1105
+ /**
1106
+ * Start a sync job (messages, contacts, groups, or all)
1107
+ */
1108
+ startSync(id: string, body: StartSyncBody): Promise<SyncJobCreated>;
1109
+ /**
1110
+ * List sync jobs for an instance
1111
+ */
1112
+ listSyncs(id: string, params?: ListSyncsParams): Promise<PaginatedResponse<SyncJobSummary>>;
1113
+ /**
1114
+ * Get sync job status
1115
+ */
1116
+ getSyncStatus(id: string, jobId: string): Promise<SyncJobStatus>;
1117
+ /**
1118
+ * List contacts for an instance
1119
+ */
1120
+ listContacts(id: string, params?: ListContactsParams): Promise<{
1121
+ items: Contact[];
1122
+ meta: {
1123
+ totalFetched: number;
1124
+ hasMore: boolean;
1125
+ cursor?: string;
1126
+ };
1127
+ }>;
1128
+ /**
1129
+ * List groups for an instance
1130
+ */
1131
+ listGroups(id: string, params?: ListGroupsParams): Promise<{
1132
+ items: Group[];
1133
+ meta: {
1134
+ totalFetched: number;
1135
+ hasMore: boolean;
1136
+ cursor?: string;
1137
+ };
1138
+ }>;
1139
+ /**
1140
+ * List members of a group
1141
+ */
1142
+ listGroupMembers(id: string, groupJid: string): Promise<{
1143
+ members: GroupMember[];
1144
+ }>;
1145
+ /**
1146
+ * Get user profile from channel
1147
+ */
1148
+ getUserProfile(id: string, userId: string): Promise<UserProfile>;
1149
+ };
1150
+ /**
1151
+ * Chat management
1152
+ * Note: Uses fetch directly until SDK types are regenerated
1153
+ */
1154
+ chats: {
1155
+ /**
1156
+ * List chats
1157
+ */
1158
+ list(params?: ListChatsParams): Promise<PaginatedResponse<Chat>>;
1159
+ /**
1160
+ * Get a chat by ID
1161
+ */
1162
+ get(id: string): Promise<Chat>;
1163
+ /**
1164
+ * Create a chat
1165
+ */
1166
+ create(body: CreateChatBody): Promise<Chat>;
1167
+ /**
1168
+ * Update a chat
1169
+ */
1170
+ update(id: string, body: UpdateChatBody): Promise<Chat>;
1171
+ /**
1172
+ * Delete a chat
1173
+ */
1174
+ delete(id: string): Promise<void>;
1175
+ /**
1176
+ * Archive a chat
1177
+ */
1178
+ archive(id: string): Promise<Chat>;
1179
+ /**
1180
+ * Unarchive a chat
1181
+ */
1182
+ unarchive(id: string): Promise<Chat>;
1183
+ /**
1184
+ * Get messages for a chat
1185
+ */
1186
+ getMessages(id: string, params?: ListChatMessagesParams): Promise<Message[]>;
1187
+ /**
1188
+ * List participants of a chat
1189
+ */
1190
+ listParticipants(id: string): Promise<ChatParticipant[]>;
1191
+ /**
1192
+ * Add a participant to a chat
1193
+ */
1194
+ addParticipant(id: string, body: AddParticipantBody): Promise<ChatParticipant>;
1195
+ /**
1196
+ * Remove a participant from a chat
1197
+ */
1198
+ removeParticipant(id: string, platformUserId: string): Promise<void>;
1199
+ /**
1200
+ * Hide a chat
1201
+ */
1202
+ hide(id: string): Promise<Chat>;
1203
+ /**
1204
+ * Unhide a chat
1205
+ */
1206
+ unhide(id: string): Promise<Chat>;
1207
+ /**
1208
+ * Add a label to a chat
1209
+ */
1210
+ addLabel(id: string, label: string): Promise<Chat>;
1211
+ /**
1212
+ * Remove a label from a chat
1213
+ */
1214
+ removeLabel(id: string, label: string): Promise<Chat>;
1215
+ /**
1216
+ * Mark entire chat as read
1217
+ */
1218
+ markRead(id: string, body: MarkChatReadBody): Promise<MarkReadResult>;
1219
+ };
1220
+ /**
1221
+ * Message sending
1222
+ */
1223
+ messages: {
1224
+ /**
1225
+ * Get a message by ID
1226
+ */
1227
+ get(messageId: string): Promise<Message>;
1228
+ /**
1229
+ * Send a text message
1230
+ */
1231
+ send(body: SendMessageBody): Promise<{
1232
+ messageId: string;
1233
+ status: string;
1234
+ }>;
1235
+ /**
1236
+ * Send a media message
1237
+ */
1238
+ sendMedia(body: SendMediaBody): Promise<{
1239
+ messageId: string;
1240
+ status: string;
1241
+ }>;
1242
+ /**
1243
+ * Send a reaction
1244
+ */
1245
+ sendReaction(body: SendReactionBody): Promise<{
1246
+ messageId?: string;
1247
+ success: boolean;
1248
+ }>;
1249
+ /**
1250
+ * Send a sticker
1251
+ */
1252
+ sendSticker(body: SendStickerBody): Promise<{
1253
+ messageId: string;
1254
+ status: string;
1255
+ }>;
1256
+ /**
1257
+ * Send a contact card
1258
+ */
1259
+ sendContact(body: SendContactBody): Promise<{
1260
+ messageId: string;
1261
+ status: string;
1262
+ }>;
1263
+ /**
1264
+ * Send a location
1265
+ */
1266
+ sendLocation(body: SendLocationBody): Promise<{
1267
+ messageId: string;
1268
+ status: string;
1269
+ }>;
1270
+ /**
1271
+ * Send a poll (Discord only)
1272
+ */
1273
+ sendPoll(body: SendPollBody): Promise<{
1274
+ messageId: string;
1275
+ status: string;
1276
+ }>;
1277
+ /**
1278
+ * Send an embed (Discord only)
1279
+ */
1280
+ sendEmbed(body: SendEmbedBody): Promise<{
1281
+ messageId: string;
1282
+ status: string;
1283
+ }>;
1284
+ /**
1285
+ * Send presence indicator (typing, recording, etc.)
1286
+ */
1287
+ sendPresence(body: SendPresenceBody): Promise<SendPresenceResult>;
1288
+ /**
1289
+ * Mark a single message as read
1290
+ */
1291
+ markRead(messageId: string, body: MarkMessageReadBody): Promise<MarkReadResult>;
1292
+ /**
1293
+ * Mark multiple messages as read in batch
1294
+ */
1295
+ batchMarkRead(body: BatchMarkReadBody): Promise<MarkReadResult>;
1296
+ /**
1297
+ * List available TTS voices
1298
+ */
1299
+ listVoices(): Promise<TtsVoice[]>;
1300
+ /**
1301
+ * Send a TTS voice note
1302
+ */
1303
+ sendTts(body: SendTtsBody): Promise<TtsResponse>;
1304
+ /**
1305
+ * Forward a message to another chat
1306
+ */
1307
+ sendForward(body: SendForwardBody): Promise<{
1308
+ messageId: string;
1309
+ status: string;
1310
+ }>;
1311
+ /**
1312
+ * Remove a reaction from a message
1313
+ */
1314
+ removeReaction(id: string, body: RemoveReactionBody): Promise<{
1315
+ success: boolean;
1316
+ }>;
1317
+ };
1318
+ /**
1319
+ * Event querying
1320
+ */
1321
+ events: {
1322
+ /**
1323
+ * List events with optional filters
1324
+ */
1325
+ list(params?: ListEventsParams): Promise<PaginatedResponse<Event>>;
1326
+ /**
1327
+ * Get a single event by ID
1328
+ */
1329
+ get(id: string): Promise<Event>;
1330
+ /**
1331
+ * Get event analytics
1332
+ */
1333
+ analytics(params?: {
1334
+ granularity?: "hourly" | "daily";
1335
+ }): Promise<EventAnalytics>;
1336
+ };
1337
+ /**
1338
+ * Person/identity search
1339
+ */
1340
+ persons: {
1341
+ /**
1342
+ * Search for persons
1343
+ */
1344
+ search(params: SearchPersonsParams): Promise<Person[]>;
1345
+ /**
1346
+ * Get a person by ID
1347
+ */
1348
+ get(id: string): Promise<Person>;
1349
+ /**
1350
+ * Get person presence (all identities and activity summary)
1351
+ */
1352
+ presence(id: string): Promise<{
1353
+ person: Person;
1354
+ identities: Array<Record<string, unknown>>;
1355
+ summary: Record<string, unknown>;
1356
+ byChannel: Record<string, unknown>;
1357
+ }>;
1358
+ /**
1359
+ * Update a person's fields (displayName, phone, email, metadata)
1360
+ */
1361
+ update(id: string, data: {
1362
+ displayName?: string;
1363
+ primaryPhone?: string | null;
1364
+ primaryEmail?: string | null;
1365
+ avatarUrl?: string | null;
1366
+ metadata?: Record<string, unknown> | null;
1367
+ }): Promise<Person>;
1368
+ /**
1369
+ * Link two platform identities to the same person
1370
+ */
1371
+ link(identityA: string, identityB: string): Promise<Person>;
1372
+ /**
1373
+ * Unlink a platform identity from its person
1374
+ */
1375
+ unlink(identityId: string, reason: string): Promise<{
1376
+ person: Person;
1377
+ identity: Record<string, unknown>;
1378
+ }>;
1379
+ /**
1380
+ * Merge two persons (source into target, source is deleted)
1381
+ */
1382
+ merge(sourcePersonId: string, targetPersonId: string, reason?: string): Promise<{
1383
+ person: Person;
1384
+ mergedIdentityIds: string[];
1385
+ deletedPersonId: string;
1386
+ }>;
1387
+ };
1388
+ /**
1389
+ * Access control rules
1390
+ */
1391
+ access: {
1392
+ /**
1393
+ * List access rules
1394
+ */
1395
+ listRules(params?: ListAccessRulesParams): Promise<AccessRule[]>;
1396
+ /**
1397
+ * Create an access rule
1398
+ */
1399
+ createRule(body: CreateAccessRuleBody): Promise<void>;
1400
+ /**
1401
+ * Delete an access rule
1402
+ */
1403
+ deleteRule(id: string): Promise<void>;
1404
+ /**
1405
+ * Check if a user has access
1406
+ */
1407
+ checkAccess(params: CheckAccessParams): Promise<CheckAccessResult>;
1408
+ /**
1409
+ * List pending pairing requests for an instance
1410
+ */
1411
+ listPairingRequests(instanceId: string): Promise<PairingRequestItem[]>;
1412
+ /**
1413
+ * Approve or deny a pairing request
1414
+ */
1415
+ actionPairingRequest(instanceId: string, requestId: string, body: {
1416
+ action: "approve" | "deny";
1417
+ reason?: string;
1418
+ }): Promise<PairingActionResult>;
1419
+ };
1420
+ /**
1421
+ * Settings management
1422
+ */
1423
+ settings: {
1424
+ /**
1425
+ * List settings
1426
+ */
1427
+ list(params?: ListSettingsParams): Promise<Setting[]>;
1428
+ /**
1429
+ * Get a single setting by key
1430
+ */
1431
+ get(key: string): Promise<Setting>;
1432
+ /**
1433
+ * Set a setting value
1434
+ */
1435
+ set(key: string, value: unknown, reason?: string): Promise<Setting>;
1436
+ };
1437
+ /**
1438
+ * Provider management
1439
+ */
1440
+ providers: {
1441
+ /**
1442
+ * List providers
1443
+ */
1444
+ list(params?: ListProvidersParams): Promise<Provider[]>;
1445
+ /**
1446
+ * Get provider by ID
1447
+ */
1448
+ get(id: string): Promise<Provider>;
1449
+ /**
1450
+ * Create a provider
1451
+ */
1452
+ create(body: NewAgentProvider): Promise<Provider>;
1453
+ /**
1454
+ * Update a provider
1455
+ */
1456
+ update(id: string, body: Record<string, unknown>): Promise<Provider>;
1457
+ /**
1458
+ * Delete a provider
1459
+ */
1460
+ delete(id: string): Promise<void>;
1461
+ /**
1462
+ * Check provider health
1463
+ */
1464
+ checkHealth(id: string): Promise<ProviderHealthResult>;
1465
+ /**
1466
+ * List agents from Agno provider
1467
+ */
1468
+ listAgents(id: string): Promise<AgnoAgent[]>;
1469
+ /**
1470
+ * List teams from Agno provider
1471
+ */
1472
+ listTeams(id: string): Promise<AgnoTeam[]>;
1473
+ /**
1474
+ * List workflows from Agno provider
1475
+ */
1476
+ listWorkflows(id: string): Promise<AgnoWorkflow[]>;
1477
+ };
1478
+ /**
1479
+ * Agent routing configuration
1480
+ */
1481
+ routes: {
1482
+ /**
1483
+ * List routes for an instance
1484
+ */
1485
+ list(instanceId: string, params?: {
1486
+ scope?: "chat" | "user";
1487
+ isActive?: boolean;
1488
+ }): Promise<components["schemas"]["AgentRoute"][]>;
1489
+ /**
1490
+ * Get route by ID
1491
+ */
1492
+ get(instanceId: string, id: string): Promise<components["schemas"]["AgentRoute"]>;
1493
+ /**
1494
+ * Create a route
1495
+ */
1496
+ create(instanceId: string, body: components["schemas"]["CreateAgentRouteRequest"]): Promise<components["schemas"]["AgentRoute"]>;
1497
+ /**
1498
+ * Update a route
1499
+ */
1500
+ update(instanceId: string, id: string, body: components["schemas"]["UpdateAgentRouteRequest"]): Promise<components["schemas"]["AgentRoute"]>;
1501
+ /**
1502
+ * Delete a route
1503
+ */
1504
+ delete(instanceId: string, id: string): Promise<void>;
1505
+ /**
1506
+ * Get route cache metrics
1507
+ */
1508
+ getMetrics(): Promise<components["schemas"]["CacheMetrics"]>;
1509
+ };
1510
+ /**
1511
+ * Log querying
1512
+ */
1513
+ logs: {
1514
+ /**
1515
+ * Get recent logs
1516
+ */
1517
+ recent(params?: ListLogsParams): Promise<{
1518
+ items: LogEntry[];
1519
+ meta: {
1520
+ total: number;
1521
+ bufferSize: number;
1522
+ limit: number;
1523
+ };
1524
+ }>;
1525
+ };
1526
+ /**
1527
+ * Automation management
1528
+ */
1529
+ automations: {
1530
+ /**
1531
+ * List automations
1532
+ */
1533
+ list(params?: ListAutomationsParams): Promise<Automation[]>;
1534
+ /**
1535
+ * Get an automation by ID
1536
+ */
1537
+ get(id: string): Promise<Automation>;
1538
+ /**
1539
+ * Create an automation
1540
+ */
1541
+ create(body: CreateAutomationBody): Promise<Automation>;
1542
+ /**
1543
+ * Update an automation
1544
+ */
1545
+ update(id: string, body: Partial<CreateAutomationBody>): Promise<Automation>;
1546
+ /**
1547
+ * Delete an automation
1548
+ */
1549
+ delete(id: string): Promise<void>;
1550
+ /**
1551
+ * Enable an automation
1552
+ */
1553
+ enable(id: string): Promise<Automation>;
1554
+ /**
1555
+ * Disable an automation
1556
+ */
1557
+ disable(id: string): Promise<Automation>;
1558
+ /**
1559
+ * Test an automation (dry run)
1560
+ */
1561
+ test(id: string, body: TestAutomationBody): Promise<{
1562
+ matched: boolean;
1563
+ wouldExecute?: unknown[];
1564
+ }>;
1565
+ /**
1566
+ * Execute an automation (actually runs actions)
1567
+ */
1568
+ execute(id: string, body: TestAutomationBody): Promise<{
1569
+ automationId: string;
1570
+ triggered: boolean;
1571
+ results: Array<{
1572
+ action: string;
1573
+ status: string;
1574
+ result?: unknown;
1575
+ error?: string;
1576
+ durationMs: number;
1577
+ }>;
1578
+ }>;
1579
+ /**
1580
+ * Get logs for an automation
1581
+ */
1582
+ getLogs(id: string, params?: {
1583
+ limit?: number;
1584
+ cursor?: string;
1585
+ }): Promise<PaginatedResponse<Record<string, unknown>>>;
1586
+ };
1587
+ /**
1588
+ * Dead letter management
1589
+ */
1590
+ deadLetters: {
1591
+ /**
1592
+ * List dead letters
1593
+ */
1594
+ list(params?: ListDeadLettersParams): Promise<PaginatedResponse<DeadLetter>>;
1595
+ /**
1596
+ * Get a dead letter by ID
1597
+ */
1598
+ get(id: string): Promise<DeadLetter>;
1599
+ /**
1600
+ * Get dead letter statistics
1601
+ */
1602
+ stats(): Promise<{
1603
+ pending: number;
1604
+ retrying: number;
1605
+ resolved: number;
1606
+ abandoned: number;
1607
+ total: number;
1608
+ }>;
1609
+ /**
1610
+ * Retry a dead letter
1611
+ */
1612
+ retry(id: string): Promise<{
1613
+ success: boolean;
1614
+ error?: string;
1615
+ }>;
1616
+ /**
1617
+ * Resolve a dead letter
1618
+ */
1619
+ resolve(id: string, body: ResolveDeadLetterBody): Promise<DeadLetter>;
1620
+ /**
1621
+ * Abandon a dead letter
1622
+ */
1623
+ abandon(id: string): Promise<DeadLetter>;
1624
+ };
1625
+ /**
1626
+ * Event operations
1627
+ */
1628
+ eventOps: {
1629
+ /**
1630
+ * Get event metrics
1631
+ */
1632
+ metrics(): Promise<Record<string, unknown>>;
1633
+ /**
1634
+ * Start a replay session
1635
+ */
1636
+ startReplay(body: StartReplayBody): Promise<ReplaySession>;
1637
+ /**
1638
+ * List replay sessions
1639
+ */
1640
+ listReplays(): Promise<ReplaySession[]>;
1641
+ /**
1642
+ * Get a replay session by ID
1643
+ */
1644
+ getReplay(id: string): Promise<ReplaySession>;
1645
+ /**
1646
+ * Cancel a replay session
1647
+ */
1648
+ cancelReplay(id: string): Promise<void>;
1649
+ };
1650
+ /**
1651
+ * Webhook source management
1652
+ */
1653
+ webhooks: {
1654
+ /**
1655
+ * List webhook sources
1656
+ */
1657
+ listSources(params?: ListWebhookSourcesParams): Promise<WebhookSource[]>;
1658
+ /**
1659
+ * Get a webhook source by ID
1660
+ */
1661
+ getSource(id: string): Promise<WebhookSource>;
1662
+ /**
1663
+ * Create a webhook source
1664
+ */
1665
+ createSource(body: CreateWebhookSourceBody): Promise<WebhookSource>;
1666
+ /**
1667
+ * Update a webhook source
1668
+ */
1669
+ updateSource(id: string, body: Partial<CreateWebhookSourceBody>): Promise<WebhookSource>;
1670
+ /**
1671
+ * Delete a webhook source
1672
+ */
1673
+ deleteSource(id: string): Promise<void>;
1674
+ /**
1675
+ * Trigger a custom event
1676
+ */
1677
+ trigger(body: TriggerEventBody): Promise<{
1678
+ eventId: string;
1679
+ eventType: string;
1680
+ }>;
1681
+ };
1682
+ /**
1683
+ * Payload management
1684
+ */
1685
+ payloads: {
1686
+ /**
1687
+ * List payloads for an event
1688
+ */
1689
+ listForEvent(eventId: string): Promise<Array<{
1690
+ stage: string;
1691
+ hasData: boolean;
1692
+ createdAt: string;
1693
+ }>>;
1694
+ /**
1695
+ * Get a specific stage payload
1696
+ */
1697
+ getStage(eventId: string, stage: "webhook_raw" | "agent_request" | "agent_response" | "channel_send" | "error"): Promise<{
1698
+ payload?: unknown;
1699
+ }>;
1700
+ /**
1701
+ * Delete payloads for an event
1702
+ */
1703
+ delete(eventId: string, body: DeletePayloadsBody): Promise<{
1704
+ deleted: number;
1705
+ }>;
1706
+ /**
1707
+ * List payload configs
1708
+ */
1709
+ listConfigs(): Promise<PayloadConfig[]>;
1710
+ /**
1711
+ * Update payload config for an event type
1712
+ */
1713
+ updateConfig(eventType: string, body: UpdatePayloadConfigBody): Promise<PayloadConfig>;
1714
+ /**
1715
+ * Get payload statistics
1716
+ */
1717
+ stats(): Promise<{
1718
+ totalPayloads: number;
1719
+ totalSizeBytes: number;
1720
+ byStage: Record<string, number | undefined>;
1721
+ }>;
1722
+ };
1723
+ /**
1724
+ * Batch job management for media processing
1725
+ */
1726
+ batchJobs: {
1727
+ /**
1728
+ * Create a batch processing job
1729
+ */
1730
+ create(body: CreateBatchJobBody): Promise<BatchJob>;
1731
+ /**
1732
+ * Get a batch job by ID
1733
+ */
1734
+ get(id: string): Promise<BatchJob>;
1735
+ /**
1736
+ * Get batch job status (lightweight, for polling)
1737
+ */
1738
+ getStatus(id: string): Promise<BatchJobStatusResponse>;
1739
+ /**
1740
+ * List batch jobs
1741
+ */
1742
+ list(params?: ListBatchJobsParams): Promise<PaginatedResponse<BatchJob>>;
1743
+ /**
1744
+ * Cancel a running batch job
1745
+ */
1746
+ cancel(id: string): Promise<BatchJob>;
1747
+ /**
1748
+ * Estimate cost before creating a job
1749
+ */
1750
+ estimate(body: Omit<CreateBatchJobBody, "force">): Promise<CostEstimate>;
1751
+ };
1752
+ /**
1753
+ * API key management
1754
+ */
1755
+ keys: {
1756
+ /**
1757
+ * Create a new API key
1758
+ * The plainTextKey is only returned in this response.
1759
+ */
1760
+ create(body: CreateApiKeyBody): Promise<CreateApiKeyResult>;
1761
+ /**
1762
+ * List API keys
1763
+ */
1764
+ list(params?: ListApiKeysParams): Promise<{
1765
+ items: ApiKeyRecord[];
1766
+ meta: {
1767
+ total: number;
1768
+ };
1769
+ }>;
1770
+ /**
1771
+ * Get an API key by ID
1772
+ */
1773
+ get(id: string): Promise<ApiKeyRecord>;
1774
+ /**
1775
+ * Update an API key
1776
+ */
1777
+ update(id: string, body: UpdateApiKeyBody): Promise<ApiKeyRecord>;
1778
+ /**
1779
+ * Revoke an API key
1780
+ */
1781
+ revoke(id: string, body?: RevokeApiKeyBody): Promise<ApiKeyRecord>;
1782
+ /**
1783
+ * Delete an API key permanently
1784
+ */
1785
+ delete(id: string): Promise<void>;
1786
+ };
1787
+ /**
1788
+ * Conversation context for turn-based agents and CLI
1789
+ */
1790
+ context: {
1791
+ /**
1792
+ * Get current conversation context for this API key
1793
+ */
1794
+ get(): Promise<{
1795
+ instanceId: string | null;
1796
+ chatId: string | null;
1797
+ messageId: string | null;
1798
+ activeInstanceId: string | null;
1799
+ updatedAt: string | null;
1800
+ }>;
1801
+ /**
1802
+ * Set conversation context (instance, chat, message)
1803
+ */
1804
+ set(body: {
1805
+ instanceId?: string;
1806
+ chatId?: string;
1807
+ messageId?: string;
1808
+ }): Promise<void>;
1809
+ /**
1810
+ * Set active instance (admin convenience)
1811
+ */
1812
+ use(instanceId: string): Promise<void>;
1813
+ /**
1814
+ * Clear conversation context
1815
+ */
1816
+ clear(): Promise<void>;
1817
+ };
1818
+ /**
1819
+ * Multimodal media operations: TTS, STT, image gen, video gen, vision.
1820
+ * Provider-routed via the API provider registry.
1821
+ */
1822
+ media: {
1823
+ /**
1824
+ * Synthesize text to speech via the registered TTS provider.
1825
+ *
1826
+ * Provider resolution order:
1827
+ * 1. Explicit `provider` parameter
1828
+ * 2. Config default (`tts.provider` setting)
1829
+ * 3. First registered provider
1830
+ *
1831
+ * Returns the audio as a Buffer plus metadata.
1832
+ */
1833
+ tts(body: {
1834
+ text: string;
1835
+ provider?: string;
1836
+ voice?: string;
1837
+ language?: string;
1838
+ speed?: number;
1839
+ format?: "mp3" | "ogg" | "opus" | "wav" | "pcm" | "flac" | "aac";
1840
+ style?: string;
1841
+ }): Promise<{
1842
+ provider: string;
1843
+ mimeType: string;
1844
+ durationMs: number;
1845
+ sizeBytes: number;
1846
+ audio: Buffer;
1847
+ }>;
1848
+ /**
1849
+ * Transcribe audio to text via the registered STT provider.
1850
+ *
1851
+ * Provider resolution order:
1852
+ * 1. Explicit `provider` parameter
1853
+ * 2. Config default (`stt.provider` setting)
1854
+ * 3. First registered provider
1855
+ *
1856
+ * Pass `timestamps: true` to receive per-segment breakdown.
1857
+ */
1858
+ stt(body: {
1859
+ audio: Buffer;
1860
+ mimeType: string;
1861
+ provider?: string;
1862
+ language?: string;
1863
+ timestamps?: boolean;
1864
+ model?: string;
1865
+ }): Promise<{
1866
+ provider: string;
1867
+ text: string;
1868
+ segments?: Array<{
1869
+ text: string;
1870
+ startMs?: number;
1871
+ endMs?: number;
1872
+ }>;
1873
+ detectedLanguage?: string;
1874
+ processingMs: number;
1875
+ }>;
1876
+ /**
1877
+ * Generate image(s) from a text prompt via the registered imagegen provider.
1878
+ *
1879
+ * Provider resolution order:
1880
+ * 1. Explicit `provider` parameter
1881
+ * 2. Config default (`imagegen.provider` setting)
1882
+ * 3. First registered provider
1883
+ *
1884
+ * Returns base64-encoded images plus metadata. Callers can save to disk
1885
+ * or forward to a chat via `client.messages.sendMedia`.
1886
+ */
1887
+ imagine(body: {
1888
+ prompt: string;
1889
+ provider?: string;
1890
+ count?: number;
1891
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "16:9" | "9:16" | "3:2" | "2:3";
1892
+ imageSize?: string;
1893
+ model?: string;
1894
+ negativePrompt?: string;
1895
+ seed?: number;
1896
+ }): Promise<{
1897
+ provider: string;
1898
+ processingMs: number;
1899
+ images: Array<{
1900
+ mimeType: string;
1901
+ sizeBytes: number;
1902
+ base64: string;
1903
+ width?: number;
1904
+ height?: number;
1905
+ seed?: number;
1906
+ }>;
1907
+ }>;
1908
+ /**
1909
+ * Describe an image or video via the registered vision provider.
1910
+ *
1911
+ * Provider resolution order:
1912
+ * 1. Explicit `provider` parameter
1913
+ * 2. Config default (`vision.provider` setting)
1914
+ * 3. First registered provider
1915
+ *
1916
+ * Pass a guided `prompt` for targeted descriptions (e.g. "What color is the cat?").
1917
+ */
1918
+ vision(body: {
1919
+ media: Buffer;
1920
+ mimeType: string;
1921
+ provider?: string;
1922
+ prompt?: string;
1923
+ language?: string;
1924
+ maxTokens?: number;
1925
+ }): Promise<{
1926
+ provider: string;
1927
+ text: string;
1928
+ processingMs: number;
1929
+ }>;
1930
+ /**
1931
+ * Generate a video from a text prompt via the registered video-gen provider.
1932
+ *
1933
+ * The API blocks until generation completes, polls internally, and
1934
+ * returns the final MP4 as base64. Generation typically takes 60–180
1935
+ * seconds with Veo 3.1. The server enforces a 5-minute timeout.
1936
+ *
1937
+ * Provider resolution order:
1938
+ * 1. Explicit `provider` parameter
1939
+ * 2. Config default (`videogen.provider` setting)
1940
+ * 3. First registered provider
1941
+ */
1942
+ film(body: {
1943
+ prompt: string;
1944
+ provider?: string;
1945
+ durationSec?: number;
1946
+ resolution?: string;
1947
+ aspectRatio?: string;
1948
+ seed?: number;
1949
+ audio?: boolean;
1950
+ }): Promise<{
1951
+ provider: string;
1952
+ operationId: string;
1953
+ mimeType: string;
1954
+ sizeBytes: number;
1955
+ durationMs: number;
1956
+ videoBase64: string;
1957
+ }>;
1958
+ };
1959
+ /**
1960
+ * Turn lifecycle for turn-based agent execution
1961
+ */
1962
+ turns: {
1963
+ /**
1964
+ * Close the open turn for this API key.
1965
+ * Idempotent: closing an already-closed turn returns success with alreadyClosed: true.
1966
+ */
1967
+ close(body: {
1968
+ action: "message" | "react" | "skip";
1969
+ reason?: string;
1970
+ turnId?: string;
1971
+ }, extraHeaders?: Record<string, string>): Promise<{
1972
+ turnId?: string;
1973
+ action?: string;
1974
+ duration?: number;
1975
+ nudgeCount?: number;
1976
+ messagesSent?: number;
1977
+ closedAt?: string;
1978
+ alreadyClosed?: boolean;
1979
+ message?: string;
1980
+ }>;
1981
+ /**
1982
+ * List turns with optional filters and pagination. Requires turns:admin scope.
1983
+ */
1984
+ list(params?: {
1985
+ status?: "open" | "done" | "timeout";
1986
+ instanceId?: string;
1987
+ chatId?: string;
1988
+ agentId?: string;
1989
+ limit?: number;
1990
+ offset?: number;
1991
+ }): Promise<{
1992
+ items: TurnItem[];
1993
+ total: number;
1994
+ limit: number;
1995
+ offset: number;
1996
+ }>;
1997
+ /**
1998
+ * Get a single turn by ID. Requires turns:admin scope.
1999
+ */
2000
+ get(id: string): Promise<TurnItem>;
2001
+ /**
2002
+ * Admin force-close a turn. Requires turns:admin scope.
2003
+ */
2004
+ forceClose(id: string, reason?: string): Promise<{
2005
+ turnId: string;
2006
+ status: string;
2007
+ closedAt: string | null;
2008
+ }>;
2009
+ /**
2010
+ * Bulk close all open turns. Requires turns:admin scope.
2011
+ */
2012
+ bulkClose(reason?: string): Promise<{
2013
+ closedCount: number;
2014
+ message: string;
2015
+ }>;
2016
+ /**
2017
+ * Get aggregate turn stats. Requires turns:admin scope.
2018
+ */
2019
+ stats(): Promise<TurnStats>;
2020
+ };
2021
+ /**
2022
+ * Agent entity CRUD
2023
+ */
2024
+ agents: {
2025
+ /**
2026
+ * List all agents
2027
+ */
2028
+ list(params?: {
2029
+ provider?: "claude" | "agno" | "openai" | "gemini" | "custom" | "omni-internal";
2030
+ isActive?: boolean;
2031
+ limit?: number;
2032
+ ownerId?: string;
2033
+ }): Promise<PaginatedResponse<components["schemas"]["Agent"]>>;
2034
+ /**
2035
+ * Get a single agent by ID
2036
+ */
2037
+ get(id: string): Promise<components["schemas"]["Agent"]>;
2038
+ /**
2039
+ * Create a new agent
2040
+ */
2041
+ create(body: components["schemas"]["CreateAgentRequest"]): Promise<components["schemas"]["Agent"]>;
2042
+ /**
2043
+ * Update an existing agent (partial patch).
2044
+ * Only fields present in `body` are changed; UUID and omitted fields are preserved.
2045
+ */
2046
+ update(id: string, body: NonNullable<operations["updateAgent"]["requestBody"]>["content"]["application/json"]): Promise<components["schemas"]["Agent"]>;
2047
+ /**
2048
+ * Delete an agent (soft-delete)
2049
+ */
2050
+ delete(id: string): Promise<void>;
2051
+ };
2052
+ /**
2053
+ * Idle-chat follow-up config surface. Three scopes (agent, instance, chat);
2054
+ * closest-defined wins at runtime. See the wish for the full resolution
2055
+ * hierarchy.
2056
+ */
2057
+ followUp: {
2058
+ getAgent(id: string): Promise<components["schemas"]["FollowUpSequenceConfig"] | null>;
2059
+ setAgent(id: string, config: components["schemas"]["FollowUpSequenceConfig"]): Promise<components["schemas"]["FollowUpSequenceConfig"] | null>;
2060
+ unsetAgent(id: string): Promise<void>;
2061
+ getInstance(id: string): Promise<components["schemas"]["FollowUpSequenceConfig"] | null>;
2062
+ setInstance(id: string, config: components["schemas"]["FollowUpSequenceConfig"]): Promise<components["schemas"]["FollowUpSequenceConfig"] | null>;
2063
+ unsetInstance(id: string): Promise<void>;
2064
+ getChat(id: string): Promise<components["schemas"]["FollowUpSequenceConfig"] | null>;
2065
+ setChat(id: string, config: components["schemas"]["FollowUpSequenceConfig"]): Promise<components["schemas"]["FollowUpSequenceConfig"] | null>;
2066
+ unsetChat(id: string): Promise<void>;
2067
+ };
2068
+ /**
2069
+ * System health
2070
+ */
2071
+ system: {
2072
+ /**
2073
+ * Get health status (no auth required)
2074
+ */
2075
+ health(): Promise<HealthResponse>;
2076
+ };
2077
+ /**
2078
+ * Raw openapi-fetch client for advanced usage
2079
+ */
2080
+ raw: import("openapi-fetch").Client<paths, `${string}/${string}`>;
2081
+ };
2082
+ /**
2083
+ * Type for the Omni client
2084
+ */
2085
+ export type OmniClient = ReturnType<typeof createOmniClient>;
2086
+ //# sourceMappingURL=client.d.ts.map