voice-runtime 1.1.0 → 2.0.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 +58 -17
- package/dist/index.cjs +18833 -5468
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1237 -937
- package/dist/index.js +18799 -5467
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,16 +10,23 @@ voice agents with bring-your-own telephony, speech, model, and synthesis provide
|
|
|
10
10
|
|
|
11
11
|
New to the package? Start with the [beginner's guide](https://github.com/Kkartik14/TVIC/blob/main/docs/getting-started.md).
|
|
12
12
|
Use the [voice-agent guide](https://github.com/Kkartik14/TVIC/blob/main/docs/building-a-voice-agent.md)
|
|
13
|
-
for application design, [
|
|
14
|
-
for
|
|
15
|
-
for browser and phone connections.
|
|
13
|
+
for application design, the [TVIC provider overview](https://github.com/Kkartik14/TVIC/blob/main/README.md#providers)
|
|
14
|
+
for supported adapters, and [transports](https://github.com/Kkartik14/TVIC/blob/main/docs/transports.md)
|
|
15
|
+
for browser and phone connections. Sarvam API details are in its
|
|
16
|
+
[official TTS documentation](https://docs.sarvam.ai/api/api-guides-tutorials/text-to-speech/overview).
|
|
16
17
|
|
|
17
18
|
## Status
|
|
18
19
|
|
|
19
|
-
`
|
|
20
|
+
The `2.0.0` release follows published `1.2.0` and changes the public
|
|
21
|
+
durable-store contracts. If you maintain custom durable-store or
|
|
22
|
+
idempotency-store adapters, read the [2.0.0 migration guide](https://github.com/Kkartik14/TVIC/blob/main/docs/migrations/2.0.0.md)
|
|
23
|
+
before upgrading.
|
|
24
|
+
|
|
25
|
+
`voice-runtime@2.0.0` is the public Node.js entry point for the TVIC runtime. It
|
|
20
26
|
supports Node.js 22, 24, and 26, ships both ESM and CommonJS entry points, and is
|
|
21
27
|
server-side only. The main CI compatibility matrix exercises all three supported
|
|
22
|
-
lines.
|
|
28
|
+
lines. Check the installed package version before using APIs documented for a
|
|
29
|
+
newer source checkout.
|
|
23
30
|
|
|
24
31
|
Browser audio connects to a Node server through the browser-audio transport
|
|
25
32
|
adapter. Browser code does not import this package directly.
|
|
@@ -68,7 +75,7 @@ audio endpoint or a phone call for your application.
|
|
|
68
75
|
import { createVoiceAgent } from "voice-runtime";
|
|
69
76
|
|
|
70
77
|
const agent = createVoiceAgent({
|
|
71
|
-
prompt: "You schedule appointments for
|
|
78
|
+
prompt: "You schedule appointments for a doctor Be concise and confirm the time.",
|
|
72
79
|
providers: {
|
|
73
80
|
telephony: { provider: "web-client-audio" },
|
|
74
81
|
stt: { provider: "deepgram", apiKey: process.env.DEEPGRAM_API_KEY },
|
|
@@ -132,8 +139,35 @@ its ID must match the returned handle's `callId`. Replace the provider and
|
|
|
132
139
|
audio. A preconstructed custom `CallHandle` is also supported when the adapter
|
|
133
140
|
already knows how to correlate its events to the managed session.
|
|
134
141
|
|
|
142
|
+
## Managed session lifecycle
|
|
143
|
+
|
|
144
|
+
`agent.start()` returns `complete()`, `stop()`, and `finalSession` alongside
|
|
145
|
+
`sessionId` and `run`. Call `session.complete()` when the caller or host has
|
|
146
|
+
finished sending input. It asks the `CallHandle.endInput()` transport hook to
|
|
147
|
+
half-close input, then resolves with the persisted terminal session. The call
|
|
148
|
+
handle must implement `endInput()` for graceful completion. Call
|
|
149
|
+
`session.stop()` to cancel only that session; cancellation remains distinct
|
|
150
|
+
from normal completion and remote hangup. `finalSession` resolves to the
|
|
151
|
+
persisted terminal result after runtime finalization and transport cleanup.
|
|
152
|
+
Per-session and agent shutdown use a bounded drain. If cleanup exceeds the
|
|
153
|
+
deadline, `stop()` and `finalSession` reject with
|
|
154
|
+
`voice_runtime.shutdown_failed` and `lateCleanupPending`; cleanup can continue
|
|
155
|
+
in the background, so keep its dependencies open while it remains active.
|
|
156
|
+
Start `session.run`—typically by beginning to consume its event stream—before
|
|
157
|
+
calling `session.complete()`. Calling `complete()` before the run starts rejects
|
|
158
|
+
with `voice_runtime.session_not_running`.
|
|
159
|
+
|
|
160
|
+
The runtime `session.run` promise still reports execution failure or
|
|
161
|
+
cancellation by rejecting. Use `finalSession` when the host needs a persisted
|
|
162
|
+
terminal status regardless of whether the run succeeded. See the
|
|
163
|
+
[API reference](https://github.com/Kkartik14/TVIC/blob/main/docs/api-reference.md)
|
|
164
|
+
and [transport lifecycle guide](https://github.com/Kkartik14/TVIC/blob/main/docs/transports.md)
|
|
165
|
+
for the complete contract.
|
|
166
|
+
|
|
135
167
|
`agent.stop()` is idempotent. If a session is still running, it cancels and
|
|
136
|
-
drains that session before closing the runtime and its stores.
|
|
168
|
+
drains that session before closing the runtime and its stores. A deadline
|
|
169
|
+
failure rejects shutdown and requires the host to retain any dependencies that
|
|
170
|
+
late cleanup still uses.
|
|
137
171
|
|
|
138
172
|
Errors on `VoiceEvent` and `MediaEvent` payloads are JSON-safe
|
|
139
173
|
`NormalizedError` values. Check them with `isNormalizedError`; the
|
|
@@ -160,20 +194,23 @@ outside the realtime critical path.
|
|
|
160
194
|
|
|
161
195
|
Each stage is configured independently. Built-in options currently include:
|
|
162
196
|
|
|
163
|
-
|
|
164
|
-
|
|
197
|
+
TVIC's supported provider set is listed in the [repository provider overview](https://github.com/Kkartik14/TVIC/blob/main/README.md#providers).
|
|
198
|
+
For current Sarvam API behavior and voice IDs, use the
|
|
199
|
+
[official Sarvam TTS documentation](https://docs.sarvam.ai/api/api-guides-tutorials/text-to-speech/overview).
|
|
165
200
|
|
|
166
|
-
- STT: Deepgram, Sarvam, ElevenLabs Scribe, AssemblyAI, and Soniox.
|
|
201
|
+
- STT: Deepgram, Sarvam, Cartesia Ink, ElevenLabs Scribe, AssemblyAI, and Soniox.
|
|
167
202
|
- LLM: Groq Chat Completions (the reference path) and an optional OpenAI Responses adapter.
|
|
168
|
-
- TTS: Cartesia and
|
|
203
|
+
- TTS: Cartesia, ElevenLabs (WebSocket, REST, and HTTP stream), and Sarvam Bulbul v3/v4 Flash.
|
|
169
204
|
- Transport: browser audio and inbound Twilio Media Streams.
|
|
170
205
|
|
|
171
206
|
Maturity is intentionally explicit: Web Client Audio and inbound Twilio Media
|
|
172
|
-
Streams
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
207
|
+
Streams remain the stable transport paths in `2.0.0`. The paid STT, LLM, and TTS
|
|
208
|
+
adapters are currently `experimental`. `validated` is the intermediate label
|
|
209
|
+
for an exact adapter/model/configuration that has passed the small-scale live
|
|
210
|
+
evidence profile and is reasonable for low-volume use; `stable` additionally
|
|
211
|
+
requires a support matrix, release evidence, ownership, and an upgrade policy.
|
|
212
|
+
The root exports `PROVIDER_STABILITY` and `PROVIDER_STABILITY_LEVELS` contain
|
|
213
|
+
the machine-readable labels.
|
|
177
214
|
|
|
178
215
|
Pass an explicit `apiKey` or use the documented environment variable. Explicit
|
|
179
216
|
credentials take precedence; missing credentials fail before a live session is
|
|
@@ -189,11 +226,15 @@ created.
|
|
|
189
226
|
| Groq | `GROQ_API_KEY` |
|
|
190
227
|
| OpenAI | `OPENAI_API_KEY` |
|
|
191
228
|
| Cartesia | `CARTESIA_API_KEY` |
|
|
229
|
+
| Sarvam TTS | `SARVAM_API_KEY` |
|
|
192
230
|
|
|
193
231
|
STT, LLM, and TTS models are independent settings. TTS voice selection is also
|
|
194
232
|
independent. Built-in TTS can read `CARTESIA_VOICE_ID` or
|
|
195
233
|
`ELEVENLABS_VOICE_ID` for its voice. For complete provider-specific control,
|
|
196
234
|
pass a constructed provider instance instead of a built-in configuration object.
|
|
235
|
+
Sarvam's managed configuration defaults to its WebSocket adapter; set
|
|
236
|
+
`transport: "rest"` or `transport: "http-stream"` on the Sarvam TTS config when
|
|
237
|
+
the downstream use case needs one-shot HTTP delivery.
|
|
197
238
|
Built-in STT and LLM configurations reject models outside the
|
|
198
239
|
dated TVIC catalog unless `allowUnknownModel: true` is explicitly set.
|
|
199
240
|
|
|
@@ -241,7 +282,7 @@ application's responsibility.
|
|
|
241
282
|
|
|
242
283
|
Advanced runtime, media, provider, normalized-error, and durable-adapter APIs
|
|
243
284
|
are exported from the package root. There are no advanced subpath imports in
|
|
244
|
-
|
|
285
|
+
2.0.0. This lets a developer start with `createVoiceAgent` and later own
|
|
245
286
|
the runtime/session/pipeline boundaries without changing package names.
|
|
246
287
|
|
|
247
288
|
Read the [voice-agent guide](https://github.com/Kkartik14/TVIC/blob/main/docs/building-a-voice-agent.md)
|