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,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OttConversationConfigSchema = exports.ConversationConfigSchema = exports.EvaluationSchema = exports.TestConfigSchema = exports.ServiceConversationConfigSchema = exports.CallTransferSchema = exports.BaseConversationConfigSchema = exports.ConversationStateHistorySchema = exports.ConversationMessageSchema = exports.ConversationContextSchema = exports.DisplayMessageSchema = exports.MessageSchema = exports.ConversationSummarySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const conversation_message_schema_1 = require("./conversation-message.schema");
|
|
6
|
+
const type_definitions_1 = require("../type-definitions");
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Conversation configuration schema definitions.
|
|
9
|
+
*
|
|
10
|
+
* Conversations represent individual interaction sessions between users and AI agents through various channels
|
|
11
|
+
* (phone, SMS, web chat, email). They track message history, status progression, call metadata, and relationship
|
|
12
|
+
* to deployment configurations. Each conversation is scoped to a project.
|
|
13
|
+
*
|
|
14
|
+
* @module conversation/conversation-config
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Conversation summary schema.
|
|
18
|
+
*
|
|
19
|
+
* AI-generated summary capturing the essence of a conversation including key discussion points,
|
|
20
|
+
* required follow-up actions, and overall sentiment analysis. Generated post-conversation for
|
|
21
|
+
* reporting, analytics, and customer service quality assurance.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* **Architecture Context:**
|
|
25
|
+
* - **Generated By**: Post-conversation AI summarization pipeline
|
|
26
|
+
* - **Used For**: Analytics dashboards, quality assurance, and customer service reports
|
|
27
|
+
* - **Stored In**: ServiceConversationConfig.conversationSummary field (optional)
|
|
28
|
+
*
|
|
29
|
+
* @typedef {Object} ConversationSummary
|
|
30
|
+
* @property {string} summary - Concise 1-3 sentence overview of the entire conversation capturing main topics and outcomes
|
|
31
|
+
* @property {string[]} key_points - Bullet points highlighting important discussion topics, decisions made, or information exchanged during the conversation
|
|
32
|
+
* @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')
|
|
33
|
+
* @property {string} sentiment - Overall emotional tone and customer satisfaction level detected from the conversation (POSITIVE, NEGATIVE, NEUTRAL, MIXED)
|
|
34
|
+
*/
|
|
35
|
+
exports.ConversationSummarySchema = zod_1.z.object({
|
|
36
|
+
summary: zod_1.z.string().describe("Concise 1-3 sentence overview of the entire conversation capturing the main topics discussed, issues addressed, and final outcomes"),
|
|
37
|
+
key_points: zod_1.z.array(zod_1.z.string()).describe("Array of bullet points highlighting important discussion topics, decisions made, information exchanged, or concerns raised during the conversation"),
|
|
38
|
+
action_items: zod_1.z.array(zod_1.z.string()).describe("Array of specific follow-up tasks, commitments, or next steps identified during the conversation (e.g., 'Send pricing quote by Friday', 'Schedule technical support callback', 'Update account information')"),
|
|
39
|
+
sentiment: zod_1.z.enum(type_definitions_1.ConversationSummarySentiment).describe("Overall emotional tone and customer satisfaction level detected from the conversation analysis (POSITIVE: satisfied/happy, NEGATIVE: frustrated/upset, NEUTRAL: informational, MIXED: varying emotions)")
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Message schema for conversation messages.
|
|
43
|
+
*
|
|
44
|
+
* Lightweight message representation used within conversation configurations. Simplified version
|
|
45
|
+
* compared to the full ConversationMessageSchema for efficient storage and retrieval in conversation
|
|
46
|
+
* message arrays.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* **Architecture Context:**
|
|
50
|
+
* - **Used In**: Conversation message arrays for quick access
|
|
51
|
+
* - **Relationship**: Simplified version of full message schemas (UserChatMessage, AssistantChatMessage, etc.)
|
|
52
|
+
* - **Storage**: Embedded within conversation documents for fast message loading
|
|
53
|
+
*
|
|
54
|
+
* @typedef {Object} Message
|
|
55
|
+
* @property {string} [id] - Optional internal database ID for the message record
|
|
56
|
+
* @property {string} messageId - Unique identifier for this message used for deduplication and reference (typically UUID)
|
|
57
|
+
* @property {string} content - Text content of the message sent by user or assistant
|
|
58
|
+
* @property {string} message_type - Type of message sender indicating who sent this message (user or assistant)
|
|
59
|
+
* @property {Date} timestamp - JavaScript Date object representing when the message was created and sent
|
|
60
|
+
* @property {Object} metadata - Additional message-specific metadata including attachments, formatting, media URLs, delivery status, or channel-specific attributes
|
|
61
|
+
* @property {number} [created_at] - Unix timestamp in milliseconds when the message was created (for sorting and filtering)
|
|
62
|
+
*/
|
|
63
|
+
exports.MessageSchema = zod_1.z.object({
|
|
64
|
+
id: zod_1.z.string().optional().describe("Optional internal database ID for the message record, auto-generated by the storage system"),
|
|
65
|
+
messageId: zod_1.z.string().describe("Unique identifier for this message used for deduplication, reference tracking, and message threading (typically UUID format)"),
|
|
66
|
+
content: zod_1.z.string().describe("Text content of the message sent by the user or assistant, may include plain text or formatted content depending on channel capabilities"),
|
|
67
|
+
message_type: zod_1.z.enum(conversation_message_schema_1.MessageType).describe("Type of message sender indicating who sent this message: 'user' for customer messages, 'assistant' for AI agent responses"),
|
|
68
|
+
timestamp: zod_1.z.date().describe("JavaScript Date object representing the exact time when the message was created and sent in the conversation"),
|
|
69
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).describe("Additional message-specific metadata as key-value pairs including attachments, formatting, media URLs, delivery status, read receipts, or channel-specific attributes"),
|
|
70
|
+
created_at: zod_1.z.number().optional().describe("Unix timestamp in milliseconds when the message was created, used for chronological sorting and time-based filtering in queries")
|
|
71
|
+
});
|
|
72
|
+
// ============================================================================
|
|
73
|
+
// DISPLAY MESSAGE SCHEMA
|
|
74
|
+
// ============================================================================
|
|
75
|
+
/**
|
|
76
|
+
* Display message schema.
|
|
77
|
+
*
|
|
78
|
+
* Simplified message format for UI display purposes, containing only the
|
|
79
|
+
* essential fields needed for rendering messages in chat interfaces.
|
|
80
|
+
*
|
|
81
|
+
* @typedef {Object} DisplayMessage
|
|
82
|
+
* @property {string} id - Unique identifier for display purposes
|
|
83
|
+
* @property {string} sender - Who sent this message (user or assistant)
|
|
84
|
+
* @property {string} content - Message content to display
|
|
85
|
+
* @property {Date} timestamp - When the message was sent
|
|
86
|
+
*/
|
|
87
|
+
exports.DisplayMessageSchema = zod_1.z.object({
|
|
88
|
+
id: zod_1.z.string().describe("Unique identifier for display purposes"),
|
|
89
|
+
sender: zod_1.z.union([
|
|
90
|
+
zod_1.z.literal('user'),
|
|
91
|
+
zod_1.z.literal('assistant')
|
|
92
|
+
]).describe("Who sent this message - user or AI assistant"),
|
|
93
|
+
content: zod_1.z.string().describe("Message content to display to users"),
|
|
94
|
+
timestamp: zod_1.z.date().describe("When the message was sent")
|
|
95
|
+
});
|
|
96
|
+
// ============================================================================
|
|
97
|
+
// CONVERSATION CONTEXT SCHEMA
|
|
98
|
+
// ============================================================================
|
|
99
|
+
/**
|
|
100
|
+
* Conversation context schema.
|
|
101
|
+
*
|
|
102
|
+
* Optional context to guide conversations, enabling deep-linking to specific
|
|
103
|
+
* products, services, or resources. Used to pre-populate conversation context
|
|
104
|
+
* when users click through from specific pages or marketing campaigns.
|
|
105
|
+
*
|
|
106
|
+
* @typedef {Object} ConversationContext
|
|
107
|
+
* @property {string} [message] - Auto-sends as the user's first message
|
|
108
|
+
* @property {string} [productId] - Deep-link to a product
|
|
109
|
+
* @property {string} [menuItemId] - Deep-link to a menu item
|
|
110
|
+
* @property {string} [serviceId] - Deep-link to a service
|
|
111
|
+
* @property {string} [propertyId] - Deep-link to a property
|
|
112
|
+
* @property {string} [resourceId] - Deep-link to a resource (rental/room)
|
|
113
|
+
* @property {string} [requiredServiceId] - Pre-select a required service
|
|
114
|
+
* @property {string} [locationId] - Context of a specific business location
|
|
115
|
+
*/
|
|
116
|
+
exports.ConversationContextSchema = zod_1.z.object({
|
|
117
|
+
message: zod_1.z.string().optional().describe("Auto-sends as the user's first message when conversation starts"),
|
|
118
|
+
productId: zod_1.z.string().optional().describe("Deep-link to a specific product for product inquiries"),
|
|
119
|
+
menuItemId: zod_1.z.string().optional().describe("Deep-link to a specific menu item for food/beverage inquiries"),
|
|
120
|
+
serviceId: zod_1.z.string().optional().describe("Deep-link to a specific service for service booking"),
|
|
121
|
+
propertyId: zod_1.z.string().optional().describe("Deep-link to a specific property for real estate inquiries"),
|
|
122
|
+
resourceId: zod_1.z.string().optional().describe("Deep-link to a specific resource (rental item, room) for reservations"),
|
|
123
|
+
requiredServiceId: zod_1.z.string().optional().describe("Pre-select a required service for the conversation"),
|
|
124
|
+
locationId: zod_1.z.string().optional().describe("Context of a specific business location for multi-location businesses"),
|
|
125
|
+
});
|
|
126
|
+
// ============================================================================
|
|
127
|
+
// CONVERSATION MESSAGE UNION
|
|
128
|
+
// ============================================================================
|
|
129
|
+
/**
|
|
130
|
+
* Union of all conversation message types.
|
|
131
|
+
*
|
|
132
|
+
* Discriminated union supporting user, AI agent, human agent, and system messages
|
|
133
|
+
* for both chat and email channels.
|
|
134
|
+
*/
|
|
135
|
+
exports.ConversationMessageSchema = zod_1.z.union([
|
|
136
|
+
conversation_message_schema_1.UserChatMessageSchema,
|
|
137
|
+
conversation_message_schema_1.AssistantChatMessageSchema,
|
|
138
|
+
conversation_message_schema_1.UserEmailMessageSchema,
|
|
139
|
+
conversation_message_schema_1.AssistantEmailMessageSchema,
|
|
140
|
+
conversation_message_schema_1.HumanAgentChatMessageSchema,
|
|
141
|
+
conversation_message_schema_1.HumanAgentEmailMessageSchema,
|
|
142
|
+
conversation_message_schema_1.SystemMessageSchema,
|
|
143
|
+
]);
|
|
144
|
+
/**
|
|
145
|
+
* Conversation state history schema for tracking status changes.
|
|
146
|
+
*
|
|
147
|
+
* Audit trail recording each status transition throughout a conversation's lifecycle. Enables tracking
|
|
148
|
+
* conversation progression from initiation to completion, understanding conversation flow patterns, and
|
|
149
|
+
* analyzing resolution times.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* **Architecture Context:**
|
|
153
|
+
* - **Used In**: ServiceConversationConfig.state_history array
|
|
154
|
+
* - **Purpose**: Audit trail for status transitions and conversation lifecycle tracking
|
|
155
|
+
* - **Analytics**: Used for measuring average handling time, resolution rates, and conversation flow analysis
|
|
156
|
+
*
|
|
157
|
+
* **Status Lifecycle:**
|
|
158
|
+
* - **ACTIVE**: Conversation currently in progress with ongoing message exchange
|
|
159
|
+
* - **COMPLETED**: Conversation successfully concluded with issue resolved or information provided
|
|
160
|
+
* - **FAILED**: Conversation encountered errors or technical failures
|
|
161
|
+
* - **ABANDONED**: User left conversation without resolution
|
|
162
|
+
* - **TRANSFERRED**: Call transferred to human agent
|
|
163
|
+
*
|
|
164
|
+
* @typedef {Object} ConversationStateHistory
|
|
165
|
+
* @property {string} status - The conversation status at this point in the lifecycle (ACTIVE, COMPLETED, FAILED, ABANDONED, TRANSFERRED)
|
|
166
|
+
* @property {number} timestamp - Unix timestamp in milliseconds when this status was set and recorded
|
|
167
|
+
* @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')
|
|
168
|
+
* @property {Object|null} [metadata] - Additional context about the state change including triggering events, system metrics, or escalation details
|
|
169
|
+
*/
|
|
170
|
+
exports.ConversationStateHistorySchema = zod_1.z.object({
|
|
171
|
+
status: zod_1.z.enum(type_definitions_1.ConversationStatus).describe("The conversation status at this point in the lifecycle (ACTIVE: in progress, COMPLETED: successfully concluded, FAILED: encountered errors, ABANDONED: user left, TRANSFERRED: escalated to human)"),
|
|
172
|
+
timestamp: zod_1.z.number().describe("Unix timestamp in milliseconds when this status was set and recorded in the conversation history"),
|
|
173
|
+
reason: zod_1.z.string().nullable().optional().describe("Optional human-readable explanation for why the status changed (e.g., 'User requested transfer to billing', 'Timeout after 5 minutes of inactivity', 'Issue successfully resolved')"),
|
|
174
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable()
|
|
175
|
+
.optional().describe("Additional context about the state change as key-value pairs including triggering events, system metrics, agent performance data, or escalation/transfer details")
|
|
176
|
+
});
|
|
177
|
+
/**
|
|
178
|
+
* Base conversation configuration schema.
|
|
179
|
+
*
|
|
180
|
+
* Foundation schema for all conversation types capturing the essential attributes of an interaction session
|
|
181
|
+
* between a user and an AI agent. Conversations link to deployment configurations, track message history,
|
|
182
|
+
* monitor status progression, and collect voice processing metadata for telephony interactions.
|
|
183
|
+
*
|
|
184
|
+
* @remarks
|
|
185
|
+
* **Architecture Context:**
|
|
186
|
+
* - **Relationship to Deployments**: N:1 - Multiple conversations use one deployment configuration
|
|
187
|
+
* - **Relationship to Projects**: N:1 - Conversations are scoped to projects for organizational grouping
|
|
188
|
+
* - **Relationship to Channels**: N:1 - Multiple conversations occur through one channel
|
|
189
|
+
* - **Extended By**: ServiceConversationConfigSchema adds conversation-specific fields (id, call transfer, etc.)
|
|
190
|
+
* - **Storage**: Primary conversation record with embedded messages for performance
|
|
191
|
+
*
|
|
192
|
+
* **Conversation Types:**
|
|
193
|
+
* - **OTT_CHAT**: Over-the-top chat (web, mobile app messaging)
|
|
194
|
+
* - **TELEPHONY_CALL**: Voice phone calls with STT/TTS processing
|
|
195
|
+
* - **SMS**: Text message conversations
|
|
196
|
+
* - **EMAIL**: Email-based interactions
|
|
197
|
+
* - **WHATSAPP**: WhatsApp messaging conversations
|
|
198
|
+
*
|
|
199
|
+
* @typedef {Object} BaseConversationConfig
|
|
200
|
+
* @property {string} channel_id - ID of the deployment channel through which this conversation is conducted (references DeploymentChannel)
|
|
201
|
+
* @property {string} project_id - ID of the project this conversation is associated with for organizational grouping and access control (references Project)
|
|
202
|
+
* @property {string} deployment_config_id - ID of the deployment configuration that powers this conversation (N:1 relationship, references DeploymentConfiguration)
|
|
203
|
+
* @property {string} channel_identifier - Unique identifier for the specific communication endpoint (phone number in E.164 format, chat widget ID, email address, WhatsApp number)
|
|
204
|
+
* @property {string} [instruction_config_id] - Optional ID of the instruction configuration overriding deployment defaults for this specific conversation (references InstructionConfiguration)
|
|
205
|
+
* @property {string} [partner_user_id] - External partner or user identifier from integrated systems for cross-platform user tracking and CRM integration
|
|
206
|
+
* @property {string} conversation_type - Type of conversation defining the communication channel and interaction mode (OTT_CHAT, TELEPHONY_CALL, SMS, EMAIL, WHATSAPP)
|
|
207
|
+
* @property {string} [model_id] - AI model ID used for this conversation, may override deployment configuration model for A/B testing or specialized scenarios
|
|
208
|
+
* @property {number} [user_id] - Internal platform user ID for authenticated users, null for anonymous conversations
|
|
209
|
+
* @property {number} [created_at] - Unix timestamp in milliseconds when conversation was initiated (default: current time)
|
|
210
|
+
* @property {Array} [messages] - Array of messages exchanged in this conversation for quick access without separate queries (embedded for performance)
|
|
211
|
+
* @property {boolean} is_campaign - Flag indicating if this conversation is part of a marketing or outreach campaign (default: false for inbound conversations)
|
|
212
|
+
* @property {string} [customer_id] - Customer or contact ID from CRM or external system for customer relationship tracking and conversation history aggregation
|
|
213
|
+
* @property {string} [status] - Current operational status of the conversation (ACTIVE, COMPLETED, FAILED, ABANDONED, TRANSFERRED)
|
|
214
|
+
* @property {number} durationInSeconds - Duration of the conversation in seconds for billing, analytics, and average handling time calculations (default: 15)
|
|
215
|
+
* @property {string} [stt_model_id] - Speech-to-Text model ID used for voice conversations to transcribe user speech (e.g., 'whisper-v3', references WiilSupportModel)
|
|
216
|
+
* @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)
|
|
217
|
+
* @property {Object} [conversationSummary] - Optional AI-generated summary of the conversation including key points, action items, and sentiment analysis (populated post-conversation)
|
|
218
|
+
* @property {string} [created_day] - The day the conversation was created in YYYY-MM-DD format for daily aggregation queries and analytics partitioning
|
|
219
|
+
* @property {Array} [state_history] - Historical audit trail of status changes throughout the conversation lifecycle for flow analysis and troubleshooting
|
|
220
|
+
* @property {number} [updated_at] - Unix timestamp in milliseconds when conversation was last modified (message added, status changed, summary generated)
|
|
221
|
+
* @property {number} [deleted_at] - Unix timestamp in milliseconds when conversation was soft-deleted, null if active (supports data retention policies)
|
|
222
|
+
*/
|
|
223
|
+
exports.BaseConversationConfigSchema = zod_1.z.object({
|
|
224
|
+
channel_id: zod_1.z.string().describe("ID of the deployment channel through which this conversation is conducted (references DeploymentChannel for phone, SMS, web, or email configuration)"),
|
|
225
|
+
project_id: zod_1.z.string().describe("ID of the project this conversation is associated with for organizational grouping, reporting, and access control (N:1 relationship with Project)"),
|
|
226
|
+
deployment_config_id: zod_1.z.string().describe("ID of the deployment configuration that powers this conversation including agent, instruction, and channel settings (N:1 relationship with DeploymentConfiguration)"),
|
|
227
|
+
channel_identifier: zod_1.z.string().describe("Unique identifier for the specific communication endpoint: phone number in E.164 format (+12125551234), chat widget ID, email address, or WhatsApp number"),
|
|
228
|
+
instruction_config_id: zod_1.z.string().optional().nullable().describe("Optional ID of the instruction configuration overriding deployment defaults for conversation-specific behavior or A/B testing (references InstructionConfiguration)"),
|
|
229
|
+
partner_user_id: zod_1.z.string().optional().describe("External partner or user identifier from integrated systems (CRM, help desk, e-commerce) for cross-platform user tracking and unified customer view"),
|
|
230
|
+
conversation_type: zod_1.z.enum(type_definitions_1.ServiceConversationType).describe("Type of conversation defining the communication channel and interaction mode (OTT_CHAT: web/mobile chat, TELEPHONY_CALL: voice, SMS: text, EMAIL: email, WHATSAPP: WhatsApp)"),
|
|
231
|
+
model_id: zod_1.z.string().optional().describe("AI model ID used for this conversation, may override deployment configuration model for A/B testing, specialized scenarios, or model version upgrades (references WiilSupportModel)"),
|
|
232
|
+
user_id: zod_1.z.number().optional().describe("Internal platform user ID for authenticated users enabling personalized conversations and user-specific history, null for anonymous or guest interactions"),
|
|
233
|
+
created_at: zod_1.z.number().optional().default(Date.now).describe("Unix timestamp in milliseconds when conversation was initiated by user or outbound campaign (default: current time, used for chronological sorting)"),
|
|
234
|
+
messages: zod_1.z.array(exports.ConversationMessageSchema).optional().nullable().describe("Array of messages exchanged in this conversation embedded for quick access without separate database queries (includes user and assistant messages with metadata)"),
|
|
235
|
+
is_campaign: zod_1.z.boolean().default(false).describe("Flag indicating if this conversation is part of a marketing or outbound campaign (true) or an inbound customer-initiated interaction (false, default)"),
|
|
236
|
+
customer_id: zod_1.z.string().optional().nullable().describe("Customer or contact ID from CRM or external system for customer relationship tracking, conversation history aggregation, and personalization"),
|
|
237
|
+
location_id: zod_1.z.string().optional().nullable().describe("Business location ID associated with this conversation for multi-location businesses, enables location-specific analytics and routing"),
|
|
238
|
+
status: zod_1.z.enum(type_definitions_1.ConversationStatus).nullable().optional().describe("Current operational status of the conversation (ACTIVE: ongoing, COMPLETED: concluded successfully, FAILED: errors, ABANDONED: user left, TRANSFERRED: escalated to human)"),
|
|
239
|
+
durationInSeconds: zod_1.z.number().nonnegative().optional().default(15).describe("Duration of the conversation in seconds for billing calculations, analytics reporting, and average handling time (AHT) metrics (default: 15 for minimum billing)"),
|
|
240
|
+
stt_model_id: zod_1.z.string().optional().nullable().describe("Speech-to-Text model ID used for voice conversations to transcribe user speech into text (e.g., 'whisper-v3', 'google-stt-enhanced', references WiilSupportModel)"),
|
|
241
|
+
tts_model_id: zod_1.z.string().optional().nullable().describe("Text-to-Speech model ID used for voice conversations to synthesize agent text responses into natural speech (e.g., 'eleven-labs-v2', 'azure-neural-tts', references WiilSupportModel)"),
|
|
242
|
+
conversationSummary: exports.ConversationSummarySchema.nullable().optional().describe("Optional AI-generated summary of the conversation including key discussion points, action items, and sentiment analysis (populated post-conversation for reporting and QA)"),
|
|
243
|
+
created_day: zod_1.z.string().optional().describe("The day the conversation was created in YYYY-MM-DD ISO format for efficient daily aggregation queries, analytics partitioning, and time-series reporting"),
|
|
244
|
+
state_history: zod_1.z.array(exports.ConversationStateHistorySchema).nullable().optional().describe("Historical audit trail of status changes throughout the conversation lifecycle for flow analysis, troubleshooting, and measuring time-to-resolution"),
|
|
245
|
+
updated_at: zod_1.z.number().optional().nullable().describe("Unix timestamp in milliseconds when conversation was last modified (message added, status changed, summary generated, metadata updated) for change tracking"),
|
|
246
|
+
deleted_at: zod_1.z.number().optional().nullable().describe("Unix timestamp in milliseconds when conversation was soft-deleted for data retention compliance, null if active (enables GDPR right-to-be-forgotten while preserving analytics)"),
|
|
247
|
+
is_test_conversation: zod_1.z.boolean().default(false).describe("Flag indicating if this conversation is for testing purposes (true) or a real customer interaction (false, default)"),
|
|
248
|
+
conversation_context: exports.ConversationContextSchema.optional().nullable().describe("Optional context to guide the conversation including deep-links to products, services, or resources"),
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* Call transfer schema for tracking call transfer details in telephony conversations.
|
|
252
|
+
*
|
|
253
|
+
* Captures metadata about call transfers to human agents including transfer type, timing, destination,
|
|
254
|
+
* and outcome. Used for measuring transfer rates, analyzing escalation patterns, and tracking agent
|
|
255
|
+
* handoff performance in telephony deployments.
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* **Architecture Context:**
|
|
259
|
+
* - **Used In**: ServiceConversationConfig.call_transfer field for telephony conversations
|
|
260
|
+
* - **Triggered By**: Agent detecting escalation keywords, user request, or configured transfer conditions
|
|
261
|
+
* - **References**: CallTransferConfig from agent configuration for transfer destinations
|
|
262
|
+
* - **Analytics**: Used for measuring AI containment rates and identifying improvement areas
|
|
263
|
+
*
|
|
264
|
+
* **Transfer Types:**
|
|
265
|
+
* - **blind**: Immediate unattended transfer without agent introduction (faster, no screening)
|
|
266
|
+
* - **warm**: Attended transfer where agent is briefed before caller is connected (professional, allows declining)
|
|
267
|
+
*
|
|
268
|
+
* **Transfer Lifecycle:**
|
|
269
|
+
* - **pending**: Transfer initiated, waiting for recipient to answer
|
|
270
|
+
* - **completed**: Transfer successful, caller connected to human agent
|
|
271
|
+
* - **failed**: Transfer failed due to busy line, no answer, or technical error
|
|
272
|
+
* - **returned**: Call returned to AI agent after human agent consultation
|
|
273
|
+
*/
|
|
274
|
+
exports.CallTransferSchema = zod_1.z.object({
|
|
275
|
+
transfer_type: zod_1.z.enum(['blind', 'warm']).nullable().optional().describe("Type of call transfer: 'blind' for immediate unattended transfer without introduction (faster), 'warm' for attended transfer with agent briefing before connection (professional, allows screening)"),
|
|
276
|
+
transfer_target: zod_1.z.string().describe("Target phone number for the call transfer in E.164 format (e.g., '+12125551234') or internal extension identifier, must match CallTransferConfig.transfer_number"),
|
|
277
|
+
transfer_initiated_at: zod_1.z.number().optional().describe("Unix timestamp in milliseconds when the transfer was initiated by the AI agent, used for measuring time-to-transfer and transfer latency"),
|
|
278
|
+
transfer_completed_at: zod_1.z.number().optional().describe("Unix timestamp in milliseconds when the transfer was successfully completed with caller connected to human agent, used for calculating transfer duration"),
|
|
279
|
+
transfer_status: zod_1.z.enum(['pending', 'completed', 'failed', 'returned']).describe("Current status of the call transfer (pending: initiated awaiting answer, completed: successful connection, failed: no answer/busy/error, returned: call returned to AI after consultation)"),
|
|
280
|
+
transfer_reason: zod_1.z.string().optional().describe("Reason for the transfer as extracted from the conversation context (e.g., 'Billing inquiry requiring account access', 'Customer requested human agent', 'Technical issue beyond AI scope')")
|
|
281
|
+
});
|
|
282
|
+
/**
|
|
283
|
+
* Service conversation configuration schema.
|
|
284
|
+
*
|
|
285
|
+
* Complete conversation record extending base configuration with conversation-specific identifiers,
|
|
286
|
+
* provider metadata, call direction, recording URLs, and transfer details. This is the primary
|
|
287
|
+
* schema used for storing and retrieving conversation records in the system.
|
|
288
|
+
*
|
|
289
|
+
* @remarks
|
|
290
|
+
* **Architecture Context:**
|
|
291
|
+
* - **Extends**: BaseConversationConfigSchema with conversation-specific fields
|
|
292
|
+
* - **Storage**: Primary conversation entity in database with unique id
|
|
293
|
+
* - **Provider Integration**: Tracks external provider IDs for email services, telephony platforms
|
|
294
|
+
* - **Call Recordings**: resource_url links to call recording storage for compliance and quality assurance
|
|
295
|
+
*
|
|
296
|
+
* **Use Cases:**
|
|
297
|
+
* - Creating new conversations for inbound/outbound interactions
|
|
298
|
+
* - Retrieving conversation history with full message arrays
|
|
299
|
+
* - Analyzing call recordings and transfer patterns
|
|
300
|
+
* - Integrating with external email providers (Gmail, Outlook, etc.)
|
|
301
|
+
*/
|
|
302
|
+
exports.ServiceConversationConfigSchema = exports.BaseConversationConfigSchema.safeExtend({
|
|
303
|
+
id: zod_1.z.string().describe("Unique identifier for this conversation record (typically UUID), used as primary key for database queries and cross-system references"),
|
|
304
|
+
record_id: zod_1.z.string().optional().nullable().describe("Optional external record ID for integration with partner systems, CRM platforms, or help desk software for conversation linkage and data synchronization"),
|
|
305
|
+
provider_message_id: zod_1.z.string().optional().nullable().describe("Provider-specific email message ID from email service providers (Gmail message ID, Outlook message ID, SendGrid ID) for email conversation tracking and threading"),
|
|
306
|
+
direction: zod_1.z.enum(type_definitions_1.ConversationDirection).nullable().optional().describe("Direction of the telephony call: 'inbound' for customer-initiated calls, 'outbound' for agent-initiated or campaign calls (null for non-voice channels like chat/email)"),
|
|
307
|
+
resource_url: zod_1.z.string().nullable().optional().describe("Resource URL for the call recording or conversation details from telephony provider (SignalWire recording URL, Twilio media URL) for compliance, quality assurance, and dispute resolution"),
|
|
308
|
+
call_transfer: exports.CallTransferSchema.nullable().optional().describe("Call transfer details if the conversation was transferred to a human agent including transfer type, destination, timing, and outcome (null if no transfer occurred)")
|
|
309
|
+
});
|
|
310
|
+
// ============================================================================
|
|
311
|
+
// TEST AND EVALUATION SCHEMAS
|
|
312
|
+
// ============================================================================
|
|
313
|
+
/**
|
|
314
|
+
* Test configuration schema.
|
|
315
|
+
* Base configuration for testing AI agents.
|
|
316
|
+
*/
|
|
317
|
+
exports.TestConfigSchema = zod_1.z.object({
|
|
318
|
+
account_id: zod_1.z.string().describe("Account ID for the test configuration"),
|
|
319
|
+
project_id: zod_1.z.string().describe("Project ID where the test will run"),
|
|
320
|
+
agent_id: zod_1.z.string().describe("AI agent ID to test"),
|
|
321
|
+
instruction_config_id: zod_1.z.string().describe("Instruction configuration ID for agent behavior"),
|
|
322
|
+
});
|
|
323
|
+
/**
|
|
324
|
+
* Evaluation schema for running AI agent evaluations.
|
|
325
|
+
*/
|
|
326
|
+
exports.EvaluationSchema = zod_1.z.object({
|
|
327
|
+
instructionId: zod_1.z.string().describe("Instruction configuration ID for evaluation"),
|
|
328
|
+
agentId: zod_1.z.string().describe("Agent ID to evaluate"),
|
|
329
|
+
evaluationConfigId: zod_1.z.string().describe("Evaluation configuration ID with test parameters"),
|
|
330
|
+
speechConfig: zod_1.z.object({}).optional().nullable().describe("Speech settings for voice-based evaluations"),
|
|
331
|
+
});
|
|
332
|
+
// ============================================================================
|
|
333
|
+
// OTT CONVERSATION CONFIG SCHEMA
|
|
334
|
+
// ============================================================================
|
|
335
|
+
/**
|
|
336
|
+
* OTT conversation configuration schema.
|
|
337
|
+
* Configuration for OTT (over-the-top) chat widget connections.
|
|
338
|
+
*/
|
|
339
|
+
exports.ConversationConfigSchema = zod_1.z.object({
|
|
340
|
+
platform_user_id: zod_1.z.number().optional().describe("Internal platform user ID for this conversation"),
|
|
341
|
+
channel_identifier: zod_1.z.string().describe("Unique identifier for the communication channel (phone number, chat ID, etc.)"),
|
|
342
|
+
partner_user_id: zod_1.z.string().optional().describe("External user/partner identifier for integration purposes"),
|
|
343
|
+
});
|
|
344
|
+
/**
|
|
345
|
+
* OTT conversation configuration with connection details.
|
|
346
|
+
*/
|
|
347
|
+
exports.OttConversationConfigSchema = exports.ConversationConfigSchema.safeExtend({
|
|
348
|
+
sdrtn_id: zod_1.z.string().optional().nullable().describe("SDRTN (Session Description and Real-Time Networking) identifier for WebRTC connections"),
|
|
349
|
+
channel_token: zod_1.z.string().describe("Authentication token for the communication channel"),
|
|
350
|
+
connection_url: zod_1.z.string().optional().nullable().describe("WebSocket or connection URL for real-time communication"),
|
|
351
|
+
});
|