@ctchealth/plato-sdk 0.0.16 → 0.0.17
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 +86 -0
- package/eslint.config.cjs +121 -0
- package/jest.config.ts +10 -0
- package/package.json +3 -4
- package/project.json +24 -0
- package/src/lib/{constants.d.ts → constants.ts} +3 -3
- package/src/lib/plato-intefaces.ts +431 -0
- package/src/lib/plato-sdk.ts +789 -0
- package/src/lib/utils.ts +72 -0
- package/tsconfig.json +22 -0
- package/tsconfig.lib.json +11 -0
- package/tsconfig.spec.json +10 -0
- package/src/index.js +0 -18
- package/src/index.js.map +0 -1
- package/src/lib/constants.js +0 -20
- package/src/lib/constants.js.map +0 -1
- package/src/lib/plato-intefaces.d.ts +0 -361
- package/src/lib/plato-intefaces.js +0 -172
- package/src/lib/plato-intefaces.js.map +0 -1
- package/src/lib/plato-sdk.d.ts +0 -193
- package/src/lib/plato-sdk.js +0 -643
- package/src/lib/plato-sdk.js.map +0 -1
- package/src/lib/utils.d.ts +0 -24
- package/src/lib/utils.js +0 -70
- package/src/lib/utils.js.map +0 -1
- /package/src/{index.d.ts → index.ts} +0 -0
package/README.md
CHANGED
|
@@ -445,6 +445,24 @@ Retrieves all available assistant images that can be used when creating a simula
|
|
|
445
445
|
const images = await client.getAssistantImages();
|
|
446
446
|
```
|
|
447
447
|
|
|
448
|
+
##### deleteSimulation(simulationId: string)
|
|
449
|
+
|
|
450
|
+
Deletes a simulation and all associated data. This permanently removes the simulation, all its call records, and excludes it from future recommendations analysis.
|
|
451
|
+
|
|
452
|
+
**Parameters:**
|
|
453
|
+
|
|
454
|
+
- `simulationId` (string): The MongoDB `_id` of the simulation to delete
|
|
455
|
+
|
|
456
|
+
**Returns:** `Promise<void>`
|
|
457
|
+
|
|
458
|
+
**Example:**
|
|
459
|
+
|
|
460
|
+
```typescript
|
|
461
|
+
await client.deleteSimulation('507f1f77bcf86cd799439011');
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
**Note:** This action is irreversible. All calls and recordings linked to the simulation will also be deleted.
|
|
465
|
+
|
|
448
466
|
##### getRecommendations()
|
|
449
467
|
|
|
450
468
|
Retrieves recommendations based on the user's recent call performance. Analyzes the 5 most recent calls using a sliding window of 3 calls to identify patterns and provide actionable insights. Calls shorter than 2 minutes are excluded from analysis. No new recommendations are generated if fewer than 3 eligible calls are available.
|
|
@@ -520,6 +538,7 @@ Retrieves detailed information about a simulation, including its original config
|
|
|
520
538
|
- `phase`: Current creation phase
|
|
521
539
|
- `assistantId`: The assistant ID (available after creation)
|
|
522
540
|
- `configuration`: Original `CreateSimulationDto`
|
|
541
|
+
- `simulationBriefing`: Optional `SimulationBriefingDto` with persona description, scenario context, and training objectives (available after creation phase reaches `FINISHED`)
|
|
523
542
|
- `createdAt`, `updatedAt`: Timestamps
|
|
524
543
|
|
|
525
544
|
**Example:**
|
|
@@ -539,6 +558,14 @@ if (simulationId) {
|
|
|
539
558
|
if (details.phase !== CreationPhase.FINISHED) {
|
|
540
559
|
startPolling(details.simulationId);
|
|
541
560
|
}
|
|
561
|
+
|
|
562
|
+
// Access simulation briefing when available
|
|
563
|
+
if (details.simulationBriefing) {
|
|
564
|
+
console.log('Objective:', details.simulationBriefing.objectiveTag);
|
|
565
|
+
console.log('Persona:', details.simulationBriefing.personaDescription.summary);
|
|
566
|
+
console.log('Scenario:', details.simulationBriefing.scenarioContext.summary);
|
|
567
|
+
console.log('Training Goals:', details.simulationBriefing.trainingObjective.keyObjectives);
|
|
568
|
+
}
|
|
542
569
|
} else {
|
|
543
570
|
localStorage.removeItem('plato_simulation_id');
|
|
544
571
|
}
|
|
@@ -1159,11 +1186,55 @@ interface SimulationDetailsDto {
|
|
|
1159
1186
|
phase: CreationPhase;
|
|
1160
1187
|
assistantId: string;
|
|
1161
1188
|
configuration?: CreateSimulationDto;
|
|
1189
|
+
simulationBriefing?: SimulationBriefingDto;
|
|
1162
1190
|
createdAt: Date;
|
|
1163
1191
|
updatedAt: Date;
|
|
1164
1192
|
}
|
|
1165
1193
|
```
|
|
1166
1194
|
|
|
1195
|
+
### SimulationBriefingDto
|
|
1196
|
+
|
|
1197
|
+
Structured briefing data generated by the multi-agent system. This data provides context about the simulation's objectives, persona, and scenario:
|
|
1198
|
+
|
|
1199
|
+
```typescript
|
|
1200
|
+
interface SimulationBriefingDto {
|
|
1201
|
+
objectiveTag: string;
|
|
1202
|
+
personaDescription: PersonaDescriptionDto;
|
|
1203
|
+
scenarioContext: ScenarioContextDto;
|
|
1204
|
+
trainingObjective: TrainingObjectiveDto;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
interface PersonaDescriptionDto {
|
|
1208
|
+
summary: string;
|
|
1209
|
+
details: string[];
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
interface ScenarioContextDto {
|
|
1213
|
+
summary: string;
|
|
1214
|
+
steps: string[];
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
interface TrainingObjectiveDto {
|
|
1218
|
+
summary: string;
|
|
1219
|
+
keyObjectives: string[];
|
|
1220
|
+
}
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
**Example:**
|
|
1224
|
+
|
|
1225
|
+
```typescript
|
|
1226
|
+
const details = await client.getSimulationDetails(simulationId);
|
|
1227
|
+
|
|
1228
|
+
if (details.simulationBriefing) {
|
|
1229
|
+
console.log('Objective:', details.simulationBriefing.objectiveTag);
|
|
1230
|
+
console.log('Persona:', details.simulationBriefing.personaDescription.summary);
|
|
1231
|
+
console.log('Scenario:', details.simulationBriefing.scenarioContext.summary);
|
|
1232
|
+
console.log('Training Goals:', details.simulationBriefing.trainingObjective.keyObjectives);
|
|
1233
|
+
}
|
|
1234
|
+
```
|
|
1235
|
+
|
|
1236
|
+
**Note:** The `simulationBriefing` field is optional and will only be present for simulations created after the briefing feature was implemented.
|
|
1237
|
+
|
|
1167
1238
|
### CreationPhase
|
|
1168
1239
|
|
|
1169
1240
|
Enum representing the simulation creation phases:
|
|
@@ -1296,6 +1367,21 @@ interface AssistantImageDto {
|
|
|
1296
1367
|
}
|
|
1297
1368
|
```
|
|
1298
1369
|
|
|
1370
|
+
### SegmentType
|
|
1371
|
+
|
|
1372
|
+
Enum representing available doctor persona segments:
|
|
1373
|
+
|
|
1374
|
+
```typescript
|
|
1375
|
+
enum SegmentType {
|
|
1376
|
+
Traditionalist = 'The Traditionalist',
|
|
1377
|
+
Innovator = 'The Innovator',
|
|
1378
|
+
PatientOrientedPhysician = 'The Patient-Oriented Physician',
|
|
1379
|
+
FinanciallyDrivenPrescriber = 'The Financially-Driven Prescriber',
|
|
1380
|
+
EvidencePurist = 'The Evidence-Purist',
|
|
1381
|
+
CostConsciousPrescriber = 'The Cost-Conscious Prescriber',
|
|
1382
|
+
}
|
|
1383
|
+
```
|
|
1384
|
+
|
|
1299
1385
|
### AvatarLanguage
|
|
1300
1386
|
|
|
1301
1387
|
Enum representing available avatar languages:
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const { defineConfig, globalIgnores } = require('eslint/config');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin');
|
|
5
|
+
const globals = require('globals');
|
|
6
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
7
|
+
const jest = require('eslint-plugin-jest');
|
|
8
|
+
const js = require('@eslint/js');
|
|
9
|
+
const headers = require('eslint-plugin-headers');
|
|
10
|
+
const { FlatCompat } = require('@eslint/eslintrc');
|
|
11
|
+
const baseRules = require('../../eslint-config-base.cjs');
|
|
12
|
+
|
|
13
|
+
const compat = new FlatCompat({
|
|
14
|
+
baseDirectory: __dirname,
|
|
15
|
+
recommendedConfig: js.configs.recommended,
|
|
16
|
+
allConfig: js.configs.all,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
module.exports = defineConfig([
|
|
20
|
+
globalIgnores([
|
|
21
|
+
'**/.eslintrc.js',
|
|
22
|
+
'src/index.d.ts',
|
|
23
|
+
'scripts/db-migrations/archived/**/*',
|
|
24
|
+
'**/*.spec.ts',
|
|
25
|
+
'**/*.config.js',
|
|
26
|
+
'**/*.config.cjs',
|
|
27
|
+
'**/jest.config.ts',
|
|
28
|
+
]),
|
|
29
|
+
{
|
|
30
|
+
files: ['**/*.ts'],
|
|
31
|
+
plugins: {
|
|
32
|
+
headers,
|
|
33
|
+
},
|
|
34
|
+
rules: {
|
|
35
|
+
'headers/header-format': [
|
|
36
|
+
'error',
|
|
37
|
+
{
|
|
38
|
+
source: 'string',
|
|
39
|
+
content: `Copyright (c) 2025 ctcHealth. All rights reserved.
|
|
40
|
+
|
|
41
|
+
This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
|
|
42
|
+
|
|
43
|
+
This source code and all related materials are confidential and proprietary to ctcHealth.
|
|
44
|
+
Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
|
|
45
|
+
and may result in disciplinary action and civil and/or criminal penalties.
|
|
46
|
+
|
|
47
|
+
This software is intended solely for authorized use within ctcHealth and its designated partners.
|
|
48
|
+
|
|
49
|
+
For internal use only.`,
|
|
50
|
+
style: 'jsdoc',
|
|
51
|
+
trailingNewlines: 1,
|
|
52
|
+
preservePragmas: false,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
extends: compat.extends(
|
|
59
|
+
'plugin:@typescript-eslint/recommended',
|
|
60
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
61
|
+
'plugin:@typescript-eslint/strict'
|
|
62
|
+
),
|
|
63
|
+
|
|
64
|
+
files: ['**/*.ts'],
|
|
65
|
+
ignores: ['**/*.json', '**/*.spec.ts'],
|
|
66
|
+
|
|
67
|
+
plugins: {
|
|
68
|
+
'@typescript-eslint': typescriptEslintEslintPlugin,
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
languageOptions: {
|
|
72
|
+
globals: {
|
|
73
|
+
...globals.node,
|
|
74
|
+
...globals.jest,
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
parser: tsParser,
|
|
78
|
+
ecmaVersion: 10,
|
|
79
|
+
sourceType: 'module',
|
|
80
|
+
|
|
81
|
+
parserOptions: {
|
|
82
|
+
project: path.join(__dirname, 'tsconfig.lib.json'),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
rules: {
|
|
87
|
+
...baseRules.rules, // shared rules
|
|
88
|
+
// project-specific rules
|
|
89
|
+
'@typescript-eslint/ban-ts-comment': 'warn',
|
|
90
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
91
|
+
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
92
|
+
'@typescript-eslint/promise-function-async': ['error'],
|
|
93
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
94
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
95
|
+
semi: ['error', 'always'],
|
|
96
|
+
'@typescript-eslint/unbound-method': 'error',
|
|
97
|
+
'keyword-spacing': ['error'],
|
|
98
|
+
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
99
|
+
'@typescript-eslint/prefer-regexp-exec': 'warn',
|
|
100
|
+
'@typescript-eslint/require-await': 'warn',
|
|
101
|
+
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
102
|
+
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
|
103
|
+
'@typescript-eslint/prefer-ts-expect-error': 'warn',
|
|
104
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
105
|
+
'space-infix-ops': 'off',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
files: ['**/*.spec.ts'],
|
|
110
|
+
extends: compat.extends('plugin:jest/recommended'),
|
|
111
|
+
|
|
112
|
+
plugins: {
|
|
113
|
+
jest,
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
rules: {
|
|
117
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
118
|
+
'jest/unbound-method': 'error',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
]);
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
displayName: 'plato-sdk',
|
|
3
|
+
preset: '../../jest.preset.js',
|
|
4
|
+
testEnvironment: 'node',
|
|
5
|
+
transform: {
|
|
6
|
+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
|
7
|
+
},
|
|
8
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
9
|
+
coverageDirectory: '../../coverage/libs/plato-sdk',
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctchealth/plato-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0",
|
|
6
6
|
"@vapi-ai/web": "2.1.8",
|
|
@@ -12,6 +12,5 @@
|
|
|
12
12
|
"typings": "./src/index.d.ts",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "plato-sdk",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "libs/plato-sdk/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/js:tsc",
|
|
10
|
+
"outputs": ["{options.outputPath}"],
|
|
11
|
+
"options": {
|
|
12
|
+
"outputPath": "dist/libs/plato-sdk",
|
|
13
|
+
"main": "libs/plato-sdk/src/index.ts",
|
|
14
|
+
"tsConfig": "libs/plato-sdk/tsconfig.lib.json",
|
|
15
|
+
"assets": ["libs/plato-sdk/*.md"]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"nx-release-publish": {
|
|
19
|
+
"options": {
|
|
20
|
+
"packageRoot": "dist/{projectRoot}"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
*
|
|
12
12
|
* For internal use only.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
14
|
+
export const MAX_PDF_FILE_SIZE = 20 * 1024 * 1024; // 20MB
|
|
15
|
+
export const ALLOWED_PDF_MIME_TYPES = ['application/pdf'];
|
|
16
|
+
export const MAX_PDF_PAGES = 100;
|