@umimoney/clawdbot-relay-plugin 0.1.19 → 0.1.21

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/index.js CHANGED
@@ -189,14 +189,18 @@ var UmiRelayClient = class {
189
189
  this.isAuthenticated = true;
190
190
  this.agentId = message.agentId ?? null;
191
191
  this.reconnectAttempts = 0;
192
- console.log(`[UmiRelay] Authenticated as ${message.agentName} (${message.agentId})`);
192
+ console.log(`[UmiRelay] \u2713 Connected as "${message.agentName}" (${message.agentId})`);
193
193
  this.startPing();
194
194
  resolveConnect?.();
195
195
  break;
196
196
  case "platform:auth_failure":
197
- console.error(`[UmiRelay] Authentication failed: ${message.error}`);
197
+ const keyPrefix = this.config.apiKey?.substring(0, 12) || "unknown";
198
+ console.error(`[UmiRelay] \u2717 Authentication failed for key ${keyPrefix}...`);
199
+ console.error(`[UmiRelay] Error: ${message.error}`);
200
+ console.error(`[UmiRelay] Tip: Validate your key with:`);
201
+ console.error(`[UmiRelay] curl -H "Authorization: Bearer <key>" https://server.umi.app/api/agent-external/info`);
198
202
  this.config.autoReconnect = false;
199
- rejectConnect?.(new Error(message.error));
203
+ rejectConnect?.(new Error(`Authentication failed: ${message.error}`));
200
204
  break;
201
205
  case "platform:message":
202
206
  console.log(`[UmiRelay] Received message: ${message.content}`);
@@ -334,10 +338,18 @@ var umiRelayChannel = {
334
338
  };
335
339
  console.log("[UmiRelay] Config from channel:", { ...config, apiKey: config.apiKey ? "***" : "MISSING" });
336
340
  if (!config.apiKey) {
337
- console.error("[UmiRelay] No API key provided. Set UMI_API_KEY or pass apiKey in config.");
341
+ console.error("[UmiRelay] \u2717 No API key provided.");
342
+ console.error("[UmiRelay] Quick fix: npx @umimoney/clawdbot-setup");
343
+ console.error("[UmiRelay] Or manually set UMI_API_KEY environment variable");
344
+ console.error("[UmiRelay] Or add apiKey to channels.umi-relay in clawdbot.json");
338
345
  return { stop: () => {
339
346
  } };
340
347
  }
348
+ if (relayClient) {
349
+ console.log("[UmiRelay] Closing existing connection before reconnecting...");
350
+ relayClient.disconnect();
351
+ relayClient = null;
352
+ }
341
353
  relayClient = new UmiRelayClient(config);
342
354
  relayClient.onMessage((message) => {
343
355
  if (message.type === "platform:message") {
package/dist/index.mjs CHANGED
@@ -154,14 +154,18 @@ var UmiRelayClient = class {
154
154
  this.isAuthenticated = true;
155
155
  this.agentId = message.agentId ?? null;
156
156
  this.reconnectAttempts = 0;
157
- console.log(`[UmiRelay] Authenticated as ${message.agentName} (${message.agentId})`);
157
+ console.log(`[UmiRelay] \u2713 Connected as "${message.agentName}" (${message.agentId})`);
158
158
  this.startPing();
159
159
  resolveConnect?.();
160
160
  break;
161
161
  case "platform:auth_failure":
162
- console.error(`[UmiRelay] Authentication failed: ${message.error}`);
162
+ const keyPrefix = this.config.apiKey?.substring(0, 12) || "unknown";
163
+ console.error(`[UmiRelay] \u2717 Authentication failed for key ${keyPrefix}...`);
164
+ console.error(`[UmiRelay] Error: ${message.error}`);
165
+ console.error(`[UmiRelay] Tip: Validate your key with:`);
166
+ console.error(`[UmiRelay] curl -H "Authorization: Bearer <key>" https://server.umi.app/api/agent-external/info`);
163
167
  this.config.autoReconnect = false;
164
- rejectConnect?.(new Error(message.error));
168
+ rejectConnect?.(new Error(`Authentication failed: ${message.error}`));
165
169
  break;
166
170
  case "platform:message":
167
171
  console.log(`[UmiRelay] Received message: ${message.content}`);
@@ -299,10 +303,18 @@ var umiRelayChannel = {
299
303
  };
300
304
  console.log("[UmiRelay] Config from channel:", { ...config, apiKey: config.apiKey ? "***" : "MISSING" });
301
305
  if (!config.apiKey) {
302
- console.error("[UmiRelay] No API key provided. Set UMI_API_KEY or pass apiKey in config.");
306
+ console.error("[UmiRelay] \u2717 No API key provided.");
307
+ console.error("[UmiRelay] Quick fix: npx @umimoney/clawdbot-setup");
308
+ console.error("[UmiRelay] Or manually set UMI_API_KEY environment variable");
309
+ console.error("[UmiRelay] Or add apiKey to channels.umi-relay in clawdbot.json");
303
310
  return { stop: () => {
304
311
  } };
305
312
  }
313
+ if (relayClient) {
314
+ console.log("[UmiRelay] Closing existing connection before reconnecting...");
315
+ relayClient.disconnect();
316
+ relayClient = null;
317
+ }
306
318
  relayClient = new UmiRelayClient(config);
307
319
  relayClient.onMessage((message) => {
308
320
  if (message.type === "platform:message") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umimoney/clawdbot-relay-plugin",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Clawdbot plugin for connecting to UMI relay server",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",