@voctiv/agent-sdk 0.2.10 → 0.2.12

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
@@ -1,10 +1,10 @@
1
1
  # @voctiv/agent-sdk
2
2
 
3
- TypeScript SDK for scripts executed by the `ScriptEngine` scripting runtime.
3
+ TypeScript SDK for voice and dialog scripts.
4
4
 
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.
5
+ The package exports `defineScript()` and types for media channels, SIP, ASR, TTS, LLM, dialog context, logging, and platform APIs.
6
6
 
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.
7
+ The SDK describes the objects injected into your script by the host runtime; it does not open calls or run services itself.
8
8
 
9
9
  ## Installation
10
10
 
@@ -121,7 +121,7 @@ For inbound calls, the script controls this explicitly:
121
121
  3. Use `channel.audio.say()`, `channel.audio.play()`, `channel.createAsr()`, or `channel.sip.sendDtmf()` normally.
122
122
  4. Call `channel.sip.answer()` when you want to send the final `200 OK`.
123
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`.
124
+ For outbound calls, pre-answer is controlled by the remote side. If the remote endpoint sends `183 Session Progress` with SDP, the host runtime moves the call to `early`. If it answers directly, `waitForEarly()` resolves when the call becomes `active`.
125
125
 
126
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
127
 
@@ -186,7 +186,128 @@ If the call terminates before media becomes available, deferred audio resolves a
186
186
  - `makeCall()` to create an outbound SIP B-leg from the main SIP channel.
187
187
  - `bridge(other)` to cross-connect two SIP channels.
188
188
 
189
- `makeCall()` and `bridge()` are only supported by the main SIP channel. Worker-isolated, WS, and headless channels do not create nested SIP legs.
189
+ `makeCall()` and `bridge()` are supported on SIP channels. The returned B-leg is a full
190
+ `MediaChannel` with the same API as the main channel. WS and headless channels do not create real SIP legs.
191
+
192
+ ### `channel.sip` Reference
193
+
194
+ SIP-only unless noted. WS/headless: most methods are no-ops; `state` behaves as synthetic `active`.
195
+
196
+ | Member | Description |
197
+ | --- | --- |
198
+ | `state` | Sync getter: `idle` \| `ringing` \| `early` \| `active` \| `holding` \| `terminated` |
199
+ | `isAnswered` | `true` after 200 OK (outbound received / inbound sent via `answer()`) |
200
+ | `state$` | Emits on every state transition |
201
+ | `progress$` | SIP 1xx provisional responses (`SipProgressEvent`) |
202
+ | `early$` | Emits once when RTP is up before final answer |
203
+ | `answered$` | Emits once on 200 OK |
204
+ | `dtmf$` | Remote DTMF digits (`DtmfEvent`: `digit`, `duration`) |
205
+ | `sipInfo$` | Raw SIP INFO messages (`SipInfo`) |
206
+ | `sipSignal$` | Low-level SIP stack events (`SipSignal`) |
207
+ | `sendProgress()` | Inbound: send 183 Session Progress → `early` |
208
+ | `waitForEarly()` | Await `early` or `active` (Promise) |
209
+ | `waitForAnswer()` | Await final 200 OK (Promise) |
210
+ | `answer()` | Inbound: send final 200 OK → `active` |
211
+ | `sendDtmf(digit, duration?)` | Send DTMF tone |
212
+ | `sendInfo(contentType, body)` | Send SIP INFO |
213
+ | `hold()` / `unhold()` | SIP hold |
214
+ | `mute()` / `unmute()` | Suppress local outgoing audio |
215
+ | `hangup()` | Terminate call |
216
+ | `makeCall(opts)` | Outbound B-leg (`MediaChannel`); `sipUri` or `msisdn` |
217
+ | `bridge(other)` | Cross-connect two SIP calls; returns teardown `() => void` |
218
+
219
+ Prefer `dtmf$` over `sipInfo$` for DTMF. Prefer `state$` / `early$` / `answered$` over raw `sipSignal$` unless you need low-level SIP details.
220
+
221
+ ### SIP Bridge
222
+
223
+ Use `channel.sip.makeCall()` when a live SIP script needs to create an outbound B-leg immediately and connect it to the current call. This is different from `platform.call()`, which schedules a separate platform-managed call.
224
+
225
+ For a normal SIP URI, pass `sipUri` explicitly:
226
+
227
+ ```ts
228
+ const bLeg = await channel.sip.makeCall({
229
+ sipUri: 'sip:+12025551234@trunk.example.com',
230
+ });
231
+
232
+ await bLeg.sip.waitForAnswer();
233
+
234
+ const teardown = channel.sip.bridge(bLeg);
235
+ ```
236
+
237
+ You can pass only `msisdn` instead of `sipUri`. The host resolves the SIP URI from agent and trunk settings and applies trunk caller-id options when configured.
238
+
239
+ ```ts
240
+ const bLeg = await channel.sip.makeCall({
241
+ msisdn: '+12025551234',
242
+ });
243
+
244
+ await bLeg.sip.waitForAnswer();
245
+ const teardown = channel.sip.bridge(bLeg);
246
+ ```
247
+
248
+ Pass `channel` as a trunk-name override when selecting which outbound trunk to use:
249
+
250
+ ```ts
251
+ const bLeg = await channel.sip.makeCall({
252
+ msisdn: '+12025551234',
253
+ channel: 'carrier-main',
254
+ });
255
+
256
+ await bLeg.sip.waitForAnswer();
257
+ const teardown = channel.sip.bridge(bLeg);
258
+ ```
259
+
260
+ The returned B-leg is a full `MediaChannel`. You can interact with it before or after bridging:
261
+
262
+ ```ts
263
+ const bLeg = await channel.sip.makeCall({
264
+ msisdn: '+12025551234',
265
+ });
266
+
267
+ await channel.audio.say('I am calling the second participant now.');
268
+
269
+ await bLeg.sip.waitForAnswer();
270
+ await bLeg.audio.say('You are about to be connected.');
271
+
272
+ const teardown = channel.sip.bridge(bLeg);
273
+
274
+ channel.events.terminated$.subscribe(() => {
275
+ teardown();
276
+ bLeg.sip.hangup();
277
+ });
278
+ ```
279
+
280
+ ```ts
281
+ const bLeg = await channel.sip.makeCall({
282
+ msisdn: '+12025551234',
283
+ channel: 'carrier-main',
284
+ });
285
+
286
+ await bLeg.sip.waitForEarly();
287
+
288
+ await bLeg.audio.say('Please wait while I connect the call.');
289
+
290
+ const asr = await bLeg.createAsr({ language: 'en-US' });
291
+ asr.result$.subscribe((text) => {
292
+ if (/operator/i.test(text)) {
293
+ bLeg.sip.sendDtmf('0');
294
+ }
295
+ });
296
+
297
+ await bLeg.sip.waitForAnswer();
298
+
299
+ const teardown = channel.sip.bridge(bLeg);
300
+
301
+ channel.events.terminated$.subscribe(() => {
302
+ teardown();
303
+ bLeg.sip.hangup();
304
+ asr.destroy();
305
+ });
306
+ ```
307
+
308
+ `bridge()` returns a teardown function. Call it when you want to disconnect the audio bridge without necessarily hanging up either leg. Use `bLeg.sip.hangup()` or `channel.sip.hangup()` when you want to terminate a call leg.
309
+
310
+ While a bridge is active, `channel.audio.say()` still sends audio only to the A-leg and `bLeg.audio.say()` sends audio only to the B-leg. These syntheses are mixed into the selected leg while the participants can also hear each other, so pause or tear down the bridge first if you need a private prompt.
190
311
 
191
312
  ## ASR, VAD, And Smart Turn
192
313
 
@@ -213,7 +334,7 @@ const asr = await channel.createAsr({
213
334
  `AsrHandle` exposes:
214
335
 
215
336
  - `result$`: finalized utterances.
216
- - `partial$`: streaming partial hypotheses.
337
+ - `partial$`: streaming partial hypotheses as `{ text, isFinal }`.
217
338
  - `speechStart$` / `speechEnd$`: VAD speech boundaries.
218
339
  - `interrupt$`: barge-in / interrupt events where the host supports them.
219
340
  - `vadProbability$`: normalized VAD probability when available.
@@ -258,9 +379,9 @@ Each vendor connector accepts its native parameter names:
258
379
 
259
380
  All vendors also accept the env-style names (`AZURE_SPEECH_KEY`, `ELEVENLABS_API_KEY`, etc.) for backwards compatibility, but vendor-native names are checked first and are preferred.
260
381
 
261
- ### Voctiv Platform ASR Key Selection
382
+ ### Platform ASR Key Selection
262
383
 
263
- In Voctiv legacy compatibility mode, ASR credentials can also be selected by logic-executor `key_storage.name`:
384
+ When platform credential catalogs are enabled, select ASR keys by **`name`**:
264
385
 
265
386
  ```ts
