@umimoney/clawdbot-relay-plugin 0.1.20 → 0.1.22

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}`);
@@ -288,7 +292,7 @@ var umiRelayChannel = {
288
292
  },
289
293
  capabilities: {
290
294
  chatTypes: ["direct"],
291
- media: false
295
+ media: true
292
296
  },
293
297
  // Empty plugin config - all config comes from channel (channels.umi-relay)
294
298
  configSchema: {
@@ -334,7 +338,10 @@ 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
  }
@@ -347,11 +354,18 @@ var umiRelayChannel = {
347
354
  relayClient.onMessage((message) => {
348
355
  if (message.type === "platform:message") {
349
356
  const userId = String(message.userId || message.senderId || "unknown");
350
- console.log("[UmiRelay] Dispatching message to Clawdbot:", message.content, "from:", userId);
357
+ const attachments = message.attachments || [];
358
+ console.log("[UmiRelay] Dispatching message to Clawdbot:", message.content, "from:", userId, "attachments:", attachments.length);
351
359
  try {
352
360
  const runtime = getPluginRuntime();
353
361
  const content = String(message.content || "");
354
362
  const sessionKey = `umi-relay:default:${userId}`;
363
+ const media = attachments.filter((att) => att.base64 && att.type === "image").map((att) => ({
364
+ type: "image",
365
+ mimeType: att.mimeType || "image/png",
366
+ data: att.base64,
367
+ name: att.name
368
+ }));
355
369
  runtime.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
356
370
  ctx: {
357
371
  channel: "umi-relay",
@@ -370,7 +384,9 @@ var umiRelayChannel = {
370
384
  ts: message.timestamp,
371
385
  metadata: {
372
386
  userId: message.userId,
373
- agentId: message.agentId
387
+ agentId: message.agentId,
388
+ attachments,
389
+ media: media.length > 0 ? media : void 0
374
390
  }
375
391
  },
376
392
  cfg: ctx.cfg,
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}`);
@@ -253,7 +257,7 @@ var umiRelayChannel = {
253
257
  },
254
258
  capabilities: {
255
259
  chatTypes: ["direct"],
256
- media: false
260
+ media: true
257
261
  },
258
262
  // Empty plugin config - all config comes from channel (channels.umi-relay)
259
263
  configSchema: {
@@ -299,7 +303,10 @@ 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
  }
@@ -312,11 +319,18 @@ var umiRelayChannel = {
312
319
  relayClient.onMessage((message) => {
313
320
  if (message.type === "platform:message") {
314
321
  const userId = String(message.userId || message.senderId || "unknown");
315
- console.log("[UmiRelay] Dispatching message to Clawdbot:", message.content, "from:", userId);
322
+ const attachments = message.attachments || [];
323
+ console.log("[UmiRelay] Dispatching message to Clawdbot:", message.content, "from:", userId, "attachments:", attachments.length);
316
324
  try {
317
325
  const runtime = getPluginRuntime();
318
326
  const content = String(message.content || "");
319
327
  const sessionKey = `umi-relay:default:${userId}`;
328
+ const media = attachments.filter((att) => att.base64 && att.type === "image").map((att) => ({
329
+ type: "image",
330
+ mimeType: att.mimeType || "image/png",
331
+ data: att.base64,
332
+ name: att.name
333
+ }));
320
334
  runtime.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
321
335
  ctx: {
322
336
  channel: "umi-relay",
@@ -335,7 +349,9 @@ var umiRelayChannel = {
335
349
  ts: message.timestamp,
336
350
  metadata: {
337
351
  userId: message.userId,
338
- agentId: message.agentId
352
+ agentId: message.agentId,
353
+ attachments,
354
+ media: media.length > 0 ? media : void 0
339
355
  }
340
356
  },
341
357
  cfg: ctx.cfg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umimoney/clawdbot-relay-plugin",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Clawdbot plugin for connecting to UMI relay server",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",