@fabric-harness/sdk 6.3.0 → 6.5.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/connector-spec/voice-telephony.md +120 -104
- package/dist/agent-route.d.ts +22 -2
- package/dist/agent-route.d.ts.map +1 -1
- package/dist/agent-route.js +32 -1
- package/dist/agent-route.js.map +1 -1
- package/dist/agent-router.d.ts +46 -0
- package/dist/agent-router.d.ts.map +1 -1
- package/dist/agent-router.js +63 -2
- package/dist/agent-router.js.map +1 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +3 -0
- package/dist/agent.js.map +1 -1
- package/dist/attachment-store.d.ts +69 -0
- package/dist/attachment-store.d.ts.map +1 -1
- package/dist/attachment-store.js +183 -14
- package/dist/attachment-store.js.map +1 -1
- package/dist/attachments.d.ts +136 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/attachments.js +332 -0
- package/dist/attachments.js.map +1 -0
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +26 -3
- package/dist/channel.js.map +1 -1
- package/dist/conversation-history.d.ts +186 -0
- package/dist/conversation-history.d.ts.map +1 -0
- package/dist/conversation-history.js +481 -0
- package/dist/conversation-history.js.map +1 -0
- package/dist/conversation-ui.d.ts +43 -2
- package/dist/conversation-ui.d.ts.map +1 -1
- package/dist/conversation-ui.js +44 -14
- package/dist/conversation-ui.js.map +1 -1
- package/dist/cost-budget.d.ts +50 -0
- package/dist/cost-budget.d.ts.map +1 -1
- package/dist/cost-budget.js +74 -4
- package/dist/cost-budget.js.map +1 -1
- package/dist/cost-enforcement.d.ts +32 -0
- package/dist/cost-enforcement.d.ts.map +1 -0
- package/dist/cost-enforcement.js +116 -0
- package/dist/cost-enforcement.js.map +1 -0
- package/dist/delivered-message.d.ts +20 -6
- package/dist/delivered-message.d.ts.map +1 -1
- package/dist/delivered-message.js +37 -8
- package/dist/delivered-message.js.map +1 -1
- package/dist/events.d.ts +16 -2
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/experimental.d.ts +2 -2
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +1 -1
- package/dist/experimental.js.map +1 -1
- package/dist/governed-voice.d.ts +6 -0
- package/dist/governed-voice.d.ts.map +1 -1
- package/dist/governed-voice.js +142 -35
- package/dist/governed-voice.js.map +1 -1
- package/dist/history.d.ts +3 -2
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +57 -23
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts +21 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/loop.d.ts +25 -2
- package/dist/loop.d.ts.map +1 -1
- package/dist/loop.js +409 -60
- package/dist/loop.js.map +1 -1
- package/dist/model-pricing.d.ts +77 -4
- package/dist/model-pricing.d.ts.map +1 -1
- package/dist/model-pricing.js +259 -18
- package/dist/model-pricing.js.map +1 -1
- package/dist/model.d.ts +115 -3
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +376 -57
- package/dist/model.js.map +1 -1
- package/dist/otel-observer.d.ts +3 -1
- package/dist/otel-observer.d.ts.map +1 -1
- package/dist/otel-observer.js +40 -8
- package/dist/otel-observer.js.map +1 -1
- package/dist/persistent-agent.d.ts +5 -0
- package/dist/persistent-agent.d.ts.map +1 -1
- package/dist/persistent-agent.js +9 -1
- package/dist/persistent-agent.js.map +1 -1
- package/dist/pi-document-attachments.d.ts +43 -0
- package/dist/pi-document-attachments.d.ts.map +1 -0
- package/dist/pi-document-attachments.js +155 -0
- package/dist/pi-document-attachments.js.map +1 -0
- package/dist/pi-loop-runtime.d.ts +103 -1
- package/dist/pi-loop-runtime.d.ts.map +1 -1
- package/dist/pi-loop-runtime.js +850 -109
- package/dist/pi-loop-runtime.js.map +1 -1
- package/dist/prompt-attachments.d.ts +98 -0
- package/dist/prompt-attachments.d.ts.map +1 -0
- package/dist/prompt-attachments.js +279 -0
- package/dist/prompt-attachments.js.map +1 -0
- package/dist/session.d.ts +52 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +410 -33
- package/dist/session.js.map +1 -1
- package/dist/stream-chunks.d.ts +15 -1
- package/dist/stream-chunks.d.ts.map +1 -1
- package/dist/stream-chunks.js +39 -18
- package/dist/stream-chunks.js.map +1 -1
- package/dist/strict.d.ts +23 -16
- package/dist/strict.d.ts.map +1 -1
- package/dist/strict.js +12 -8
- package/dist/strict.js.map +1 -1
- package/dist/submission-context.d.ts +7 -0
- package/dist/submission-context.d.ts.map +1 -1
- package/dist/submission-context.js.map +1 -1
- package/dist/submission-runner.d.ts +5 -0
- package/dist/submission-runner.d.ts.map +1 -1
- package/dist/submission-runner.js +97 -13
- package/dist/submission-runner.js.map +1 -1
- package/dist/submission-store-contract.d.ts.map +1 -1
- package/dist/submission-store-contract.js +15 -1
- package/dist/submission-store-contract.js.map +1 -1
- package/dist/submission-store.d.ts +12 -0
- package/dist/submission-store.d.ts.map +1 -1
- package/dist/submission-store.js +13 -4
- package/dist/submission-store.js.map +1 -1
- package/dist/trace-content.d.ts +21 -0
- package/dist/trace-content.d.ts.map +1 -0
- package/dist/trace-content.js +69 -0
- package/dist/trace-content.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/usage-completeness.d.ts +39 -0
- package/dist/usage-completeness.d.ts.map +1 -0
- package/dist/usage-completeness.js +135 -0
- package/dist/usage-completeness.js.map +1 -0
- package/dist/voice-openai-realtime.d.ts +24 -2
- package/dist/voice-openai-realtime.d.ts.map +1 -1
- package/dist/voice-openai-realtime.js +266 -49
- package/dist/voice-openai-realtime.js.map +1 -1
- package/dist/voice-pipeline.d.ts +81 -3
- package/dist/voice-pipeline.d.ts.map +1 -1
- package/dist/voice-pipeline.js +429 -60
- package/dist/voice-pipeline.js.map +1 -1
- package/dist/voice-stt-cartesia.d.ts +8 -0
- package/dist/voice-stt-cartesia.d.ts.map +1 -1
- package/dist/voice-stt-cartesia.js +77 -17
- package/dist/voice-stt-cartesia.js.map +1 -1
- package/dist/voice-stt-deepgram.d.ts +10 -2
- package/dist/voice-stt-deepgram.d.ts.map +1 -1
- package/dist/voice-stt-deepgram.js +78 -18
- package/dist/voice-stt-deepgram.js.map +1 -1
- package/dist/voice-stt.d.ts +13 -3
- package/dist/voice-stt.d.ts.map +1 -1
- package/dist/voice-tts-cartesia.d.ts +8 -0
- package/dist/voice-tts-cartesia.d.ts.map +1 -1
- package/dist/voice-tts-cartesia.js +48 -105
- package/dist/voice-tts-cartesia.js.map +1 -1
- package/dist/voice-tts-elevenlabs.d.ts +10 -1
- package/dist/voice-tts-elevenlabs.d.ts.map +1 -1
- package/dist/voice-tts-elevenlabs.js +50 -113
- package/dist/voice-tts-elevenlabs.js.map +1 -1
- package/dist/voice-ws-client.js +16 -3
- package/dist/voice-ws-client.js.map +1 -1
- package/dist/voice-ws-shared.d.ts +205 -6
- package/dist/voice-ws-shared.d.ts.map +1 -1
- package/dist/voice-ws-shared.js +510 -15
- package/dist/voice-ws-shared.js.map +1 -1
- package/dist/voice.d.ts +98 -4
- package/dist/voice.d.ts.map +1 -1
- package/dist/voice.js +71 -1
- package/dist/voice.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Server-side voice transport.
|
|
3
|
-
*
|
|
2
|
+
* Server-side voice transport. Built-in voice providers open their provider
|
|
3
|
+
* socket through a {@link VoiceSocketFactory}. The default factory loads the
|
|
4
|
+
* optional Node `ws` peer lazily (it supports authorization headers, unlike
|
|
5
|
+
* the WHATWG `WebSocket` constructor); runtimes without `ws` — Cloudflare
|
|
6
|
+
* Workers and Durable Objects, for example — inject their own factory through
|
|
7
|
+
* the provider's `socketFactory` option.
|
|
4
8
|
*/
|
|
9
|
+
/** Minimal, runtime-neutral view of a connected provider socket. */
|
|
5
10
|
export interface VoiceWebSocket {
|
|
6
11
|
send(data: string | ArrayBuffer | Uint8Array): void;
|
|
7
12
|
close(code?: number, reason?: string): void;
|
|
@@ -12,16 +17,210 @@ export interface VoiceWebSocket {
|
|
|
12
17
|
addEventListener(type: 'close', listener: (ev: unknown) => void): void;
|
|
13
18
|
addEventListener(type: 'open', listener: (ev: unknown) => void): void;
|
|
14
19
|
readyState: number;
|
|
20
|
+
/**
|
|
21
|
+
* Bytes queued by `send()` but not yet written to the network, when the
|
|
22
|
+
* runtime exposes it (Node `ws` does). Providers use it to apply outbound
|
|
23
|
+
* backpressure; when absent they fall back to an application-level bound.
|
|
24
|
+
*/
|
|
25
|
+
readonly bufferedAmount?: number | undefined;
|
|
15
26
|
}
|
|
27
|
+
/** Options the provider passes to {@link VoiceSocketFactory.connect}. */
|
|
28
|
+
export interface VoiceSocketConnectOptions {
|
|
29
|
+
/** Handshake headers, including provider credentials. Factories must never log or echo them. */
|
|
30
|
+
headers: Record<string, string>;
|
|
31
|
+
/** Optional WebSocket subprotocols. */
|
|
32
|
+
protocols?: string[];
|
|
33
|
+
/** Cancels the handshake. Factories reject with `VOICE_CONNECT_ABORTED`. */
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
/** Bound on the opening handshake. Factories reject with `VOICE_CONNECT_TIMEOUT`. */
|
|
36
|
+
handshakeTimeoutMs: number;
|
|
37
|
+
/** Largest inbound message the factory delivers; larger messages close the socket. */
|
|
38
|
+
maxPayloadBytes: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Opens provider WebSockets. Implementations must resolve only with an open
|
|
42
|
+
* socket, and must reject with a {@link VoiceConnectionError} that never
|
|
43
|
+
* retains the URL, headers or provider response body.
|
|
44
|
+
*/
|
|
45
|
+
export interface VoiceSocketFactory {
|
|
46
|
+
readonly name?: string;
|
|
47
|
+
connect(url: string, options: VoiceSocketConnectOptions): Promise<VoiceWebSocket>;
|
|
48
|
+
}
|
|
49
|
+
export declare const DEFAULT_VOICE_HANDSHAKE_TIMEOUT_MS = 15000;
|
|
50
|
+
export declare const DEFAULT_VOICE_MAX_PAYLOAD_BYTES = 1048576;
|
|
51
|
+
/** Fixed message for a refused plaintext provider URL; never includes the URL. */
|
|
52
|
+
export declare const INSECURE_VOICE_TRANSPORT_MESSAGE = "Voice provider sockets require wss://; pass allowInsecureTransport: true to the socket factory for local development only";
|
|
16
53
|
/** Sanitized server-side connection classification; never retains provider headers or URLs. */
|
|
17
54
|
export declare class VoiceConnectionError extends Error {
|
|
18
|
-
readonly code: 'VOICE_CONNECT_ABORTED' | 'VOICE_CONNECT_TIMEOUT' | 'VOICE_CONNECT_REJECTED' | 'VOICE_CONNECT_FAILED' | 'VOICE_CONNECT_CLOSED';
|
|
55
|
+
readonly code: 'VOICE_CONNECT_ABORTED' | 'VOICE_CONNECT_TIMEOUT' | 'VOICE_CONNECT_REJECTED' | 'VOICE_CONNECT_FAILED' | 'VOICE_CONNECT_CLOSED' | 'VOICE_INSECURE_TRANSPORT' | 'VOICE_WS_PEER_MISSING';
|
|
19
56
|
readonly status?: number | undefined;
|
|
20
57
|
readonly retryable: boolean;
|
|
21
|
-
constructor(code: 'VOICE_CONNECT_ABORTED' | 'VOICE_CONNECT_TIMEOUT' | 'VOICE_CONNECT_REJECTED' | 'VOICE_CONNECT_FAILED' | 'VOICE_CONNECT_CLOSED', status?: number | undefined);
|
|
58
|
+
constructor(code: 'VOICE_CONNECT_ABORTED' | 'VOICE_CONNECT_TIMEOUT' | 'VOICE_CONNECT_REJECTED' | 'VOICE_CONNECT_FAILED' | 'VOICE_CONNECT_CLOSED' | 'VOICE_INSECURE_TRANSPORT' | 'VOICE_WS_PEER_MISSING', status?: number | undefined);
|
|
22
59
|
}
|
|
23
|
-
|
|
60
|
+
/** Options for {@link createNodeVoiceSocketFactory}. */
|
|
61
|
+
export interface VoiceSocketFactoryOptions {
|
|
62
|
+
/**
|
|
63
|
+
* Permit plaintext `ws://` provider connections. Provider handshakes carry
|
|
64
|
+
* API keys, so factories refuse anything but `wss://` by default. Set this
|
|
65
|
+
* only for a local test server on a trusted host; never in production.
|
|
66
|
+
*/
|
|
67
|
+
allowInsecureTransport?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Default Node factory backed by the optional `ws` peer. The peer is imported
|
|
71
|
+
* only when a connection is opened, so loading the SDK never requires it.
|
|
72
|
+
* Only `wss://` URLs are accepted unless `allowInsecureTransport` is set.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createNodeVoiceSocketFactory(factoryOptions?: VoiceSocketFactoryOptions): VoiceSocketFactory;
|
|
75
|
+
/** Opens a provider socket through `factory`, defaulting to the Node `ws` factory. */
|
|
76
|
+
export declare function openVoiceWs(url: string, headers: Record<string, string>, signal?: AbortSignal, factory?: VoiceSocketFactory): Promise<VoiceWebSocket>;
|
|
24
77
|
export declare function toError(value: unknown, fallback: string): Error;
|
|
78
|
+
/**
|
|
79
|
+
* Decode a text frame from any supported socket implementation: WHATWG and
|
|
80
|
+
* Workers deliver strings, `ws` may deliver Buffers (Uint8Array) or fragment
|
|
81
|
+
* arrays, and binary frames may arrive as ArrayBuffer. Returns undefined for
|
|
82
|
+
* payloads that cannot be decoded synchronously.
|
|
83
|
+
*/
|
|
84
|
+
export declare function decodeVoiceMessageText(data: unknown): string | undefined;
|
|
25
85
|
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
26
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Decode provider base64 audio. Returns `undefined` for malformed input
|
|
88
|
+
* instead of throwing: it runs inside socket listeners, where a throw would
|
|
89
|
+
* escape every error boundary.
|
|
90
|
+
*/
|
|
91
|
+
export declare function base64ToBytes(value: string): Uint8Array | undefined;
|
|
92
|
+
/** Fixed, sanitized message for malformed provider frames. */
|
|
93
|
+
export declare const VOICE_PROTOCOL_ERROR_MESSAGE = "Voice provider protocol error";
|
|
94
|
+
/**
|
|
95
|
+
* Bounds on audio a streaming TTS synthesis buffers ahead of its consumer.
|
|
96
|
+
* Providers synthesize faster than real time, so a stalled consumer would
|
|
97
|
+
* otherwise grow the buffer without limit. 16 MiB is minutes of pcm16 audio;
|
|
98
|
+
* the chunk cap bounds per-entry overhead from many tiny frames. Overflow
|
|
99
|
+
* fails the synthesis with {@link VOICE_PROTOCOL_ERROR_MESSAGE} and closes the socket.
|
|
100
|
+
*/
|
|
101
|
+
export declare const VOICE_TTS_MAX_BUFFERED_BYTES: number;
|
|
102
|
+
export declare const VOICE_TTS_MAX_BUFFERED_CHUNKS = 4096;
|
|
103
|
+
/** Callbacks a streaming TTS provider uses to feed {@link createVoiceTtsStream}. @internal */
|
|
104
|
+
interface VoiceTtsStreamControl {
|
|
105
|
+
/** Deliver one decoded audio frame. */
|
|
106
|
+
audio(chunk: Uint8Array): void;
|
|
107
|
+
/** The provider finished the utterance. */
|
|
108
|
+
done(): void;
|
|
109
|
+
/** The provider reported an error; surfaced after buffered audio drains. */
|
|
110
|
+
fail(message: string): void;
|
|
111
|
+
/** The provider sent a malformed frame. */
|
|
112
|
+
protocolError(): void;
|
|
113
|
+
}
|
|
114
|
+
/** @internal */
|
|
115
|
+
export interface VoiceTtsStreamOptions {
|
|
116
|
+
/** Provider label used in error messages, e.g. `ElevenLabs`. */
|
|
117
|
+
label: string;
|
|
118
|
+
/** Consumer-supplied cancellation for the synthesis. */
|
|
119
|
+
signal?: AbortSignal | undefined;
|
|
120
|
+
/** Open the provider socket; `signal` aborts the handshake. */
|
|
121
|
+
open(signal: AbortSignal): Promise<VoiceWebSocket>;
|
|
122
|
+
/** Send the synthesis request on the freshly opened socket. */
|
|
123
|
+
start(ws: VoiceWebSocket): void;
|
|
124
|
+
/** Handle one decoded JSON frame from the provider. */
|
|
125
|
+
onFrame(payload: Record<string, unknown>, control: VoiceTtsStreamControl): void;
|
|
126
|
+
/** Called once when the synthesis settles (completed, failed or terminated), with the audio bytes received. */
|
|
127
|
+
onSettled(audioBytes: number): void;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Hand-written async iterator for a WebSocket TTS synthesis. Unlike an async
|
|
131
|
+
* generator, whose `return()` queues behind a `next()` suspended on provider
|
|
132
|
+
* audio, `return()` here settles immediately: it aborts a pending handshake,
|
|
133
|
+
* closes the socket, drops buffered audio, detaches the abort listener and
|
|
134
|
+
* resolves every pending `next()` with `done: true`, even while the provider
|
|
135
|
+
* is stalled. A consumer abort (`signal`) likewise yields nothing further.
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
export declare function createVoiceTtsStream(options: VoiceTtsStreamOptions): AsyncIterableIterator<Uint8Array>;
|
|
139
|
+
/**
|
|
140
|
+
* Outbound audio could not be delivered to the provider fast enough: the
|
|
141
|
+
* provider socket stayed above its buffer bound, or the caller sent audio far
|
|
142
|
+
* faster than real time. The session is closed; the message never includes
|
|
143
|
+
* audio, URLs or credentials.
|
|
144
|
+
*/
|
|
145
|
+
export declare class VoiceBackpressureError extends Error {
|
|
146
|
+
readonly code: "VOICE_BACKPRESSURE";
|
|
147
|
+
readonly retryable = false;
|
|
148
|
+
constructor();
|
|
149
|
+
}
|
|
150
|
+
export interface VoiceOutboundGateOptions {
|
|
151
|
+
/** Real-time audio rate of the session, bytes per millisecond. */
|
|
152
|
+
bytesPerMs: number;
|
|
153
|
+
/** Largest `bufferedAmount` tolerated before sends wait. Default 512 KiB. */
|
|
154
|
+
maxBufferedBytes?: number;
|
|
155
|
+
/** Longest a send waits for capacity, measured from the call to `admit()`. Default 2 s. */
|
|
156
|
+
maxWaitMs?: number;
|
|
157
|
+
/** Multiple of real time the application-level bound admits. Default 4. */
|
|
158
|
+
rateMultiplier?: number;
|
|
159
|
+
/** Audio the application-level bound admits in a burst. Default 10 s of audio. */
|
|
160
|
+
burstMs?: number;
|
|
161
|
+
/** Most sends allowed to wait at once; further sends reject immediately. Default 256. */
|
|
162
|
+
maxPendingFrames?: number;
|
|
163
|
+
/** Most bytes allowed to wait at once; further sends reject immediately. Default one burst (`burstMs` of audio). */
|
|
164
|
+
maxPendingBytes?: number;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Bounds provider-socket outbound audio. Where the socket reports
|
|
168
|
+
* `bufferedAmount` (Node `ws`), a send waits until the buffer drains below
|
|
169
|
+
* `maxBufferedBytes`. On every runtime, including Workers sockets that expose
|
|
170
|
+
* no buffer size, a token bucket admits at most `rateMultiplier`× real time
|
|
171
|
+
* plus a `burstMs` burst, so a flood cannot queue unbounded audio. Waiting
|
|
172
|
+
* sends are admitted in call order and bounded by `maxPendingFrames` and
|
|
173
|
+
* `maxPendingBytes`: a send beyond either bound rejects at once with
|
|
174
|
+
* {@link VoiceBackpressureError}, and a queued send that is not admitted
|
|
175
|
+
* within `maxWaitMs` of its call rejects the same way.
|
|
176
|
+
*/
|
|
177
|
+
export declare class VoiceOutboundGate {
|
|
178
|
+
private readonly ws;
|
|
179
|
+
private readonly maxBufferedBytes;
|
|
180
|
+
private readonly maxWaitMs;
|
|
181
|
+
private readonly refillPerMs;
|
|
182
|
+
private readonly capacity;
|
|
183
|
+
private readonly maxPendingFrames;
|
|
184
|
+
private readonly maxPendingBytes;
|
|
185
|
+
private tokens;
|
|
186
|
+
private refilledAt;
|
|
187
|
+
private readonly queue;
|
|
188
|
+
private pendingBytes;
|
|
189
|
+
private pumping;
|
|
190
|
+
constructor(ws: VoiceWebSocket, options: VoiceOutboundGateOptions);
|
|
191
|
+
/** Sends currently waiting for capacity. */
|
|
192
|
+
get pending(): number;
|
|
193
|
+
/**
|
|
194
|
+
* Admit `bytes` synchronously when nothing is queued ahead and capacity is
|
|
195
|
+
* available now. Returns false when the caller must use {@link admit}.
|
|
196
|
+
*/
|
|
197
|
+
tryAdmit(bytes: number): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Wait for capacity to send `bytes`, in call order. Rejects with
|
|
200
|
+
* {@link VoiceBackpressureError} at once when the wait queue is full, and
|
|
201
|
+
* when capacity does not free up within `maxWaitMs` of this call.
|
|
202
|
+
*/
|
|
203
|
+
admit(bytes: number, isClosed: () => boolean): Promise<void>;
|
|
204
|
+
private settleHead;
|
|
205
|
+
private pump;
|
|
206
|
+
private refill;
|
|
207
|
+
private bufferFull;
|
|
208
|
+
}
|
|
209
|
+
/** Real-time byte rate for a voice codec at a sample rate (mono). */
|
|
210
|
+
export declare function voiceBytesPerMs(format: string | undefined, sampleRate: number): number;
|
|
211
|
+
/**
|
|
212
|
+
* Resolve a provider's audio format and sample rate, failing closed instead
|
|
213
|
+
* of substituting another format: audio decoded at a rate other than the one
|
|
214
|
+
* it was produced at plays at the wrong speed. G.711 is 8 kHz only; PCM rates
|
|
215
|
+
* must be in `pcmRates` when the provider publishes a fixed set, else any
|
|
216
|
+
* positive integer. Throws before any provider socket is opened.
|
|
217
|
+
*/
|
|
218
|
+
export declare function resolveVoiceAudio(label: string, format: unknown, sampleRate: number | undefined, pcm: {
|
|
219
|
+
defaultRate: number;
|
|
220
|
+
rates?: readonly number[];
|
|
221
|
+
}): {
|
|
222
|
+
format: 'pcm16' | 'g711_ulaw' | 'g711_alaw';
|
|
223
|
+
sampleRate: number;
|
|
224
|
+
};
|
|
225
|
+
export {};
|
|
27
226
|
//# sourceMappingURL=voice-ws-shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-ws-shared.d.ts","sourceRoot":"","sources":["../src/voice-ws-shared.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"voice-ws-shared.d.ts","sourceRoot":"","sources":["../src/voice-ws-shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IACpD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,OAAO,CA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