MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / killAsyncAgent

Function killAsyncAgent

src/tasks/LocalAgentTask/LocalAgentTask.tsx:338–360  ·  view source on GitHub ↗
(taskId: string, setAppState: SetAppState)

Source from the content-addressed store, hash-verified

336 * Kill an agent task. No-op if already killed/completed.
337 */
338export function killAsyncAgent(taskId: string, setAppState: SetAppState): void {
339 let killed = false;
340 updateTaskState<LocalAgentTaskState>(taskId, setAppState, task => {
341 if (task.status !== 'running') {
342 return task;
343 }
344 killed = true;
345 task.abortController?.abort();
346 task.unregisterCleanup?.();
347 return {
348 ...task,
349 status: 'killed',
350 endTime: Date.now(),
351 evictAfter: task.retain ? undefined : Date.now() + PANEL_GRACE_MS,
352 abortController: undefined,
353 unregisterCleanup: undefined,
354 selectedAgent: undefined,
355 };
356 });
357 if (killed) {
358 void evictTaskOutput(taskId);
359 }
360}
361
362/**
363 * Kill all running agent tasks.

Callers 7

runAsyncAgentLifecycleFunction · 0.85
callFunction · 0.85
killFunction · 0.85
killAllRunningAgentTasksFunction · 0.85
registerAsyncAgentFunction · 0.85
registerAgentForegroundFunction · 0.85

Calls 4

evictTaskOutputFunction · 0.85
nowMethod · 0.80
abortMethod · 0.65
updateTaskStateFunction · 0.50

Tested by

no test coverage detected