@ctchealth/plato-sdk 0.0.9 → 0.0.10

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/README.md CHANGED
@@ -8,11 +8,12 @@ The Plato SDK provides a simple and type-safe way to integrate with the Plato pl
8
8
 
9
9
  ## Features
10
10
 
11
- - 🎭 Create AI personas with customizable professional profiles and personalities
12
- - 🗣️ Real-time voice interactions with AI assistants
13
- - 📊 Comprehensive event system for call management
14
- - 🔒 Type-safe API with full TypeScript support
15
- - 🎯 Medical training simulation configuration
11
+ - Create AI personas with customizable professional profiles and personalities
12
+ - Real-time voice interactions with AI assistants
13
+ - Comprehensive event system for call management
14
+ - Type-safe API with full TypeScript support
15
+ - Medical training simulation configuration
16
+ - Simulation persistence and recovery across page reloads
16
17
 
17
18
  ## Installation
18
19
 
@@ -64,16 +65,10 @@ const simulation = await client.createSimulation({
64
65
  },
65
66
  presentation: 'Oral tablets, 10 tablets per pack',
66
67
  scenario: 'Discussing treatment options for an elderly patient with chronic arthritis',
67
- objectives: [
68
- 'Demonstrate efficacy of Ibuprofen in pain management',
69
- 'Highlight safety profile and contraindications',
70
- 'Encourage patient adherence',
71
- ],
72
- anticipatedObjections: [
73
- 'Concerns about gastrointestinal side effects',
74
- 'Preference for lower-cost generic alternatives',
75
- 'Potential interactions with other medications',
76
- ],
68
+ objectives:
69
+ 'Demonstrate efficacy of Ibuprofen in pain management Highlight safety profile and contraindications Encourage patient adherence',
70
+ anticipatedObjections:
71
+ 'Concerns about gastrointestinal side effects Preference for lower-cost generic alternatives Potential interactions with other medications',
77
72
  });
78
73
 
79
74
  // Check the simulation status - If simulation creation phase is equals to FINISHED, the simulation is ready to use
@@ -161,6 +156,7 @@ Retrieves detailed information about a completed call, including transcript, sum
161
156
  - `metric1Value`, `metric2Value`, `metric3Value`: Values for each metric
162
157
  - `createdAt`: Timestamp when the call was created
163
158
  - `endedAt`: Timestamp when the call ended
159
+ - `callDurationMs`: Duration of the call in milliseconds
164
160
  - And other call-related fields
165
161
 
166
162
  **Example:**
@@ -233,6 +229,60 @@ console.log('Current phase:', status.phase); // e.g., 'FINISHED', 'ERROR', etc.
233
229
  - **Returns:** `{ phase: CreationPhase }` — The current phase of the simulation creation process.
234
230
  - **Typical usage:** Poll this method until the phase is `FINISHED` or `ERROR` before starting a call.
235
231
 
232
+ ## Simulation Persistence
233
+
234
+ Simulations are persisted server-side and can be recovered after page reloads. Store the simulation ID client-side (e.g., localStorage) for quick recovery.
235
+
236
+ ### getSimulationDetails(simulationId: string)
237
+
238
+ Retrieves detailed information about a simulation, including its original configuration.
239
+
240
+ **Returns:** `Promise<SimulationDetailsDto>` containing:
241
+
242
+ - `simulationId`: MongoDB ID
243
+ - `phase`: Current creation phase
244
+ - `assistantId`: The assistant ID (available after creation)
245
+ - `configuration`: Original `CreateSimulationDto`
246
+ - `createdAt`, `updatedAt`: Timestamps
247
+
248
+ **Example:**
249
+
250
+ ```typescript
251
+ // Store simulation ID after creation
252
+ const simulation = await client.createSimulation(config);
253
+ localStorage.setItem('plato_simulation_id', simulation.simulationId);
254
+
255
+ // Recover simulation on page reload
256
+ const simulationId = localStorage.getItem('plato_simulation_id');
257
+ if (simulationId) {
258
+ const details = await client.getSimulationDetails(simulationId);
259
+
260
+ if (details.phase !== CreationPhase.ERROR) {
261
+ // Resume polling if still in progress
262
+ if (details.phase !== CreationPhase.FINISHED) {
263
+ startPolling(details.simulationId);
264
+ }
265
+ } else {
266
+ localStorage.removeItem('plato_simulation_id');
267
+ }
268
+ }
269
+ ```
270
+
271
+ ### getUserSimulations()
272
+
273
+ Retrieves all simulations for the authenticated user. Useful when the simulation ID is not stored locally.
274
+
275
+ **Returns:** `Promise<Array<{ simulationId: string; phase: CreationPhase }>>`
276
+
277
+ **Example:**
278
+
279
+ ```typescript
280
+ const simulations = await client.getUserSimulations();
281
+ const inProgress = simulations.find(
282
+ sim => sim.phase !== CreationPhase.FINISHED && sim.phase !== CreationPhase.ERROR
283
+ );
284
+ ```
285
+
236
286
  ## Event System
