@vrs-soft/wecom-aibot-mcp 2.3.0 → 2.3.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.
- package/dist/channel-server.js +3 -2
- package/dist/client.js +4 -1
- package/dist/http-server.d.ts +1 -0
- package/dist/http-server.js +6 -0
- package/package.json +1 -1
package/dist/channel-server.js
CHANGED
|
@@ -240,6 +240,7 @@ function connectSSE(ccId) {
|
|
|
240
240
|
chatid: message.chatid || '',
|
|
241
241
|
chattype: message.chattype || 'single',
|
|
242
242
|
cc_id: msg.ccId || '',
|
|
243
|
+
quote_content: message.quoteContent || '',
|
|
243
244
|
},
|
|
244
245
|
},
|
|
245
246
|
};
|
|
@@ -378,7 +379,7 @@ function registerChannelTools(server) {
|
|
|
378
379
|
agent_name,
|
|
379
380
|
cc_id,
|
|
380
381
|
robot_id,
|
|
381
|
-
project_dir,
|
|
382
|
+
project_dir: project_dir || process.cwd(),
|
|
382
383
|
mode,
|
|
383
384
|
auto_approve,
|
|
384
385
|
auto_approve_timeout,
|
|
@@ -422,7 +423,7 @@ function registerChannelTools(server) {
|
|
|
422
423
|
sseConnected = false;
|
|
423
424
|
logChannel('SSE disconnected', { cc_id });
|
|
424
425
|
}
|
|
425
|
-
return forwardToHttpMcp('exit_headless_mode', { cc_id, project_dir });
|
|
426
|
+
return forwardToHttpMcp('exit_headless_mode', { cc_id, project_dir: project_dir || process.cwd() });
|
|
426
427
|
});
|
|
427
428
|
// ============================================
|
|
428
429
|
// 工具 11: 从消息识别用户
|
package/dist/client.js
CHANGED
|
@@ -547,9 +547,12 @@ class WecomClient extends EventEmitter {
|
|
|
547
547
|
// 清理过期消息
|
|
548
548
|
cleanupMessages(maxAgeMs = 300000) {
|
|
549
549
|
const cutoff = Date.now() - maxAgeMs;
|
|
550
|
+
// 未解决的审批保留 15 分钟,防止用户在超时前点击时记录已被清理导致按钮失效
|
|
551
|
+
const pendingCutoff = Date.now() - 15 * 60 * 1000;
|
|
550
552
|
this.messages = this.messages.filter(m => m.timestamp > cutoff);
|
|
551
553
|
this.approvals.forEach((a, k) => {
|
|
552
|
-
|
|
554
|
+
const threshold = a.resolved ? cutoff : pendingCutoff;
|
|
555
|
+
if (a.timestamp < threshold)
|
|
553
556
|
this.approvals.delete(k);
|
|
554
557
|
});
|
|
555
558
|
// 清理过期的待发送消息
|
package/dist/http-server.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare function pushMessageToSSEClient(robotName: string, message: {
|
|
|
31
31
|
chatid: string;
|
|
32
32
|
chattype: 'single' | 'group';
|
|
33
33
|
timestamp: number;
|
|
34
|
+
quoteContent?: string;
|
|
34
35
|
}, targetCcId?: string): Promise<void>;
|
|
35
36
|
export interface ApprovalRequest {
|
|
36
37
|
tool_name: string;
|
package/dist/http-server.js
CHANGED
|
@@ -109,6 +109,7 @@ export async function pushMessageToSSEClient(robotName, message, targetCcId) {
|
|
|
109
109
|
chatid: message.chatid,
|
|
110
110
|
chattype: message.chattype,
|
|
111
111
|
time: new Date(message.timestamp).toISOString(),
|
|
112
|
+
quoteContent: message.quoteContent,
|
|
112
113
|
},
|
|
113
114
|
});
|
|
114
115
|
client.res.write(`event: message\ndata: ${data}\n\n`);
|
|
@@ -227,6 +228,7 @@ async function handleWecomMessage(msg) {
|
|
|
227
228
|
chatid: msg.chatid,
|
|
228
229
|
chattype: msg.chattype,
|
|
229
230
|
timestamp: msg.timestamp,
|
|
231
|
+
quoteContent: msg.quoteContent,
|
|
230
232
|
}, targetCcId);
|
|
231
233
|
return;
|
|
232
234
|
}
|
|
@@ -251,6 +253,7 @@ async function handleWecomMessage(msg) {
|
|
|
251
253
|
chatid: msg.chatid,
|
|
252
254
|
chattype: msg.chattype,
|
|
253
255
|
timestamp: msg.timestamp,
|
|
256
|
+
quoteContent: msg.quoteContent,
|
|
254
257
|
}, ccId);
|
|
255
258
|
return;
|
|
256
259
|
}
|
|
@@ -267,6 +270,7 @@ async function handleWecomMessage(msg) {
|
|
|
267
270
|
chatid: msg.chatid,
|
|
268
271
|
chattype: msg.chattype,
|
|
269
272
|
timestamp: msg.timestamp,
|
|
273
|
+
quoteContent: msg.quoteContent,
|
|
270
274
|
}, targetCcId);
|
|
271
275
|
return;
|
|
272
276
|
}
|
|
@@ -284,6 +288,7 @@ async function handleWecomMessage(msg) {
|
|
|
284
288
|
chatid: msg.chatid,
|
|
285
289
|
chattype: msg.chattype,
|
|
286
290
|
timestamp: msg.timestamp,
|
|
291
|
+
quoteContent: msg.quoteContent,
|
|
287
292
|
}, matchedCcId);
|
|
288
293
|
return;
|
|
289
294
|
}
|
|
@@ -383,6 +388,7 @@ async function handleWecomMessage(msg) {
|
|
|
383
388
|
chatid: msg.chatid,
|
|
384
389
|
chattype: msg.chattype,
|
|
385
390
|
timestamp: msg.timestamp,
|
|
391
|
+
quoteContent: msg.quoteContent,
|
|
386
392
|
}, matchedCcId);
|
|
387
393
|
}
|
|
388
394
|
else {
|