@ctchealth/plato-sdk 0.0.19 → 0.0.21

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.
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PdfSlidesAnalysisQueryDto = exports.PdfSlidesSortField = exports.PdfSlidesStatus = exports.RecommendationPriority = exports.CreationPhase = exports.SimulationRecordingsDto = exports.RecordingStatus = exports.SortOrder = exports.SimulationRecordingsQueryDto = exports.CreateSimulationDto = exports.ProductConfig = exports.CharacterCreateDto = exports.ContextDto = exports.ProfessionalProfileDto = exports.PersonalityAndBehaviourDto = exports.AvatarLanguage = exports.AssistantVoiceGender = exports.SegmentType = exports.PracticeType = exports.YearOfExperience = void 0;
4
+ /**
5
+ * Copyright (c) 2025 ctcHealth. All rights reserved.
6
+ *
7
+ * This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
8
+ *
9
+ * This source code and all related materials are confidential and proprietary to ctcHealth.
10
+ * Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
11
+ * and may result in disciplinary action and civil and/or criminal penalties.
12
+ *
13
+ * This software is intended solely for authorized use within ctcHealth and its designated partners.
14
+ *
15
+ * For internal use only.
16
+ */
17
+ var YearOfExperience;
18
+ (function (YearOfExperience) {
19
+ YearOfExperience["1-5"] = "1-5 years";
20
+ YearOfExperience["6-10"] = "6-10 years";
21
+ YearOfExperience["11-20"] = "16-20 years";
22
+ YearOfExperience["20+"] = "20+ years";
23
+ })(YearOfExperience || (exports.YearOfExperience = YearOfExperience = {}));
24
+ var PracticeType;
25
+ (function (PracticeType) {
26
+ PracticeType["Private"] = "Private Practice";
27
+ PracticeType["Hospital"] = "Hospital";
28
+ PracticeType["AcademicMedicalCenter"] = "Academic Medical Center";
29
+ PracticeType["Clinic"] = "Clinic";
30
+ })(PracticeType || (exports.PracticeType = PracticeType = {}));
31
+ var SegmentType;
32
+ (function (SegmentType) {
33
+ SegmentType["Traditionalist"] = "The Traditionalist";
34
+ SegmentType["Innovator"] = "The Innovator";
35
+ SegmentType["PatientOrientedPhysician"] = "The Patient-Oriented Physician";
36
+ SegmentType["FinanciallyDrivenPrescriber"] = "The Financially-Driven Prescriber";
37
+ SegmentType["EvidencePurist"] = "The Evidence-Purist";
38
+ SegmentType["CostConsciousPrescriber"] = "The Cost-Conscious Prescriber";
39
+ })(SegmentType || (exports.SegmentType = SegmentType = {}));
40
+ var AssistantVoiceGender;
41
+ (function (AssistantVoiceGender) {
42
+ AssistantVoiceGender["Male"] = "Male";
43
+ AssistantVoiceGender["Female"] = "Female";
44
+ })(AssistantVoiceGender || (exports.AssistantVoiceGender = AssistantVoiceGender = {}));
45
+ var AvatarLanguage;
46
+ (function (AvatarLanguage) {
47
+ AvatarLanguage["English"] = "en";
48
+ AvatarLanguage["German"] = "de";
49
+ AvatarLanguage["Spanish"] = "es";
50
+ AvatarLanguage["Italian"] = "it";
51
+ AvatarLanguage["French"] = "fr";
52
+ AvatarLanguage["Arabic"] = "ar";
53
+ AvatarLanguage["Russian"] = "ru";
54
+ })(AvatarLanguage || (exports.AvatarLanguage = AvatarLanguage = {}));
55
+ class PersonalityAndBehaviourDto {
56
+ riskTolerance;
57
+ researchOrientation;
58
+ recognitionNeed;
59
+ brandLoyalty;
60
+ patientEmpathy;
61
+ }
62
+ exports.PersonalityAndBehaviourDto = PersonalityAndBehaviourDto;
63
+ class ProfessionalProfileDto {
64
+ practiceSettings;
65
+ yearOfExperience;
66
+ specialityAndDepartment;
67
+ location;
68
+ }
69
+ exports.ProfessionalProfileDto = ProfessionalProfileDto;
70
+ class ContextDto {
71
+ subSpecialityOrTherapyFocus;
72
+ typicalPatientMix;
73
+ keyClinicalDrivers;
74
+ }
75
+ exports.ContextDto = ContextDto;
76
+ class CharacterCreateDto {
77
+ name;
78
+ professionalProfile;
79
+ segment;
80
+ personalityAndBehaviour;
81
+ context;
82
+ assistantGender;
83
+ }
84
+ exports.CharacterCreateDto = CharacterCreateDto;
85
+ class ProductConfig {
86
+ name;
87
+ description;
88
+ }
89
+ exports.ProductConfig = ProductConfig;
90
+ class CreateSimulationDto {
91
+ persona;
92
+ product;
93
+ scenario;
94
+ objectives;
95
+ anticipatedObjections;
96
+ imageId;
97
+ avatarLanguage;
98
+ pdfSlideId;
99
+ isLearning;
100
+ }
101
+ exports.CreateSimulationDto = CreateSimulationDto;
102
+ class SimulationRecordingsQueryDto {
103
+ limit;
104
+ page;
105
+ sort;
106
+ }
107
+ exports.SimulationRecordingsQueryDto = SimulationRecordingsQueryDto;
108
+ var SortOrder;
109
+ (function (SortOrder) {
110
+ SortOrder["ASC"] = "asc";
111
+ SortOrder["DESC"] = "desc";
112
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
113
+ var RecordingStatus;
114
+ (function (RecordingStatus) {
115
+ RecordingStatus["STARTED"] = "STARTED";
116
+ RecordingStatus["PROCESSING"] = "PROCESSING";
117
+ RecordingStatus["FINISHED"] = "FINISHED";
118
+ RecordingStatus["FAILED"] = "FAILED";
119
+ })(RecordingStatus || (exports.RecordingStatus = RecordingStatus = {}));
120
+ class SimulationRecordingsDto {
121
+ _id;
122
+ createdAt;
123
+ recordingStatus;
124
+ }
125
+ exports.SimulationRecordingsDto = SimulationRecordingsDto;
126
+ var CreationPhase;
127
+ (function (CreationPhase) {
128
+ CreationPhase["QUEUED"] = "QUEUED";
129
+ CreationPhase["STARTING"] = "STARTING";
130
+ CreationPhase["BUILD_HEADER"] = "BUILD_HEADER";
131
+ CreationPhase["SEGMENT_SELECTED"] = "SEGMENT_SELECTED";
132
+ CreationPhase["BUILD_CONTEXT"] = "BUILD_CONTEXT";
133
+ CreationPhase["BUILD_PSYCHOGRAPHICS"] = "BUILD_PSYCHOGRAPHICS";
134
+ CreationPhase["BUILD_OBJECTIVES"] = "BUILD_OBJECTIVES";
135
+ CreationPhase["PERSONA_ASSEMBLED"] = "PERSONA_ASSEMBLED";
136
+ CreationPhase["CORE"] = "CORE";
137
+ CreationPhase["BOUNDARIES"] = "BOUNDARIES";
138
+ CreationPhase["SPEECH_AND_THOUGHT"] = "SPEECH_AND_THOUGHT";
139
+ CreationPhase["CONVERSATION_EVOLUTION"] = "CONVERSATION_EVOLUTION";
140
+ CreationPhase["MEMORY"] = "MEMORY";
141
+ CreationPhase["OBJECTION_HANDLING"] = "OBJECTION_HANDLING";
142
+ CreationPhase["PERFORMANCE_EVALUATION"] = "PERFORMANCE_EVALUATION";
143
+ CreationPhase["BEHAVIORAL_FRAMEWORKS"] = "BEHAVIORAL_FRAMEWORKS";
144
+ CreationPhase["FINISHED"] = "FINISHED";
145
+ CreationPhase["ERROR"] = "ERROR";
146
+ })(CreationPhase || (exports.CreationPhase = CreationPhase = {}));
147
+ var RecommendationPriority;
148
+ (function (RecommendationPriority) {
149
+ RecommendationPriority["HIGH"] = "high";
150
+ RecommendationPriority["MEDIUM"] = "medium";
151
+ RecommendationPriority["LOW"] = "low";
152
+ })(RecommendationPriority || (exports.RecommendationPriority = RecommendationPriority = {}));
153
+ var PdfSlidesStatus;
154
+ (function (PdfSlidesStatus) {
155
+ PdfSlidesStatus["PENDING"] = "pending";
156
+ PdfSlidesStatus["STARTED"] = "started";
157
+ PdfSlidesStatus["PROCESSING"] = "processing";
158
+ PdfSlidesStatus["OVERVIEW"] = "overview";
159
+ PdfSlidesStatus["COMPLETED"] = "completed";
160
+ PdfSlidesStatus["FAILED"] = "failed";
161
+ })(PdfSlidesStatus || (exports.PdfSlidesStatus = PdfSlidesStatus = {}));
162
+ var PdfSlidesSortField;
163
+ (function (PdfSlidesSortField) {
164
+ PdfSlidesSortField["CREATED_AT"] = "createdAt";
165
+ PdfSlidesSortField["FILENAME"] = "originalFilename";
166
+ PdfSlidesSortField["TOTAL_SLIDES"] = "totalSlides";
167
+ })(PdfSlidesSortField || (exports.PdfSlidesSortField = PdfSlidesSortField = {}));
168
+ class PdfSlidesAnalysisQueryDto {
169
+ limit;
170
+ page;
171
+ sort;
172
+ sortBy;
173
+ }
174
+ exports.PdfSlidesAnalysisQueryDto = PdfSlidesAnalysisQueryDto;
175
+ //# sourceMappingURL=plato-intefaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plato-intefaces.js","sourceRoot":"","sources":["../../../../../libs/plato-sdk/src/lib/plato-intefaces.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,qCAAmB,CAAA;IACnB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;IACvB,qCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,4CAA4B,CAAA;IAC5B,qCAAqB,CAAA;IACrB,iEAAiD,CAAA;IACjD,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AACD,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,oDAAqC,CAAA;IACrC,0CAA2B,CAAA;IAC3B,0EAA2D,CAAA;IAC3D,gFAAiE,CAAA;IACjE,qDAAsC,CAAA;IACtC,wEAAyD,CAAA;AAC3D,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB;AAED,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,yCAAiB,CAAA;AACnB,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B;AAED,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,gCAAc,CAAA;IACd,+BAAa,CAAA;IACb,gCAAc,CAAA;IACd,gCAAc,CAAA;IACd,+BAAa,CAAA;IACb,+BAAa,CAAA;IACb,gCAAc,CAAA;AAChB,CAAC,EARW,cAAc,8BAAd,cAAc,QAQzB;AAED,MAAa,0BAA0B;IACrC,aAAa,CAAU;IACvB,mBAAmB,CAAU;IAC7B,eAAe,CAAU;IACzB,YAAY,CAAU;IACtB,cAAc,CAAU;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,CAAA;IAC7B,sDAAqC,CAAA;IACrC,gDAA+B,CAAA;IAC/B,8DAA6C,CAAA;IAC7C,sDAAqC,CAAA;IACrC,wDAAuC,CAAA;IACvC,8BAAa,CAAA;IACb,0CAAyB,CAAA;IACzB,0DAAyC,CAAA;IACzC,kEAAiD,CAAA;IACjD,kCAAiB,CAAA;IACjB,0DAAyC,CAAA;IACzC,kEAAiD,CAAA;IACjD,gEAA+C,CAAA;IAC/C,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACjB,CAAC,EAnBW,aAAa,6BAAb,aAAa,QAmBxB;AA+DD,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,2CAAiB,CAAA;IACjB,qCAAW,CAAA;AACb,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC;AA2BD,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;IACrB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;AACnB,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAQD,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,8CAAwB,CAAA;IACxB,mDAA6B,CAAA;IAC7B,kDAA4B,CAAA;AAC9B,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,MAAa,yBAAyB;IACpC,KAAK,CAAmB;IACxB,IAAI,CAAU;IACd,IAAI,CAAa;IACjB,MAAM,CAAsB;CAC7B;AALD,8DAKC"}
@@ -0,0 +1,135 @@
1
+ import { CallDTO, CreateSimulationDto, CreationPhase, SimulationRecordingsDto, SimulationRecordingsQueryDto, SimulationDetailsDto, RecommendationsResponseDto, PdfSlidesDto, PdfSlideDto, PdfSlidesAnalysisQueryDto, CheckPdfStatusResponse, AssistantImageDto } from './plato-intefaces';
2
+ export interface ApiClientConfig {
3
+ baseUrl: string;
4
+ jwtToken: string;
5
+ publicKey: string;
6
+ }
7
+ export interface ToolCall {
8
+ function: {
9
+ name: string;
10
+ arguments: {
11
+ slideNumber?: number;
12
+ progressObjectiveNumber?: number;
13
+ [key: string]: unknown;
14
+ };
15
+ };
16
+ id: string;
17
+ }
18
+ /**
19
+ * Event map for call events, providing strict typing for each event's payload.
20
+ * There are no inputs for the events and all of them return void.
21
+ */
22
+ export interface CallEventMap {
23
+ 'call-start': undefined;
24
+ 'call-end': undefined;
25
+ 'speech-start': undefined;
26
+ 'speech-end': undefined;
27
+ error: Error;
28
+ message: {
29
+ type: string;
30
+ role: string;
31
+ transcript?: string;
32
+ transcriptType: 'final' | 'partial';
33
+ toolCallList?: ToolCall[];
34
+ toolCalls?: ToolCall[];
35
+ [key: string]: unknown;
36
+ };
37
+ 'volume-level': number;
38
+ 'call-details-ready': CallDTO;
39
+ 'call-ended-reason': {
40
+ reason: string;
41
+ isInactivity: boolean;
42
+ };
43
+ }
44
+ export type CallEventNames = keyof CallEventMap;
45
+ export type CallEventListener<K extends CallEventNames> = (payload: CallEventMap[K]) => void;
46
+ export declare class PlatoApiClient {
47
+ private config;
48
+ private http;
49
+ private eventListeners;
50
+ private callControllerInstance?;
51
+ private eventsAttached;
52
+ private vapiEventNames;
53
+ eventNames: CallEventNames[];
54
+ constructor(config: ApiClientConfig);
55
+ /**
56
+ * Update the JWT token for all subsequent requests.
57
+ * Useful when the token is refreshed or when switching user context.
58
+ */
59
+ setJwtToken(jwtToken: string): void;
60
+ /**
61
+ * Remove the JWT token from subsequent requests.
62
+ */
63
+ clearJwtToken(): void;
64
+ /**
65
+ * Register a listener for a call event with strict typing.
66
+ * @param event Event name
67
+ * @param listener Listener function
68
+ */
69
+ private on;
70
+ /**
71
+ * Remove a listener for a call event with strict typing.
72
+ * @param event Event name
73
+ * @param listener Listener function
74
+ */
75
+ private off;
76
+ /**
77
+ * Internal: Attach event listeners and propagate to registered listeners.
78
+ */
79
+ private attachEvents;
80
+ /**
81
+ * Internal: Emit SDK-specific events that are not part of Vapi.
82
+ */
83
+ private emit;
84
+ createSimulation(createSimulationParams: CreateSimulationDto): Promise<{
85
+ simulationId: string;
86
+ phase: CreationPhase;
87
+ }>;
88
+ checkSimulationStatus(simulationId: string): Promise<{
89
+ phase: CreationPhase;
90
+ }>;
91
+ getUserSimulations(): Promise<Array<{
92
+ simulationId: string;
93
+ phase: CreationPhase;
94
+ }>>;
95
+ getSimulationDetails(simulationId: string): Promise<SimulationDetailsDto>;
96
+ /**
97
+ * Deletes a simulation (assistant) from the server and Vapi.
98
+ * @param simulationId - MongoDB ObjectId of the simulation
99
+ * @throws 404 if simulation not found
100
+ */
101
+ deleteSimulation(simulationId: string): Promise<void>;
102
+ getCallDetails(callId: string): Promise<CallDTO>;
103
+ getCallRecordings(queryParams: SimulationRecordingsQueryDto): Promise<SimulationRecordingsDto[]>;
104
+ getCallRecording(callId: string): Promise<string>;
105
+ /**
106
+ * Remove all listeners for all call events.
107
+ */
108
+ private removeAllEventListeners;
109
+ /**
110
+ * Starts a call for the given simulation.
111
+ * Polls the backend after call-end until the call is finalized, then emits 'call-details-ready'.
112
+ */
113
+ startCall(simulationId: string): Promise<{
114
+ stopCall: () => void;
115
+ callId: string;
116
+ on: <K extends CallEventNames>(event: K, listener: CallEventListener<K>) => void;
117
+ off: <K extends CallEventNames>(event: K, listener: CallEventListener<K>) => void;
118
+ }>;
119
+ private createCall;
120
+ uploadPdfSlides(file: File | Blob): Promise<string>;
121
+ getRecommendations(): Promise<RecommendationsResponseDto>;
122
+ getSlidesAnalysis(queryParams: PdfSlidesAnalysisQueryDto): Promise<PdfSlidesDto[]>;
123
+ getSlideAnalysis(id: string): Promise<PdfSlideDto>;
124
+ deleteSlideAnalysis(id: string): Promise<void>;
125
+ checkPdfStatus(id: string): Promise<CheckPdfStatusResponse>;
126
+ getAssistantImages(): Promise<AssistantImageDto[]>;
127
+ /**
128
+ * Deletes a call and all associated data (messages, recommendations, recording).
129
+ * Only the owner of the call can delete it.
130
+ * @param callId - MongoDB ObjectId of the call
131
+ * @throws 404 if call not found
132
+ * @throws 403 if the caller is not the call owner
133
+ */
134
+ deleteCall(callId: string): Promise<void>;
135
+ }