@tellescope/types-models 1.255.19 → 1.256.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.d.ts +69 -11
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.d.ts +69 -11
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/index.ts +81 -8
package/src/index.ts
CHANGED
|
@@ -593,6 +593,9 @@ export interface Organization extends Organization_readonly, Organization_requir
|
|
|
593
593
|
customerIOFields?: string[],
|
|
594
594
|
customerIOIdField?: string,
|
|
595
595
|
createEnduserForms?: string[],
|
|
596
|
+
// Journey containing a "Generate Patient Summary" action; enables the Regenerate button on the
|
|
597
|
+
// AI Summary panel of the patient profile. Unset automatically if the journey is deleted.
|
|
598
|
+
defaultSummaryJourneyId?: string,
|
|
596
599
|
creditCount?: number,
|
|
597
600
|
creditTrialStartedAt?: Date,
|
|
598
601
|
hasIntegrations?: string[],
|
|
@@ -1169,10 +1172,27 @@ export interface Enduser extends Enduser_readonly, Enduser_required, Enduser_upd
|
|
|
1169
1172
|
preferredPharmacy?: Pharmacy,
|
|
1170
1173
|
aiSummary?: string, // AI-generated patient profile summary (e.g. from the Generate Patient Summary journey action)
|
|
1171
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[],
|
|
1172
1179
|
// unsubscribedFromEmail?: boolean,
|
|
1173
1180
|
// unsubscribedFromSMS?: boolean,
|
|
1174
1181
|
}
|
|
1175
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
|
+
|
|
1176
1196
|
export interface EnduserCustomType_readonly extends ClientRecord {}
|
|
1177
1197
|
export interface EnduserCustomType_required {
|
|
1178
1198
|
title: string,
|
|
@@ -3249,6 +3269,7 @@ export type AutomationEventType =
|
|
|
3249
3269
|
| 'waitForTrigger'
|
|
3250
3270
|
| "onCallOutcome"
|
|
3251
3271
|
| "onAIDecision"
|
|
3272
|
+
| "onAIConversationOutcome"
|
|
3252
3273
|
| "onError"
|
|
3253
3274
|
|
|
3254
3275
|
interface AutomationEventBuilder <T extends AutomationEventType, V extends object> {
|
|
@@ -3364,8 +3385,10 @@ export type FormsUnsubmittedEvent = AutomationEventBuilder<'formsUnsubmitted', F
|
|
|
3364
3385
|
export type OnJourneyStartAutomationEvent = AutomationEventBuilder<'onJourneyStart', {}>
|
|
3365
3386
|
export type TicketCompletedAutomationEvent = AutomationEventBuilder<'ticketCompleted', TicketCompletedEventInfo>
|
|
3366
3387
|
export type WaitForTriggerAutomationEvent = AutomationEventBuilder<'waitForTrigger', { automationStepId: string, triggerId: string }>
|
|
3367
|
-
export type OnCallOutcomeAutomationEvent = AutomationEventBuilder<'onCallOutcome', { automationStepId: string, outcome: string }>
|
|
3388
|
+
export type OnCallOutcomeAutomationEvent = AutomationEventBuilder<'onCallOutcome', { automationStepId: string, outcome: string }>
|
|
3368
3389
|
export type OnAIDecisionAutomationEvent = AutomationEventBuilder<'onAIDecision', { automationStepId: string, outcomes: string[] }>
|
|
3390
|
+
// branches from a 'startAIConversation' step when the AI conversation ends with this outcome (the SMS sibling of 'onCallOutcome')
|
|
3391
|
+
export type OnAIConversationOutcomeAutomationEvent = AutomationEventBuilder<'onAIConversationOutcome', { automationStepId: string, outcome: string }>
|
|
3369
3392
|
|
|
3370
3393
|
export type OnErrorEventInfo = {
|
|
3371
3394
|
automationStepId: string,
|
|
@@ -3383,6 +3406,7 @@ export type AutomationEventForType = {
|
|
|
3383
3406
|
'waitForTrigger': WaitForTriggerAutomationEvent
|
|
3384
3407
|
'onCallOutcome': OnCallOutcomeAutomationEvent,
|
|
3385
3408
|
'onAIDecision': OnAIDecisionAutomationEvent
|
|
3409
|
+
'onAIConversationOutcome': OnAIConversationOutcomeAutomationEvent
|
|
3386
3410
|
'onError': OnErrorAutomationEvent
|
|
3387
3411
|
}
|
|
3388
3412
|
export type AutomationEvent = AutomationEventForType[keyof AutomationEventForType]
|
|
@@ -3548,6 +3572,15 @@ export type BelugaAutomationMappingEntry = {
|
|
|
3548
3572
|
patientPreferences: BelugaUpdateVisitPatientPreferenceItem[],
|
|
3549
3573
|
pharmacyId: string,
|
|
3550
3574
|
}
|
|
3575
|
+
export type BelugaTriggerRefillPatientPreferenceItem = {
|
|
3576
|
+
medId: string,
|
|
3577
|
+
}
|
|
3578
|
+
export type BelugaTriggerRefillAutomationAction = AutomationActionBuilder<'belugaTriggerRefill', {
|
|
3579
|
+
formId: string,
|
|
3580
|
+
patientPreferences?: BelugaTriggerRefillPatientPreferenceItem[],
|
|
3581
|
+
useOrganizationMapping?: boolean,
|
|
3582
|
+
customFieldName?: string,
|
|
3583
|
+
}>
|
|
3551
3584
|
export type SendChatAutomationAction = AutomationActionBuilder<'sendChat', {
|
|
3552
3585
|
templateId: string,
|
|
3553
3586
|
identifier: string,
|
|
@@ -3695,10 +3728,23 @@ export type CreateScriptSureDraftAutomationAction = AutomationActionBuilder<'cre
|
|
|
3695
3728
|
matchMedicationTitle?: string, // when set, restrict to routes with this exact title
|
|
3696
3729
|
matchEnduserState?: boolean, // when true, restrict to routes whose state === enduser.state
|
|
3697
3730
|
}>
|
|
3731
|
+
// Starts an AI agent conversation with the enduser over a messaging channel (SMS v1) — the
|
|
3732
|
+
// messaging sibling of the phone tree 'AI Agent' step. The step's automated_action completes
|
|
3733
|
+
// immediately; the journey branches later via 'onAIConversationOutcome' events when the agent
|
|
3734
|
+
// ends the conversation with an outcome.
|
|
3735
|
+
export type StartAIConversationActionInfo = AIAgentBaseConfig & {
|
|
3736
|
+
channel: 'SMS', // v1: SMS only; conversations are scoped per (channel, source, destination)
|
|
3737
|
+
senderId: string, // user the AI's messages are attributed to (message userId + merge-field context)
|
|
3738
|
+
fromNumber?: string, // source number — must be one of the organization's numbers; defaults to organization.twilioNumber
|
|
3739
|
+
initialMessage: string, // opening SMS, sent immediately; supports merge fields like {{enduser.fname}}
|
|
3740
|
+
inactivityTimeoutHours?: number, // conversation auto-ends after this idle window (default 72)
|
|
3741
|
+
}
|
|
3742
|
+
export type StartAIConversationAutomationAction = AutomationActionBuilder<'startAIConversation', StartAIConversationActionInfo>
|
|
3698
3743
|
|
|
3699
3744
|
export type AutomationActionForType = {
|
|
3700
3745
|
'aiDecision': AIDecisionAutomationAction,
|
|
3701
3746
|
'generateEnduserSummary': GenerateEnduserSummaryAutomationAction,
|
|
3747
|
+
'startAIConversation': StartAIConversationAutomationAction,
|
|
3702
3748
|
'assignInboxItem': AssignInboxItemAutomationAction,
|
|
3703
3749
|
'stripeChargeCardOnFile': StripeChargeCardOnFileAutomationAction,
|
|
3704
3750
|
'stripeCancelSubscription': StripeCancelSubscriptionAutomationAction,
|
|
@@ -3734,6 +3780,7 @@ export type AutomationActionForType = {
|
|
|
3734
3780
|
'smartMeterPlaceOrder': SmartMeterPlaceOrderAutomationAction,
|
|
3735
3781
|
'belugaAutoRx': BelugaAutoRxAutomationAction,
|
|
3736
3782
|
'belugaUpdateVisit': BelugaUpdateVisitAutomationAction,
|
|
3783
|
+
'belugaTriggerRefill': BelugaTriggerRefillAutomationAction,
|
|
3737
3784
|
'healthieSync': HealthieSyncAutomationAction,
|
|
3738
3785
|
healthieAddToCourse: HealthieAddToCourseAutomationAction,
|
|
3739
3786
|
healthieSendChat: HealthieSendChatAutomationAction,
|
|
@@ -5134,6 +5181,35 @@ export type PhonePlaybackInfo = {
|
|
|
5134
5181
|
export type PhonePlaybackType = keyof PhonePlaybackInfo
|
|
5135
5182
|
export type PhonePlayback = PhonePlaybackInfo[PhonePlaybackType]
|
|
5136
5183
|
|
|
5184
|
+
// Capabilities granted to an 'AI Agent' node — each entry enables tool(s) the agent may use
|
|
5185
|
+
// mid-call (e.g. collecting and submitting a form). Extensible the same way PhoneTreeActions is:
|
|
5186
|
+
// future capabilities (e.g. appointment booking) are new entries in PhoneTreeAgentTools.
|
|
5187
|
+
export type PhoneTreeAgentToolBuilder <T extends string, V> = { type: T, info: V }
|
|
5188
|
+
export type PhoneTreeAgentTools = {
|
|
5189
|
+
'Submit Form': PhoneTreeAgentToolBuilder<'Submit Form', {
|
|
5190
|
+
formId: string,
|
|
5191
|
+
useWhen?: string, // guidance for when the agent should collect this form (disambiguates when several forms are configured)
|
|
5192
|
+
}>,
|
|
5193
|
+
'Book Appointment': PhoneTreeAgentToolBuilder<'Book Appointment', {
|
|
5194
|
+
appointmentBookingPageId: string,
|
|
5195
|
+
useWhen?: string, // guidance for when the agent should offer booking
|
|
5196
|
+
}>,
|
|
5197
|
+
}
|
|
5198
|
+
export type PhoneTreeAgentToolType = keyof PhoneTreeAgentTools
|
|
5199
|
+
export type PhoneTreeAgentTool = PhoneTreeAgentTools[PhoneTreeAgentToolType]
|
|
5200
|
+
|
|
5201
|
+
// The channel-agnostic AI agent configuration — shared by the phone tree 'AI Agent' step (voice)
|
|
5202
|
+
// and the 'startAIConversation' journey action (SMS). Channel-specific settings extend this.
|
|
5203
|
+
export type AIAgentBaseConfig = {
|
|
5204
|
+
prompt: string, // org-authored additions to the channel's base system prompt
|
|
5205
|
+
outcomes: { value: string, description: string }[], // the agent must end with one of these
|
|
5206
|
+
tools?: PhoneTreeAgentTool[], // capabilities the agent may use mid-conversation (e.g. 'Submit Form', 'Book Appointment')
|
|
5207
|
+
model?: string, // friendly AI model name, see SELECTABLE_AI_MODELS (constants); defaults to Claude Sonnet 5
|
|
5208
|
+
maxTokensPerTurn?: number,
|
|
5209
|
+
maxTurns?: number,
|
|
5210
|
+
maxCreditsPerCall?: number, // per-call/per-conversation spend circuit breaker, default from constants
|
|
5211
|
+
}
|
|
5212
|
+
|
|
5137
5213
|
export type PhoneTreeActionBuilder <T, V> = { type: T, info: V }
|
|
5138
5214
|
export type PhoneTreeActions = {
|
|
5139
5215
|
// 'Play': PhoneTreeActionBuilder<"Play", { playback: PhonePlayback }>
|
|
@@ -5189,18 +5265,14 @@ export type PhoneTreeActions = {
|
|
|
5189
5265
|
// Conversational AI agent (Twilio ConversationRelay + Bedrock). A generic "end call with outcome"
|
|
5190
5266
|
// step: the agent converses, then ends with one of the configured outcomes; the tree branches on
|
|
5191
5267
|
// the outcome via 'On Agent Outcome' events, like 'On Gather' branches on input.
|
|
5192
|
-
|
|
5193
|
-
|
|
5268
|
+
// The field set is AIAgentBaseConfig + voice-only settings — structurally identical to the
|
|
5269
|
+
// pre-split inline shape, so validators, editors, and stored trees are unaffected.
|
|
5270
|
+
'AI Agent': PhoneTreeActionBuilder<"AI Agent", AIAgentBaseConfig & {
|
|
5194
5271
|
greeting?: string, // ConversationRelay welcomeGreeting
|
|
5195
5272
|
voice?: string,
|
|
5196
5273
|
language?: string,
|
|
5197
5274
|
interruptible?: boolean, // barge-in, default true
|
|
5198
|
-
maxTokensPerTurn?: number,
|
|
5199
|
-
maxTurns?: number,
|
|
5200
5275
|
maxDurationSeconds?: number,
|
|
5201
|
-
maxCreditsPerCall?: number, // per-call spend circuit breaker, default from constants
|
|
5202
|
-
model?: string, // friendly AI model name, see SELECTABLE_AI_MODELS (constants); defaults to Claude Sonnet 5
|
|
5203
|
-
outcomes: { value: string, description: string }[], // the agent must end with one of these
|
|
5204
5276
|
}>
|
|
5205
5277
|
}
|
|
5206
5278
|
export type PhoneTreeActionType = keyof PhoneTreeActions
|
|
@@ -7104,6 +7176,7 @@ export type DataSyncRecord = {
|
|
|
7104
7176
|
data: 'deleted' | string, // when not deleted, stringified JSON
|
|
7105
7177
|
userIds: string[], // Default access
|
|
7106
7178
|
enduserIds: string[], // Assigned access
|
|
7179
|
+
visibleToAllUsers?: boolean, // 'visibleToAllUsers' schema access constraint (staff users only)
|
|
7107
7180
|
}
|
|
7108
7181
|
|
|
7109
7182
|
export type InsuranceType = "Primary" | "Secondary"
|