237
287
 
238
288
  The SDK provides a comprehensive event system for managing voice calls:
@@ -277,8 +327,8 @@ interface CreateSimulationDto {
277
327
  product: ProductConfig;
278
328
  presentation?: string;
279
329
  scenario: string;
280
- objectives?: string[];
281
- anticipatedObjections?: string[];
330
+ objectives?: string;
331
+ anticipatedObjections?: string;
282
332
  trainingConfiguration: TrainingConfigurationDto;
283
333
  }
284
334
  ```
@@ -298,6 +348,38 @@ interface CharacterCreateDto {
298
348
  }
299
349
  ```
300
350
 
351
+ ### SimulationDetailsDto
352
+
353
+ Detailed simulation information returned by `getSimulationDetails()`:
354
+
355
+ ```typescript
356
+ interface SimulationDetailsDto {
357
+ simulationId: string;
358
+ phase: CreationPhase;
359
+ assistantId: string;
360
+ configuration?: CreateSimulationDto;
361
+ createdAt: Date;
362
+ updatedAt: Date;
363
+ }
364
+ ```
365
+
366
+ ### CreationPhase
367
+
368
+ Enum representing the simulation creation phases:
369
+
370
+ ```typescript
371
+ enum CreationPhase {
372
+ STARTING = 'STARTING',
373
+ CORE = 'CORE',
374
+ BOUNDARIES = 'BOUNDARIES',
375
+ SPEECH_AND_THOUGHT = 'SPEECH_AND_THOUGHT',
376
+ CONVERSATION_EVOLUTION = 'CONVERSATION_EVOLUTION',
377
+ MEMORY = 'MEMORY',
378
+ FINISHED = 'FINISHED',
379
+ ERROR = 'ERROR',
380
+ }
381
+ ```
382
+
301
383
  ## Error Handling
302
384
 
303
385
  The SDK throws errors for invalid configurations and API failures:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctchealth/plato-sdk",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "@vapi-ai/web": "2.1.8",
@@ -11,5 +11,6 @@
11
11
  "typings": "./src/index.d.ts",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
