chatccc 0.2.158 → 0.2.159
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/orchestrator.ts +6 -28
package/package.json
CHANGED
package/src/orchestrator.ts
CHANGED
|
@@ -78,7 +78,6 @@ import {
|
|
|
78
78
|
cancelQueuedMessage,
|
|
79
79
|
} from "./session-chat-binding.ts";
|
|
80
80
|
import { getTenantAccessToken, sendPostMessage } from "./feishu-platform.ts";
|
|
81
|
-
import { readStreamState } from "./stream-state.ts";
|
|
82
81
|
export { type PlatformAdapter } from "./platform-adapter.ts";
|
|
83
82
|
import type { PlatformAdapter } from "./platform-adapter.ts";
|
|
84
83
|
|
|
@@ -594,12 +593,12 @@ export async function handleCommand(
|
|
|
594
593
|
|
|
595
594
|
if (sessionId && descriptionTool && toolLabel) {
|
|
596
595
|
// 有会话上下文 — 路由到命令处理或 prompt
|
|
597
|
-
logTrace(tid, "BRANCH", { sessionId, tool: descriptionTool });
|
|
598
|
-
const routeKind = textLower.startsWith("/") ? "command" : "prompt";
|
|
599
|
-
const chatKind = chatType === "p2p" ? "p2p chat" : "session group";
|
|
600
|
-
console.log(
|
|
601
|
-
`[${ts()}] [ROUTE] ${toolLabel} ${chatKind} ${routeKind} detected, session=${sessionId} tool=${descriptionTool}`,
|
|
602
|
-
);
|
|
596
|
+
logTrace(tid, "BRANCH", { sessionId, tool: descriptionTool });
|
|
597
|
+
const routeKind = textLower.startsWith("/") ? "command" : "prompt";
|
|
598
|
+
const chatKind = chatType === "p2p" ? "p2p chat" : "session group";
|
|
599
|
+
console.log(
|
|
600
|
+
`[${ts()}] [ROUTE] ${toolLabel} ${chatKind} ${routeKind} detected, session=${sessionId} tool=${descriptionTool}`,
|
|
601
|
+
);
|
|
603
602
|
|
|
604
603
|
if (
|
|
605
604
|
chatType !== "p2p" &&
|
|
@@ -1231,27 +1230,6 @@ export async function handleCommand(
|
|
|
1231
1230
|
await platform.sendText(chatId, "生成中...").catch(() => {});
|
|
1232
1231
|
}
|
|
1233
1232
|
|
|
1234
|
-
// 检查 session 是否被 stop-stuck-loop 标记为卡住,是则创建新 session
|
|
1235
|
-
const stuckState = await readStreamState(sessionId);
|
|
1236
|
-
if (stuckState?.stuckAt) {
|
|
1237
|
-
try {
|
|
1238
|
-
const init = await initClaudeSession(descriptionTool, undefined, chatId);
|
|
1239
|
-
const newSessionId = init.sessionId;
|
|
1240
|
-
unbindChatFromSession(sessionId, chatId);
|
|
1241
|
-
bindChatToSession(newSessionId, chatId);
|
|
1242
|
-
await recordSessionRegistry({
|
|
1243
|
-
chatId,
|
|
1244
|
-
sessionId: newSessionId,
|
|
1245
|
-
tool: descriptionTool,
|
|
1246
|
-
chatName: sessionChatName(text.slice(0, 10), init.cwd),
|
|
1247
|
-
}).catch(() => {});
|
|
1248
|
-
console.log(`[${ts()}] [STUCK-REDIRECT] Session ${sessionId} was stuck, created new session ${newSessionId}`);
|
|
1249
|
-
sessionId = newSessionId;
|
|
1250
|
-
} catch (err) {
|
|
1251
|
-
console.warn(`[${ts()}] [STUCK-REDIRECT] Failed to create new session: ${(err as Error).message}`);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
1233
|
try {
|
|
1256
1234
|
logTrace(tid, "RESUME", { sessionId, tool: descriptionTool });
|
|
1257
1235
|
await resumeAndPrompt(
|