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

Function updateTaskState

src/utils/swarm/inProcessRunner.ts:520–542  ·  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

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

Callers 1

runInProcessTeammateFunction · 0.70

Calls 1

setAppStateFunction · 0.50

Tested by

no test coverage detected