@aiqa/sdk 2.1.0-develop.3 → 2.1.0-develop.4

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
@@ -10,20 +10,28 @@ A TypeScript/JavaScript SDK for interacting with the AIQA WebSocket service. Thi
10
10
  - [API Reference](#api-reference)
11
11
  - [Connection Management](#connection-management)
12
12
  - [Application Management](#application-management)
13
- - [Recording Management](#recording-management)
14
13
  - [Fact Management](#fact-management)
14
+ - [Recording Management](#recording-management)
15
15
  - [Event Handling](#event-handling)
16
16
  - [Verification lifecycle](#verification-lifecycle)
17
17
  - [Types](#types)
18
+ - [Application](#application)
19
+ - [ApplicationVerificationSummary](#applicationverificationsummary)
20
+ - [ApplicationVerificationStatus](#applicationverificationstatus)
21
+ - [ApplicationFact](#applicationfact)
22
+ - [ApplicationFactInput](#applicationfactinput)
18
23
  - [AddFactResult](#addfactresult)
19
24
  - [VerificationStatus](#verificationstatus)
20
25
  - [FactVerifiedPayload](#factverifiedpayload)
26
+ - [FactUpdateEvent](#factupdateevent)
21
27
  - [FlagFactResult](#flagfactresult)
28
+ - [ConversationLanguage](#conversationlanguage)
22
29
  - [UpdateConversationInput](#updateconversationinput)
23
30
  - [UpdateConversationResult](#updateconversationresult)
24
31
  - [Examples](#examples)
25
32
  - [Error Handling](#error-handling)
26
- - [Semantic Versioning](#semantic-versioning)
33
+ - [Version Requirements](#version-requirements)
34
+ - [License](#license)
27
35
 
28
36
  ## Installation
29
37
 
@@ -65,6 +73,14 @@ sdk.on("error", (error) => {
65
73
  new AiQaSdk(applicationId, applicationSecret, url?)
66
74
  ```
67
75
 
76
+ **Parameters:**
77
+
78
+ - `applicationId: string` - your application id
79
+ - `applicationSecret: string` - your application secret
80
+ - `url?: string` - the AIQA service endpoint. Pass it explicitly: the
81
+ built-in fallback is a local development address, so omitting it in a
82
+ deployed app connects to `localhost` instead of the service.
83
+
68
84
  ## API Reference
69
85
 
70
86
  ### Connection Management
@@ -73,6 +89,11 @@ new AiQaSdk(applicationId, applicationSecret, url?)
73
89
 
74
90
  Establishes a WebSocket connection to the AIQA service.
75
91
 
92
+ **Returns:**
93
+
94
+ - `void` — connection progress is reported through the `connect`,
95
+ `authenticated`, and `error` events.
96
+
76
97
  ```typescript
77
98
  sdk.connect();
78
99
  ```
@@ -81,6 +102,10 @@ sdk.connect();
81
102
 
82
103
  Closes the WebSocket connection.
83
104
 
105
+ **Returns:**
106
+
107
+ - `void`
108
+
84
109
  ```typescript
85
110
  sdk.disconnect();
86
111
  ```
@@ -89,20 +114,70 @@ sdk.disconnect();
89
114
 
90
115
  #### `getApplication()`
91
116
 
92
- Returns the cached application loaded during authentication.
93
- If authentication hasn't completed yet, this throws. Use the `authenticated` event to know when it's ready.
117
+ Returns the application, its conversation participants, and the current
118
+ verification tally for the call.
119
+
120
+ **Returns:**
121
+
122
+ - `Promise<`[`Application`](#application)`>`
123
+
124
+ ```typescript
125
+ {
126
+ application_id: string;
127
+ client_name: string;
128
+ client_phone_number: string;
129
+ agent_id: string;
130
+ agent_first_name: string;
131
+ agent_last_name: string;
132
+ verification?: ApplicationVerificationSummary;
133
+ }
134
+ ```
135
+
136
+ The identity fields are read fresh, so an `updateConversation()` earlier in
137
+ the call is reflected. It **rejects** if authentication hasn't completed yet
138
+ — wait for the `authenticated` event before calling it — and it rejects on a
139
+ failed request rather than quietly handing back older values.
94
140
 
95
141
  ```typescript
96
142
  const application = await sdk.getApplication();
143
+
144
+ console.log(application.application_id, application.client_name);
145
+
146
+ if (application.verification) {
147
+ const v = application.verification;
148
+ console.log(v.status, `${v.count_errors} errors`);
149
+ }
97
150
  ```
98
151
 
152
+ ##### Reading `verification` during a live call
153
+
154
+ The summary is computed when you ask for it, so it moves as the call
155
+ progresses. Two things to know before you render it:
156
+
157
+ - **Most facts start in `count_pending`.** A fact is pending from the moment
158
+ you add it until the server reaches a verdict on it, so early in a call
159
+ nearly everything sits there and drains into the other counters as the call
160
+ proceeds. `count_not_asked` means the question was genuinely never asked; it
161
+ does not absorb the ones still in flight.
162
+ - **`count_total` is the total, not a pass count.** It is every fact on the
163
+ application, verdict or not, so `count_total - count_errors` is _not_ the
164
+ number that passed — the pending ones are in there too.
165
+ - **`status` only reflects answers.** A skipped question never raises it, so a
166
+ call where nothing was asked and nothing was wrong reads `no_errors`. Read
167
+ the counters, not just the status, if "incomplete" matters to you.
168
+ - **`verification` is absent only against a server that predates it**, in which
169
+ case this method returns the identity fields it cached at authentication.
170
+ Every other failure — a rejected request, a dropped socket, a server-side
171
+ error — rejects instead, so an absent `verification` always means "this
172
+ server has no summary to give", never "something went wrong just now".
173
+
99
174
  #### `setConversationProduct(product)`
100
175
 
101
176
  Sets the conversation product using a valid product code.
102
177
 
103
178
  **Parameters:**
104
179
 
105
- - `product: string` - product code (from the `service.code` catalog)
180
+ - `product: string` - product code; the accepted values for your account are listed in the AIQA dashboard
106
181
 
107
182
  **Returns:**
108
183
 
@@ -187,6 +262,11 @@ fact resolves with `is_valid_answer: false` and (where the backend
187
262
  provides it) `verification_status: "unmatched"`.
188
263
  Reject paths are reserved for transport / protocol errors.
189
264
 
265
+ **Returns:**
266
+
267
+ - `Promise<`[`AddFactResult`](#addfactresult)`>` — resolves once the fact
268
+ reaches a terminal `verification_status`.
269
+
190
270
  **Parameters:**
191
271
 
192
272
  - `fact: ApplicationFactInput`
@@ -269,13 +349,19 @@ otherwise `id`. So:
269
349
  send a stable `questionId`. Otherwise each call looks like a new question and
270
350
  you lose the features above.
271
351
  - Once you've picked an identity for a question, don't change it. If you must
272
- rename, coordinate with the team owning the dashboard so remaps and
273
- historical signals can be migrated.
352
+ rename, contact AIQA support first so remaps and historical signals can
353
+ be migrated.
274
354
 
275
355
  #### `getFacts()`
276
356
 
277
357
  Retrieves all facts for the application (Promise-based). Each fact includes a `metadata` field containing whatever was passed to `addFact()`. Facts added without `metadata` return `{}`.
278
358
 
359
+ **Returns:**
360
+
361
+ - `Promise<`[`ApplicationFact[]`](#applicationfact)`>` — every fact of the
362
+ application, each with its current `question_status` /
363
+ `verification_status`.
364
+
279
365
  ```typescript
280
366
  const facts = await sdk.getFacts();
281
367
  facts.forEach((fact) => {
@@ -304,7 +390,11 @@ console.log(result.success); // true
304
390
 
305
391
  #### `startRecording()`
306
392
 
307
- Starts audio recording (Promise-based).
393
+ Starts audio recording.
394
+
395
+ **Returns:**
396
+
397
+ - `Promise<boolean>` — `true` once the server has started recording.
308
398
 
309
399
  ```typescript
310
400
  const started = await sdk.startRecording();
@@ -312,7 +402,11 @@ const started = await sdk.startRecording();
312
402
 
313
403
  #### `stopRecording()`
314
404
 
315
- Stops audio recording (Promise-based).
405
+ Stops audio recording.
406
+
407
+ **Returns:**
408
+
409
+ - `Promise<boolean>` — `true` once the server has stopped recording.
316
410
 
317
411
  ```typescript
318
412
  const stopped = await sdk.stopRecording();
@@ -320,7 +414,11 @@ const stopped = await sdk.stopRecording();
320
414
 
321
415
  #### `isRecordingNow()`
322
416
 
323
- Checks if recording is currently active (Promise-based).
417
+ Checks if recording is currently active.
418
+
419
+ **Returns:**
420
+
421
+ - `Promise<boolean>` — `true` while a recording is in progress.
324
422
 
325
423
  ```typescript
326
424
  const isRecording = await sdk.isRecordingNow();
@@ -332,6 +430,10 @@ const isRecording = await sdk.isRecordingNow();
332
430
 
333
431
  Registers an event listener. Call `connect()` before `on()`.
334
432
 
433
+ **Returns:**
434
+
435
+ - `void`
436
+
335
437
  **Available Events:**
336
438
 
337
439
  - `connect` - Socket.IO connection established
@@ -397,13 +499,18 @@ Rules for consumers:
397
499
  The enum is additive — older SDK builds must fall through gracefully
398
500
  when the backend ships a new state.
399
501
  - **`pending_confirmation_*` is never terminal.** The wire-visible
400
- latency penalty is bounded by `settling_window_ms` on the server
401
- (default 2000 ms). The held verdict can flip — that's the whole
402
- point — so don't treat it as a commit.
502
+ latency penalty is bounded by a short server-side settling window
503
+ (currently around 2s; not part of the SDK contract). The held verdict
504
+ can flip — that's the whole point — so don't treat it as a commit.
403
505
 
404
506
  #### `off(eventName, callback?)`
405
507
 
406
- Removes an event listener.
508
+ Removes an event listener. Omit `callback` to remove every listener
509
+ registered for the event.
510
+
511
+ **Returns:**
512
+
513
+ - `void`
407
514
 
408
515
  ```typescript
409
516
  sdk.off("connect");
@@ -413,6 +520,10 @@ sdk.off("connect");
413
520
 
414
521
  ### Application
415
522
 
523
+ Returned by [`getApplication()`](#getapplication): the application, the two
524
+ participants of the conversation, and the verification tally at the moment of
525
+ the call.
526
+
416
527
  ```typescript
417
528
  type Application = {
418
529
  application_id: string;
@@ -421,9 +532,61 @@ type Application = {
421
532
  agent_id: string;
422
533
  agent_first_name: string;
423
534
  agent_last_name: string;
535
+ // Absent on servers that predate this field.
536
+ verification?: ApplicationVerificationSummary;
424
537
  };
425
538
  ```
426
539
 
540
+ ### ApplicationVerificationSummary
541
+
542
+ ```typescript
543
+ type ApplicationVerificationSummary = {
544
+ status: ApplicationVerificationStatus;
545
+
546
+ // Facts whose answer did not match the expected one.
547
+ count_errors: number;
548
+
549
+ // Subset of count_errors whose question is marked critical.
550
+ count_critical_errors: number;
551
+
552
+ // Every fact on the application, verdict or not. Neither a pass count nor a
553
+ // count of what has been evaluated: the two counters below are subsets of
554
+ // it, not separate buckets.
555
+ count_total: number;
556
+
557
+ // Facts whose question was genuinely never asked. Does not include the ones
558
+ // still awaiting a verdict — those are count_pending.
559
+ count_not_asked: number;
560
+
561
+ // Subset of count_not_asked whose question is marked critical.
562
+ count_critical_not_asked: number;
563
+
564
+ // Facts added but not yet resolved. Most of the call's facts sit here early
565
+ // on and drain as verdicts land.
566
+ count_pending: number;
567
+
568
+ // Facts the conduct review flagged. Independent of the answer verdict — a
569
+ // matched fact can still be suspicious.
570
+ count_suspicious: number;
571
+ };
572
+ ```
573
+
574
+ ### ApplicationVerificationStatus
575
+
576
+ Rolled-up verdict over the answers, for the whole application. Distinct from
577
+ [`VerificationStatus`](#verificationstatus), which describes a single fact.
578
+ Questions that were never asked do not raise it.
579
+
580
+ ```typescript
581
+ type ApplicationVerificationStatus =
582
+ // At least one critical fact failed.
583
+ | "critical_errors"
584
+ // At least one fact failed, none of them critical.
585
+ | "errors"
586
+ // No fact has failed — which is not the same as "everything was asked".
587
+ | "no_errors";
588
+ ```
589
+
427
590
  ### ApplicationFact
428
591
 
429
592
  Returned by `getFacts()`. Extends `ApplicationFactInput` and adds server-side fields.
@@ -465,24 +628,23 @@ interface AddFactResult {
465
628
 
466
629
  /**
467
630
  * 0–1 score derived from how well the customer's answer matched expected.
468
- * Populated by the verification queue from partial-match heuristics
469
- * (numeric-prefix ratio, matched-components ratio).
631
+ * Derived from partial-match heuristics (numeric-prefix ratio,
632
+ * matched-components ratio).
470
633
  */
471
634
  answer_match_score?: number;
472
635
 
473
636
  /**
474
637
  * Top-level state at terminal resolution. Always one of `matched`
475
638
  * or `unmatched` because the `addFact()` Promise only
476
- * resolves on terminals. Optional during the rollout window for
477
- * backwards compatibility with older backends.
639
+ * resolves on terminals. Optional for compatibility with older
640
+ * server versions.
478
641
  */
479
642
  verification_status?: VerificationStatus;
480
643
 
481
644
  /**
482
- * Per-fact partial-match breakdown carried through from the
483
- * verification queue's component-wise comparators. For numeric-prefix
484
- * facts these are `["prefix"]` / `["suffix"]`; future work will
485
- * generalise to addresses, names, dates, etc.
645
+ * Component labels describing which parts of the expected answer
646
+ * matched. Currently `["prefix"]` / `["suffix"]` for numeric facts;
647
+ * treat the set as open-ended.
486
648
  */
487
649
  matched_components?: string[];
488
650
  missing_components?: string[];
@@ -667,36 +829,6 @@ type FactUpdateEvent = {
667
829
  };
668
830
  ```
669
831
 
670
- ## Semantic Versioning
671
-
672
- Version bumps are automated with semantic commits and `semantic-release` in Bitbucket Pipelines:
673
-
674
- - `master` creates stable releases.
675
- - `develop` creates prereleases on the `develop` channel (for example `1.2.3-develop.1`).
676
-
677
- ### Commit types and version bump
678
-
679
- - `fix: ...` -> patch bump (`0.0.6` -> `0.0.7`)
680
- - `feat: ...` -> minor bump (`0.0.6` -> `0.1.0`)
681
- - `feat!: ...` or commit body with `BREAKING CHANGE:` -> major bump (`0.0.6` -> `1.0.0`)
682
- - `chore: ...`
683
- - Other commit types (for example `docs:`, `chore:`) do not trigger a release by default.
684
-
685
- ### Examples
686
-
687
- ```text
688
- fix: handle socket timeout error
689
- feat: add isRecordingNow helper
690
- feat!: change addFact response contract
691
- ```
692
-
693
- ### Pipeline requirements
694
-
695
- Set these repository variables so the release step can push tags/commits and publish to npm:
696
-
697
- - `BB_TOKEN_BASIC_AUTH` with value `user:token`
698
- - `NPM_TOKEN` with publish access to `@aiqa/sdk`
699
-
700
832
  ## Examples
701
833
 
702
834
  ### Complete Example: Recording Session
@@ -1,5 +1,41 @@
1
1
  import { Socket } from 'socket.io-client';
2
2
 
3
+ /**
4
+ * Rolled-up verdict over the *answers*: `critical_errors` if any critical fact
5
+ * failed, otherwise `errors` if any fact failed, otherwise `no_errors`.
6
+ * Questions that were never asked do not raise it, so a call where everything
7
+ * was skipped and nothing was wrong reads `no_errors`.
8
+ *
9
+ * Distinct from the per-fact `VerificationStatus` — this one describes the
10
+ * call, not an answer.
11
+ */
12
+ type ApplicationVerificationStatus = "no_errors" | "errors" | "critical_errors";
13
+ /** Verification tally for the application at the moment it was requested. */
14
+ type ApplicationVerificationSummary = {
15
+ status: ApplicationVerificationStatus;
16
+ /** Facts whose answer did not match the expected one. */
17
+ count_errors: number;
18
+ /** Subset of `count_errors` whose question is marked critical. */
19
+ count_critical_errors: number;
20
+ /**
21
+ * Facts on the application, full stop — verdict or not. Not a pass count and
22
+ * not a count of what has been evaluated: `count_not_asked` and
23
+ * `count_pending` are subsets of it, not separate buckets.
24
+ */
25
+ count_total: number;
26
+ /** Facts with a verdict of never-asked. Excludes the still-pending ones. */
27
+ count_not_asked: number;
28
+ /** Subset of `count_not_asked` whose question is marked critical. */
29
+ count_critical_not_asked: number;
30
+ /**
31
+ * Facts still awaiting a verdict — added, but not resolved yet. During a live
32
+ * call most facts sit here, and they drain into the other counters as the
33
+ * call proceeds.
34
+ */
35
+ count_pending: number;
36
+ /** Facts the conduct review flagged; a matched fact can still be suspicious. */
37
+ count_suspicious: number;
38
+ };
3
39
  type Application = {
4
40
  application_id: string;
5
41
  client_name: string;
@@ -7,10 +43,17 @@ type Application = {
7
43
  agent_id: string;
8
44
  agent_first_name: string;
9
45
  agent_last_name: string;
46
+ /**
47
+ * Absent only when the server predates this field, in which case
48
+ * `getApplication()` served its cached authentication snapshot. Treat the
49
+ * absence as "no live data", never as a zeroed summary.
50
+ */
51
+ verification?: ApplicationVerificationSummary;
10
52
  };
11
53
  declare enum Methods {
12
54
  AUTHENTICATE = "AUTHENTICATE",
13
55
  GET_FACTS = "GET_FACTS",
56
+ GET_APPLICATION = "GET_APPLICATION",
14
57
  START_RECORDING = "START_RECORDING",
15
58
  STOP_RECORDING = "STOP_RECORDING",
16
59
  IS_RECORDING = "IS_RECORDING",
@@ -156,24 +199,23 @@ interface AddFactResult {
156
199
  question_match_score?: number;
157
200
  /**
158
201
  * 0–1 score derived from how well the customer's answer matched expected.
159
- * Populated by the verification queue from partial-match heuristics
160
- * (numeric-prefix ratio, matched-components ratio). Undefined when no
161
- * partial signal exists or for terminal results before this rolls out.
202
+ * Derived from partial-match heuristics (numeric-prefix ratio,
203
+ * matched-components ratio). Undefined when no partial signal exists,
204
+ * or on older server versions.
162
205
  */
163
206
  answer_match_score?: number;
164
207
  metadata?: Record<string, string>;
165
208
  /**
166
209
  * Top-level state at terminal resolution. Always one of `matched`
167
210
  * or `unmatched` because the `addFact()` Promise only
168
- * resolves on terminals. Optional during the rollout window for
169
- * backwards compatibility with older backends.
211
+ * resolves on terminals. Optional for compatibility with older
212
+ * server versions.
170
213
  */
171
214
  verification_status?: VerificationStatus;
172
215
  /**
173
- * Per-fact partial-match breakdown carried through from the
174
- * verification queue's component-wise comparators. For numeric-prefix
175
- * facts these are `["prefix"]` / `["suffix"]`; future work will
176
- * generalise to addresses, names, dates, etc.
216
+ * Component labels describing which parts of the expected answer
217
+ * matched. Currently `["prefix"]` / `["suffix"]` for numeric facts;
218
+ * treat the set as open-ended.
177
219
  */
178
220
  matched_components?: string[];
179
221
  missing_components?: string[];
@@ -181,7 +223,7 @@ interface AddFactResult {
181
223
  /**
182
224
  * Payload of the `FACT_VERIFIED` broadcast event.
183
225
  *
184
- * Fires on EVERY state transition the verification queue produces —
226
+ * Fires on EVERY state transition the server produces —
185
227
  * non-terminal (`partial`, `awaiting_question`, `awaiting_answer`,
186
228
  * `pending_confirmation_matched`, `pending_confirmation_unmatched`,
187
229
  * `processing`) AND terminal (`matched`, `unmatched`).
@@ -213,33 +255,24 @@ type FlagFactResult = {
213
255
  success: boolean;
214
256
  };
215
257
  /**
216
- * Coarse dialog-act label produced by the backend's `UtteranceEnricher`.
217
- * Advisory only — do not gate production behaviour on this value; the
218
- * enricher emits its best-effort categorical guess plus a separate
219
- * `dialog_act_confidence` band.
220
- *
221
- * Mirrors `DialogAct` in
222
- * `libs/types/src/utterance-enrichment.ts` on the backend.
258
+ * Coarse dialog-act label classified server-side. Advisory only — do
259
+ * not gate production behaviour on this value; it is a best-effort
260
+ * categorical guess, paired with a separate `dialog_act_confidence`
261
+ * band.
223
262
  */
224
263
  type DialogAct = "question" | "answer" | "acknowledgement" | "filler" | "other";
225
264
  /**
226
265
  * Categorical confidence band for `dialog_act` ONLY. Named distinctly
227
266
  * from the numeric STT `confidence` field on the same utterance — the
228
- * two are unrelated and conflating them is a documented drift hazard on
229
- * the backend.
230
- *
231
- * Mirrors `DialogActConfidence` in
232
- * `libs/types/src/utterance-enrichment.ts` on the backend.
267
+ * two are unrelated, so do not compare or conflate them.
233
268
  */
234
269
  type DialogActConfidence = "high" | "medium" | "low";
235
270
  /**
236
- * Persisted utterance shape — matches `TranscriptionUtteranceDto` on the
237
- * gateway (`apps/realtime-verification/src/socket/realtimeVerification.gateway.output.dto.ts`)
238
- * and the `Utterance` interface in `libs/types/src/common.ts` field for
239
- * field. Sent over the wire by the `TRANSCRIPTION_UPDATED` broadcast.
271
+ * Persisted utterance shape, sent over the wire by the
272
+ * `TRANSCRIPTION_UPDATED` broadcast.
240
273
  *
241
- * The 7 enricher classification fields are all optional because
242
- * pre-cutover utterances (persisted before backend PR #234) lack them.
274
+ * The 7 classification fields are all optional because utterances
275
+ * persisted by older server versions lack them.
243
276
  * Treat any missing or nullish value as "unknown" — NOT as a deliberate
244
277
  * negative signal. `is_ivr_filler_candidate === false` in particular
245
278
  * does NOT round-trip through `undefined`, so consumer logic that wants
@@ -251,8 +284,8 @@ type Utterance = {
251
284
  id: string;
252
285
  call_id: number;
253
286
  /**
254
- * NOT YET IMPLEMENTED — currently hardcoded to 0 at write sites on
255
- * the backend. Do not use for sorting; sort by `id` (UUIDv7) instead.
287
+ * Reserved — currently always 0. Do not use for sorting; sort by `id`
288
+ * (UUIDv7) instead.
256
289
  */
257
290
  order: number;
258
291
  is_agent: boolean | null;
@@ -328,4 +361,4 @@ declare class AiQaSdk implements IAiqaSdk {
328
361
  private isManagerEvent;
329
362
  }
330
363
 
331
- export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, ConversationLanguage, type DialogAct, type DialogActConfidence, FactAnswerFormatType, type FactVerifiedPayload, type FlagFactResult, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationLanguageResult, type SetConversationProductResult, type TranscriptionUpdate, type UpdateConversationInput, type UpdateConversationResult, type Utterance, type VerificationStatus };
364
+ export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, type ApplicationVerificationStatus, type ApplicationVerificationSummary, ConversationLanguage, type DialogAct, type DialogActConfidence, FactAnswerFormatType, type FactVerifiedPayload, type FlagFactResult, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationLanguageResult, type SetConversationProductResult, type TranscriptionUpdate, type UpdateConversationInput, type UpdateConversationResult, type Utterance, type VerificationStatus };
@@ -3341,6 +3341,7 @@ Object.assign(lookup2, {
3341
3341
  var Methods = /* @__PURE__ */ ((Methods2) => {
3342
3342
  Methods2["AUTHENTICATE"] = "AUTHENTICATE";
3343
3343
  Methods2["GET_FACTS"] = "GET_FACTS";
3344
+ Methods2["GET_APPLICATION"] = "GET_APPLICATION";
3344
3345
  Methods2["START_RECORDING"] = "START_RECORDING";
3345
3346
  Methods2["STOP_RECORDING"] = "STOP_RECORDING";
3346
3347
  Methods2["IS_RECORDING"] = "IS_RECORDING";
@@ -3397,7 +3398,7 @@ var compareVersions = (left, right) => {
3397
3398
  // package.json
3398
3399
  var package_default = {
3399
3400
  name: "@aiqa/sdk",
3400
- version: "2.1.0-develop.2",
3401
+ version: "2.1.0-develop.4",
3401
3402
  main: "dist/node/node.js",
3402
3403
  module: "dist/node/node.js",
3403
3404
  types: "dist/node/node.d.ts",
@@ -3481,6 +3482,9 @@ var DEFAULT_URL = "ws://localhost:3025/ws";
3481
3482
  var DEFAULT_TIMEOUT_MS = 6e4;
3482
3483
  var RUNTIME = typeof window !== "undefined" && typeof window.document !== "undefined" ? "browser" : "node";
3483
3484
  var USER_AGENT = RUNTIME === "browser" ? typeof navigator !== "undefined" ? navigator.userAgent : "browser/unknown" : typeof process !== "undefined" ? `node ${process.version} ${process.platform}` : "node/unknown";
3485
+ function isRequestTimeout(error, method) {
3486
+ return error instanceof Error && error.message === `Request timed out for ${method}`;
3487
+ }
3484
3488
  function isThenable(value2) {
3485
3489
  return value2 !== null && typeof value2 === "object" && typeof value2.then === "function";
3486
3490
  }
@@ -3688,6 +3692,18 @@ var AiQaSdk = class {
3688
3692
  });
3689
3693
  }
3690
3694
  async getApplication() {
3695
+ try {
3696
+ const result = await this.sendMessage("GET_APPLICATION" /* GET_APPLICATION */);
3697
+ const application = result && result.data !== void 0 ? result.data : result;
3698
+ if (application && application.application_id !== void 0) {
3699
+ return application;
3700
+ }
3701
+ throw new Error("GET_APPLICATION returned no application");
3702
+ } catch (error) {
3703
+ if (!isRequestTimeout(error, "GET_APPLICATION" /* GET_APPLICATION */)) {
3704
+ throw error;
3705
+ }
3706
+ }
3691
3707
  if (this.cachedApplication) {
3692
3708
  return this.cachedApplication;
3693
3709
  }