chatccc 0.2.151 → 0.2.152
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
|
@@ -128,6 +128,10 @@ export interface ToolPromptOptions {
|
|
|
128
128
|
onProcessStart?: (info: ToolProcessInfo) => void;
|
|
129
129
|
/** Called when the adapter leaves the prompt process scope normally or by abort. */
|
|
130
130
|
onProcessExit?: (info: ToolProcessInfo) => void;
|
|
131
|
+
/** Called when the adapter creates an SDK session internally.
|
|
132
|
+
* The callback receives a close function that terminates the underlying
|
|
133
|
+
* subprocess. Used by stop-stuck-loop to kill the CLI process immediately. */
|
|
134
|
+
onSessionCreated?: (closeSession: () => void) => void;
|
|
131
135
|
}
|
|
132
136
|
|
|
133
137
|
// ---------------------------------------------------------------------------
|
|
@@ -490,6 +490,8 @@ class ClaudeAdapter implements ToolAdapter {
|
|
|
490
490
|
})),
|
|
491
491
|
);
|
|
492
492
|
|
|
493
|
+
options?.onSessionCreated?.(() => session.close());
|
|
494
|
+
|
|
493
495
|
try {
|
|
494
496
|
await session.send(buildClaudePromptText(userText, undefined, sessionId));
|
|
495
497
|
for await (const raw of session.stream()) {
|
package/src/agent-stop-stuck.ts
CHANGED
|
@@ -73,6 +73,10 @@ export interface ActivePrompt {
|
|
|
73
73
|
abnormalExitNotified?: boolean;
|
|
74
74
|
/** Set when the resource monitor detects CPU + memory unchanged for 3 minutes. */
|
|
75
75
|
resourceStuck?: boolean;
|
|
76
|
+
/** Adapter-provided callback to close the underlying SDK session / subprocess.
|
|
77
|
+
* Called by stop-stuck-loop before controller.abort() to terminate the CLI
|
|
78
|
+
* process immediately, rather than waiting for the async generator to unblock. */
|
|
79
|
+
closeSession?: () => void;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
export const activePrompts = new Map<string, ActivePrompt>();
|
package/src/session.ts
CHANGED
|
@@ -1110,6 +1110,10 @@ export async function runAgentSession(
|
|
|
1110
1110
|
clearPromptProcessMonitor(sessionId);
|
|
1111
1111
|
if (exitInfo.pid !== undefined) unregisterProcess(exitInfo.pid);
|
|
1112
1112
|
},
|
|
1113
|
+
onSessionCreated: (closeSession) => {
|
|
1114
|
+
const prompt = activePrompts.get(sessionId);
|
|
1115
|
+
if (prompt) prompt.closeSession = closeSession;
|
|
1116
|
+
},
|
|
1113
1117
|
})) {
|
|
1114
1118
|
for (const block of unifiedMsg.blocks) {
|
|
1115
1119
|
accumulateBlockContent(block, state, toolCallMap);
|