openclaw-elys 1.8.1 → 1.8.3

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.
@@ -46,10 +46,10 @@ export async function monitorElysProvider(opts) {
46
46
  let fullText = "";
47
47
  // Download inbound media (user-sent) to local temp files
48
48
  // OpenClaw expects local file paths in MediaPath/MediaUrl, not remote URLs
49
- const rawMediaUrls = cmd.mediaUrls?.length
50
- ? cmd.mediaUrls
51
- : cmd.mediaUrl
52
- ? [cmd.mediaUrl]
49
+ const rawMediaUrls = cmd.media_urls?.length
50
+ ? cmd.media_urls
51
+ : cmd.media_url
52
+ ? [cmd.media_url]
53
53
  : [];
54
54
  const downloadedPaths = [];
55
55
  const downloadedTypes = [];
@@ -57,7 +57,7 @@ export async function monitorElysProvider(opts) {
57
57
  try {
58
58
  const localPath = await downloadToTemp(url, log);
59
59
  downloadedPaths.push(localPath);
60
- downloadedTypes.push(cmd.mediaType ?? guessMediaType(url));
60
+ downloadedTypes.push(cmd.media_type ?? guessMediaType(url));
61
61
  }
62
62
  catch (err) {
63
63
  log(`[elys] failed to download media ${url}:`, err);
@@ -45,7 +45,7 @@ export declare class ElysDeviceMQTTClient {
45
45
  private flushDebounce;
46
46
  private startCommand;
47
47
  private processPendingCommands;
48
- /** Merge multiple buffered commands into one. Joins text args with newline. */
48
+ /** Merge multiple buffered commands into one. Joins text args with newline, collects all media. */
49
49
  private mergeCommands;
50
50
  private executeCommand;
51
51
  private cleanupDedup;
@@ -133,9 +133,9 @@ export class ElysDeviceMQTTClient {
133
133
  done,
134
134
  };
135
135
  if (media?.mediaUrl)
136
- msg.mediaUrl = media.mediaUrl;
136
+ msg.media_url = media.mediaUrl;
137
137
  if (media?.mediaUrls?.length)
138
- msg.mediaUrls = media.mediaUrls;
138
+ msg.media_urls = media.mediaUrls;
139
139
  this.publish(msg);
140
140
  }
141
141
  // ─── Inbound message pipeline: dedup → ack → debounce → abort → execute ───
@@ -208,7 +208,7 @@ export class ElysDeviceMQTTClient {
208
208
  this.log(`[elys] processing queued command ${merged.id}`);
209
209
  this.startCommand(merged);
210
210
  }
211
- /** Merge multiple buffered commands into one. Joins text args with newline. */
211
+ /** Merge multiple buffered commands into one. Joins text args with newline, collects all media. */
212
212
  mergeCommands(cmds) {
213
213
  if (cmds.length === 1)
214
214
  return cmds[0];
@@ -216,11 +216,25 @@ export class ElysDeviceMQTTClient {
216
216
  const texts = cmds
217
217
  .map((c) => c.args?.text ?? "")
218
218
  .filter(Boolean);
219
- if (texts.length > 1) {
220
- this.log(`[elys] debounce: merged ${cmds.length} commands`);
219
+ // Collect all media URLs from all commands
220
+ const allMediaUrls = [];
221
+ for (const c of cmds) {
222
+ if (c.media_urls?.length) {
223
+ allMediaUrls.push(...c.media_urls);
224
+ }
225
+ else if (c.media_url) {
226
+ allMediaUrls.push(c.media_url);
227
+ }
228
+ }
229
+ const mergedText = texts.length > 1 ? texts.join("\n") : texts[0] ?? "";
230
+ if (texts.length > 1 || allMediaUrls.length > 0) {
231
+ this.log(`[elys] debounce: merged ${cmds.length} commands (${texts.length} texts, ${allMediaUrls.length} media)`);
221
232
  return {
222
233
  ...last,
223
- args: { ...last.args, text: texts.join("\n") },
234
+ args: { ...last.args, ...(mergedText && { text: mergedText }) },
235
+ media_url: allMediaUrls[0] ?? last.media_url,
236
+ media_urls: allMediaUrls.length > 0 ? allMediaUrls : undefined,
237
+ media_type: last.media_type,
224
238
  };
225
239
  }
226
240
  // Can't merge non-text commands, use the latest one
@@ -25,9 +25,9 @@ export interface CommandMessage extends MQTTBaseMessage {
25
25
  command: string;
26
26
  args?: Record<string, unknown>;
27
27
  stream?: boolean;
28
- mediaUrl?: string;
29
- mediaUrls?: string[];
30
- mediaType?: string;
28
+ media_url?: string;
29
+ media_urls?: string[];
30
+ media_type?: string;
31
31
  }
32
32
  export interface AckMessage extends MQTTBaseMessage {
33
33
  type: "ack";
@@ -37,14 +37,14 @@ export interface StreamMessage extends MQTTBaseMessage {
37
37
  chunk: string;
38
38
  done: boolean;
39
39
  seq: number;
40
- mediaUrl?: string;
41
- mediaUrls?: string[];
40
+ media_url?: string;
41
+ media_urls?: string[];
42
42
  }
43
43
  export interface ResultMessage extends MQTTBaseMessage {
44
44
  type: "result";
45
45
  status: "success" | "error";
46
46
  result?: Record<string, unknown>;
47
47
  error?: string;
48
- mediaUrl?: string;
49
- mediaUrls?: string[];
48
+ media_url?: string;
49
+ media_urls?: string[];
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-elys",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "OpenClaw Elys channel plugin — connects to Elys App",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",