@vui-design/openclaw-plugin-feishu-progress 0.2.2 → 0.2.3
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 +1 -1
- package/src/index.ts +6 -4
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -47,34 +47,36 @@ export default {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
// ── 1. 收到用户消息时,记录当前会话对应的飞书 chat_id ────────────────────
|
|
50
|
-
// ctx: PluginHookMessageContext → 有 channelId / accountId / conversationId,无 sessionKey
|
|
51
50
|
api.on('message_received', async (_event: any, ctx: any) => {
|
|
51
|
+
api.logger.info(`[feishu-progress][DEBUG] message_received: channelId=${ctx.channelId} accountId=${ctx.accountId} conversationId=${ctx.conversationId}`);
|
|
52
52
|
if (ctx.channelId !== 'feishu') return;
|
|
53
53
|
if (!ctx.conversationId) return;
|
|
54
54
|
const key = ctx.accountId ?? 'default';
|
|
55
55
|
sessionChatMap.set(key, ctx.conversationId);
|
|
56
|
+
api.logger.info(`[feishu-progress][DEBUG] stored: key=${key} chatId=${ctx.conversationId}`);
|
|
56
57
|
});
|
|
57
58
|
|
|
58
59
|
// ── 2. 每次工具调用前,自动推送进度到飞书 ──────────────────────────────
|
|
59
|
-
// ctx: PluginHookToolContext → 有 agentId / sessionKey / runId,无 conversationId
|
|
60
|
-
// agentId 与 message_received 的 accountId 通过 bindings 对应,用作关联 key
|
|
61
60
|
api.on('before_tool_call', async (event: any, ctx: any) => {
|
|
61
|
+
api.logger.info(`[feishu-progress][DEBUG] before_tool_call: tool=${event.toolName} agentId=${ctx.agentId} sessionKey=${ctx.sessionKey}`);
|
|
62
62
|
const key = ctx.agentId ?? ctx.sessionKey ?? 'default';
|
|
63
63
|
const chatId = sessionChatMap.get(key);
|
|
64
|
+
api.logger.info(`[feishu-progress][DEBUG] lookup: key=${key} chatId=${chatId} mapSize=${sessionChatMap.size}`);
|
|
64
65
|
if (!chatId) return;
|
|
65
66
|
|
|
66
67
|
const label = toolLabel(event.toolName);
|
|
67
68
|
try {
|
|
68
69
|
await client.sendText(chatId, `🔧 正在执行:${label}`);
|
|
70
|
+
api.logger.info(`[feishu-progress][DEBUG] sendText OK: chatId=${chatId} label=${label}`);
|
|
69
71
|
} catch (err: any) {
|
|
70
72
|
api.logger?.warn(`[feishu-progress] 推送失败: ${err?.message}`);
|
|
71
73
|
}
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
// ── 3. 任务结束后清理 session 映射 ───────────────────────────────────────
|
|
75
|
-
// ctx: PluginHookAgentContext → 有 agentId / sessionKey
|
|
76
77
|
api.on('agent_end', async (_event: any, ctx: any) => {
|
|
77
78
|
const key = ctx.agentId ?? ctx.sessionKey ?? 'default';
|
|
79
|
+
api.logger.info(`[feishu-progress][DEBUG] agent_end: key=${key}`);
|
|
78
80
|
sessionChatMap.delete(key);
|
|
79
81
|
});
|
|
80
82
|
},
|