@ynhcj/xiaoyi-channel 0.0.1 → 0.0.2

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.
@@ -1,6 +1,5 @@
1
1
  import { resolveXYConfig } from "./config.js";
2
2
  import { getXYWebSocketManager } from "./client.js";
3
- import { getXYRuntime } from "./runtime.js";
4
3
  import { handleXYMessage } from "./bot.js";
5
4
  /**
6
5
  * Per-session serial queue that ensures messages from the same session are processed
@@ -30,9 +29,6 @@ export async function monitorXYProvider(opts = {}) {
30
29
  if (!cfg) {
31
30
  throw new Error("Config is required for XY monitor");
32
31
  }
33
- // Validate runtime early - fail fast if plugin not registered
34
- // Following feishu/monitor.account.ts pattern
35
- const core = getXYRuntime();
36
32
  const runtime = opts.runtime;
37
33
  const log = runtime?.log ?? console.log;
38
34
  const error = runtime?.error ?? console.error;
@@ -276,19 +276,24 @@ export class XYWebSocketManager extends EventEmitter {
276
276
  try {
277
277
  const messageStr = data.toString();
278
278
  const parsed = JSON.parse(messageStr);
279
+ // Log raw message
280
+ console.log(`[XY-${serverId}] Received message:`, JSON.stringify(parsed, null, 2));
279
281
  // Check if message is in direct A2A JSON-RPC format (server push)
280
282
  if (parsed.jsonrpc === "2.0") {
281
283
  // Direct A2A format
282
284
  const a2aRequest = parsed;
285
+ console.log(`[XY-${serverId}] Message type: Direct A2A JSON-RPC, method: ${a2aRequest.method}`);
283
286
  // Extract sessionId from params
284
287
  const sessionId = a2aRequest.params?.sessionId;
285
288
  if (!sessionId) {
286
- this.error(`Message missing sessionId from ${serverId}`);
289
+ console.error(`[XY-${serverId}] Message missing sessionId`);
287
290
  return;
288
291
  }
292
+ console.log(`[XY-${serverId}] Session ID: ${sessionId}`);
289
293
  // Bind session to this server if not already bound
290
294
  if (!sessionManager.isBound(sessionId)) {
291
295
  sessionManager.bind(sessionId, serverId);
296
+ console.log(`[XY-${serverId}] Bound session ${sessionId} to ${serverId}`);
292
297
  }
293
298
  // Emit message event
294
299
  this.emit("message", a2aRequest, sessionId, serverId);
@@ -296,22 +301,27 @@ export class XYWebSocketManager extends EventEmitter {
296
301
  }
297
302
  // Wrapped format (InboundWebSocketMessage)
298
303
  const inboundMsg = parsed;
304
+ console.log(`[XY-${serverId}] Message type: Wrapped, msgType: ${inboundMsg.msgType}`);
299
305
  // Skip heartbeat responses
300
306
  if (inboundMsg.msgType === "heartbeat" || inboundMsg.msgType === "data") {
307
+ console.log(`[XY-${serverId}] Skipping ${inboundMsg.msgType} message`);
301
308
  return;
302
309
  }
303
310
  // Parse msgDetail as A2AJsonRpcRequest
304
311
  const a2aRequest = JSON.parse(inboundMsg.msgDetail);
312
+ console.log(`[XY-${serverId}] Parsed A2A request, method: ${a2aRequest.method}`);
305
313
  // Bind session to this server if not already bound
306
314
  const sessionId = inboundMsg.sessionId;
307
315
  if (!sessionManager.isBound(sessionId)) {
308
316
  sessionManager.bind(sessionId, serverId);
317
+ console.log(`[XY-${serverId}] Bound session ${sessionId} to ${serverId}`);
309
318
  }
319
+ console.log(`[XY-${serverId}] Session ID: ${sessionId}`);
310
320
  // Emit message event
311
321
  this.emit("message", a2aRequest, sessionId, serverId);
312
322
  }
313
323
  catch (error) {
314
- this.error(`Failed to parse message from ${serverId}:`, error);
324
+ console.error(`[XY-${serverId}] Failed to parse message:`, error);
315
325
  }
316
326
  }
317
327
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,12 @@
49
49
  }
50
50
  },
51
51
  "peerDependencies": {
52
- "openclaw": "*"
52
+ "openclaw": ">=2026.3.1"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "openclaw": {
56
+ "optional": true
57
+ }
53
58
  },
54
59
  "dependencies": {
55
60
  "ws": "^8.14.2",
@@ -57,6 +62,7 @@
57
62
  "node-fetch": "^2.7.0"
58
63
  },
59
64
  "devDependencies": {
65
+ "openclaw": ">=2026.3.1",
60
66
  "@types/ws": "^8.5.8",
61
67
  "@types/uuid": "^9.0.5",
62
68
  "@types/node": "^20.8.0",