@umimoney/clawdbot-relay-plugin 0.1.18 → 0.1.19
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/clawdbot.plugin.json +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -18
- package/dist/index.mjs +0 -18
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://clawdbot.dev/schemas/plugin.json",
|
|
3
3
|
"id": "umi-relay",
|
|
4
4
|
"name": "UMI Relay",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.19",
|
|
6
6
|
"description": "Connect to UMI relay server for real-time chat visibility in UMI web UI",
|
|
7
7
|
"type": "channel",
|
|
8
8
|
"main": "index.js",
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -44,7 +44,6 @@ var UmiRelayClient = class {
|
|
|
44
44
|
this.messageHandlers = /* @__PURE__ */ new Set();
|
|
45
45
|
this.agentId = null;
|
|
46
46
|
this.isAuthenticated = false;
|
|
47
|
-
this.isConnecting = false;
|
|
48
47
|
this.config = {
|
|
49
48
|
relayUrl: config.relayUrl || "wss://ws.umi.app/ws/relay",
|
|
50
49
|
apiKey: config.apiKey,
|
|
@@ -61,25 +60,11 @@ var UmiRelayClient = class {
|
|
|
61
60
|
*/
|
|
62
61
|
connect() {
|
|
63
62
|
return new Promise((resolve, reject) => {
|
|
64
|
-
if (this.isConnecting) {
|
|
65
|
-
console.log("[UmiRelay] Connection already in progress, skipping");
|
|
66
|
-
resolve();
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (this.ws) {
|
|
70
|
-
console.log("[UmiRelay] Closing existing connection before reconnect");
|
|
71
|
-
const oldWs = this.ws;
|
|
72
|
-
this.ws = null;
|
|
73
|
-
oldWs.removeAllListeners();
|
|
74
|
-
oldWs.close();
|
|
75
|
-
}
|
|
76
|
-
this.isConnecting = true;
|
|
77
63
|
try {
|
|
78
64
|
const url = `${this.config.relayUrl}?type=agent`;
|
|
79
65
|
console.log(`[UmiRelay] Connecting to ${url}`);
|
|
80
66
|
this.ws = new import_ws.default(url);
|
|
81
67
|
this.ws.on("open", () => {
|
|
82
|
-
this.isConnecting = false;
|
|
83
68
|
console.log("[UmiRelay] Connected, authenticating...");
|
|
84
69
|
this.authenticate();
|
|
85
70
|
});
|
|
@@ -97,14 +82,12 @@ var UmiRelayClient = class {
|
|
|
97
82
|
this.scheduleReconnect();
|
|
98
83
|
});
|
|
99
84
|
this.ws.on("error", (error) => {
|
|
100
|
-
this.isConnecting = false;
|
|
101
85
|
console.error("[UmiRelay] WebSocket error:", error);
|
|
102
86
|
if (!this.isAuthenticated) {
|
|
103
87
|
reject(error);
|
|
104
88
|
}
|
|
105
89
|
});
|
|
106
90
|
} catch (error) {
|
|
107
|
-
this.isConnecting = false;
|
|
108
91
|
reject(error);
|
|
109
92
|
}
|
|
110
93
|
});
|
|
@@ -256,7 +239,6 @@ var UmiRelayClient = class {
|
|
|
256
239
|
}
|
|
257
240
|
cleanup() {
|
|
258
241
|
this.isAuthenticated = false;
|
|
259
|
-
this.isConnecting = false;
|
|
260
242
|
if (this.pingInterval) {
|
|
261
243
|
clearInterval(this.pingInterval);
|
|
262
244
|
this.pingInterval = null;
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,6 @@ var UmiRelayClient = class {
|
|
|
9
9
|
this.messageHandlers = /* @__PURE__ */ new Set();
|
|
10
10
|
this.agentId = null;
|
|
11
11
|
this.isAuthenticated = false;
|
|
12
|
-
this.isConnecting = false;
|
|
13
12
|
this.config = {
|
|
14
13
|
relayUrl: config.relayUrl || "wss://ws.umi.app/ws/relay",
|
|
15
14
|
apiKey: config.apiKey,
|
|
@@ -26,25 +25,11 @@ var UmiRelayClient = class {
|
|
|
26
25
|
*/
|
|
27
26
|
connect() {
|
|
28
27
|
return new Promise((resolve, reject) => {
|
|
29
|
-
if (this.isConnecting) {
|
|
30
|
-
console.log("[UmiRelay] Connection already in progress, skipping");
|
|
31
|
-
resolve();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (this.ws) {
|
|
35
|
-
console.log("[UmiRelay] Closing existing connection before reconnect");
|
|
36
|
-
const oldWs = this.ws;
|
|
37
|
-
this.ws = null;
|
|
38
|
-
oldWs.removeAllListeners();
|
|
39
|
-
oldWs.close();
|
|
40
|
-
}
|
|
41
|
-
this.isConnecting = true;
|
|
42
28
|
try {
|
|
43
29
|
const url = `${this.config.relayUrl}?type=agent`;
|
|
44
30
|
console.log(`[UmiRelay] Connecting to ${url}`);
|
|
45
31
|
this.ws = new WebSocket(url);
|
|
46
32
|
this.ws.on("open", () => {
|
|
47
|
-
this.isConnecting = false;
|
|
48
33
|
console.log("[UmiRelay] Connected, authenticating...");
|
|
49
34
|
this.authenticate();
|
|
50
35
|
});
|
|
@@ -62,14 +47,12 @@ var UmiRelayClient = class {
|
|
|
62
47
|
this.scheduleReconnect();
|
|
63
48
|
});
|
|
64
49
|
this.ws.on("error", (error) => {
|
|
65
|
-
this.isConnecting = false;
|
|
66
50
|
console.error("[UmiRelay] WebSocket error:", error);
|
|
67
51
|
if (!this.isAuthenticated) {
|
|
68
52
|
reject(error);
|
|
69
53
|
}
|
|
70
54
|
});
|
|
71
55
|
} catch (error) {
|
|
72
|
-
this.isConnecting = false;
|
|
73
56
|
reject(error);
|
|
74
57
|
}
|
|
75
58
|
});
|
|
@@ -221,7 +204,6 @@ var UmiRelayClient = class {
|
|
|
221
204
|
}
|
|
222
205
|
cleanup() {
|
|
223
206
|
this.isAuthenticated = false;
|
|
224
|
-
this.isConnecting = false;
|
|
225
207
|
if (this.pingInterval) {
|
|
226
208
|
clearInterval(this.pingInterval);
|
|
227
209
|
this.pingInterval = null;
|