MCPcopy Index your code
hub / github.com/codeaashu/claude-code / findAvailableTask

Function findAvailableTask

src/utils/swarm/inProcessRunner.ts:595–605  ·  view source on GitHub ↗

* Find an available task from the team's task list. * A task is available if it's pending, has no owner, and is not blocked.

(tasks: Task[])

Source from the content-addressed store, hash-verified

593 * A task is available if it's pending, has no owner, and is not blocked.
594 */
595function findAvailableTask(tasks: Task[]): Task | undefined {
596 const unresolvedTaskIds = new Set(
597 tasks.filter(t => t.status !== 'completed').map(t => t.id),
598 )
599
600 return tasks.find(task => {
601 if (task.status !== 'pending') return false
602 if (task.owner) return false
603 return task.blockedBy.every(id => !unresolvedTaskIds.has(id))
604 })
605}
606
607/**
608 * Format a task as a prompt for the teammate to work on.

Callers 1

tryClaimNextTaskFunction · 0.70

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected