@voctiv/agent-sdk 0.2.7 → 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.
Files changed (38) hide show
  1. package/README.md +156 -13
  2. package/dist/define-script.d.ts +7 -334
  3. package/dist/define-script.d.ts.map +1 -1
  4. package/dist/define-script.js +4 -3
  5. package/dist/define-script.js.map +1 -1
  6. package/dist/index.d.ts +10 -5
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/types/asr-handle.d.ts +23 -10
  11. package/dist/types/asr-handle.d.ts.map +1 -1
  12. package/dist/types/errors.d.ts +19 -0
  13. package/dist/types/errors.d.ts.map +1 -0
  14. package/dist/types/errors.js +3 -0
  15. package/dist/types/errors.js.map +1 -0
  16. package/dist/types/legacy-phrase.d.ts +10 -9
  17. package/dist/types/legacy-phrase.d.ts.map +1 -1
  18. package/dist/types/llm.d.ts +78 -0
  19. package/dist/types/llm.d.ts.map +1 -0
  20. package/dist/types/llm.js +3 -0
  21. package/dist/types/llm.js.map +1 -0
  22. package/dist/types/media-channel.d.ts +32 -567
  23. package/dist/types/media-channel.d.ts.map +1 -1
  24. package/dist/types/mixer.d.ts +40 -9
  25. package/dist/types/mixer.d.ts.map +1 -1
  26. package/dist/types/platform.d.ts +164 -0
  27. package/dist/types/platform.d.ts.map +1 -0
  28. package/dist/types/platform.js +3 -0
  29. package/dist/types/platform.js.map +1 -0
  30. package/dist/types/script-context.d.ts +170 -0
  31. package/dist/types/script-context.d.ts.map +1 -0
  32. package/dist/types/script-context.js +3 -0
  33. package/dist/types/script-context.js.map +1 -0
  34. package/dist/types/sip.d.ts +485 -0
  35. package/dist/types/sip.d.ts.map +1 -0
  36. package/dist/types/sip.js +3 -0
  37. package/dist/types/sip.js.map +1 -0
  38. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  * - **`legacyAsrKeysByName`**: map **`name`** → `{ platform, flat }` for ASR
13
13
  * - **`legacyTtsKeysByName`**: same for TTS
14
14
  *
15
- * Rows are scoped to **this dialogs agent and company** (no agent UUID in the script). Use:
15
+ * Rows are scoped to **this dialog's agent and company** (no agent UUID in the script). Use:
16
16
  * - {@link import('./types/asr-handle').AsrConfig.name} or **`data.name`** on **`createAsr`**
17
17
  * - {@link import('./types/mixer').PlayOptions.name} or **`ttsConfig.name`** on **`say`/`play`/`presay`**
18
18
  *
@@ -22,12 +22,17 @@
22
22
  * records) require `context.legacyV3Compat === true`.
23
23
  */
24
24
  export { defineScript } from './define-script';
25
- export type { ScriptContext, ScriptDialogContext, ScriptRunTime, ScriptResult, PersistedScriptResult, ScriptError, ScriptFn, NluScriptApi, PlatformApi, DialogApi, ScheduleCallOptions, SendMessageOptions, InboundMessage, MessagingApi, } from './define-script';
25
+ export type { ScriptContext, ScriptFn } from './define-script';
26
+ export type { ScriptDialogContext, ScriptRunTime, ScriptResult, PersistedScriptResult, ScriptError, } from './types/script-context';
27
+ export type { NluScriptApi, PlatformApi, DialogApi, ScheduleCallOptions, SendMessageOptions, InboundMessage, MessagingApi, } from './types/platform';
26
28
  export type { ScriptLogger } from './types/logger';
27
- export type { MediaChannel, ChannelAudio, ChannelEvents, ChannelLlm, ChannelSip, SipState, SipProgressEvent, LlmOptions, LlmStreamChunk, ExtractOptions, PersistentLlmStreamHandle, } from './types/media-channel';
29
+ export type { MediaChannel, ChannelAudio, ChannelEvents, } from './types/media-channel';
30
+ export type { ChannelLlm, LlmOptions, LlmStreamChunk, ExtractOptions, PersistentLlmStreamHandle, } from './types/llm';
31
+ export type { ChannelSip, SipState, SipProgressEvent, } from './types/sip';
32
+ export type { MediaError } from './types/errors';
28
33
  export type { AsrHandle, AsrConfig, AsrVadConfig, AsrSmartTurnConfig } from './types/asr-handle';
29
- export type { MixerQueueControl, PlayOptions, TtsStrategy, TtsVendor } from './types/mixer';
30
- 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';
31
36
  export { LEGACY_PHRASE_RECORD_BRAND, isLegacyPhraseRecord, } from './types/legacy-phrase';
32
37
  export type { TextInput } from './types/text-input';
33
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,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,cAAc,EACd,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACjG,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC5F,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;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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"}
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * - **`legacyAsrKeysByName`**: map **`name`** → `{ platform, flat }` for ASR
14
14
  * - **`legacyTtsKeysByName`**: same for TTS
15
15
  *
16
- * Rows are scoped to **this dialogs agent and company** (no agent UUID in the script). Use:
16
+ * Rows are scoped to **this dialog's agent and company** (no agent UUID in the script). Use:
17
17
  * - {@link import('./types/asr-handle').AsrConfig.name} or **`data.name`** on **`createAsr`**
18
18
  * - {@link import('./types/mixer').PlayOptions.name} or **`ttsConfig.name`** on **`say`/`play`/`presay`**
19
19
  *
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;AAuCrB,uDAG+B;AAF7B,2HAAA,0BAA0B,OAAA;AAC1B,qHAAA,oBAAoB,OAAA"}
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,4 +1,5 @@
1
- import { Observable } from 'rxjs';
1
+ import type { Observable } from 'rxjs';
2
+ import type { MediaError } from './errors';
2
3
  /**
3
4
  * Voice Activity Detection (VAD) tuning.
4
5
  *
@@ -35,7 +36,7 @@ export interface AsrVadConfig {
35
36
  export interface AsrSmartTurnConfig {
36
37
  /** When `true`, turn-taking heuristics are applied (defaults vary by host). */
37
38
  enabled?: boolean;
38
- /** Frames of speech that must be seen before a turn can start. */
39
+ /** Frames of speech that must be seen before a "turn" can start. */
39
40
  triggerFrames?: number;
40
41
  /** Frames to wait before retrying after a short pause inside an utterance. */
41
42
  retryFrames?: number;