266
387
  const asr = await channel.createAsr({
@@ -269,12 +390,26 @@ const asr = await channel.createAsr({
269
390
  });
270
391
  ```
271
392
 
272
- The runtime looks in `channel.params.authentication_data.legacyAsrKeysByName[name]` for the current dialog agent and company. If `name` is omitted, `channel.params.defaultAsrName` may be used.
393
+ The host resolves credentials from `channel.params.authentication_data` for the current dialog agent and company. If `name` is omitted, `channel.params.defaultAsrName` may be used.
273
394
 
274
395
  When both `name` (platform key) and explicit `data` are provided, `data` values win — they are applied last and override anything resolved from the platform.
275
396
 
276
397
  ## TTS, Playback, And Mixer Queues
277
398
 
399
+ All audio playback goes through **`channel.audio`** (`ChannelAudio`). There are no top-level
400
+ `channel.say()` / `channel.play()` shortcuts on `MediaChannel`.
401
+
402
+ | Method | Purpose |
403
+ | --- | --- |
404
+ | `channel.audio.say(textOrObservable, options?)` | Synthesize text with TTS and play on a mixer queue |
405
+ | `channel.audio.play(source, options?)` | Play raw audio (URL, path, or platform phrase record) |
406
+ | `channel.audio.presay(text, options?)` | Pre-synthesize TTS into the host cache (no playback) |
407
+ | `channel.audio.preload(source, options?)` | Decode/warm a raw audio source (no playback) |
408
+ | `channel.audio.queue(index)` | Per-queue control handle (`MixerQueueControl`) |
409
+ | `channel.audio.remove(alias, queue?)` | Remove one queued item by alias |
410
+ | `channel.audio.stop(queue)` | Clear a queue **and** abort in-flight sentence TTS for it |
411
+ | `channel.audio.stopAll()` | Clear every queue (WS clients also get an audio interrupt) |
412
+
278
413
  `channel.audio.say(textOrObservable, options?)` synthesizes text and plays it through the mixer.
279
414
 
280
415
  ```ts
@@ -293,11 +428,11 @@ await channel.audio.say('Please wait while I check that.', {
293
428
  });
294
429
  ```
295
430
 
296
- Use full vendor names for `ttsVendor`. Dedicated TTS vendors include `"elevenlabs"`, `"google"`, and `"voctiv"`. The default TTS path can also accept compatible aliases such as `"azure"` or `"neuro_v3"`, depending on how ScriptEngine is configured.
431
+ Use full vendor names for `ttsVendor`. Dedicated TTS vendors include `"elevenlabs"`, `"google"`, and `"voctiv"`. The default TTS path can also accept compatible aliases such as `"azure"` or `"neuro_v3"`, depending on how the host runtime is configured.
297
432
 
298
433
  Vendor-native parameter names (`api_key`, `voice_id`, `model_id`, `base_url`) are passed directly to the connector and override any platform defaults. See [TTS Credentials And Vendor Parameters](#tts-credentials-and-vendor-parameters) for the full list of accepted keys per vendor.
299
434
 
300
- `channel.audio.play(source, options?)` plays raw audio from a URL/path or a `LegacyPhraseRecord`.
435
+ `channel.audio.play(source, options?)` plays raw audio from a URL/path or a phrase record from `platform.getRecords()`.
301
436
 
302
437
  ```ts
303
438
  await channel.audio.play('/opt/prompts/welcome.wav', {
@@ -306,9 +441,40 @@ await channel.audio.play('/opt/prompts/welcome.wav', {
306
441
  });
307
442
  ```
308
443
 
309
- `channel.audio.presay(text, options?)` pre-synthesizes TTS into the host TTS cache. If the cache is not available, the runtime logs a warning and resolves without throwing.
444
+ ### Pre-synthesis And Preload
445
+
446
+ `channel.audio.presay(text, options?)` runs TTS ahead of time and stores PCM in the host TTS
447
+ cache. Later `say()` calls with the same resolved TTS config and text can reuse the cached file.
448
+ Playback does **not** start. If the cache is unavailable, the runtime logs a warning and resolves
449
+ without throwing.
450
+
451
+ ```ts
452
+ await channel.audio.presay('Your balance is one hundred dollars.', {
453
+ ttsVendor: 'elevenlabs',
454
+ ttsConfig: { voice_id: 'bBLRWT6MSWBFAm76ZWXY' },
455
+ });
310
456
 
311
- `channel.audio.preload(source)` decodes a raw audio source through the audio player. It does not synthesize TTS and does not populate the TTS cache used by `presay()`.
457
+ // Later cache hit, faster playback:
458
+ await channel.audio.say('Your balance is one hundred dollars.', {
459
+ alias: 'balance',
460
+ ttsVendor: 'elevenlabs',
461
+ ttsConfig: { voice_id: 'bBLRWT6MSWBFAm76ZWXY' },
462
+ });
463
+ ```
464
+
465
+ `PresayOptions` accepts `ttsVendor`, `name`, `ttsConfig`, `ttsStrategy`, and optional `cache`
466
+ overrides (same shape as `PlayOptions.cache`).
467
+
468
+ `channel.audio.preload(source, options?)` downloads/decodes a **raw audio** source through the
469
+ audio player path. It does **not** synthesize TTS and does **not** populate the TTS cache used
470
+ by `presay()`. Use it to warm the decoder before `play()`.
471
+
472
+ ```ts
473
+ await channel.audio.preload('/opt/prompts/welcome.wav');
474
+ await channel.audio.play('/opt/prompts/welcome.wav', { alias: 'welcome' });
475
+ ```
476
+
477
+ When phrase persistence is enabled, `preload()` can store decoded audio for later playback via `platform.getRecords()`. Pass `options.cache` to override phrase name, flag, or language.
312
478
 
313
479
  ### TTS Strategies
314
480
 
@@ -322,24 +488,77 @@ When using an `Observable<string>` input, WS clients also receive text progress
322
488
 
323
489
  ### Mixer Queues
324
490
 
325
- The mixer has queues `0` through `4`. Use separate queues for main speech, earcons, hold music, or background audio.
491
+ The mixer has queues **`0` through `4`**. Use separate queues for main speech, earcons, hold
492
+ music, or background audio so barge-in on one queue does not cut unrelated audio.
493
+
494
+ Obtain a per-queue handle with **`channel.audio.queue(index)`** (`MixerQueueControl`):
495
+
496
+ | Member | Description |
497
+ | --- | --- |
498
+ | `index` | Queue index **0–4** |
499
+ | `volume` | Linear gain **0.0–1.0** for the entire queue (get/set) |
500
+ | `itemStarted$` | Emits item **`alias`** when playback starts |
501
+ | `itemFinished$` | Emits **`alias`** when an item finishes, is removed, or is skipped by clear |
502
+ | `queueEmpty$` | Emits when the queue is empty after all PCM has been mixed out |
503
+ | `remove(alias)` | Drop one item on this queue |
504
+ | `clear()` | Drop all items on this queue (does **not** abort in-flight TTS generation) |
505
+
506
+ Top-level helpers on **`channel.audio`**:
507
+
508
+ - **`remove(alias, queue?)`** — when `queue` is omitted, searches all five queues; when set, only that queue is checked.
509
+ - **`stop(queue)`** — same as `clear()` **plus** aborts in-flight sentence TTS for that queue.
510
+ - **`stopAll()`** — `stop()` on every queue; WS clients also receive an audio interrupt signal.
326
511
 
327
512
  ```ts
513
+ const tts = channel.audio.queue(0);
328
514
  const music = channel.audio.queue(2);
515
+
516
+ tts.itemStarted$.subscribe((alias) => logger.log('TTS started', { alias }));
517
+ tts.queueEmpty$.subscribe(() => logger.log('Agent queue idle'));
518
+
329
519
  music.volume = 0.25;
330
520
 
331
521
  await channel.audio.play('/opt/audio/hold.wav', {
332
522
  queue: 2,
333
523
  alias: 'hold-music',
334
524
  loop: true,
525
+ loopDelayMs: 500,
335
526
  });
336
527
 
337
- channel.audio.stop(2);
528
+ // Remove one earcon without touching TTS:
529
+ channel.audio.remove('hold-music', 2);
530
+
531
+ // Barge-in: stop agent speech and abort pending sentence synthesis:
532
+ channel.audio.stop(0);
533
+
534
+ // Or clear music only (no TTS abort on queue 0):
535
+ music.clear();
338
536
  ```
339
537
 
340
- `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.
538
+ `PlayOptions.volume` changes the whole queue volume, not just one item.
539
+
540
+ For sentence-split TTS, queue item aliases are suffixed as `alias-0`, `alias-1`, and so on. Raw
541
+ `play()` and direct streaming TTS use the alias exactly. Pass the suffixed alias to
542
+ `remove()` when cancelling a single synthesized sentence.
543
+
544
+ ### PlayOptions Reference
545
+
546
+ Shared by `say()`, `play()`, and (where noted) `presay()`:
547
+
548
+ | Field | Type | Applies to | Description |
549
+ | --- | --- | --- | --- |
550
+ | `queue` | `number?` | `say`, `play` | Mixer queue **0–4** (default **0**). |
551
+ | `alias` | `string?` | `say`, `play` | Stable item id for `remove()` and queue events. |
552
+ | `loop` | `boolean?` | `say`, `play` | Restart after finish until stopped/removed. |
553
+ | `loopDelayMs` | `number?` | `say`, `play` | Silence between loop iterations. |
554
+ | `volume` | `number?` | `say`, `play` | Sets **whole queue** gain **0.0–1.0** (not per-item). |
555
+ | `ttsStrategy` | `TtsStrategy?` | `say`, `presay` | `sentence` \| `streaming` \| `full`. |
556
+ | `ttsVendor` | `TtsVendor?` | `say`, `presay` | Override `channel.params.ttsVendor`. |
557
+ | `name` | `string?` | `say`, `presay` | Platform TTS credential **`name`** (key catalog selector). |
558
+ | `ttsConfig` | `Record<string, unknown>?` | `say`, `presay` | Vendor params; `name` key is stripped before send. |
559
+ | `cache` | `true \| CacheOptions?` | `say`, `presay` | TTS file cache; optional platform phrase persist. |
341
560
 
342
- 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.
561
+ `play()` ignores `tts*` and `cache` for raw audio. `preload()` only accepts `cache` overrides.
343
562
 
344
563
  ## TTS Credentials And Vendor Parameters
345
564
 
@@ -369,9 +588,9 @@ Each TTS vendor connector accepts its native parameter names:
369
588
 
370
589
  All vendors also accept the env-style names (`ELEVENLABS_API_KEY`, `ELEVENLABS_VOICE_ID`, etc.) for backwards compatibility, but vendor-native names are checked first and are preferred.
371
590
 
372
- ### Voctiv Platform TTS Key Selection
591
+ ### Platform TTS Key Selection
373
592
 
374
- In Voctiv legacy compatibility mode, TTS credentials can also be selected by `PlayOptions.name` or `ttsConfig.name`.
593
+ TTS credentials can also be selected by `PlayOptions.name` or `ttsConfig.name`:
375
594
 
376
595
  ```ts
377
596
  await channel.audio.say('Здравствуйте!', {
@@ -382,14 +601,14 @@ await channel.audio.say('Здравствуйте!', {
382
601
  });
383
602
  ```
384
603
 
385
- The runtime looks in `channel.params.authentication_data.legacyTtsKeysByName[name]`. If `name` is omitted, `channel.params.defaultTtsName` may be used.
604
+ The host resolves credentials from `channel.params.authentication_data` for the current agent and company. If `name` is omitted, `channel.params.defaultTtsName` may be used.
386
605
 
387
606
  When both `name` (platform key) and explicit `ttsConfig` values are provided, `ttsConfig` values win — they are applied last and override anything resolved from the platform.
388
607
 
389
608
  `cache` enables TTS result caching for `say()` and `presay()`:
390
609
 
391
- - **`cache: true`** — read/write TTS file cache only (Redis + filesystem + DB).
392
- - **`cache: { phraseName, flag?, language? }`** — TTS cache **plus** persist into Voctiv platform `record_phrase` / `record_phrase_file` so `platform.getRecords()` can retrieve the audio later.
610
+ - **`cache: true`** — read/write host TTS file cache.
611
+ - **`cache: { phraseName, flag?, language? }`** — TTS cache **plus** persist as a platform phrase so `platform.getRecords()` can retrieve the audio later.
393
612
 
394
613
  ```ts
395
614
  // Cache only (no platform persist):
@@ -415,12 +634,14 @@ if (records?.[0]) {
415
634
  }
416
635
  ```
417
636
 
418
- This requires legacy compatibility mode, a trusted LE agent id/UUID, TTS cache, and `LEGACY_V3_RECORD_PHRASE_ROOT`.
637
+ Phrase persistence requires platform phrase storage and TTS cache to be enabled on the host.
419
638
 
420
639
  ## Error Handling
421
640
 
422
641
  ASR and TTS errors are propagated to the script. Unhandled errors are always logged server-side, but scripts can catch them to react: fall back to a different vendor, notify the caller, or abort the dialog.
423
642
 
643
+ `channel.events.error$` is the canonical stream for media/runtime errors. TTS methods still reject their own promise when the awaited operation fails, and `AsrHandle.error$` still exposes errors scoped to one recognizer, but the same ASR/TTS failures are also emitted on `channel.events.error$`.
644
+
424
645
  ### TTS Errors — Promise Rejection
425
646
 
426
647
  `say()` and `play()` reject their promises when TTS/playback fails:
@@ -460,13 +681,16 @@ A degraded handle (returned when connector creation itself failed) has an inert
460
681
 
461
682
  ### Channel Error Stream
462
683
 
463
- `channel.events.error$` is a unified stream of all media errors — both ASR and TTS:
684
+ `channel.events.error$` is a unified stream of all media errors — ASR creation/runtime failures, TTS synthesis/playback failures, SIP/channel failures, and other host media errors:
464
685
 
465
686
  ```ts
466
687
  channel.events.error$.subscribe((err) => {
467
- logger.warn(`[${err.source}] ${err.message}`, {
688
+ logger.warn(`[${err.source}:${err.operation ?? 'unknown'}] ${err.message}`, {
689
+ phase: err.phase,
468
690
  code: err.code,
469
691
  vendor: err.vendor,
692
+ queue: err.queue,
693
+ alias: err.alias,
470
694
  });
471
695
  });
472
696
  ```
@@ -475,18 +699,67 @@ channel.events.error$.subscribe((err) => {
475
699
 
476
700
  | Field | Type | Description |
477
701
  | --- | --- | --- |
478
- | `source` | `'asr' \| 'tts' \| 'sip' \| 'channel'` | Which subsystem produced the error. |
702
+ | `source` | `'asr' \| 'tts' \| 'sip' \| 'channel' \| 'llm'` | Which subsystem produced the error. |
703
+ | `phase` | `'create' \| 'start' \| 'stream' \| 'playback' \| 'finalize' \| 'destroy'?` | Lifecycle phase where the error happened. |
704
+ | `operation` | `string?` | Public SDK operation, e.g. `createAsr`, `audio.say`, or `audio.play`. |
705
+ | `recoverable` | `boolean?` | Whether the runtime can keep the session alive after this error. |
706
+ | `handleId` | `string?` | ASR handle id when the error belongs to a recognizer instance. |
707
+ | `queue` | `number?` | Mixer queue index when the error belongs to an audio operation. |
708
+ | `alias` | `string?` | Queue item alias when the error belongs to playback. |
479
709
  | `message` | `string` | Human-readable description. |
480
- | `code` | `number?` | HTTP status, gRPC status, or WebSocket close code. |
710
+ | `code` | `number \| string?` | HTTP status, gRPC status, provider code, or WebSocket close code. |
481
711
  | `vendor` | `string?` | Vendor identifier, e.g. `"yandex"`, `"elevenlabs"`, `"azure"`. |
482
712
  | `details` | `unknown?` | Arbitrary provider-specific payload. |
713
+ | `cause` | `unknown?` | Original underlying error when available. |
483
714
 
484
715
  Subscribing to `error$` is optional. Old scripts that do not subscribe are not affected — the observables simply go unobserved.
485
716
 
717
+ ## Channel Events
718
+
719
+ `channel.events` exposes session-level observables that are **not** tied to a single ASR handle:
720
+
721
+ | Observable | Emits when |
722
+ | --- | --- |
723
+ | `speechStart$` | User started speaking (VAD, socket event, or synthetic text input). |
724
+ | `speechEnd$` | User stopped speaking (VAD end, ASR final, or synthetic text input). |
725
+ | `interrupt$` | Barge-in: user speech interrupted bot audio (may be inert without VAD). |
726
+ | `terminated$` | Session ending — hangup, WS disconnect, or `channel.destroy()`. |
727
+ | `message$` | Structured WS data messages (`DataMessage`: `{ event, payload }`). |
728
+ | `error$` | Unified media/runtime errors (see [Error Handling](#error-handling)). |
729
+
730
+ ```ts
731
+ channel.events.speechStart$.subscribe(() => {
732
+ channel.audio.stop(0); // barge-in on agent TTS queue
733
+ });
734
+
735
+ channel.events.message$.subscribe(({ event, payload }) => {
736
+ logger.log('WS client event', { event, payload });
737
+ });
738
+
739
+ channel.events.terminated$.subscribe(() => {
740
+ asr.destroy();
741
+ channel.destroy();
742
+ });
743
+ ```
744
+
745
+ **ASR vs channel events:** `AsrHandle.speechStart$` / `speechEnd$` / `interrupt$` are scoped to one
746
+ recognizer instance. `channel.events.*` aggregates session-level signals (useful when you do not
747
+ create ASR or want one subscription for the whole channel).
748
+
486
749
  ## LLM API
487
750
 
488
751
  `channel.llm` talks to the Omni LLM backend.
489
752
 
753
+ | Method | Returns | Description |
754
+ | --- | --- | --- |
755
+ | `ask(message, options?)` | `Promise<string>` | Single-shot completion (consumes SSE stream). |
756
+ | `stream(message, options?)` | `Observable<LlmStreamChunk>` | Token/chunk stream; use `chunk.content` for TTS. |
757
+ | `extract(options?)` | `Promise<Record<string, any>>` | Structured extraction via Omni extract API. |
758
+ | `makePersistentStream(options?)` | `PersistentLlmStreamHandle` | Long-lived stream for multi-turn chat. |
759
+
760
+ Common `LlmOptions`: `dialogUuid`, `agentUuid`, `role`, `hidden`, `name` (LLM speaker label — **not**
761
+ the TTS credential `name`), `payload`, `debug`, `agentAliasFilter`, `currentAgentAlias`.
762
+
490
763
  ```ts
491
764
  const answer = await channel.llm.ask('Summarize the user request', {
492
765
  role: 'assistant',
@@ -500,6 +773,8 @@ await channel.audio.say(answer);
500
773
  For streaming:
501
774
 
502
775
  ```ts
776
+ import { map } from 'rxjs';
777
+
503
778
  const stream$ = channel.llm.stream('Answer briefly', {
504
779
  role: 'assistant',
505
780
  });
@@ -510,13 +785,70 @@ await channel.audio.say(
510
785
  );
511
786
  ```
512
787
 
513
- `channel.llm.extract(options?)` runs structured extraction via Omni. `makePersistentStream(options?)` opens a long-lived Socket.IO stream and lets you send multiple turns without reconnecting.
788
+ Structured extraction:
789
+
790
+ ```ts
791
+ const fields = await channel.llm.extract({
792
+ prompt: 'Extract appointment date and time from the dialog.',
793
+ temperature: 0.2,
794
+ });
795
+ ```
796
+
797
+ Persistent multi-turn stream:
798
+
799
+ ```ts
800
+ const chat = channel.llm.makePersistentStream({
801
+ agentUuid: context.agentUuid,
802
+ dialogUuid: context.dialogUuid,
803
+ });
804
+
805
+ chat.stream$.pipe(map((c) => c.content)).subscribe((text) => logger.debug('LLM chunk', { text }));
806
+
807
+ chat.send('What is my balance?');
808
+ chat.send('And my last payment date?');
809
+ chat.disconnect();
810
+ ```
811
+
812
+ ## Script Return Value
813
+
814
+ Scripts may return `void` or a **`ScriptResult`**:
815
+
816
+ ```ts
817
+ return {
818
+ output: { intent: 'reschedule', score: 0.92 },
819
+ };
820
+ ```
821
+
822
+ - **`output`** — stored in dialog stats / host persistence.
823
+ - **`error`** — optional; usually auto-populated on crash, but scripts may set it explicitly.
824
+
825
+ **Do not** return `env` from the script. Persist state via `context.env$`; the runtime snapshots it
826
+ after completion into **`PersistedScriptResult.env`**.
827
+
828
+ Use **`getScriptPhase(context)`** to branch on lifecycle (`online`, `messaging`, `recall`, etc.):
829
+
830
+ ```ts
831
+ import { defineScript, getScriptPhase } from '@voctiv/agent-sdk';
832
+
833
+ export default defineScript(async ({ context }) => {
834
+ switch (getScriptPhase(context)) {
835
+ case 'online':
836
+ // live call
837
+ break;
838
+ case 'messaging':
839
+ // inbound message handling
840
+ break;
841
+ }
842
+ });
843
+ ```
514
844
 
515
845
  ## Platform API
516
846
 
517
- `platform` exposes Voctiv platform operations.
847
+ `platform` exposes platform operations.
518
848
 
519
- `platform.nlu.extract(utterance, options?)` calls NLU v3 `/infer`. The runtime sends `phrase`, `context`, and `agent_id`. If `options.context` is omitted, current dialog params are serialized and used as NLU context.
849
+ `platform.nlu.extract(utterance, options?)` runs intent/entity extraction. If `options.context` is omitted, current dialog params are serialized and used as NLU context.
850
+
851
+ `platform.nlu.extract$()` is an Observable wrapper — one `extract()` call per subscription, not a streaming NLU session.
520
852
 
521
853
  ```ts
522
854
  const result = await platform.nlu.extract('I want to reschedule', {
@@ -526,7 +858,7 @@ const result = await platform.nlu.extract('I want to reschedule', {
526
858
  });
527
859
  ```
528
860
 
529
- Platform APIs require `context.legacyV3Compat === true`. This includes NLU, outbound calls, dialog writes, messaging sends, and phrase records.
861
+ Platform APIs (`platform.nlu`, `platform.call`, dialog writes, messaging, phrase records) are available when the host enables platform integration.
530
862
 
531
863
  ### Dialog State
532
864
 
@@ -535,7 +867,7 @@ platform.dialog.entryPoint = 'on_recall';
535
867
  platform.dialog.result = 'done';
536
868
  ```
537
869
 
538
- Setters update the local value immediately and ask the platform DB to persist asynchronously. They are not awaitable and should not be used as transactional writes.
870
+ Setters update the local value immediately and persist to the platform asynchronously. They are not awaitable and should not be used as transactional writes.
539
871
 
540
872
  ### Platform-Scheduled Calls
541
873
 
@@ -547,6 +879,8 @@ The destination number should be E.164 formatted.
547
879
  await platform.call('+12025551234');
548
880
  ```
549
881
 
882
+ When options are omitted, the host fills scheduling and routing defaults from agent and dialog settings. Explicit `options` always win.
883
+
550
884
  By default, the platform schedules the call for immediate processing. Use `date` to schedule it for the future:
551
885
 
552
886
  ```ts
@@ -610,7 +944,7 @@ await platform.messaging.send({
610
944
  });
611
945
  ```
612
946
 
613
- Outbound messages are transported through legacy Redis streams. `platform.messaging.message$` currently replays the inbound message that started a headless messaging script; it is not a live subscription to all future Redis messages.
947
+ `platform.messaging.message$` replays the inbound message that started a headless messaging script; it is not a live subscription to all future messages.
614
948
 
615
949
  ## Offline / Headless Logic
616
950
 
@@ -635,11 +969,7 @@ export default defineScript(async ({ channel, context, logger, platform }) => {
635
969
  });
636
970
  ```
637
971
 
638
- Headless sessions can be started by host integrations such as:
639
-
640
- - a platform dialog queue worker that loads pending dialogs;
641
- - an inbound messaging worker, usually with `context.entryPoint === 'on_message_api_received'`;
642
- - an HTTP/API request that asks ScriptEngine to run a script without media.
972
+ Headless sessions can be started by the host for background processing, inbound messaging, or API-triggered runs without media.
643
973
 
644
974
  ### What Works In Headless
645
975
 
@@ -647,7 +977,7 @@ These APIs are available and are the intended tools for offline scripts:
647
977
 
648
978
  - `context.dialogParams`, `context.initialData`, `context.dialogEntity`, and `context.callEntity` for platform data.
649
979
  - `context.env$` for persisted per-dialog state.
650
- - `platform.nlu.extract()` for text NLU when legacy platform compatibility is enabled.
980
+ - `platform.nlu.extract()` for text NLU when platform integration is enabled.
651
981
  - `platform.messaging.send()` for outbound messages through the configured platform messaging transport.
652
982
  - `platform.call()` for scheduling outbound platform-managed calls.
653
983
  - `platform.dialog.entryPoint` and `platform.dialog.result` for updating dialog routing and outcome.
@@ -726,7 +1056,7 @@ context.env$?.next({
726
1056
  });
727
1057
  ```
728
1058
 
729
- Do not return `env` from the script. ScriptEngine snapshots `context.env$` after completion and persists it according to the host integration.
1059
+ Do not return `env` from the script. The runtime snapshots `context.env$` after completion and persists it for the dialog.
730
1060
 
731
1061
  ### Combining Voice And Offline In One Script
732
1062
 
@@ -755,6 +1085,36 @@ export default defineScript(async ({ channel, context, platform }) => {
755
1085
 
756
1086
  `context` includes identity, telephony fields, params, routing metadata, and runtime helpers.
757
1087
 
1088
+ ### Agent env and storage
1089
+
1090
+ When the host exposes agent identity, `context.agent` provides agent-scoped global variables:
1091
+
1092
+ ```ts
1093
+ // Read all agent env keys
1094
+ const all = await context.agent?.env?.();
1095
+
1096
+ // Read one key
1097
+ const counter = await context.agent?.env?.<number>('visitCount');
1098
+
1099
+ // Write with optional TTL (days)
1100
+ await context.agent?.env?.('visitCount', 42, { expire: 30 });
1101
+ ```
1102
+
1103
+ `context.storage('key1', 'key2')` reads CMS/global variables from agent settings, then company-level
1104
+ fallback. Always returns an object with every requested key (value or `null`).
1105
+
1106
+ ### Execution budget (`runTime`)
1107
+
1108
+ Long-running async scripts can check and extend their time budget:
1109
+
1110
+ ```ts
1111
+ if ((context.runTime?.remainingMs() ?? Infinity) < 5000) {
1112
+ context.runTime?.extend(30_000);
1113
+ }
1114
+ ```
1115
+
1116
+ `budgetMs` and `maxExtendMs` are fixed for the session; `extend()` grants up to the remaining quota.
1117
+
758
1118
  Important fields:
759
1119
 
760
1120
  - `context.dialogUuid`: current dialog UUID.
@@ -790,7 +1150,7 @@ logger.log('ASR result received', { text });
790
1150
  logger.warn('Low confidence intent', { confidence });
791
1151
  ```
792
1152
 
793
- `logger.enableDebug(endpoint)` streams logs from the current script instance to a remote debug endpoint. `logger.breakpoint(label, snapshot?)` pauses only when an active debug session is connected; otherwise it resolves immediately.
1153
+ `logger.enableDebug(endpoint)` streams logs from the current script instance to a remote debug endpoint. `logger.disableDebug()` stops streaming. `logger.breakpoint(label, snapshot?)` pauses only when an active debug session is connected; otherwise it resolves immediately.
794
1154
 
795
1155
  ## WS And Headless Behavior
796
1156
 
@@ -825,15 +1185,7 @@ This is mainly for WS debug clients and automated tests. Unknown ASR ids are ign
825
1185
 
826
1186
  ## Package Notes
827
1187
 
828
- The package is published as CommonJS with TypeScript declarations in `dist`.
829
-
830
- Build locally with:
831
-
832
- ```bash
833
- npm run build
834
- ```
835
-
836
- The package exports only the public SDK entry point:
1188
+ The package ships as CommonJS with TypeScript declarations. Import from `@voctiv/agent-sdk`:
837
1189
 
838
1190
  ```ts
839
1191
  import { defineScript, type MediaChannel, type AsrHandle, type MediaError } from '@voctiv/agent-sdk';
package/dist/index.d.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  /**
2
2
  * @packageDocumentation
3
- * **Agent scripting SDK** for `ScriptEngine`: typed **`defineScript`** context,
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; runtime behavior is
6
- * provided by ScriptEngine when it loads and executes your script.
3
+ * **Agent scripting SDK**: typed **`defineScript`** context,
4
+ * {@link import('./types/media-channel').MediaChannel}, ASR/TTS, LLM, SIP, and platform helpers.
5
+ *
6
+ * Full API reference: **`README.md`** in this package (`@voctiv/agent-sdk` on npm).
7
7
  *
8
- * ### Selecting ASR/TTS credentials by `key_storage.name` (Voctiv platform)
8
+ * These exports are types plus the `defineScript` identity helper; runtime behavior is
9
+ * provided by the host when it loads and executes your script.
9
10
  *
10
- * When the host enables Voctiv platform PostgreSQL key auth, **`channel.params.authentication_data`**
11
- * may contain:
12
- * - **`legacyAsrKeysByName`**: map **`name`** → `{ platform, flat }` for ASR
13
- * - **`legacyTtsKeysByName`**: same for TTS
11
+ * ### Selecting ASR/TTS credentials by name (platform key catalog)
14
12
  *
15
- * Rows are scoped to **this dialog's agent and company** (no agent UUID in the script). Use:
13
+ * When the host loads platform credential catalogs, **`channel.params.authentication_data`**
14
+ * may contain named ASR/TTS key rows for the current dialog agent and company. Use:
16
15
  * - {@link import('./types/asr-handle').AsrConfig.name} or **`data.name`** on **`createAsr`**
17
16
  * - {@link import('./types/mixer').PlayOptions.name} or **`ttsConfig.name`** on **`say`/`play`/`presay`**
18
17
  *
19
18
  * Channel defaults **`defaultAsrName`** / **`defaultTtsName`** apply when **`name`** is omitted.
20
19
  *
21
- * Legacy platform APIs (`platform.nlu`, `platform.call`, messaging sends, dialog writes, and phrase
22
- * records) require `context.legacyV3Compat === true`.
20
+ * Platform APIs (`platform.nlu`, `platform.call`, messaging, dialog writes, phrase records)
21
+ * are available when the host enables platform integration.
23
22
  */
24
23
  export { defineScript } from './define-script';
25
24
  export type { ScriptContext, ScriptFn } from './define-script';
26
- export type { ScriptDialogContext, ScriptRunTime, ScriptResult, PersistedScriptResult, ScriptError, } from './types/script-context';
25
+ export type { ScriptDialogContext, ScriptPhase, ScriptRunTime, ScriptResult, PersistedScriptResult, ScriptError, AgentContext, AgentEnvSetOptions, StorageContextApi, } from './types/script-context';
26
+ export { getScriptPhase } from './types/script-context';
27
27
  export type { NluScriptApi, PlatformApi, DialogApi, ScheduleCallOptions, SendMessageOptions, InboundMessage, MessagingApi, } from './types/platform';
28
28
  export type { ScriptLogger } from './types/logger';
29
29
  export type { MediaChannel, ChannelAudio, ChannelEvents, } from './types/media-channel';
@@ -1 +1 @@
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,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE/D,YAAY,EACV,mBAAmB,EACnB,aA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BAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,31 +1,32 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @packageDocumentation
4
- * **Agent scripting SDK** for `ScriptEngine`: typed **`defineScript`** context,
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; runtime behavior is
7
- * provided by ScriptEngine when it loads and executes your script.
4
+ * **Agent scripting SDK**: typed **`defineScript`** context,
5
+ * {@link import('./types/media-channel').MediaChannel}, ASR/TTS, LLM, SIP, and platform helpers.
6
+ *
7
+ * Full API reference: **`README.md`** in this package (`@voctiv/agent-sdk` on npm).
8
8
  *
9
- * ### Selecting ASR/TTS credentials by `key_storage.name` (Voctiv platform)
9
+ * These exports are types plus the `defineScript` identity helper; runtime behavior is
10
+ * provided by the host when it loads and executes your script.
10
11
  *
11
- * When the host enables Voctiv platform PostgreSQL key auth, **`channel.params.authentication_data`**
12
- * may contain:
13
- * - **`legacyAsrKeysByName`**: map **`name`** → `{ platform, flat }` for ASR
14
- * - **`legacyTtsKeysByName`**: same for TTS
12
+ * ### Selecting ASR/TTS credentials by name (platform key catalog)
15
13
  *
16
- * Rows are scoped to **this dialog's agent and company** (no agent UUID in the script). Use:
14
+ * When the host loads platform credential catalogs, **`channel.params.authentication_data`**
15
+ * may contain named ASR/TTS key rows for the current dialog agent and company. Use:
17
16
  * - {@link import('./types/asr-handle').AsrConfig.name} or **`data.name`** on **`createAsr`**
18
17
  * - {@link import('./types/mixer').PlayOptions.name} or **`ttsConfig.name`** on **`say`/`play`/`presay`**
19
18
  *
20
19
  * Channel defaults **`defaultAsrName`** / **`defaultTtsName`** apply when **`name`** is omitted.
21
20
  *
22
- * Legacy platform APIs (`platform.nlu`, `platform.call`, messaging sends, dialog writes, and phrase
23
- * records) require `context.legacyV3Compat === true`.
21
+ * Platform APIs (`platform.nlu`, `platform.call`, messaging, dialog writes, phrase records)
22
+ * are available when the host enables platform integration.
24
23
  */
25
24
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isLegacyPhraseRecord = exports.LEGACY_PHRASE_RECORD_BRAND = exports.defineScript = void 0;
25
+ exports.isLegacyPhraseRecord = exports.LEGACY_PHRASE_RECORD_BRAND = exports.getScriptPhase = exports.defineScript = void 0;
27
26
  var define_script_1 = require("./define-script");
28
27
  Object.defineProperty(exports, "defineScript", { enumerable: true, get: function () { return define_script_1.defineScript; } });
28
+ var script_context_1 = require("./types/script-context");
29
+ Object.defineProperty(exports, "getScriptPhase", { enumerable: true, get: function () { return script_context_1.getScriptPhase; } });
29
30
  var legacy_phrase_1 = require("./types/legacy-phrase");
30
31
  Object.defineProperty(exports, "LEGACY_PHRASE_RECORD_BRAND", { enumerable: true, get: function () { return legacy_phrase_1.LEGACY_PHRASE_RECORD_BRAND; } });
31
32
  Object.defineProperty(exports, "isLegacyPhraseRecord", { enumerable: true, get: function () { return legacy_phrase_1.isLegacyPhraseRecord; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAEH,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAmDrB,uDAG+B;AAF7B,2HAAA,0BAA0B,OAAA;AAC1B,qHAAA,oBAAoB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAerB,yDAAwD;AAA/C,gHAAA,cAAc,OAAA;AA0CvB,uDAG+B;AAF7B,2HAAA,0BAA0B,OAAA;AAC1B,qHAAA,oBAAoB,OAAA"}
@@ -6,14 +6,28 @@
6
6
  */
7
7
  export interface MediaError {
8
8
  /** Which subsystem produced the error. */
9
- source: 'asr' | 'tts' | 'sip' | 'channel';
9
+ source: 'asr' | 'tts' | 'sip' | 'channel' | 'llm';
10
+ /** Lifecycle phase where the error happened. */
11
+ phase?: 'create' | 'start' | 'stream' | 'playback' | 'finalize' | 'destroy';
12
+ /** Public SDK operation that produced the error, e.g. `createAsr`, `audio.say`, or `audio.play`. */
13
+ operation?: string;
14
+ /** Whether the runtime can keep the session alive after this error. */
15
+ recoverable?: boolean;
16
+ /** ASR handle id when the error belongs to a specific recognizer instance. */
17
+ handleId?: string;
18
+ /** Mixer queue index when the error belongs to an audio operation. */
19
+ queue?: number;
20
+ /** Queue item alias when the error belongs to a specific playback item. */
21
+ alias?: string;
10
22
  /** Human-readable description (same string that appears in server logs). */
11
23
  message: string;
12
24
  /** HTTP status code, gRPC status, or WebSocket close code when available. */
13
- code?: number;
25
+ code?: number | string;
14
26
  /** Vendor/engine identifier, e.g. `"yandex"`, `"elevenlabs"`, `"azure"`. */
15
27
  vendor?: string;
16
28
  /** Arbitrary provider-specific payload for advanced diagnostics. */
17
29
  details?: unknown;
30
+ /** Original provider/runtime error when available in-process. */
31
+ cause?: unknown;
18
32
  }
19
33
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IAC1C,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;IAClD,gDAAgD;IAChD,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC5E,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
@@ -92,7 +92,7 @@ export interface ChannelAudio {
92
92
  * suffixed as `alias-0`, `alias-1`, etc.; remove the concrete suffix if you need to
93
93
  * cancel one synthesized sentence.
94
94
  * @param alias - **`PlayOptions.alias`** of the item to drop.
95
- * @param queue - Queue index; defaults to **0**.
95
+ * @param queue - When set, only this queue index is searched; when omitted, all five queues are searched.
96
96
  */
97
97
  remove(alias: string, queue?: number): void;
98
98
  /**
@@ -118,12 +118,13 @@ export interface ChannelEvents {
118
118
  /** Structured messages from the WS client or bridge (event + payload). */
119
119
  readonly message$: Observable<DataMessage>;
120
120
  /**
121
- * Unified stream of runtime media errors (ASR connector failures, TTS HTTP errors,
122
- * missing API keys, etc.).
121
+ * Canonical stream of runtime media errors (ASR connector creation/runtime failures,
122
+ * TTS synthesis/playback failures, missing API keys, etc.).
123
123
  *
124
- * Subscribing is optional unhandled errors are always logged server-side. Use this
125
- * when the script needs to react (e.g. fall back to a different vendor, notify the
126
- * caller, or abort the dialog).
124
+ * TTS methods still reject their own promises when the awaited operation fails, and
125
+ * `AsrHandle.error$` still exposes recognizer-scoped errors, but the same failures
126
+ * are also emitted here for one-place monitoring. Subscribing is optional —
127
+ * unhandled errors are always logged server-side.
127
128
  *
128
129
  * ```ts
129
130
  * channel.events.error$.subscribe(err => {
@@ -1 +1 @@
1
- {"version":3,"file":"media-channel.d.ts","sourceRoot":"","sources":["../../src/types/media-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,MAAM,EA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AyF;IACzF,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACvC,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;CACzC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAElD,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IAEzB,6GAA6G;IAC7G,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,wFAAwF;IACxF,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -137,7 +137,8 @@ export interface MixerQueueControl {
137
137
  readonly itemStarted$: Observable<string>;
138
138
  /** Emits **`alias`** when an item finishes, is removed, or is skipped by queue clear. */
139
139
  readonly itemFinished$: Observable<string>;
140
- /** Emits whenever the queue becomes empty after all pending/current items are gone. */
140
+ /** Emits whenever the queue becomes empty after all pending/current items are gone
141
+ * and their PCM has been emitted to the mixer output (not merely dequeued). */
141
142
  readonly queueEmpty$: Observable<void>;
142
143
  /**
143
144
  * Remove a single item by **`alias`**.
@@ -1 +1 @@
1
- {"version":3,"file":"mixer.d.ts","sourceRoot":"","sources":["../../src/types/mixer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,QAAQ,GACR,OAAO,GACP,UAAU,GACV,UAAU,GACV,eAAe,GACf,aAAa,GACb,KAAK,GACL,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;CAC7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AE,MAAM,CAAC;IACvB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IAEf,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1C,yFAAyF;IACzF,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC3C;oFACgF;IAChF,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAEvC;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,uDAAuD;IACvD,KAAK,IAAI,IAAI,CAAC;CACf"}
@@ -46,17 +46,18 @@ export interface ScheduleCallOptions {
46
46
  */
47
47
  entryPoint?: string;
48
48
  /**
49
- * Legacy compatibility field for callers that schedule without a current `scriptId`.
49
+ * Legacy compatibility field for old callers.
50
50
  *
51
- * ScriptEngine uses this to allow scheduling when the current script id is not
52
- * available. It does not resolve script names or paths from this field.
51
+ * Outbound calls can be scheduled without a legacy `script_id`; the dialer can
52
+ * resolve the runtime script from the agent UUID. This field is not used to
53
+ * resolve script names or paths.
53
54
  */
54
55
  script?: string;
55
56
  /**
56
57
  * Legacy trunk id as string or number (same as LE `call.trunk_id`) when `trunkId` is not set.
57
58
  * Forwarded to the dialer for `X-Via-Trunk` / gateway routing.
58
59
  */
59
- channel?: string;
60
+ channel?: string | number;
60
61
  /** How many times to retry on failure. Stored as `recall_count` in call params. */
61
62
  recallCount?: number;
62
63
  /** Delay in seconds between retries. Stored as `recall_delay` in call params. */
@@ -73,8 +74,8 @@ export interface ScheduleCallOptions {
73
74
  protoAdditional?: Record<string, string>;
74
75
  /**
75
76
  * LE `call.trunk_id` — required for the legacy mass outbound dialer to originate SIP.
76
- * If omitted, the scheduler tries `channel` (numeric), `dialog.params.trunk_id`, then
77
- * env `LEGACY_V3_SCHEDULED_CALL_DEFAULT_TRUNK_ID`.
77
+ * If omitted, the scheduler tries `channel` (numeric), `dialog.params.trunk_id`,
78
+ * `agent.trunk_id`, then env `LEGACY_V3_SCHEDULED_CALL_DEFAULT_TRUNK_ID`.
78
79
  */
79
80
  trunkId?: number;
80
81
  /** LE `call.pool_id` when absent from dialog params. */
@@ -151,6 +152,10 @@ export interface MessagingApi {
151
152
  * Provides access to NLU, dialog state management, outbound call scheduling,
152
153
  * phrase records, and messaging. These operations are legacy-platform backed and
153
154
  * require `context.legacyV3Compat === true`.
155
+ *
156
+ * `platform.call(msisdn)` may be called without options. The host fills omitted
157
+ * scheduling/routing fields from agent/dialog settings when available; explicit
158
+ * `options` always win over those defaults.
154
159
  */
155
160
  export interface PlatformApi {
156
161
  /** NLU intent/entity extraction API; throws outside legacy V3 compatibility mode. */
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/types/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;OAWG;IACH,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CACN,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,UAAU,CAAC,cAAc,CAAC,CAAC;CAC/B;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,UAAU,CA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,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE;;;;;OAKG;IACH,UAAU,CAAC,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CAC5E"}
@@ -1,5 +1,26 @@
1
1
  import type { BehaviorSubject } from 'rxjs';
2
2
  import type { InboundMessage } from './platform';
3
+ /** Options for writing legacy LE-style agent environment values. */
4
+ export interface AgentEnvSetOptions {
5
+ /** TTL in days, matching legacy `nn.agent.env(..., expire=days)`. */
6
+ expire?: number;
7
+ }
8
+ /** Legacy LE-style global environment shared by all dialogs of the agent. */
9
+ export interface AgentContext {
10
+ /** Numeric NLU / LE agent id, when resolved by the host. */
11
+ id?: number;
12
+ /** Omni / LE agent UUID, when resolved by the host. */
13
+ uuid?: string;
14
+ /** Read/write agent-level env stored in Redis under `agent:{uuid}`. */
15
+ env?: {
16
+ (): Promise<Record<string, unknown>>;
17
+ <T = unknown>(key: string): Promise<T | undefined>;
18
+ (key: string, value: unknown, options?: AgentEnvSetOptions): Promise<void>;
19
+ (values: Record<string, unknown>, options?: AgentEnvSetOptions): Promise<void>;
20
+ };
21
+ }
22
+ /** Read LE/CMS global variables from `storage` with agent → company fallback. */
23
+ export type StorageContextApi = (...keys: string[]) => Promise<Record<string, string | null>>;
3
24
  /**
4
25
  * First-level **`context`** passed to every **`defineScript`** handler.
5
26
  *
@@ -37,6 +58,13 @@ export interface ScriptDialogContext {
37
58
  * May be `0` when no agent id is configured; NLU and `platform.call()` will then fail.
38
59
  */
39
60
  agentId: number;
61
+ /** Agent identity and legacy global agent env (`context.agent.env`). */
62
+ agent?: AgentContext;
63
+ /**
64
+ * Read global variables configured in agent settings, then company-level globals.
65
+ * Always returns an object containing every requested key.
66
+ */
67
+ storage?: StorageContextApi;
40
68
  /**
41
69
  * **Snapshot** of dialog/session payload when the script run started.
42
70
  *
@@ -79,8 +107,9 @@ export interface ScriptDialogContext {
79
107
  * attaches it to the persisted result; the script return value must not carry env
80
108
  * (see {@link ScriptResult}).
81
109
  *
82
- * Session runners decide where that snapshot is stored. In Voctiv platform compatibility
83
- * mode it is used as the LE-style dialog environment.
110
+ * Session runners load the previous snapshot from Redis (`dialog:{uuid}`) at start and
111
+ * persist the final `env$` snapshot after every run (SIP, WebSocket, headless). Same key
112
+ * as legacy logic-executor `nn.env`.
84
113
  */
85
114
  env$?: BehaviorSubject<Record<string, unknown> | undefined>;
86
115
  /** Raw `dialog` table row from the Voctiv platform database. */
@@ -139,6 +168,23 @@ export interface ScriptRunTime {
139
168
  */
140
169
  extend(requestedMs: number): number;
141
170
  }
171
+ /**
172
+ * High-level phase of a script execution lifecycle. Useful for branching logic
173
+ * between pre-call preparation, the live call, and post-call processing.
174
+ */
175
+ export type ScriptPhase = 'before_call' | 'online' | 'after_call_success' | 'after_call_failed' | 'messaging' | 'recall' | 'headless_other';
176
+ /**
177
+ * Determines which phase of the dialog lifecycle the script is currently executing in.
178
+ *
179
+ * - `before_call` — headless run that typically schedules an outbound call.
180
+ * - `online` — live SIP/media session (voice call active).
181
+ * - `after_call_success` — headless run after a successful call completion.
182
+ * - `after_call_failed` — headless run after call failure (no answer, reject, etc.).
183
+ * - `messaging` — headless run triggered by an inbound message.
184
+ * - `recall` — headless recall attempt.
185
+ * - `headless_other` — any other headless invocation not matching the above.
186
+ */
187
+ export declare function getScriptPhase(context: ScriptDialogContext): ScriptPhase;
142
188
  /** Error info attached to {@link ScriptResult} when a script fails. */
143
189
  export interface ScriptError {
144
190
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"script-context.d.ts","sourceRoot":"","sources":["../../src/types/script-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,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AAC;IAExB,yDAAyD;IACzD,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yFAAyF;IACzF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,WAAW,IAAI,MAAM,CAAC;IACtB,4CAA4C;IAC5C,iBAAiB,IAAI,MAAM,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,aAAa,GACb,QAAQ,GACR,oBAAoB,GACpB,mBAAmB,GACnB,WAAW,GACX,QAAQ,GACR,gBAAgB,CAAC;AAarB;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAaxE;AAED,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,uEAAuE;IACvE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B"}
@@ -1,3 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getScriptPhase = getScriptPhase;
4
+ const AFTER_CALL_SUCCESS_ENTRY_POINTS = new Set([
5
+ 'on_success_call',
6
+ 'after_call_success',
7
+ 'on_done_call',
8
+ ]);
9
+ const AFTER_CALL_FAILED_ENTRY_POINTS = new Set([
10
+ 'on_failed_call',
11
+ 'after_call_failed',
12
+ ]);
13
+ const RECALL_ENTRY_POINTS = new Set(['on_recall', 'recall']);
14
+ /**
15
+ * Determines which phase of the dialog lifecycle the script is currently executing in.
16
+ *
17
+ * - `before_call` — headless run that typically schedules an outbound call.
18
+ * - `online` — live SIP/media session (voice call active).
19
+ * - `after_call_success` — headless run after a successful call completion.
20
+ * - `after_call_failed` — headless run after call failure (no answer, reject, etc.).
21
+ * - `messaging` — headless run triggered by an inbound message.
22
+ * - `recall` — headless recall attempt.
23
+ * - `headless_other` — any other headless invocation not matching the above.
24
+ */
25
+ function getScriptPhase(context) {
26
+ if (!context.headless)
27
+ return 'online';
28
+ const ep = context.entryPoint?.trim().toLowerCase() ?? '';
29
+ if (AFTER_CALL_SUCCESS_ENTRY_POINTS.has(ep))
30
+ return 'after_call_success';
31
+ if (AFTER_CALL_FAILED_ENTRY_POINTS.has(ep))
32
+ return 'after_call_failed';
33
+ if (RECALL_ENTRY_POINTS.has(ep))
34
+ return 'recall';
35
+ if (ep === 'on_message_api_received' || context.inboundMessage)
36
+ return 'messaging';
37
+ if (!ep || ep === 'main' || ep === 'default')
38
+ return 'before_call';
39
+ return 'headless_other';
40
+ }
3
41
  //# sourceMappingURL=script-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"script-context.js","sourceRoot":"","sources":["../../src/types/script-context.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"script-context.js","sourceRoot":"","sources":["../../src/types/script-context.ts"],"names":[],"mappings":";;AA8NA,wCAaC;AAnCD,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,iBAAiB;IACjB,oBAAoB;IACpB,cAAc;CACf,CAAC,CAAC;AACH,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC;IAC7C,gBAAgB;IAChB,mBAAmB;CACpB,CAAC,CAAC;AACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,SAAgB,cAAc,CAAC,OAA4B;IACzD,IAAI,CAAC,OAAO,CAAC,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAEvC,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAE1D,IAAI,+BAA+B,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,oBAAoB,CAAC;IACzE,IAAI,8BAA8B,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACvE,IAAI,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,EAAE,KAAK,yBAAyB,IAAI,OAAO,CAAC,cAAc;QAAE,OAAO,WAAW,CAAC;IAEnF,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,aAAa,CAAC;IAEnE,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -437,22 +437,27 @@ export interface ChannelSip {
437
437
  */
438
438
  sendProgress(): void;
439
439
  /**
440
- * Initiate an **outbound** SIP call to the given SIP URI.
440
+ * Initiate an **outbound** SIP call and return the new B-leg.
441
441
  *
442
442
  * Returns a new {@link MediaChannel} representing the B-leg. The returned channel
443
443
  * has its own `sip`, `audio`, `events`, etc. — use `waitForAnswer()` or
444
444
  * `waitForEarly()` on the B-leg before sending audio.
445
445
  *
446
- * Supported only by the main-thread SIP channel. Worker-isolated, WS, and headless
447
- * channels throw because the current worker bridge does not proxy nested call legs.
446
+ * Supported by SIP channels. In worker isolation mode the host proxies the returned
447
+ * B-leg, including media operations, ASR, SIP control, LLM, and `bridge()`. WS channels
448
+ * dial the B-leg via the host SIP stack and bridge client PCM to RTP. Headless channels throw.
448
449
  *
449
450
  * @param opts.sipUri - Full SIP URI, e.g. `"sip:+12025551234@trunk.carrier.com"`.
451
+ * @param opts.msisdn - Legacy-mode phone number. The host resolves the SIP URI from the selected trunk.
452
+ * @param opts.channel - Legacy-mode trunk name override, matching `nv.bridge(..., channel=...)`.
453
+ * @param opts.protoAdditional - Legacy-mode extra outbound INVITE headers.
450
454
  * @param opts.fromUri - Optional caller-ID override SIP URI.
451
455
  * @returns A new `MediaChannel` for the outbound leg.
452
456
  *
453
457
  * ```ts
454
458
  * const bLeg = await channel.sip.makeCall({
455
- * sipUri: 'sip:+12025551234@trunk.carrier.com',
459
+ * msisdn: '+12025551234',
460
+ * channel: 'carrier-main',
456
461
  * });
457
462
  * await bLeg.sip.waitForAnswer();
458
463
  * // Bridge both legs so callers hear each other
@@ -460,8 +465,11 @@ export interface ChannelSip {
460
465
  * ```
461
466
  */
462
467
  makeCall(opts: {
463
- sipUri: string;
468
+ sipUri?: string;
469
+ msisdn?: string;
470
+ channel?: string;
464
471
  fromUri?: string;
472
+ protoAdditional?: Record<string, string>;
465
473
  legacyInviteHeaders?: {
466
474
  xViaTrunk: string;
467
475
  protoAdditional?: Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"sip.d.ts","sourceRoot":"","sources":["../../src/types/sip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,SAAS,GACT,OAAO,GACP,QAAQ,GACR,SAAS,GACT,YAAY,CAAC;AAEjB;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SAC1C,CAAC;KACH,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE1B;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,IAAI,CAAC;CACzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voctiv/agent-sdk",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Voctiv TypeScript agent SDK: defineScript and platform types for the voice/dialog scripting runtime.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",
@@ -22,7 +22,8 @@
22
22
  }
23
23
  },
24
24
  "files": [
25
- "dist"
25
+ "dist",
26
+ "README.md"
26
27
  ],
27
28
  "scripts": {
28
29
  "build": "tsc -p tsconfig.build.json",