voice-runtime 1.2.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 +48 -14
- package/dist/index.cjs +9991 -3259
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +429 -840
- package/dist/index.js +9983 -3264
- 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.
|
|
@@ -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,23 +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, ElevenLabs (WebSocket, REST, and HTTP stream), and Sarvam Bulbul v3.
|
|
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
|
|
207
|
+
Streams remain the stable transport paths in `2.0.0`. The paid STT, LLM, and TTS
|
|
173
208
|
adapters are currently `experimental`. `validated` is the intermediate label
|
|
174
209
|
for an exact adapter/model/configuration that has passed the small-scale live
|
|
175
210
|
evidence profile and is reasonable for low-volume use; `stable` additionally
|
|
176
211
|
requires a support matrix, release evidence, ownership, and an upgrade policy.
|
|
177
212
|
The root exports `PROVIDER_STABILITY` and `PROVIDER_STABILITY_LEVELS` contain
|
|
178
|
-
the machine-readable labels.
|
|
179
|
-
and promotion rules.
|
|
213
|
+
the machine-readable labels.
|
|
180
214
|
|
|
181
215
|
Pass an explicit `apiKey` or use the documented environment variable. Explicit
|
|
182
216
|
credentials take precedence; missing credentials fail before a live session is
|
|
@@ -248,7 +282,7 @@ application's responsibility.
|
|
|
248
282
|
|
|
249
283
|
Advanced runtime, media, provider, normalized-error, and durable-adapter APIs
|
|
250
284
|
are exported from the package root. There are no advanced subpath imports in
|
|
251
|
-
|
|
285
|
+
2.0.0. This lets a developer start with `createVoiceAgent` and later own
|
|
252
286
|
the runtime/session/pipeline boundaries without changing package names.
|
|
253
287
|
|
|
254
288
|
Read the [voice-agent guide](https://github.com/Kkartik14/TVIC/blob/main/docs/building-a-voice-agent.md)
|