@@ -51,9 +52,9 @@ export interface AsrSmartTurnConfig {
51
52
  *
52
53
  * ### Voctiv platform + logic-executor `key_storage`
53
54
  *
54
- * When Voctiv platform compatibility is on and the connector loaded credentials from PostgreSQL, the sessions
55
+ * When Voctiv platform compatibility is on and the connector loaded credentials from PostgreSQL, the session's
55
56
  * `authentication_data` includes **`legacyAsrKeysByName`**: a map from **`key_storage.name`**
56
- * (string) to flat connector parameters (`api_key`, `base_url`, …) for **this dialogs agent
57
+ * (string) to flat connector parameters (`api_key`, `base_url`, …) for **this dialog's agent
57
58
  * and company**. You do **not** pass agent UUID in the script — the dialog already belongs to an agent.
58
59
  *
59
60
  * - **`name`**: pick which row from that map to use (same value as in LE admin for the key).
@@ -66,18 +67,18 @@ export interface AsrSmartTurnConfig {
66
67
  *
67
68
  * ### Vendor
68
69
  *
69
- * **`vendor`** is resolved via ScriptEngine vendor aliases (`"yandex"`, `"Y"`, `"neuro_v3"`, …). If you set
70
- * **`name`** but omit **`vendor`**, the runtime may infer vendor from the key rows **`platform`**
70
+ * **`vendor`** is resolved via ScriptEngine vendor aliases (`"yandex"`, `"deepgram"`, `"neuro_v3"`, …). If you set
71
+ * **`name`** but omit **`vendor`**, the runtime may infer vendor from the key row's **`platform`**
71
72
  * in the catalog.
72
73
  */
73
74
  export interface AsrConfig {
74
75
  /**
75
- * ASR vendor / engine hint: single-letter code (`"Y"`, `"D"`, …) or legacy name
76
- * (`"yandex"`, `"neuro_v3"`, …). See host `media-vendor-aliases` mapping.
76
+ * ASR vendor / engine hint, e.g. `"yandex"`, `"deepgram"`, `"google"`,
77
+ * `"azure"`, `"voctiv"`, or `"neuro_v3"`.
77
78
  */
78
79
  vendor?: string;
79
80
  /**
80
- * logic-executor **`key_storage.name`** for this dialogs agent + company. Selects credentials
81
+ * logic-executor **`key_storage.name`** for this dialog's agent + company. Selects credentials
81
82
  * from **`authentication_data.legacyAsrKeysByName[name]`** when Voctiv platform PostgreSQL key auth is enabled.
82
83
  * Overrides channel **`defaultAsrName`**.
83
84
  */
@@ -89,7 +90,7 @@ export interface AsrConfig {
89
90
  * Merged last over channel defaults and catalog credentials so the script can override
90
91
  * per call. Primitives are stringified; objects and arrays are JSON-serialized.
91
92
  *
92
- * Do not rely on **`name`** here for third-party model name fields — the runtime consumes
93
+ * Do not rely on **`name`** here for third-party "model name" fields — the runtime consumes
93
94
  * it as the storage row selector and removes it before vendor config is built.
94
95
  */
95
96
  data?: Record<string, unknown>;
@@ -132,6 +133,18 @@ export interface AsrHandle {
132
133
  readonly interrupt$: Observable<void>;
133
134
  /** Normalized voice-activity probability 0–1 when the host exposes it; else may be inert. */
134
135
  readonly vadProbability$: Observable<number>;
136
+ /**
137
+ * Runtime errors from the ASR provider (gRPC disconnect, auth failures, quota exceeded, etc.).
138
+ *
139
+ * A degraded handle (returned when connector creation itself failed) has an inert `error$`
140
+ * that never emits — the creation failure is reported on {@link import('./media-channel').ChannelEvents.error$} instead.
141
+ *
142
+ * ```ts
143
+ * const asr = await channel.createAsr({ name: 'yandex-asr-test' });
144
+ * asr.error$.subscribe(err => console.log('ASR error:', err.message));
145
+ * ```
146
+ */
147
+ readonly error$: Observable<MediaError>;
135
148
  /** Pause forwarding new audio frames to the recognizer; skipped audio is not replayed. */
136
149
  pause(): void;
137
150
  /** Resume after {@link pause}. */
@@ -1 +1 @@
1
- {"version":3,"file":"asr-handle.d.ts","sourceRoot":"","sources":["../../src/types/asr-handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MA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IAClE,kEAAkE;IAClE,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,wDAAwD;IACxD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,6FAA6F;IAC7F,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAExC,0FAA0F;IAC1F,KAAK,IAAI,IAAI,CAAC;IACd,kCAAkC;IAClC,MAAM,IAAI,IAAI,CAAC;IACf,kFAAkF;IAClF,QAAQ,IAAI,IAAI,CAAC;IACjB,8FAA8F;IAC9F,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Structured error emitted on {@link import('./media-channel').ChannelEvents.error$} and {@link import('./asr-handle').AsrHandle.error$}.
3
+ *
4
+ * Scripts can subscribe to these observables to detect ASR/TTS/SIP failures at runtime
5
+ * without relying on server-side logs.
6
+ */
7
+ export interface MediaError {
8
+ /** Which subsystem produced the error. */
9
+ source: 'asr' | 'tts' | 'sip' | 'channel';
10
+ /** Human-readable description (same string that appears in server logs). */
11
+ message: string;
12
+ /** HTTP status code, gRPC status, or WebSocket close code when available. */
13
+ code?: number;
14
+ /** Vendor/engine identifier, e.g. `"yandex"`, `"elevenlabs"`, `"azure"`. */
15
+ vendor?: string;
16
+ /** Arbitrary provider-specific payload for advanced diagnostics. */
17
+ details?: unknown;
18
+ }
19
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":""}
@@ -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"}
@@ -0,0 +1,78 @@
1
+ import type { Observable } from 'rxjs';
2
+ /** Options for **`channel.llm.ask`** / **`stream`** / **`makePersistentStream`**. */
3
+ export interface LlmOptions {
4
+ /** Override dialog UUID for Omni/LLM tracing (defaults to script dialog). */
5
+ dialogUuid?: string;
6
+ /** Chat role sent with the message, e.g. **`"assistant"`**, **`"user"`**. */
7
+ role?: string;
8
+ /** When `true`, message may be hidden from user-visible transcript (host-dependent). */
9
+ hidden?: boolean;
10
+ /**
11
+ * **LLM-only**: speaker / persona label in multi-party chat. **Not** related to
12
+ * {@link import('./mixer').PlayOptions.name} (TTS **`key_storage.name`**).
13
+ */
14
+ name?: string;
15
+ /** Route the request to a specific Omni agent profile (UUID). */
16
+ agentUuid?: string;
17
+ /** Multi-agent: current alias for routing. */
18
+ currentAgentAlias?: string;
19
+ /** Opaque payload forwarded to the Omni LLM backend. */
20
+ payload?: Record<string, any>;
21
+ /** Verbose logging on the LLM path. */
22
+ debug?: boolean;
23
+ /** Restrict which agent aliases may handle the request. */
24
+ agentAliasFilter?: string[];
25
+ }
26
+ /** Options for **`channel.llm.extract`**. All fields except `dialogUuid` are forwarded to Omni extract. */
27
+ export interface ExtractOptions {
28
+ /** Override dialog UUID for extraction context; defaults to the current script dialog. */
29
+ dialogUuid?: string;
30
+ /** Optional extraction prompt/instruction forwarded to Omni. */
31
+ prompt?: string;
32
+ /** Model name or id understood by the Omni backend. */
33
+ model?: string;
34
+ /** Nucleus sampling value forwarded to Omni. */
35
+ topP?: number;
36
+ /** Temperature forwarded to Omni. */
37
+ temperature?: number;
38
+ /** Custom model descriptor forwarded as-is. */
39
+ customModel?: Record<string, any>;
40
+ [key: string]: unknown;
41
+ }
42
+ /** One chunk from **`channel.llm.stream`**. */
43
+ export interface LlmStreamChunk {
44
+ id: string;
45
+ chunkId: number;
46
+ content: string;
47
+ finishReason: string | null;
48
+ event: any;
49
+ toolMessages?: any[];
50
+ raw: Record<string, any>;
51
+ }
52
+ /**
53
+ * Long-lived LLM Socket.IO stream — amortizes connection setup across many user turns.
54
+ */
55
+ export interface PersistentLlmStreamHandle {
56
+ readonly stream$: Observable<LlmStreamChunk>;
57
+ /** Send one user/assistant turn over the existing stream; options override defaults for this send only. */
58
+ send(message: string, options?: LlmOptions): void;
59
+ /** Close the underlying Socket.IO stream without destroying the handle object. */
60
+ disconnect(): void;
61
+ /** Re-open the underlying Socket.IO stream after {@link disconnect}. */
62
+ reconnect(): void;
63
+ }
64
+ /** LLM facade on the media channel. */
65
+ export interface ChannelLlm {
66
+ /** Single-shot completion for **`message`**; consumes the Omni SSE stream and returns concatenated text. */
67
+ ask(message: string, options?: LlmOptions): Promise<string>;
68
+ /** Token/chunk stream for **`message`** parsed from Omni SSE `data:` events. */
69
+ stream(message: string, options?: LlmOptions): Observable<LlmStreamChunk>;
70
+ /** Structured extraction / JSON-style fill from conversation context via Omni extract. */
71
+ extract(options?: ExtractOptions): Promise<Record<string, any>>;
72
+ /**
73
+ * Open a persistent Omni chat stream.
74
+ * @param options - Default **`agentUuid`**, **`dialogUuid`**, etc.; per-**`send`** overrides allowed.
75
+ */
76
+ makePersistentStream(options?: LlmOptions): PersistentLlmStreamHandle;
77
+ }
78
+ //# sourceMappingURL=llm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/types/llm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,qFAAqF;AACrF,MAAM,WAAW,UAAU;IACzB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,uCAAuC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,2GAA2G;AAC3G,MAAM,WAAW,cAAc;IAC7B,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IAC7C,2GAA2G;IAC3G,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAClD,kFAAkF;IAClF,UAAU,IAAI,IAAI,CAAC;IACnB,wEAAwE;IACxE,SAAS,IAAI,IAAI,CAAC;CACnB;AAED,uCAAuC;AACvC,MAAM,WAAW,UAAU;IACzB,4GAA4G;IAC5G,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5D,gFAAgF;IAChF,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC1E,0FAA0F;IAC1F,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAChE;;;OAGG;IACH,oBAAoB,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,yBAAyB,CAAC;CACvE"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=llm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/types/llm.ts"],"names":[],"mappings":""}