@tellescope/types-models 1.256.0 → 1.256.2
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/lib/cjs/index.d.ts +52 -13
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.d.ts +52 -13
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/index.ts +61 -9
package/src/index.ts
CHANGED
|
@@ -1172,10 +1172,27 @@ export interface Enduser extends Enduser_readonly, Enduser_required, Enduser_upd
|
|
|
1172
1172
|
preferredPharmacy?: Pharmacy,
|
|
1173
1173
|
aiSummary?: string, // AI-generated patient profile summary (e.g. from the Generate Patient Summary journey action)
|
|
1174
1174
|
aiSummaryUpdatedAt?: Date,
|
|
1175
|
+
// AI agent conversations (Start AI Conversation journey action). One entry per
|
|
1176
|
+
// (channel, source, destination) pairing, updated in place — an active entry means inbound
|
|
1177
|
+
// messages on that pairing are answered by the AI instead of the out-of-office autoreply.
|
|
1178
|
+
aiConversations?: EnduserAIConversation[],
|
|
1175
1179
|
// unsubscribedFromEmail?: boolean,
|
|
1176
1180
|
// unsubscribedFromSMS?: boolean,
|
|
1177
1181
|
}
|
|
1178
1182
|
|
|
1183
|
+
export type EnduserAIConversation = {
|
|
1184
|
+
channel: 'SMS', // v1: SMS only
|
|
1185
|
+
aiConversationId: string, // the ai_conversations transcript/billing record
|
|
1186
|
+
source: string, // our number (inbound body.To)
|
|
1187
|
+
destination: string, // the enduser number in the conversation (inbound body.From)
|
|
1188
|
+
active: boolean,
|
|
1189
|
+
startedAt: Date,
|
|
1190
|
+
endedAt?: Date,
|
|
1191
|
+
endedReason?: string, // 'outcome' | 'staff-takeover' | 'unsubscribed' | 'expired' | 'max-turns' | 'credit-cap' | 'superseded' | 'error'
|
|
1192
|
+
journeyId?: string,
|
|
1193
|
+
automationStepId?: string, // the startAIConversation step — outcome events reference it
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1179
1196
|
export interface EnduserCustomType_readonly extends ClientRecord {}
|
|
1180
1197
|
export interface EnduserCustomType_required {
|
|
1181
1198
|
title: string,
|
|
@@ -1274,6 +1291,7 @@ export const SESSION_SCOPES = [
|
|
|
1274
1291
|
'public-form',
|
|
1275
1292
|
'appointment-booking',
|
|
1276
1293
|
'ics-download',
|
|
1294
|
+
'embeddables-token',
|
|
1277
1295
|
] as const
|
|
1278
1296
|
export type SessionScope = typeof SESSION_SCOPES[number]
|
|
1279
1297
|
|
|
@@ -3252,6 +3270,7 @@ export type AutomationEventType =
|
|
|
3252
3270
|
| 'waitForTrigger'
|
|
3253
3271
|
| "onCallOutcome"
|
|
3254
3272
|
| "onAIDecision"
|
|
3273
|
+
| "onAIConversationOutcome"
|
|
3255
3274
|
| "onError"
|
|
3256
3275
|
|
|
3257
3276
|
interface AutomationEventBuilder <T extends AutomationEventType, V extends object> {
|
|
@@ -3367,8 +3386,10 @@ export type FormsUnsubmittedEvent = AutomationEventBuilder<'formsUnsubmitted', F
|
|
|
3367
3386
|
export type OnJourneyStartAutomationEvent = AutomationEventBuilder<'onJourneyStart', {}>
|
|
3368
3387
|
export type TicketCompletedAutomationEvent = AutomationEventBuilder<'ticketCompleted', TicketCompletedEventInfo>
|
|
3369
3388
|
export type WaitForTriggerAutomationEvent = AutomationEventBuilder<'waitForTrigger', { automationStepId: string, triggerId: string }>
|
|
3370
|
-
export type OnCallOutcomeAutomationEvent = AutomationEventBuilder<'onCallOutcome', { automationStepId: string, outcome: string }>
|
|
3389
|
+
export type OnCallOutcomeAutomationEvent = AutomationEventBuilder<'onCallOutcome', { automationStepId: string, outcome: string }>
|
|
3371
3390
|
export type OnAIDecisionAutomationEvent = AutomationEventBuilder<'onAIDecision', { automationStepId: string, outcomes: string[] }>
|
|
3391
|
+
// branches from a 'startAIConversation' step when the AI conversation ends with this outcome (the SMS sibling of 'onCallOutcome')
|
|
3392
|
+
export type OnAIConversationOutcomeAutomationEvent = AutomationEventBuilder<'onAIConversationOutcome', { automationStepId: string, outcome: string }>
|
|
3372
3393
|
|
|
3373
3394
|
export type OnErrorEventInfo = {
|
|
3374
3395
|
automationStepId: string,
|
|
@@ -3386,6 +3407,7 @@ export type AutomationEventForType = {
|
|
|
3386
3407
|
'waitForTrigger': WaitForTriggerAutomationEvent
|
|
3387
3408
|
'onCallOutcome': OnCallOutcomeAutomationEvent,
|
|
3388
3409
|
'onAIDecision': OnAIDecisionAutomationEvent
|
|
3410
|
+
'onAIConversationOutcome': OnAIConversationOutcomeAutomationEvent
|
|
3389
3411
|
'onError': OnErrorAutomationEvent
|
|
3390
3412
|
}
|
|
3391
3413
|
export type AutomationEvent = AutomationEventForType[keyof AutomationEventForType]
|
|
@@ -3551,6 +3573,15 @@ export type BelugaAutomationMappingEntry = {
|
|
|
3551
3573
|
patientPreferences: BelugaUpdateVisitPatientPreferenceItem[],
|
|
3552
3574
|
pharmacyId: string,
|
|
3553
3575
|
}
|
|
3576
|
+
export type BelugaTriggerRefillPatientPreferenceItem = {
|
|
3577
|
+
medId: string,
|
|
3578
|
+
}
|
|
3579
|
+
export type BelugaTriggerRefillAutomationAction = AutomationActionBuilder<'belugaTriggerRefill', {
|
|
3580
|
+
formId: string,
|
|
3581
|
+
patientPreferences?: BelugaTriggerRefillPatientPreferenceItem[],
|
|
3582
|
+
useOrganizationMapping?: boolean,
|
|
3583
|
+
customFieldName?: string,
|
|
3584
|
+
}>
|
|
3554
3585
|
export type SendChatAutomationAction = AutomationActionBuilder<'sendChat', {
|
|
3555
3586
|
templateId: string,
|
|
3556
3587
|
identifier: string,
|
|
@@ -3698,10 +3729,23 @@ export type CreateScriptSureDraftAutomationAction = AutomationActionBuilder<'cre
|
|
|
3698
3729
|
matchMedicationTitle?: string, // when set, restrict to routes with this exact title
|
|
3699
3730
|
matchEnduserState?: boolean, // when true, restrict to routes whose state === enduser.state
|
|
3700
3731
|
}>
|
|
3732
|
+
// Starts an AI agent conversation with the enduser over a messaging channel (SMS v1) — the
|
|
3733
|
+
// messaging sibling of the phone tree 'AI Agent' step. The step's automated_action completes
|
|
3734
|
+
// immediately; the journey branches later via 'onAIConversationOutcome' events when the agent
|
|
3735
|
+
// ends the conversation with an outcome.
|
|
3736
|
+
export type StartAIConversationActionInfo = AIAgentBaseConfig & {
|
|
3737
|
+
channel: 'SMS', // v1: SMS only; conversations are scoped per (channel, source, destination)
|
|
3738
|
+
senderId: string, // user the AI's messages are attributed to (message userId + merge-field context)
|
|
3739
|
+
fromNumber?: string, // source number — must be one of the organization's numbers; defaults to organization.twilioNumber
|
|
3740
|
+
initialMessage: string, // opening SMS, sent immediately; supports merge fields like {{enduser.fname}}
|
|
3741
|
+
inactivityTimeoutHours?: number, // conversation auto-ends after this idle window (default 72)
|
|
3742
|
+
}
|
|
3743
|
+
export type StartAIConversationAutomationAction = AutomationActionBuilder<'startAIConversation', StartAIConversationActionInfo>
|
|
3701
3744
|
|
|
3702
3745
|
export type AutomationActionForType = {
|
|
3703
3746
|
'aiDecision': AIDecisionAutomationAction,
|
|
3704
3747
|
'generateEnduserSummary': GenerateEnduserSummaryAutomationAction,
|
|
3748
|
+
'startAIConversation': StartAIConversationAutomationAction,
|
|
3705
3749
|
'assignInboxItem': AssignInboxItemAutomationAction,
|
|
3706
3750
|
'stripeChargeCardOnFile': StripeChargeCardOnFileAutomationAction,
|
|
3707
3751
|
'stripeCancelSubscription': StripeCancelSubscriptionAutomationAction,
|
|
@@ -3737,6 +3781,7 @@ export type AutomationActionForType = {
|
|
|
3737
3781
|
'smartMeterPlaceOrder': SmartMeterPlaceOrderAutomationAction,
|
|
3738
3782
|
'belugaAutoRx': BelugaAutoRxAutomationAction,
|
|
3739
3783
|
'belugaUpdateVisit': BelugaUpdateVisitAutomationAction,
|
|
3784
|
+
'belugaTriggerRefill': BelugaTriggerRefillAutomationAction,
|
|
3740
3785
|
'healthieSync': HealthieSyncAutomationAction,
|
|
3741
3786
|
healthieAddToCourse: HealthieAddToCourseAutomationAction,
|
|
3742
3787
|
healthieSendChat: HealthieSendChatAutomationAction,
|
|
@@ -5154,6 +5199,18 @@ export type PhoneTreeAgentTools = {
|
|
|
5154
5199
|
export type PhoneTreeAgentToolType = keyof PhoneTreeAgentTools
|
|
5155
5200
|
export type PhoneTreeAgentTool = PhoneTreeAgentTools[PhoneTreeAgentToolType]
|
|
5156
5201
|
|
|
5202
|
+
// The channel-agnostic AI agent configuration — shared by the phone tree 'AI Agent' step (voice)
|
|
5203
|
+
// and the 'startAIConversation' journey action (SMS). Channel-specific settings extend this.
|
|
5204
|
+
export type AIAgentBaseConfig = {
|
|
5205
|
+
prompt: string, // org-authored additions to the channel's base system prompt
|
|
5206
|
+
outcomes: { value: string, description: string }[], // the agent must end with one of these
|
|
5207
|
+
tools?: PhoneTreeAgentTool[], // capabilities the agent may use mid-conversation (e.g. 'Submit Form', 'Book Appointment')
|
|
5208
|
+
model?: string, // friendly AI model name, see SELECTABLE_AI_MODELS (constants); defaults to Claude Sonnet 5
|
|
5209
|
+
maxTokensPerTurn?: number,
|
|
5210
|
+
maxTurns?: number,
|
|
5211
|
+
maxCreditsPerCall?: number, // per-call/per-conversation spend circuit breaker, default from constants
|
|
5212
|
+
}
|
|
5213
|
+
|
|
5157
5214
|
export type PhoneTreeActionBuilder <T, V> = { type: T, info: V }
|
|
5158
5215
|
export type PhoneTreeActions = {
|
|
5159
5216
|
// 'Play': PhoneTreeActionBuilder<"Play", { playback: PhonePlayback }>
|
|
@@ -5209,19 +5266,14 @@ export type PhoneTreeActions = {
|
|
|
5209
5266
|
// Conversational AI agent (Twilio ConversationRelay + Bedrock). A generic "end call with outcome"
|
|
5210
5267
|
// step: the agent converses, then ends with one of the configured outcomes; the tree branches on
|
|
5211
5268
|
// the outcome via 'On Agent Outcome' events, like 'On Gather' branches on input.
|
|
5212
|
-
|
|
5213
|
-
|
|
5269
|
+
// The field set is AIAgentBaseConfig + voice-only settings — structurally identical to the
|
|
5270
|
+
// pre-split inline shape, so validators, editors, and stored trees are unaffected.
|
|
5271
|
+
'AI Agent': PhoneTreeActionBuilder<"AI Agent", AIAgentBaseConfig & {
|
|
5214
5272
|
greeting?: string, // ConversationRelay welcomeGreeting
|
|
5215
5273
|
voice?: string,
|
|
5216
5274
|
language?: string,
|
|
5217
5275
|
interruptible?: boolean, // barge-in, default true
|
|
5218
|
-
maxTokensPerTurn?: number,
|
|
5219
|
-
maxTurns?: number,
|
|
5220
5276
|
maxDurationSeconds?: number,
|
|
5221
|
-
maxCreditsPerCall?: number, // per-call spend circuit breaker, default from constants
|
|
5222
|
-
model?: string, // friendly AI model name, see SELECTABLE_AI_MODELS (constants); defaults to Claude Sonnet 5
|
|
5223
|
-
outcomes: { value: string, description: string }[], // the agent must end with one of these
|
|
5224
|
-
tools?: PhoneTreeAgentTool[], // capabilities the agent may use mid-call (e.g. 'Submit Form')
|
|
5225
5277
|
}>
|
|
5226
5278
|
}
|
|
5227
5279
|
export type PhoneTreeActionType = keyof PhoneTreeActions
|