twilio-agent-connect 1.0.3 → 2.0.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.
package/dist/index.d.ts CHANGED
@@ -51,7 +51,9 @@ declare const TACConfigSchema: z.ZodObject<{
51
51
  phoneTraitField: z.ZodDefault<z.ZodString>;
52
52
  }, z.core.$strip>>;
53
53
  conversationConfigurationId: z.ZodOptional<z.ZodString>;
54
- voicePublicDomain: z.ZodOptional<z.ZodString>;
54
+ voicePublicDomain: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
55
+ voiceWebsocketPath: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
56
+ voiceActionPath: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
55
57
  cintelConfigurationId: z.ZodOptional<z.ZodString>;
56
58
  cintelObservationOperatorSid: z.ZodOptional<z.ZodString>;
57
59
  cintelSummaryOperatorSid: z.ZodOptional<z.ZodString>;
@@ -79,6 +81,8 @@ declare const EnvironmentVariables: {
79
81
  readonly TWILIO_MEMORY_PHONE_TRAIT_FIELD: "TWILIO_MEMORY_PHONE_TRAIT_FIELD";
80
82
  readonly TWILIO_CONVERSATION_CONFIGURATION_ID: "TWILIO_CONVERSATION_CONFIGURATION_ID";
81
83
  readonly TWILIO_VOICE_PUBLIC_DOMAIN: "TWILIO_VOICE_PUBLIC_DOMAIN";
84
+ readonly TWILIO_VOICE_WEBSOCKET_PATH: "TWILIO_VOICE_WEBSOCKET_PATH";
85
+ readonly TWILIO_VOICE_ACTION_PATH: "TWILIO_VOICE_ACTION_PATH";
82
86
  readonly TWILIO_TAC_CI_CONFIGURATION_ID: "TWILIO_TAC_CI_CONFIGURATION_ID";
83
87
  readonly TWILIO_TAC_CI_OBSERVATION_OPERATOR_SID: "TWILIO_TAC_CI_OBSERVATION_OPERATOR_SID";
84
88
  readonly TWILIO_TAC_CI_SUMMARY_OPERATOR_SID: "TWILIO_TAC_CI_SUMMARY_OPERATOR_SID";
@@ -87,11 +91,17 @@ declare const EnvironmentVariables: {
87
91
  };
88
92
 
89
93
  /**
90
- * Memory retrieval mode for channels
94
+ * Memory retrieval mode for channels.
95
+ *
96
+ * - "always": Fetch memory with the message as query on every inbound message.
97
+ * - "once": Fetch memory once at conversation start with an empty query and
98
+ * cache it. The cache is invalidated when the conversation becomes INACTIVE.
99
+ * - "never": Never automatically fetch memory (default).
91
100
  */
92
101
  declare const MemoryModeSchema: z.ZodEnum<{
93
102
  never: "never";
94
103
  always: "always";
104
+ once: "once";
95
105
  }>;
96
106
  type MemoryMode = z.infer<typeof MemoryModeSchema>;
97
107
  /**
@@ -470,6 +480,267 @@ declare const CreateConversationSummariesResponseSchema: z.ZodObject<{
470
480
  }, z.core.$strip>;
471
481
  type CreateConversationSummariesResponse = z.infer<typeof CreateConversationSummariesResponseSchema>;
472
482
 
483
+ /**
484
+ * Channel type for communications
485
+ */
486
+ declare const TACChannelTypeSchema: z.ZodEnum<{
487
+ VOICE: "VOICE";
488
+ SMS: "SMS";
489
+ RCS: "RCS";
490
+ EMAIL: "EMAIL";
491
+ WHATSAPP: "WHATSAPP";
492
+ CHAT: "CHAT";
493
+ API: "API";
494
+ SYSTEM: "SYSTEM";
495
+ }>;
496
+ type TACChannelType = z.infer<typeof TACChannelTypeSchema>;
497
+ /**
498
+ * Delivery status for communications
499
+ */
500
+ declare const TACDeliveryStatusSchema: z.ZodEnum<{
501
+ INITIATED: "INITIATED";
502
+ IN_PROGRESS: "IN_PROGRESS";
503
+ DELIVERED: "DELIVERED";
504
+ COMPLETED: "COMPLETED";
505
+ FAILED: "FAILED";
506
+ }>;
507
+ type TACDeliveryStatus = z.infer<typeof TACDeliveryStatusSchema>;
508
+ /**
509
+ * Participant type
510
+ */
511
+ declare const TACParticipantTypeSchema: z.ZodEnum<{
512
+ HUMAN_AGENT: "HUMAN_AGENT";
513
+ CUSTOMER: "CUSTOMER";
514
+ AI_AGENT: "AI_AGENT";
515
+ AGENT: "AGENT";
516
+ }>;
517
+ type TACParticipantType = z.infer<typeof TACParticipantTypeSchema>;
518
+ /**
519
+ * Unified author model with all fields from both Memory and Conversation Orchestrator APIs.
520
+ *
521
+ * Fields not available from a particular API will be undefined.
522
+ */
523
+ declare const TACCommunicationAuthorSchema: z.ZodObject<{
524
+ address: z.ZodString;
525
+ channel: z.ZodEnum<{
526
+ VOICE: "VOICE";
527
+ SMS: "SMS";
528
+ RCS: "RCS";
529
+ EMAIL: "EMAIL";
530
+ WHATSAPP: "WHATSAPP";
531
+ CHAT: "CHAT";
532
+ API: "API";
533
+ SYSTEM: "SYSTEM";
534
+ }>;
535
+ participantId: z.ZodOptional<z.ZodString>;
536
+ deliveryStatus: z.ZodOptional<z.ZodEnum<{
537
+ INITIATED: "INITIATED";
538
+ IN_PROGRESS: "IN_PROGRESS";
539
+ DELIVERED: "DELIVERED";
540
+ COMPLETED: "COMPLETED";
541
+ FAILED: "FAILED";
542
+ }>>;
543
+ id: z.ZodOptional<z.ZodString>;
544
+ name: z.ZodOptional<z.ZodString>;
545
+ type: z.ZodOptional<z.ZodEnum<{
546
+ HUMAN_AGENT: "HUMAN_AGENT";
547
+ CUSTOMER: "CUSTOMER";
548
+ AI_AGENT: "AI_AGENT";
549
+ AGENT: "AGENT";
550
+ }>>;
551
+ profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
552
+ }, z.core.$strip>;
553
+ type TACCommunicationAuthor = z.infer<typeof TACCommunicationAuthorSchema>;
554
+ /**
555
+ * Unified content model with all fields from both Memory and Conversation Orchestrator APIs.
556
+ */
557
+ declare const TACCommunicationContentSchema: z.ZodObject<{
558
+ type: z.ZodOptional<z.ZodEnum<{
559
+ TEXT: "TEXT";
560
+ TRANSCRIPTION: "TRANSCRIPTION";
561
+ }>>;
562
+ text: z.ZodOptional<z.ZodString>;
563
+ transcription: z.ZodOptional<z.ZodObject<{
564
+ channel: z.ZodOptional<z.ZodNumber>;
565
+ confidence: z.ZodOptional<z.ZodNumber>;
566
+ engine: z.ZodOptional<z.ZodString>;
567
+ words: z.ZodOptional<z.ZodArray<z.ZodObject<{
568
+ text: z.ZodString;
569
+ startTime: z.ZodOptional<z.ZodString>;
570
+ endTime: z.ZodOptional<z.ZodString>;
571
+ }, z.core.$strip>>>;
572
+ }, z.core.$strip>>;
573
+ }, z.core.$strip>;
574
+ type TACCommunicationContent = z.infer<typeof TACCommunicationContentSchema>;
575
+ /**
576
+ * Unified communication model with all fields from both Memory and Conversation Orchestrator APIs.
577
+ *
578
+ * Provides complete access to all communication fields regardless of the source.
579
+ * Fields not available from a particular API will be undefined.
580
+ */
581
+ declare const TACCommunicationSchema: z.ZodObject<{
582
+ id: z.ZodString;
583
+ author: z.ZodObject<{
584
+ address: z.ZodString;
585
+ channel: z.ZodEnum<{
586
+ VOICE: "VOICE";
587
+ SMS: "SMS";
588
+ RCS: "RCS";
589
+ EMAIL: "EMAIL";
590
+ WHATSAPP: "WHATSAPP";
591
+ CHAT: "CHAT";
592
+ API: "API";
593
+ SYSTEM: "SYSTEM";
594
+ }>;
595
+ participantId: z.ZodOptional<z.ZodString>;
596
+ deliveryStatus: z.ZodOptional<z.ZodEnum<{
597
+ INITIATED: "INITIATED";
598
+ IN_PROGRESS: "IN_PROGRESS";
599
+ DELIVERED: "DELIVERED";
600
+ COMPLETED: "COMPLETED";
601
+ FAILED: "FAILED";
602
+ }>>;
603
+ id: z.ZodOptional<z.ZodString>;
604
+ name: z.ZodOptional<z.ZodString>;
605
+ type: z.ZodOptional<z.ZodEnum<{
606
+ HUMAN_AGENT: "HUMAN_AGENT";
607
+ CUSTOMER: "CUSTOMER";
608
+ AI_AGENT: "AI_AGENT";
609
+ AGENT: "AGENT";
610
+ }>>;
611
+ profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
612
+ }, z.core.$strip>;
613
+ content: z.ZodObject<{
614
+ type: z.ZodOptional<z.ZodEnum<{
615
+ TEXT: "TEXT";
616
+ TRANSCRIPTION: "TRANSCRIPTION";
617
+ }>>;
618
+ text: z.ZodOptional<z.ZodString>;
619
+ transcription: z.ZodOptional<z.ZodObject<{
620
+ channel: z.ZodOptional<z.ZodNumber>;
621
+ confidence: z.ZodOptional<z.ZodNumber>;
622
+ engine: z.ZodOptional<z.ZodString>;
623
+ words: z.ZodOptional<z.ZodArray<z.ZodObject<{
624
+ text: z.ZodString;
625
+ startTime: z.ZodOptional<z.ZodString>;
626
+ endTime: z.ZodOptional<z.ZodString>;
627
+ }, z.core.$strip>>>;
628
+ }, z.core.$strip>>;
629
+ }, z.core.$strip>;
630
+ recipients: z.ZodDefault<z.ZodArray<z.ZodObject<{
631
+ address: z.ZodString;
632
+ channel: z.ZodEnum<{
633
+ VOICE: "VOICE";
634
+ SMS: "SMS";
635
+ RCS: "RCS";
636
+ EMAIL: "EMAIL";
637
+ WHATSAPP: "WHATSAPP";
638
+ CHAT: "CHAT";
639
+ API: "API";
640
+ SYSTEM: "SYSTEM";
641
+ }>;
642
+ participantId: z.ZodOptional<z.ZodString>;
643
+ deliveryStatus: z.ZodOptional<z.ZodEnum<{
644
+ INITIATED: "INITIATED";
645
+ IN_PROGRESS: "IN_PROGRESS";
646
+ DELIVERED: "DELIVERED";
647
+ COMPLETED: "COMPLETED";
648
+ FAILED: "FAILED";
649
+ }>>;
650
+ id: z.ZodOptional<z.ZodString>;
651
+ name: z.ZodOptional<z.ZodString>;
652
+ type: z.ZodOptional<z.ZodEnum<{
653
+ HUMAN_AGENT: "HUMAN_AGENT";
654
+ CUSTOMER: "CUSTOMER";
655
+ AI_AGENT: "AI_AGENT";
656
+ AGENT: "AGENT";
657
+ }>>;
658
+ profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
659
+ }, z.core.$strip>>>;
660
+ channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
661
+ createdAt: z.ZodOptional<z.ZodString>;
662
+ updatedAt: z.ZodOptional<z.ZodString>;
663
+ conversationId: z.ZodOptional<z.ZodString>;
664
+ accountId: z.ZodOptional<z.ZodString>;
665
+ }, z.core.$strip>;
666
+ type TACCommunication = z.infer<typeof TACCommunicationSchema>;
667
+
668
+ /**
669
+ * Unified response wrapper for TAC.retrieveMemory().
670
+ *
671
+ * Provides a consistent interface for accessing memory data regardless of whether
672
+ * Memory API is configured or falling back to Conversation Orchestrator Communications API.
673
+ *
674
+ * Memory configured:
675
+ * - observations, summaries, communications all populated
676
+ * - communications include Memory-specific fields (author id, name, type, profileId)
677
+ *
678
+ * Conversation Orchestrator fallback:
679
+ * - observations and summaries are empty arrays
680
+ * - communications include Conversation Orchestrator-specific fields (conversationId, accountId, etc.)
681
+ */
682
+ declare class TACMemoryResponse {
683
+ private readonly _data;
684
+ private readonly _communications;
685
+ /**
686
+ * Initialize wrapper with either Memory or Conversation Orchestrator data.
687
+ *
688
+ * @param data - Either MemoryRetrievalResponse (Memory) or Communication[] (Conversation Orchestrator)
689
+ */
690
+ constructor(data: MemoryRetrievalResponse | Communication[]);
691
+ /**
692
+ * Get observation memories.
693
+ *
694
+ * @returns List of observations if Memory is configured, empty array for Conversation Orchestrator fallback
695
+ */
696
+ get observations(): ObservationInfo[];
697
+ /**
698
+ * Get summary memories.
699
+ *
700
+ * @returns List of summaries if Memory is configured, empty array for Conversation Orchestrator fallback
701
+ */
702
+ get summaries(): SummaryInfo[];
703
+ /**
704
+ * Get communications in unified format with all available fields.
705
+ *
706
+ * Communications are converted to a common format during initialization that includes
707
+ * all fields from both Memory and Conversation Orchestrator APIs. Fields not available from a particular
708
+ * API will be undefined.
709
+ *
710
+ * @returns List of unified communications with all available fields
711
+ */
712
+ get communications(): TACCommunication[];
713
+ /**
714
+ * Check if Memory API is configured and providing full features.
715
+ *
716
+ * @returns true if Memory is configured (observations/summaries available),
717
+ * false if using Conversation Orchestrator fallback (only communications available)
718
+ */
719
+ get hasMemoryFeatures(): boolean;
720
+ /**
721
+ * Access raw underlying data for advanced use cases.
722
+ *
723
+ * Use this when you need access to all fields from the original API responses,
724
+ * not just the unified common fields.
725
+ *
726
+ * @returns Either MemoryRetrievalResponse or Communication[] depending on configuration
727
+ */
728
+ get rawData(): MemoryRetrievalResponse | Communication[];
729
+ /**
730
+ * Build formatted prompt sections from available memory data.
731
+ *
732
+ * Generates markdown-formatted sections for observations, summaries, and communications
733
+ * that can be injected into LLM prompts. Each section includes a heading and formatted content.
734
+ * Sections with no data are omitted from the result.
735
+ *
736
+ * @returns Array of formatted prompt sections, empty array if no memory data available
737
+ */
738
+ buildMemoryPrompts(): string[];
739
+ private buildObservationsPrompt;
740
+ private buildSummariesPrompt;
741
+ private buildCommunicationsPrompt;
742
+ }
743
+
473
744
  /**
474
745
  * Participant address type for different communication channels
475
746
  */
@@ -905,6 +1176,7 @@ declare const ConversationSessionSchema: z.ZodObject<{
905
1176
  type: z.ZodDefault<z.ZodLiteral<"end">>;
906
1177
  handoffData: z.ZodString;
907
1178
  }, z.core.$strip>>;
1179
+ cachedMemory: z.ZodOptional<z.ZodCustom<TACMemoryResponse, TACMemoryResponse>>;
908
1180
  }, z.core.$strip>;
909
1181
  type ConversationSession = z.infer<typeof ConversationSessionSchema>;
910
1182
  /**
@@ -1386,6 +1658,135 @@ interface ConversationRelayConfig extends ConversationRelayAttributes {
1386
1658
  languages?: LanguageAttributes[] | undefined;
1387
1659
  }
1388
1660
  declare const ConversationRelayConfigSchema: z.ZodType<ConversationRelayConfig>;
1661
+ /**
1662
+ * Twilio uses the same four-value enum for several attributes that control
1663
+ * what caller input (DTMF, speech, both, neither) triggers a given behavior.
1664
+ */
1665
+ declare const InterruptModeSchema: z.ZodEnum<{
1666
+ any: "any";
1667
+ speech: "speech";
1668
+ none: "none";
1669
+ dtmf: "dtmf";
1670
+ }>;
1671
+ type InterruptMode = z.infer<typeof InterruptModeSchema>;
1672
+ /**
1673
+ * A single `<Language>` child for multi-language ConversationRelay setups.
1674
+ *
1675
+ * Maps to the `<Language>` element documented at
1676
+ * https://www.twilio.com/docs/voice/twiml/connect/conversationrelay#language-element
1677
+ *
1678
+ * Distinct from {@link LanguageAttributes} (the Twilio-SDK-shaped type used by
1679
+ * `connectConversationRelay`): this is the customization-facing model used in
1680
+ * {@link TwiMLOptions}, mirroring the Python SDK's `LanguageConfig`.
1681
+ */
1682
+ declare const LanguageConfigSchema: z.ZodObject<{
1683
+ code: z.ZodString;
1684
+ voice: z.ZodOptional<z.ZodString>;
1685
+ ttsProvider: z.ZodOptional<z.ZodString>;
1686
+ transcriptionProvider: z.ZodOptional<z.ZodString>;
1687
+ speechModel: z.ZodOptional<z.ZodString>;
1688
+ }, z.core.$strip>;
1689
+ type LanguageConfig = z.infer<typeof LanguageConfigSchema>;
1690
+ /**
1691
+ * Options for the TwiML inside `<ConversationRelay>` (plus the
1692
+ * `<Connect action>` URL).
1693
+ *
1694
+ * Fields map to the attributes documented at
1695
+ * https://www.twilio.com/docs/voice/twiml/connect/conversationrelay . All
1696
+ * fields are optional. `VoiceChannel.handleIncomingCall` merges these values
1697
+ * over TAC defaults per-field — only fields explicitly present on the object
1698
+ * override lower layers (see `VoiceChannel`'s overlay logic).
1699
+ *
1700
+ * This is the customization-facing counterpart to {@link ConversationRelayConfig}
1701
+ * (which is the Twilio-SDK-shaped emit model and carries the required `url`).
1702
+ * Mirrors the Python SDK's `TwiMLOptions`.
1703
+ */
1704
+ declare const TwiMLOptionsSchema: z.ZodObject<{
1705
+ customParameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1706
+ welcomeGreeting: z.ZodOptional<z.ZodString>;
1707
+ welcomeGreetingInterruptible: z.ZodOptional<z.ZodEnum<{
1708
+ any: "any";
1709
+ speech: "speech";
1710
+ none: "none";
1711
+ dtmf: "dtmf";
1712
+ }>>;
1713
+ actionUrl: z.ZodOptional<z.ZodString>;
1714
+ conversationConfiguration: z.ZodOptional<z.ZodString>;
1715
+ websocketUrl: z.ZodOptional<z.ZodString>;
1716
+ language: z.ZodOptional<z.ZodString>;
1717
+ ttsLanguage: z.ZodOptional<z.ZodString>;
1718
+ transcriptionLanguage: z.ZodOptional<z.ZodString>;
1719
+ voice: z.ZodOptional<z.ZodString>;
1720
+ ttsProvider: z.ZodOptional<z.ZodString>;
1721
+ transcriptionProvider: z.ZodOptional<z.ZodString>;
1722
+ speechModel: z.ZodOptional<z.ZodString>;
1723
+ elevenlabsTextNormalization: z.ZodOptional<z.ZodEnum<{
1724
+ on: "on";
1725
+ auto: "auto";
1726
+ off: "off";
1727
+ }>>;
1728
+ eotThreshold: z.ZodOptional<z.ZodNumber>;
1729
+ partialPrompts: z.ZodOptional<z.ZodBoolean>;
1730
+ deepgramSmartFormat: z.ZodOptional<z.ZodBoolean>;
1731
+ speechTimeout: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"auto">]>>;
1732
+ interruptible: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1733
+ any: "any";
1734
+ speech: "speech";
1735
+ none: "none";
1736
+ dtmf: "dtmf";
1737
+ }>, z.ZodBoolean]>>;
1738
+ interruptSensitivity: z.ZodOptional<z.ZodEnum<{
1739
+ low: "low";
1740
+ medium: "medium";
1741
+ high: "high";
1742
+ }>>;
1743
+ reportInputDuringAgentSpeech: z.ZodOptional<z.ZodEnum<{
1744
+ any: "any";
1745
+ speech: "speech";
1746
+ none: "none";
1747
+ dtmf: "dtmf";
1748
+ }>>;
1749
+ ignoreBackchannel: z.ZodOptional<z.ZodBoolean>;
1750
+ preemptible: z.ZodOptional<z.ZodBoolean>;
1751
+ dtmfDetection: z.ZodOptional<z.ZodBoolean>;
1752
+ hints: z.ZodOptional<z.ZodString>;
1753
+ events: z.ZodOptional<z.ZodString>;
1754
+ debug: z.ZodOptional<z.ZodString>;
1755
+ intelligenceService: z.ZodOptional<z.ZodString>;
1756
+ languages: z.ZodOptional<z.ZodArray<z.ZodObject<{
1757
+ code: z.ZodString;
1758
+ voice: z.ZodOptional<z.ZodString>;
1759
+ ttsProvider: z.ZodOptional<z.ZodString>;
1760
+ transcriptionProvider: z.ZodOptional<z.ZodString>;
1761
+ speechModel: z.ZodOptional<z.ZodString>;
1762
+ }, z.core.$strip>>>;
1763
+ extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>>>;
1764
+ }, z.core.$strict>;
1765
+ type TwiMLOptions = z.infer<typeof TwiMLOptionsSchema>;
1766
+ /**
1767
+ * Framework-neutral view of the Twilio TwiML webhook form.
1768
+ *
1769
+ * Populated by `TACServer` from the incoming Twilio webhook, then passed to a
1770
+ * customizer registered via `VoiceChannel.onInboundCallTwiml(...)` so the
1771
+ * application can produce per-call {@link TwiMLOptions} overrides without
1772
+ * depending on Fastify types. Mirrors the Python SDK's `TwiMLRequest`.
1773
+ */
1774
+ declare const TwiMLRequestSchema: z.ZodObject<{
1775
+ from: z.ZodOptional<z.ZodString>;
1776
+ to: z.ZodOptional<z.ZodString>;
1777
+ callSid: z.ZodOptional<z.ZodString>;
1778
+ callerCountry: z.ZodOptional<z.ZodString>;
1779
+ callerState: z.ZodOptional<z.ZodString>;
1780
+ callerCity: z.ZodOptional<z.ZodString>;
1781
+ direction: z.ZodOptional<z.ZodString>;
1782
+ extra: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1783
+ }, z.core.$strip>;
1784
+ type TwiMLRequest = z.infer<typeof TwiMLRequestSchema>;
1785
+ /**
1786
+ * Build a {@link TwiMLRequest} from a raw Twilio form dict, bucketing unknown
1787
+ * keys into `extra`. Mirrors the Python SDK's `TwiMLRequest.from_form`.
1788
+ */
1789
+ declare function twiMLRequestFromForm(form: Record<string, string>): TwiMLRequest;
1389
1790
  /**
1390
1791
  * ConversationRelay callback payload from Twilio webhook
1391
1792
  *
@@ -1431,11 +1832,32 @@ type ConversationRelayCallbackPayload = z.infer<typeof ConversationRelayCallback
1431
1832
  *
1432
1833
  * The caller identity is always TAC's configured `config.phoneNumber`.
1433
1834
  * Multi-number deployments should run one TAC instance per line.
1835
+ *
1836
+ * TwiML for the outbound call is built by merging per-field, highest precedence
1837
+ * first:
1838
+ * 1. This call's `twimlOptions` (per-call overrides)
1839
+ * 2. `VoiceChannelConfig.defaultTwimlOptions` (channel-wide defaults)
1840
+ * 3. TAC defaults (welcome greeting, conversationConfiguration, actionUrl
1841
+ * resolved via Studio handoff if configured, else derived from
1842
+ * `TACConfig.voicePublicDomain` + `voiceActionPath`)
1843
+ *
1844
+ * Fields you don't set at a layer fall through to lower layers — so
1845
+ * `twimlOptions: { voice: 'es-MX-Neural2-A' }` on this call overrides only
1846
+ * `voice`; `language`, `interruptible`, etc. from the channel config still apply.
1434
1847
  */
1435
1848
  interface InitiateVoiceConversationOptions {
1436
1849
  to: string;
1437
- conversationRelayConfig: ConversationRelayConfig;
1438
- actionUrl?: string | undefined;
1850
+ /**
1851
+ * Public WebSocket URL for ConversationRelay (e.g. 'wss://your-domain.ngrok.app/ws').
1852
+ * Optional — defaults to the URL derived from `TACConfig.voicePublicDomain` +
1853
+ * `voiceWebsocketPath`. Pass it here only to override the URL for a specific call.
1854
+ */
1855
+ websocketUrl?: string | undefined;
1856
+ /**
1857
+ * Per-call overrides for the TwiML inside `<ConversationRelay>`. Merged over
1858
+ * `VoiceChannelConfig.defaultTwimlOptions` and TAC defaults.
1859
+ */
1860
+ twimlOptions?: TwiMLOptions | undefined;
1439
1861
  }
1440
1862
  declare const InitiateVoiceConversationOptionsSchema: z.ZodType<InitiateVoiceConversationOptions>;
1441
1863
 
@@ -1615,246 +2037,61 @@ declare const OperatorResultEventSchema: z.ZodObject<{
1615
2037
  accountId: z.ZodString;
1616
2038
  conversationId: z.ZodString;
1617
2039
  memoryStoreId: z.ZodOptional<z.ZodString>;
1618
- intelligenceConfiguration: z.ZodObject<{
1619
- id: z.ZodString;
1620
- friendlyName: z.ZodOptional<z.ZodString>;
1621
- }, z.core.$strip>;
1622
- operatorResults: z.ZodArray<z.ZodObject<{
1623
- id: z.ZodString;
1624
- operator: z.ZodObject<{
1625
- id: z.ZodString;
1626
- name: z.ZodOptional<z.ZodString>;
1627
- }, z.core.$strip>;
1628
- outputFormat: z.ZodString;
1629
- result: z.ZodUnknown;
1630
- dateCreated: z.ZodString;
1631
- referenceIds: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1632
- executionDetails: z.ZodOptional<z.ZodObject<{
1633
- participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
1634
- type: z.ZodString;
1635
- profileId: z.ZodOptional<z.ZodString>;
1636
- mediaParticipantId: z.ZodOptional<z.ZodString>;
1637
- }, z.core.$strip>>>;
1638
- }, z.core.$strip>>;
1639
- }, z.core.$strip>>;
1640
- }, z.core.$strip>;
1641
- type OperatorResultEvent = z.infer<typeof OperatorResultEventSchema>;
1642
- /**
1643
- * Result of processing an operator result event
1644
- */
1645
- declare const OperatorProcessingResultSchema: z.ZodObject<{
1646
- success: z.ZodBoolean;
1647
- eventType: z.ZodOptional<z.ZodString>;
1648
- skipped: z.ZodDefault<z.ZodBoolean>;
1649
- skipReason: z.ZodOptional<z.ZodString>;
1650
- error: z.ZodOptional<z.ZodString>;
1651
- createdCount: z.ZodDefault<z.ZodNumber>;
1652
- }, z.core.$strip>;
1653
- type OperatorProcessingResult = z.infer<typeof OperatorProcessingResultSchema>;
1654
- /**
1655
- * Conversation Intelligence configuration for TAC
1656
- */
1657
- declare const ConversationIntelligenceConfigSchema: z.ZodObject<{
1658
- configurationId: z.ZodString;
1659
- observationOperatorSid: z.ZodOptional<z.ZodString>;
1660
- summaryOperatorSid: z.ZodOptional<z.ZodString>;
1661
- }, z.core.$strip>;
1662
- type ConversationIntelligenceConfig = z.infer<typeof ConversationIntelligenceConfigSchema>;
1663
- /**
1664
- * Summary item for batch creation
1665
- */
1666
- declare const ConversationSummaryItemSchema: z.ZodObject<{
1667
- content: z.ZodString;
1668
- conversationId: z.ZodString;
1669
- occurredAt: z.ZodString;
1670
- source: z.ZodOptional<z.ZodString>;
1671
- }, z.core.$strip>;
1672
- type ConversationSummaryItem = z.infer<typeof ConversationSummaryItemSchema>;
1673
-
1674
- /**
1675
- * Channel type for communications
1676
- */
1677
- declare const TACChannelTypeSchema: z.ZodEnum<{
1678
- VOICE: "VOICE";
1679
- SMS: "SMS";
1680
- RCS: "RCS";
1681
- EMAIL: "EMAIL";
1682
- WHATSAPP: "WHATSAPP";
1683
- CHAT: "CHAT";
1684
- API: "API";
1685
- SYSTEM: "SYSTEM";
1686
- }>;
1687
- type TACChannelType = z.infer<typeof TACChannelTypeSchema>;
1688
- /**
1689
- * Delivery status for communications
1690
- */
1691
- declare const TACDeliveryStatusSchema: z.ZodEnum<{
1692
- INITIATED: "INITIATED";
1693
- IN_PROGRESS: "IN_PROGRESS";
1694
- DELIVERED: "DELIVERED";
1695
- COMPLETED: "COMPLETED";
1696
- FAILED: "FAILED";
1697
- }>;
1698
- type TACDeliveryStatus = z.infer<typeof TACDeliveryStatusSchema>;
1699
- /**
1700
- * Participant type
1701
- */
1702
- declare const TACParticipantTypeSchema: z.ZodEnum<{
1703
- HUMAN_AGENT: "HUMAN_AGENT";
1704
- CUSTOMER: "CUSTOMER";
1705
- AI_AGENT: "AI_AGENT";
1706
- AGENT: "AGENT";
1707
- }>;
1708
- type TACParticipantType = z.infer<typeof TACParticipantTypeSchema>;
1709
- /**
1710
- * Unified author model with all fields from both Memory and Conversation Orchestrator APIs.
1711
- *
1712
- * Fields not available from a particular API will be undefined.
1713
- */
1714
- declare const TACCommunicationAuthorSchema: z.ZodObject<{
1715
- address: z.ZodString;
1716
- channel: z.ZodEnum<{
1717
- VOICE: "VOICE";
1718
- SMS: "SMS";
1719
- RCS: "RCS";
1720
- EMAIL: "EMAIL";
1721
- WHATSAPP: "WHATSAPP";
1722
- CHAT: "CHAT";
1723
- API: "API";
1724
- SYSTEM: "SYSTEM";
1725
- }>;
1726
- participantId: z.ZodOptional<z.ZodString>;
1727
- deliveryStatus: z.ZodOptional<z.ZodEnum<{
1728
- INITIATED: "INITIATED";
1729
- IN_PROGRESS: "IN_PROGRESS";
1730
- DELIVERED: "DELIVERED";
1731
- COMPLETED: "COMPLETED";
1732
- FAILED: "FAILED";
1733
- }>>;
1734
- id: z.ZodOptional<z.ZodString>;
1735
- name: z.ZodOptional<z.ZodString>;
1736
- type: z.ZodOptional<z.ZodEnum<{
1737
- HUMAN_AGENT: "HUMAN_AGENT";
1738
- CUSTOMER: "CUSTOMER";
1739
- AI_AGENT: "AI_AGENT";
1740
- AGENT: "AGENT";
1741
- }>>;
1742
- profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1743
- }, z.core.$strip>;
1744
- type TACCommunicationAuthor = z.infer<typeof TACCommunicationAuthorSchema>;
1745
- /**
1746
- * Unified content model with all fields from both Memory and Conversation Orchestrator APIs.
1747
- */
1748
- declare const TACCommunicationContentSchema: z.ZodObject<{
1749
- type: z.ZodOptional<z.ZodEnum<{
1750
- TEXT: "TEXT";
1751
- TRANSCRIPTION: "TRANSCRIPTION";
1752
- }>>;
1753
- text: z.ZodOptional<z.ZodString>;
1754
- transcription: z.ZodOptional<z.ZodObject<{
1755
- channel: z.ZodOptional<z.ZodNumber>;
1756
- confidence: z.ZodOptional<z.ZodNumber>;
1757
- engine: z.ZodOptional<z.ZodString>;
1758
- words: z.ZodOptional<z.ZodArray<z.ZodObject<{
1759
- text: z.ZodString;
1760
- startTime: z.ZodOptional<z.ZodString>;
1761
- endTime: z.ZodOptional<z.ZodString>;
1762
- }, z.core.$strip>>>;
1763
- }, z.core.$strip>>;
1764
- }, z.core.$strip>;
1765
- type TACCommunicationContent = z.infer<typeof TACCommunicationContentSchema>;
1766
- /**
1767
- * Unified communication model with all fields from both Memory and Conversation Orchestrator APIs.
1768
- *
1769
- * Provides complete access to all communication fields regardless of the source.
1770
- * Fields not available from a particular API will be undefined.
1771
- */
1772
- declare const TACCommunicationSchema: z.ZodObject<{
1773
- id: z.ZodString;
1774
- author: z.ZodObject<{
1775
- address: z.ZodString;
1776
- channel: z.ZodEnum<{
1777
- VOICE: "VOICE";
1778
- SMS: "SMS";
1779
- RCS: "RCS";
1780
- EMAIL: "EMAIL";
1781
- WHATSAPP: "WHATSAPP";
1782
- CHAT: "CHAT";
1783
- API: "API";
1784
- SYSTEM: "SYSTEM";
1785
- }>;
1786
- participantId: z.ZodOptional<z.ZodString>;
1787
- deliveryStatus: z.ZodOptional<z.ZodEnum<{
1788
- INITIATED: "INITIATED";
1789
- IN_PROGRESS: "IN_PROGRESS";
1790
- DELIVERED: "DELIVERED";
1791
- COMPLETED: "COMPLETED";
1792
- FAILED: "FAILED";
1793
- }>>;
1794
- id: z.ZodOptional<z.ZodString>;
1795
- name: z.ZodOptional<z.ZodString>;
1796
- type: z.ZodOptional<z.ZodEnum<{
1797
- HUMAN_AGENT: "HUMAN_AGENT";
1798
- CUSTOMER: "CUSTOMER";
1799
- AI_AGENT: "AI_AGENT";
1800
- AGENT: "AGENT";
1801
- }>>;
1802
- profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2040
+ intelligenceConfiguration: z.ZodObject<{
2041
+ id: z.ZodString;
2042
+ friendlyName: z.ZodOptional<z.ZodString>;
1803
2043
  }, z.core.$strip>;
1804
- content: z.ZodObject<{
1805
- type: z.ZodOptional<z.ZodEnum<{
1806
- TEXT: "TEXT";
1807
- TRANSCRIPTION: "TRANSCRIPTION";
1808
- }>>;
1809
- text: z.ZodOptional<z.ZodString>;
1810
- transcription: z.ZodOptional<z.ZodObject<{
1811
- channel: z.ZodOptional<z.ZodNumber>;
1812
- confidence: z.ZodOptional<z.ZodNumber>;
1813
- engine: z.ZodOptional<z.ZodString>;
1814
- words: z.ZodOptional<z.ZodArray<z.ZodObject<{
1815
- text: z.ZodString;
1816
- startTime: z.ZodOptional<z.ZodString>;
1817
- endTime: z.ZodOptional<z.ZodString>;
2044
+ operatorResults: z.ZodArray<z.ZodObject<{
2045
+ id: z.ZodString;
2046
+ operator: z.ZodObject<{
2047
+ id: z.ZodString;
2048
+ name: z.ZodOptional<z.ZodString>;
2049
+ }, z.core.$strip>;
2050
+ outputFormat: z.ZodString;
2051
+ result: z.ZodUnknown;
2052
+ dateCreated: z.ZodString;
2053
+ referenceIds: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2054
+ executionDetails: z.ZodOptional<z.ZodObject<{
2055
+ participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
2056
+ type: z.ZodString;
2057
+ profileId: z.ZodOptional<z.ZodString>;
2058
+ mediaParticipantId: z.ZodOptional<z.ZodString>;
1818
2059
  }, z.core.$strip>>>;
1819
2060
  }, z.core.$strip>>;
1820
- }, z.core.$strip>;
1821
- recipients: z.ZodDefault<z.ZodArray<z.ZodObject<{
1822
- address: z.ZodString;
1823
- channel: z.ZodEnum<{
1824
- VOICE: "VOICE";
1825
- SMS: "SMS";
1826
- RCS: "RCS";
1827
- EMAIL: "EMAIL";
1828
- WHATSAPP: "WHATSAPP";
1829
- CHAT: "CHAT";
1830
- API: "API";
1831
- SYSTEM: "SYSTEM";
1832
- }>;
1833
- participantId: z.ZodOptional<z.ZodString>;
1834
- deliveryStatus: z.ZodOptional<z.ZodEnum<{
1835
- INITIATED: "INITIATED";
1836
- IN_PROGRESS: "IN_PROGRESS";
1837
- DELIVERED: "DELIVERED";
1838
- COMPLETED: "COMPLETED";
1839
- FAILED: "FAILED";
1840
- }>>;
1841
- id: z.ZodOptional<z.ZodString>;
1842
- name: z.ZodOptional<z.ZodString>;
1843
- type: z.ZodOptional<z.ZodEnum<{
1844
- HUMAN_AGENT: "HUMAN_AGENT";
1845
- CUSTOMER: "CUSTOMER";
1846
- AI_AGENT: "AI_AGENT";
1847
- AGENT: "AGENT";
1848
- }>>;
1849
- profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1850
- }, z.core.$strip>>>;
1851
- channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1852
- createdAt: z.ZodOptional<z.ZodString>;
1853
- updatedAt: z.ZodOptional<z.ZodString>;
1854
- conversationId: z.ZodOptional<z.ZodString>;
1855
- accountId: z.ZodOptional<z.ZodString>;
2061
+ }, z.core.$strip>>;
1856
2062
  }, z.core.$strip>;
1857
- type TACCommunication = z.infer<typeof TACCommunicationSchema>;
2063
+ type OperatorResultEvent = z.infer<typeof OperatorResultEventSchema>;
2064
+ /**
2065
+ * Result of processing an operator result event
2066
+ */
2067
+ declare const OperatorProcessingResultSchema: z.ZodObject<{
2068
+ success: z.ZodBoolean;
2069
+ eventType: z.ZodOptional<z.ZodString>;
2070
+ skipped: z.ZodDefault<z.ZodBoolean>;
2071
+ skipReason: z.ZodOptional<z.ZodString>;
2072
+ error: z.ZodOptional<z.ZodString>;
2073
+ createdCount: z.ZodDefault<z.ZodNumber>;
2074
+ }, z.core.$strip>;
2075
+ type OperatorProcessingResult = z.infer<typeof OperatorProcessingResultSchema>;
2076
+ /**
2077
+ * Conversation Intelligence configuration for TAC
2078
+ */
2079
+ declare const ConversationIntelligenceConfigSchema: z.ZodObject<{
2080
+ configurationId: z.ZodString;
2081
+ observationOperatorSid: z.ZodOptional<z.ZodString>;
2082
+ summaryOperatorSid: z.ZodOptional<z.ZodString>;
2083
+ }, z.core.$strip>;
2084
+ type ConversationIntelligenceConfig = z.infer<typeof ConversationIntelligenceConfigSchema>;
2085
+ /**
2086
+ * Summary item for batch creation
2087
+ */
2088
+ declare const ConversationSummaryItemSchema: z.ZodObject<{
2089
+ content: z.ZodString;
2090
+ conversationId: z.ZodString;
2091
+ occurredAt: z.ZodString;
2092
+ source: z.ZodOptional<z.ZodString>;
2093
+ }, z.core.$strip>;
2094
+ type ConversationSummaryItem = z.infer<typeof ConversationSummaryItemSchema>;
1858
2095
 
1859
2096
  /**
1860
2097
  * Knowledge base status enum
@@ -1909,82 +2146,6 @@ declare const KnowledgeSearchResponseSchema: z.ZodObject<{
1909
2146
  }, z.core.$strip>;
1910
2147
  type KnowledgeSearchResponse = z.infer<typeof KnowledgeSearchResponseSchema>;
1911
2148
 
1912
- /**
1913
- * Unified response wrapper for TAC.retrieveMemory().
1914
- *
1915
- * Provides a consistent interface for accessing memory data regardless of whether
1916
- * Memory API is configured or falling back to Conversation Orchestrator Communications API.
1917
- *
1918
- * Memory configured:
1919
- * - observations, summaries, communications all populated
1920
- * - communications include Memory-specific fields (author id, name, type, profileId)
1921
- *
1922
- * Conversation Orchestrator fallback:
1923
- * - observations and summaries are empty arrays
1924
- * - communications include Conversation Orchestrator-specific fields (conversationId, accountId, etc.)
1925
- */
1926
- declare class TACMemoryResponse {
1927
- private readonly _data;
1928
- private readonly _communications;
1929
- /**
1930
- * Initialize wrapper with either Memory or Conversation Orchestrator data.
1931
- *
1932
- * @param data - Either MemoryRetrievalResponse (Memory) or Communication[] (Conversation Orchestrator)
1933
- */
1934
- constructor(data: MemoryRetrievalResponse | Communication[]);
1935
- /**
1936
- * Get observation memories.
1937
- *
1938
- * @returns List of observations if Memory is configured, empty array for Conversation Orchestrator fallback
1939
- */
1940
- get observations(): ObservationInfo[];
1941
- /**
1942
- * Get summary memories.
1943
- *
1944
- * @returns List of summaries if Memory is configured, empty array for Conversation Orchestrator fallback
1945
- */
1946
- get summaries(): SummaryInfo[];
1947
- /**
1948
- * Get communications in unified format with all available fields.
1949
- *
1950
- * Communications are converted to a common format during initialization that includes
1951
- * all fields from both Memory and Conversation Orchestrator APIs. Fields not available from a particular
1952
- * API will be undefined.
1953
- *
1954
- * @returns List of unified communications with all available fields
1955
- */
1956
- get communications(): TACCommunication[];
1957
- /**
1958
- * Check if Memory API is configured and providing full features.
1959
- *
1960
- * @returns true if Memory is configured (observations/summaries available),
1961
- * false if using Conversation Orchestrator fallback (only communications available)
1962
- */
1963
- get hasMemoryFeatures(): boolean;
1964
- /**
1965
- * Access raw underlying data for advanced use cases.
1966
- *
1967
- * Use this when you need access to all fields from the original API responses,
1968
- * not just the unified common fields.
1969
- *
1970
- * @returns Either MemoryRetrievalResponse or Communication[] depending on configuration
1971
- */
1972
- get rawData(): MemoryRetrievalResponse | Communication[];
1973
- /**
1974
- * Build formatted prompt sections from available memory data.
1975
- *
1976
- * Generates markdown-formatted sections for observations, summaries, and communications
1977
- * that can be injected into LLM prompts. Each section includes a heading and formatted content.
1978
- * Sections with no data are omitted from the result.
1979
- *
1980
- * @returns Array of formatted prompt sections, empty array if no memory data available
1981
- */
1982
- buildMemoryPrompts(): string[];
1983
- private buildObservationsPrompt;
1984
- private buildSummariesPrompt;
1985
- private buildCommunicationsPrompt;
1986
- }
1987
-
1988
2149
  /**
1989
2150
  * TAC Configuration class with Python-like static factory methods
1990
2151
  *
@@ -2011,6 +2172,10 @@ declare class TACConfig {
2011
2172
  readonly memoryConfig: TACConfigData['memoryConfig'];
2012
2173
  readonly conversationConfigurationId?: string;
2013
2174
  readonly voicePublicDomain?: string;
2175
+ /** Path the voice WebSocket is served at (default '/ws'). */
2176
+ readonly voiceWebsocketPath: string;
2177
+ /** Path the ConversationRelay action callback is served at (default '/conversation-relay-callback'). */
2178
+ readonly voiceActionPath: string;
2014
2179
  readonly cintelConfigurationId?: string;
2015
2180
  readonly cintelObservationOperatorSid?: string;
2016
2181
  readonly cintelSummaryOperatorSid?: string;
@@ -2038,7 +2203,9 @@ declare class TACConfig {
2038
2203
  * Optional environment variables:
2039
2204
  * - TWILIO_WHATSAPP_NUMBER: WhatsApp number for WhatsApp channel (e.g., 'whatsapp:+1234567890')
2040
2205
  * - TWILIO_CONVERSATION_CONFIGURATION_ID: Conversation Orchestrator configuration ID (enables orchestrated mode)
2041
- * - TWILIO_VOICE_PUBLIC_DOMAIN: Public domain for voice WebSocket connections (domain only, without protocol/port/path, e.g., 'abc123.ngrok.app')
2206
+ * - TWILIO_VOICE_PUBLIC_DOMAIN: Public domain for voice routes (required for voice; domain only, without protocol/port/path, e.g., 'abc123.ngrok.app')
2207
+ * - TWILIO_VOICE_WEBSOCKET_PATH: Path for the voice WebSocket (default: /ws)
2208
+ * - TWILIO_VOICE_ACTION_PATH: Path for the ConversationRelay action callback (default: /conversation-relay-callback)
2042
2209
  * - TWILIO_REGION: Twilio region subdomain for API routing (e.g. transforms base URLs to `https://{product}.{region}.twilio.com`)
2043
2210
  * - TWILIO_STUDIO_HANDOFF_FLOW_SID: Studio Flow SID used by createStudioHandoffTool for human handoff
2044
2211
  * - TWILIO_RCS_SENDER_ID: RCS Sender ID for the RCS channel
@@ -2067,6 +2234,8 @@ declare class TACConfig {
2067
2234
  /**
2068
2235
  * Whether Conversation Orchestrator is configured.
2069
2236
  * Returns false in voice-only mode (no conversationConfigurationId).
2237
+ *
2238
+ * @internal
2070
2239
  */
2071
2240
  isOrchestratorEnabled(): boolean;
2072
2241
  /**
@@ -2372,7 +2541,8 @@ interface BaseChannelOptions {
2372
2541
  * Memory retrieval mode for this channel. Default is "never".
2373
2542
  *
2374
2543
  * - "never": Memory is not automatically retrieved. Use the memory TAC tool or manually call `tac.retrieveMemory()` in callbacks for conditional retrieval.
2375
- * - "always": Memory is automatically retrieved for every inbound message and available in `onMessageReady` callback.
2544
+ * - "always": Memory is automatically retrieved (using the message as query) for every inbound message and available in `onMessageReady` callback.
2545
+ * - "once": Memory is retrieved once at conversation start with an empty query and cached on the session. Subsequent messages reuse the cache until the conversation becomes INACTIVE.
2376
2546
  */
2377
2547
  memoryMode?: MemoryMode;
2378
2548
  /**
@@ -2470,21 +2640,62 @@ declare abstract class BaseChannel {
2470
2640
  */
2471
2641
  protected validateWebhookPayload(payload: unknown): boolean;
2472
2642
  /**
2473
- * Extract conversation ID from webhook payload (implemented by subclasses)
2643
+ * Preprocess webhook before handling event-specific logic.
2644
+ * Handles deduplication, validation, filtering, and data extraction.
2645
+ *
2646
+ * @param payload - Raw webhook payload from Twilio
2647
+ * @param idempotencyToken - Optional idempotency token for deduplication
2648
+ * @returns Preprocessed webhook data, or null if webhook should be skipped
2649
+ */
2650
+ protected preprocessWebhook(payload: unknown, idempotencyToken: string | undefined): {
2651
+ webhookData: ConversationWebhookPayload;
2652
+ eventType: string;
2653
+ conversationId: string | undefined;
2654
+ } | null;
2655
+ /**
2656
+ * Extract conversation ID from webhook payload with type validation.
2657
+ *
2658
+ * Extracts conversationId from webhookData.data?.conversationId || webhookData.data?.id,
2659
+ * validates the value is a non-empty string, and ensures it passes isConversationId check.
2660
+ *
2661
+ * This prevents invalid IDs from causing downstream issues like incorrect Map key
2662
+ * matching in CONVERSATION_UPDATED self-filtering or propagating malformed IDs.
2474
2663
  */
2475
- protected abstract extractConversationId(payload: unknown): ConversationId | null;
2664
+ protected extractConversationId(payload: unknown): ConversationId | null;
2476
2665
  /**
2477
- * Extract profile ID from webhook payload (implemented by subclasses)
2666
+ * Extract profile ID from webhook payload with type validation.
2667
+ *
2668
+ * Extracts profileId from webhookData.data?.profileId,
2669
+ * validates the value is a non-empty string, and ensures it passes isProfileId check.
2670
+ *
2671
+ * This prevents invalid IDs from propagating downstream and ensures consistent
2672
+ * validation across all channel types.
2478
2673
  */
2479
- protected abstract extractProfileId(payload: unknown): ProfileId | null;
2674
+ protected extractProfileId(payload: unknown): ProfileId | null;
2480
2675
  /**
2481
- * Retrieve memory only when memoryMode === 'always'.
2676
+ * Retrieve memory according to the channel's memoryMode.
2482
2677
  *
2483
2678
  * This method handles the common logic for memory retrieval across all channels,
2484
- * including error handling and debug logging. If memoryMode is 'never',
2485
- * automatic memory retrieval is skipped.
2679
+ * including error handling and debug logging.
2680
+ *
2681
+ * Modes:
2682
+ * - "always": Fetch with the provided query on every message.
2683
+ * - "once": Fetch once with an empty query and cache the result on the
2684
+ * session. Subsequent calls reuse the cache until it is invalidated on the
2685
+ * INACTIVE transition.
2686
+ * - "never": Skip retrieval.
2687
+ *
2688
+ * Memory retrieval failures are logged and swallowed so message processing
2689
+ * continues without memory context.
2486
2690
  */
2487
2691
  protected retrieveMemoryIfEnabled(session: ConversationSession, query?: string): Promise<TACMemoryResponse | undefined>;
2692
+ /**
2693
+ * Invalidate cached memory for "once" mode when a conversation becomes
2694
+ * INACTIVE. Conversation Orchestrator updates memory on the INACTIVE
2695
+ * transition, so the next message re-fetches fresh memory. No-op for other
2696
+ * memory modes.
2697
+ */
2698
+ protected invalidateCachedMemory(conversationId: ConversationId): void;
2488
2699
  /**
2489
2700
  * Cleanup resources when shutting down
2490
2701
  */
@@ -2571,6 +2782,8 @@ declare class TAC {
2571
2782
  /**
2572
2783
  * Whether Conversation Orchestrator is configured.
2573
2784
  * Returns false in voice-only mode.
2785
+ *
2786
+ * @internal
2574
2787
  */
2575
2788
  isOrchestratorEnabled(): boolean;
2576
2789
  /**
@@ -2727,14 +2940,6 @@ declare abstract class MessagingChannel extends BaseChannel {
2727
2940
  * Handle conversation updated event
2728
2941
  */
2729
2942
  private handleConversationUpdated;
2730
- /**
2731
- * Extract conversation ID from webhook payload
2732
- */
2733
- protected extractConversationId(payload: unknown): ConversationId | null;
2734
- /**
2735
- * Extract profile ID from webhook payload
2736
- */
2737
- protected extractProfileId(payload: unknown): ProfileId | null;
2738
2943
  /**
2739
2944
  * Validate messaging channel webhook payload structure
2740
2945
  */
@@ -2976,6 +3181,34 @@ declare class ChatChannel extends MessagingChannel {
2976
3181
  initiateOutboundConversation(options: InitiateChatConversationOptions): Promise<InitiateConversationResult>;
2977
3182
  }
2978
3183
 
3184
+ /**
3185
+ * Configuration for the Voice channel.
3186
+ *
3187
+ * `defaultTwimlOptions` is one of several TwiML layers that merge per-field;
3188
+ * see `handleIncomingCall` (inbound) and `initiateOutboundConversation`
3189
+ * (outbound) for the full precedence order.
3190
+ */
3191
+ interface VoiceChannelConfig extends BaseChannelOptions {
3192
+ /**
3193
+ * Static `TwiMLOptions` applied to every call (inbound and outbound).
3194
+ * Controls the TwiML inside `<ConversationRelay>` — voice, language,
3195
+ * transcription provider, welcomeGreeting, `<Language>` children, etc. Use
3196
+ * this when the same ConversationRelay configuration is correct for every call.
3197
+ *
3198
+ * Per-call inbound customization is registered via
3199
+ * `VoiceChannel.onInboundCallTwiml(...)` (not on this config).
3200
+ *
3201
+ * Note: `customParameters` and `languages` replace wholesale when a
3202
+ * higher-priority layer sets them.
3203
+ */
3204
+ defaultTwimlOptions?: TwiMLOptions;
3205
+ }
3206
+ /**
3207
+ * Callback that produces per-call overrides for the TwiML inside
3208
+ * `<ConversationRelay>` on inbound calls. Receives a framework-neutral
3209
+ * {@link TwiMLRequest} and returns {@link TwiMLOptions}.
3210
+ */
3211
+ type InboundCallTwimlHandler = (req: TwiMLRequest) => Promise<TwiMLOptions>;
2979
3212
  /**
2980
3213
  * Voice channel event callbacks extending base callbacks
2981
3214
  */
@@ -3024,7 +3257,45 @@ declare class VoiceChannel extends BaseChannel {
3024
3257
  private readonly callSidToConversationId;
3025
3258
  private readonly MAX_INITIALIZATION_RETRIES;
3026
3259
  private twilioClient;
3027
- constructor(tac: TAC, options?: BaseChannelOptions);
3260
+ private readonly voiceConfig;
3261
+ private onInboundCallTwimlHandler;
3262
+ constructor(tac: TAC, options?: VoiceChannelConfig);
3263
+ /**
3264
+ * Register a callback that produces per-call overrides for the TwiML inside
3265
+ * `<ConversationRelay>` on inbound calls.
3266
+ *
3267
+ * The callback receives a framework-neutral {@link TwiMLRequest} (parsed from
3268
+ * the Twilio webhook form) and returns {@link TwiMLOptions}. Fields the
3269
+ * callback explicitly sets override `defaultTwimlOptions` and TAC defaults;
3270
+ * unset fields fall through.
3271
+ *
3272
+ * @example
3273
+ * ```typescript
3274
+ * voiceChannel.onInboundCallTwiml(async req => {
3275
+ * if (req.callerCountry === 'MX') {
3276
+ * return { language: 'es-MX', welcomeGreeting: '¡Hola!' };
3277
+ * }
3278
+ * return {};
3279
+ * });
3280
+ * ```
3281
+ *
3282
+ * Outbound calls don't use this — pass per-call TwiML via
3283
+ * `InitiateVoiceConversationOptions.twimlOptions` directly.
3284
+ */
3285
+ onInboundCallTwiml(callback: InboundCallTwimlHandler): void;
3286
+ /**
3287
+ * Resolve the public WebSocket URL from `TACConfig.voicePublicDomain` +
3288
+ * `TACConfig.voiceWebsocketPath`. Throws if `voicePublicDomain` isn't set.
3289
+ */
3290
+ private resolveWebsocketUrl;
3291
+ /**
3292
+ * Resolve the default `<Connect action=...>` cleanup URL.
3293
+ *
3294
+ * Returns undefined if `voicePublicDomain` isn't set; that's fine because
3295
+ * actionUrl has higher-priority layers (customizer, twimlOptions, Studio
3296
+ * handoff) above this fallback.
3297
+ */
3298
+ private resolveDefaultActionUrl;
3028
3299
  private getTwilioClient;
3029
3300
  get channelType(): ChannelType;
3030
3301
  /**
@@ -3032,10 +3303,22 @@ declare class VoiceChannel extends BaseChannel {
3032
3303
  */
3033
3304
  on(event: string, callback: (...args: any[]) => void): void;
3034
3305
  /**
3035
- * Process webhook - Voice channel doesn't use traditional webhooks,
3036
- * but this method is required by the base class
3306
+ * Process conversation webhooks for cleanup.
3307
+ *
3308
+ * Voice channel processes CONVERSATION_UPDATED events:
3309
+ * - CLOSED status: Clean up local session state
3310
+ *
3311
+ * Note: Conversation tracking uses instance-local memory. In multi-instance
3312
+ * deployments, webhooks may route to a different instance, preventing cleanup.
3313
+ *
3314
+ * @param payload - Raw webhook event data from Twilio
3315
+ * @param idempotencyToken - Optional Twilio idempotency token from request headers
3316
+ */
3317
+ processWebhook(payload: unknown, idempotencyToken?: string): Promise<void>;
3318
+ /**
3319
+ * Handle conversation updated event
3037
3320
  */
3038
- processWebhook(_payload: unknown): Promise<void>;
3321
+ private handleConversationUpdated;
3039
3322
  /**
3040
3323
  * Get active WebSocket connection for a conversation
3041
3324
  */
@@ -3053,7 +3336,9 @@ declare class VoiceChannel extends BaseChannel {
3053
3336
  */
3054
3337
  private handleInterruptMessage;
3055
3338
  /**
3056
- * Handle WebSocket disconnection
3339
+ * Handle WebSocket disconnection. In orchestrated mode the conversation stays
3340
+ * tracked until the CLOSED webhook (so a follow-up call can reuse it); in
3341
+ * voice-only mode there is no such webhook, so it ends here.
3057
3342
  */
3058
3343
  private handleWebSocketDisconnect;
3059
3344
  /**
@@ -3075,18 +3360,89 @@ declare class VoiceChannel extends BaseChannel {
3075
3360
  signal?: AbortSignal;
3076
3361
  }): Promise<string>;
3077
3362
  /**
3078
- * Handle incoming voice call - generate TwiML to connect to ConversationRelay
3363
+ * Generate the TwiML response for an incoming voice call.
3364
+ *
3365
+ * ConversationRelay automatically handles conversation creation and
3366
+ * participant management via the `conversationConfiguration` parameter.
3367
+ *
3368
+ * The WebSocket URL and default session-cleanup action URL are derived from
3369
+ * `TACConfig.voicePublicDomain` + `TACConfig.voiceWebsocketPath` /
3370
+ * `voiceActionPath`.
3371
+ *
3372
+ * TwiML fields are merged per-field, highest precedence first:
3373
+ * 1. Output of the customizer registered via
3374
+ * `VoiceChannel.onInboundCallTwiml(...)` if configured and `twimlRequest`
3375
+ * is given. (Application-owned.)
3376
+ * 2. `VoiceChannelConfig.defaultTwimlOptions` — per-channel defaults.
3377
+ * 3. `hostTwimlOptions` — per-call transport facts supplied by the host (the
3378
+ * code owning the route), e.g. a per-call `websocketUrl` with an affinity
3379
+ * token.
3380
+ * 4. TAC defaults: a fixed default welcomeGreeting, `conversationConfiguration`
3381
+ * from `TACConfig`, `actionUrl` resolved via Studio handoff (when
3382
+ * `studioHandoffFlowSid` is configured), else derived from
3383
+ * `TACConfig.voicePublicDomain` + `voiceActionPath`, and the `websocketUrl`
3384
+ * derived from `TACConfig.voicePublicDomain` + `voiceWebsocketPath`.
3385
+ *
3386
+ * Fields not set at a layer fall through to lower layers. Arrays (`languages`)
3387
+ * and nested objects (`customParameters`) replace wholesale when set at a
3388
+ * higher-priority layer. `websocketUrl` falls back to the `TACConfig`-derived
3389
+ * URL if unset at every layer.
3390
+ *
3391
+ * @param twimlRequest - Parsed Twilio webhook fields. Passed to the customizer
3392
+ * if one is configured on the channel.
3393
+ * @param options - Additional per-call inputs.
3394
+ * @param options.hostTwimlOptions - Per-call TwiML supplied by a custom
3395
+ * in-process host (e.g. an affinity-routed deployment injecting a per-call
3396
+ * `websocketUrl`), layered below `defaultTwimlOptions` and the application
3397
+ * customizer but above the TAC defaults.
3398
+ * @returns TwiML XML string for call connection.
3399
+ */
3400
+ handleIncomingCall(twimlRequest?: TwiMLRequest, options?: {
3401
+ hostTwimlOptions?: TwiMLOptions;
3402
+ }): Promise<string>;
3403
+ /**
3404
+ * Layer TwiML options, lowest precedence first: TAC defaults → `host`
3405
+ * (calling host's per-call values) → channel `defaultTwimlOptions` → `perCall`
3406
+ * (application customizer output for inbound, or
3407
+ * `InitiateVoiceConversationOptions.twimlOptions` for outbound).
3408
+ */
3409
+ private buildTwimlOptions;
3410
+ /**
3411
+ * Apply fields explicitly present on `source` onto `target`.
3412
+ *
3413
+ * Nested objects (`customParameters`), arrays (`languages`), and dicts
3414
+ * (`extra`) replace wholesale — there's no per-key merging.
3079
3415
  *
3080
- * ConversationRelay will create the conversation automatically. The conversation
3081
- * will be initialized on the first prompt using the callSid.
3416
+ * `actionUrl` is skipped here on purpose — it's resolved once via
3417
+ * `resolveActionUrl` looking at every layer at once, and that resolved value
3418
+ * is written into `target` before this overlay runs. Letting it through here
3419
+ * would let a higher-priority layer that didn't set actionUrl silently clobber
3420
+ * a lower layer that did.
3082
3421
  *
3083
- * @param options - Options for handling the incoming call
3084
- * @returns TwiML XML string with ConversationRelay configuration
3422
+ * "Explicitly present" is detected via key presence (`key in source`), which
3423
+ * mirrors Python's `model_fields_set`: a key set to `undefined` is still
3424
+ * "present" and overrides lower layers, while an absent key falls through.
3085
3425
  */
3086
- handleIncomingCall(options: {
3087
- actionUrl?: string;
3088
- conversationRelayConfig: ConversationRelayConfig;
3089
- }): string;
3426
+ private overlayFields;
3427
+ /**
3428
+ * Resolve the TwiML `<Connect action=...>` URL.
3429
+ *
3430
+ * Precedence (highest to lowest):
3431
+ * 1. application customizer
3432
+ * 2. channel `defaultTwimlOptions`
3433
+ * 3. `host` (calling host's per-call options)
3434
+ * 4. Studio handoff (when `studioHandoffFlowSid` is configured)
3435
+ * 5. Channel default — derived from `TACConfig.voicePublicDomain` +
3436
+ * `TACConfig.voiceActionPath`.
3437
+ *
3438
+ * User-expressed intent (Studio handoff is configured explicitly on
3439
+ * `TACConfig`) beats the SDK's generated cleanup default.
3440
+ *
3441
+ * Explicit `actionUrl: undefined` on a layer (key present, value undefined)
3442
+ * suppresses `<Connect action=...>` entirely — all lower layers are skipped.
3443
+ * `actionUrl` left absent (key not present) falls through to the next layer.
3444
+ */
3445
+ private resolveActionUrl;
3090
3446
  /**
3091
3447
  * Initiate an outbound voice conversation
3092
3448
  *
@@ -3095,14 +3451,21 @@ declare class VoiceChannel extends BaseChannel {
3095
3451
  * conversation during passive hydration. The session is initialized lazily
3096
3452
  * on the first prompt when the conversation is discovered by callSid.
3097
3453
  *
3098
- * `conversationRelayConfig.url` must be the publicly accessible WebSocket
3099
- * endpoint (e.g., `wss://your-domain.ngrok.app/ws`). Unlike inbound calls
3100
- * where TACServer sets this automatically, outbound calls require it
3101
- * explicitly since there is no incoming HTTP request to derive the host from.
3454
+ * TwiML fields are merged per-field, highest precedence first:
3455
+ * 1. `options.twimlOptions` — per-call overrides
3456
+ * 2. `VoiceChannelConfig.defaultTwimlOptions` — channel-wide defaults
3457
+ * 3. TAC defaults: welcome greeting, `conversationConfiguration` from
3458
+ * `TACConfig`, and `actionUrl` from Studio handoff (if configured), else
3459
+ * derived from `TACConfig.voicePublicDomain` + `voiceActionPath`.
3460
+ *
3461
+ * The WebSocket URL is derived from `TACConfig.voicePublicDomain` +
3462
+ * `TACConfig.voiceWebsocketPath`, unless overridden per-call via
3463
+ * `options.websocketUrl`.
3102
3464
  */
3103
3465
  initiateOutboundConversation(options: InitiateVoiceConversationOptions): Promise<InitiateVoiceConversationResult>;
3104
3466
  /**
3105
- * Handle ConversationRelay callback from Twilio
3467
+ * Handle ConversationRelay callback from Twilio. Cleans up on call completion
3468
+ * in voice-only mode; in orchestrated mode the CO webhook owns cleanup.
3106
3469
  *
3107
3470
  * @param payload - Callback payload from Twilio
3108
3471
  * @returns Response with status, content, and content type
@@ -3139,6 +3502,29 @@ declare class VoiceChannel extends BaseChannel {
3139
3502
  * @returns true if an active task exists
3140
3503
  */
3141
3504
  hasActiveStreamTask(conversationId: ConversationId): boolean;
3505
+ /**
3506
+ * Field names on {@link TwiMLOptions} that map directly to `<ConversationRelay>`
3507
+ * attributes (camelCase, emitted as-is). Excludes the fields handled specially
3508
+ * by {@link generateTwiml}: websocketUrl (resolved through the layered merge and
3509
+ * emitted as the `url` attribute), actionUrl, languages, customParameters, extra.
3510
+ */
3511
+ private static readonly RELAY_ATTR_FIELDS;
3512
+ /**
3513
+ * Generate TwiML XML for ConversationRelay from a merged {@link TwiMLOptions}.
3514
+ *
3515
+ * This is the low-level emitter used by `handleIncomingCall` and
3516
+ * `initiateOutboundConversation` after layering. It mirrors the Python SDK's
3517
+ * `generate_twiml`. The WebSocket URL may be passed as `websocketUrl` or via
3518
+ * `options.websocketUrl` (the explicit argument wins when both are given), so a
3519
+ * channel-less caller can pass everything in one object.
3520
+ *
3521
+ * @param websocketUrl - Public WebSocket URL (e.g. 'wss://example.ngrok.app/ws').
3522
+ * Optional if `options.websocketUrl` is set.
3523
+ * @param options - Merged TwiMLOptions to emit.
3524
+ * @returns TwiML XML string ready to return to Twilio.
3525
+ * @throws {Error} if no WebSocket URL is provided via either source.
3526
+ */
3527
+ private generateTwiml;
3142
3528
  /**
3143
3529
  * Generate TwiML to connect a call to ConversationRelay.
3144
3530
  * Validates configuration with Zod before generating TwiML.
@@ -3157,14 +3543,6 @@ declare class VoiceChannel extends BaseChannel {
3157
3543
  * Keeps null, false, 0, and empty strings as they are valid values.
3158
3544
  */
3159
3545
  private filterUnsetValues;
3160
- /**
3161
- * Extract conversation ID - Not applicable for Voice channel
3162
- */
3163
- protected extractConversationId(_payload: unknown): ConversationId | null;
3164
- /**
3165
- * Extract profile ID - Not applicable for Voice channel
3166
- */
3167
- protected extractProfileId(_payload: unknown): ProfileId | null;
3168
3546
  /**
3169
3547
  * Cleanup channel state on shutdown
3170
3548
  *
@@ -3617,17 +3995,23 @@ interface TACServerConfig {
3617
3995
  host?: string;
3618
3996
  /** Port to bind the server to (default: 8000) */
3619
3997
  port?: number;
3620
- /** Custom webhook paths */
3998
+ /**
3999
+ * Custom server-only webhook paths. The voice WebSocket and ConversationRelay
4000
+ * action callback paths live on `TACConfig` (`voiceWebsocketPath` /
4001
+ * `voiceActionPath`) because they're consumed by the voice channel regardless
4002
+ * of which web framework is used; this server reads them from there.
4003
+ */
3621
4004
  webhookPaths?: {
4005
+ /**
4006
+ * @deprecated Use `conversation` instead. This field will be removed in a future version.
4007
+ * If both `messaging` and `conversation` are set, `conversation` takes precedence.
4008
+ */
3622
4009
  messaging?: string;
4010
+ conversation?: string;
3623
4011
  twiml?: string;
3624
- ws?: string;
3625
- conversationRelayCallback?: string;
3626
4012
  /** Path for Conversation Intelligence webhook (optional - only registered if provided) */
3627
4013
  cintel?: string;
3628
4014
  };
3629
- /** ConversationRelay configuration (welcomeGreeting, transcription, TTS, interaction settings, etc.) */
3630
- conversationRelayConfig?: Partial<Omit<ConversationRelayConfig, 'url'>>;
3631
4015
  /** Voice channel instance (alternative to registering on TAC) */
3632
4016
  voiceChannel?: VoiceChannel;
3633
4017
  /** Messaging channel instances — webhooks are fanned out to all (alternative to registering on TAC) */
@@ -3660,10 +4044,12 @@ declare class TACServer {
3660
4044
  readonly fastify: FastifyInstance;
3661
4045
  private readonly tac;
3662
4046
  private readonly config;
3663
- /** All enabled messaging channels — webhooks are fanned out to each one */
4047
+ /** All enabled messaging channels */
3664
4048
  private readonly messagingChannels;
3665
4049
  /** Voice channel instance */
3666
4050
  private readonly voiceChannel;
4051
+ /** All channels that need webhook processing (voice + messaging) */
4052
+ private readonly webhookChannels;
3667
4053
  constructor(tac: TAC, config?: TACServerConfig);
3668
4054
  private getForwardedProto;
3669
4055
  private getForwardedHost;
@@ -3698,4 +4084,4 @@ declare class TACServer {
3698
4084
  stop(): Promise<void>;
3699
4085
  }
3700
4086
 
3701
- export { type ActionChannelSettings, ActionChannelSettingsSchema, type ActionParticipantRef, ActionParticipantRefSchema, type ActionResponse, ActionResponseSchema, type ActionTextContent, ActionTextContentSchema, type AdapterOptions, type AuthorInfo, AuthorInfoSchema, BaseChannel, type BaseChannelEvents, type BaseChannelOptions, BaseClient, type BuiltInToolName, BuiltInTools, type CaptureRule, CaptureRuleSchema, type ChannelSettings, ChannelSettingsSchema, type ChannelType, ChannelTypeSchema, ChatChannel, type ChatChannelConfig, type CintelParticipant, CintelParticipantSchema, type Communication, type CommunicationContent, CommunicationContentSchema, type CommunicationParticipant, CommunicationParticipantSchema, CommunicationSchema, type ConversationAddress, ConversationAddressSchema, ConversationClient, type ConversationConfiguration, ConversationConfigurationSchema, type ConversationEndedCallback, type ConversationGroupingType, ConversationGroupingTypeSchema, type ConversationId, type ConversationIntelligenceConfig, ConversationIntelligenceConfigSchema, type ConversationParticipant, ConversationParticipantSchema, type ConversationRelayAttributes, ConversationRelayAttributesSchema, type ConversationRelayCallbackPayload, ConversationRelayCallbackPayloadSchema, type ConversationRelayConfig, ConversationRelayConfigSchema, type ConversationResponse, ConversationResponseSchema, type ConversationSession, ConversationSessionSchema, type ConversationSummaryItem, ConversationSummaryItemSchema, type ConversationWebhookPayload, type CreateConversationSummariesResponse, CreateConversationSummariesResponseSchema, type CreateObservationResponse, CreateObservationResponseSchema, type CustomParameters, CustomParametersSchema, EMPTY_MEMORY_RESPONSE, EnvironmentVariables, type ExecutionDetails, ExecutionDetailsSchema, type HandoffPayload, HandoffPayloadSchema, type HandoffResult, type InitiateChatConversationOptions, type InitiateConversationResult, type InitiateMessagingConversationOptions, InitiateMessagingConversationOptionsSchema, type InitiateVoiceConversationOptions, InitiateVoiceConversationOptionsSchema, type InitiateVoiceConversationResult, type IntelligenceConfiguration, IntelligenceConfigurationSchema, type InterruptCallback, type InterruptMessage, InterruptMessageSchema, type JSONSchema, JSONSchemaSchema, type KnowledgeBase, KnowledgeBaseSchema, type KnowledgeBaseStatus, KnowledgeBaseStatusSchema, type KnowledgeChunkResult, KnowledgeChunkResultSchema, KnowledgeClient, type KnowledgeSearchResponse, KnowledgeSearchResponseSchema, type LanguageAttributes, LanguageAttributesSchema, type ListCommunicationsResponse, ListCommunicationsResponseSchema, type ListConversationsResponse, ListConversationsResponseSchema, type ListParticipantsResponse, ListParticipantsResponseSchema, type Logger, type MemoryChannelType, MemoryChannelTypeSchema, MemoryClient, type MemoryCommunication, type MemoryCommunicationContent, MemoryCommunicationContentSchema, MemoryCommunicationSchema, type MemoryDeliveryStatus, MemoryDeliveryStatusSchema, type MemoryMode, MemoryModeSchema, type MemoryParticipant, MemoryParticipantSchema, type MemoryParticipantType, MemoryParticipantTypeSchema, MemoryPromptBuilder, type MemoryRetrievalRequest, MemoryRetrievalRequestSchema, type MemoryRetrievalResponse, MemoryRetrievalResponseSchema, type MessageDirection, MessageDirectionSchema, type MessageReadyCallback, MessagingChannel, type MessagingChannelConfig, type MessagingChannelEvents, type ObservationInfo, ObservationInfoSchema, type OpenAITool, OpenAIToolSchema, type Operator, type OperatorProcessingResult, OperatorProcessingResultSchema, type OperatorResult, type OperatorResultEvent, OperatorResultEventSchema, OperatorResultProcessor, OperatorResultSchema, OperatorSchema, type ParticipantAddress, ParticipantAddressSchema, type ParticipantAddressType, ParticipantAddressTypeSchema, type ParticipantId, type PendingHandoffData, PendingHandoffDataSchema, type Profile, type ProfileId, type ProfileLookupResponse, ProfileLookupResponseSchema, type ProfileResponse, ProfileResponseSchema, type PromptMessage, PromptMessageSchema, RCSChannel, SMSChannel, type SendMessageActionPayload, SendMessageActionPayloadSchema, type SendMessageActionRequest, SendMessageActionRequestSchema, type SessionInfo, SessionInfoSchema, type SessionMessage, SessionMessageSchema, type SetupMessage, SetupMessageSchema, type StatusCallback, StatusCallbackSchema, type StatusTimeouts, StatusTimeoutsSchema, type StreamTask, type SummaryInfo, SummaryInfoSchema, TAC, type TACChannelType, TACChannelTypeSchema, type TACCommunication, type TACCommunicationAuthor, TACCommunicationAuthorSchema, type TACCommunicationContent, TACCommunicationContentSchema, TACCommunicationSchema, TACConfig, type TACConfigData, TACConfigSchema, type TACDeliveryStatus, TACDeliveryStatusSchema, TACMemoryResponse, type TACOptions, type TACParticipantType, TACParticipantTypeSchema, TACServer, type TACServerConfig, TACTool, type TextTokenMessage, TextTokenMessageSchema, type ToolContext, type ToolExecutionResult, ToolExecutionResultSchema, type ToolFunction, type Transcription, TranscriptionSchema, type TranscriptionWord, TranscriptionWordSchema, type TwilioMemoryConfig, TwilioMemoryConfigSchema, VoiceChannel, type VoiceChannelEvents, type WebSocketMessage, WebSocketMessageSchema, WhatsAppChannel, type _SDKDriftGuards, buildHandoffPayload, createKnowledgeSearchTool, createKnowledgeSearchToolAsync, createKnowledgeTools, createLogger, createMemoryRetrievalTool, createMemoryTools, createMessagingTools, createSendMessageTool, createStudioHandoffTool, defineTool, isConversationId, isParticipantId, isProfileId, maskAddress, maskEmail, maskPhone, postStudioHandoff, scrubObject, scrubPii, studioExecutionsUrl, studioVoiceHandoffUrl };
4087
+ export { type ActionChannelSettings, ActionChannelSettingsSchema, type ActionParticipantRef, ActionParticipantRefSchema, type ActionResponse, ActionResponseSchema, type ActionTextContent, ActionTextContentSchema, type AdapterOptions, type AuthorInfo, AuthorInfoSchema, BaseChannel, type BaseChannelEvents, type BaseChannelOptions, BaseClient, type BuiltInToolName, BuiltInTools, type CaptureRule, CaptureRuleSchema, type ChannelSettings, ChannelSettingsSchema, type ChannelType, ChannelTypeSchema, ChatChannel, type ChatChannelConfig, type CintelParticipant, CintelParticipantSchema, type Communication, type CommunicationContent, CommunicationContentSchema, type CommunicationParticipant, CommunicationParticipantSchema, CommunicationSchema, type ConversationAddress, ConversationAddressSchema, ConversationClient, type ConversationConfiguration, ConversationConfigurationSchema, type ConversationEndedCallback, type ConversationGroupingType, ConversationGroupingTypeSchema, type ConversationId, type ConversationIntelligenceConfig, ConversationIntelligenceConfigSchema, type ConversationParticipant, ConversationParticipantSchema, type ConversationRelayAttributes, ConversationRelayAttributesSchema, type ConversationRelayCallbackPayload, ConversationRelayCallbackPayloadSchema, type ConversationRelayConfig, ConversationRelayConfigSchema, type ConversationResponse, ConversationResponseSchema, type ConversationSession, ConversationSessionSchema, type ConversationSummaryItem, ConversationSummaryItemSchema, type ConversationWebhookPayload, type CreateConversationSummariesResponse, CreateConversationSummariesResponseSchema, type CreateObservationResponse, CreateObservationResponseSchema, type CustomParameters, CustomParametersSchema, EMPTY_MEMORY_RESPONSE, EnvironmentVariables, type ExecutionDetails, ExecutionDetailsSchema, type HandoffPayload, HandoffPayloadSchema, type HandoffResult, type InboundCallTwimlHandler, type InitiateChatConversationOptions, type InitiateConversationResult, type InitiateMessagingConversationOptions, InitiateMessagingConversationOptionsSchema, type InitiateVoiceConversationOptions, InitiateVoiceConversationOptionsSchema, type InitiateVoiceConversationResult, type IntelligenceConfiguration, IntelligenceConfigurationSchema, type InterruptCallback, type InterruptMessage, InterruptMessageSchema, type InterruptMode, InterruptModeSchema, type JSONSchema, JSONSchemaSchema, type KnowledgeBase, KnowledgeBaseSchema, type KnowledgeBaseStatus, KnowledgeBaseStatusSchema, type KnowledgeChunkResult, KnowledgeChunkResultSchema, KnowledgeClient, type KnowledgeSearchResponse, KnowledgeSearchResponseSchema, type LanguageAttributes, LanguageAttributesSchema, type LanguageConfig, LanguageConfigSchema, type ListCommunicationsResponse, ListCommunicationsResponseSchema, type ListConversationsResponse, ListConversationsResponseSchema, type ListParticipantsResponse, ListParticipantsResponseSchema, type Logger, type MemoryChannelType, MemoryChannelTypeSchema, MemoryClient, type MemoryCommunication, type MemoryCommunicationContent, MemoryCommunicationContentSchema, MemoryCommunicationSchema, type MemoryDeliveryStatus, MemoryDeliveryStatusSchema, type MemoryMode, MemoryModeSchema, type MemoryParticipant, MemoryParticipantSchema, type MemoryParticipantType, MemoryParticipantTypeSchema, MemoryPromptBuilder, type MemoryRetrievalRequest, MemoryRetrievalRequestSchema, type MemoryRetrievalResponse, MemoryRetrievalResponseSchema, type MessageDirection, MessageDirectionSchema, type MessageReadyCallback, MessagingChannel, type MessagingChannelConfig, type MessagingChannelEvents, type ObservationInfo, ObservationInfoSchema, type OpenAITool, OpenAIToolSchema, type Operator, type OperatorProcessingResult, OperatorProcessingResultSchema, type OperatorResult, type OperatorResultEvent, OperatorResultEventSchema, OperatorResultProcessor, OperatorResultSchema, OperatorSchema, type ParticipantAddress, ParticipantAddressSchema, type ParticipantAddressType, ParticipantAddressTypeSchema, type ParticipantId, type PendingHandoffData, PendingHandoffDataSchema, type Profile, type ProfileId, type ProfileLookupResponse, ProfileLookupResponseSchema, type ProfileResponse, ProfileResponseSchema, type PromptMessage, PromptMessageSchema, RCSChannel, SMSChannel, type SendMessageActionPayload, SendMessageActionPayloadSchema, type SendMessageActionRequest, SendMessageActionRequestSchema, type SessionInfo, SessionInfoSchema, type SessionMessage, SessionMessageSchema, type SetupMessage, SetupMessageSchema, type StatusCallback, StatusCallbackSchema, type StatusTimeouts, StatusTimeoutsSchema, type StreamTask, type SummaryInfo, SummaryInfoSchema, TAC, type TACChannelType, TACChannelTypeSchema, type TACCommunication, type TACCommunicationAuthor, TACCommunicationAuthorSchema, type TACCommunicationContent, TACCommunicationContentSchema, TACCommunicationSchema, TACConfig, type TACConfigData, TACConfigSchema, type TACDeliveryStatus, TACDeliveryStatusSchema, TACMemoryResponse, type TACOptions, type TACParticipantType, TACParticipantTypeSchema, TACServer, type TACServerConfig, TACTool, type TextTokenMessage, TextTokenMessageSchema, type ToolContext, type ToolExecutionResult, ToolExecutionResultSchema, type ToolFunction, type Transcription, TranscriptionSchema, type TranscriptionWord, TranscriptionWordSchema, type TwiMLOptions, TwiMLOptionsSchema, type TwiMLRequest, TwiMLRequestSchema, type TwilioMemoryConfig, TwilioMemoryConfigSchema, VoiceChannel, type VoiceChannelConfig, type VoiceChannelEvents, type WebSocketMessage, WebSocketMessageSchema, WhatsAppChannel, type _SDKDriftGuards, buildHandoffPayload, createKnowledgeSearchTool, createKnowledgeSearchToolAsync, createKnowledgeTools, createLogger, createMemoryRetrievalTool, createMemoryTools, createMessagingTools, createSendMessageTool, createStudioHandoffTool, defineTool, isConversationId, isParticipantId, isProfileId, maskAddress, maskEmail, maskPhone, postStudioHandoff, scrubObject, scrubPii, studioExecutionsUrl, studioVoiceHandoffUrl, twiMLRequestFromForm };