@vapi-ai/web 3.0.1 → 3.1.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/dist/api.js CHANGED
@@ -1338,6 +1338,41 @@ class Api extends HttpClient {
1338
1338
  secure: true,
1339
1339
  ...params,
1340
1340
  }),
1341
+ /**
1342
+ * No description
1343
+ *
1344
+ * @tags Calls
1345
+ * @name GoalEvaluationCurrentControllerCurrentGet
1346
+ * @summary Get the current goal evaluation for a call
1347
+ * @request GET:/call/{id}/goal-evaluation
1348
+ * @secure
1349
+ */
1350
+ goalEvaluationCurrentControllerCurrentGet: (id, query, params = {}) => this.request({
1351
+ path: `/call/${id}/goal-evaluation`,
1352
+ method: "GET",
1353
+ query: query,
1354
+ secure: true,
1355
+ format: "json",
1356
+ ...params,
1357
+ }),
1358
+ /**
1359
+ * No description
1360
+ *
1361
+ * @tags Calls
1362
+ * @name GoalEvaluationCurrentControllerCurrentBatchGet
1363
+ * @summary Get current goal evaluations for up to 100 call/goal pairs
1364
+ * @request POST:/call/goal-evaluation/batch
1365
+ * @secure
1366
+ */
1367
+ goalEvaluationCurrentControllerCurrentBatchGet: (data, params = {}) => this.request({
1368
+ path: `/call/goal-evaluation/batch`,
1369
+ method: "POST",
1370
+ body: data,
1371
+ secure: true,
1372
+ type: ContentType.Json,
1373
+ format: "json",
1374
+ ...params,
1375
+ }),
1341
1376
  };
