@telnyx/ai-agent-lib 0.3.4 → 0.4.0-beta.1

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/dist/client.d.ts CHANGED
@@ -68,6 +68,14 @@ export declare class TelnyxAIAgent extends EventEmitter<AIAgentEvents> {
68
68
  * @returns Promise that resolves when the connection is established
69
69
  */
70
70
  connect(): Promise<void>;
71
+ /**
72
+ * Clears the reconnect token stored by the underlying WebRTC SDK.
73
+ *
74
+ * This forces the next connection to pick a new b2bua-rtc instance via
75
+ * weighted round-robin instead of sticking to the same one. Useful when
76
+ * retrying after a "Login Incorrect" error caused by RMQ propagation lag.
77
+ */
78
+ clearReconnectToken(): void;
71
79
  /**
72
80
  * Disconnects from the Telnyx WebRTC service and cleans up all event listeners.
73
81
  * Emits an 'agent.disconnected' event before completing cleanup.
package/dist/index.js CHANGED
@@ -3915,6 +3915,16 @@ class Qt extends Ct {
3915
3915
  async connect() {
3916
3916
  return this.telnyxRTC.connect();
3917
3917
  }
3918
+ /**
3919
+ * Clears the reconnect token stored by the underlying WebRTC SDK.
3920
+ *
3921
+ * This forces the next connection to pick a new b2bua-rtc instance via
3922
+ * weighted round-robin instead of sticking to the same one. Useful when
3923
+ * retrying after a "Login Incorrect" error caused by RMQ propagation lag.
3924
+ */
3925
+ clearReconnectToken() {
3926
+ this.telnyxRTC.clearReconnectToken?.();
3927
+ }
3918
3928
  /**
3919
3929
  * Disconnects from the Telnyx WebRTC service and cleans up all event listeners.
3920
3930
  * Emits an 'agent.disconnected' event before completing cleanup.
@@ -4033,7 +4043,7 @@ class Qt extends Ct {
4033
4043
  this.emit("agent.connected", t);
4034
4044
  };
4035
4045
  onClientOrSocketError = (e) => {
4036
- this.emit("agent.error", e);
4046
+ this.emit("agent.error", e.error);
4037
4047
  };
4038
4048
  onNotification = (e) => {
4039
4049
  e.type !== "callUpdate" || !e.call || (this.emit("conversation.update", e), e.call.state === "active" ? (this.activeCall = e.call, e.call.remoteStream && this.audioStreamMonitor.setRemoteStream(e.call.remoteStream), e.call.localStream && this.audioStreamMonitor.setLocalStream(e.call.localStream)) : (this.activeCall = null, this.audioStreamMonitor.stopAudioStreamMonitor()));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@telnyx/ai-agent-lib",
3
3
  "private": false,
4
- "version": "0.3.4",
4
+ "version": "0.4.0-beta.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",