MCPcopy Create free account
hub / github.com/WJX20/claude-code / completeAgentTask

Function completeAgentTask

src/tasks/LocalAgentTask/LocalAgentTask.tsx:413–433  ·  view source on GitHub ↗
(result: AgentToolResult, setAppState: SetAppState)

Source from the content-addressed store, hash-verified

411 * Complete an agent task with result.
412 */
413export function completeAgentTask(result: AgentToolResult, setAppState: SetAppState): void {
414 const taskId = result.agentId;
415 updateTaskState<LocalAgentTaskState>(taskId, setAppState, task => {
416 if (task.status !== 'running') {
417 return task;
418 }
419 task.unregisterCleanup?.();
420 return {
421 ...task,
422 status: 'completed',
423 result,
424 endTime: Date.now(),
425 evictAfter: task.retain ? undefined : Date.now() + PANEL_GRACE_MS,
426 abortController: undefined,
427 unregisterCleanup: undefined,
428 selectedAgent: undefined
429 };
430 });
431 void evictTaskOutput(taskId);
432 // Note: Notification is sent by AgentTool via enqueueAgentNotification
433}
434
435/**
436 * Fail an agent task with error.

Callers

nothing calls this directly

Calls 2

evictTaskOutputFunction · 0.85
updateTaskStateFunction · 0.50

Tested by

no test coverage detected