@voctiv/agent-sdk 0.2.0 → 0.2.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/define-script.d.ts +68 -32
- package/dist/define-script.d.ts.map +1 -1
- package/dist/define-script.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/types/asr-handle.d.ts +26 -12
- package/dist/types/asr-handle.d.ts.map +1 -1
- package/dist/types/events.d.ts +7 -7
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/legacy-phrase.d.ts +12 -5
- package/dist/types/legacy-phrase.d.ts.map +1 -1
- package/dist/types/legacy-phrase.js +2 -1
- package/dist/types/legacy-phrase.js.map +1 -1
- package/dist/types/logger.d.ts +3 -1
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/media-channel.d.ts +538 -23
- package/dist/types/media-channel.d.ts.map +1 -1
- package/dist/types/mixer.d.ts +23 -10
- package/dist/types/mixer.d.ts.map +1 -1
- package/dist/types/nlu.d.ts +20 -10
- package/dist/types/nlu.d.ts.map +1 -1
- package/dist/types/text-input.d.ts +11 -1
- package/dist/types/text-input.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/define-script.d.ts
CHANGED
|
@@ -6,20 +6,32 @@ import type { LegacyGetRecordsParams, LegacyPhraseRecord } from './types/legacy-
|
|
|
6
6
|
/**
|
|
7
7
|
* NLU (Natural Language Understanding) API.
|
|
8
8
|
*
|
|
9
|
-
* Provides intent/entity extraction
|
|
10
|
-
*
|
|
9
|
+
* Provides intent/entity extraction through the legacy NLU v3 `/infer` endpoint.
|
|
10
|
+
* The current `apps/api` runtime only allows this API when `context.legacyV3Compat`
|
|
11
|
+
* is `true` and NLU runtime settings are configured (`NLU_V3_BASE_URL` plus a
|
|
12
|
+
* resolved numeric agent id). Calls fail fast with a descriptive error otherwise.
|
|
13
|
+
*
|
|
14
|
+
* Compatible with logic-executor `nn.extract()` request/response shape.
|
|
11
15
|
*/
|
|
12
16
|
export interface NluScriptApi {
|
|
13
17
|
/**
|
|
14
|
-
* Extract intents and entities from
|
|
18
|
+
* Extract intents and entities from one user utterance.
|
|
19
|
+
*
|
|
20
|
+
* The runtime sends `{ phrase, context, agent_id }` to NLU v3. If
|
|
21
|
+
* `options.context` is omitted, it serializes the current dialog params
|
|
22
|
+
* (`context.dialogParams`, then legacy fallbacks) as the request context.
|
|
23
|
+
*
|
|
15
24
|
* @param utterance - User input text to analyze.
|
|
16
|
-
* @param options -
|
|
17
|
-
*
|
|
25
|
+
* @param options - Optional NLU filters and flags. `entities`, `intents`,
|
|
26
|
+
* `use_neuro_api`, and `use_synonyms` are forwarded by the current API runtime.
|
|
27
|
+
* @returns Raw parsed JSON response from the NLU `/infer` endpoint.
|
|
18
28
|
*/
|
|
19
29
|
extract(utterance: string, options?: NluExtractOptions): Promise<NluInferResult>;
|
|
20
30
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
31
|
+
* Observable wrapper around {@link extract}.
|
|
32
|
+
*
|
|
33
|
+
* This is not a streaming NLU session: every subscription performs one
|
|
34
|
+
* `extract()` call and emits exactly one result or one error.
|
|
23
35
|
*/
|
|
24
36
|
extract$(utterance: string, options?: NluExtractOptions): Observable<NluInferResult>;
|
|
25
37
|
}
|
|
@@ -51,7 +63,14 @@ export interface ScriptDialogContext {
|
|
|
51
63
|
scriptName: string;
|
|
52
64
|
/** Agent UUID from Omni platform (links script to an NLU agent). */
|
|
53
65
|
agentUuid?: string;
|
|
54
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Numeric NLU agent id used for `platform.nlu.extract()` and legacy DB operations.
|
|
68
|
+
*
|
|
69
|
+
* Resolved by the server from Omni/LE mapping or env (`NLU_DEFAULT_AGENT_ID` /
|
|
70
|
+
* `AGENT_ID`). Client/session params named `agent_id`, `agentId`, `agentUuid`,
|
|
71
|
+
* and `agent_uuid` are stripped before context construction and cannot spoof it.
|
|
72
|
+
* May be `0` when no agent id is configured; NLU and `platform.call()` will then fail.
|
|
73
|
+
*/
|
|
55
74
|
agentId: number;
|
|
56
75
|
/**
|
|
57
76
|
* **Snapshot** of dialog/session payload when the script run started.
|
|
@@ -78,16 +97,19 @@ export interface ScriptDialogContext {
|
|
|
78
97
|
/** `true` when the script runs without a real media channel (offline / queue / messaging). */
|
|
79
98
|
headless: boolean;
|
|
80
99
|
/**
|
|
81
|
-
* Persisted dialog environment for this conversation.
|
|
82
|
-
*
|
|
100
|
+
* Persisted dialog environment for this conversation. The API runtime converts the
|
|
101
|
+
* plain persisted `env` snapshot into this `BehaviorSubject` before invoking the script.
|
|
102
|
+
* On the first call the value is `undefined`.
|
|
83
103
|
*
|
|
84
104
|
* **Read/write only via `env$`:** use `env$.getValue()`, `env$.next(partialOrNext)`, or
|
|
85
105
|
* `env$.subscribe(...)`. Do not use a plain `context.env` — it is not provided.
|
|
86
106
|
*
|
|
87
107
|
* **Persistence:** On script completion (success or error), the runtime snapshots `env$` and
|
|
88
|
-
*
|
|
108
|
+
* attaches it to the persisted result; the script return value must not carry env
|
|
109
|
+
* (see {@link ScriptResult}).
|
|
89
110
|
*
|
|
90
|
-
*
|
|
111
|
+
* Session runners decide where that snapshot is stored. In Voctiv platform compatibility
|
|
112
|
+
* mode it is used as the LE-style dialog environment.
|
|
91
113
|
*/
|
|
92
114
|
env$?: BehaviorSubject<Record<string, unknown> | undefined>;
|
|
93
115
|
/** Raw `dialog` table row from the Voctiv platform database. */
|
|
@@ -173,35 +195,46 @@ export interface ScheduleCallOptions {
|
|
|
173
195
|
date?: string | Date;
|
|
174
196
|
/** Deadline — don't call after this time. */
|
|
175
197
|
dateEnd?: string | Date;
|
|
176
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* Entry point to pass to the script when the call connects.
|
|
200
|
+
*
|
|
201
|
+
* Stored in the created call params as `entry_point`.
|
|
202
|
+
*/
|
|
177
203
|
entryPoint?: string;
|
|
178
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* Legacy compatibility field for callers that schedule without a current `scriptId`.
|
|
206
|
+
*
|
|
207
|
+
* The current `apps/api` scheduler only uses this to allow validation when
|
|
208
|
+
* `scriptId` is missing; it does not resolve the script name/path itself.
|
|
209
|
+
*/
|
|
179
210
|
script?: string;
|
|
180
|
-
/** SIP channel/trunk
|
|
211
|
+
/** Reserved SIP channel/trunk hint. The current `apps/api` scheduler does not persist it. */
|
|
181
212
|
channel?: string;
|
|
182
|
-
/** How many times to retry on failure. */
|
|
213
|
+
/** How many times to retry on failure. Stored as `recall_count` in call params. */
|
|
183
214
|
recallCount?: number;
|
|
184
|
-
/** Delay in seconds between retries. */
|
|
215
|
+
/** Delay in seconds between retries. Stored as `recall_delay` in call params. */
|
|
185
216
|
recallDelay?: number;
|
|
186
|
-
/** Entry point to use after a successful call. */
|
|
217
|
+
/** Entry point to use after a successful call. Stored as `on_success_call`. */
|
|
187
218
|
onSuccessCall?: string;
|
|
188
|
-
/** Entry point to use after a failed call. */
|
|
219
|
+
/** Entry point to use after a failed call. Stored as `on_failed_call`. */
|
|
189
220
|
onFailedCall?: string;
|
|
190
221
|
/** Call priority (higher = processed sooner by dialer). */
|
|
191
222
|
priority?: number;
|
|
192
|
-
/** Timezone offset
|
|
223
|
+
/** Timezone offset passed to the legacy call row as `timeZone`. */
|
|
193
224
|
timezone?: number;
|
|
194
|
-
/** Extra SIP headers or protocol-level params. */
|
|
225
|
+
/** Extra SIP headers or protocol-level params. Stored as `proto_additional` in call params. */
|
|
195
226
|
protoAdditional?: Record<string, string>;
|
|
196
227
|
}
|
|
197
228
|
/**
|
|
198
229
|
* Dialog state API — read and update dialog routing metadata.
|
|
199
230
|
*
|
|
200
|
-
* Setting `entryPoint` or `result` immediately
|
|
201
|
-
*
|
|
231
|
+
* Setting `entryPoint` or `result` updates the local value immediately and asks
|
|
232
|
+
* the Voctiv platform database to persist the change asynchronously. In worker
|
|
233
|
+
* sessions the setter sends an RPC to the main thread; in direct sessions errors
|
|
234
|
+
* are logged. There is no awaitable setter, so do not use it for transactional flow.
|
|
202
235
|
*/
|
|
203
236
|
export interface DialogApi {
|
|
204
|
-
/** Current script entry point (e.g. `"on_recall"`). Set to change routing for next call. */
|
|
237
|
+
/** Current script entry point (e.g. `"on_recall"`). Set to change routing for the next call. */
|
|
205
238
|
entryPoint: string | undefined;
|
|
206
239
|
/** Dialog outcome (e.g. `"done"`, `"busy"`, `"no_answer"`). Set to finalize dialog. */
|
|
207
240
|
result: string | undefined;
|
|
@@ -212,11 +245,11 @@ export interface DialogApi {
|
|
|
212
245
|
}
|
|
213
246
|
/** Options for sending an outbound message via {@link MessagingApi.send}. */
|
|
214
247
|
export interface SendMessageOptions {
|
|
215
|
-
/** Sender identifier (
|
|
248
|
+
/** Sender identifier (service id, bot id, or phone number expected by the MA consumer). */
|
|
216
249
|
src: string;
|
|
217
|
-
/** Recipient identifier (phone number, user
|
|
250
|
+
/** Recipient identifier (phone number, user id, or channel-specific address). */
|
|
218
251
|
destination: string;
|
|
219
|
-
/** Text body of the message. */
|
|
252
|
+
/** Text body of the message. When present in legacy mode, it is also mirrored to dialog stats. */
|
|
220
253
|
text?: string;
|
|
221
254
|
/** URL of an attachment (image, document, etc.). */
|
|
222
255
|
attachment?: string;
|
|
@@ -237,8 +270,10 @@ export interface InboundMessage {
|
|
|
237
270
|
/**
|
|
238
271
|
* Messaging API — send and receive messages through external channels.
|
|
239
272
|
*
|
|
240
|
-
*
|
|
241
|
-
* compatible with the old LE messaging architecture.
|
|
273
|
+
* Outbound messages are transported via Redis Streams (`ma_send` / `ma_receive`),
|
|
274
|
+
* compatible with the old LE messaging architecture. `message$` is currently a
|
|
275
|
+
* one-shot replay of the inbound message that started a headless messaging script,
|
|
276
|
+
* not a live subscription to all future Redis messages.
|
|
242
277
|
*/
|
|
243
278
|
export interface MessagingApi {
|
|
244
279
|
/**
|
|
@@ -257,11 +292,12 @@ export interface MessagingApi {
|
|
|
257
292
|
* Platform API — Voctiv platform–compatible operations available to scripts.
|
|
258
293
|
*
|
|
259
294
|
* Provides access to NLU, dialog state management, outbound call scheduling,
|
|
260
|
-
* and messaging.
|
|
261
|
-
*
|
|
295
|
+
* phrase records, and messaging. These operations are legacy-platform backed:
|
|
296
|
+
* the current `apps/api` runtime requires `context.legacyV3Compat === true` for
|
|
297
|
+
* NLU, `call`, `dialog` writes, messaging sends, and `getRecords`.
|
|
262
298
|
*/
|
|
263
299
|
export interface PlatformApi {
|
|
264
|
-
/** NLU intent/entity extraction API. */
|
|
300
|
+
/** NLU intent/entity extraction API; throws outside legacy V3 compatibility mode. */
|
|
265
301
|
readonly nlu: NluScriptApi;
|
|
266
302
|
/** Dialog state — read/write entry point and result. */
|
|
267
303
|
readonly dialog: DialogApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-script.d.ts","sourceRoot":"","sources":["../src/define-script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B
|
|
1
|
+
{"version":3,"file":"define-script.d.ts","sourceRoot":"","sources":["../src/define-script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,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;CAC5E;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB,0FAA0F;IAC1F,MAAM,EAAE,YAAY,CAAC;IACrB,wFAAwF;IACxF,OAAO,EAAE,mBAAmB,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,CACrB,GAAG,EAAE,aAAa,KACf,IAAI,GAAG,YAAY,GAAG,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAEnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-script.js","sourceRoot":"","sources":["../src/define-script.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"define-script.js","sourceRoot":"","sources":["../src/define-script.ts"],"names":[],"mappings":";;AAwaA,oCAEC;AA3BD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,YAAY,CAAC,EAAY;IACvC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* **Agent scripting SDK** for `node-asr-tts-connector`: typed **`defineScript`** context,
|
|
4
4
|
* {@link import('./types/media-channel').MediaChannel}, ASR/TTS, LLM, SIP, and Voctiv platform (LE-compat) helpers.
|
|
5
|
+
* These exports are types plus the `defineScript` identity helper; behavior is provided by
|
|
6
|
+
* the `apps/api` scripting runtime that loads and executes your script.
|
|
5
7
|
*
|
|
6
8
|
* ### Selecting ASR/TTS credentials by `key_storage.name` (Voctiv platform)
|
|
7
9
|
*
|
|
@@ -15,11 +17,14 @@
|
|
|
15
17
|
* - {@link import('./types/mixer').PlayOptions.name} or **`ttsConfig.name`** on **`say`/`play`/`presay`**
|
|
16
18
|
*
|
|
17
19
|
* Channel defaults **`defaultAsrName`** / **`defaultTtsName`** apply when **`name`** is omitted.
|
|
20
|
+
*
|
|
21
|
+
* Legacy platform APIs (`platform.nlu`, `platform.call`, messaging sends, dialog writes, and phrase
|
|
22
|
+
* records) require `context.legacyV3Compat === true` in the current API runtime.
|
|
18
23
|
*/
|
|
19
24
|
export { defineScript } from './define-script';
|
|
20
25
|
export type { ScriptContext, ScriptDialogContext, ScriptRunTime, ScriptResult, PersistedScriptResult, ScriptError, ScriptFn, NluScriptApi, PlatformApi, DialogApi, ScheduleCallOptions, SendMessageOptions, InboundMessage, MessagingApi, } from './define-script';
|
|
21
26
|
export type { ScriptLogger } from './types/logger';
|
|
22
|
-
export type { MediaChannel, ChannelAudio, ChannelEvents, ChannelLlm, ChannelSip, LlmOptions, LlmStreamChunk, ExtractOptions, PersistentLlmStreamHandle, } from './types/media-channel';
|
|
27
|
+
export type { MediaChannel, ChannelAudio, ChannelEvents, ChannelLlm, ChannelSip, SipState, SipProgressEvent, LlmOptions, LlmStreamChunk, ExtractOptions, PersistentLlmStreamHandle, } from './types/media-channel';
|
|
23
28
|
export type { AsrHandle, AsrConfig, AsrVadConfig, AsrSmartTurnConfig } from './types/asr-handle';
|
|
24
29
|
export type { MixerQueueControl, PlayOptions, TtsStrategy, TtsVendor } from './types/mixer';
|
|
25
30
|
export type { LegacyPhraseRecord, LegacyGetRecordsParams, LegacySavePhraseOptions, } from './types/legacy-phrase';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,cAAc,EACd,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACjG,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC5F,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
* **Agent scripting SDK** for `node-asr-tts-connector`: typed **`defineScript`** context,
|
|
5
5
|
* {@link import('./types/media-channel').MediaChannel}, ASR/TTS, LLM, SIP, and Voctiv platform (LE-compat) helpers.
|
|
6
|
+
* These exports are types plus the `defineScript` identity helper; behavior is provided by
|
|
7
|
+
* the `apps/api` scripting runtime that loads and executes your script.
|
|
6
8
|
*
|
|
7
9
|
* ### Selecting ASR/TTS credentials by `key_storage.name` (Voctiv platform)
|
|
8
10
|
*
|
|
@@ -16,6 +18,9 @@
|
|
|
16
18
|
* - {@link import('./types/mixer').PlayOptions.name} or **`ttsConfig.name`** on **`say`/`play`/`presay`**
|
|
17
19
|
*
|
|
18
20
|
* Channel defaults **`defaultAsrName`** / **`defaultTtsName`** apply when **`name`** is omitted.
|
|
21
|
+
*
|
|
22
|
+
* Legacy platform APIs (`platform.nlu`, `platform.call`, messaging sends, dialog writes, and phrase
|
|
23
|
+
* records) require `context.legacyV3Compat === true` in the current API runtime.
|
|
19
24
|
*/
|
|
20
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
26
|
exports.isLegacyPhraseRecord = exports.LEGACY_PHRASE_RECORD_BRAND = exports.defineScript = void 0;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAEH,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAuCrB,uDAG+B;AAF7B,2HAAA,0BAA0B,OAAA;AAC1B,qHAAA,oBAAoB,OAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
/**
|
|
3
|
-
* Voice Activity Detection (VAD) tuning
|
|
4
|
-
*
|
|
3
|
+
* Voice Activity Detection (VAD) tuning.
|
|
4
|
+
*
|
|
5
|
+
* SIP sessions use the call-level telephony VAD when available. WS sessions create one
|
|
6
|
+
* VAD instance for the whole socket session on the first `createAsr()` call and merge
|
|
7
|
+
* these options with runtime defaults. When no VAD is available, audio is forwarded to
|
|
8
|
+
* ASR continuously and most VAD observables are empty.
|
|
5
9
|
*/
|
|
6
10
|
export interface AsrVadConfig {
|
|
7
11
|
/** Energy threshold to start speech detection (0.0–1.0). */
|
|
@@ -14,14 +18,19 @@ export interface AsrVadConfig {
|
|
|
14
18
|
energyFloor?: number;
|
|
15
19
|
/** Smoothing factor for noise floor estimation (0.0–1.0). */
|
|
16
20
|
noiseFloorAlpha?: number;
|
|
17
|
-
/** Frames of PCM (typically 20 ms @
|
|
21
|
+
/** Frames of PCM (typically 20 ms @ 16 kHz / 640 bytes) to prepend before detected speech start. */
|
|
18
22
|
preSpeechFrames?: number;
|
|
19
|
-
/**
|
|
23
|
+
/** Frames of post-speech PCM to still forward to ASR after VAD speech end. */
|
|
20
24
|
postSpeechFrames?: number;
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
27
|
* Smart turn-taking — controls when the runtime finalizes an utterance (end-of-turn) while
|
|
24
28
|
* streaming audio to ASR. Reduces cutting off the user mid-sentence when enabled.
|
|
29
|
+
*
|
|
30
|
+
* On WS sessions these values are passed to the telephony VAD/SmartTurn service.
|
|
31
|
+
* On SIP sessions, `enabled: true` also ensures the ASR connector has an
|
|
32
|
+
* `utterance_end_ms` value (defaulting to `1000`) when the resolved connector config
|
|
33
|
+
* did not already provide one.
|
|
25
34
|
*/
|
|
26
35
|
export interface AsrSmartTurnConfig {
|
|
27
36
|
/** When `true`, turn-taking heuristics are applied (defaults vary by host). */
|
|
@@ -52,8 +61,8 @@ export interface AsrSmartTurnConfig {
|
|
|
52
61
|
* - If neither is set, credentials fall back to the usual **`authentication_data.asr.<engine>`**
|
|
53
62
|
* blob for the resolved vendor (main/reserved keys on the agent).
|
|
54
63
|
*
|
|
55
|
-
* You may also set the same selector as **`data.name
|
|
56
|
-
*
|
|
64
|
+
* You may also set the same selector as **`data.name`**. The runtime treats it as
|
|
65
|
+
* the storage-row selector and strips it before sending connector params to the ASR vendor.
|
|
57
66
|
*
|
|
58
67
|
* ### Vendor
|
|
59
68
|
*
|
|
@@ -76,10 +85,12 @@ export interface AsrConfig {
|
|
|
76
85
|
/** Recognition language (BCP-47), e.g. `"ru-RU"`. Passed through to the connector as `language`. */
|
|
77
86
|
language?: string;
|
|
78
87
|
/**
|
|
79
|
-
* Vendor-specific connection parameters (URLs, timeouts, model ids, …).
|
|
80
|
-
* catalog credentials so the script can override
|
|
81
|
-
*
|
|
82
|
-
*
|
|
88
|
+
* Vendor-specific connection parameters (URLs, timeouts, model ids, nested JSON, …).
|
|
89
|
+
* Merged last over channel defaults and catalog credentials so the script can override
|
|
90
|
+
* per call. Primitives are stringified; objects and arrays are JSON-serialized.
|
|
91
|
+
*
|
|
92
|
+
* Do not rely on **`name`** here for third-party “model name” fields — the runtime consumes
|
|
93
|
+
* it as the storage row selector and removes it before vendor config is built.
|
|
83
94
|
*/
|
|
84
95
|
data?: Record<string, unknown>;
|
|
85
96
|
/** Optional VAD tuning for this session (see host implementation). */
|
|
@@ -91,8 +102,11 @@ export interface AsrConfig {
|
|
|
91
102
|
* Live speech recognition session returned by {@link import('./media-channel').MediaChannel.createAsr}.
|
|
92
103
|
*
|
|
93
104
|
* Subscribe to **`partial$`** / **`result$`** for transcripts; wire **`speechStart$`** /
|
|
94
|
-
* **`speechEnd$`** / **`interrupt$`** for barge-in and UI.
|
|
105
|
+
* **`speechEnd$`** / **`interrupt$`** for barge-in and UI. Call **`destroy()`** when done
|
|
95
106
|
* (e.g. on `channel.events.terminated$`) to release connector and subscriptions.
|
|
107
|
+
*
|
|
108
|
+
* If connector creation fails, SIP/WS return a degraded handle: VAD observables still
|
|
109
|
+
* mirror the channel where possible, but `partial$` and `result$` do not emit real STT.
|
|
96
110
|
*/
|
|
97
111
|
export interface AsrHandle {
|
|
98
112
|
/** Opaque id (passed to `channel.textInput` helpers in automated tests). */
|
|
@@ -118,7 +132,7 @@ export interface AsrHandle {
|
|
|
118
132
|
readonly interrupt$: Observable<void>;
|
|
119
133
|
/** Normalized voice-activity probability 0–1 when the host exposes it; else may be inert. */
|
|
120
134
|
readonly vadProbability$: Observable<number>;
|
|
121
|
-
/** Pause audio
|
|
135
|
+
/** Pause forwarding new audio frames to the recognizer; skipped audio is not replayed. */
|
|
122
136
|
pause(): void;
|
|
123
137
|
/** Resume after {@link pause}. */
|
|
124
138
|
resume(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asr-handle.d.ts","sourceRoot":"","sources":["../../src/types/asr-handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC
|
|
1
|
+
{"version":3,"file":"asr-handle.d.ts","sourceRoot":"","sources":["../../src/types/asr-handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oGAAoG;IACpG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4FAA4F;IAC5F,gBAAgB,CAAC,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B"}
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/** DTMF digit event from the remote party. */
|
|
2
2
|
export interface DtmfEvent {
|
|
3
|
-
/** The pressed digit
|
|
3
|
+
/** The pressed digit. SIP emits `0`–`9`, `*`, `#`; WS input also accepts `A`–`D`. */
|
|
4
4
|
digit: string;
|
|
5
|
-
/** Duration of the tone in milliseconds. */
|
|
5
|
+
/** Duration of the tone in milliseconds, normalized by the channel when available. */
|
|
6
6
|
duration: number;
|
|
7
7
|
}
|
|
8
8
|
/** Incoming SIP INFO message. */
|
|
9
9
|
export interface SipInfo {
|
|
10
|
-
/** MIME content type (e.g. `"application/dtmf-relay"`). */
|
|
10
|
+
/** MIME content type (e.g. `"application/dtmf-relay"`). May be empty for low-level Sofia events. */
|
|
11
11
|
contentType: string;
|
|
12
|
-
/** Message body. */
|
|
12
|
+
/** Message body. May be empty for low-level Sofia events. */
|
|
13
13
|
body: string;
|
|
14
14
|
}
|
|
15
15
|
/** SIP call state change signal. */
|
|
16
16
|
export interface SipSignal {
|
|
17
|
-
/**
|
|
17
|
+
/** Raw telephony/Sofia call state, not normalized to SDK `SipState`. */
|
|
18
18
|
state: string;
|
|
19
19
|
/** SIP response status code (e.g. `200`, `486`). */
|
|
20
20
|
statusCode?: number;
|
|
@@ -23,11 +23,11 @@ export interface SipSignal {
|
|
|
23
23
|
/** SDP body (for media negotiation events). */
|
|
24
24
|
sdp?: string;
|
|
25
25
|
}
|
|
26
|
-
/** Arbitrary data message
|
|
26
|
+
/** Arbitrary data message used for WS data-channel communication between script and client. */
|
|
27
27
|
export interface DataMessage {
|
|
28
28
|
/** Event name / type identifier. */
|
|
29
29
|
event: string;
|
|
30
|
-
/** Event payload
|
|
30
|
+
/** Event payload. Keep it JSON-serializable for WS clients and worker proxying. */
|
|
31
31
|
payload: unknown;
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,iCAAiC;AACjC,MAAM,WAAW,OAAO;IACtB,oGAAoG;IACpG,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oCAAoC;AACpC,MAAM,WAAW,SAAS;IACxB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,+FAA+F;AAC/F,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Marker for pre-recorded phrase rows loaded from the Voctiv platform LE PostgreSQL DB
|
|
3
3
|
* ({@link PlatformApi.getRecords}). Pass to {@link ChannelAudio.play} instead of a URL/path string.
|
|
4
4
|
*
|
|
5
|
-
* Only used when Voctiv platform compatibility mode is enabled
|
|
5
|
+
* Only used when Voctiv platform compatibility mode is enabled and the server has resolved
|
|
6
|
+
* a trusted LE agent id/UUID plus `LEGACY_V3_RECORD_PHRASE_ROOT`.
|
|
6
7
|
*/
|
|
7
8
|
export declare const LEGACY_PHRASE_RECORD_BRAND: "__legacyPhraseRecord";
|
|
8
9
|
export interface LegacyPhraseRecord {
|
|
@@ -17,18 +18,24 @@ export interface LegacyPhraseRecord {
|
|
|
17
18
|
export declare function isLegacyPhraseRecord(source: unknown): source is LegacyPhraseRecord;
|
|
18
19
|
/** Parameters for {@link PlatformApi.getRecords} (Voctiv platform LE `RecordPhrase` / `record_phrase_file`). */
|
|
19
20
|
export interface LegacyGetRecordsParams {
|
|
21
|
+
/** Phrase group/name (`record_phrase.name`). */
|
|
20
22
|
phraseName: string;
|
|
23
|
+
/** Business flag used by the phrase catalog, normally `context.flag`. */
|
|
21
24
|
flag: string;
|
|
25
|
+
/** Language key used by the phrase catalog, normally `context.language`. */
|
|
22
26
|
language: string;
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
|
-
* When set on {@link PlayOptions}, after TTS the audio is copied under the Voctiv platform
|
|
26
|
-
* and a `record_phrase` / `record_phrase_file` row is inserted so
|
|
27
|
-
* can retrieve it. Also registers the PCM in the TTS file
|
|
29
|
+
* When set on {@link PlayOptions}, after TTS the audio is copied under the Voctiv platform
|
|
30
|
+
* record-phrase root and a `record_phrase` / `record_phrase_file` row is inserted so
|
|
31
|
+
* {@link PlatformApi.getRecords} can retrieve it. Also registers the PCM in the TTS file
|
|
32
|
+
* cache for subsequent `say`/`presay`.
|
|
28
33
|
*
|
|
29
|
-
* Only honored when Voctiv platform compatibility mode is active
|
|
34
|
+
* Only honored when Voctiv platform compatibility mode is active, `LEGACY_V3_RECORD_PHRASE_ROOT`
|
|
35
|
+
* is set, TTS cache is available, and the server resolved a trusted LE agent id/UUID.
|
|
30
36
|
*/
|
|
31
37
|
export interface LegacySavePhraseOptions {
|
|
38
|
+
/** Phrase group/name to create or update. */
|
|
32
39
|
phraseName: string;
|
|
33
40
|
/** Defaults to dialog `flag` from channel params when omitted. */
|
|
34
41
|
flag?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-phrase.d.ts","sourceRoot":"","sources":["../../src/types/legacy-phrase.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"legacy-phrase.d.ts","sourceRoot":"","sources":["../../src/types/legacy-phrase.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,wBAAkC,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,CAAC,0BAA0B,CAAC,EAAE,IAAI,CAAC;IAC5C,yGAAyG;IACzG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,kBAAkB,CAOlF;AAED,gHAAgH;AAChH,MAAM,WAAW,sBAAsB;IACrC,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -6,7 +6,8 @@ exports.isLegacyPhraseRecord = isLegacyPhraseRecord;
|
|
|
6
6
|
* Marker for pre-recorded phrase rows loaded from the Voctiv platform LE PostgreSQL DB
|
|
7
7
|
* ({@link PlatformApi.getRecords}). Pass to {@link ChannelAudio.play} instead of a URL/path string.
|
|
8
8
|
*
|
|
9
|
-
* Only used when Voctiv platform compatibility mode is enabled
|
|
9
|
+
* Only used when Voctiv platform compatibility mode is enabled and the server has resolved
|
|
10
|
+
* a trusted LE agent id/UUID plus `LEGACY_V3_RECORD_PHRASE_ROOT`.
|
|
10
11
|
*/
|
|
11
12
|
exports.LEGACY_PHRASE_RECORD_BRAND = '__legacyPhraseRecord';
|
|
12
13
|
function isLegacyPhraseRecord(source) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-phrase.js","sourceRoot":"","sources":["../../src/types/legacy-phrase.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"legacy-phrase.js","sourceRoot":"","sources":["../../src/types/legacy-phrase.ts"],"names":[],"mappings":";;;AAmBA,oDAOC;AA1BD;;;;;;GAMG;AACU,QAAA,0BAA0B,GAAG,sBAA+B,CAAC;AAY1E,SAAgB,oBAAoB,CAAC,MAAe;IAClD,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACd,MAA6B,CAAC,kCAA0B,CAAC,KAAK,IAAI;QACnE,OAAQ,MAA6B,CAAC,IAAI,KAAK,QAAQ,CACxD,CAAC;AACJ,CAAC"}
|
package/dist/types/logger.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* In Voctiv platform compatibility mode, log entries are also batch-written
|
|
5
5
|
* to the `dialog_stats` DB table (equivalent of old LE `nn.log`).
|
|
6
|
+
* In all modes they go to the API process logger. Debug streaming, when enabled,
|
|
7
|
+
* forwards only logs from the current script session to the configured debug endpoint.
|
|
6
8
|
*/
|
|
7
9
|
export interface ScriptLogger {
|
|
8
10
|
/** Info-level log entry. */
|
|
@@ -11,7 +13,7 @@ export interface ScriptLogger {
|
|
|
11
13
|
warn(message: string, data?: Record<string, unknown>): void;
|
|
12
14
|
/** Error-level log entry. */
|
|
13
15
|
error(message: string, data?: Record<string, unknown>): void;
|
|
14
|
-
/** Debug-level log entry
|
|
16
|
+
/** Debug-level log entry; intended for process/debug stream output rather than legacy DB stats. */
|
|
15
17
|
debug(message: string, data?: Record<string, unknown>): void;
|
|
16
18
|
/**
|
|
17
19
|
* Enable real-time log streaming to a remote debug endpoint.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,+BAA+B;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,6BAA6B;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,mGAAmG;IACnG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE7D;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,kEAAkE;IAClE,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;;;;OASG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E"}
|