- }
15
- }
14
+ },
15
+ "types": "./src/index.d.ts"
16
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2025 ctcHealth. All rights reserved.
3
+ *
4
+ * This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
5
+ *
6
+ * This source code and all related materials are confidential and proprietary to ctcHealth.
7
+ * Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
8
+ * and may result in disciplinary action and civil and/or criminal penalties.
9
+ *
10
+ * This software is intended solely for authorized use within ctcHealth and its designated partners.
11
+ *
12
+ * For internal use only.
13
+ */
14
+ export * from './lib/plato-sdk';
package/src/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
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
+ tslib_1.__exportStar(require("./lib/plato-sdk"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/plato-sdk/src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,0DAAgC"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * Copyright (c) 2025 ctcHealth. All rights reserved.
3
+ *
4
+ * This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
5
+ *
6
+ * This source code and all related materials are confidential and proprietary to ctcHealth.
7
+ * Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
8
+ * and may result in disciplinary action and civil and/or criminal penalties.
9
+ *
10
+ * This software is intended solely for authorized use within ctcHealth and its designated partners.
11
+ *
12
+ * For internal use only.
13
+ */
14
+ export declare enum YearOfExperience {
15
+ '1-5' = "1-5 years",
16
+ '6-10' = "6-10 years",
17
+ '11-20' = "16-20 years",
18
+ '20+' = "20+ years"
19
+ }
20
+ export declare enum PracticeType {
21
+ Private = "Private Practice",
22
+ Hospital = "Hospital",
23
+ AcademicMedicalCenter = "Academic Medical Center",
24
+ Clinic = "Clinic"
25
+ }
26
+ export declare enum SegmentType {
27
+ Traditionalist = "The Traditionalist",
28
+ Innovator = "The Innovator",
29
+ PatientOrientedPhysician = "The Patient-Oriented Physician",
30
+ FinanciallyDrivenPrescriber = "The Financially-Driven Prescriber",
31
+ EvidencePurist = "The Evidence-Purist",
32
+ CostConsciousPrescriber = "The Cost-Conscious Prescriber"
33
+ }
34
+ export declare enum AssistantVoiceGender {
35
+ Male = "Male",
36
+ Female = "Female"
37
+ }
38
+ export declare class PersonalityAndBehaviourDto {
39
+ riskTolerance: number;
40
+ researchOrientation: number;
41
+ recognitionNeed: number;
42
+ brandLoyalty: number;
43
+ patientEmpathy: number;
44
+ }
45
+ export declare class ProfessionalProfileDto {
46
+ practiceSettings: string;
47
+ yearOfExperience: number;
48
+ specialityAndDepartment: string;
49
+ location: string;
50
+ }
51
+ export declare class ContextDto {
52
+ subSpecialityOrTherapyFocus: string;
53
+ typicalPatientMix: string;
54
+ keyClinicalDrivers: string;
55
+ }
56
+ export declare class CharacterCreateDto {
57
+ name: string;
58
+ professionalProfile: ProfessionalProfileDto;
59
+ segment: SegmentType;
60
+ personalityAndBehaviour: PersonalityAndBehaviourDto;
61
+ context: ContextDto;
62
+ assistantGender?: AssistantVoiceGender;
63
+ }
64
+ export declare class ProductConfig {
65
+ name: string;
66
+ description: string;
67
+ }
68
+ export declare class CreateSimulationDto {
69
+ persona: CharacterCreateDto;
70
+ product: ProductConfig;
71
+ presentation?: string;
72
+ scenario: string;
73
+ objectives?: string;
74
+ anticipatedObjections?: string;
75
+ }
76
+ export type RecordingsLimit = 5 | 10 | 25;
77
+ export declare class SimulationRecordingsQueryDto {
78
+ limit?: RecordingsLimit;
79
+ page?: number;
80
+ sort?: SortOrder;
81
+ }
82
+ export declare enum SortOrder {
83
+ ASC = "asc",
84
+ DESC = "desc"
85
+ }
86
+ export declare enum RecordingStatus {
87
+ STARTED = "STARTED",
88
+ PROCESSING = "PROCESSING",
89
+ FINISHED = "FINISHED",
90
+ FAILED = "FAILED"
91
+ }
92
+ export declare class SimulationRecordingsDto {
93
+ _id: string;
94
+ createdAt: Date;
95
+ recordingStatus?: RecordingStatus;
96
+ }
97
+ export interface CallCreateDto {
98
+ /**
99
+ * Call ID obtained
100
+ */
101
+ callId: string;
102
+ /**
103
+ * Call Assistant ID
104
+ */
105
+ assistantId: string;
106
+ }
107
+ export interface CallDTO {
108
+ /**
109
+ * call ID
110
+ */
111
+ _id: string;
112
+ /**
113
+ * call ID obtained
114
+ */
115
+ callId: string;
116
+ /**
117
+ * call User ID
118
+ */
119
+ platoUserId: string;
120
+ /**
121
+ * call Assistant ID
122
+ */
123
+ assistantId: string;
124
+ /**
125
+ * call summary of the conversation
126
+ */
127
+ summary: string;
128
+ /**
129
+ * call transcript of the conversation
130
+ */
131
+ transcript: string;
132
+ /**
133
+ * call feedback provided by the user
134
+ */
135
+ feedback: string;
136
+ /**
137
+ * Success Evaluation returned by model
138
+ */
139
+ successEvaluation: boolean;
140
+ /**
141
+ * call Recording URL
142
+ */
143
+ recordingUrl: string;
144
+ /**
145
+ * Status of recording processing (e.g., 'STARTED', 'PROCESSING', 'FINISHED', 'FAILED')
146
+ */
147
+ recordingStatus?: RecordingStatus;
148
+ /**
149
+ * Date and Time of the creation of the message
150
+ */
151
+ createdAt: Date;
152
+ /**
153
+ * Date and Time of the creation of the message
154
+ */
155
+ endedAt: Date;
156
+ /**
157
+ * Rating of the call given by the user
158
+ */
159
+ rating: number;
160
+ /**
161
+ * Main strenghts of the user conversation based on the analysis of the AI
162
+ */
163
+ strengths: Array<string>;
164
+ /**
165
+ * Main weak points of the user conversation based on the analysis of the AI
166
+ */
167
+ weaknesses: Array<string>;
168
+ /**
169
+ * Name of Metric for the AI feedback report
170
+ */
171
+ metric1: string;
172
+ /**
173
+ * Name of Metric for the AI feedback report
174
+ */
175
+ metric2: string;
176
+ /**
177
+ * Name of Metric for the AI feedback report
178
+ */
179
+ metric3: string;
180
+ /**
181
+ * AI feedback value for Metric 1
182
+ */
183
+ metric1Value: number;
184
+ /**
185
+ * AI feedback value for Metric 2
186
+ */
187
+ metric2Value: number;
188
+ /**
189
+ * AI feedback value for Metric 3
190
+ */
191
+ metric3Value: number;
192
+ /**
193
+ * AI feedback value for the call score
194
+ */
195
+ score?: number;
196
+ /**
197
+ * Defines if the calls will be consider for the memory feature
198
+ */
199
+ inMemory: boolean;
200
+ /**
201
+ * Duration of the call in milliseconds
202
+ */
203
+ callDurationMs?: number;
204
+ }
205
+ export declare enum CreationPhase {
206
+ STARTING = "STARTING",
207
+ CORE = "CORE",
208
+ BOUNDARIES = "BOUNDARIES",
209
+ SPEECH_AND_THOUGHT = "SPEECH_AND_THOUGHT",
210
+ CONVERSATION_EVOLUTION = "CONVERSATION_EVOLUTION",
211
+ MEMORY = "MEMORY",
212
+ FINISHED = "FINISHED",
213
+ ERROR = "ERROR"
214
+ }
215
+ /**
216
+ * Response DTO for PDF file upload.
217
+ */
218
+ export interface UploadPdfSlidesResponseDto {
219
+ /**
220
+ * The S3 object key where the PDF was saved
221
+ */
222
+ objectKey: string;
223
+ /**
224
+ * The original filename
225
+ */
226
+ filename: string;
227
+ /**
228
+ * The file size in bytes
229
+ */
230
+ size: number;
231
+ /**
232
+ * The content type of the file
233
+ */
234
+ contentType: string;
235
+ }
236
+ export interface SimulationDetailsDto {
237
+ simulationId: string;
238
+ phase: CreationPhase;
239
+ assistantId: string;
240
+ configuration?: CreateSimulationDto;
241
+ createdAt: Date;
242
+ updatedAt: Date;
243
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreationPhase = exports.SimulationRecordingsDto = exports.RecordingStatus = exports.SortOrder = exports.SimulationRecordingsQueryDto = exports.CreateSimulationDto = exports.ProductConfig = exports.CharacterCreateDto = exports.ContextDto = exports.ProfessionalProfileDto = exports.PersonalityAndBehaviourDto = 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
+ class PersonalityAndBehaviourDto {
46
+ riskTolerance;
47
+ researchOrientation;
48
+ recognitionNeed;
49
+ brandLoyalty;
50
+ patientEmpathy;
51
+ }
52
+ exports.PersonalityAndBehaviourDto = PersonalityAndBehaviourDto;
53
+ class ProfessionalProfileDto {
54
+ practiceSettings;
55
+ yearOfExperience;
56
+ specialityAndDepartment;
57
+ location;
58
+ }
59
+ exports.ProfessionalProfileDto = ProfessionalProfileDto;
60
+ class ContextDto {
61
+ subSpecialityOrTherapyFocus;
62
+ typicalPatientMix;
63
+ keyClinicalDrivers;
64
+ }
65
+ exports.ContextDto = ContextDto;
66
+ class CharacterCreateDto {
67
+ name;
68
+ professionalProfile;
69
+ segment;
70
+ personalityAndBehaviour;
71
+ context;
72
+ assistantGender;
73
+ }
74
+ exports.CharacterCreateDto = CharacterCreateDto;
75
+ class ProductConfig {
76
+ name;
77
+ description;
78
+ }
79
+ exports.ProductConfig = ProductConfig;
80
+ class CreateSimulationDto {
81
+ persona;
82
+ product;
83
+ presentation;
84
+ scenario;
85
+ objectives;
86
+ anticipatedObjections;
87
+ }
88
+ exports.CreateSimulationDto = CreateSimulationDto;
89
+ class SimulationRecordingsQueryDto {
90
+ limit;
91
+ page;
92
+ sort;
93
+ }
94
+ exports.SimulationRecordingsQueryDto = SimulationRecordingsQueryDto;
95
+ var SortOrder;
96
+ (function (SortOrder) {
97
+ SortOrder["ASC"] = "asc";
98
+ SortOrder["DESC"] = "desc";
99
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
100
+ var RecordingStatus;
101
+ (function (RecordingStatus) {
102
+ RecordingStatus["STARTED"] = "STARTED";
103
+ RecordingStatus["PROCESSING"] = "PROCESSING";
104
+ RecordingStatus["FINISHED"] = "FINISHED";
105
+ RecordingStatus["FAILED"] = "FAILED";
106
+ })(RecordingStatus || (exports.RecordingStatus = RecordingStatus = {}));
107
+ class SimulationRecordingsDto {
108
+ _id;
109
+ createdAt;
110
+ recordingStatus;
111
+ }
112
+ exports.SimulationRecordingsDto = SimulationRecordingsDto;
113
+ var CreationPhase;
114
+ (function (CreationPhase) {
115
+ CreationPhase["STARTING"] = "STARTING";
116
+ CreationPhase["CORE"] = "CORE";
117
+ CreationPhase["BOUNDARIES"] = "BOUNDARIES";
118
+ CreationPhase["SPEECH_AND_THOUGHT"] = "SPEECH_AND_THOUGHT";
119
+ CreationPhase["CONVERSATION_EVOLUTION"] = "CONVERSATION_EVOLUTION";
120
+ CreationPhase["MEMORY"] = "MEMORY";
121
+ CreationPhase["FINISHED"] = "FINISHED";
122
+ CreationPhase["ERROR"] = "ERROR";
123
+ })(CreationPhase || (exports.CreationPhase = CreationPhase = {}));
124
+ //# 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,MAAa,0BAA0B;IACrC,aAAa,CAAU;IACvB,mBAAmB,CAAU;IAC7B,eAAe,CAAU;IACzB,YAAY,CAAU;IACtB,cAAc,CAAU;CACzB;AAND,gEAMC;AAED,MAAa,sBAAsB;IACjC,gBAAgB,CAAU;IAC1B,gBAAgB,CAAU;IAC1B,uBAAuB,CAAU;IACjC,QAAQ,CAAU;CACnB;AALD,wDAKC;AAED,MAAa,UAAU;IACrB,2BAA2B,CAAU;IACrC,iBAAiB,CAAU;IAC3B,kBAAkB,CAAU;CAC7B;AAJD,gCAIC;AAED,MAAa,kBAAkB;IAC7B,IAAI,CAAU;IACd,mBAAmB,CAA0B;IAC7C,OAAO,CAAe;IACtB,uBAAuB,CAA8B;IACrD,OAAO,CAAc;IACrB,eAAe,CAAwB;CACxC;AAPD,gDAOC;AAED,MAAa,aAAa;IACxB,IAAI,CAAU;IACd,WAAW,CAAU;CACtB;AAHD,sCAGC;AAED,MAAa,mBAAmB;IAC9B,OAAO,CAAsB;IAC7B,OAAO,CAAiB;IACxB,YAAY,CAAU;IACtB,QAAQ,CAAU;IAClB,UAAU,CAAU;IACpB,qBAAqB,CAAU;CAChC;AAPD,kDAOC;AAID,MAAa,4BAA4B;IACvC,KAAK,CAAmB;IACxB,IAAI,CAAU;IACd,IAAI,CAAa;CAClB;AAJD,oEAIC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;IACrB,oCAAiB,CAAA;AACnB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAED,MAAa,uBAAuB;IAClC,GAAG,CAAU;IACb,SAAS,CAAQ;IACjB,eAAe,CAAmB;CACnC;AAJD,0DAIC;AAiHD,IAAY,aASX;AATD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,8BAAa,CAAA;IACb,0CAAyB,CAAA;IACzB,0DAAyC,CAAA;IACzC,kEAAiD,CAAA;IACjD,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACjB,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB"}
@@ -0,0 +1,102 @@
1
+ import { CallDTO, CreateSimulationDto, CreationPhase, SimulationRecordingsDto, SimulationRecordingsQueryDto, UploadPdfSlidesResponseDto, SimulationDetailsDto } from './plato-intefaces';
2
+ export interface ApiClientConfig {
3
+ baseUrl: string;
4
+ token?: string;
5
+ user?: 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
+ }
39
+ export type CallEventNames = keyof CallEventMap;
40
+ export type CallEventListener<K extends CallEventNames> = (payload: CallEventMap[K]) => void;
41
+ export declare class PlatoApiClient {
42
+ private config;
43
+ private http;
44
+ private eventListeners;
45
+ private callControllerInstance?;
46
+ private eventsAttached;
47
+ eventNames: CallEventNames[];
48
+ constructor(config: ApiClientConfig);
49
+ /**
50
+ * Register a listener for a call event with strict typing.
51
+ * @param event Event name
52
+ * @param listener Listener function
53
+ */
54
+ private on;
55
+ /**
56
+ * Remove a listener for a call event with strict typing.
57
+ * @param event Event name
58
+ * @param listener Listener function
59
+ */
60
+ private off;
61
+ /**
62
+ * Internal: Attach event listeners and propagate to registered listeners.
63
+ */
64
+ private attachEvents;
65
+ createSimulation(createSimulationParams: CreateSimulationDto): Promise<{
66
+ simulationId: string;
67
+ phase: CreationPhase;
68
+ }>;
69
+ checkSimulationStatus(simulationId: string): Promise<{
70
+ phase: CreationPhase;
71
+ }>;
72
+ getUserSimulations(): Promise<Array<{
73
+ simulationId: string;
74
+ phase: CreationPhase;
75
+ }>>;
76
+ getSimulationDetails(simulationId: string): Promise<SimulationDetailsDto>;
77
+ getCallDetails(callId: string): Promise<CallDTO>;
78
+ getCallRecordings(queryParams: SimulationRecordingsQueryDto): Promise<SimulationRecordingsDto[]>;
79
+ getCallRecording(callId: string): Promise<string>;
80
+ /**
81
+ * Remove all listeners for all call events.
82
+ */
83
+ private removeAllEventListeners;
84
+ startCall(simulationId: string): Promise<{
85
+ stopCall: () => void;
86
+ callId: string;
87
+ /**
88
+ * Subscribe to call events for this call with strict typing.
89
+ * @param event Event name
90
+ * @param listener Listener function
91
+ */
92
+ on: <K extends CallEventNames>(event: K, listener: CallEventListener<K>) => void;
93
+ /**
94
+ * Unsubscribe from call events for this call with strict typing.
95
+ * @param event Event name
96
+ * @param listener Listener function
97
+ */
98
+ off: <K extends CallEventNames>(event: K, listener: CallEventListener<K>) => void;
99
+ }>;
100
+ private createCall;
101
+ uploadPdfSlides(file: File | Blob): Promise<UploadPdfSlidesResponseDto>;
102
+ }