1342
1377
  chat = {
1343
1378
  /**
@@ -1670,7 +1705,7 @@ class Api extends HttpClient {
1670
1705
  };
1671
1706
  trafficAllocations = {
1672
1707
  /**
1673
- * @description Creates a new traffic allocation for an assistant, replacing the one currently in effect. To start or adjust a split, send targets naming published versions (such as "v7") with percentages totaling 100; allocationIntent is inferred as 'explicit'. To stop splitting and send every call to the newest published version, send allocationIntent 'follow-latest' with no targets field; stopping always names its intent, so a dropped targets field can never end a split by accident. Traffic splitting is in beta, rolling out to select organizations; requests from organizations without access receive a 403.
1708
+ * @description Creates a new traffic allocation for an assistant, replacing the one currently in effect. To start or adjust a split, send targets naming published versions (such as "v7") with percentages totaling 100; allocationIntent is inferred as 'explicit'. To stop splitting and send every call to the newest published version, send allocationIntent 'follow-latest' with no targets field; stopping always names its intent, so a dropped targets field can never end a split by accident.
1674
1709
  *
1675
1710
  * @tags Traffic Allocations
1676
1711
  * @name TrafficAllocationControllerCreate
@@ -1688,7 +1723,7 @@ class Api extends HttpClient {
1688
1723
  ...params,
1689
1724
  }),
1690
1725
  /**
1691
- * @description The append-only history of an assistant's allocations, newest first. Traffic splitting is in beta, rolling out to select organizations; requests from organizations without access receive a 403.
1726
+ * @description The append-only history of an assistant's allocations, newest first.
1692
1727
  *
1693
1728
  * @tags Traffic Allocations
1694
1729
  * @name TrafficAllocationControllerFindAllPaginated
@@ -1705,7 +1740,7 @@ class Api extends HttpClient {
1705
1740
  ...params,
1706
1741
  }),
1707
1742
  /**
1708
- * @description The allocation currently in effect for the assistant, with its targets. The response carries no allocation field when traffic splitting has never been configured. Traffic splitting is in beta, rolling out to select organizations; requests from organizations without access receive a 403.
1743
+ * @description The allocation currently in effect for the assistant, with its targets. The response carries no allocation field when traffic splitting has never been configured.
1709
1744
  *
1710
1745
  * @tags Traffic Allocations
1711
1746
  * @name TrafficAllocationControllerLatestGet
@@ -1722,7 +1757,7 @@ class Api extends HttpClient {
1722
1757
  ...params,
1723
1758
  }),
1724
1759
  /**
1725
- * @description Per-assistant-version call metrics over a time window: call counts, configured vs actual traffic share, duration, cost per minute, latency, ended reasons, a bucketed timeseries, and optional structured output aggregations. Calls with no assistant version are reported as an 'unversioned' row. Traffic splitting is in beta, rolling out to select organizations; requests from organizations without access receive a 403.
1760
+ * @description Per-assistant-version call metrics over a time window: call counts, configured vs actual traffic share, duration, cost per minute, latency, ended reasons, a bucketed timeseries, and optional structured output aggregations. Calls with no assistant version are reported as an 'unversioned' row.
1726
1761
  *
1727
1762
  * @tags Traffic Allocations
1728
1763
  * @name TrafficAllocationControllerMetricsGet
@@ -1739,7 +1774,7 @@ class Api extends HttpClient {
1739
1774
  ...params,
1740
1775
  }),
1741
1776
  /**
1742
- * @description Returns a single allocation by id, including its targets and actor attribution. Traffic splitting is in beta, rolling out to select organizations; requests from organizations without access receive a 403.
1777
+ * @description Returns a single allocation by id, including its targets and actor attribution.
1743
1778
  *
1744
1779
  * @tags Traffic Allocations
1745
1780
  * @name TrafficAllocationControllerFindOne
@@ -2347,6 +2382,42 @@ class Api extends HttpClient {
2347
2382
  ...params,
2348
2383
  }),
2349
2384
  };
2385
+ callHealth = {
2386
+ /**
2387
+ * No description
2388
+ *
2389
+ * @tags Call Health
2390
+ * @name CallHealthDashboardIssueReadControllerListGet
2391
+ * @summary List one assistant’s issue aggregates in ascending ID transport pages
2392
+ * @request GET:/call-health/assistant/{id}/issue
2393
+ * @secure
2394
+ */
2395
+ callHealthDashboardIssueReadControllerListGet: (id, query, params = {}) => this.request({
2396
+ path: `/call-health/assistant/${id}/issue`,
2397
+ method: "GET",
2398
+ query: query,
2399
+ secure: true,
2400
+ format: "json",
2401
+ ...params,
2402
+ }),
2403
+ /**
2404
+ * No description
2405
+ *
2406
+ * @tags Call Health
2407
+ * @name CallHealthDashboardIssueReadControllerDetailGet
2408
+ * @summary Get full-window issue impact and a bounded daily chart page
2409
+ * @request GET:/call-health/issue/{id}
2410
+ * @secure
2411
+ */
2412
+ callHealthDashboardIssueReadControllerDetailGet: (id, query, params = {}) => this.request({
2413
+ path: `/call-health/issue/${id}`,
2414
+ method: "GET",
2415
+ query: query,
2416
+ secure: true,
2417
+ format: "json",
2418
+ ...params,
2419
+ }),
2420
+ };
2350
2421
  structuredOutput = {
2351
2422
  /**
2352
2423
  * No description
@@ -3132,6 +3203,60 @@ class Api extends HttpClient {
3132
3203
  format: "json",
3133
3204
  ...params,
3134
3205
  }),
3206
+ /**
3207
+ * @description Generate draft test requirements from an assistant's prompt, tools, and handoff configuration. The response includes numbered requirements describing expected behavior and open questions about behavior that needs clarification. Use this endpoint before generating a simulation suite. Review the requirements and resolve any open questions. To revise a draft, send it as `previousDraft` together with natural-language `feedback` describing the changes or answers. Once the requirements are ready, pass them to `POST /eval/simulation/onboarding/suite`. Requests can take up to 2 minutes. Each organization can draft requirements 60 times per UTC day, shared with the dashboard. A 429 `SIMULATION_ONBOARDING_QUOTA_EXCEEDED` response means the daily limit has been reached. Wait until the limit resets at 00:00 UTC before retrying.
3208
+ *
3209
+ * @tags Simulation Suites
3210
+ * @name SimulationOnboardingControllerRequirementsDraft
3211
+ * @summary Draft simulation requirements
3212
+ * @request POST:/eval/simulation/onboarding/requirements
3213
+ * @secure
3214
+ */
3215
+ simulationOnboardingControllerRequirementsDraft: (data, params = {}) => this.request({
3216
+ path: `/eval/simulation/onboarding/requirements`,
3217
+ method: "POST",
3218
+ body: data,
3219
+ secure: true,
3220
+ type: ContentType.Json,
3221
+ format: "json",
3222
+ ...params,
3223
+ }),
3224
+ /**
3225
+ * @description Generate and save a simulation suite from reviewed test requirements, and assign it to an assistant. First draft requirements with `POST /eval/simulation/onboarding/requirements`. The response includes the saved suite, its simulations, and requirement coverage, including any gaps. Requests can take up to 3 minutes. Set a client timeout of at least 200 seconds. Use a unique `idempotencyKey` for each suite generation request. Retrying with the same key does not create a duplicate suite: - On a timeout or a 5xx (502, 504, 524), retry with the same key. You get the saved suite, a 409 while it is still generating, or a fresh generation if the first one never saved. - On a 409 `SIMULATION_ONBOARDING_GENERATION_IN_PROGRESS`, the first request is still generating. Wait `Retry-After` seconds (15) and retry with the same key. - On a 409 `SIMULATION_ONBOARDING_IDEMPOTENCY_KEY_REUSED`, the key was used for a different assistant or requirements. Send a new key. Review the generated simulations and coverage gaps. Revise the suite with `PATCH /eval/simulation/onboarding/suite/{suiteId}`, then run it with `POST /eval/simulation/run`. Each organization can generate 20 suites per UTC day, shared with the dashboard, and 2 at a time. A retry that returns a saved suite does not count toward these limits. On a 429 `SIMULATION_ONBOARDING_CONCURRENCY_LIMITED`, wait `Retry-After` seconds (30) before retrying. On a 429 `SIMULATION_ONBOARDING_QUOTA_EXCEEDED`, wait until the daily limit resets at 00:00 UTC before retrying.
3226
+ *
3227
+ * @tags Simulation Suites
3228
+ * @name SimulationOnboardingControllerSuiteCreate
3229
+ * @summary Generate a simulation suite
3230
+ * @request POST:/eval/simulation/onboarding/suite
3231
+ * @secure
3232
+ */
3233
+ simulationOnboardingControllerSuiteCreate: (data, params = {}) => this.request({
3234
+ path: `/eval/simulation/onboarding/suite`,
3235
+ method: "POST",
3236
+ body: data,
3237
+ secure: true,
3238
+ type: ContentType.Json,
3239
+ format: "json",
3240
+ ...params,
3241
+ }),
3242
+ /**
3243
+ * @description Revise a suite created by `POST /eval/simulation/onboarding/suite`. Remove simulations, rewrite scenarios using natural-language instructions, or set `retryFailed` to regenerate scenarios that failed or exceeded generation limits. The response includes the updated suite and requirement coverage. Requests can take up to 2 minutes. Send a new `patchKey` for each edit. Replaying an applied key changes nothing and returns the current suite, with `failedEditSimulationIds` listing the simulations that edit could not rewrite, so retry a timeout or a 5xx with the same key. A suite remembers its last 50 keys, so never reuse one. Each organization can make 60 edits per UTC day, shared with the dashboard. Requests that only remove simulations and replays of applied edits do not count toward this limit. On a 429 `SIMULATION_ONBOARDING_QUOTA_EXCEEDED`, wait until the daily limit resets at 00:00 UTC before retrying.
3244
+ *
3245
+ * @tags Simulation Suites
3246
+ * @name SimulationOnboardingControllerSuiteUpdate
3247
+ * @summary Edit a generated simulation suite
3248
+ * @request PATCH:/eval/simulation/onboarding/suite/{suiteId}
3249
+ * @secure
3250
+ */
3251
+ simulationOnboardingControllerSuiteUpdate: (suiteId, data, params = {}) => this.request({
3252
+ path: `/eval/simulation/onboarding/suite/${suiteId}`,
3253
+ method: "PATCH",
3254
+ body: data,
3255
+ secure: true,
3256
+ type: ContentType.Json,
3257
+ format: "json",
3258
+ ...params,
3259
+ }),
3135
3260
  /**
3136
3261
  * No description
3137
3262
  *
package/dist/vapi.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ChatCompletionMessageParam } from 'openai/resources';
2
2
  import { DailyCall, DailyAdvancedConfig, DailyFactoryOptions, DailyEventObjectNoPayload, DailyEventObjectRecordingError, DailyEventObjectRecordingStarted, DailyEventObjectRecordingStopped, DailyParticipant, DailyVideoSendSettings } from '@daily-co/daily-js';
3
3
  import EventEmitter from 'events';
4
- import { Call, CreateSquadDTO, CreateAssistantDTO, AssistantOverrides, CreateWorkflowDTO, WorkflowOverrides } from './api';
4
+ import { Call, CreateSquadDTO, CreateAssistantDTO, AssistantOverrides, CreateWebCallDTO, CreateWorkflowDTO, WorkflowOverrides } from './api';
5
5
  export interface EndCallMessage {
6
6
  type: 'end-call';
7
7
  }
@@ -69,9 +69,19 @@ type VapiEventListeners = {
69
69
  'recording-error': (event: DailyEventObjectRecordingError) => void;
70
70
  'recording-upload-completed': (event: DailyEventObjectNoPayload) => void;
71
71
  };
72
+ type VideoRecordingStartMode = NonNullable<CreateWebCallDTO['videoRecordingStartMode']>;
72
73
  type StartCallOptions = {
73
74
  /** Acquire the microphone before creating a backend call. Defaults to true. */
74
75
  microphonePreflightEnabled?: boolean;
76
+ /**
77
+ * Run Daily's Krisp noise cancellation on the microphone
78
+ * in the browser, before the audio leaves the device. Set to `false` to send
79
+ * the raw microphone audio. Defaults to true.
80
+ *
81
+ * Separate from the assistant's server-side `backgroundSpeechDenoisingPlan`,
82
+ * which this option does not change.
83
+ */
84
+ clientSideNoiseCancellationEnabled?: boolean;
75
85
  /**
76
86
  * This determines whether the daily room will be deleted and all participants will be kicked once the user leaves the room.
77
87
  * If set to `false`, the room will be kept alive even after the user leaves, allowing clients to reconnect to the same room.
@@ -81,6 +91,36 @@ type StartCallOptions = {
81
91
  * @example true
82
92
  */
83
93
  roomDeleteOnUserLeaveEnabled?: boolean;
94
+ /**
95
+ * This determines who starts the video recording. Only applies when video
96
+ * recording is enabled (`artifactPlan.videoRecordingEnabled`).
97
+ *
98
+ * - `client`: the web client starts the recording when it joins.
99
+ * - `server`: Vapi starts the recording once the user has joined, so a weak
100
+ * client connection can't stop it from starting. If Vapi can't set up the
101
+ * server-side start, or the start itself fails, the SDK emits
102
+ * `recording-error`.
103
+ *
104
+ * In `server` mode the SDK never calls `startRecording()` itself. If the
105
+ * server-side start couldn't be set up, calling it yourself may still start
106
+ * the recording.
107
+ *
108
+ * Requires a Vapi API that supports this field; older servers reject the
109
+ * request. The server defaults to `client` when it is not set.
110
+ * @example "server"
111
+ */
112
+ videoRecordingStartMode?: VideoRecordingStartMode;
113
+ };
114
+ type ReconnectOptions = {
115
+ /**
116
+ * Run Daily's Krisp noise cancellation on the microphone
117
+ * in the browser. Defaults to the value used by the last `start()` or
118
+ * `reconnect()`, or true if neither set it.
119
+ *
120
+ * Separate from the assistant's server-side `backgroundSpeechDenoisingPlan`,
121
+ * which this option does not change.
122
+ */
123
+ clientSideNoiseCancellationEnabled?: boolean;
84
124
  };
