voice-runtime 1.0.0 → 1.1.0
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 +59 -18
- package/bin/voice-runtime.mjs +248 -0
- package/dist/index.cjs +7353 -2064
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +372 -158
- package/dist/index.js +7342 -2059
- package/dist/index.js.map +4 -4
- package/package.json +7 -2
- package/skills/tvic/SKILL.md +79 -0
package/dist/index.d.ts
CHANGED
|
@@ -226,6 +226,42 @@ declare class MemorySessionQuotaExceededError extends DurableError {
|
|
|
226
226
|
constructor(sessionId: string, usedBytes: number, requestedBytes: number, maxBytes: number);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
/** Canonical cross-provider error codes shared by runtime and adapters. */
|
|
230
|
+
declare const TVIC_ERROR_CODES: Readonly<{
|
|
231
|
+
readonly providerAuthFailed: "provider.auth_failed";
|
|
232
|
+
readonly providerRateLimited: "provider.rate_limited";
|
|
233
|
+
readonly providerModelUnsupported: "provider.model_unsupported";
|
|
234
|
+
readonly providerVoiceUnsupported: "provider.voice_unsupported";
|
|
235
|
+
readonly providerInputRejected: "provider.input_rejected";
|
|
236
|
+
readonly providerInvalidRequest: "provider.invalid_request";
|
|
237
|
+
readonly providerSessionExpired: "provider.session_expired";
|
|
238
|
+
readonly providerProtocolInvalid: "provider.protocol_invalid";
|
|
239
|
+
readonly providerSequenceInvalid: "provider.sequence_invalid";
|
|
240
|
+
readonly providerUpstreamFailed: "provider.upstream_failed";
|
|
241
|
+
readonly providerIdentityMismatch: "provider.identity_mismatch";
|
|
242
|
+
readonly providerStreamBufferOverflow: "provider.stream_buffer_overflow";
|
|
243
|
+
readonly sttSessionBufferOverflow: "stt.session_buffer_overflow";
|
|
244
|
+
readonly sttCommitInFlight: "stt.commit_in_flight";
|
|
245
|
+
readonly llmProviderFailed: "llm.provider.failed";
|
|
246
|
+
readonly sttTransportUnexpectedEof: "stt.transport.unexpected_eof";
|
|
247
|
+
readonly ttsTransportUnexpectedEof: "tts.transport.unexpected_eof";
|
|
248
|
+
readonly llmProviderUnexpectedEof: "llm.provider.unexpected_eof";
|
|
249
|
+
}>;
|
|
250
|
+
/** One-release aliases accepted at provider and persisted-data boundaries. */
|
|
251
|
+
declare const TVIC_ERROR_CODE_ALIASES: Readonly<{
|
|
252
|
+
readonly "stt.provider.auth_failed": "provider.auth_failed";
|
|
253
|
+
readonly "stt.provider.rate_limited": "provider.rate_limited";
|
|
254
|
+
readonly "stt.provider.quota_exceeded": "provider.rate_limited";
|
|
255
|
+
readonly "stt.provider.invalid_request": "provider.invalid_request";
|
|
256
|
+
readonly "stt.provider.input_rejected": "provider.input_rejected";
|
|
257
|
+
readonly "stt.provider.session_expired": "provider.session_expired";
|
|
258
|
+
readonly "stt.provider.protocol_error": "provider.protocol_invalid";
|
|
259
|
+
readonly "stt.provider.service_unavailable": "provider.upstream_failed";
|
|
260
|
+
readonly "stt.provider.internal": "provider.upstream_failed";
|
|
261
|
+
readonly "model.unsupported": "provider.model_unsupported";
|
|
262
|
+
readonly "voice.unsupported": "provider.voice_unsupported";
|
|
263
|
+
readonly "stt.model_unsupported": "provider.model_unsupported";
|
|
264
|
+
}>;
|
|
229
265
|
declare const TELEPHONY_SAMPLE_RATE_HZ = 8000;
|
|
230
266
|
declare const RUNTIME_SAMPLE_RATE_HZ = 16000;
|
|
231
267
|
declare const PCM16_16K_MONO: {
|
|
@@ -247,6 +283,7 @@ declare const PROVIDER_NAMES: {
|
|
|
247
283
|
readonly sarvam: "sarvam";
|
|
248
284
|
readonly assemblyaiStt: "assemblyai-stt";
|
|
249
285
|
readonly sonioxStt: "soniox-stt";
|
|
286
|
+
readonly groq: "groq-chat-completions";
|
|
250
287
|
readonly openaiResponses: "openai-responses";
|
|
251
288
|
readonly webClientAudio: "web-client-audio";
|
|
252
289
|
};
|
|
@@ -259,6 +296,10 @@ declare const PROVIDER_ERROR_CODES: {
|
|
|
259
296
|
readonly sarvamStt: "sarvam.stt.error";
|
|
260
297
|
readonly assemblyaiStt: "assemblyai.stt.error";
|
|
261
298
|
readonly sonioxStt: "soniox.stt.error";
|
|
299
|
+
readonly groqChat: "groq.chat.error";
|
|
300
|
+
readonly groqHttp: "groq.http_error";
|
|
301
|
+
readonly groqResponseFailed: "groq.response.failed";
|
|
302
|
+
readonly groqProtocol: "groq.protocol.error";
|
|
262
303
|
readonly openaiResponses: "openai.responses.error";
|
|
263
304
|
readonly openaiHttp: "openai.http_error";
|
|
264
305
|
readonly openaiResponseFailed: "openai.response.failed";
|
|
@@ -270,17 +311,20 @@ declare const STT_ERROR_CODES: {
|
|
|
270
311
|
readonly unexpectedEof: "stt.transport.unexpected_eof";
|
|
271
312
|
readonly connectFailed: "stt.transport.connect_failed";
|
|
272
313
|
readonly connectTimeout: "stt.transport.connect_timeout";
|
|
273
|
-
readonly authFailed: "
|
|
274
|
-
readonly invalidRequest: "
|
|
275
|
-
readonly inputRejected: "
|
|
276
|
-
readonly rateLimited: "
|
|
277
|
-
readonly quotaExceeded: "
|
|
278
|
-
readonly serviceUnavailable: "
|
|
279
|
-
readonly providerInternal: "
|
|
280
|
-
readonly protocolError: "
|
|
281
|
-
readonly sessionExpired: "
|
|
314
|
+
readonly authFailed: "provider.auth_failed";
|
|
315
|
+
readonly invalidRequest: "provider.invalid_request";
|
|
316
|
+
readonly inputRejected: "provider.input_rejected";
|
|
317
|
+
readonly rateLimited: "provider.rate_limited";
|
|
318
|
+
readonly quotaExceeded: "provider.rate_limited";
|
|
319
|
+
readonly serviceUnavailable: "provider.upstream_failed";
|
|
320
|
+
readonly providerInternal: "provider.upstream_failed";
|
|
321
|
+
readonly protocolError: "provider.protocol_invalid";
|
|
322
|
+
readonly sessionExpired: "provider.session_expired";
|
|
282
323
|
readonly streamEnded: "stt.stream_ended";
|
|
324
|
+
readonly audioWriteTimeout: "stt.audio_write_timeout";
|
|
325
|
+
readonly closeTimeout: "stt.close_timeout";
|
|
283
326
|
readonly bufferOverflow: "stt.reconnect.buffer_overflow";
|
|
327
|
+
readonly sessionBufferOverflow: "stt.session_buffer_overflow";
|
|
284
328
|
readonly recoveryExhausted: "stt.reconnect.recovery_exhausted";
|
|
285
329
|
readonly closed: "stt.reconnect.closed";
|
|
286
330
|
};
|
|
@@ -774,58 +818,13 @@ interface FailedCall extends CallBase {
|
|
|
774
818
|
readonly startedAt?: Timestamp;
|
|
775
819
|
}
|
|
776
820
|
type Call = CreatedCall | RingingCall | ConnectedCall | EndedCall | FailedCall;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
readonly turnSequence: number;
|
|
785
|
-
}
|
|
786
|
-
interface SessionBase {
|
|
787
|
-
readonly id: SessionId;
|
|
788
|
-
readonly agentId: AgentId;
|
|
789
|
-
readonly channel: ChannelKind;
|
|
790
|
-
readonly callId?: CallId;
|
|
791
|
-
/**
|
|
792
|
-
* Reserved for a future durable reference index. The runtime currently
|
|
793
|
-
* leaves this empty; memory adapters and session-end snapshots are the
|
|
794
|
-
* authoritative memory surfaces.
|
|
795
|
-
*/
|
|
796
|
-
readonly memoryRefs: readonly MemoryEntryId[];
|
|
797
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
798
|
-
readonly createdAt: Timestamp;
|
|
799
|
-
readonly state: SessionState;
|
|
800
|
-
}
|
|
801
|
-
interface CreatedSession extends SessionBase {
|
|
802
|
-
readonly status: "created";
|
|
803
|
-
}
|
|
804
|
-
interface StartingSession extends SessionBase {
|
|
805
|
-
readonly status: "starting";
|
|
806
|
-
}
|
|
807
|
-
interface ActiveSession extends SessionBase {
|
|
808
|
-
readonly status: "active" | "interrupted" | "waiting_for_tool" | "ending";
|
|
809
|
-
readonly startedAt: Timestamp;
|
|
810
|
-
}
|
|
811
|
-
type TerminalSessionStatus = "completed" | "failed" | "cancelled";
|
|
812
|
-
interface TerminalSessionBase extends SessionBase {
|
|
813
|
-
readonly startedAt: Timestamp;
|
|
814
|
-
readonly endedAt: Timestamp;
|
|
815
|
-
}
|
|
816
|
-
interface CompletedSession extends TerminalSessionBase {
|
|
817
|
-
readonly status: "completed";
|
|
818
|
-
}
|
|
819
|
-
interface FailedSession extends TerminalSessionBase {
|
|
820
|
-
readonly status: "failed";
|
|
821
|
-
readonly error: NormalizedError;
|
|
822
|
-
}
|
|
823
|
-
interface CancelledSession extends TerminalSessionBase {
|
|
824
|
-
readonly status: "cancelled";
|
|
825
|
-
readonly cancelReason: SessionCancellationReason;
|
|
826
|
-
}
|
|
827
|
-
type TerminalSession = CompletedSession | FailedSession | CancelledSession;
|
|
828
|
-
type Session = CreatedSession | StartingSession | ActiveSession | TerminalSession;
|
|
821
|
+
/**
|
|
822
|
+
* The immutable value a managed runtime passes across its call boundary.
|
|
823
|
+
* Runtime validation supplies the deep-freeze guarantee; this alias keeps
|
|
824
|
+
* that boundary visible to TypeScript consumers without creating a second
|
|
825
|
+
* call union.
|
|
826
|
+
*/
|
|
827
|
+
type CallSnapshot = Readonly<Call>;
|
|
829
828
|
|
|
830
829
|
type TurnCancellationReason = "barge_in" | "dtmf" | "explicit" | "timeout" | "not_heard" | "transport_lost" | "lease_lost" | "runtime_restarted";
|
|
831
830
|
type TurnStatus = "started" | "listening" | "thinking" | "calling_tool" | "speaking" | "interrupted" | "completed" | "cancelled" | "failed";
|
|
@@ -995,7 +994,7 @@ interface ProviderRequirements {
|
|
|
995
994
|
readonly region?: string;
|
|
996
995
|
readonly dataPolicy?: ProviderDataPolicy;
|
|
997
996
|
}
|
|
998
|
-
type ProviderCompatibilityIssueCode = "kind.unsupported" | "streaming.unsupported" | "cancellation.unsupported" | "transport.unsupported" | "audio.input_unsupported" | "audio.output_unsupported" | "language.unsupported" | "
|
|
997
|
+
type ProviderCompatibilityIssueCode = "kind.unsupported" | "streaming.unsupported" | "cancellation.unsupported" | "transport.unsupported" | "audio.input_unsupported" | "audio.output_unsupported" | "language.unsupported" | "provider.model_unsupported" | "provider.voice_unsupported" | "turn_detection.unsupported" | "tools.unsupported" | "playout.unsupported" | "call_control.unsupported" | "region.unsupported" | "data_policy.unsupported";
|
|
999
998
|
interface ProviderCompatibilityIssue {
|
|
1000
999
|
readonly code: ProviderCompatibilityIssueCode;
|
|
1001
1000
|
readonly requirement: string;
|
|
@@ -1193,18 +1192,24 @@ interface IncrementalTextToSpeechProvider extends TextToSpeechProvider {
|
|
|
1193
1192
|
declare function isIncrementalTextToSpeechProvider(provider: TextToSpeechProvider): provider is IncrementalTextToSpeechProvider;
|
|
1194
1193
|
|
|
1195
1194
|
type LlmMessageRole = "system" | "user" | "assistant" | "tool";
|
|
1195
|
+
interface LlmInlineToolCall {
|
|
1196
|
+
readonly callRef: string;
|
|
1197
|
+
readonly toolName: ToolName;
|
|
1198
|
+
readonly input: unknown;
|
|
1199
|
+
}
|
|
1196
1200
|
interface LlmMessage {
|
|
1197
1201
|
readonly role: LlmMessageRole;
|
|
1198
1202
|
readonly content: string;
|
|
1199
1203
|
readonly toolCallRef?: string;
|
|
1200
1204
|
readonly toolName?: ToolName;
|
|
1205
|
+
/**
|
|
1206
|
+
* Tool calls emitted by an assistant message. Providers that use native
|
|
1207
|
+
* function-calling protocols need this envelope before the corresponding
|
|
1208
|
+
* `tool` result messages.
|
|
1209
|
+
*/
|
|
1210
|
+
readonly toolCalls?: readonly LlmInlineToolCall[];
|
|
1201
1211
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
1202
1212
|
}
|
|
1203
|
-
interface LlmInlineToolCall {
|
|
1204
|
-
readonly callRef: string;
|
|
1205
|
-
readonly toolName: ToolName;
|
|
1206
|
-
readonly input: unknown;
|
|
1207
|
-
}
|
|
1208
1213
|
interface LlmCompletionRequest {
|
|
1209
1214
|
readonly sessionId: SessionId;
|
|
1210
1215
|
readonly turnId: TurnId;
|
|
@@ -1498,6 +1503,8 @@ interface RuntimeOptions {
|
|
|
1498
1503
|
readonly clock?: Clock;
|
|
1499
1504
|
readonly idGenerator?: IdGenerator;
|
|
1500
1505
|
readonly durableStore?: DurableRuntimeStore;
|
|
1506
|
+
/** Whether the runtime may close an injected durable store during stop. */
|
|
1507
|
+
readonly durableStoreOwnership?: "runtime" | "caller";
|
|
1501
1508
|
/** Overrides for the explicit defaults; omitted values use the safe defaults. */
|
|
1502
1509
|
readonly durablePolicy?: Partial<DurableRuntimePolicy>;
|
|
1503
1510
|
readonly toolIdempotencyStore?: ToolIdempotencyStore;
|
|
@@ -1711,6 +1718,8 @@ interface HealthCheckResult {
|
|
|
1711
1718
|
readonly ok: boolean;
|
|
1712
1719
|
readonly latencyMs?: number;
|
|
1713
1720
|
readonly message?: string;
|
|
1721
|
+
/** Sanitized diagnostic details supplied by the owning subsystem. */
|
|
1722
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
1714
1723
|
}
|
|
1715
1724
|
interface DurableRuntimeMetric {
|
|
1716
1725
|
readonly name: string;
|
|
@@ -1754,17 +1763,22 @@ interface StartSessionOptions {
|
|
|
1754
1763
|
readonly workflowId?: WorkflowId;
|
|
1755
1764
|
}
|
|
1756
1765
|
type EndSessionReason = "completed" | "cancelled" | "failed" | "timeout";
|
|
1766
|
+
type TerminalSource = "operator_stop" | "caller_abort" | "run_timeout" | "remote_transport" | "provider_runtime" | "normal_completion" | "runtime_recovery" | "runtime_shutdown" | "legacy_unknown";
|
|
1757
1767
|
type EndSessionRequest = {
|
|
1758
1768
|
readonly reason: "completed";
|
|
1769
|
+
readonly terminalSource?: "normal_completion" | "legacy_unknown";
|
|
1759
1770
|
} | {
|
|
1760
1771
|
readonly reason: "cancelled";
|
|
1761
1772
|
readonly cancelReason: SessionCancellationReason;
|
|
1773
|
+
readonly terminalSource?: "operator_stop" | "caller_abort" | "remote_transport" | "runtime_recovery" | "runtime_shutdown" | "legacy_unknown";
|
|
1762
1774
|
} | {
|
|
1763
1775
|
readonly reason: "failed";
|
|
1764
1776
|
readonly error: NormalizedError;
|
|
1777
|
+
readonly terminalSource?: "provider_runtime" | "legacy_unknown";
|
|
1765
1778
|
} | {
|
|
1766
1779
|
readonly reason: "timeout";
|
|
1767
1780
|
readonly error: NormalizedError;
|
|
1781
|
+
readonly terminalSource?: "run_timeout" | "legacy_unknown";
|
|
1768
1782
|
};
|
|
1769
1783
|
interface StartTurnRequest {
|
|
1770
1784
|
readonly sessionId: SessionId;
|
|
@@ -1823,7 +1837,7 @@ interface SessionAttachment {
|
|
|
1823
1837
|
}
|
|
1824
1838
|
interface RuntimeServiceLifecycle {
|
|
1825
1839
|
/** Starts the runtime. A runtime can be started once; create a new runtime after stop. */
|
|
1826
|
-
start(): Promise<void>;
|
|
1840
|
+
start(signal?: AbortSignal): Promise<void>;
|
|
1827
1841
|
/**
|
|
1828
1842
|
* Stops the runtime and closes its owned resources. The operation is
|
|
1829
1843
|
* idempotent and concurrent callers await the same teardown. A stopped
|
|
@@ -1833,6 +1847,13 @@ interface RuntimeServiceLifecycle {
|
|
|
1833
1847
|
readonly isRunning: boolean;
|
|
1834
1848
|
}
|
|
1835
1849
|
interface Runtime extends RuntimeServiceLifecycle {
|
|
1850
|
+
/**
|
|
1851
|
+
* Optional execution seam for low-level pipeline users. Registered runs are
|
|
1852
|
+
* cancelled and drained by `stop()` before the runtime closes its durable
|
|
1853
|
+
* stores. Managed voice agents already provide their own higher-level
|
|
1854
|
+
* lifecycle, but direct `PipelineVoiceLoop` callers need this ownership too.
|
|
1855
|
+
*/
|
|
1856
|
+
registerPipelineRun?(run: Promise<unknown>, cancel: () => void): () => void;
|
|
1836
1857
|
startSession(agent: Agent, options: StartSessionOptions): Promise<ActiveSession>;
|
|
1837
1858
|
startAttachedSession(agent: Agent, options: StartAttachedSessionOptions): Promise<SessionAttachment>;
|
|
1838
1859
|
attachSession(agent: Agent, sessionId: SessionId, options?: {
|
|
@@ -1875,6 +1896,60 @@ interface Runtime extends RuntimeServiceLifecycle {
|
|
|
1875
1896
|
readonly memory?: Memory;
|
|
1876
1897
|
}
|
|
1877
1898
|
|
|
1899
|
+
type SessionCancellationReason = "caller_hangup" | "transport_lost" | "recovery_expired" | "operator_requested" | "shutdown";
|
|
1900
|
+
type SessionStatus = "created" | "starting" | "active" | "interrupted" | "waiting_for_tool" | "ending" | "completed" | "failed" | "cancelled";
|
|
1901
|
+
interface SessionState {
|
|
1902
|
+
readonly variables: Readonly<Record<string, unknown>>;
|
|
1903
|
+
readonly currentTurnId?: TurnId;
|
|
1904
|
+
readonly pendingToolCallIds: readonly ToolCallId[];
|
|
1905
|
+
readonly turnSequence: number;
|
|
1906
|
+
}
|
|
1907
|
+
interface SessionBase {
|
|
1908
|
+
readonly id: SessionId;
|
|
1909
|
+
readonly agentId: AgentId;
|
|
1910
|
+
readonly channel: ChannelKind;
|
|
1911
|
+
readonly callId?: CallId;
|
|
1912
|
+
/**
|
|
1913
|
+
* Reserved for a future durable reference index. The runtime currently
|
|
1914
|
+
* leaves this empty; memory adapters and session-end snapshots are the
|
|
1915
|
+
* authoritative memory surfaces.
|
|
1916
|
+
*/
|
|
1917
|
+
readonly memoryRefs: readonly MemoryEntryId[];
|
|
1918
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
1919
|
+
readonly createdAt: Timestamp;
|
|
1920
|
+
readonly state: SessionState;
|
|
1921
|
+
}
|
|
1922
|
+
interface CreatedSession extends SessionBase {
|
|
1923
|
+
readonly status: "created";
|
|
1924
|
+
}
|
|
1925
|
+
interface StartingSession extends SessionBase {
|
|
1926
|
+
readonly status: "starting";
|
|
1927
|
+
}
|
|
1928
|
+
interface ActiveSession extends SessionBase {
|
|
1929
|
+
readonly status: "active" | "interrupted" | "waiting_for_tool" | "ending";
|
|
1930
|
+
readonly startedAt: Timestamp;
|
|
1931
|
+
}
|
|
1932
|
+
type TerminalSessionStatus = "completed" | "failed" | "cancelled";
|
|
1933
|
+
interface TerminalSessionBase extends SessionBase {
|
|
1934
|
+
readonly startedAt: Timestamp;
|
|
1935
|
+
readonly endedAt: Timestamp;
|
|
1936
|
+
/** Terminal provenance is optional only for legacy in-memory values. */
|
|
1937
|
+
readonly terminalSource?: TerminalSource;
|
|
1938
|
+
}
|
|
1939
|
+
interface CompletedSession extends TerminalSessionBase {
|
|
1940
|
+
readonly status: "completed";
|
|
1941
|
+
}
|
|
1942
|
+
interface FailedSession extends TerminalSessionBase {
|
|
1943
|
+
readonly status: "failed";
|
|
1944
|
+
readonly error: NormalizedError;
|
|
1945
|
+
}
|
|
1946
|
+
interface CancelledSession extends TerminalSessionBase {
|
|
1947
|
+
readonly status: "cancelled";
|
|
1948
|
+
readonly cancelReason: SessionCancellationReason;
|
|
1949
|
+
}
|
|
1950
|
+
type TerminalSession = CompletedSession | FailedSession | CancelledSession;
|
|
1951
|
+
type Session = CreatedSession | StartingSession | ActiveSession | TerminalSession;
|
|
1952
|
+
|
|
1878
1953
|
interface TerminalSessionDraft {
|
|
1879
1954
|
readonly id: SessionId;
|
|
1880
1955
|
readonly agentId: AgentId;
|
|
@@ -1889,6 +1964,7 @@ interface TerminalSessionDraft {
|
|
|
1889
1964
|
readonly endedAt: Timestamp;
|
|
1890
1965
|
}
|
|
1891
1966
|
declare function terminalSessionFromRequest(draft: TerminalSessionDraft, request: EndSessionRequest): TerminalSession;
|
|
1967
|
+
declare function terminalSourceForRequest(request: EndSessionRequest): TerminalSource;
|
|
1892
1968
|
declare function terminalTurnFromRequest(turn: ActiveTurn, request: EndTurnRequest, endedAt: Timestamp, durationMs: number): TerminalTurn;
|
|
1893
1969
|
declare function isTerminalSession(session: Session): session is TerminalSession;
|
|
1894
1970
|
declare function isTerminalTurn(turn: Turn): turn is TerminalTurn;
|
|
@@ -1899,6 +1975,7 @@ interface ProviderClock {
|
|
|
1899
1975
|
|
|
1900
1976
|
interface TwilioMediaStreamSocket {
|
|
1901
1977
|
readonly readyState: number;
|
|
1978
|
+
readonly bufferedAmount?: number;
|
|
1902
1979
|
send(data: string): void;
|
|
1903
1980
|
close(code?: number, reason?: string): void;
|
|
1904
1981
|
on(event: "message", handler: (data: WebSocket.RawData) => void): this;
|
|
@@ -1911,7 +1988,11 @@ interface TwilioMediaStreamCallHandleOptions {
|
|
|
1911
1988
|
readonly sessionId: SessionId;
|
|
1912
1989
|
readonly inputFormat?: AudioFormat;
|
|
1913
1990
|
readonly outputFormat?: AudioFormat;
|
|
1991
|
+
/** Values authenticated by the host and expected in Twilio's start frame. */
|
|
1992
|
+
readonly expectedTwilioCallSid?: string;
|
|
1993
|
+
readonly expectedAccountSid?: string;
|
|
1914
1994
|
readonly clock?: ProviderClock;
|
|
1995
|
+
readonly onClosed?: () => void;
|
|
1915
1996
|
}
|
|
1916
1997
|
declare class TwilioMediaStreamCallHandle implements CallHandle {
|
|
1917
1998
|
#private;
|
|
@@ -1924,6 +2005,8 @@ declare class TwilioMediaStreamCallHandle implements CallHandle {
|
|
|
1924
2005
|
close(reason: StreamEndReason): Promise<void>;
|
|
1925
2006
|
confirmPlayout(markId: string, timeoutMs: number): Promise<boolean>;
|
|
1926
2007
|
}
|
|
2008
|
+
|
|
2009
|
+
/** Accept-only bridge for a host-authenticated Twilio Media Streams socket. */
|
|
1927
2010
|
declare class TwilioMediaStreamsProvider implements TelephonyProvider {
|
|
1928
2011
|
#private;
|
|
1929
2012
|
readonly name: "twilio-media-streams";
|
|
@@ -1963,8 +2046,8 @@ declare class TwilioMediaStreamsProvider implements TelephonyProvider {
|
|
|
1963
2046
|
dial(): Promise<CallHandle>;
|
|
1964
2047
|
accept(ctx: Parameters<TelephonyProvider["accept"]>[0]): Promise<CallHandle>;
|
|
1965
2048
|
attachWebSocket(socket: TwilioMediaStreamSocket, callId: CallId, sessionId: SessionId): void;
|
|
1966
|
-
acceptWebSocket(socket: TwilioMediaStreamSocket, callId: CallId, sessionId: SessionId): Promise<TwilioMediaStreamCallHandle>;
|
|
1967
|
-
hangup(
|
|
2049
|
+
acceptWebSocket(socket: TwilioMediaStreamSocket, callId: CallId, sessionId: SessionId, options?: Pick<TwilioMediaStreamCallHandleOptions, "expectedTwilioCallSid" | "expectedAccountSid">): Promise<TwilioMediaStreamCallHandle>;
|
|
2050
|
+
hangup(callId: CallId): Promise<void>;
|
|
1968
2051
|
}
|
|
1969
2052
|
declare function createTwilioMediaStreamsProvider(): TwilioMediaStreamsProvider;
|
|
1970
2053
|
|
|
@@ -1986,6 +2069,7 @@ declare const WEB_CLIENT_AUDIO_DEFAULTS: {
|
|
|
1986
2069
|
};
|
|
1987
2070
|
interface WebClientAudioSocket {
|
|
1988
2071
|
readonly readyState: number;
|
|
2072
|
+
readonly bufferedAmount?: number;
|
|
1989
2073
|
send(data: string | Buffer): void;
|
|
1990
2074
|
close(code?: number, reason?: string): void;
|
|
1991
2075
|
on(event: "message", handler: (data: WebSocket.RawData, isBinary: boolean) => void): this;
|
|
@@ -2410,11 +2494,49 @@ declare class OpenAiResponsesLlmProvider implements LLMProvider {
|
|
|
2410
2494
|
}
|
|
2411
2495
|
declare function createOpenAiResponsesLlmProvider(options: OpenAiResponsesLlmProviderOptions): OpenAiResponsesLlmProvider;
|
|
2412
2496
|
|
|
2497
|
+
interface GroqChatLlmProviderOptions {
|
|
2498
|
+
readonly apiKey: string;
|
|
2499
|
+
readonly url?: string;
|
|
2500
|
+
/** Allows an explicitly configured compatible endpoint/model outside the dated catalog. */
|
|
2501
|
+
readonly allowUnknownModel?: boolean;
|
|
2502
|
+
readonly clock?: ProviderClock;
|
|
2503
|
+
}
|
|
2504
|
+
declare class GroqChatLlmProvider implements LLMProvider {
|
|
2505
|
+
#private;
|
|
2506
|
+
readonly name: "groq-chat-completions";
|
|
2507
|
+
readonly kind = "llm";
|
|
2508
|
+
readonly version = "0.1.0";
|
|
2509
|
+
readonly capabilities: {
|
|
2510
|
+
streaming: {
|
|
2511
|
+
input: false;
|
|
2512
|
+
output: true;
|
|
2513
|
+
native: true;
|
|
2514
|
+
};
|
|
2515
|
+
cancellation: {
|
|
2516
|
+
request: true;
|
|
2517
|
+
output: true;
|
|
2518
|
+
buffer: false;
|
|
2519
|
+
truncation: false;
|
|
2520
|
+
};
|
|
2521
|
+
transports: ("http" | "sse")[];
|
|
2522
|
+
models: readonly ["openai/gpt-oss-20b", "openai/gpt-oss-120b"];
|
|
2523
|
+
tools: {
|
|
2524
|
+
functionCalling: true;
|
|
2525
|
+
parallelCalls: false;
|
|
2526
|
+
};
|
|
2527
|
+
};
|
|
2528
|
+
constructor(options: GroqChatLlmProviderOptions);
|
|
2529
|
+
complete(request: LlmCompletionRequest): Promise<LlmCompletion>;
|
|
2530
|
+
}
|
|
2531
|
+
declare function createGroqChatLlmProvider(options: GroqChatLlmProviderOptions): GroqChatLlmProvider;
|
|
2532
|
+
|
|
2413
2533
|
interface CartesiaTtsProviderOptions {
|
|
2414
2534
|
readonly apiKey: string;
|
|
2415
2535
|
readonly url?: string;
|
|
2416
2536
|
readonly voiceId: string;
|
|
2417
2537
|
readonly modelId?: string;
|
|
2538
|
+
/** Allows an explicitly configured compatible endpoint/model outside the dated catalog. */
|
|
2539
|
+
readonly allowUnknownModel?: boolean;
|
|
2418
2540
|
readonly language?: string;
|
|
2419
2541
|
readonly clock?: ProviderClock;
|
|
2420
2542
|
readonly webSocketFactory?: (url: string, headers: Readonly<Record<string, string>>) => WebSocket;
|
|
@@ -2488,6 +2610,7 @@ declare const PROVIDER_STABILITY: Readonly<{
|
|
|
2488
2610
|
readonly elevenlabsStt: "experimental";
|
|
2489
2611
|
readonly assemblyai: "experimental";
|
|
2490
2612
|
readonly soniox: "experimental";
|
|
2613
|
+
readonly groq: "experimental";
|
|
2491
2614
|
readonly openaiResponses: "experimental";
|
|
2492
2615
|
readonly cartesia: "experimental";
|
|
2493
2616
|
readonly elevenlabs: "experimental";
|
|
@@ -2496,20 +2619,20 @@ declare const PROVIDER_STABILITY: Readonly<{
|
|
|
2496
2619
|
}>;
|
|
2497
2620
|
declare const PROVIDER_CATALOG: {
|
|
2498
2621
|
readonly deepgram: {
|
|
2499
|
-
readonly verifiedAt: "2026-
|
|
2622
|
+
readonly verifiedAt: "2026-09-15";
|
|
2500
2623
|
readonly source: "https://developers.deepgram.com/docs/models-languages-overview";
|
|
2501
2624
|
readonly defaultModel: "nova-3";
|
|
2502
2625
|
readonly models: readonly ["nova-3", "nova-2"];
|
|
2503
2626
|
};
|
|
2504
2627
|
readonly sarvam: {
|
|
2505
|
-
readonly verifiedAt: "2026-
|
|
2506
|
-
readonly source: "https://docs.sarvam.ai/api-reference/
|
|
2628
|
+
readonly verifiedAt: "2026-09-15";
|
|
2629
|
+
readonly source: "https://docs.sarvam.ai/api-reference/speech-to-text/transcribe/ws";
|
|
2507
2630
|
readonly defaultModel: "saaras:v3";
|
|
2508
2631
|
readonly models: readonly ["saaras:v3", "saaras:v4"];
|
|
2509
2632
|
};
|
|
2510
2633
|
readonly cartesia: {
|
|
2511
|
-
readonly verifiedAt: "2026-
|
|
2512
|
-
readonly source: "https://docs.cartesia.ai/
|
|
2634
|
+
readonly verifiedAt: "2026-09-15";
|
|
2635
|
+
readonly source: "https://docs.cartesia.ai/build-with-cartesia/tts-models/older-models";
|
|
2513
2636
|
readonly defaultModel: "sonic-3";
|
|
2514
2637
|
readonly models: readonly ["sonic-3", "sonic-2"];
|
|
2515
2638
|
};
|
|
@@ -2537,6 +2660,12 @@ declare const PROVIDER_CATALOG: {
|
|
|
2537
2660
|
readonly defaultModel: "stt-rt-v5";
|
|
2538
2661
|
readonly models: readonly ["stt-rt-v5"];
|
|
2539
2662
|
};
|
|
2663
|
+
readonly groq: {
|
|
2664
|
+
readonly verifiedAt: "2026-09-15";
|
|
2665
|
+
readonly source: "https://console.groq.com/docs/models";
|
|
2666
|
+
readonly defaultModel: "openai/gpt-oss-20b";
|
|
2667
|
+
readonly models: readonly ["openai/gpt-oss-20b", "openai/gpt-oss-120b"];
|
|
2668
|
+
};
|
|
2540
2669
|
readonly openaiResponses: {
|
|
2541
2670
|
readonly verifiedAt: "2026-07-24";
|
|
2542
2671
|
readonly source: "https://platform.openai.com/docs/models";
|
|
@@ -2617,6 +2746,82 @@ declare class ElevenLabsTtsProvider implements IncrementalTextToSpeechProvider {
|
|
|
2617
2746
|
}
|
|
2618
2747
|
declare function createElevenLabsTtsProvider(options: ElevenLabsTtsProviderOptions): ElevenLabsTtsProvider;
|
|
2619
2748
|
|
|
2749
|
+
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
2750
|
+
declare function base64ToBytes(value: string): Uint8Array;
|
|
2751
|
+
declare function mulawToPcm16le(mulaw: Uint8Array): Uint8Array;
|
|
2752
|
+
declare function pcm16leToMulaw(pcm: Uint8Array): Uint8Array;
|
|
2753
|
+
/**
|
|
2754
|
+
* v0.1 normalized audio is frozen to **pcm_s16le, mono**. The frame/duration/
|
|
2755
|
+
* resample helpers below compute on interleaved-sample assumptions that only hold
|
|
2756
|
+
* for a single channel, so a stereo format would silently corrupt timing. We
|
|
2757
|
+
* reject it at the boundary rather than miscompute.
|
|
2758
|
+
*/
|
|
2759
|
+
declare function assertPcm16leFormat(format: AudioFormat): void;
|
|
2760
|
+
declare function resamplePcm16le(pcm: Uint8Array, fromSampleRateHz: number, toSampleRateHz: number): Uint8Array;
|
|
2761
|
+
declare function frameCountForPcm16le(bytes: Uint8Array): number;
|
|
2762
|
+
declare function durationMsForPcm16le(bytes: Uint8Array, sampleRateHz: number): number;
|
|
2763
|
+
declare function splitPcm16leFrames(bytes: Uint8Array, format: AudioFormat, frameDurationMs: number): readonly Uint8Array[];
|
|
2764
|
+
|
|
2765
|
+
/**
|
|
2766
|
+
* Thrown synchronously when a second live iterator claims the queue. The
|
|
2767
|
+
* stable `code` is the cross-realm detection contract.
|
|
2768
|
+
*/
|
|
2769
|
+
declare class AsyncQueueConsumerError extends Error {
|
|
2770
|
+
readonly name = "AsyncQueueConsumerError";
|
|
2771
|
+
readonly code: "async_queue.consumer_already_claimed";
|
|
2772
|
+
constructor();
|
|
2773
|
+
}
|
|
2774
|
+
interface AsyncQueueOptions {
|
|
2775
|
+
readonly maxBuffered?: number;
|
|
2776
|
+
/**
|
|
2777
|
+
* Supplies the terminal error to deliver when a bounded queue is full. When
|
|
2778
|
+
* omitted, `push()` keeps its non-throwing boolean-only contract and the
|
|
2779
|
+
* caller remains responsible for handling `false`.
|
|
2780
|
+
*/
|
|
2781
|
+
readonly onOverflow?: () => unknown;
|
|
2782
|
+
}
|
|
2783
|
+
/**
|
|
2784
|
+
* Bounded, single-live-consumer async queue. Producer close drains buffered
|
|
2785
|
+
* values; consumer return discards them; fail rejects pending and future
|
|
2786
|
+
* reads. A second live consumer is rejected synchronously.
|
|
2787
|
+
*/
|
|
2788
|
+
declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
2789
|
+
#private;
|
|
2790
|
+
constructor(options?: AsyncQueueOptions);
|
|
2791
|
+
get isClosed(): boolean;
|
|
2792
|
+
push(value: T): boolean;
|
|
2793
|
+
fail(error: unknown): void;
|
|
2794
|
+
close(): void;
|
|
2795
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
interface AudioNormalizerOptions {
|
|
2799
|
+
readonly inputFormat: AudioFormat;
|
|
2800
|
+
readonly outputFormat?: AudioFormat;
|
|
2801
|
+
readonly channelPolicy?: "average" | "left";
|
|
2802
|
+
}
|
|
2803
|
+
interface AudioNormalizer {
|
|
2804
|
+
readonly inputFormat: AudioFormat;
|
|
2805
|
+
readonly outputFormat: AudioFormat;
|
|
2806
|
+
push(bytes: Uint8Array): Uint8Array;
|
|
2807
|
+
finishSegment(): Uint8Array;
|
|
2808
|
+
finish(): Uint8Array;
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* Converts supported PCM source frames into PCM16LE mono while preserving
|
|
2812
|
+
* sample-clock phase across arbitrary realtime chunk boundaries.
|
|
2813
|
+
*
|
|
2814
|
+
* The FIR is intentionally small and deterministic. It is causal with a
|
|
2815
|
+
* bounded look-ahead: ordinary pushes emit only samples whose filter support is
|
|
2816
|
+
* present, while an explicit segment/stream finish uses the final source sample
|
|
2817
|
+
* as the endpoint. This prevents packet boundaries from becoming resampling
|
|
2818
|
+
* boundaries.
|
|
2819
|
+
*/
|
|
2820
|
+
declare function createAudioNormalizer(options: AudioNormalizerOptions): AudioNormalizer;
|
|
2821
|
+
|
|
2822
|
+
declare function isInputMediaEvent(event: MediaEvent): event is InputMediaEvent;
|
|
2823
|
+
declare function isOutputMediaEvent(event: MediaEvent): event is OutputMediaEvent;
|
|
2824
|
+
|
|
2620
2825
|
/**
|
|
2621
2826
|
* A single param value or an array of repeated param values. Twilio sends
|
|
2622
2827
|
* each value as a separate URL-encoded occurrence in the POST body, so a
|
|
@@ -2650,11 +2855,6 @@ interface VerifyTwilioOptions {
|
|
|
2650
2855
|
* verifyTwilioSignature({...authTokenB});
|
|
2651
2856
|
*/
|
|
2652
2857
|
readonly authToken: string;
|
|
2653
|
-
/**
|
|
2654
|
-
* When true, return true unconditionally. Use this ONLY in tests, never
|
|
2655
|
-
* in production. Defaults to false.
|
|
2656
|
-
*/
|
|
2657
|
-
readonly skipVerification?: boolean;
|
|
2658
2858
|
}
|
|
2659
2859
|
declare function canonicalizeTwilioData(url: string, params: TwilioFlatParams | TwilioParams): Buffer;
|
|
2660
2860
|
/**
|
|
@@ -2712,10 +2912,6 @@ interface VerifyVoiceSessionTokenOptions {
|
|
|
2712
2912
|
* Use this if server and client clocks are skewed.
|
|
2713
2913
|
*/
|
|
2714
2914
|
readonly toleranceMs?: number;
|
|
2715
|
-
/**
|
|
2716
|
-
* When true, return true unconditionally. Use ONLY in tests.
|
|
2717
|
-
*/
|
|
2718
|
-
readonly skipVerification?: boolean;
|
|
2719
2915
|
}
|
|
2720
2916
|
/**
|
|
2721
2917
|
* Compute the expected voice-session token for a given session ref
|
|
@@ -2866,7 +3062,7 @@ declare class SessionRecoveryCoordinator {
|
|
|
2866
3062
|
#private;
|
|
2867
3063
|
constructor(options: SessionRecoveryCoordinatorOptions);
|
|
2868
3064
|
start(): void;
|
|
2869
|
-
stop(): void
|
|
3065
|
+
stop(): Promise<void>;
|
|
2870
3066
|
pollOnce(): Promise<RecoveryPollResult>;
|
|
2871
3067
|
}
|
|
2872
3068
|
interface SessionReaperOptions {
|
|
@@ -2887,7 +3083,7 @@ declare class SessionReaper {
|
|
|
2887
3083
|
#private;
|
|
2888
3084
|
constructor(options: SessionReaperOptions);
|
|
2889
3085
|
start(): void;
|
|
2890
|
-
stop(): void
|
|
3086
|
+
stop(): Promise<void>;
|
|
2891
3087
|
reapOnce(): Promise<number>;
|
|
2892
3088
|
}
|
|
2893
3089
|
|
|
@@ -2932,7 +3128,7 @@ declare class ConversationPolicy {
|
|
|
2932
3128
|
/** Commits buffered final segments for an endpoint, timeout, or stream shutdown. */
|
|
2933
3129
|
flushBufferedTranscript(): string | null;
|
|
2934
3130
|
messagesForTranscript(transcript: string): readonly LlmMessage[];
|
|
2935
|
-
messagesForToolContinuation(messages: readonly LlmMessage[], assistantText: string, toolMessages: readonly LlmMessage[]): readonly LlmMessage[];
|
|
3131
|
+
messagesForToolContinuation(messages: readonly LlmMessage[], assistantText: string, toolMessages: readonly LlmMessage[], assistantToolCalls?: readonly LlmInlineToolCall[]): readonly LlmMessage[];
|
|
2936
3132
|
recordTurn(transcript: string, assistantText: string): void;
|
|
2937
3133
|
recordInterruptedTurn(transcript: string, assistantText: string): void;
|
|
2938
3134
|
findTool(call: LlmInlineToolCall): ToolDefinition | null;
|
|
@@ -2971,7 +3167,11 @@ interface SttReconnectOptions {
|
|
|
2971
3167
|
readonly uncertainWindowMs?: number;
|
|
2972
3168
|
readonly maxBufferedBytes?: number;
|
|
2973
3169
|
readonly maxBufferedCommands?: number;
|
|
3170
|
+
/** Bounds provider acceptance of one audio command in each generation. */
|
|
3171
|
+
readonly sendTimeoutMs?: number;
|
|
2974
3172
|
readonly commitTimeoutMs?: number;
|
|
3173
|
+
readonly audioWriteTimeoutMs?: number;
|
|
3174
|
+
readonly closeTimeoutMs?: number;
|
|
2975
3175
|
}
|
|
2976
3176
|
/**
|
|
2977
3177
|
* Wraps one STT provider with bounded, best-effort reconnect and replay policy.
|
|
@@ -3006,6 +3206,8 @@ declare function deliverAssistantText(options: {
|
|
|
3006
3206
|
readonly mode?: TextDeliveryMode;
|
|
3007
3207
|
readonly audioDelivered: boolean;
|
|
3008
3208
|
readonly cancelledByBargeIn: boolean;
|
|
3209
|
+
/** Internal seam for deterministic tests and slow text transports. */
|
|
3210
|
+
readonly timeoutMs?: number;
|
|
3009
3211
|
}): Promise<boolean | undefined>;
|
|
3010
3212
|
|
|
3011
3213
|
/**
|
|
@@ -3058,7 +3260,8 @@ type VoiceEvent = {
|
|
|
3058
3260
|
};
|
|
3059
3261
|
/**
|
|
3060
3262
|
* The result of starting a `PipelineVoiceLoop`. Dual-protocol: awaits
|
|
3061
|
-
* to a final `PipelineVoiceLoopResult`
|
|
3263
|
+
* to a final `PipelineVoiceLoopResult` with an explicit terminal reason and
|
|
3264
|
+
* source, AND iterates the per-event
|
|
3062
3265
|
* stream.
|
|
3063
3266
|
*
|
|
3064
3267
|
* Implementation note: the class implements both `PromiseLike<PipelineVoiceLoopResult>`
|
|
@@ -3096,7 +3299,7 @@ type PipelineVoiceLoopResultLike = PipelineVoiceLoopResult;
|
|
|
3096
3299
|
* supervisor controller.
|
|
3097
3300
|
*
|
|
3098
3301
|
* The double-set guard rejects a second `abortSignal` call. To compose
|
|
3099
|
-
* multiple signals, use `AbortSignal.any([a, b])` (Node
|
|
3302
|
+
* multiple signals, use `AbortSignal.any([a, b])` (Node 22+) before
|
|
3100
3303
|
* passing them in.
|
|
3101
3304
|
*/
|
|
3102
3305
|
declare class PipelineVoiceLoopBuilder {
|
|
@@ -3123,9 +3326,15 @@ declare class PipelineVoiceLoopBuilder {
|
|
|
3123
3326
|
interface PipelineVoiceLoopLike {
|
|
3124
3327
|
_startInternal(options: {
|
|
3125
3328
|
readonly overrideSignal?: AbortSignal;
|
|
3329
|
+
readonly consumer?: "internal" | "public";
|
|
3330
|
+
/** Internal lifecycle hook; does not observe or assimilate the thenable. */
|
|
3331
|
+
readonly onRunPromise?: (promise: Promise<PipelineVoiceLoopResult>) => void;
|
|
3126
3332
|
}): DualProtocolResult;
|
|
3127
3333
|
}
|
|
3128
3334
|
|
|
3335
|
+
/** The six sources that may win a live pipeline terminal race. */
|
|
3336
|
+
type LiveTerminalSource = Extract<TerminalSource, "operator_stop" | "caller_abort" | "run_timeout" | "remote_transport" | "provider_runtime" | "normal_completion">;
|
|
3337
|
+
|
|
3129
3338
|
interface TurnLatencyRecord {
|
|
3130
3339
|
readonly sessionId: SessionId;
|
|
3131
3340
|
readonly turnId: TurnId;
|
|
@@ -3163,6 +3372,8 @@ interface PipelineVoiceLoopOptions {
|
|
|
3163
3372
|
readonly turnEndpointTimeoutMs?: number;
|
|
3164
3373
|
/** Absolute cap from the first immutable final segment in one utterance. */
|
|
3165
3374
|
readonly turnMaxDurationMs?: number;
|
|
3375
|
+
/** Optional managed-owner source for an external cancellation signal. */
|
|
3376
|
+
readonly terminalSourceForCancellation?: () => LiveTerminalSource | undefined;
|
|
3166
3377
|
/**
|
|
3167
3378
|
* Receives one record per terminal turn. This is an observation seam, not part of
|
|
3168
3379
|
* execution: it is invoked after the turn is already terminal, its return value is
|
|
@@ -3172,12 +3383,23 @@ interface PipelineVoiceLoopOptions {
|
|
|
3172
3383
|
readonly onAssistantText?: (record: AssistantTextRecord) => void;
|
|
3173
3384
|
readonly sessionMetricsRecorder?: SessionMetricsRecorder;
|
|
3174
3385
|
}
|
|
3386
|
+
type PipelineVoiceLoopTerminalReason = "completed" | "cancelled" | "failed" | "remote_hangup";
|
|
3175
3387
|
interface PipelineVoiceLoopResult {
|
|
3176
3388
|
readonly session: ActiveSession;
|
|
3177
3389
|
readonly turnsHandled: number;
|
|
3178
3390
|
readonly interruptions: number;
|
|
3179
3391
|
readonly turnsFailed: number;
|
|
3180
3392
|
readonly firstTurnError: NormalizedError | null;
|
|
3393
|
+
/**
|
|
3394
|
+
* Terminal reason for RESOLVED runs (additive; existing readers ignore it).
|
|
3395
|
+
* Precedence: cancelled (explicit cancel/abort won) > failed (one or more
|
|
3396
|
+
* failed turns, or a timeout/error stream end) > remote_hangup >
|
|
3397
|
+
* completed. Rejected runs carry their terminal in the rejection instead;
|
|
3398
|
+
* unified cancel/remote arbitration with scheduler batches is joint T1
|
|
3399
|
+
* work — this field reports the resolved outcome only.
|
|
3400
|
+
*/
|
|
3401
|
+
readonly terminalReason: PipelineVoiceLoopTerminalReason;
|
|
3402
|
+
readonly terminalSource: LiveTerminalSource;
|
|
3181
3403
|
}
|
|
3182
3404
|
/**
|
|
3183
3405
|
* Runs a pipeline voice session: media -> STT -> LLM/tools -> TTS -> media.
|
|
@@ -3205,9 +3427,31 @@ declare class PipelineVoiceLoop {
|
|
|
3205
3427
|
*/
|
|
3206
3428
|
_startInternal(options: {
|
|
3207
3429
|
readonly overrideSignal?: AbortSignal;
|
|
3430
|
+
readonly consumer?: "internal" | "public";
|
|
3431
|
+
/** Internal lifecycle hook used by managed wrappers without thenable assimilation. */
|
|
3432
|
+
readonly onRunPromise?: (promise: Promise<PipelineVoiceLoopResult>) => void;
|
|
3208
3433
|
}): DualProtocolResult;
|
|
3209
3434
|
}
|
|
3210
3435
|
|
|
3436
|
+
type CleanupStage = "call.close" | "runtime.endSession" | "runtime.stop" | "late.call.close" | "late.runtime.endSession" | "late.runtime.stop";
|
|
3437
|
+
interface CleanupErrorSummary {
|
|
3438
|
+
readonly stage: CleanupStage;
|
|
3439
|
+
readonly code: string;
|
|
3440
|
+
readonly message: string;
|
|
3441
|
+
}
|
|
3442
|
+
interface VoiceRuntimeFailureMetadata {
|
|
3443
|
+
readonly degraded: boolean;
|
|
3444
|
+
readonly callClosed: boolean;
|
|
3445
|
+
readonly sessionEnded: boolean;
|
|
3446
|
+
readonly timedOut: boolean;
|
|
3447
|
+
readonly lateCleanupPending: boolean;
|
|
3448
|
+
readonly primaryCode: string;
|
|
3449
|
+
readonly cleanupErrors: readonly CleanupErrorSummary[];
|
|
3450
|
+
}
|
|
3451
|
+
declare class VoiceRuntimeFinalizationError extends TvicThrowableError {
|
|
3452
|
+
constructor(raw: NormalizedError | null, cleanupErrors: readonly CleanupErrorSummary[], metadata: VoiceRuntimeFailureMetadata);
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3211
3455
|
type AudioNormalizationMode = "auto" | "never";
|
|
3212
3456
|
interface SttSessionInputOptions {
|
|
3213
3457
|
readonly format: AudioFormat;
|
|
@@ -3228,6 +3472,12 @@ interface SttSessionOptions {
|
|
|
3228
3472
|
readonly vocabulary?: readonly string[];
|
|
3229
3473
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
3230
3474
|
readonly openTimeoutMs?: number;
|
|
3475
|
+
/** Bounds provider acceptance of one audio command. */
|
|
3476
|
+
readonly sendTimeoutMs?: number;
|
|
3477
|
+
/** Bounds provider acceptance of one commit barrier. */
|
|
3478
|
+
readonly commitTimeoutMs?: number;
|
|
3479
|
+
/** Bounds an ordered close before the session switches to forced teardown. */
|
|
3480
|
+
readonly closeTimeoutMs?: number;
|
|
3231
3481
|
readonly signal?: AbortSignal;
|
|
3232
3482
|
readonly clock?: Clock;
|
|
3233
3483
|
readonly idGenerator?: IdGenerator;
|
|
@@ -3272,6 +3522,8 @@ interface NodeMediaPlaneOptions<TContext = unknown> {
|
|
|
3272
3522
|
readonly host?: string;
|
|
3273
3523
|
readonly port: number;
|
|
3274
3524
|
readonly path: string;
|
|
3525
|
+
/** Maximum inbound WebSocket frame accepted before the connection is closed. */
|
|
3526
|
+
readonly maxInboundFrameBytes?: number;
|
|
3275
3527
|
readonly healthPath?: string;
|
|
3276
3528
|
/**
|
|
3277
3529
|
* Optional health check. Called when the plane's `healthPath` endpoint
|
|
@@ -3340,7 +3592,13 @@ type OpenAiProviderConfig = Omit<OpenAiResponsesLlmProviderOptions, "apiKey"> &
|
|
|
3340
3592
|
/** Allows a custom OpenAI-compatible endpoint to use a model outside TVIC's dated catalog. */
|
|
3341
3593
|
readonly allowUnknownModel?: boolean;
|
|
3342
3594
|
};
|
|
3343
|
-
type
|
|
3595
|
+
type GroqProviderConfig = Omit<GroqChatLlmProviderOptions, "apiKey"> & {
|
|
3596
|
+
readonly provider: "groq";
|
|
3597
|
+
readonly apiKey?: string;
|
|
3598
|
+
readonly model?: string;
|
|
3599
|
+
readonly allowUnknownModel?: boolean;
|
|
3600
|
+
};
|
|
3601
|
+
type LlmProviderConfig = OpenAiProviderConfig | GroqProviderConfig;
|
|
3344
3602
|
type CartesiaProviderConfig = Omit<CartesiaTtsProviderOptions, "apiKey" | "voiceId" | "modelId"> & {
|
|
3345
3603
|
readonly provider: "cartesia";
|
|
3346
3604
|
readonly apiKey?: string;
|
|
@@ -3403,6 +3661,8 @@ interface VoiceAgentRunOptions {
|
|
|
3403
3661
|
readonly organizationId?: OrganizationId;
|
|
3404
3662
|
readonly workflowId?: WorkflowId;
|
|
3405
3663
|
readonly signal?: AbortSignal;
|
|
3664
|
+
/** Maximum time allowed to start the runtime, attach the call, and create the run. */
|
|
3665
|
+
readonly startupTimeoutMs?: number;
|
|
3406
3666
|
readonly safetyIdentifier?: string;
|
|
3407
3667
|
readonly sttReconnect?: boolean | SttReconnectOptions;
|
|
3408
3668
|
readonly sttLanguage?: string;
|
|
@@ -3413,8 +3673,11 @@ interface VoiceAgentRunOptions {
|
|
|
3413
3673
|
}
|
|
3414
3674
|
interface VoiceAgentCallHandleContext {
|
|
3415
3675
|
readonly sessionId: SessionId;
|
|
3416
|
-
|
|
3676
|
+
/** A deeply frozen copy of the validated call supplied to start(). */
|
|
3677
|
+
readonly call: CallSnapshot;
|
|
3417
3678
|
readonly channel: ChannelKind;
|
|
3679
|
+
/** Aborts when the caller, startup deadline, or global agent shutdown wins. */
|
|
3680
|
+
readonly signal: AbortSignal;
|
|
3418
3681
|
}
|
|
3419
3682
|
type VoiceAgentCallHandleFactory = (context: VoiceAgentCallHandleContext) => CallHandle | PromiseLike<CallHandle>;
|
|
3420
3683
|
interface VoiceAgentRun extends DualProtocolResult {
|
|
@@ -3441,68 +3704,6 @@ interface VoiceAgent {
|
|
|
3441
3704
|
}
|
|
3442
3705
|
declare function createVoiceAgent(options: CreateVoiceAgentOptions): VoiceAgent;
|
|
3443
3706
|
|
|
3444
|
-
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
3445
|
-
declare function base64ToBytes(value: string): Uint8Array;
|
|
3446
|
-
declare function mulawToPcm16le(mulaw: Uint8Array): Uint8Array;
|
|
3447
|
-
declare function pcm16leToMulaw(pcm: Uint8Array): Uint8Array;
|
|
3448
|
-
/**
|
|
3449
|
-
* v0.1 normalized audio is frozen to **pcm_s16le, mono**. The frame/duration/
|
|
3450
|
-
* resample helpers below compute on interleaved-sample assumptions that only hold
|
|
3451
|
-
* for a single channel, so a stereo format would silently corrupt timing. We
|
|
3452
|
-
* reject it at the boundary rather than miscompute.
|
|
3453
|
-
*/
|
|
3454
|
-
declare function assertPcm16leFormat(format: AudioFormat): void;
|
|
3455
|
-
declare function resamplePcm16le(pcm: Uint8Array, fromSampleRateHz: number, toSampleRateHz: number): Uint8Array;
|
|
3456
|
-
declare function frameCountForPcm16le(bytes: Uint8Array): number;
|
|
3457
|
-
declare function durationMsForPcm16le(bytes: Uint8Array, sampleRateHz: number): number;
|
|
3458
|
-
declare function splitPcm16leFrames(bytes: Uint8Array, format: AudioFormat, frameDurationMs: number): readonly Uint8Array[];
|
|
3459
|
-
|
|
3460
|
-
/**
|
|
3461
|
-
* A deliberately unbounded, single-consumer async queue: exactly one iterator
|
|
3462
|
-
* may drain it, and pushed values resolve waiters in FIFO order. Lives in
|
|
3463
|
-
* `@tvic/media` because it is the one package both `@tvic/providers` and
|
|
3464
|
-
* `@tvic/runtime` are allowed to depend on (see `scripts/check-architecture.mjs`),
|
|
3465
|
-
* so provider adapters and the runtime's own session/stream wrappers share this
|
|
3466
|
-
* one implementation instead of each keeping a private copy.
|
|
3467
|
-
*/
|
|
3468
|
-
declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
3469
|
-
#private;
|
|
3470
|
-
constructor(options?: {
|
|
3471
|
-
readonly maxBuffered?: number;
|
|
3472
|
-
});
|
|
3473
|
-
push(value: T): boolean;
|
|
3474
|
-
fail(error: unknown): void;
|
|
3475
|
-
close(): void;
|
|
3476
|
-
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
3477
|
-
}
|
|
3478
|
-
|
|
3479
|
-
interface AudioNormalizerOptions {
|
|
3480
|
-
readonly inputFormat: AudioFormat;
|
|
3481
|
-
readonly outputFormat?: AudioFormat;
|
|
3482
|
-
readonly channelPolicy?: "average" | "left";
|
|
3483
|
-
}
|
|
3484
|
-
interface AudioNormalizer {
|
|
3485
|
-
readonly inputFormat: AudioFormat;
|
|
3486
|
-
readonly outputFormat: AudioFormat;
|
|
3487
|
-
push(bytes: Uint8Array): Uint8Array;
|
|
3488
|
-
finishSegment(): Uint8Array;
|
|
3489
|
-
finish(): Uint8Array;
|
|
3490
|
-
}
|
|
3491
|
-
/**
|
|
3492
|
-
* Converts supported PCM source frames into PCM16LE mono while preserving
|
|
3493
|
-
* sample-clock phase across arbitrary realtime chunk boundaries.
|
|
3494
|
-
*
|
|
3495
|
-
* The FIR is intentionally small and deterministic. It is causal with a
|
|
3496
|
-
* bounded look-ahead: ordinary pushes emit only samples whose filter support is
|
|
3497
|
-
* present, while an explicit segment/stream finish uses the final source sample
|
|
3498
|
-
* as the endpoint. This prevents packet boundaries from becoming resampling
|
|
3499
|
-
* boundaries.
|
|
3500
|
-
*/
|
|
3501
|
-
declare function createAudioNormalizer(options: AudioNormalizerOptions): AudioNormalizer;
|
|
3502
|
-
|
|
3503
|
-
declare function isInputMediaEvent(event: MediaEvent): event is InputMediaEvent;
|
|
3504
|
-
declare function isOutputMediaEvent(event: MediaEvent): event is OutputMediaEvent;
|
|
3505
|
-
|
|
3506
3707
|
declare class InMemorySessionStore implements SessionStore {
|
|
3507
3708
|
#private;
|
|
3508
3709
|
get(id: SessionId): Promise<StoredSessionRecord | null>;
|
|
@@ -3668,9 +3869,21 @@ declare function idempotencyKeyFor<TInput, TOutput>(input: ExecuteToolInput<TInp
|
|
|
3668
3869
|
declare function idempotencyRequestHashFor<TInput, TOutput>(input: ExecuteToolInput<TInput, TOutput>): string;
|
|
3669
3870
|
declare function executeTool<TInput = unknown, TOutput = unknown>(input: ExecuteToolInput<TInput, TOutput>): Promise<ToolCall>;
|
|
3670
3871
|
|
|
3872
|
+
interface PersistedErrorCompatibilityDiagnostic {
|
|
3873
|
+
readonly adapter: "postgres" | "redis";
|
|
3874
|
+
readonly operation: "idempotency_alias_rewrite";
|
|
3875
|
+
readonly key: string;
|
|
3876
|
+
readonly legacyCode: string;
|
|
3877
|
+
readonly canonicalCode: string;
|
|
3878
|
+
readonly outcome: "rewrite_failed";
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3671
3881
|
declare class PostgresToolIdempotencyStore implements ToolIdempotencyStore {
|
|
3882
|
+
#private;
|
|
3672
3883
|
readonly client: SqlClient$1;
|
|
3673
|
-
constructor(client: SqlClient$1
|
|
3884
|
+
constructor(client: SqlClient$1, options?: {
|
|
3885
|
+
readonly onCompatibilityDiagnostic?: (diagnostic: PersistedErrorCompatibilityDiagnostic) => void;
|
|
3886
|
+
});
|
|
3674
3887
|
lookup(key: string, requestHash: string): Promise<ToolIdempotencyRecord | null>;
|
|
3675
3888
|
claim(input: ToolIdempotencyClaim): Promise<ToolIdempotencyClaimResult>;
|
|
3676
3889
|
complete(key: string, requestHash: string, outcome: ToolIdempotencyOutcome): Promise<void>;
|
|
@@ -3827,6 +4040,7 @@ interface RedisStoreOptions {
|
|
|
3827
4040
|
readonly nowMs?: () => number;
|
|
3828
4041
|
readonly maxTransactionRetries?: number;
|
|
3829
4042
|
readonly closeClient?: boolean;
|
|
4043
|
+
readonly onCompatibilityDiagnostic?: (diagnostic: PersistedErrorCompatibilityDiagnostic) => void;
|
|
3830
4044
|
}
|
|
3831
4045
|
|
|
3832
4046
|
declare class RedisSessionStore implements SessionStore {
|
|
@@ -3931,13 +4145,13 @@ declare function createPostgresRedisDurableRuntimeStore(options: PostgresRedisDu
|
|
|
3931
4145
|
interface SqlClient {
|
|
3932
4146
|
query<TRow extends Record<string, unknown> = Record<string, unknown>>(text: string, params?: readonly unknown[]): Promise<{
|
|
3933
4147
|
rows: readonly TRow[];
|
|
3934
|
-
rowCount
|
|
4148
|
+
rowCount?: number | null;
|
|
3935
4149
|
}>;
|
|
3936
4150
|
}
|
|
3937
4151
|
interface SqlPool {
|
|
3938
4152
|
query<TRow extends Record<string, unknown> = Record<string, unknown>>(text: string, params?: readonly unknown[]): Promise<{
|
|
3939
4153
|
rows: readonly TRow[];
|
|
3940
|
-
rowCount
|
|
4154
|
+
rowCount?: number | null;
|
|
3941
4155
|
}>;
|
|
3942
4156
|
connect(): Promise<SqlClient & {
|
|
3943
4157
|
readonly release: () => void;
|
|
@@ -3972,5 +4186,5 @@ declare class PostgresMemory implements Memory {
|
|
|
3972
4186
|
}
|
|
3973
4187
|
declare function createPostgresMemory(options: PostgresMemoryOptions): PostgresMemory;
|
|
3974
4188
|
|
|
3975
|
-
export { ADAPTER_DEFAULTS, AssemblyAiSttProvider, AsyncQueue, BackendUnavailableError, CartesiaTtsProvider, ConversationPolicy, CorruptRecordError, DEFAULT_DURABLE_RUNTIME_POLICY, DTMF_DIGITS, DeepgramSttProvider, DurableError, EVENT_KIND_MAP, ElevenLabsSttProvider, ElevenLabsTtsProvider, InMemoryMemory, InMemorySessionLeaseStore, InMemorySessionStore, InMemoryToolCallStore, InMemoryToolIdempotencyStore, InMemoryTurnStore, InvalidArgumentError, LeaseLostError, LeaseUnavailableError, MemoryBackendUnavailableError, MemoryEntryTooLargeError, MemorySessionQuotaExceededError, NodeMediaPlane, PCM16_16K_MONO, PCM16_8K_MONO, PROVIDER_API_VERSIONS, PROVIDER_CATALOG, PROVIDER_ERROR_CODES, PROVIDER_NAMES, PROVIDER_STABILITY, PipelineVoiceLoop, PipelineVoiceLoopBuilder, RUNTIME_SAMPLE_RATE_HZ, RecordConflictError, RecordNotFoundError, STT_ERROR_CODES, STT_STREAM_ENDED_REASON, SarvamSttProvider, SessionReaper, SessionRecoveryCoordinator, SonioxSttProvider, TELEPHONY_SAMPLE_RATE_HZ, TVIC_ERROR_MARKER, TVIC_ERROR_NAMES, TvicThrowableError, TwilioMediaStreamCallHandle, TwilioMediaStreamsProvider, WEB_CLIENT_AUDIO_CLOSE_CODES, WEB_CLIENT_AUDIO_DEFAULTS, WebClientAudioCallHandle, WebClientAudioProvider, assertMemoryCapability, assertMemoryPolicySupported, assertPcm16leFormat, authError, base64ToBytes, bytesToBase64, cancelledError, canonicalizeTwilioData, computeTwilioSignature, connectionError, counterIdGenerator, createAssemblyAiSttProvider, createAudioNormalizer, createCartesiaTtsProvider, createDeepgramSttProvider, createDefaultIdGenerator, createElevenLabsSttProvider, createElevenLabsTtsProvider, createInMemoryDurableRuntimeStore, createInMemoryMemory, createInMemorySessionStore, createInMemoryToolCallStore, createInMemoryTurnStore, createMediaEvent, createNodeMediaPlane, createOpenAiResponsesLlmProvider, createPostgresDurableRuntimeStore, createPostgresMemory, createPostgresRedisDurableRuntimeStore, createRedisDurableRuntimeStore, createRuntime, createSarvamSttProvider, createSonioxSttProvider, createSttSession, createSystemClock, createToolRegistry, createTwilioMediaStreamsProvider, createVoiceAgent, createWebClientAudioProvider, defineAgent, defineTool, deliverAssistantText, durationMsForPcm16le, evaluateProviderCompatibility, executeTool, formatMemoryContextAsSystemBlock, formatPreCallContextAsSystemBlock, frameCountForPcm16le, getSttRecoveryControl, idempotencyKeyFor, idempotencyRequestHashFor, internalError, interruptedError, isDtmfDigit, isIncrementalTextToSpeechProvider, isInputMediaEvent, isNormalizedError, isOutputMediaEvent, isProviderKind, isReconstructableAudioFormat, isSampleRateHz, isTerminalSession, isTerminalTurn, isTranscriptSegmentEvent, isTvicError, isTvicErrorName, kindForMediaEvent, matchPath, mediaError, monotonicOffsetMs, mulawToPcm16le, normalizeLegacyError, normalizeUnknownError, normalizedError, nowTimestamp, pcm16leToMulaw, providerError, rateLimitError, requireProviderKind, resamplePcm16le, resolvePreCallContext, resolvePreCallMemory, runPostgresMemoryMigrations, runPostgresMigrations, sameAudioFormat, shouldDeliverText, signVoiceSessionToken, signatureError, splitPcm16leFrames, stableStringify, supportsAudioFormat, supportsLanguage, supportsModel, terminalSessionFromRequest, terminalTurnFromRequest, timeoutError, toTimestamp, toolError, toolInputError, tvicErrorFromJSON, unknownErrorMessage, validateJsonSchemaSubset, validationError, verifyTwilioSignature, verifyVoiceSessionToken, withSttReconnect };
|
|
3976
|
-
export type { ActiveSession, ActiveTurn, Agent, AgentAudioPolicy, AgentContextPolicy, AgentId, AgentMemoryPolicy, AgentProviders, AnyMediaEventInit, AssemblyAiProviderConfig, AssemblyAiSttProviderOptions, AssistantTextRecord, AudioFormat, AudioNormalizationMode, AudioNormalizer, AudioNormalizerOptions, AudioPayload, BackoffStrategy, Brand, Call, CallControlCapability, CallDirection, CallHandle, CallId, CallStatus, CancelledSession, CancelledTurn, CartesiaProviderConfig, CartesiaTtsProviderOptions, ChannelKind, ChannelLayout, Clock, CompletedSession, CompletedTurn, ConnectedCall, ConnectionObservabilityEvent, ConversationPolicyOptions, CounterIdGenerator, CreateVoiceAgentOptions, CreatedCall, CreatedSession, DeepgramProviderConfig, DeepgramSttProviderOptions, DefineAgentInput, DefineToolInput, DtmfDigit, DtmfReceivedEvent, DualProtocolResult, DurableErrorCode, DurableOutboxEvent, DurableRuntimeMetric, DurableRuntimePolicy, DurableRuntimeStore, DurableSessionTransaction, ElevenLabsSttCommitStrategy, ElevenLabsSttProviderConfig, ElevenLabsSttProviderOptions, ElevenLabsTtsProviderConfig, ElevenLabsTtsProviderOptions, EndSessionReason, EndSessionRequest, EndTurnRequest, EndedCall, ErrorCategory, ExecuteToolInput, FailedCall, FailedSession, FailedToolCall, FailedToolCallStatus, FailedTurn, HealthCheckResult, HealthSnapshot, IdGenerator, IdempotencyPolicy, InMemoryDurableRuntimeStore, InMemoryDurableRuntimeStoreOptions, InMemoryMemoryOptions, InboundCallContext, InboundMediaEvent, IncrementalTextToSpeechProvider, InputAudioChunk, InputMediaEvent, InternalMediaEvent, InterruptRequestedEvent, InterruptionMode, InterruptionPolicy, JsonSchemaDocument, JsonValue, LLMProvider, LlmCompletion, LlmCompletionRequest, LlmInlineToolCall, LlmMessage, LlmMessageRole, LlmProviderConfig, LlmStreamEvent, LlmUsage, MediaAudioChunkEvent, MediaAudioCommittedEvent, MediaDirection, MediaErrorEvent, MediaEvent, MediaEventId, MediaEventKind, MediaEventType, MediaStreamEndedEvent, MediaStreamStartedEvent, MediaTransport, MediaTransportKind, Memory, MemoryCapabilities, MemoryEntry, MemoryEntryId, MemoryKind, MemoryPutOptions, MemoryQuery, MemoryRef, MemoryScope, NodeMediaPlaneConnection, NodeMediaPlaneConnectionErrorHandler, NodeMediaPlaneConnectionHandler, NodeMediaPlaneOptions, NodeMediaPlaneRequestHandler, NormalizedAudioEncoding, NormalizedError, OpenAiProviderConfig, OpenAiResponsesLlmProviderOptions, OrganizationId, OutboundCallRequest, OutputAudioChunk, OutputMediaEvent, PersonaConfig, PipelineVoiceLoopOptions, PipelineVoiceLoopResult, PostgresDurableStoreOptions, PostgresMemoryOptions, PostgresMigration, PostgresRedisDurableStoreOptions, PreCallContext, PreCallContextResolver, PreCallMemoryContext, PreCallMemoryResolver, Provider, ProviderAudioCapabilities, ProviderCancellationCapabilities, ProviderCapabilities, ProviderCatalogEntry, ProviderCompatibility, ProviderCompatibilityIssue, ProviderCompatibilityIssueCode, ProviderDataPolicy, ProviderEventId, ProviderForKind, ProviderKind, ProviderPlayoutCapabilities, ProviderRequirements, ProviderStability, ProviderStreamingCapabilities, ProviderToolCapabilities, ProviderTransport, QueuedToolCall, RecoveryPollResult, RedisClient, RedisMulti, RedisScanOptions, RedisSetResult, RedisStoreOptions, RequiredProviderCapabilities, RetryPolicy, RingingCall, RunningToolCall, Runtime, RuntimeOptions, RuntimeProvider, RuntimeServiceLifecycle, SampleRateHz, SarvamOutputMode, SarvamProviderConfig, SarvamSttProviderOptions, SchemaValidationResult, Session, SessionAttachment, SessionAttachmentHealth, SessionCancellationReason, SessionEndEvent, SessionEndMemorySnapshot, SessionId, SessionLease, SessionLeaseStore, SessionMemoryFinalization, SessionMetricsRecorder, SessionReaperOptions, SessionRecoveryCoordinatorOptions, SessionRuntimeMetadata, SessionSnapshot, SessionState, SessionStatus, SessionStore, SonioxProviderConfig, SonioxStructuredContext, SonioxSttProviderOptions, SpeechToTextProvider, SqlClient$1 as SqlClient, SqlPool$1 as SqlPool, SqlResult, StartAttachedSessionOptions, StartSessionOptions, StartTurnRequest, StartingSession, StoredSessionRecord, StoredToolCallRecord, StoredTurnRecord, StreamEndReason, SttCommitMode, SttOpenRequest, SttProviderConfig, SttReconnectOptions, SttRecoveryControl, SttRecoveryState, SttSession, SttSessionInputOptions, SttSessionOptions, SttStream, SttTimestampOrigin, SucceededToolCall, TelephonyProvider, TelephonyProviderConfig, TerminalSession, TerminalSessionDraft, TerminalSessionStatus, TerminalToolCall, TerminalTurn, TextDeliveryMode, TextToSpeechProvider, TimeoutAction, TimeoutPolicy, Timestamp, ToolCall, ToolCallId, ToolCallRuntimeMetadata, ToolCallStatus, ToolCallStore, ToolDefinition, ToolExecutionContext, ToolExecutor, ToolId, ToolIdempotencyClaim, ToolIdempotencyClaimResult, ToolIdempotencyLease, ToolIdempotencyOutcome, ToolIdempotencyRecord, ToolIdempotencyStatus, ToolIdempotencyStore, ToolLogger, ToolName, ToolRegistry, ToolTenant, TranscriptEndpointEvent, TranscriptEndpointReason, TranscriptEvent, TranscriptEventType, TranscriptSegmentEvent, TranscriptSegmentEventType, TranscriptSpeechStartedEvent, TransportAudioEncoding, TransportAudioFormat, TtsAlignmentEvent, TtsAlignmentUnit, TtsEvent, TtsFlushAcknowledgement, TtsFlushCompletedEvent, TtsFlushId, TtsFlushResult, TtsProviderConfig, TtsSession, TtsSessionOpenRequest, TtsStream, TtsSynthesisRequest, Turn, TurnCancellationReason, TurnCommitRequestedEvent, TurnDetectionMode, TurnId, TurnInput, TurnLatency, TurnLatencyRecord, TurnOutput, TurnRuntimeMetadata, TurnStatus, TurnStore, TvicErrorName, TwilioFlatParams, TwilioMediaStreamCallHandleOptions, TwilioMediaStreamSocket, TwilioParamValue, TwilioParams, UserId, VerifyTwilioOptions, VerifyVoiceSessionTokenOptions, VoiceAgent, VoiceAgentCallHandleContext, VoiceAgentCallHandleFactory, VoiceAgentModels, VoiceAgentProviderNames, VoiceAgentProviders, VoiceAgentRun, VoiceAgentRunOptions, VoiceAgentSession, VoiceEvent, WebClientAudioCallHandleOptions, WebClientAudioConnectionEvent, WebClientAudioProviderOptions, WebClientAudioSocket, WorkflowId };
|
|
4189
|
+
export { ADAPTER_DEFAULTS, AssemblyAiSttProvider, AsyncQueue, AsyncQueueConsumerError, BackendUnavailableError, CartesiaTtsProvider, ConversationPolicy, CorruptRecordError, DEFAULT_DURABLE_RUNTIME_POLICY, DTMF_DIGITS, DeepgramSttProvider, DurableError, EVENT_KIND_MAP, ElevenLabsSttProvider, ElevenLabsTtsProvider, InMemoryMemory, InMemorySessionLeaseStore, InMemorySessionStore, InMemoryToolCallStore, InMemoryToolIdempotencyStore, InMemoryTurnStore, InvalidArgumentError, LeaseLostError, LeaseUnavailableError, MemoryBackendUnavailableError, MemoryEntryTooLargeError, MemorySessionQuotaExceededError, NodeMediaPlane, PCM16_16K_MONO, PCM16_8K_MONO, PROVIDER_API_VERSIONS, PROVIDER_CATALOG, PROVIDER_ERROR_CODES, PROVIDER_NAMES, PROVIDER_STABILITY, PipelineVoiceLoop, PipelineVoiceLoopBuilder, RUNTIME_SAMPLE_RATE_HZ, RecordConflictError, RecordNotFoundError, STT_ERROR_CODES, STT_STREAM_ENDED_REASON, SarvamSttProvider, SessionReaper, SessionRecoveryCoordinator, SonioxSttProvider, TELEPHONY_SAMPLE_RATE_HZ, TVIC_ERROR_CODES, TVIC_ERROR_CODE_ALIASES, TVIC_ERROR_MARKER, TVIC_ERROR_NAMES, TvicThrowableError, TwilioMediaStreamCallHandle, TwilioMediaStreamsProvider, VoiceRuntimeFinalizationError, WEB_CLIENT_AUDIO_CLOSE_CODES, WEB_CLIENT_AUDIO_DEFAULTS, WebClientAudioCallHandle, WebClientAudioProvider, assertMemoryCapability, assertMemoryPolicySupported, assertPcm16leFormat, authError, base64ToBytes, bytesToBase64, cancelledError, canonicalizeTwilioData, computeTwilioSignature, connectionError, counterIdGenerator, createAssemblyAiSttProvider, createAudioNormalizer, createCartesiaTtsProvider, createDeepgramSttProvider, createDefaultIdGenerator, createElevenLabsSttProvider, createElevenLabsTtsProvider, createGroqChatLlmProvider, createInMemoryDurableRuntimeStore, createInMemoryMemory, createInMemorySessionStore, createInMemoryToolCallStore, createInMemoryTurnStore, createMediaEvent, createNodeMediaPlane, createOpenAiResponsesLlmProvider, createPostgresDurableRuntimeStore, createPostgresMemory, createPostgresRedisDurableRuntimeStore, createRedisDurableRuntimeStore, createRuntime, createSarvamSttProvider, createSonioxSttProvider, createSttSession, createSystemClock, createToolRegistry, createTwilioMediaStreamsProvider, createVoiceAgent, createWebClientAudioProvider, defineAgent, defineTool, deliverAssistantText, durationMsForPcm16le, evaluateProviderCompatibility, executeTool, formatMemoryContextAsSystemBlock, formatPreCallContextAsSystemBlock, frameCountForPcm16le, getSttRecoveryControl, idempotencyKeyFor, idempotencyRequestHashFor, internalError, interruptedError, isDtmfDigit, isIncrementalTextToSpeechProvider, isInputMediaEvent, isNormalizedError, isOutputMediaEvent, isProviderKind, isReconstructableAudioFormat, isSampleRateHz, isTerminalSession, isTerminalTurn, isTranscriptSegmentEvent, isTvicError, isTvicErrorName, kindForMediaEvent, matchPath, mediaError, monotonicOffsetMs, mulawToPcm16le, normalizeLegacyError, normalizeUnknownError, normalizedError, nowTimestamp, pcm16leToMulaw, providerError, rateLimitError, requireProviderKind, resamplePcm16le, resolvePreCallContext, resolvePreCallMemory, runPostgresMemoryMigrations, runPostgresMigrations, sameAudioFormat, shouldDeliverText, signVoiceSessionToken, signatureError, splitPcm16leFrames, stableStringify, supportsAudioFormat, supportsLanguage, supportsModel, terminalSessionFromRequest, terminalSourceForRequest, terminalTurnFromRequest, timeoutError, toTimestamp, toolError, toolInputError, tvicErrorFromJSON, unknownErrorMessage, validateJsonSchemaSubset, validationError, verifyTwilioSignature, verifyVoiceSessionToken, withSttReconnect };
|
|
4190
|
+
export type { ActiveSession, ActiveTurn, Agent, AgentAudioPolicy, AgentContextPolicy, AgentId, AgentMemoryPolicy, AgentProviders, AnyMediaEventInit, AssemblyAiProviderConfig, AssemblyAiSttProviderOptions, AssistantTextRecord, AudioFormat, AudioNormalizationMode, AudioNormalizer, AudioNormalizerOptions, AudioPayload, BackoffStrategy, Brand, Call, CallControlCapability, CallDirection, CallHandle, CallId, CallSnapshot, CallStatus, CancelledSession, CancelledTurn, CartesiaProviderConfig, CartesiaTtsProviderOptions, ChannelKind, ChannelLayout, CleanupErrorSummary, CleanupStage, Clock, CompletedSession, CompletedTurn, ConnectedCall, ConnectionObservabilityEvent, ConversationPolicyOptions, CounterIdGenerator, CreateVoiceAgentOptions, CreatedCall, CreatedSession, DeepgramProviderConfig, DeepgramSttProviderOptions, DefineAgentInput, DefineToolInput, DtmfDigit, DtmfReceivedEvent, DualProtocolResult, DurableErrorCode, DurableOutboxEvent, DurableRuntimeMetric, DurableRuntimePolicy, DurableRuntimeStore, DurableSessionTransaction, ElevenLabsSttCommitStrategy, ElevenLabsSttProviderConfig, ElevenLabsSttProviderOptions, ElevenLabsTtsProviderConfig, ElevenLabsTtsProviderOptions, EndSessionReason, EndSessionRequest, EndTurnRequest, EndedCall, ErrorCategory, ExecuteToolInput, FailedCall, FailedSession, FailedToolCall, FailedToolCallStatus, FailedTurn, GroqChatLlmProviderOptions, GroqProviderConfig, HealthCheckResult, HealthSnapshot, IdGenerator, IdempotencyPolicy, InMemoryDurableRuntimeStore, InMemoryDurableRuntimeStoreOptions, InMemoryMemoryOptions, InboundCallContext, InboundMediaEvent, IncrementalTextToSpeechProvider, InputAudioChunk, InputMediaEvent, InternalMediaEvent, InterruptRequestedEvent, InterruptionMode, InterruptionPolicy, JsonSchemaDocument, JsonValue, LLMProvider, LiveTerminalSource, LlmCompletion, LlmCompletionRequest, LlmInlineToolCall, LlmMessage, LlmMessageRole, LlmProviderConfig, LlmStreamEvent, LlmUsage, MediaAudioChunkEvent, MediaAudioCommittedEvent, MediaDirection, MediaErrorEvent, MediaEvent, MediaEventId, MediaEventKind, MediaEventType, MediaStreamEndedEvent, MediaStreamStartedEvent, MediaTransport, MediaTransportKind, Memory, MemoryCapabilities, MemoryEntry, MemoryEntryId, MemoryKind, MemoryPutOptions, MemoryQuery, MemoryRef, MemoryScope, NodeMediaPlaneConnection, NodeMediaPlaneConnectionErrorHandler, NodeMediaPlaneConnectionHandler, NodeMediaPlaneOptions, NodeMediaPlaneRequestHandler, NormalizedAudioEncoding, NormalizedError, OpenAiProviderConfig, OpenAiResponsesLlmProviderOptions, OrganizationId, OutboundCallRequest, OutputAudioChunk, OutputMediaEvent, PersonaConfig, PipelineVoiceLoopOptions, PipelineVoiceLoopResult, PostgresDurableStoreOptions, PostgresMemoryOptions, PostgresMigration, PostgresRedisDurableStoreOptions, PreCallContext, PreCallContextResolver, PreCallMemoryContext, PreCallMemoryResolver, Provider, ProviderAudioCapabilities, ProviderCancellationCapabilities, ProviderCapabilities, ProviderCatalogEntry, ProviderCompatibility, ProviderCompatibilityIssue, ProviderCompatibilityIssueCode, ProviderDataPolicy, ProviderEventId, ProviderForKind, ProviderKind, ProviderPlayoutCapabilities, ProviderRequirements, ProviderStability, ProviderStreamingCapabilities, ProviderToolCapabilities, ProviderTransport, QueuedToolCall, RecoveryPollResult, RedisClient, RedisMulti, RedisScanOptions, RedisSetResult, RedisStoreOptions, RequiredProviderCapabilities, RetryPolicy, RingingCall, RunningToolCall, Runtime, RuntimeOptions, RuntimeProvider, RuntimeServiceLifecycle, SampleRateHz, SarvamOutputMode, SarvamProviderConfig, SarvamSttProviderOptions, SchemaValidationResult, Session, SessionAttachment, SessionAttachmentHealth, SessionCancellationReason, SessionEndEvent, SessionEndMemorySnapshot, SessionId, SessionLease, SessionLeaseStore, SessionMemoryFinalization, SessionMetricsRecorder, SessionReaperOptions, SessionRecoveryCoordinatorOptions, SessionRuntimeMetadata, SessionSnapshot, SessionState, SessionStatus, SessionStore, SonioxProviderConfig, SonioxStructuredContext, SonioxSttProviderOptions, SpeechToTextProvider, SqlClient$1 as SqlClient, SqlPool$1 as SqlPool, SqlResult, StartAttachedSessionOptions, StartSessionOptions, StartTurnRequest, StartingSession, StoredSessionRecord, StoredToolCallRecord, StoredTurnRecord, StreamEndReason, SttCommitMode, SttOpenRequest, SttProviderConfig, SttReconnectOptions, SttRecoveryControl, SttRecoveryState, SttSession, SttSessionInputOptions, SttSessionOptions, SttStream, SttTimestampOrigin, SucceededToolCall, TelephonyProvider, TelephonyProviderConfig, TerminalSession, TerminalSessionDraft, TerminalSessionStatus, TerminalSource, TerminalToolCall, TerminalTurn, TextDeliveryMode, TextToSpeechProvider, TimeoutAction, TimeoutPolicy, Timestamp, ToolCall, ToolCallId, ToolCallRuntimeMetadata, ToolCallStatus, ToolCallStore, ToolDefinition, ToolExecutionContext, ToolExecutor, ToolId, ToolIdempotencyClaim, ToolIdempotencyClaimResult, ToolIdempotencyLease, ToolIdempotencyOutcome, ToolIdempotencyRecord, ToolIdempotencyStatus, ToolIdempotencyStore, ToolLogger, ToolName, ToolRegistry, ToolTenant, TranscriptEndpointEvent, TranscriptEndpointReason, TranscriptEvent, TranscriptEventType, TranscriptSegmentEvent, TranscriptSegmentEventType, TranscriptSpeechStartedEvent, TransportAudioEncoding, TransportAudioFormat, TtsAlignmentEvent, TtsAlignmentUnit, TtsEvent, TtsFlushAcknowledgement, TtsFlushCompletedEvent, TtsFlushId, TtsFlushResult, TtsProviderConfig, TtsSession, TtsSessionOpenRequest, TtsStream, TtsSynthesisRequest, Turn, TurnCancellationReason, TurnCommitRequestedEvent, TurnDetectionMode, TurnId, TurnInput, TurnLatency, TurnLatencyRecord, TurnOutput, TurnRuntimeMetadata, TurnStatus, TurnStore, TvicErrorName, TwilioFlatParams, TwilioMediaStreamCallHandleOptions, TwilioMediaStreamSocket, TwilioParamValue, TwilioParams, UpgradeAuthorization, UserId, VerifyTwilioOptions, VerifyVoiceSessionTokenOptions, VoiceAgent, VoiceAgentCallHandleContext, VoiceAgentCallHandleFactory, VoiceAgentModels, VoiceAgentProviderNames, VoiceAgentProviders, VoiceAgentRun, VoiceAgentRunOptions, VoiceAgentSession, VoiceEvent, VoiceRuntimeFailureMetadata, WebClientAudioCallHandleOptions, WebClientAudioConnectionEvent, WebClientAudioProviderOptions, WebClientAudioSocket, WorkflowId };
|