chatccc 0.2.153 → 0.2.154
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/agent-stop-stuck.ts +0 -12
package/package.json
CHANGED
package/src/agent-stop-stuck.ts
CHANGED
|
@@ -10,9 +10,6 @@ export const AGENT_STOP_STUCK_PATH = "/api/agent/stop-stuck-loop";
|
|
|
10
10
|
|
|
11
11
|
const MAX_REQUEST_BYTES = 8 * 1024;
|
|
12
12
|
|
|
13
|
-
/** 已处理过 stop-stuck-loop 的 session,防止 agent 循环中反复调用 */
|
|
14
|
-
const processedSessions = new Set<string>();
|
|
15
|
-
|
|
16
13
|
function jsonReply(res: ServerResponse, status: number, data: unknown): void {
|
|
17
14
|
res.writeHead(status, { "Content-Type": "application/json; charset=utf-8" });
|
|
18
15
|
res.end(JSON.stringify(data));
|
|
@@ -68,19 +65,10 @@ export async function handleAgentStopStuckRequest(
|
|
|
68
65
|
|
|
69
66
|
const prompt = activePrompts.get(sessionId);
|
|
70
67
|
if (!prompt) {
|
|
71
|
-
// session 可能已被清理,清理去重记录
|
|
72
|
-
processedSessions.delete(sessionId);
|
|
73
68
|
jsonReply(res, 404, { error: "Session not found or not running" });
|
|
74
69
|
return true;
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
// 去重:同一 session 只处理一次,防止 agent 循环中反复调用
|
|
78
|
-
if (processedSessions.has(sessionId)) {
|
|
79
|
-
jsonReply(res, 200, { ok: true, deduplicated: true });
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
processedSessions.add(sessionId);
|
|
83
|
-
|
|
84
72
|
// 先发"卡住"提示消息给所有绑定的群聊
|
|
85
73
|
const chats = getChatsForSession(sessionId);
|
|
86
74
|
for (const chatId of chats) {
|