@voctiv/agent-sdk 0.2.8 → 0.2.9

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
@@ -386,11 +386,18 @@ The runtime looks in `channel.params.authentication_data.legacyTtsKeysByName[nam
386
386
 
387
387
  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
388
 
389
- `legacySavePhrase` stores synthesized audio under the Voctiv record phrase storage root and inserts phrase metadata so it can later be loaded with `platform.getRecords()`.
389
+ `cache` enables TTS result caching for `say()` and `presay()`:
390
+
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.
390
393
 
391
394
  ```ts
395
+ // Cache only (no platform persist):
396
+ await channel.audio.say('Hello!', { cache: true });
397
+
398
+ // Cache + persist to platform phrase storage:
392
399
  await channel.audio.say('Welcome back.', {
393
- legacySavePhrase: {
400
+ cache: {
394
401
  phraseName: 'welcome_back',
395
402
  flag: context.flag,
396
403
  language: context.language,
package/dist/index.d.ts CHANGED
@@ -31,8 +31,8 @@ export type { ChannelLlm, LlmOptions, LlmStreamChunk, ExtractOptions, Persistent
31
31
  export type { ChannelSip, SipState, SipProgressEvent, } from './types/sip';
32
32
  export type { MediaError } from './types/errors';
33
33
  export type { AsrHandle, AsrConfig, AsrVadConfig, AsrSmartTurnConfig } from './types/asr-handle';
34
- export type { MixerQueueControl, PlayOptions, TtsStrategy, TtsVendor } from './types/mixer';
35
- export type { LegacyPhraseRecord, LegacyGetRecordsParams, LegacySavePhraseOptions, } from './types/legacy-phrase';
34
+ export type { MixerQueueControl, PlayOptions, PresayOptions, PreloadOptions, TtsStrategy, TtsVendor } from './types/mixer';
35
+ export type { LegacyPhraseRecord, LegacyGetRecordsParams, CacheOptions, } from './types/legacy-phrase';
36
36
  export { LEGACY_PHRASE_RECORD_BRAND, isLegacyPhraseRecord, } from './types/legacy-phrase';
37
37
  export type { TextInput } from './types/text-input';
38
38
  export type { DtmfEvent, SipInfo, SipSignal, DataMessage, } from './types/events';
@@ -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,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,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,0BA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AAC3H,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,GACb,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"}
@@ -26,17 +26,18 @@ export interface LegacyGetRecordsParams {
26
26
  language: string;
27
27
  }
28
28
  /**
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`.
29
+ * Extended cache options: TTS cache **plus** persist into `record_phrase` / `record_phrase_file`
30
+ * on the Voctiv platform so {@link PlatformApi.getRecords} can retrieve the audio later.
33
31
  *
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.
32
+ * Only the persist part requires platform compatibility mode, `LEGACY_V3_RECORD_PHRASE_ROOT`,
33
+ * and a resolved LE agent id/UUID. The TTS file cache itself works in any mode.
36
34
  */
37
- export interface LegacySavePhraseOptions {
38
- /** Phrase group/name to create or update. */
39
- phraseName: string;
35
+ export interface CacheOptions {
36
+ /**
37
+ * Phrase group/name to create or update in `record_phrase`.
38
+ * Defaults to `_cache` when omitted (same phrase used by the internal TTS cache in legacy mode).
39
+ */
40
+ phraseName?: string;
40
41
  /** Defaults to dialog `flag` from channel params when omitted. */
41
42
  flag?: string;
42
43
  /** Defaults to dialog language from channel params when omitted. */
@@ -1 +1 @@
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"}
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;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -1,7 +1,7 @@
1
1
  import type { Observable } from 'rxjs';
2
2
  import type { AsrConfig, AsrHandle } from './asr-handle';
3
3
  import type { DataMessage } from './events';
4
- import type { MixerQueueControl, PlayOptions } from './mixer';
4
+ import type { MixerQueueControl, PlayOptions, PresayOptions, PreloadOptions } from './mixer';
5
5
  import type { LegacyPhraseRecord } from './legacy-phrase';
6
6
  import type { TextInput } from './text-input';
7
7
  import type { MediaError } from './errors';
@@ -47,7 +47,7 @@ export interface ChannelAudio {
47
47
  * Play audio from a URL/path string, or a {@link LegacyPhraseRecord} from the Voctiv platform phrase DB.
48
48
  *
49
49
  * The runtime decodes the full source to PCM and pushes it to the mixer. `ttsVendor`,
50
- * `ttsConfig`, `ttsStrategy`, and `legacySavePhrase` do not affect raw playback.
50
+ * `ttsConfig`, `ttsStrategy`, and `cache` do not affect raw playback.
51
51
  *
52
52
  * @param source - HTTP(S) URL, local path, or structured {@link LegacyPhraseRecord} (no TTS).
53
53
  * @param options - Queue, alias, volume, loop; **`tts*`** fields apply only if the host
@@ -60,21 +60,25 @@ export interface ChannelAudio {
60
60
  /**
61
61
  * Download/decode **`source`** through the audio player.
62
62
  *
63
- * In ScriptEngine this warms the decoder/audio-player path for `play()`;
64
- * it does not synthesize TTS and does not populate the TTS cache used by `presay()`.
63
+ * In ScriptEngine this warms the decoder/audio-player path for `play()`.
64
+ * In legacy mode the decoded PCM is always persisted into `record_phrase` /
65
+ * `record_phrase_file` (default phrase name `_cache`).
66
+ *
65
67
  * @param source - URL or file path accepted by the host's fetch layer.
68
+ * @param options - Optional; only `cache` is used to override persist name/flag/language.
66
69
  */
67
- preload(source: string): Promise<void>;
70
+ preload(source: string, options?: PreloadOptions): Promise<void>;
68
71
  /**
69
72
  * Run TTS ahead of time and store PCM in the host TTS cache.
70
73
  *
71
74
  * Later `say()` calls with the same resolved TTS config and text can reuse the cached
72
- * file. If the cache service is unavailable, ScriptEngine logs a warning and
73
- * resolves without throwing.
75
+ * file. In legacy mode the result is always persisted into `record_phrase`
76
+ * (default phrase name `_cache`).
77
+ *
74
78
  * @param text - Full text to synthesize.
75
- * @param options - Same TTS-related options as **`say`** (vendor, **`name`**, **`ttsConfig`**).
79
+ * @param options - TTS vendor/name/config and optional cache name/flag override.
76
80
  */
77
- presay(text: string, options?: PlayOptions): Promise<void>;
81
+ presay(text: string, options?: PresayOptions): Promise<void>;
78
82
  /**
79
83
  * @param index - Mixer queue **0–4**.
80
84
  * @returns Control handle for that queue's volume and item lifecycle observables.
@@ -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,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,O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AAG,EAAE,UAAU,CAAC;IAEzB,6GAA6G;IAC7G,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,wFAAwF;IACxF,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import type { LegacySavePhraseOptions } from './legacy-phrase';
2
+ import type { CacheOptions } from './legacy-phrase';
3
3
  /**
4
4
  * How TTS audio is chunked and fed to the mixer.
5
5
  *
@@ -89,10 +89,39 @@ export interface PlayOptions {
89
89
  */
90
90
  ttsConfig?: Record<string, unknown>;
91
91
  /**
92
- * Voctiv platform only: after synthesis, persist audio under **`record_phrase`** + filesystem root so
93
- * {@link import('./define-script').PlatformApi.getRecords} can return a {@link import('./legacy-phrase').LegacyPhraseRecord}.
92
+ * Enable TTS result caching for `say()`.
93
+ *
94
+ * - **`true`** — read/write TTS file cache only (Redis + filesystem + `tts_cache` table or
95
+ * LE `_cache` phrase in legacy mode).
96
+ * - **`{ phraseName?, flag?, language? }`** — TTS cache **plus** persist into `record_phrase` /
97
+ * `record_phrase_file` on the Voctiv platform so {@link import('./define-script').PlatformApi.getRecords}
98
+ * can retrieve the audio later. `phraseName` defaults to `_cache`.
94
99
  */
95
- legacySavePhrase?: LegacySavePhraseOptions;
100
+ cache?: true | CacheOptions;
101
+ }
102
+ /**
103
+ * Options for {@link ChannelAudio.presay}.
104
+ *
105
+ * Caching and persistence to `record_phrase` always happen in legacy mode.
106
+ * Use `cache` only to override the default phrase name / flag / language.
107
+ */
108
+ export interface PresayOptions {
109
+ ttsVendor?: TtsVendor;
110
+ name?: string;
111
+ ttsConfig?: Record<string, unknown>;
112
+ ttsStrategy?: TtsStrategy;
113
+ /** Override persist name/flag/language. Defaults to `{ phraseName: '_cache' }`. */
114
+ cache?: CacheOptions;
115
+ }
116
+ /**
117
+ * Options for {@link ChannelAudio.preload}.
118
+ *
119
+ * In legacy mode the decoded PCM is always persisted to `record_phrase`.
120
+ * Use `cache` only to override the default phrase name / flag / language.
121
+ */
122
+ export interface PreloadOptions {
123
+ /** Override persist name/flag/language. Defaults to `{ phraseName: '_cache' }`. */
124
+ cache?: CacheOptions;
96
125
  }
97
126
  /**
98
127
  * Per-queue mixer control: volume, observability, and manual removal.
@@ -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,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;;;;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,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CAAC,CAAC;IAEvC;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,uDAAuD;IACvD,KAAK,IAAI,IAAI,CAAC;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voctiv/agent-sdk",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Voctiv TypeScript agent SDK: defineScript and platform types for the voice/dialog scripting runtime.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",