@voxevolv/client 0.3.3 → 0.3.5

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/CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  All notable changes to `@voxevolv/client` are recorded here.
4
4
 
5
+ ## 0.3.5 - 2026-09-23
6
+
7
+ - Preserve global client command order across concurrent context keys and prevent
8
+ timer updates from being overtaken by screen updates at the LiveKit publish boundary.
9
+ - Add opt-in SDK-owned initial connection recovery with three default attempts,
10
+ increasing 15/20/25-second readiness budgets, bounded delays, and a 65-second
11
+ overall startup deadline.
12
+ - Renew the same session's room token between startup attempts while keeping
13
+ intermediate failures nonterminal.
14
+ - Add `onStartupAttempt()` progress events for connecting and retrying UI.
15
+ - Stop startup retry on terminal HTTP, session, microphone, and audio errors;
16
+ preserve one configured credential refresh after `401` and honor explicitly
17
+ retryable `session.error` events.
18
+ - Preserve caller options across startup attempts, retry transient network
19
+ failures, and enforce the startup deadline during token renewal.
20
+ - Keep explicit startup cancellation disconnected and deliver command timeouts
21
+ even when an earlier command is still waiting to publish.
22
+
23
+ ## 0.3.4 - 2026-09-22
24
+
25
+ - Add a typed `trigger` and safe command correlation fields to every recovery event.
26
+ - Keep the latest 128 content-free diagnostic entries in memory and report them
27
+ only after a slow operation, rejection, failure, timeout, or reconnect.
28
+ - Send triggered reports through the session-scoped diagnostics endpoint without
29
+ exposing context text, images, tokens, or request URLs, and never let reporting
30
+ failures affect the realtime call.
31
+ - Coalesce rate-limited triggers into a trailing report and stop waiting on a
32
+ diagnostics request after five seconds, so later failure evidence is not lost.
33
+
5
34
  ## 0.3.3 - 2026-09-17
6
35
 
7
36
  - Add identified, revisioned transcript snapshots with `onTranscriptUpdated()` and `session.transcript`.
package/README.md CHANGED
@@ -26,7 +26,7 @@ Browsers without a build step can use the versioned bundle after publication:
26
26
  ```html
27
27
  <script type="module">
28
28
  import { RealtimeSession } from
29
- "https://cdn.jsdelivr.net/npm/@voxevolv/client@0.3.2/dist/browser/index.js";
29
+ "https://cdn.jsdelivr.net/npm/@voxevolv/client@0.3.5/dist/browser/index.js";
30
30
  </script>
31
31
  ```
32
32
 
