xiaozuoassistant 0.2.22 → 0.2.24

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.
@@ -57,32 +57,37 @@ export class FeishuChannel extends BaseChannel {
57
57
  });
58
58
  // Start WebSocket client
59
59
  console.log(`Starting WebSocket client for Feishu Bot: ${name}`);
60
+ // MUST capture botName and client references within this loop closure to prevent overriding
61
+ const botName = name;
60
62
  await wsClient.start({
61
- eventDispatcher: new lark.EventDispatcher({}).register({
63
+ eventDispatcher: new lark.EventDispatcher({
64
+ encryptKey: botConfig.encryptKey || '',
65
+ verificationToken: botConfig.verificationToken || ''
66
+ }).register({
62
67
  'im.message.receive_v1': async (data) => {
63
- console.log(`[Feishu-${name}] Received message event:`, data);
68
+ console.log(`[Feishu-${botName}] Received message event:`, data);
64
69
  const event = data.message;
65
70
  const sender = data.sender;
66
71
  if (!event || !sender) {
67
- console.log(`[Feishu-${name}] Invalid event structure:`, data);
72
+ console.log(`[Feishu-${botName}] Invalid event structure:`, data);
68
73
  return;
69
74
  }
70
75
  // Ignore bot messages
71
76
  if (sender.sender_type !== 'user') {
72
- console.log(`[Feishu-${name}] Ignoring bot message`);
77
+ console.log(`[Feishu-${botName}] Ignoring bot message`);
73
78
  return;
74
79
  }
75
80
  try {
76
81
  const content = JSON.parse(event.content).text;
77
- console.log(`[Feishu-${name}] Received message: ${content}`);
82
+ console.log(`[Feishu-${botName}] Received message: ${content}`);
78
83
  // Use chat_id for group chats, open_id/user_id for p2p?
79
84
  // Actually message.chat_id is universal for where the message comes from.
80
- const sessionId = `feishu:${name}:${event.chat_id}`;
81
- console.log(`[Feishu-${name}] Emitting message with sessionId: ${sessionId}`);
85
+ const sessionId = `feishu:${botName}:${event.chat_id}`;
86
+ console.log(`[Feishu-${botName}] Emitting message with sessionId: ${sessionId}`);
82
87
  this.emitMessage(sessionId, content);
83
88
  }
84
89
  catch (e) {
85
- console.error(`[Feishu-${name}] Failed to parse message content:`, e);
90
+ console.error(`[Feishu-${botName}] Failed to parse message content:`, e);
86
91
  }
87
92
  }
88
93
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaozuoassistant",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "description": "A local-first personal AI assistant with multi-channel support and enhanced memory.",
5
5
  "author": "mantle.lau",
6
6
  "license": "MIT",