MCPcopy Create free account
hub / github.com/freecodexyz/free-code / updateTaskState

Function updateTaskState

src/utils/swarm/inProcessRunner.ts:519–541  ·  view source on GitHub ↗

* Updates task state in AppState.

(
  taskId: string,
  updater: (task: InProcessTeammateTaskState) => InProcessTeammateTaskState,
  setAppState: SetAppStateFn,
)

Source from the content-addressed store, hash-verified

517 * Updates task state in AppState.
518 */
519function updateTaskState(
520 taskId: string,
521 updater: (task: InProcessTeammateTaskState) => InProcessTeammateTaskState,
522 setAppState: SetAppStateFn,
523): void {
524 setAppState(prev => {
525 const task = prev.tasks[taskId]
526 if (!task || task.type !== 'in_process_teammate') {
527 return prev
528 }
529 const updated = updater(task)
530 if (updated === task) {
531 return prev
532 }
533 return {
534 ...prev,
535 tasks: {
536 ...prev.tasks,
537 [taskId]: updated,
538 },
539 }
540 })
541}
542
543/**
544 * Sends a message to the leader's file-based mailbox.

Callers 1

runInProcessTeammateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected