chatccc 0.2.167 → 0.2.168
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/session.ts +7 -0
package/package.json
CHANGED
package/src/session.ts
CHANGED
|
@@ -1605,6 +1605,13 @@ export function stopSession(sessionId: string): boolean {
|
|
|
1605
1605
|
clearPromptProcessMonitor(sessionId);
|
|
1606
1606
|
cancelQueuedMessage(sessionId);
|
|
1607
1607
|
prompt.controller.abort();
|
|
1608
|
+
|
|
1609
|
+
// 强制杀死 CLI 子进程。controller.abort() 只在 for-await 收到下一条
|
|
1610
|
+
// stream 消息时才被检测到——如果 agent 陷入无输出的计算循环,abort 信号
|
|
1611
|
+
// 永远不会生效。直接 process.kill 让 stdout/stderr 管道关闭,stream 立即结束。
|
|
1612
|
+
if (prompt.processPid !== undefined) {
|
|
1613
|
+
try { process.kill(prompt.processPid); } catch { /* 进程可能已退出 */ }
|
|
1614
|
+
}
|
|
1608
1615
|
console.log(`[${ts()}] [STOP] Session ${sessionId} aborted`);
|
|
1609
1616
|
|
|
1610
1617
|
// fire-and-forget:立刻把 stream-state.status 改成 stopped,
|