@voctiv/agent-sdk 0.2.3 → 0.2.5
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 +26 -4
- package/dist/define-script.d.ts +11 -12
- package/dist/define-script.d.ts.map +1 -1
- package/dist/define-script.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/types/asr-handle.d.ts +1 -1
- package/dist/types/media-channel.d.ts +7 -7
- package/dist/types/mixer.d.ts +1 -1
- package/dist/types/nlu.d.ts +5 -5
- package/dist/types/nlu.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for scripts executed by the `ScriptEngine` scripting runtime.
|
|
4
4
|
|
|
5
|
-
The package exports the `defineScript()` identity helper and the public runtime types for voice channels, SIP calls, ASR, TTS, VAD, Smart Turn, LLM, dialog context, logging, and Voctiv legacy platform compatibility APIs.
|
|
5
|
+
The package exports the `defineScript()` identity helper and the public ScriptEngine runtime types for voice channels, SIP calls, ASR, TTS, VAD, Smart Turn, LLM, dialog context, logging, and Voctiv legacy platform compatibility APIs.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The SDK itself does not open SIP calls, run ASR/TTS, or talk to platform services; it describes the objects injected into your script by ScriptEngine.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -103,6 +103,28 @@ The important states are:
|
|
|
103
103
|
- `active`: final 200 OK has been received or sent.
|
|
104
104
|
- `terminated`: the call ended and no more audio is possible.
|
|
105
105
|
|
|
106
|
+
### How Pre-Answer Works
|
|
107
|
+
|
|
108
|
+
Pre-answer means the SIP media path is open before the call is finally answered with `200 OK`. In this state the caller can already hear TTS, the script can already receive audio for ASR, and DTMF can be exchanged.
|
|
109
|
+
|
|
110
|
+
Use pre-answer when you need to do something before committing the call to the final answer state:
|
|
111
|
+
|
|
112
|
+
- play an informational greeting or disclaimer;
|
|
113
|
+
- collect a short value with ASR, such as account number or menu choice;
|
|
114
|
+
- detect and navigate an IVR that speaks before answering;
|
|
115
|
+
- delay `answer()` until the script is ready to transfer, bridge, or continue.
|
|
116
|
+
|
|
117
|
+
For inbound calls, the script controls this explicitly:
|
|
118
|
+
|
|
119
|
+
1. Call `channel.sip.sendProgress()` to send `183 Session Progress` with SDP.
|
|
120
|
+
2. Wait for `channel.sip.waitForEarly()` if your next logic step needs media to be ready.
|
|
121
|
+
3. Use `channel.audio.say()`, `channel.audio.play()`, `channel.createAsr()`, or `channel.sip.sendDtmf()` normally.
|
|
122
|
+
4. Call `channel.sip.answer()` when you want to send the final `200 OK`.
|
|
123
|
+
|
|
124
|
+
For outbound calls, pre-answer is controlled by the remote side. If the remote endpoint sends `183 Session Progress` with SDP, ScriptEngine moves the call to `early`. If it answers directly, `waitForEarly()` resolves when the call becomes `active`.
|
|
125
|
+
|
|
126
|
+
`early` is a media-ready state, not a final answer state. `answer()` is still the explicit transition that sends final `200 OK` for inbound calls. External billing behavior depends on the carrier.
|
|
127
|
+
|
|
106
128
|
### Outbound Pre-Answer
|
|
107
129
|
|
|
108
130
|
For outbound calls, early media starts when the remote side sends a provisional response with SDP, usually `183 Session Progress`. This is useful for IVRs that speak before answering.
|
|
@@ -277,7 +299,7 @@ channel.audio.stop(2);
|
|
|
277
299
|
|
|
278
300
|
`PlayOptions.volume` changes the whole queue volume, not just one item. `stop(queue)` clears a queue and aborts in-flight sentence TTS for that queue. `stopAll()` clears every queue.
|
|
279
301
|
|
|
280
|
-
For sentence-split TTS,
|
|
302
|
+
For sentence-split TTS, queue item aliases are suffixed as `alias-0`, `alias-1`, and so on. Raw `play()` and direct streaming TTS use the alias exactly.
|
|
281
303
|
|
|
282
304
|
## TTS Credentials And Saved Phrases
|
|
283
305
|
|
|
@@ -361,7 +383,7 @@ const result = await platform.nlu.extract('I want to reschedule', {
|
|
|
361
383
|
});
|
|
362
384
|
```
|
|
363
385
|
|
|
364
|
-
Legacy platform APIs require `context.legacyV3Compat === true
|
|
386
|
+
Legacy platform APIs require `context.legacyV3Compat === true`. This includes NLU, outbound calls, dialog writes, messaging sends, and phrase records.
|
|
365
387
|
|
|
366
388
|
### Dialog State
|
|
367
389
|
|
package/dist/define-script.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ import type { LegacyGetRecordsParams, LegacyPhraseRecord } from './types/legacy-
|
|
|
7
7
|
* NLU (Natural Language Understanding) API.
|
|
8
8
|
*
|
|
9
9
|
* Provides intent/entity extraction through the legacy NLU v3 `/infer` endpoint.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* ScriptEngine allows this API when `context.legacyV3Compat` is `true` and NLU
|
|
11
|
+
* runtime settings are configured (`NLU_V3_BASE_URL` plus a resolved numeric
|
|
12
|
+
* agent id). Calls fail fast with a descriptive error otherwise.
|
|
13
13
|
*
|
|
14
14
|
* Compatible with logic-executor `nn.extract()` request/response shape.
|
|
15
15
|
*/
|
|
@@ -23,7 +23,7 @@ export interface NluScriptApi {
|
|
|
23
23
|
*
|
|
24
24
|
* @param utterance - User input text to analyze.
|
|
25
25
|
* @param options - Optional NLU filters and flags. `entities`, `intents`,
|
|
26
|
-
* `use_neuro_api`, and `use_synonyms` are forwarded by
|
|
26
|
+
* `use_neuro_api`, and `use_synonyms` are forwarded by ScriptEngine.
|
|
27
27
|
* @returns Raw parsed JSON response from the NLU `/infer` endpoint.
|
|
28
28
|
*/
|
|
29
29
|
extract(utterance: string, options?: NluExtractOptions): Promise<NluInferResult>;
|
|
@@ -97,7 +97,7 @@ export interface ScriptDialogContext {
|
|
|
97
97
|
/** `true` when the script runs without a real media channel (offline / queue / messaging). */
|
|
98
98
|
headless: boolean;
|
|
99
99
|
/**
|
|
100
|
-
* Persisted dialog environment for this conversation.
|
|
100
|
+
* Persisted dialog environment for this conversation. ScriptEngine converts the
|
|
101
101
|
* plain persisted `env` snapshot into this `BehaviorSubject` before invoking the script.
|
|
102
102
|
* On the first call the value is `undefined`.
|
|
103
103
|
*
|
|
@@ -138,7 +138,7 @@ export interface ScriptDialogContext {
|
|
|
138
138
|
* Injected by the runtime; absent only in tests or non-standard hosts.
|
|
139
139
|
*/
|
|
140
140
|
runTime?: ScriptRunTime;
|
|
141
|
-
/**
|
|
141
|
+
/** Opaque NLU runtime config managed by ScriptEngine. */
|
|
142
142
|
_nlu?: unknown;
|
|
143
143
|
[key: string]: unknown;
|
|
144
144
|
}
|
|
@@ -204,11 +204,11 @@ export interface ScheduleCallOptions {
|
|
|
204
204
|
/**
|
|
205
205
|
* Legacy compatibility field for callers that schedule without a current `scriptId`.
|
|
206
206
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
207
|
+
* ScriptEngine uses this to allow scheduling when the current script id is not
|
|
208
|
+
* available. It does not resolve script names or paths from this field.
|
|
209
209
|
*/
|
|
210
210
|
script?: string;
|
|
211
|
-
/** Reserved SIP channel/trunk hint.
|
|
211
|
+
/** Reserved SIP channel/trunk hint. Not used by the default ScriptEngine scheduler. */
|
|
212
212
|
channel?: string;
|
|
213
213
|
/** How many times to retry on failure. Stored as `recall_count` in call params. */
|
|
214
214
|
recallCount?: number;
|
|
@@ -292,9 +292,8 @@ export interface MessagingApi {
|
|
|
292
292
|
* Platform API — Voctiv platform–compatible operations available to scripts.
|
|
293
293
|
*
|
|
294
294
|
* Provides access to NLU, dialog state management, outbound call scheduling,
|
|
295
|
-
* phrase records, and messaging. These operations are legacy-platform backed
|
|
296
|
-
*
|
|
297
|
-
* NLU, `call`, `dialog` writes, messaging sends, and `getRecords`.
|
|
295
|
+
* phrase records, and messaging. These operations are legacy-platform backed and
|
|
296
|
+
* require `context.legacyV3Compat === true`.
|
|
298
297
|
*/
|
|
299
298
|
export interface PlatformApi {
|
|
300
299
|
/** NLU intent/entity extraction API; throws outside legacy V3 compatibility mode. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-script.d.ts","sourceRoot":"","sources":["../src/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;;;;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":";;AAuaA,oCAEC;AA3BD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,YAAY,CAAC,EAAY;IACvC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* **Agent scripting SDK** for `ScriptEngine`: 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
|
|
6
|
-
*
|
|
5
|
+
* These exports are types plus the `defineScript` identity helper; runtime behavior is
|
|
6
|
+
* provided by ScriptEngine when it loads and executes your script.
|
|
7
7
|
*
|
|
8
8
|
* ### Selecting ASR/TTS credentials by `key_storage.name` (Voctiv platform)
|
|
9
9
|
*
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* Channel defaults **`defaultAsrName`** / **`defaultTtsName`** apply when **`name`** is omitted.
|
|
20
20
|
*
|
|
21
21
|
* Legacy platform APIs (`platform.nlu`, `platform.call`, messaging sends, dialog writes, and phrase
|
|
22
|
-
* records) require `context.legacyV3Compat === true
|
|
22
|
+
* records) require `context.legacyV3Compat === true`.
|
|
23
23
|
*/
|
|
24
24
|
export { defineScript } from './define-script';
|
|
25
25
|
export type { ScriptContext, ScriptDialogContext, ScriptRunTime, ScriptResult, PersistedScriptResult, ScriptError, ScriptFn, NluScriptApi, PlatformApi, DialogApi, ScheduleCallOptions, SendMessageOptions, InboundMessage, MessagingApi, } from './define-script';
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
* **Agent scripting SDK** for `ScriptEngine`: 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
|
|
7
|
-
*
|
|
6
|
+
* These exports are types plus the `defineScript` identity helper; runtime behavior is
|
|
7
|
+
* provided by ScriptEngine when it loads and executes your script.
|
|
8
8
|
*
|
|
9
9
|
* ### Selecting ASR/TTS credentials by `key_storage.name` (Voctiv platform)
|
|
10
10
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* Channel defaults **`defaultAsrName`** / **`defaultTtsName`** apply when **`name`** is omitted.
|
|
21
21
|
*
|
|
22
22
|
* Legacy platform APIs (`platform.nlu`, `platform.call`, messaging sends, dialog writes, and phrase
|
|
23
|
-
* records) require `context.legacyV3Compat === true
|
|
23
|
+
* records) require `context.legacyV3Compat === true`.
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.isLegacyPhraseRecord = exports.LEGACY_PHRASE_RECORD_BRAND = exports.defineScript = void 0;
|
|
@@ -66,7 +66,7 @@ export interface AsrSmartTurnConfig {
|
|
|
66
66
|
*
|
|
67
67
|
* ### Vendor
|
|
68
68
|
*
|
|
69
|
-
* **`vendor`** is resolved via
|
|
69
|
+
* **`vendor`** is resolved via ScriptEngine vendor aliases (`"yandex"`, `"Y"`, `"neuro_v3"`, …). If you set
|
|
70
70
|
* **`name`** but omit **`vendor`**, the runtime may infer vendor from the key row’s **`platform`**
|
|
71
71
|
* in the catalog.
|
|
72
72
|
*/
|
|
@@ -16,7 +16,7 @@ import { TextInput } from './text-input';
|
|
|
16
16
|
* For SIP calls, `say()` and `play()` automatically wait for the RTP pipeline to be ready
|
|
17
17
|
* (early media or 200 OK) before starting playback. You do **not** need to call
|
|
18
18
|
* `sip.waitForEarly()` / `sip.waitForAnswer()` manually before speaking — the audio
|
|
19
|
-
* operation waits
|
|
19
|
+
* operation waits and starts as soon as the call enters `"early"` or `"active"` state.
|
|
20
20
|
*
|
|
21
21
|
* If the call terminates **before** any media is available, deferred `say`/`play` calls
|
|
22
22
|
* resolve as no-ops (they do not throw).
|
|
@@ -57,7 +57,7 @@ export interface ChannelAudio {
|
|
|
57
57
|
/**
|
|
58
58
|
* Download/decode **`source`** through the audio player.
|
|
59
59
|
*
|
|
60
|
-
* In
|
|
60
|
+
* In ScriptEngine this warms the decoder/audio-player path for `play()`;
|
|
61
61
|
* it does not synthesize TTS and does not populate the TTS cache used by `presay()`.
|
|
62
62
|
* @param source - URL or file path accepted by the host’s fetch layer.
|
|
63
63
|
*/
|
|
@@ -66,7 +66,7 @@ export interface ChannelAudio {
|
|
|
66
66
|
* Run TTS ahead of time and store PCM in the host TTS cache.
|
|
67
67
|
*
|
|
68
68
|
* Later `say()` calls with the same resolved TTS config and text can reuse the cached
|
|
69
|
-
* file. If the cache service is unavailable,
|
|
69
|
+
* file. If the cache service is unavailable, ScriptEngine logs a warning and
|
|
70
70
|
* resolves without throwing.
|
|
71
71
|
* @param text - Full text to synthesize.
|
|
72
72
|
* @param options - Same TTS-related options as **`say`** (vendor, **`name`**, **`ttsConfig`**).
|
|
@@ -81,7 +81,7 @@ export interface ChannelAudio {
|
|
|
81
81
|
* Remove one item by **`alias`**.
|
|
82
82
|
*
|
|
83
83
|
* When **`queue`** is omitted, the SIP/WS runtime searches all five queues. When set,
|
|
84
|
-
* only that queue is inspected. For sentence-split TTS,
|
|
84
|
+
* only that queue is inspected. For sentence-split TTS, queue item aliases are
|
|
85
85
|
* suffixed as `alias-0`, `alias-1`, etc.; remove the concrete suffix if you need to
|
|
86
86
|
* cancel one synthesized sentence.
|
|
87
87
|
* @param alias - **`PlayOptions.alias`** of the item to drop.
|
|
@@ -91,7 +91,7 @@ export interface ChannelAudio {
|
|
|
91
91
|
/**
|
|
92
92
|
* Stop playback and clear all pending items on a single queue.
|
|
93
93
|
*
|
|
94
|
-
* Also aborts in-flight sentence TTS generation for that queue
|
|
94
|
+
* Also aborts in-flight sentence TTS generation for that queue.
|
|
95
95
|
* @param queue - Queue index **0–4**.
|
|
96
96
|
*/
|
|
97
97
|
stop(queue: number): void;
|
|
@@ -182,7 +182,7 @@ export interface ChannelLlm {
|
|
|
182
182
|
/** Structured extraction / JSON-style fill from conversation context via Omni extract. */
|
|
183
183
|
extract(options?: ExtractOptions): Promise<Record<string, any>>;
|
|
184
184
|
/**
|
|
185
|
-
* Open a persistent Omni chat stream
|
|
185
|
+
* Open a persistent Omni chat stream.
|
|
186
186
|
* @param options - Default **`agentUuid`**, **`dialogUuid`**, etc.; per-**`send`** overrides allowed.
|
|
187
187
|
*/
|
|
188
188
|
makePersistentStream(options?: LlmOptions): PersistentLlmStreamHandle;
|
|
@@ -653,7 +653,7 @@ export interface ChannelSip {
|
|
|
653
653
|
* Cross-connect audio between this SIP call and another SIP call (conference bridge).
|
|
654
654
|
*
|
|
655
655
|
* Both parties hear each other in real time. Returns a teardown function
|
|
656
|
-
* that disconnects the bridge when called.
|
|
656
|
+
* that disconnects the bridge when called. ScriptEngine only bridges two
|
|
657
657
|
* `SipMediaChannel` instances directly; non-SIP channels return a no-op teardown
|
|
658
658
|
* or throw depending on the host.
|
|
659
659
|
*
|
package/dist/types/mixer.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface PlayOptions {
|
|
|
51
51
|
* Stable id for this queue item — used with **`remove`**, debug UIs, and completion tracking.
|
|
52
52
|
* Should be unique per logical utterance if you need to cancel a specific playback.
|
|
53
53
|
*
|
|
54
|
-
* For sentence-split TTS the runtime creates
|
|
54
|
+
* For sentence-split TTS the runtime creates item aliases by suffixing
|
|
55
55
|
* this value (`alias-0`, `alias-1`, ...). For raw `play()` and direct streaming TTS,
|
|
56
56
|
* the item uses this alias exactly.
|
|
57
57
|
*/
|
package/dist/types/nlu.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Options for `platform.nlu.extract()`.
|
|
3
3
|
*
|
|
4
|
-
* Compatible with logic-executor `NeuroNluRecognitionRequest`.
|
|
5
|
-
* `
|
|
4
|
+
* Compatible with logic-executor `NeuroNluRecognitionRequest`. ScriptEngine forwards
|
|
5
|
+
* `entities`, `intents`, `context`,
|
|
6
6
|
* `use_neuro_api`, and `use_synonyms` to NLU v3 `/infer`. Exclude fields are
|
|
7
7
|
* kept in the SDK for source compatibility with older scripts, but are not
|
|
8
|
-
*
|
|
8
|
+
* part of the default ScriptEngine request payload.
|
|
9
9
|
*/
|
|
10
10
|
export interface NluExtractOptions {
|
|
11
11
|
/** Include only these entity types (e.g. `"date"`, `"phone"`); forwarded as `entities`. */
|
|
12
12
|
entities?: string | string[] | null;
|
|
13
|
-
/** Legacy compatibility field;
|
|
13
|
+
/** Legacy compatibility field; not part of the default ScriptEngine request payload. */
|
|
14
14
|
entities_exclude?: string | string[] | null;
|
|
15
15
|
/** Include only these intent names; forwarded as `intents`. */
|
|
16
16
|
intents?: string | string[] | null;
|
|
17
|
-
/** Legacy compatibility field;
|
|
17
|
+
/** Legacy compatibility field; not part of the default ScriptEngine request payload. */
|
|
18
18
|
intents_exclude?: string | string[] | null;
|
|
19
19
|
/**
|
|
20
20
|
* Additional context for disambiguation.
|
package/dist/types/nlu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nlu.d.ts","sourceRoot":"","sources":["../../src/types/nlu.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACpC,
|
|
1
|
+
{"version":3,"file":"nlu.d.ts","sourceRoot":"","sources":["../../src/types/nlu.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACpC,wFAAwF;IACxF,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5C,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,wFAAwF;IACxF,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9D,+EAA+E;IAC/E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iFAAiF;IACjF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED