@furious.luke/argus-js 0.5.6 → 0.5.7

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 CHANGED
@@ -241,6 +241,7 @@ not the `utterance_finished` lifecycle event, which can overtake the last chunk.
241
241
  | `onUserTextResult({ messageId, accepted, reason })` | The server accepted or rejected a `sendUserText` message. |
242
242
  | `onConnectionStats(sample)` | A periodic `ConnectionStatsSample` (loss ratio, RTT, jitter, send/available bitrate, encoder limitation) — the raw feed behind `onConnectionQualityChange`. Fires every `connectionStatsIntervalMs` while connected. |
243
243
  | `onConnectionQualityChange({ level, sample })` | The derived connection-quality level (`"good" \| "fair" \| "poor" \| "critical"`) changed, including the first assessment after connecting. Downgrades are debounced; upgrades fire immediately. React to a degrading uplink here — warn the user, or drop a secondary track. |
244
+ | `onSpeechQualityChange({ degraded, realtimeFactor })` | Server-side text-to-speech generation crossed the realtime boundary: `degraded: true` when the TTS provider dropped below realtime (`realtimeFactor` < 1.0), synthesizing slower than it plays and starving playout, `degraded: false` once it climbs comfortably back above realtime. The degraded transition is raised **live during synthesis** (a long, slow utterance is reported while it happens, not at its end). Edge-triggered (no flapping at the boundary). A **distinct axis from `onConnectionQualityChange`** (that is network health) — react by warning the user or offering a text fallback. |
244
245
  | `onError(error)` | A fatal error occurred (signaling error, WebRTC connection failure/timeout, or signaling resume timed out). |
245
246
 
246
247
  ## How `start()` works
package/dist/index.cjs CHANGED
@@ -1121,6 +1121,17 @@ var Publisher = class {
1121
1121
  this.completeMediaRecovery(msg.track);
1122
1122
  break;
1123
1123
  }
1124
+ case "speech_slow": {
1125
+ this.opts.callbacks?.onSpeechQualityChange?.({
1126
+ degraded: true,
1127
+ realtimeFactor: msg.realtime_factor
1128
+ });
1129
+ break;
1130
+ }
1131
+ case "speech_recovered": {
1132
+ this.opts.callbacks?.onSpeechQualityChange?.({ degraded: false });
1133
+ break;
1134
+ }
1124
1135
  case "error": {
1125
1136
  const err = new ReportedPublisherError(msg.error, msg.fatal === true);
1126
1137
  const pending = this.pendingAnswer;