MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / finalize

Function finalize

projects/openade-module/src/node.ts:830–851  ·  view source on GitHub ↗
(status: "completed" | "failed" | "stopped", error?: string)

Source from the content-addressed store, hash-verified

828 let finalized = false
829
830 const finalize = async (status: "completed" | "failed" | "stopped", error?: string) => {
831 if (finalized) return
832 finalized = true
833
834 if (status === "completed") {
835 await writer.completeActionEvent({ taskId, eventId, success: terminalSuccess })
836 const runtime = server?.supervisor.update(runtimeId, { status: "completed" })
837 server?.notify("runtime/completed", runtime)
838 } else if (status === "stopped") {
839 await writer.stoppedActionEvent({ taskId, eventId })
840 const runtime = server?.supervisor.update(runtimeId, { status: "stopped", error })
841 server?.notify("runtime/stopped", runtime)
842 } else {
843 await writer.errorActionEvent({ taskId, eventId })
844 const runtime = server?.supervisor.update(runtimeId, { status: "failed", error })
845 server?.notify("runtime/failed", runtime)
846 }
847
848 activeTaskExecutions.delete(taskId)
849 notifyWorkingTasks(server)
850 notifyTaskChanged(server, repoId, taskId)
851 }
852
853 try {
854 for (const layer of groupOpenADEHyperPlanByDepth(strategy)) {

Callers 4

runHeadlessHyperPlanTurnFunction · 0.70
onEventFunction · 0.70
onSettledFunction · 0.70
runHeadlessTurnFunction · 0.70

Calls 9

notifyWorkingTasksFunction · 0.85
notifyTaskChangedFunction · 0.85
notifyMethod · 0.80
allMethod · 0.80
completeActionEventMethod · 0.65
updateMethod · 0.65
stoppedActionEventMethod · 0.65
errorActionEventMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected