twilio-agent-connect 1.0.3 → 2.0.0

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
 
@@ -1613,248 +2035,63 @@ type IntelligenceConfiguration = z.infer<typeof IntelligenceConfigurationSchema>
1613
2035
  */
1614
2036
  declare const OperatorResultEventSchema: z.ZodObject<{
1615
2037
  accountId: z.ZodString;
1616
- conversationId: z.ZodString;
1617
- 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>>;
2038
+ conversationId: z.ZodString;
2039
+ memoryStoreId: z.ZodOptional<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
@@ -2372,7 +2539,8 @@ interface BaseChannelOptions {
2372
2539
  * Memory retrieval mode for this channel. Default is "never".
2373
2540
  *
2374
2541
  * - "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.
2542
+ * - "always": Memory is automatically retrieved (using the message as query) for every inbound message and available in `onMessageReady` callback.
2543
+ * - "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
2544
  */
2377
2545
  memoryMode?: MemoryMode;
2378
2546
  /**
@@ -2470,21 +2638,62 @@ declare abstract class BaseChannel {
2470
2638
  */
2471
2639
  protected validateWebhookPayload(payload: unknown): boolean;
2472
2640
  /**
2473
- * Extract conversation ID from webhook payload (implemented by subclasses)
2641
+ * Preprocess webhook before handling event-specific logic.
2642
+ * Handles deduplication, validation, filtering, and data extraction.
2643
+ *
2644
+ * @param payload - Raw webhook payload from Twilio
2645
+ * @param idempotencyToken - Optional idempotency token for deduplication
2646
+ * @returns Preprocessed webhook data, or null if webhook should be skipped
2647
+ */
2648
+ protected preprocessWebhook(payload: unknown, idempotencyToken: string | undefined): {
2649
+ webhookData: ConversationWebhookPayload;
2650
+ eventType: string;
2651
+ conversationId: string | undefined;
2652
+ } | null;
2653
+ /**
2654
+ * Extract conversation ID from webhook payload with type validation.
2655
+ *
2656
+ * Extracts conversationId from webhookData.data?.conversationId || webhookData.data?.id,
2657
+ * validates the value is a non-empty string, and ensures it passes isConversationId check.
2658
+ *
2659
+ * This prevents invalid IDs from causing downstream issues like incorrect Map key
2660
+ * matching in CONVERSATION_UPDATED self-filtering or propagating malformed IDs.
2474
2661
  */
2475
- protected abstract extractConversationId(payload: unknown): ConversationId | null;
2662
+ protected extractConversationId(payload: unknown): ConversationId | null;
2476
2663
  /**
2477
- * Extract profile ID from webhook payload (implemented by subclasses)
2664
+ * Extract profile ID from webhook payload with type validation.
2665
+ *
2666
+ * Extracts profileId from webhookData.data?.profileId,
2667
+ * validates the value is a non-empty string, and ensures it passes isProfileId check.
2668
+ *
2669
+ * This prevents invalid IDs from propagating downstream and ensures consistent
2670
+ * validation across all channel types.
2478
2671
  */
2479
- protected abstract extractProfileId(payload: unknown): ProfileId | null;
2672
+ protected extractProfileId(payload: unknown): ProfileId | null;
2480
2673
  /**
2481
- * Retrieve memory only when memoryMode === 'always'.
2674
+ * Retrieve memory according to the channel's memoryMode.
2482
2675
  *
2483
2676
  * 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.
2677
+ * including error handling and debug logging.
2678
+ *
2679
+ * Modes:
2680
+ * - "always": Fetch with the provided query on every message.
2681
+ * - "once": Fetch once with an empty query and cache the result on the
2682
+ * session. Subsequent calls reuse the cache until it is invalidated on the
2683
+ * INACTIVE transition.
2684
+ * - "never": Skip retrieval.
2685
+ *
2686
+ * Memory retrieval failures are logged and swallowed so message processing
2687
+ * continues without memory context.
2486
2688
  */
2487
2689
  protected retrieveMemoryIfEnabled(session: ConversationSession, query?: string): Promise<TACMemoryResponse | undefined>;
2690
+ /**
2691
+ * Invalidate cached memory for "once" mode when a conversation becomes
2692
+ * INACTIVE. Conversation Orchestrator updates memory on the INACTIVE
2693
+ * transition, so the next message re-fetches fresh memory. No-op for other
2694
+ * memory modes.
2695
+ */
2696
+ protected invalidateCachedMemory(conversationId: ConversationId): void;
2488
2697
  /**
2489
2698
  * Cleanup resources when shutting down
2490
2699
  */
@@ -2727,14 +2936,6 @@ declare abstract class MessagingChannel extends BaseChannel {
2727
2936
  * Handle conversation updated event
2728
2937
  */
2729
2938
  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
2939
  /**
2739
2940
  * Validate messaging channel webhook payload structure
2740
2941
  */
@@ -2976,6 +3177,34 @@ declare class ChatChannel extends MessagingChannel {
2976
3177
  initiateOutboundConversation(options: InitiateChatConversationOptions): Promise<InitiateConversationResult>;
2977
3178
  }
2978
3179
 
3180
+ /**
3181
+ * Configuration for the Voice channel.
3182
+ *
3183
+ * `defaultTwimlOptions` is one of several TwiML layers that merge per-field;
3184
+ * see `handleIncomingCall` (inbound) and `initiateOutboundConversation`
3185
+ * (outbound) for the full precedence order.
3186
+ */
3187
+ interface VoiceChannelConfig extends BaseChannelOptions {
3188
+ /**
3189
+ * Static `TwiMLOptions` applied to every call (inbound and outbound).
3190
+ * Controls the TwiML inside `<ConversationRelay>` — voice, language,
3191
+ * transcription provider, welcomeGreeting, `<Language>` children, etc. Use
3192
+ * this when the same ConversationRelay configuration is correct for every call.
3193
+ *
3194
+ * Per-call inbound customization is registered via
3195
+ * `VoiceChannel.onInboundCallTwiml(...)` (not on this config).
3196
+ *
3197
+ * Note: `customParameters` and `languages` replace wholesale when a
3198
+ * higher-priority layer sets them.
3199
+ */
3200
+ defaultTwimlOptions?: TwiMLOptions;
3201
+ }
3202
+ /**
3203
+ * Callback that produces per-call overrides for the TwiML inside
3204
+ * `<ConversationRelay>` on inbound calls. Receives a framework-neutral
3205
+ * {@link TwiMLRequest} and returns {@link TwiMLOptions}.
3206
+ */
3207
+ type InboundCallTwimlHandler = (req: TwiMLRequest) => Promise<TwiMLOptions>;
2979
3208
  /**
2980
3209
  * Voice channel event callbacks extending base callbacks
2981
3210
  */
@@ -3024,7 +3253,45 @@ declare class VoiceChannel extends BaseChannel {
3024
3253
  private readonly callSidToConversationId;
3025
3254
  private readonly MAX_INITIALIZATION_RETRIES;
3026
3255
  private twilioClient;
3027
- constructor(tac: TAC, options?: BaseChannelOptions);
3256
+ private readonly voiceConfig;
3257
+ private onInboundCallTwimlHandler;
3258
+ constructor(tac: TAC, options?: VoiceChannelConfig);
3259
+ /**
3260
+ * Register a callback that produces per-call overrides for the TwiML inside
3261
+ * `<ConversationRelay>` on inbound calls.
3262
+ *
3263
+ * The callback receives a framework-neutral {@link TwiMLRequest} (parsed from
3264
+ * the Twilio webhook form) and returns {@link TwiMLOptions}. Fields the
3265
+ * callback explicitly sets override `defaultTwimlOptions` and TAC defaults;
3266
+ * unset fields fall through.
3267
+ *
3268
+ * @example
3269
+ * ```typescript
3270
+ * voiceChannel.onInboundCallTwiml(async req => {
3271
+ * if (req.callerCountry === 'MX') {
3272
+ * return { language: 'es-MX', welcomeGreeting: '¡Hola!' };
3273
+ * }
3274
+ * return {};
3275
+ * });
3276
+ * ```
3277
+ *
3278
+ * Outbound calls don't use this — pass per-call TwiML via
3279
+ * `InitiateVoiceConversationOptions.twimlOptions` directly.
3280
+ */
3281
+ onInboundCallTwiml(callback: InboundCallTwimlHandler): void;
3282
+ /**
3283
+ * Resolve the public WebSocket URL from `TACConfig.voicePublicDomain` +
3284
+ * `TACConfig.voiceWebsocketPath`. Throws if `voicePublicDomain` isn't set.
3285
+ */
3286
+ private resolveWebsocketUrl;
3287
+ /**
3288
+ * Resolve the default `<Connect action=...>` cleanup URL.
3289
+ *
3290
+ * Returns undefined if `voicePublicDomain` isn't set; that's fine because
3291
+ * actionUrl has higher-priority layers (customizer, twimlOptions, Studio
3292
+ * handoff) above this fallback.
3293
+ */
3294
+ private resolveDefaultActionUrl;
3028
3295
  private getTwilioClient;
3029
3296
  get channelType(): ChannelType;
3030
3297
  /**
@@ -3032,10 +3299,22 @@ declare class VoiceChannel extends BaseChannel {
3032
3299
  */
3033
3300
  on(event: string, callback: (...args: any[]) => void): void;
3034
3301
  /**
3035
- * Process webhook - Voice channel doesn't use traditional webhooks,
3036
- * but this method is required by the base class
3302
+ * Process conversation webhooks for cleanup.
3303
+ *
3304
+ * Voice channel processes CONVERSATION_UPDATED events:
3305
+ * - CLOSED status: Clean up local session state
3306
+ *
3307
+ * Note: Conversation tracking uses instance-local memory. In multi-instance
3308
+ * deployments, webhooks may route to a different instance, preventing cleanup.
3309
+ *
3310
+ * @param payload - Raw webhook event data from Twilio
3311
+ * @param idempotencyToken - Optional Twilio idempotency token from request headers
3312
+ */
3313
+ processWebhook(payload: unknown, idempotencyToken?: string): Promise<void>;
3314
+ /**
3315
+ * Handle conversation updated event
3037
3316
  */
3038
- processWebhook(_payload: unknown): Promise<void>;
3317
+ private handleConversationUpdated;
3039
3318
  /**
3040
3319
  * Get active WebSocket connection for a conversation
3041
3320
  */
@@ -3053,7 +3332,9 @@ declare class VoiceChannel extends BaseChannel {
3053
3332
  */
3054
3333
  private handleInterruptMessage;
3055
3334
  /**
3056
- * Handle WebSocket disconnection
3335
+ * Handle WebSocket disconnection. In orchestrated mode the conversation stays
3336
+ * tracked until the CLOSED webhook (so a follow-up call can reuse it); in
3337
+ * voice-only mode there is no such webhook, so it ends here.
3057
3338
  */
3058
3339
  private handleWebSocketDisconnect;
3059
3340
  /**
@@ -3075,18 +3356,89 @@ declare class VoiceChannel extends BaseChannel {
3075
3356
  signal?: AbortSignal;
3076
3357
  }): Promise<string>;
3077
3358
  /**
3078
- * Handle incoming voice call - generate TwiML to connect to ConversationRelay
3359
+ * Generate the TwiML response for an incoming voice call.
3360
+ *
3361
+ * ConversationRelay automatically handles conversation creation and
3362
+ * participant management via the `conversationConfiguration` parameter.
3363
+ *
3364
+ * The WebSocket URL and default session-cleanup action URL are derived from
3365
+ * `TACConfig.voicePublicDomain` + `TACConfig.voiceWebsocketPath` /
3366
+ * `voiceActionPath`.
3367
+ *
3368
+ * TwiML fields are merged per-field, highest precedence first:
3369
+ * 1. Output of the customizer registered via
3370
+ * `VoiceChannel.onInboundCallTwiml(...)` if configured and `twimlRequest`
3371
+ * is given. (Application-owned.)
3372
+ * 2. `VoiceChannelConfig.defaultTwimlOptions` — per-channel defaults.
3373
+ * 3. `hostTwimlOptions` — per-call transport facts supplied by the host (the
3374
+ * code owning the route), e.g. a per-call `websocketUrl` with an affinity
3375
+ * token.
3376
+ * 4. TAC defaults: a fixed default welcomeGreeting, `conversationConfiguration`
3377
+ * from `TACConfig`, `actionUrl` resolved via Studio handoff (when
3378
+ * `studioHandoffFlowSid` is configured), else derived from
3379
+ * `TACConfig.voicePublicDomain` + `voiceActionPath`, and the `websocketUrl`
3380
+ * derived from `TACConfig.voicePublicDomain` + `voiceWebsocketPath`.
3381
+ *
3382
+ * Fields not set at a layer fall through to lower layers. Arrays (`languages`)
3383
+ * and nested objects (`customParameters`) replace wholesale when set at a
3384
+ * higher-priority layer. `websocketUrl` falls back to the `TACConfig`-derived
3385
+ * URL if unset at every layer.
3386
+ *
3387
+ * @param twimlRequest - Parsed Twilio webhook fields. Passed to the customizer
3388
+ * if one is configured on the channel.
3389
+ * @param options - Additional per-call inputs.
3390
+ * @param options.hostTwimlOptions - Per-call TwiML supplied by a custom
3391
+ * in-process host (e.g. an affinity-routed deployment injecting a per-call
3392
+ * `websocketUrl`), layered below `defaultTwimlOptions` and the application
3393
+ * customizer but above the TAC defaults.
3394
+ * @returns TwiML XML string for call connection.
3395
+ */
3396
+ handleIncomingCall(twimlRequest?: TwiMLRequest, options?: {
3397
+ hostTwimlOptions?: TwiMLOptions;
3398
+ }): Promise<string>;
3399
+ /**
3400
+ * Layer TwiML options, lowest precedence first: TAC defaults → `host`
3401
+ * (calling host's per-call values) → channel `defaultTwimlOptions` → `perCall`
3402
+ * (application customizer output for inbound, or
3403
+ * `InitiateVoiceConversationOptions.twimlOptions` for outbound).
3404
+ */
3405
+ private buildTwimlOptions;
3406
+ /**
3407
+ * Apply fields explicitly present on `source` onto `target`.
3408
+ *
3409
+ * Nested objects (`customParameters`), arrays (`languages`), and dicts
3410
+ * (`extra`) replace wholesale — there's no per-key merging.
3079
3411
  *
3080
- * ConversationRelay will create the conversation automatically. The conversation
3081
- * will be initialized on the first prompt using the callSid.
3412
+ * `actionUrl` is skipped here on purpose it's resolved once via
3413
+ * `resolveActionUrl` looking at every layer at once, and that resolved value
3414
+ * is written into `target` before this overlay runs. Letting it through here
3415
+ * would let a higher-priority layer that didn't set actionUrl silently clobber
3416
+ * a lower layer that did.
3082
3417
  *
3083
- * @param options - Options for handling the incoming call
3084
- * @returns TwiML XML string with ConversationRelay configuration
3418
+ * "Explicitly present" is detected via key presence (`key in source`), which
3419
+ * mirrors Python's `model_fields_set`: a key set to `undefined` is still
3420
+ * "present" and overrides lower layers, while an absent key falls through.
3085
3421
  */
3086
- handleIncomingCall(options: {
3087
- actionUrl?: string;
3088
- conversationRelayConfig: ConversationRelayConfig;
3089
- }): string;
3422
+ private overlayFields;
3423
+ /**
3424
+ * Resolve the TwiML `<Connect action=...>` URL.
3425
+ *
3426
+ * Precedence (highest to lowest):
3427
+ * 1. application customizer
3428
+ * 2. channel `defaultTwimlOptions`
3429
+ * 3. `host` (calling host's per-call options)
3430
+ * 4. Studio handoff (when `studioHandoffFlowSid` is configured)
3431
+ * 5. Channel default — derived from `TACConfig.voicePublicDomain` +
3432
+ * `TACConfig.voiceActionPath`.
3433
+ *
3434
+ * User-expressed intent (Studio handoff is configured explicitly on
3435
+ * `TACConfig`) beats the SDK's generated cleanup default.
3436
+ *
3437
+ * Explicit `actionUrl: undefined` on a layer (key present, value undefined)
3438
+ * suppresses `<Connect action=...>` entirely — all lower layers are skipped.
3439
+ * `actionUrl` left absent (key not present) falls through to the next layer.
3440
+ */
3441
+ private resolveActionUrl;
3090
3442
  /**
3091
3443
  * Initiate an outbound voice conversation
3092
3444
  *
@@ -3095,14 +3447,21 @@ declare class VoiceChannel extends BaseChannel {
3095
3447
  * conversation during passive hydration. The session is initialized lazily
3096
3448
  * on the first prompt when the conversation is discovered by callSid.
3097
3449
  *
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.
3450
+ * TwiML fields are merged per-field, highest precedence first:
3451
+ * 1. `options.twimlOptions` per-call overrides
3452
+ * 2. `VoiceChannelConfig.defaultTwimlOptions` channel-wide defaults
3453
+ * 3. TAC defaults: welcome greeting, `conversationConfiguration` from
3454
+ * `TACConfig`, and `actionUrl` from Studio handoff (if configured), else
3455
+ * derived from `TACConfig.voicePublicDomain` + `voiceActionPath`.
3456
+ *
3457
+ * The WebSocket URL is derived from `TACConfig.voicePublicDomain` +
3458
+ * `TACConfig.voiceWebsocketPath`, unless overridden per-call via
3459
+ * `options.websocketUrl`.
3102
3460
  */
3103
3461
  initiateOutboundConversation(options: InitiateVoiceConversationOptions): Promise<InitiateVoiceConversationResult>;
3104
3462
  /**
3105
- * Handle ConversationRelay callback from Twilio
3463
+ * Handle ConversationRelay callback from Twilio. Cleans up on call completion
3464
+ * in voice-only mode; in orchestrated mode the CO webhook owns cleanup.
3106
3465
  *
3107
3466
  * @param payload - Callback payload from Twilio
3108
3467
  * @returns Response with status, content, and content type
@@ -3139,6 +3498,29 @@ declare class VoiceChannel extends BaseChannel {
3139
3498
  * @returns true if an active task exists
3140
3499
  */
3141
3500
  hasActiveStreamTask(conversationId: ConversationId): boolean;
3501
+ /**
3502
+ * Field names on {@link TwiMLOptions} that map directly to `<ConversationRelay>`
3503
+ * attributes (camelCase, emitted as-is). Excludes the fields handled specially
3504
+ * by {@link generateTwiml}: websocketUrl (resolved through the layered merge and
3505
+ * emitted as the `url` attribute), actionUrl, languages, customParameters, extra.
3506
+ */
3507
+ private static readonly RELAY_ATTR_FIELDS;
3508
+ /**
3509
+ * Generate TwiML XML for ConversationRelay from a merged {@link TwiMLOptions}.
3510
+ *
3511
+ * This is the low-level emitter used by `handleIncomingCall` and
3512
+ * `initiateOutboundConversation` after layering. It mirrors the Python SDK's
3513
+ * `generate_twiml`. The WebSocket URL may be passed as `websocketUrl` or via
3514
+ * `options.websocketUrl` (the explicit argument wins when both are given), so a
3515
+ * channel-less caller can pass everything in one object.
3516
+ *
3517
+ * @param websocketUrl - Public WebSocket URL (e.g. 'wss://example.ngrok.app/ws').
3518
+ * Optional if `options.websocketUrl` is set.
3519
+ * @param options - Merged TwiMLOptions to emit.
3520
+ * @returns TwiML XML string ready to return to Twilio.
3521
+ * @throws {Error} if no WebSocket URL is provided via either source.
3522
+ */
3523
+ private generateTwiml;
3142
3524
  /**
3143
3525
  * Generate TwiML to connect a call to ConversationRelay.
3144
3526
  * Validates configuration with Zod before generating TwiML.
@@ -3157,14 +3539,6 @@ declare class VoiceChannel extends BaseChannel {
3157
3539
  * Keeps null, false, 0, and empty strings as they are valid values.
3158
3540
  */
3159
3541
  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
3542
  /**
3169
3543
  * Cleanup channel state on shutdown
3170
3544
  *
@@ -3617,17 +3991,23 @@ interface TACServerConfig {
3617
3991
  host?: string;
3618
3992
  /** Port to bind the server to (default: 8000) */
3619
3993
  port?: number;
3620
- /** Custom webhook paths */
3994
+ /**
3995
+ * Custom server-only webhook paths. The voice WebSocket and ConversationRelay
3996
+ * action callback paths live on `TACConfig` (`voiceWebsocketPath` /
3997
+ * `voiceActionPath`) because they're consumed by the voice channel regardless
3998
+ * of which web framework is used; this server reads them from there.
3999
+ */
3621
4000
  webhookPaths?: {
4001
+ /**
4002
+ * @deprecated Use `conversation` instead. This field will be removed in a future version.
4003
+ * If both `messaging` and `conversation` are set, `conversation` takes precedence.
4004
+ */
3622
4005
  messaging?: string;
4006
+ conversation?: string;
3623
4007
  twiml?: string;
3624
- ws?: string;
3625
- conversationRelayCallback?: string;
3626
4008
  /** Path for Conversation Intelligence webhook (optional - only registered if provided) */
3627
4009
  cintel?: string;
3628
4010
  };
3629
- /** ConversationRelay configuration (welcomeGreeting, transcription, TTS, interaction settings, etc.) */
3630
- conversationRelayConfig?: Partial<Omit<ConversationRelayConfig, 'url'>>;
3631
4011
  /** Voice channel instance (alternative to registering on TAC) */
3632
4012
  voiceChannel?: VoiceChannel;
3633
4013
  /** Messaging channel instances — webhooks are fanned out to all (alternative to registering on TAC) */
@@ -3660,10 +4040,12 @@ declare class TACServer {
3660
4040
  readonly fastify: FastifyInstance;
3661
4041
  private readonly tac;
3662
4042
  private readonly config;
3663
- /** All enabled messaging channels — webhooks are fanned out to each one */
4043
+ /** All enabled messaging channels */
3664
4044
  private readonly messagingChannels;
3665
4045
  /** Voice channel instance */
3666
4046
  private readonly voiceChannel;
4047
+ /** All channels that need webhook processing (voice + messaging) */
4048
+ private readonly webhookChannels;
3667
4049
  constructor(tac: TAC, config?: TACServerConfig);
3668
4050
  private getForwardedProto;
3669
4051
  private getForwardedHost;
@@ -3698,4 +4080,4 @@ declare class TACServer {
3698
4080
  stop(): Promise<void>;
3699
4081
  }
3700
4082
 
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 };
4083
+ 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 };