@vapi-ai/web 1.2.0 → 1.4.0
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/api.ts +21 -0
- package/dist/api.d.ts +19 -0
- package/dist/vapi.js +22 -4
- package/package.json +2 -2
- package/vapi.ts +25 -4
package/api.ts
CHANGED
|
@@ -1811,6 +1811,14 @@ export interface AnalysisPlan {
|
|
|
1811
1811
|
structuredDataSchema?: JsonSchema;
|
|
1812
1812
|
}
|
|
1813
1813
|
|
|
1814
|
+
export interface ArtifactPlan {
|
|
1815
|
+
/**
|
|
1816
|
+
* This sets whether the video is recorded with Daily. Defaults to false.
|
|
1817
|
+
* @example true
|
|
1818
|
+
*/
|
|
1819
|
+
videoRecordingEnabled?: boolean;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1814
1822
|
export interface CreateAssistantDTO {
|
|
1815
1823
|
/** These are the options for the assistant's transcriber. */
|
|
1816
1824
|
transcriber?: DeepgramTranscriber | TalkscriberTranscriber;
|
|
@@ -1981,6 +1989,7 @@ export interface CreateAssistantDTO {
|
|
|
1981
1989
|
*/
|
|
1982
1990
|
serverUrlSecret?: string;
|
|
1983
1991
|
analysisPlan?: AnalysisPlan;
|
|
1992
|
+
artifactPlan?: ArtifactPlan;
|
|
1984
1993
|
}
|
|
1985
1994
|
|
|
1986
1995
|
export interface Assistant {
|
|
@@ -2153,6 +2162,7 @@ export interface Assistant {
|
|
|
2153
2162
|
*/
|
|
2154
2163
|
serverUrlSecret?: string;
|
|
2155
2164
|
analysisPlan?: AnalysisPlan;
|
|
2165
|
+
artifactPlan?: ArtifactPlan;
|
|
2156
2166
|
/** This is the unique identifier for the assistant. */
|
|
2157
2167
|
id: string;
|
|
2158
2168
|
/** This is the unique identifier for the org that this assistant belongs to. */
|
|
@@ -2339,6 +2349,7 @@ export interface UpdateAssistantDTO {
|
|
|
2339
2349
|
*/
|
|
2340
2350
|
serverUrlSecret?: string;
|
|
2341
2351
|
analysisPlan?: AnalysisPlan;
|
|
2352
|
+
artifactPlan?: ArtifactPlan;
|
|
2342
2353
|
}
|
|
2343
2354
|
|
|
2344
2355
|
export interface AnalysisCostBreakdown {
|
|
@@ -2394,6 +2405,11 @@ export interface Analysis {
|
|
|
2394
2405
|
successEvaluation?: string;
|
|
2395
2406
|
}
|
|
2396
2407
|
|
|
2408
|
+
export interface Artifact {
|
|
2409
|
+
/** Video recording url if assistant.artifactPlan.videoRecordingEnabled was set to true */
|
|
2410
|
+
videoRecordingUrl?: string;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2397
2413
|
export interface PhoneCallTwilioDetails {
|
|
2398
2414
|
statusCallbackEvent?: 'initiated' | 'ringing' | 'answered' | 'completed';
|
|
2399
2415
|
machineDetection?: 'Enable' | 'DetectMessageEnd';
|
|
@@ -2598,6 +2614,7 @@ export interface OverrideAssistantDTO {
|
|
|
2598
2614
|
*/
|
|
2599
2615
|
serverUrlSecret?: string;
|
|
2600
2616
|
analysisPlan?: AnalysisPlan;
|
|
2617
|
+
artifactPlan?: ArtifactPlan;
|
|
2601
2618
|
}
|
|
2602
2619
|
|
|
2603
2620
|
export interface SquadMemberDTO {
|
|
@@ -2803,6 +2820,10 @@ export interface Call {
|
|
|
2803
2820
|
stereoRecordingUrl?: string;
|
|
2804
2821
|
/** This is the analysis of the call. Customize the analysis by setting `assistant.analysisPlan`. */
|
|
2805
2822
|
analysis?: Analysis;
|
|
2823
|
+
/** This is the artifacts related to the call. Customize the analysis by setting `assistant.artifactPlan`. */
|
|
2824
|
+
artifact?: Artifact;
|
|
2825
|
+
/** This stores a copy of assistant.artifactPlan. */
|
|
2826
|
+
artifactPlan?: ArtifactPlan;
|
|
2806
2827
|
/** These are the messages that were spoken during the call. */
|
|
2807
2828
|
messages?: object[];
|
|
2808
2829
|
/**
|
package/dist/api.d.ts
CHANGED
|
@@ -1205,6 +1205,13 @@ export interface AnalysisPlan {
|
|
|
1205
1205
|
*/
|
|
1206
1206
|
structuredDataSchema?: JsonSchema;
|
|
1207
1207
|
}
|
|
1208
|
+
export interface ArtifactPlan {
|
|
1209
|
+
/**
|
|
1210
|
+
* This sets whether the video is recorded with Daily. Defaults to false.
|
|
1211
|
+
* @example true
|
|
1212
|
+
*/
|
|
1213
|
+
videoRecordingEnabled?: boolean;
|
|
1214
|
+
}
|
|
1208
1215
|
export interface CreateAssistantDTO {
|
|
1209
1216
|
/** These are the options for the assistant's transcriber. */
|
|
1210
1217
|
transcriber?: DeepgramTranscriber | TalkscriberTranscriber;
|
|
@@ -1337,6 +1344,7 @@ export interface CreateAssistantDTO {
|
|
|
1337
1344
|
*/
|
|
1338
1345
|
serverUrlSecret?: string;
|
|
1339
1346
|
analysisPlan?: AnalysisPlan;
|
|
1347
|
+
artifactPlan?: ArtifactPlan;
|
|
1340
1348
|
}
|
|
1341
1349
|
export interface Assistant {
|
|
1342
1350
|
/** These are the options for the assistant's transcriber. */
|
|
@@ -1470,6 +1478,7 @@ export interface Assistant {
|
|
|
1470
1478
|
*/
|
|
1471
1479
|
serverUrlSecret?: string;
|
|
1472
1480
|
analysisPlan?: AnalysisPlan;
|
|
1481
|
+
artifactPlan?: ArtifactPlan;
|
|
1473
1482
|
/** This is the unique identifier for the assistant. */
|
|
1474
1483
|
id: string;
|
|
1475
1484
|
/** This is the unique identifier for the org that this assistant belongs to. */
|
|
@@ -1617,6 +1626,7 @@ export interface UpdateAssistantDTO {
|
|
|
1617
1626
|
*/
|
|
1618
1627
|
serverUrlSecret?: string;
|
|
1619
1628
|
analysisPlan?: AnalysisPlan;
|
|
1629
|
+
artifactPlan?: ArtifactPlan;
|
|
1620
1630
|
}
|
|
1621
1631
|
export interface AnalysisCostBreakdown {
|
|
1622
1632
|
/** This is the cost to summarize the call. */
|
|
@@ -1668,6 +1678,10 @@ export interface Analysis {
|
|
|
1668
1678
|
/** This is the evaluation of the call. Customize by setting `assistant.analysisPlan.successEvaluationPrompt` and/or `assistant.analysisPlan.successEvaluationRubric`. */
|
|
1669
1679
|
successEvaluation?: string;
|
|
1670
1680
|
}
|
|
1681
|
+
export interface Artifact {
|
|
1682
|
+
/** Video recording url if assistant.artifactPlan.videoRecordingEnabled was set to true */
|
|
1683
|
+
videoRecordingUrl?: string;
|
|
1684
|
+
}
|
|
1671
1685
|
export interface PhoneCallTwilioDetails {
|
|
1672
1686
|
statusCallbackEvent?: 'initiated' | 'ringing' | 'answered' | 'completed';
|
|
1673
1687
|
machineDetection?: 'Enable' | 'DetectMessageEnd';
|
|
@@ -1833,6 +1847,7 @@ export interface OverrideAssistantDTO {
|
|
|
1833
1847
|
*/
|
|
1834
1848
|
serverUrlSecret?: string;
|
|
1835
1849
|
analysisPlan?: AnalysisPlan;
|
|
1850
|
+
artifactPlan?: ArtifactPlan;
|
|
1836
1851
|
}
|
|
1837
1852
|
export interface SquadMemberDTO {
|
|
1838
1853
|
/** This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead. */
|
|
@@ -1956,6 +1971,10 @@ export interface Call {
|
|
|
1956
1971
|
stereoRecordingUrl?: string;
|
|
1957
1972
|
/** This is the analysis of the call. Customize the analysis by setting `assistant.analysisPlan`. */
|
|
1958
1973
|
analysis?: Analysis;
|
|
1974
|
+
/** This is the artifacts related to the call. Customize the analysis by setting `assistant.artifactPlan`. */
|
|
1975
|
+
artifact?: Artifact;
|
|
1976
|
+
/** This stores a copy of assistant.artifactPlan. */
|
|
1977
|
+
artifactPlan?: ArtifactPlan;
|
|
1959
1978
|
/** These are the messages that were spoken during the call. */
|
|
1960
1979
|
messages?: object[];
|
|
1961
1980
|
/**
|
package/dist/vapi.js
CHANGED
|
@@ -25,13 +25,13 @@ async function buildAudioPlayer(track, participantId) {
|
|
|
25
25
|
await startPlayer(player, track);
|
|
26
26
|
return player;
|
|
27
27
|
}
|
|
28
|
-
function subscribeToTracks(e, call) {
|
|
28
|
+
function subscribeToTracks(e, call, isVideoRecordingEnabled) {
|
|
29
29
|
if (e.participant.local)
|
|
30
30
|
return;
|
|
31
31
|
call.updateParticipant(e.participant.session_id, {
|
|
32
32
|
setSubscribedTracks: {
|
|
33
33
|
audio: true,
|
|
34
|
-
video:
|
|
34
|
+
video: isVideoRecordingEnabled,
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
}
|
|
@@ -90,13 +90,18 @@ class Vapi extends VapiEventEmitter {
|
|
|
90
90
|
if (this.call) {
|
|
91
91
|
this.cleanup();
|
|
92
92
|
}
|
|
93
|
+
const isVideoRecordingEnabled = webCall?.artifactPlan?.videoRecordingEnabled ??
|
|
94
|
+
false;
|
|
93
95
|
this.call = daily_js_1.default.createCallObject({
|
|
94
96
|
audioSource: true,
|
|
95
|
-
videoSource:
|
|
97
|
+
videoSource: isVideoRecordingEnabled,
|
|
96
98
|
});
|
|
97
99
|
this.call.iframe()?.style.setProperty('display', 'none');
|
|
98
100
|
this.call.on('left-meeting', () => {
|
|
99
101
|
this.emit('call-end');
|
|
102
|
+
if (isVideoRecordingEnabled) {
|
|
103
|
+
this.call?.stopRecording();
|
|
104
|
+
}
|
|
100
105
|
this.cleanup();
|
|
101
106
|
});
|
|
102
107
|
this.call.on('participant-left', (e) => {
|
|
@@ -106,6 +111,9 @@ class Vapi extends VapiEventEmitter {
|
|
|
106
111
|
});
|
|
107
112
|
this.call.on('error', (error) => {
|
|
108
113
|
this.emit('error', error);
|
|
114
|
+
if (isVideoRecordingEnabled) {
|
|
115
|
+
this.call?.stopRecording();
|
|
116
|
+
}
|
|
109
117
|
});
|
|
110
118
|
this.call.on('camera-error', (error) => {
|
|
111
119
|
this.emit('error', error);
|
|
@@ -125,12 +133,22 @@ class Vapi extends VapiEventEmitter {
|
|
|
125
133
|
this.call.on('participant-joined', (e) => {
|
|
126
134
|
if (!e || !this.call)
|
|
127
135
|
return;
|
|
128
|
-
subscribeToTracks(e, this.call);
|
|
136
|
+
subscribeToTracks(e, this.call, isVideoRecordingEnabled);
|
|
129
137
|
});
|
|
130
138
|
await this.call.join({
|
|
131
139
|
url: webCall.webCallUrl,
|
|
132
140
|
subscribeToTracksAutomatically: false,
|
|
133
141
|
});
|
|
142
|
+
if (isVideoRecordingEnabled) {
|
|
143
|
+
await this.call.startRecording({
|
|
144
|
+
width: 1280,
|
|
145
|
+
height: 720,
|
|
146
|
+
backgroundColor: '#FF1F2D3D',
|
|
147
|
+
layout: {
|
|
148
|
+
preset: 'default',
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
134
152
|
this.call.startRemoteParticipantsAudioLevelObserver(100);
|
|
135
153
|
this.call.on('remote-participants-audio-level', (e) => {
|
|
136
154
|
if (e)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vapi-ai/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/vapi.js",
|
|
6
6
|
"types": "dist/vapi.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/VapiAI/web#readme",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@daily-co/daily-js": "^0.
|
|
25
|
+
"@daily-co/daily-js": "^0.66.0",
|
|
26
26
|
"@vapi-ai/web": "^1.0.263",
|
|
27
27
|
"events": "^3.3.0"
|
|
28
28
|
},
|
package/vapi.ts
CHANGED
|
@@ -29,13 +29,13 @@ async function buildAudioPlayer(track: any, participantId: string) {
|
|
|
29
29
|
await startPlayer(player, track);
|
|
30
30
|
return player;
|
|
31
31
|
}
|
|
32
|
-
function subscribeToTracks(e: DailyEventObjectParticipant, call: DailyCall) {
|
|
32
|
+
function subscribeToTracks(e: DailyEventObjectParticipant, call: DailyCall, isVideoRecordingEnabled?: boolean) {
|
|
33
33
|
if (e.participant.local) return;
|
|
34
34
|
|
|
35
35
|
call.updateParticipant(e.participant.session_id, {
|
|
36
36
|
setSubscribedTracks: {
|
|
37
37
|
audio: true,
|
|
38
|
-
video:
|
|
38
|
+
video: isVideoRecordingEnabled,
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -145,14 +145,21 @@ export default class Vapi extends VapiEventEmitter {
|
|
|
145
145
|
if (this.call) {
|
|
146
146
|
this.cleanup();
|
|
147
147
|
}
|
|
148
|
+
const isVideoRecordingEnabled =
|
|
149
|
+
webCall?.artifactPlan?.videoRecordingEnabled ??
|
|
150
|
+
false;
|
|
151
|
+
|
|
148
152
|
this.call = DailyIframe.createCallObject({
|
|
149
153
|
audioSource: true,
|
|
150
|
-
videoSource:
|
|
154
|
+
videoSource: isVideoRecordingEnabled,
|
|
151
155
|
});
|
|
152
156
|
this.call.iframe()?.style.setProperty('display', 'none');
|
|
153
157
|
|
|
154
158
|
this.call.on('left-meeting', () => {
|
|
155
159
|
this.emit('call-end');
|
|
160
|
+
if (isVideoRecordingEnabled) {
|
|
161
|
+
this.call?.stopRecording();
|
|
162
|
+
}
|
|
156
163
|
this.cleanup();
|
|
157
164
|
});
|
|
158
165
|
|
|
@@ -163,6 +170,9 @@ export default class Vapi extends VapiEventEmitter {
|
|
|
163
170
|
|
|
164
171
|
this.call.on('error', (error: any) => {
|
|
165
172
|
this.emit('error', error);
|
|
173
|
+
if (isVideoRecordingEnabled) {
|
|
174
|
+
this.call?.stopRecording();
|
|
175
|
+
}
|
|
166
176
|
});
|
|
167
177
|
|
|
168
178
|
this.call.on('camera-error', (error: any) => {
|
|
@@ -182,7 +192,7 @@ export default class Vapi extends VapiEventEmitter {
|
|
|
182
192
|
|
|
183
193
|
this.call.on('participant-joined', (e) => {
|
|
184
194
|
if (!e || !this.call) return;
|
|
185
|
-
subscribeToTracks(e, this.call);
|
|
195
|
+
subscribeToTracks(e, this.call, isVideoRecordingEnabled);
|
|
186
196
|
});
|
|
187
197
|
|
|
188
198
|
await this.call.join({
|
|
@@ -190,6 +200,17 @@ export default class Vapi extends VapiEventEmitter {
|
|
|
190
200
|
subscribeToTracksAutomatically: false,
|
|
191
201
|
});
|
|
192
202
|
|
|
203
|
+
if (isVideoRecordingEnabled) {
|
|
204
|
+
await this.call.startRecording({
|
|
205
|
+
width: 1280,
|
|
206
|
+
height: 720,
|
|
207
|
+
backgroundColor: '#FF1F2D3D',
|
|
208
|
+
layout: {
|
|
209
|
+
preset: 'default',
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
193
214
|
this.call.startRemoteParticipantsAudioLevelObserver(100);
|
|
194
215
|
|
|
195
216
|
this.call.on('remote-participants-audio-level', (e) => {
|