85
125
  type WebCall = {
86
126
  /**
@@ -113,13 +153,21 @@ type WebCall = {
113
153
  };
114
154
  /**
115
155
  * The Vapi WebCall transport. When video recording is enabled, the server
116
- * sets `callToken` to a Daily meeting token that auto-starts the cloud
117
- * recording on join.
156
+ * sets `callToken` to the Daily meeting token to join with. In `client` mode
157
+ * the token auto-starts the cloud recording on join; in `server` mode it
158
+ * starts nothing and Vapi starts the recording. If there is no token, the
159
+ * SDK emits `recording-error` and starts nothing, though `startRecording()`
160
+ * may still start the recording from the client.
161
+ *
162
+ * `videoRecordingStartMode` is `server` when Vapi starts the recording, and
163
+ * is absent when video recording is off or the server-side start couldn't
164
+ * be set up.
118
165
  *
119
166
  * call.transport
120
167
  */
121
168
  transport?: {
122
169
  callToken?: string;
170
+ videoRecordingStartMode?: VideoRecordingStartMode;
123
171
  };
124
172
  };
125
173
  declare class VapiEventEmitter extends EventEmitter {
@@ -142,6 +190,7 @@ export default class Vapi extends VapiEventEmitter {
142
190
  private dailyCallObject;
143
191
  private microphoneTrack;
144
192
  private cancelMicrophonePreflight;
193
+ private clientSideNoiseCancellationEnabled;
145
194
  private microphoneAcquire;
146
195
  private hasEmittedCallEndedStatus;
147
196
  constructor(apiToken: string, apiBaseUrl?: string, dailyCallConfig?: Pick<DailyAdvancedConfig, 'avoidEval' | 'alwaysIncludeMicInPermissionPrompt'>, dailyCallObject?: Pick<DailyFactoryOptions, 'audioSource' | 'startAudioOff'>);
@@ -220,6 +269,16 @@ export default class Vapi extends VapiEventEmitter {
220
269
  * which EventEmitter throws on when nothing is listening.
221
270
  */
222
271
  private emitToConsumer;
272
+ /**
273
+ * Reported in a later task, like Daily's own recording-error: start() or
274
+ * reconnect() has resolved and the caller's await continuation has run, so a
275
+ * listener registered right after it still hears this, and one that calls
276
+ * stop() can't interrupt call setup. Skipped if that call was stopped or
277
+ * replaced.
278
+ */
279
+ private recordingTokenMissingReportSchedule;
280
+ /** The fields are read defensively: the app message is untrusted JSON. */
281
+ private videoRecordingStartFailedReport;
223
282
  /** Drops the reference before removing, so nothing hands out a detached element. */
224
283
  private detachAudioPlayer;
225
284
  /**
@@ -308,10 +367,10 @@ export default class Vapi extends VapiEventEmitter {
308
367
  /**
309
368
  * Reconnects to an active call.
310
369
  *
311
- *
312
370
  * @param webCall
371
+ * @param options
313
372
  */
314
- reconnect(webCall: WebCall): Promise<void>;
373
+ reconnect(webCall: WebCall, options?: ReconnectOptions): Promise<void>;
315
374
  /**
316
375
  * Runs all network connectivity tests for pre-call diagnostics.
317
376
  * Creates a temporary Daily call object for testing purposes.