chatccc 0.2.141 → 0.2.143
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
CHANGED
package/src/agent-stop-stuck.ts
CHANGED
|
@@ -27,9 +27,9 @@ export async function handleAgentStopStuckRequest(
|
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
let body: { session_id?: string };
|
|
30
|
+
let body: { session_id?: string; final_reply?: string };
|
|
31
31
|
try {
|
|
32
|
-
body = await readUtf8JsonBody<{ session_id?: string }>(req, MAX_REQUEST_BYTES);
|
|
32
|
+
body = await readUtf8JsonBody<{ session_id?: string; final_reply?: string }>(req, MAX_REQUEST_BYTES);
|
|
33
33
|
} catch (err) {
|
|
34
34
|
jsonReply(res, 400, { error: `Invalid request body: ${(err as Error).message}` });
|
|
35
35
|
return true;
|
|
@@ -59,6 +59,8 @@ export async function handleAgentStopStuckRequest(
|
|
|
59
59
|
// 丢弃缓存队列中的消息
|
|
60
60
|
cancelQueuedMessage(sessionId);
|
|
61
61
|
|
|
62
|
+
const finalReply = typeof body?.final_reply === "string" ? body.final_reply.trim() : "";
|
|
63
|
+
|
|
62
64
|
// fire-and-forget:立即把 stream-state 标为 done(而非 stopped),
|
|
63
65
|
// 让 display loop 以"正常完成"而非"已停止"来渲染卡片和最终回复。
|
|
64
66
|
// 不设 prompt.stopped = true,这样 runAgentSession 的 finally 也会写 "done"。
|
|
@@ -70,6 +72,7 @@ export async function handleAgentStopStuckRequest(
|
|
|
70
72
|
await writeStreamState({
|
|
71
73
|
...current,
|
|
72
74
|
status: "done",
|
|
75
|
+
finalReply: finalReply ? current.finalReply + "\n\n" + finalReply : current.finalReply,
|
|
73
76
|
updatedAt: Date.now(),
|
|
74
77
|
});
|
|
75
78
|
} catch (err) {
|
|
@@ -82,7 +85,7 @@ export async function handleAgentStopStuckRequest(
|
|
|
82
85
|
// 不设 stopped 标记 → finally block 写 "done" → 卡片正常结束
|
|
83
86
|
prompt.controller.abort();
|
|
84
87
|
|
|
85
|
-
console.log(`[${ts()}] [STUCK-LOOP] Session ${sessionId} aborted as done (agent detected stuck loop)`);
|
|
88
|
+
console.log(`[${ts()}] [STUCK-LOOP] Session ${sessionId} aborted as done (agent detected stuck loop, final_reply=${finalReply ? "yes" : "no"})`);
|
|
86
89
|
|
|
87
90
|
jsonReply(res, 200, { ok: true });
|
|
88
91
|
return true;
|
package/src/index.ts
CHANGED
|
@@ -79,6 +79,7 @@ import { setMessageHandler } from "./sim-store.ts";
|
|
|
79
79
|
import { handleAgentImageRequest } from "./agent-image-rpc.ts";
|
|
80
80
|
import { handleAgentFileRequest } from "./agent-file-rpc.ts";
|
|
81
81
|
import { handleAgentStopStuckRequest } from "./agent-stop-stuck.ts";
|
|
82
|
+
import { applyPrivacy } from "./privacy.ts";
|
|
82
83
|
import {
|
|
83
84
|
createCardKitCard,
|
|
84
85
|
sendCardKitMessage,
|
|
@@ -145,13 +146,13 @@ function createFeishuAdapter(): PlatformAdapter {
|
|
|
145
146
|
|
|
146
147
|
// ---- 进度展示(CardKit 委托) ----
|
|
147
148
|
async cardCreate(cardJson) {
|
|
148
|
-
return createCardKitCard(await auth(), cardJson);
|
|
149
|
+
return createCardKitCard(await auth(), applyPrivacy(cardJson));
|
|
149
150
|
},
|
|
150
151
|
async cardSend(chatId, cardId) {
|
|
151
152
|
return sendCardKitMessage(await auth(), chatId, cardId);
|
|
152
153
|
},
|
|
153
154
|
async cardUpdate(cardId, cardJson, sequence) {
|
|
154
|
-
return updateCardKitCard(await auth(), cardId, cardJson, sequence);
|
|
155
|
+
return updateCardKitCard(await auth(), cardId, applyPrivacy(cardJson), sequence);
|
|
155
156
|
},
|
|
156
157
|
};
|
|
157
158
|
}
|