@voxevolv/client 0.3.4 → 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,24 @@
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
+
5
23
  ## 0.3.4 - 2026-09-22
6
24
 
7
25
  - Add a typed `trigger` and safe command correlation fields to every recovery event.
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.4/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,6 +127,61 @@ 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
187
  With `@voxevolv/client@0.3.2` or newer, set `autoRejoin: true` to let the SDK recover
@@ -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) => {