@@ -41,6 +41,7 @@ const session = await RealtimeSession.create({
41
41
  // Use the hosted API directly when its lifecycle CORS policy is public.
42
42
  // A same-origin lifecycle proxy remains supported.
43
43
  apiBase: "https://YOUR_VOXEVOLV_HOST/v1",
44
+ startupRetry: true,
44
45
  autoRejoin: true,
45
46
  tools: {
46
47
  present_attachment: (arguments_) => presentAttachment(arguments_),
@@ -64,6 +65,7 @@ play remote audio:
64
65
  ```ts
65
66
  const session = new RealtimeSession(credentials, {
66
67
  connect: { apiBase: "https://YOUR_VOXEVOLV_HOST/v1" },
68
+ startupRetry: true,
67
69
  autoRejoin: true,
68
70
  });
69
71
  await session.connect({ microphone: true });
@@ -125,9 +127,64 @@ Applications that intentionally run without agent audio can opt out:
125
127
  await session.connect({ waitForRemoteAudio: false });
126
128
  ```
127
129
 
130
+ ## Initial connection retries
131
+
132
+ Set `startupRetry: true` to let the SDK retry a session that has not connected
133
+ successfully yet. The default policy makes three total attempts with 15, 20,
134
+ and 25-second readiness budgets, waits one second before attempt two and three
135
+ seconds before attempt three, and enforces a 65-second overall deadline. The
136
+ overall deadline also includes room connection, token renewal, microphone
137
+ publication, the client hello, and remote-audio readiness.
138
+
139
+ Attempt one uses the room token returned at session creation. Later attempts
140
+ obtain a fresh room token for the same VoxEvolv session ID. Intermediate
141
+ failures remain nonterminal; `connect()` rejects and the session enters
142
+ `failed` only when the attempts are exhausted, the overall deadline expires,
143
+ or a terminal error occurs.
144
+
145
+ ```ts
146
+ const session = await RealtimeSession.create({
147
+ endpoint: "/api/voice-session",
148
+ apiBase: "https://YOUR_VOXEVOLV_HOST/v1",
149
+ startupRetry: true,
150
+ autoRejoin: true,
151
+ });
152
+
153
+ session.onStartupAttempt(({ status, attempt, maxAttempts, error }) => {
154
+ if (status === "started" && attempt > 1) {
155
+ renderConnectionStatus(`Retrying connection (${attempt}/${maxAttempts})…`);
156
+ }
157
+ if (status === "failed") recordStartupFailure(attempt, error);
158
+ });
159
+
160
+ await session.connect();
161
+ ```
162
+
163
+ Custom policies use explicit attempts. `delayBeforeMs` is the wait before that
164
+ attempt. When startup retry is enabled, each attempt's `readyTimeoutMs` replaces
165
+ the single timeout supplied through `connect()` or the constructor defaults.
166
+
167
+ ```ts
168
+ startupRetry: {
169
+ attempts: [
170
+ { readyTimeoutMs: 15_000 },
171
+ { delayBeforeMs: 1_000, readyTimeoutMs: 20_000 },
172
+ { delayBeforeMs: 3_000, readyTimeoutMs: 25_000 },
173
+ ],
174
+ timeoutMs: 65_000,
175
+ }
176
+ ```
177
+
178
+ The SDK does not retry invalid audio configuration, microphone permission or
179
+ device errors, non-retryable `session.error` events, or non-transient HTTP 4xx
180
+ responses such as `401`, `403`, and `409 Session has ended`. A configured
181
+ `refreshCredentials` callback still gets one opportunity to replace expired
182
+ credentials after a `401`. A `session.error` explicitly marked
183
+ `retryable: true` may advance to the next startup attempt.
184
+
128
185
  ## Recovery, rejoin, and connection quality
129
186
 
130
- With `@voxevolv/client@0.3.2`, set `autoRejoin: true` to let the SDK recover
187
+ With `@voxevolv/client@0.3.2` or newer, set `autoRejoin: true` to let the SDK recover
131
188
  when an agent leaves, its worker changes, a context command times out, or LiveKit
132
189
  exhausts its transport reconnect. Automatic recovery runs only after the session has
133
190
  connected successfully, never after an explicit `disconnect()`, `end()`, or
@@ -158,9 +215,9 @@ or replayed during recovery because repeating them could duplicate input. Update
158
215
  already in flight may have reached the server even if their acknowledgment was lost.
159
216
 
160
217
  Keep the existing `RealtimeSession` instance during recovery, register tools on
161
- that instance, and use `onStateChange` / `onRecovery` for UI. Avoid application
162
- retry loops that create new sessions. Older clients remain API-compatible but
163
- need the SDK upgrade to gain agent-loss detection and context restoration.
218
+ that instance, and use `onStateChange`, `onStartupAttempt`, and `onRecovery` for
219
+ UI. Avoid application retry loops that create new sessions. Older clients remain
220
+ API-compatible but need the SDK upgrade to gain these recovery behaviors.
164
221
 
165
222
  ```ts
166
223
  session.onStateChange((state) => {
@@ -169,8 +226,17 @@ session.onStateChange((state) => {
169
226
  renderConnectionState(state);
170
227
  });
171
228
 
172
- session.onRecovery(({ status, strategy, attempt, error }) => {
173
- recordRecovery({ status, strategy, attempt, error });
229
+ session.onRecovery(({ status, strategy, attempt, trigger, messageId, contextKey, timeoutMs, error }) => {
230
+ recordRecovery({
231
+ status,
232
+ strategy,
233
+ attempt,
234
+ trigger,
235
+ messageId,
236
+ contextKey,
237
+ timeoutMs,
238
+ error,
239
+ });
174
240
  });
175
241
 
176
242
  session.onConnectionQuality((quality) => {
@@ -182,6 +248,17 @@ session.onConnectionQuality((quality) => {
182
248
  `waitForState(states, timeoutMs, { signal })` is available for advanced flows
183
249
  that need to await a bounded set of lifecycle states.
184
250
 
251
+ In version 0.3.4, every recovery event includes a typed `trigger`, such as
252
+ `context_command_timeout`, `livekit_disconnected`, `agent_disconnected`, or
253
+ `worker_replaced`. Context timeouts also include the safe `messageId`,
254
+ `contextKey`, and `timeoutMs` correlation fields. The SDK keeps the latest 128
255
+ content-free transport and command entries in memory. It sends a throttled,
256
+ best-effort report only after a slow operation, rejection, failure, timeout, or
257
+ reconnect. Reports never include context text, screenshots, tokens, or raw URLs,
258
+ and reporting failures never affect the call. A trigger received during the
259
+ throttle window is retained for one trailing report, and each diagnostics request
260
+ stops waiting after five seconds so a stuck endpoint cannot block later evidence.
261
+
185
262
  Manual `rejoin()` remains available. It obtains a fresh room token, disconnects
186
263
  any underlying room connection, and reconnects with the original microphone or
187
264
  application-owned track choice. A managed microphone that the user muted with
@@ -199,6 +276,7 @@ enabled by default), or a same-origin proxy base that forwards only:
199
276
 
200
277
  - `POST /sessions/{id}/room-tokens`
201
278
  - `GET /sessions/{id}/events`
279
+ - `POST /sessions/{id}/diagnostics`
202
280
  - `DELETE /sessions/{id}`
203
281
 
204
282
  The proxy must forward the browser's `Authorization: Bearer vsa_...` header. It