@telnyx/ai-agent-lib 0.3.3 → 0.4.0-beta.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/dist/client.d.ts +16 -0
- package/dist/index.js +21 -1
- package/package.json +2 -3
package/dist/client.d.ts
CHANGED
|
@@ -68,6 +68,22 @@ 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;
|
|
79
|
+
/**
|
|
80
|
+
* Re-sends the login message on the existing WebSocket connection.
|
|
81
|
+
* Used by the widget to retry after a transient "Login Incorrect" error
|
|
82
|
+
* without closing and reopening the socket.
|
|
83
|
+
*
|
|
84
|
+
* @returns Promise that resolves when the re-login succeeds
|
|
85
|
+
*/
|
|
86
|
+
retryLogin(): Promise<void>;
|
|
71
87
|
/**
|
|
72
88
|
* Disconnects from the Telnyx WebRTC service and cleans up all event listeners.
|
|
73
89
|
* Emits an 'agent.disconnected' event before completing cleanup.
|
package/dist/index.js
CHANGED
|
@@ -3915,6 +3915,26 @@ 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
|
+
}
|
|
3928
|
+
/**
|
|
3929
|
+
* Re-sends the login message on the existing WebSocket connection.
|
|
3930
|
+
* Used by the widget to retry after a transient "Login Incorrect" error
|
|
3931
|
+
* without closing and reopening the socket.
|
|
3932
|
+
*
|
|
3933
|
+
* @returns Promise that resolves when the re-login succeeds
|
|
3934
|
+
*/
|
|
3935
|
+
async retryLogin() {
|
|
3936
|
+
return this.telnyxRTC.relogin?.();
|
|
3937
|
+
}
|
|
3918
3938
|
/**
|
|
3919
3939
|
* Disconnects from the Telnyx WebRTC service and cleans up all event listeners.
|
|
3920
3940
|
* Emits an 'agent.disconnected' event before completing cleanup.
|
|
@@ -4033,7 +4053,7 @@ class Qt extends Ct {
|
|
|
4033
4053
|
this.emit("agent.connected", t);
|
|
4034
4054
|
};
|
|
4035
4055
|
onClientOrSocketError = (e) => {
|
|
4036
|
-
this.emit("agent.error", e);
|
|
4056
|
+
this.emit("agent.error", e.error);
|
|
4037
4057
|
};
|
|
4038
4058
|
onNotification = (e) => {
|
|
4039
4059
|
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.
|
|
4
|
+
"version": "0.4.0-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"lint": "eslint .",
|
|
24
24
|
"format": "prettier --write .",
|
|
25
25
|
"preview": "vite preview",
|
|
26
|
-
"release": "release-it"
|
|
27
|
-
"postinstall": "node scripts/fix-webrtc-types.mjs"
|
|
26
|
+
"release": "release-it"
|
|
28
27
|
},
|
|
29
28
|
"peerDependencies": {
|
|
30
29
|
"react": "^19.1.1",
|