chatccc 0.2.166 → 0.2.167
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 +12 -0
package/package.json
CHANGED
package/src/agent-stop-stuck.ts
CHANGED
|
@@ -107,6 +107,18 @@ export async function handleAgentStopStuckRequest(
|
|
|
107
107
|
|
|
108
108
|
// 先关闭底层 SDK session,终止 CLI 子进程,然后再 abort 清理 adapter 层
|
|
109
109
|
prompt.closeSession?.();
|
|
110
|
+
|
|
111
|
+
// 强制杀死 CLI 子进程。controller.abort() 只在 for-await 收到下一条
|
|
112
|
+
// stream 消息时才被检测到——如果 agent 陷入无输出的计算循环,abort 信号
|
|
113
|
+
// 永远不会生效;SDK 的 session.close() 也不保证立即终止子进程。
|
|
114
|
+
if (prompt.processPid !== undefined) {
|
|
115
|
+
try {
|
|
116
|
+
process.kill(prompt.processPid);
|
|
117
|
+
} catch {
|
|
118
|
+
// 进程可能已退出,忽略错误
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
110
122
|
// 不设 stopped 标记 → finally block 写 "done" → 卡片正常结束
|
|
111
123
|
prompt.controller.abort();
|
|
112
124
|
|