openclaw-xiaoyou 1.4.4 → 1.4.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-xiaoyou",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "type": "module",
5
5
  "description": "Xiaoyou channel plugin for OpenClaw — connects enterprise services via persistent outbound WebSocket",
6
6
  "openclaw": {
package/src/channel.ts CHANGED
@@ -140,6 +140,7 @@ export const xiayouPlugin = {
140
140
  const conversationId = msg.conversationId;
141
141
  const inboundMessageId = msg.messageId;
142
142
  const text = msg.text ?? "";
143
+ const metadata = msg.metadata ?? undefined;
143
144
 
144
145
  // 记录最后活跃的 conversationId,供 cron delivery 兜底使用
145
146
  _lastConversationId = conversationId;
@@ -214,6 +215,7 @@ export const xiayouPlugin = {
214
215
  replyToMessageId: inboundMessageId,
215
216
  senderId,
216
217
  text: textToSend,
218
+ ...(metadata ? { metadata } : {}),
217
219
  streamStatus: "chunk",
218
220
  seq: chunkSeq++,
219
221
  timestamp: Date.now(),
@@ -231,6 +233,7 @@ export const xiayouPlugin = {
231
233
  replyToMessageId: inboundMessageId,
232
234
  senderId,
233
235
  text: fullText,
236
+ ...(metadata ? { metadata } : {}),
234
237
  streamStatus: "end",
235
238
  timestamp: Date.now(),
236
239
  });
@@ -249,6 +252,7 @@ export const xiayouPlugin = {
249
252
  replyToMessageId: inboundMessageId,
250
253
  senderId,
251
254
  text: fullText,
255
+ ...(metadata ? { metadata } : {}),
252
256
  streamStatus: "end",
253
257
  timestamp: Date.now(),
254
258
  });
@@ -317,7 +321,6 @@ export const xiayouPlugin = {
317
321
  messageId: `xiaoyou-${Date.now()}`,
318
322
  replyToMessageId: replyToId,
319
323
  senderId: to,
320
- ...(replyToId ? {} : { source: "scheduled_task" as const }),
321
324
  text: text,
322
325
  timestamp: Date.now(),
323
326
  };
@@ -340,7 +343,6 @@ export const xiayouPlugin = {
340
343
  messageId: `xiaoyou-${Date.now()}`,
341
344
  replyToMessageId: replyToId,
342
345
  senderId: to,
343
- ...(replyToId ? {} : { source: "scheduled_task" as const }),
344
346
  text: text ?? "",
345
347
  mediaUrls: mediaUrl ? [mediaUrl] : [],
346
348
  timestamp: Date.now(),
package/src/types.ts CHANGED
@@ -65,6 +65,8 @@ export type OutboundReply = {
65
65
  mediaUrls?: string[];
66
66
  agentId?: string;
67
67
  timestamp: number;
68
+ /** 业务元数据,透传企业服务端发来的自定义字段 */
69
+ metadata?: Record<string, unknown>;
68
70
  /** 消息来源标识:scheduled_task=定时任务推送,不传=正常对话回复 */
69
71
  source?: "scheduled_task";
70
72
  /** 流式标记:chunk=增量片段, end=流结束, 不传=一次性完整回复 */