wiil-core-js 0.0.82
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/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/core/account/index.d.ts +7 -0
- package/dist/core/account/index.js +23 -0
- package/dist/core/account/organization.schema.d.ts +118 -0
- package/dist/core/account/organization.schema.js +91 -0
- package/dist/core/account/project.schema.d.ts +121 -0
- package/dist/core/account/project.schema.js +102 -0
- package/dist/core/account/supported-business-verticals.d.ts +8 -0
- package/dist/core/account/supported-business-verticals.js +23 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.d.ts +115 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.js +17 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.d.ts +61 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.js +29 -0
- package/dist/core/assistant-setups/index.d.ts +4 -0
- package/dist/core/assistant-setups/index.js +21 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.d.ts +63 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.js +14 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.d.ts +56 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.js +17 -0
- package/dist/core/base.schema.d.ts +34 -0
- package/dist/core/base.schema.js +36 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.d.ts +63 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.js +53 -0
- package/dist/core/business-mgt/appointment-field-config.schema.d.ts +251 -0
- package/dist/core/business-mgt/appointment-field-config.schema.js +49 -0
- package/dist/core/business-mgt/bookings.shared.schema.d.ts +47 -0
- package/dist/core/business-mgt/bookings.shared.schema.js +60 -0
- package/dist/core/business-mgt/business-location.schema.d.ts +327 -0
- package/dist/core/business-mgt/business-location.schema.js +176 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.d.ts +87 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.js +53 -0
- package/dist/core/business-mgt/customer-management/customer.schema.d.ts +156 -0
- package/dist/core/business-mgt/customer-management/customer.schema.js +93 -0
- package/dist/core/business-mgt/customer-management/index.d.ts +7 -0
- package/dist/core/business-mgt/customer-management/index.js +23 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.d.ts +112 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.js +79 -0
- package/dist/core/business-mgt/customer.schema.d.ts +111 -0
- package/dist/core/business-mgt/customer.schema.js +73 -0
- package/dist/core/business-mgt/discount-rule.schema.d.ts +183 -0
- package/dist/core/business-mgt/discount-rule.schema.js +108 -0
- package/dist/core/business-mgt/index.d.ts +16 -0
- package/dist/core/business-mgt/index.js +38 -0
- package/dist/core/business-mgt/menu-config.schema.d.ts +165 -0
- package/dist/core/business-mgt/menu-config.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/index.d.ts +11 -0
- package/dist/core/business-mgt/menu-management/index.js +27 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.d.ts +386 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.js +58 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.d.ts +301 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.js +169 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.d.ts +143 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.d.ts +239 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.js +117 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.d.ts +420 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.js +283 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.d.ts +654 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.js +204 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.d.ts +585 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.js +341 -0
- package/dist/core/business-mgt/menu.order.schema.d.ts +335 -0
- package/dist/core/business-mgt/menu.order.schema.js +149 -0
- package/dist/core/business-mgt/order.schema.d.ts +222 -0
- package/dist/core/business-mgt/order.schema.js +205 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.d.ts +56 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.js +68 -0
- package/dist/core/business-mgt/product-config.schema.d.ts +177 -0
- package/dist/core/business-mgt/product-config.schema.js +106 -0
- package/dist/core/business-mgt/product-management/index.d.ts +12 -0
- package/dist/core/business-mgt/product-management/index.js +28 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.d.ts +54 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.js +54 -0
- package/dist/core/business-mgt/product-management/product-config.schema.d.ts +1042 -0
- package/dist/core/business-mgt/product-management/product-config.schema.js +392 -0
- package/dist/core/business-mgt/product-management/product-display.schema.d.ts +548 -0
- package/dist/core/business-mgt/product-management/product-display.schema.js +80 -0
- package/dist/core/business-mgt/product-management/product-order.schema.d.ts +493 -0
- package/dist/core/business-mgt/product-management/product-order.schema.js +158 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.d.ts +167 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.js +68 -0
- package/dist/core/business-mgt/product-management/product-set.schema.d.ts +488 -0
- package/dist/core/business-mgt/product-management/product-set.schema.js +273 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.d.ts +156 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.js +98 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.d.ts +219 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.js +130 -0
- package/dist/core/business-mgt/product-order.schema.d.ts +326 -0
- package/dist/core/business-mgt/product-order.schema.js +153 -0
- package/dist/core/business-mgt/property-config.schema.d.ts +621 -0
- package/dist/core/business-mgt/property-config.schema.js +224 -0
- package/dist/core/business-mgt/property-inquiry.schema.d.ts +222 -0
- package/dist/core/business-mgt/property-inquiry.schema.js +112 -0
- package/dist/core/business-mgt/property-management/index.d.ts +6 -0
- package/dist/core/business-mgt/property-management/index.js +22 -0
- package/dist/core/business-mgt/property-management/property-config.schema.d.ts +1306 -0
- package/dist/core/business-mgt/property-management/property-config.schema.js +367 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.d.ts +254 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.js +131 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.d.ts +3 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.js +19 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.d.ts +139 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.js +90 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.js +70 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.js +72 -0
- package/dist/core/business-mgt/reservation-mgt/index.d.ts +14 -0
- package/dist/core/business-mgt/reservation-mgt/index.js +31 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.d.ts +180 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.js +75 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.d.ts +91 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.js +57 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.d.ts +334 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.js +179 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.d.ts +195 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.js +106 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.d.ts +402 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.js +198 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.d.ts +229 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.js +127 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.d.ts +382 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.js +322 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.d.ts +123 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.js +83 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.d.ts +167 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.js +84 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.d.ts +0 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.js +153 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.d.ts +4 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.js +20 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.d.ts +157 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.js +76 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.d.ts +137 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.js +94 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.d.ts +713 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.js +363 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.d.ts +151 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.js +147 -0
- package/dist/core/business-mgt/reservation-resource.schema.d.ts +154 -0
- package/dist/core/business-mgt/reservation-resource.schema.js +100 -0
- package/dist/core/business-mgt/reservation.schema.d.ts +119 -0
- package/dist/core/business-mgt/reservation.schema.js +89 -0
- package/dist/core/business-mgt/service-appointment.schema.d.ts +105 -0
- package/dist/core/business-mgt/service-appointment.schema.js +69 -0
- package/dist/core/business-mgt/service-config.schema.d.ts +453 -0
- package/dist/core/business-mgt/service-config.schema.js +102 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.d.ts +110 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.js +78 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.d.ts +304 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.js +75 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.d.ts +1226 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.js +317 -0
- package/dist/core/business-mgt/service-management/index.d.ts +13 -0
- package/dist/core/business-mgt/service-management/index.js +29 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.d.ts +531 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.js +116 -0
- package/dist/core/business-mgt/service-management/service-person.schema.d.ts +122 -0
- package/dist/core/business-mgt/service-management/service-person.schema.js +66 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.d.ts +221 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.js +118 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.js +54 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.js +113 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.d.ts +121 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.js +95 -0
- package/dist/core/business-mgt/service-person.schema.d.ts +43 -0
- package/dist/core/business-mgt/service-person.schema.js +38 -0
- package/dist/core/business-mgt/tax-rule.schema.d.ts +161 -0
- package/dist/core/business-mgt/tax-rule.schema.js +90 -0
- package/dist/core/conversation/conversation-config.schema.d.ts +644 -0
- package/dist/core/conversation/conversation-config.schema.js +351 -0
- package/dist/core/conversation/conversation-message.schema.d.ts +307 -0
- package/dist/core/conversation/conversation-message.schema.js +275 -0
- package/dist/core/conversation/index.d.ts +12 -0
- package/dist/core/conversation/index.js +28 -0
- package/dist/core/conversation/outbound-call.schema.d.ts +209 -0
- package/dist/core/conversation/outbound-call.schema.js +116 -0
- package/dist/core/conversation/outbound-email.schema.d.ts +338 -0
- package/dist/core/conversation/outbound-email.schema.js +150 -0
- package/dist/core/conversation/outbound-sms.schema.d.ts +163 -0
- package/dist/core/conversation/outbound-sms.schema.js +85 -0
- package/dist/core/conversation/outbound-template.schema.d.ts +375 -0
- package/dist/core/conversation/outbound-template.schema.js +160 -0
- package/dist/core/conversation/translation-config.schema.d.ts +92 -0
- package/dist/core/conversation/translation-config.schema.js +88 -0
- package/dist/core/conversation/translation-conversation.schema.d.ts +469 -0
- package/dist/core/conversation/translation-conversation.schema.js +175 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +30 -0
- package/dist/core/service-configuration/agent-config.schema.d.ts +236 -0
- package/dist/core/service-configuration/agent-config.schema.js +152 -0
- package/dist/core/service-configuration/base-agent-setup.d.ts +147 -0
- package/dist/core/service-configuration/base-agent-setup.js +123 -0
- package/dist/core/service-configuration/call-transfer-config.schema.d.ts +60 -0
- package/dist/core/service-configuration/call-transfer-config.schema.js +53 -0
- package/dist/core/service-configuration/deployment-config.schema.d.ts +522 -0
- package/dist/core/service-configuration/deployment-config.schema.js +271 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.d.ts +130 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.js +110 -0
- package/dist/core/service-configuration/dynamic_setup/index.d.ts +10 -0
- package/dist/core/service-configuration/dynamic_setup/index.js +26 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.d.ts +111 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.js +56 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.d.ts +113 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.js +55 -0
- package/dist/core/service-configuration/index.d.ts +17 -0
- package/dist/core/service-configuration/index.js +33 -0
- package/dist/core/service-configuration/instruction-config.schema.d.ts +183 -0
- package/dist/core/service-configuration/instruction-config.schema.js +139 -0
- package/dist/core/service-configuration/interaction-channels.schema.d.ts +469 -0
- package/dist/core/service-configuration/interaction-channels.schema.js +390 -0
- package/dist/core/service-configuration/knowledge.schema.d.ts +107 -0
- package/dist/core/service-configuration/knowledge.schema.js +106 -0
- package/dist/core/service-configuration/phone-config.schema.d.ts +206 -0
- package/dist/core/service-configuration/phone-config.schema.js +121 -0
- package/dist/core/service-configuration/phone-number.schema.d.ts +236 -0
- package/dist/core/service-configuration/phone-number.schema.js +211 -0
- package/dist/core/service-configuration/provisioning-config.d.ts +429 -0
- package/dist/core/service-configuration/provisioning-config.js +307 -0
- package/dist/core/service-configuration/support-llm.d.ts +95 -0
- package/dist/core/service-configuration/support-llm.js +76 -0
- package/dist/core/service-configuration/voice-language.schema.d.ts +200 -0
- package/dist/core/service-configuration/voice-language.schema.js +166 -0
- package/dist/core/type-definitions/account-definitions.d.ts +82 -0
- package/dist/core/type-definitions/account-definitions.js +88 -0
- package/dist/core/type-definitions/business-definitions.d.ts +394 -0
- package/dist/core/type-definitions/business-definitions.js +447 -0
- package/dist/core/type-definitions/conversation.type.definition.d.ts +223 -0
- package/dist/core/type-definitions/conversation.type.definition.js +236 -0
- package/dist/core/type-definitions/display-order.d.ts +154 -0
- package/dist/core/type-definitions/display-order.js +154 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.d.ts +165 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.js +97 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.d.ts +49 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.js +104 -0
- package/dist/core/type-definitions/dynamic-fields/index.d.ts +9 -0
- package/dist/core/type-definitions/dynamic-fields/index.js +25 -0
- package/dist/core/type-definitions/index.d.ts +10 -0
- package/dist/core/type-definitions/index.js +26 -0
- package/dist/core/type-definitions/knowledge-definitions.d.ts +30 -0
- package/dist/core/type-definitions/knowledge-definitions.js +37 -0
- package/dist/core/type-definitions/service-config.definitions.d.ts +112 -0
- package/dist/core/type-definitions/service-config.definitions.js +135 -0
- package/dist/core/validators/channel-validation.d.ts +19 -0
- package/dist/core/validators/channel-validation.js +40 -0
- package/dist/core/validators/index.d.ts +5 -0
- package/dist/core/validators/index.js +21 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -0
- package/dist/request/index.d.ts +5 -0
- package/dist/request/index.js +21 -0
- package/dist/request/models/index.d.ts +6 -0
- package/dist/request/models/index.js +22 -0
- package/dist/request/models/paginated-quest.schema.d.ts +33 -0
- package/dist/request/models/paginated-quest.schema.js +35 -0
- package/dist/request/models/paginated-result.schema.d.ts +124 -0
- package/dist/request/models/paginated-result.schema.js +94 -0
- package/package.json +43 -0
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MessageType } from "./conversation-message.schema";
|
|
3
|
+
import { ConversationDirection, ConversationStatus, ConversationSummarySentiment, ServiceConversationType } from "../type-definitions";
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Conversation configuration schema definitions.
|
|
6
|
+
*
|
|
7
|
+
* Conversations represent individual interaction sessions between users and AI agents through various channels
|
|
8
|
+
* (phone, SMS, web chat, email). They track message history, status progression, call metadata, and relationship
|
|
9
|
+
* to deployment configurations. Each conversation is scoped to a project.
|
|
10
|
+
*
|
|
11
|
+
* @module conversation/conversation-config
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Conversation summary schema.
|
|
15
|
+
*
|
|
16
|
+
* AI-generated summary capturing the essence of a conversation including key discussion points,
|
|
17
|
+
* required follow-up actions, and overall sentiment analysis. Generated post-conversation for
|
|
18
|
+
* reporting, analytics, and customer service quality assurance.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* **Architecture Context:**
|
|
22
|
+
* - **Generated By**: Post-conversation AI summarization pipeline
|
|
23
|
+
* - **Used For**: Analytics dashboards, quality assurance, and customer service reports
|
|
24
|
+
* - **Stored In**: ServiceConversationConfig.conversationSummary field (optional)
|
|
25
|
+
*
|
|
26
|
+
* @typedef {Object} ConversationSummary
|
|
27
|
+
* @property {string} summary - Concise 1-3 sentence overview of the entire conversation capturing main topics and outcomes
|
|
28
|
+
* @property {string[]} key_points - Bullet points highlighting important discussion topics, decisions made, or information exchanged during the conversation
|
|
29
|
+
* @property {string[]} action_items - Specific follow-up tasks, commitments, or next steps identified during the conversation (e.g., 'Send quote by Friday', 'Schedule follow-up call')
|
|
30
|
+
* @property {string} sentiment - Overall emotional tone and customer satisfaction level detected from the conversation (POSITIVE, NEGATIVE, NEUTRAL, MIXED)
|
|
31
|
+
*/
|
|
32
|
+
export declare const ConversationSummarySchema: z.ZodObject<{
|
|
33
|
+
summary: z.ZodString;
|
|
34
|
+
key_points: z.ZodArray<z.ZodString>;
|
|
35
|
+
action_items: z.ZodArray<z.ZodString>;
|
|
36
|
+
sentiment: z.ZodEnum<typeof ConversationSummarySentiment>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
/**
|
|
39
|
+
* Message schema for conversation messages.
|
|
40
|
+
*
|
|
41
|
+
* Lightweight message representation used within conversation configurations. Simplified version
|
|
42
|
+
* compared to the full ConversationMessageSchema for efficient storage and retrieval in conversation
|
|
43
|
+
* message arrays.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* **Architecture Context:**
|
|
47
|
+
* - **Used In**: Conversation message arrays for quick access
|
|
48
|
+
* - **Relationship**: Simplified version of full message schemas (UserChatMessage, AssistantChatMessage, etc.)
|
|
49
|
+
* - **Storage**: Embedded within conversation documents for fast message loading
|
|
50
|
+
*
|
|
51
|
+
* @typedef {Object} Message
|
|
52
|
+
* @property {string} [id] - Optional internal database ID for the message record
|
|
53
|
+
* @property {string} messageId - Unique identifier for this message used for deduplication and reference (typically UUID)
|
|
54
|
+
* @property {string} content - Text content of the message sent by user or assistant
|
|
55
|
+
* @property {string} message_type - Type of message sender indicating who sent this message (user or assistant)
|
|
56
|
+
* @property {Date} timestamp - JavaScript Date object representing when the message was created and sent
|
|
57
|
+
* @property {Object} metadata - Additional message-specific metadata including attachments, formatting, media URLs, delivery status, or channel-specific attributes
|
|
58
|
+
* @property {number} [created_at] - Unix timestamp in milliseconds when the message was created (for sorting and filtering)
|
|
59
|
+
*/
|
|
60
|
+
export declare const MessageSchema: z.ZodObject<{
|
|
61
|
+
id: z.ZodOptional<z.ZodString>;
|
|
62
|
+
messageId: z.ZodString;
|
|
63
|
+
content: z.ZodString;
|
|
64
|
+
message_type: z.ZodEnum<typeof MessageType>;
|
|
65
|
+
timestamp: z.ZodDate;
|
|
66
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
67
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type Message = z.infer<typeof MessageSchema>;
|
|
70
|
+
/**
|
|
71
|
+
* Display message schema.
|
|
72
|
+
*
|
|
73
|
+
* Simplified message format for UI display purposes, containing only the
|
|
74
|
+
* essential fields needed for rendering messages in chat interfaces.
|
|
75
|
+
*
|
|
76
|
+
* @typedef {Object} DisplayMessage
|
|
77
|
+
* @property {string} id - Unique identifier for display purposes
|
|
78
|
+
* @property {string} sender - Who sent this message (user or assistant)
|
|
79
|
+
* @property {string} content - Message content to display
|
|
80
|
+
* @property {Date} timestamp - When the message was sent
|
|
81
|
+
*/
|
|
82
|
+
export declare const DisplayMessageSchema: z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
sender: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
|
|
85
|
+
content: z.ZodString;
|
|
86
|
+
timestamp: z.ZodDate;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export type DisplayMessage = z.infer<typeof DisplayMessageSchema>;
|
|
89
|
+
/**
|
|
90
|
+
* Conversation context schema.
|
|
91
|
+
*
|
|
92
|
+
* Optional context to guide conversations, enabling deep-linking to specific
|
|
93
|
+
* products, services, or resources. Used to pre-populate conversation context
|
|
94
|
+
* when users click through from specific pages or marketing campaigns.
|
|
95
|
+
*
|
|
96
|
+
* @typedef {Object} ConversationContext
|
|
97
|
+
* @property {string} [message] - Auto-sends as the user's first message
|
|
98
|
+
* @property {string} [productId] - Deep-link to a product
|
|
99
|
+
* @property {string} [menuItemId] - Deep-link to a menu item
|
|
100
|
+
* @property {string} [serviceId] - Deep-link to a service
|
|
101
|
+
* @property {string} [propertyId] - Deep-link to a property
|
|
102
|
+
* @property {string} [resourceId] - Deep-link to a resource (rental/room)
|
|
103
|
+
* @property {string} [requiredServiceId] - Pre-select a required service
|
|
104
|
+
* @property {string} [locationId] - Context of a specific business location
|
|
105
|
+
*/
|
|
106
|
+
export declare const ConversationContextSchema: z.ZodObject<{
|
|
107
|
+
message: z.ZodOptional<z.ZodString>;
|
|
108
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
109
|
+
menuItemId: z.ZodOptional<z.ZodString>;
|
|
110
|
+
serviceId: z.ZodOptional<z.ZodString>;
|
|
111
|
+
propertyId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
113
|
+
requiredServiceId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type ConversationContext = z.infer<typeof ConversationContextSchema>;
|
|
117
|
+
/**
|
|
118
|
+
* Union of all conversation message types.
|
|
119
|
+
*
|
|
120
|
+
* Discriminated union supporting user, AI agent, human agent, and system messages
|
|
121
|
+
* for both chat and email channels.
|
|
122
|
+
*/
|
|
123
|
+
export declare const ConversationMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
124
|
+
conversation_config_id: z.ZodString;
|
|
125
|
+
message: z.ZodString;
|
|
126
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
127
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
128
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.USER>>;
|
|
129
|
+
user_message_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
130
|
+
last_assistant_message_id: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
132
|
+
conversation_config_id: z.ZodString;
|
|
133
|
+
message: z.ZodString;
|
|
134
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
135
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
136
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.AGENT>>;
|
|
137
|
+
assistant_message_id: z.ZodString;
|
|
138
|
+
last_user_message_id: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
140
|
+
conversation_config_id: z.ZodString;
|
|
141
|
+
message: z.ZodString;
|
|
142
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
143
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
144
|
+
subject: z.ZodString;
|
|
145
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
146
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.USER>>;
|
|
147
|
+
provider_message_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
148
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
149
|
+
conversation_config_id: z.ZodString;
|
|
150
|
+
message: z.ZodString;
|
|
151
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
152
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
153
|
+
subject: z.ZodString;
|
|
154
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
155
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.AGENT>>;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
conversation_config_id: z.ZodString;
|
|
158
|
+
message: z.ZodString;
|
|
159
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
160
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
161
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.HUMAN_AGENT>>;
|
|
162
|
+
agent_message_id: z.ZodString;
|
|
163
|
+
agent_session_id: z.ZodString;
|
|
164
|
+
last_user_message_id: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
conversation_config_id: z.ZodString;
|
|
167
|
+
message: z.ZodString;
|
|
168
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
169
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
170
|
+
subject: z.ZodString;
|
|
171
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
172
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.HUMAN_AGENT>>;
|
|
173
|
+
agent_session_id: z.ZodString;
|
|
174
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
175
|
+
conversation_config_id: z.ZodString;
|
|
176
|
+
message: z.ZodString;
|
|
177
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
178
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
179
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.SYSTEM>>;
|
|
180
|
+
system_message_id: z.ZodString;
|
|
181
|
+
event_type: z.ZodEnum<typeof import("./conversation-message.schema").SystemMessageEventType>;
|
|
182
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
183
|
+
}, z.core.$strip>]>;
|
|
184
|
+
/**
|
|
185
|
+
* Conversation state history schema for tracking status changes.
|
|
186
|
+
*
|
|
187
|
+
* Audit trail recording each status transition throughout a conversation's lifecycle. Enables tracking
|
|
188
|
+
* conversation progression from initiation to completion, understanding conversation flow patterns, and
|
|
189
|
+
* analyzing resolution times.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* **Architecture Context:**
|
|
193
|
+
* - **Used In**: ServiceConversationConfig.state_history array
|
|
194
|
+
* - **Purpose**: Audit trail for status transitions and conversation lifecycle tracking
|
|
195
|
+
* - **Analytics**: Used for measuring average handling time, resolution rates, and conversation flow analysis
|
|
196
|
+
*
|
|
197
|
+
* **Status Lifecycle:**
|
|
198
|
+
* - **ACTIVE**: Conversation currently in progress with ongoing message exchange
|
|
199
|
+
* - **COMPLETED**: Conversation successfully concluded with issue resolved or information provided
|
|
200
|
+
* - **FAILED**: Conversation encountered errors or technical failures
|
|
201
|
+
* - **ABANDONED**: User left conversation without resolution
|
|
202
|
+
* - **TRANSFERRED**: Call transferred to human agent
|
|
203
|
+
*
|
|
204
|
+
* @typedef {Object} ConversationStateHistory
|
|
205
|
+
* @property {string} status - The conversation status at this point in the lifecycle (ACTIVE, COMPLETED, FAILED, ABANDONED, TRANSFERRED)
|
|
206
|
+
* @property {number} timestamp - Unix timestamp in milliseconds when this status was set and recorded
|
|
207
|
+
* @property {string|null} [reason] - Optional human-readable explanation for why the status changed (e.g., 'User requested transfer', 'Timeout after 5 minutes of inactivity', 'Issue resolved')
|
|
208
|
+
* @property {Object|null} [metadata] - Additional context about the state change including triggering events, system metrics, or escalation details
|
|
209
|
+
*/
|
|
210
|
+
export declare const ConversationStateHistorySchema: z.ZodObject<{
|
|
211
|
+
status: z.ZodEnum<typeof ConversationStatus>;
|
|
212
|
+
timestamp: z.ZodNumber;
|
|
213
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
/**
|
|
217
|
+
* Base conversation configuration schema.
|
|
218
|
+
*
|
|
219
|
+
* Foundation schema for all conversation types capturing the essential attributes of an interaction session
|
|
220
|
+
* between a user and an AI agent. Conversations link to deployment configurations, track message history,
|
|
221
|
+
* monitor status progression, and collect voice processing metadata for telephony interactions.
|
|
222
|
+
*
|
|
223
|
+
* @remarks
|
|
224
|
+
* **Architecture Context:**
|
|
225
|
+
* - **Relationship to Deployments**: N:1 - Multiple conversations use one deployment configuration
|
|
226
|
+
* - **Relationship to Projects**: N:1 - Conversations are scoped to projects for organizational grouping
|
|
227
|
+
* - **Relationship to Channels**: N:1 - Multiple conversations occur through one channel
|
|
228
|
+
* - **Extended By**: ServiceConversationConfigSchema adds conversation-specific fields (id, call transfer, etc.)
|
|
229
|
+
* - **Storage**: Primary conversation record with embedded messages for performance
|
|
230
|
+
*
|
|
231
|
+
* **Conversation Types:**
|
|
232
|
+
* - **OTT_CHAT**: Over-the-top chat (web, mobile app messaging)
|
|
233
|
+
* - **TELEPHONY_CALL**: Voice phone calls with STT/TTS processing
|
|
234
|
+
* - **SMS**: Text message conversations
|
|
235
|
+
* - **EMAIL**: Email-based interactions
|
|
236
|
+
* - **WHATSAPP**: WhatsApp messaging conversations
|
|
237
|
+
*
|
|
238
|
+
* @typedef {Object} BaseConversationConfig
|
|
239
|
+
* @property {string} channel_id - ID of the deployment channel through which this conversation is conducted (references DeploymentChannel)
|
|
240
|
+
* @property {string} project_id - ID of the project this conversation is associated with for organizational grouping and access control (references Project)
|
|
241
|
+
* @property {string} deployment_config_id - ID of the deployment configuration that powers this conversation (N:1 relationship, references DeploymentConfiguration)
|
|
242
|
+
* @property {string} channel_identifier - Unique identifier for the specific communication endpoint (phone number in E.164 format, chat widget ID, email address, WhatsApp number)
|
|
243
|
+
* @property {string} [instruction_config_id] - Optional ID of the instruction configuration overriding deployment defaults for this specific conversation (references InstructionConfiguration)
|
|
244
|
+
* @property {string} [partner_user_id] - External partner or user identifier from integrated systems for cross-platform user tracking and CRM integration
|
|
245
|
+
* @property {string} conversation_type - Type of conversation defining the communication channel and interaction mode (OTT_CHAT, TELEPHONY_CALL, SMS, EMAIL, WHATSAPP)
|
|
246
|
+
* @property {string} [model_id] - AI model ID used for this conversation, may override deployment configuration model for A/B testing or specialized scenarios
|
|
247
|
+
* @property {number} [user_id] - Internal platform user ID for authenticated users, null for anonymous conversations
|
|
248
|
+
* @property {number} [created_at] - Unix timestamp in milliseconds when conversation was initiated (default: current time)
|
|
249
|
+
* @property {Array} [messages] - Array of messages exchanged in this conversation for quick access without separate queries (embedded for performance)
|
|
250
|
+
* @property {boolean} is_campaign - Flag indicating if this conversation is part of a marketing or outreach campaign (default: false for inbound conversations)
|
|
251
|
+
* @property {string} [customer_id] - Customer or contact ID from CRM or external system for customer relationship tracking and conversation history aggregation
|
|
252
|
+
* @property {string} [status] - Current operational status of the conversation (ACTIVE, COMPLETED, FAILED, ABANDONED, TRANSFERRED)
|
|
253
|
+
* @property {number} durationInSeconds - Duration of the conversation in seconds for billing, analytics, and average handling time calculations (default: 15)
|
|
254
|
+
* @property {string} [stt_model_id] - Speech-to-Text model ID used for voice conversations to transcribe user speech (e.g., 'whisper-v3', references WiilSupportModel)
|
|
255
|
+
* @property {string} [tts_model_id] - Text-to-Speech model ID used for voice conversations to synthesize agent responses (e.g., 'eleven-labs-v2', references WiilSupportModel)
|
|
256
|
+
* @property {Object} [conversationSummary] - Optional AI-generated summary of the conversation including key points, action items, and sentiment analysis (populated post-conversation)
|
|
257
|
+
* @property {string} [created_day] - The day the conversation was created in YYYY-MM-DD format for daily aggregation queries and analytics partitioning
|
|
258
|
+
* @property {Array} [state_history] - Historical audit trail of status changes throughout the conversation lifecycle for flow analysis and troubleshooting
|
|
259
|
+
* @property {number} [updated_at] - Unix timestamp in milliseconds when conversation was last modified (message added, status changed, summary generated)
|
|
260
|
+
* @property {number} [deleted_at] - Unix timestamp in milliseconds when conversation was soft-deleted, null if active (supports data retention policies)
|
|
261
|
+
*/
|
|
262
|
+
export declare const BaseConversationConfigSchema: z.ZodObject<{
|
|
263
|
+
channel_id: z.ZodString;
|
|
264
|
+
project_id: z.ZodString;
|
|
265
|
+
deployment_config_id: z.ZodString;
|
|
266
|
+
channel_identifier: z.ZodString;
|
|
267
|
+
instruction_config_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
268
|
+
partner_user_id: z.ZodOptional<z.ZodString>;
|
|
269
|
+
conversation_type: z.ZodEnum<typeof ServiceConversationType>;
|
|
270
|
+
model_id: z.ZodOptional<z.ZodString>;
|
|
271
|
+
user_id: z.ZodOptional<z.ZodNumber>;
|
|
272
|
+
created_at: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
273
|
+
messages: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
274
|
+
conversation_config_id: z.ZodString;
|
|
275
|
+
message: z.ZodString;
|
|
276
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
277
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
278
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.USER>>;
|
|
279
|
+
user_message_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
280
|
+
last_assistant_message_id: z.ZodOptional<z.ZodString>;
|
|
281
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
282
|
+
conversation_config_id: z.ZodString;
|
|
283
|
+
message: z.ZodString;
|
|
284
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
285
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
286
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.AGENT>>;
|
|
287
|
+
assistant_message_id: z.ZodString;
|
|
288
|
+
last_user_message_id: z.ZodOptional<z.ZodString>;
|
|
289
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
290
|
+
conversation_config_id: z.ZodString;
|
|
291
|
+
message: z.ZodString;
|
|
292
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
293
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
294
|
+
subject: z.ZodString;
|
|
295
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
296
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.USER>>;
|
|
297
|
+
provider_message_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
298
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
299
|
+
conversation_config_id: z.ZodString;
|
|
300
|
+
message: z.ZodString;
|
|
301
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
302
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
303
|
+
subject: z.ZodString;
|
|
304
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
305
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.AGENT>>;
|
|
306
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
307
|
+
conversation_config_id: z.ZodString;
|
|
308
|
+
message: z.ZodString;
|
|
309
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
310
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
311
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.HUMAN_AGENT>>;
|
|
312
|
+
agent_message_id: z.ZodString;
|
|
313
|
+
agent_session_id: z.ZodString;
|
|
314
|
+
last_user_message_id: z.ZodOptional<z.ZodString>;
|
|
315
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
316
|
+
conversation_config_id: z.ZodString;
|
|
317
|
+
message: z.ZodString;
|
|
318
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
319
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
320
|
+
subject: z.ZodString;
|
|
321
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
322
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.HUMAN_AGENT>>;
|
|
323
|
+
agent_session_id: z.ZodString;
|
|
324
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
325
|
+
conversation_config_id: z.ZodString;
|
|
326
|
+
message: z.ZodString;
|
|
327
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
328
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
329
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.SYSTEM>>;
|
|
330
|
+
system_message_id: z.ZodString;
|
|
331
|
+
event_type: z.ZodEnum<typeof import("./conversation-message.schema").SystemMessageEventType>;
|
|
332
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
333
|
+
}, z.core.$strip>]>>>>;
|
|
334
|
+
is_campaign: z.ZodDefault<z.ZodBoolean>;
|
|
335
|
+
customer_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
336
|
+
location_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
337
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ConversationStatus>>>;
|
|
338
|
+
durationInSeconds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
339
|
+
stt_model_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
340
|
+
tts_model_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
341
|
+
conversationSummary: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
342
|
+
summary: z.ZodString;
|
|
343
|
+
key_points: z.ZodArray<z.ZodString>;
|
|
344
|
+
action_items: z.ZodArray<z.ZodString>;
|
|
345
|
+
sentiment: z.ZodEnum<typeof ConversationSummarySentiment>;
|
|
346
|
+
}, z.core.$strip>>>;
|
|
347
|
+
created_day: z.ZodOptional<z.ZodString>;
|
|
348
|
+
state_history: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
349
|
+
status: z.ZodEnum<typeof ConversationStatus>;
|
|
350
|
+
timestamp: z.ZodNumber;
|
|
351
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
352
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
353
|
+
}, z.core.$strip>>>>;
|
|
354
|
+
updated_at: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
355
|
+
deleted_at: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
356
|
+
is_test_conversation: z.ZodDefault<z.ZodBoolean>;
|
|
357
|
+
conversation_context: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
358
|
+
message: z.ZodOptional<z.ZodString>;
|
|
359
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
360
|
+
menuItemId: z.ZodOptional<z.ZodString>;
|
|
361
|
+
serviceId: z.ZodOptional<z.ZodString>;
|
|
362
|
+
propertyId: z.ZodOptional<z.ZodString>;
|
|
363
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
364
|
+
requiredServiceId: z.ZodOptional<z.ZodString>;
|
|
365
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
366
|
+
}, z.core.$strip>>>;
|
|
367
|
+
}, z.core.$strip>;
|
|
368
|
+
/**
|
|
369
|
+
* Call transfer schema for tracking call transfer details in telephony conversations.
|
|
370
|
+
*
|
|
371
|
+
* Captures metadata about call transfers to human agents including transfer type, timing, destination,
|
|
372
|
+
* and outcome. Used for measuring transfer rates, analyzing escalation patterns, and tracking agent
|
|
373
|
+
* handoff performance in telephony deployments.
|
|
374
|
+
*
|
|
375
|
+
* @remarks
|
|
376
|
+
* **Architecture Context:**
|
|
377
|
+
* - **Used In**: ServiceConversationConfig.call_transfer field for telephony conversations
|
|
378
|
+
* - **Triggered By**: Agent detecting escalation keywords, user request, or configured transfer conditions
|
|
379
|
+
* - **References**: CallTransferConfig from agent configuration for transfer destinations
|
|
380
|
+
* - **Analytics**: Used for measuring AI containment rates and identifying improvement areas
|
|
381
|
+
*
|
|
382
|
+
* **Transfer Types:**
|
|
383
|
+
* - **blind**: Immediate unattended transfer without agent introduction (faster, no screening)
|
|
384
|
+
* - **warm**: Attended transfer where agent is briefed before caller is connected (professional, allows declining)
|
|
385
|
+
*
|
|
386
|
+
* **Transfer Lifecycle:**
|
|
387
|
+
* - **pending**: Transfer initiated, waiting for recipient to answer
|
|
388
|
+
* - **completed**: Transfer successful, caller connected to human agent
|
|
389
|
+
* - **failed**: Transfer failed due to busy line, no answer, or technical error
|
|
390
|
+
* - **returned**: Call returned to AI agent after human agent consultation
|
|
391
|
+
*/
|
|
392
|
+
export declare const CallTransferSchema: z.ZodObject<{
|
|
393
|
+
transfer_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
394
|
+
blind: "blind";
|
|
395
|
+
warm: "warm";
|
|
396
|
+
}>>>;
|
|
397
|
+
transfer_target: z.ZodString;
|
|
398
|
+
transfer_initiated_at: z.ZodOptional<z.ZodNumber>;
|
|
399
|
+
transfer_completed_at: z.ZodOptional<z.ZodNumber>;
|
|
400
|
+
transfer_status: z.ZodEnum<{
|
|
401
|
+
pending: "pending";
|
|
402
|
+
completed: "completed";
|
|
403
|
+
failed: "failed";
|
|
404
|
+
returned: "returned";
|
|
405
|
+
}>;
|
|
406
|
+
transfer_reason: z.ZodOptional<z.ZodString>;
|
|
407
|
+
}, z.core.$strip>;
|
|
408
|
+
/**
|
|
409
|
+
* Service conversation configuration schema.
|
|
410
|
+
*
|
|
411
|
+
* Complete conversation record extending base configuration with conversation-specific identifiers,
|
|
412
|
+
* provider metadata, call direction, recording URLs, and transfer details. This is the primary
|
|
413
|
+
* schema used for storing and retrieving conversation records in the system.
|
|
414
|
+
*
|
|
415
|
+
* @remarks
|
|
416
|
+
* **Architecture Context:**
|
|
417
|
+
* - **Extends**: BaseConversationConfigSchema with conversation-specific fields
|
|
418
|
+
* - **Storage**: Primary conversation entity in database with unique id
|
|
419
|
+
* - **Provider Integration**: Tracks external provider IDs for email services, telephony platforms
|
|
420
|
+
* - **Call Recordings**: resource_url links to call recording storage for compliance and quality assurance
|
|
421
|
+
*
|
|
422
|
+
* **Use Cases:**
|
|
423
|
+
* - Creating new conversations for inbound/outbound interactions
|
|
424
|
+
* - Retrieving conversation history with full message arrays
|
|
425
|
+
* - Analyzing call recordings and transfer patterns
|
|
426
|
+
* - Integrating with external email providers (Gmail, Outlook, etc.)
|
|
427
|
+
*/
|
|
428
|
+
export declare const ServiceConversationConfigSchema: z.ZodObject<{
|
|
429
|
+
channel_id: z.ZodString;
|
|
430
|
+
project_id: z.ZodString;
|
|
431
|
+
deployment_config_id: z.ZodString;
|
|
432
|
+
channel_identifier: z.ZodString;
|
|
433
|
+
instruction_config_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
434
|
+
partner_user_id: z.ZodOptional<z.ZodString>;
|
|
435
|
+
conversation_type: z.ZodEnum<typeof ServiceConversationType>;
|
|
436
|
+
model_id: z.ZodOptional<z.ZodString>;
|
|
437
|
+
user_id: z.ZodOptional<z.ZodNumber>;
|
|
438
|
+
created_at: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
439
|
+
messages: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
440
|
+
conversation_config_id: z.ZodString;
|
|
441
|
+
message: z.ZodString;
|
|
442
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
443
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
444
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.USER>>;
|
|
445
|
+
user_message_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
446
|
+
last_assistant_message_id: z.ZodOptional<z.ZodString>;
|
|
447
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
448
|
+
conversation_config_id: z.ZodString;
|
|
449
|
+
message: z.ZodString;
|
|
450
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
451
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
452
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.AGENT>>;
|
|
453
|
+
assistant_message_id: z.ZodString;
|
|
454
|
+
last_user_message_id: z.ZodOptional<z.ZodString>;
|
|
455
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
456
|
+
conversation_config_id: z.ZodString;
|
|
457
|
+
message: z.ZodString;
|
|
458
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
459
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
460
|
+
subject: z.ZodString;
|
|
461
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
462
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.USER>>;
|
|
463
|
+
provider_message_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
464
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
465
|
+
conversation_config_id: z.ZodString;
|
|
466
|
+
message: z.ZodString;
|
|
467
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
468
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
469
|
+
subject: z.ZodString;
|
|
470
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
471
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.AGENT>>;
|
|
472
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
473
|
+
conversation_config_id: z.ZodString;
|
|
474
|
+
message: z.ZodString;
|
|
475
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
476
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
477
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.HUMAN_AGENT>>;
|
|
478
|
+
agent_message_id: z.ZodString;
|
|
479
|
+
agent_session_id: z.ZodString;
|
|
480
|
+
last_user_message_id: z.ZodOptional<z.ZodString>;
|
|
481
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
482
|
+
conversation_config_id: z.ZodString;
|
|
483
|
+
message: z.ZodString;
|
|
484
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
485
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
486
|
+
subject: z.ZodString;
|
|
487
|
+
isEmail: z.ZodDefault<z.ZodLiteral<true>>;
|
|
488
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.HUMAN_AGENT>>;
|
|
489
|
+
agent_session_id: z.ZodString;
|
|
490
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
491
|
+
conversation_config_id: z.ZodString;
|
|
492
|
+
message: z.ZodString;
|
|
493
|
+
timestamp: z.ZodDefault<z.ZodNumber>;
|
|
494
|
+
llm_conversation_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
495
|
+
message_type: z.ZodDefault<z.ZodLiteral<MessageType.SYSTEM>>;
|
|
496
|
+
system_message_id: z.ZodString;
|
|
497
|
+
event_type: z.ZodEnum<typeof import("./conversation-message.schema").SystemMessageEventType>;
|
|
498
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
499
|
+
}, z.core.$strip>]>>>>;
|
|
500
|
+
is_campaign: z.ZodDefault<z.ZodBoolean>;
|
|
501
|
+
customer_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
502
|
+
location_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
503
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ConversationStatus>>>;
|
|
504
|
+
durationInSeconds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
505
|
+
stt_model_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
506
|
+
tts_model_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
507
|
+
conversationSummary: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
508
|
+
summary: z.ZodString;
|
|
509
|
+
key_points: z.ZodArray<z.ZodString>;
|
|
510
|
+
action_items: z.ZodArray<z.ZodString>;
|
|
511
|
+
sentiment: z.ZodEnum<typeof ConversationSummarySentiment>;
|
|
512
|
+
}, z.core.$strip>>>;
|
|
513
|
+
created_day: z.ZodOptional<z.ZodString>;
|
|
514
|
+
state_history: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
515
|
+
status: z.ZodEnum<typeof ConversationStatus>;
|
|
516
|
+
timestamp: z.ZodNumber;
|
|
517
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
518
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
519
|
+
}, z.core.$strip>>>>;
|
|
520
|
+
updated_at: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
521
|
+
deleted_at: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
522
|
+
is_test_conversation: z.ZodDefault<z.ZodBoolean>;
|
|
523
|
+
conversation_context: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
524
|
+
message: z.ZodOptional<z.ZodString>;
|
|
525
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
526
|
+
menuItemId: z.ZodOptional<z.ZodString>;
|
|
527
|
+
serviceId: z.ZodOptional<z.ZodString>;
|
|
528
|
+
propertyId: z.ZodOptional<z.ZodString>;
|
|
529
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
530
|
+
requiredServiceId: z.ZodOptional<z.ZodString>;
|
|
531
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
532
|
+
}, z.core.$strip>>>;
|
|
533
|
+
id: z.ZodString;
|
|
534
|
+
record_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
535
|
+
provider_message_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
536
|
+
direction: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ConversationDirection>>>;
|
|
537
|
+
resource_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
538
|
+
call_transfer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
539
|
+
transfer_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
540
|
+
blind: "blind";
|
|
541
|
+
warm: "warm";
|
|
542
|
+
}>>>;
|
|
543
|
+
transfer_target: z.ZodString;
|
|
544
|
+
transfer_initiated_at: z.ZodOptional<z.ZodNumber>;
|
|
545
|
+
transfer_completed_at: z.ZodOptional<z.ZodNumber>;
|
|
546
|
+
transfer_status: z.ZodEnum<{
|
|
547
|
+
pending: "pending";
|
|
548
|
+
completed: "completed";
|
|
549
|
+
failed: "failed";
|
|
550
|
+
returned: "returned";
|
|
551
|
+
}>;
|
|
552
|
+
transfer_reason: z.ZodOptional<z.ZodString>;
|
|
553
|
+
}, z.core.$strip>>>;
|
|
554
|
+
}, z.core.$strip>;
|
|
555
|
+
/**
|
|
556
|
+
* Test configuration schema.
|
|
557
|
+
* Base configuration for testing AI agents.
|
|
558
|
+
*/
|
|
559
|
+
export declare const TestConfigSchema: z.ZodObject<{
|
|
560
|
+
account_id: z.ZodString;
|
|
561
|
+
project_id: z.ZodString;
|
|
562
|
+
agent_id: z.ZodString;
|
|
563
|
+
instruction_config_id: z.ZodString;
|
|
564
|
+
}, z.core.$strip>;
|
|
565
|
+
/**
|
|
566
|
+
* Evaluation schema for running AI agent evaluations.
|
|
567
|
+
*/
|
|
568
|
+
export declare const EvaluationSchema: z.ZodObject<{
|
|
569
|
+
instructionId: z.ZodString;
|
|
570
|
+
agentId: z.ZodString;
|
|
571
|
+
evaluationConfigId: z.ZodString;
|
|
572
|
+
speechConfig: z.ZodNullable<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
|
|
573
|
+
}, z.core.$strip>;
|
|
574
|
+
/**
|
|
575
|
+
* OTT conversation configuration schema.
|
|
576
|
+
* Configuration for OTT (over-the-top) chat widget connections.
|
|
577
|
+
*/
|
|
578
|
+
export declare const ConversationConfigSchema: z.ZodObject<{
|
|
579
|
+
platform_user_id: z.ZodOptional<z.ZodNumber>;
|
|
580
|
+
channel_identifier: z.ZodString;
|
|
581
|
+
partner_user_id: z.ZodOptional<z.ZodString>;
|
|
582
|
+
}, z.core.$strip>;
|
|
583
|
+
/**
|
|
584
|
+
* OTT conversation configuration with connection details.
|
|
585
|
+
*/
|
|
586
|
+
export declare const OttConversationConfigSchema: z.ZodObject<{
|
|
587
|
+
platform_user_id: z.ZodOptional<z.ZodNumber>;
|
|
588
|
+
channel_identifier: z.ZodString;
|
|
589
|
+
partner_user_id: z.ZodOptional<z.ZodString>;
|
|
590
|
+
sdrtn_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
591
|
+
channel_token: z.ZodString;
|
|
592
|
+
connection_url: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
593
|
+
}, z.core.$strip>;
|
|
594
|
+
export type ConversationSummary = z.infer<typeof ConversationSummarySchema>;
|
|
595
|
+
export type ServiceConversationConfigType = z.infer<typeof ServiceConversationConfigSchema>;
|
|
596
|
+
export type CallTransfer = z.infer<typeof CallTransferSchema>;
|
|
597
|
+
export type ConversationStateHistory = z.infer<typeof ConversationStateHistorySchema>;
|
|
598
|
+
/**
|
|
599
|
+
* Conversation filter options.
|
|
600
|
+
* @interface ConversationFilters
|
|
601
|
+
*/
|
|
602
|
+
export interface ConversationFilters {
|
|
603
|
+
/** Text search across conversation content */
|
|
604
|
+
search?: string;
|
|
605
|
+
/** Filter by conversation type(s) */
|
|
606
|
+
conversationType?: ServiceConversationType[];
|
|
607
|
+
/** Filter by channel ID */
|
|
608
|
+
channelId?: string;
|
|
609
|
+
/** Filter by location ID */
|
|
610
|
+
locationId?: string;
|
|
611
|
+
/** Filter by customer ID */
|
|
612
|
+
customerId?: string;
|
|
613
|
+
/** Filter by presence of messages */
|
|
614
|
+
hasMessages?: boolean;
|
|
615
|
+
/** Filter by date range */
|
|
616
|
+
dateRange?: {
|
|
617
|
+
start?: Date;
|
|
618
|
+
end?: Date;
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Conversation sorting options.
|
|
623
|
+
* @interface ConversationSorting
|
|
624
|
+
*/
|
|
625
|
+
export interface ConversationSorting {
|
|
626
|
+
/** Field to sort by */
|
|
627
|
+
field: 'created_at' | 'customer_id';
|
|
628
|
+
/** Sort direction */
|
|
629
|
+
direction: 'asc' | 'desc';
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Conversation query options.
|
|
633
|
+
* @interface ConversationQueryOptions
|
|
634
|
+
*/
|
|
635
|
+
export interface ConversationQueryOptions {
|
|
636
|
+
/** Page number (1-indexed) */
|
|
637
|
+
page: number;
|
|
638
|
+
/** Items per page */
|
|
639
|
+
pageSize: number;
|
|
640
|
+
/** Optional filters */
|
|
641
|
+
filters?: ConversationFilters;
|
|
642
|
+
/** Optional sorting */
|
|
643
|
+
sorting?: ConversationSorting;
|
|
644
|
+
}
|