@ynhcj/xiaoyi-channel 0.0.45-beta → 0.0.46-beta

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.
Files changed (2) hide show
  1. package/dist/src/bot.js +14 -12
  2. package/package.json +1 -1
package/dist/src/bot.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { getXYRuntime } from "./runtime.js";
2
2
  import { createXYReplyDispatcher } from "./reply-dispatcher.js";
3
3
  import { parseA2AMessage, extractTextFromParts, extractFileParts, extractPushId, extractTriggerData } from "./parser.js";
4
+ import { downloadFilesFromParts } from "./file-download.js";
4
5
  import { resolveXYConfig } from "./config.js";
5
6
  import { sendStatusUpdate, sendClearContextResponse, sendTasksCancelResponse, sendA2AResponse } from "./formatter.js";
6
7
  import { registerSession, unregisterSession, runWithSessionContext } from "./tools/session-manager.js";
@@ -172,9 +173,9 @@ export async function handleXYMessage(params) {
172
173
  // Extract text and files from parts
173
174
  const text = extractTextFromParts(parsed.parts);
174
175
  const fileParts = extractFileParts(parsed.parts);
175
- // Build media payload directly from file URIs (openclaw can download them)
176
- // No need to download files locally - pass URIs directly to openclaw
177
- const mediaPayload = buildXYMediaPayload(fileParts);
176
+ // Download files to local disk
177
+ const downloadedFiles = await downloadFilesFromParts(fileParts);
178
+ const mediaPayload = buildXYMediaPayload(downloadedFiles);
178
179
  // Resolve envelope format options (following feishu pattern)
179
180
  const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(cfg);
180
181
  // Build message body with speaker prefix (following feishu pattern)
@@ -318,18 +319,19 @@ export async function handleXYMessage(params) {
318
319
  /**
319
320
  * Build media payload for inbound context.
320
321
  * Following feishu pattern: buildFeishuMediaPayload().
321
- * Uses remote URIs directly - openclaw will download them.
322
+ *
323
+ * @param mediaList - Downloaded files with local paths
322
324
  */
323
- function buildXYMediaPayload(fileParts) {
324
- const first = fileParts[0];
325
- const uris = fileParts.map((file) => file.uri);
326
- const mediaTypes = fileParts.map((file) => file.mimeType).filter(Boolean);
325
+ function buildXYMediaPayload(mediaList) {
326
+ const first = mediaList[0];
327
+ const mediaPaths = mediaList.map((media) => media.path);
328
+ const mediaTypes = mediaList.map((media) => media.mimeType).filter(Boolean);
327
329
  return {
328
- MediaPath: first?.uri,
330
+ MediaPath: first?.path,
329
331
  MediaType: first?.mimeType,
330
- MediaUrl: first?.uri,
331
- MediaPaths: uris.length > 0 ? uris : undefined,
332
- MediaUrls: uris.length > 0 ? uris : undefined,
332
+ MediaUrl: first?.path,
333
+ MediaPaths: mediaPaths.length > 0 ? mediaPaths : undefined,
334
+ MediaUrls: mediaPaths.length > 0 ? mediaPaths : undefined,
333
335
  MediaTypes: mediaTypes.length > 0 ? mediaTypes : undefined,
334
336
  };
335
337
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.45-beta",
3
+ "version": "0.0.46-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",