openclaw-xiaoyou 1.3.7 → 1.3.9

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/index.ts CHANGED
@@ -47,9 +47,12 @@ const plugin = {
47
47
  console.error("--to <conversationId> is required");
48
48
  return;
49
49
  }
50
- const result = await xiayouPlugin.outbound.send({
50
+ const result = await xiayouPlugin.outbound.sendText({
51
51
  to: opts.to,
52
- payload: { kind: "text", text: opts.text },
52
+ text: opts.text,
53
+ accountId: "default",
54
+ replyToId: undefined,
55
+ cfg: undefined,
53
56
  });
54
57
  console.log(JSON.stringify(result, null, 2));
55
58
  });
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "id": "xiaoyou",
3
3
  "channels": ["xiaoyou"],
4
+ "capabilities": {
5
+ "proactiveMessaging": true,
6
+ "cronJobs": true
7
+ },
4
8
  "configSchema": {
5
9
  "type": "object",
10
+ "additionalProperties": true,
6
11
  "properties": {
7
12
  "wsUrl": {
8
13
  "type": "string",
9
14
  "title": "WebSocket URL",
10
- "description": "企业 WebSocket 服务地址",
11
- "default": "ws://aiws-sim.haiersmarthomes.com:11055/xiaoyou/claw"
15
+ "description": "企业 WebSocket 服务地址"
12
16
  },
13
17
  "authToken": {
14
18
  "type": "string",
15
19
  "title": "Auth Token",
16
- "description": "企业服务认证 Token",
17
- "format": "password"
20
+ "description": "企业服务认证 Token"
18
21
  },
19
22
  "dmSecurity": {
20
23
  "type": "string",
@@ -54,7 +57,6 @@
54
57
  "description": "心跳超时(毫秒)",
55
58
  "default": 10000
56
59
  }
57
- },
58
- "required": ["wsUrl", "authToken"]
60
+ }
59
61
  }
60
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-xiaoyou",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
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
@@ -273,34 +273,48 @@ export const xiayouPlugin = {
273
273
  },
274
274
  },
275
275
 
276
- // ── Outbound 出站 ──────────────────────────────────
276
+ // ── Outbound 出站(符合 ChannelPluginOutbound 接口)──────
277
277
  outbound: {
278
- send: async ({ to, payload }: any) => {
278
+ deliveryMode: "direct" as const,
279
+ textChunkLimit: 2000,
280
+
281
+ sendText: async ({ to, text, accountId, replyToId, cfg }: any) => {
279
282
  if (!_client || !_client.isConnected()) {
280
- return { ok: false, error: "xiaoyou: not connected" };
283
+ return { channel: "xiaoyou", error: new Error("xiaoyou: not connected") };
281
284
  }
282
285
 
283
- const baseReply = {
286
+ const reply = {
284
287
  type: "reply" as const,
285
- conversationId: to,
288
+ conversationId: to || "cron-delivery",
286
289
  messageId: `xiaoyou-${Date.now()}`,
287
- agentId: payload.agentId,
290
+ replyToMessageId: replyToId,
291
+ text: text,
288
292
  timestamp: Date.now(),
289
293
  };
290
294
 
291
- if (payload.kind === "text") {
292
- _client.sendReply({ ...baseReply, text: payload.text });
293
- return { ok: true };
294
- }
295
- if (payload.kind === "image" || payload.kind === "file") {
296
- _client.sendReply({
297
- ...baseReply,
298
- text: payload.caption ?? "",
299
- mediaUrls: [payload.url ?? payload.filePath],
300
- });
301
- return { ok: true };
295
+ _client.sendReply(reply);
296
+ console.log(`[xiaoyou][outbound] sendText to=${to}, text=${text?.substring(0, 50)}`);
297
+ return { channel: "xiaoyou", messageId: reply.messageId };
298
+ },
299
+
300
+ sendMedia: async ({ to, text, mediaUrl, accountId, replyToId, cfg }: any) => {
301
+ if (!_client || !_client.isConnected()) {
302
+ return { channel: "xiaoyou", error: new Error("xiaoyou: not connected") };
302
303
  }
303
- return { ok: false, error: `Unsupported payload kind: ${payload.kind}` };
304
+
305
+ const reply = {
306
+ type: "reply" as const,
307
+ conversationId: to || "cron-delivery",
308
+ messageId: `xiaoyou-${Date.now()}`,
309
+ replyToMessageId: replyToId,
310
+ text: text ?? "",
311
+ mediaUrls: mediaUrl ? [mediaUrl] : [],
312
+ timestamp: Date.now(),
313
+ };
314
+
315
+ _client.sendReply(reply);
316
+ console.log(`[xiaoyou][outbound] sendMedia to=${to}`);
317
+ return { channel: "xiaoyou", messageId: reply.messageId };
304
318
  },
305
319
  },
306
320