MCPcopy Index your code
hub / github.com/ByBrawe/opencode-loop / stopLoop

Function stopLoop

src/index.js:1410–1426  ·  view source on GitHub ↗
(directory, client, sessionID, args)

Source from the content-addressed store, hash-verified

1408 if (shouldReplace) replaced = true
1409 return !shouldReplace
1410 })
1411 } else {
1412 state.jobs = jobs
1413 }
1414
1415 state.jobs.push(parsed.job)
1416 await writeState(directory, sessionID, state)
1417 await scheduleDueWork(directory, client, sessionID)
1418 if (parsed.job.immediate) scheduleIdleWork(directory, client, sessionID)
1419 await toast(client, `${replaced ? "Loop replaced" : "Loop added"}: ${jobLabel(parsed.job)}`, "success")
1420 await appendLoopLog(directory, replaced ? "replace" : "add", { sessionID, job: parsed.job.name || parsed.job.id, label: jobLabel(parsed.job) })
1421}
1422
1423async function stopLoop(directory, client, sessionID, args) {
1424 const target = String(args || "").trim()
1425 if (!target || target.toLowerCase() === "all") {
1426 await removeState(directory, sessionID)
1427 clearActiveRun(sessionID)
1428 const due = dueTimers.get(sessionID); if (due) clearTimeout(due); dueTimers.delete(sessionID)
1429 stopWatchdog(sessionID)

Callers 1

handleCommandFunction · 0.85

Calls 8

removeStateFunction · 0.85
clearActiveRunFunction · 0.85
stopWatchdogFunction · 0.85
toastFunction · 0.85
readStateFunction · 0.85
matchJobFunction · 0.85
writeStateFunction · 0.85
scheduleDueWorkFunction · 0.85

Tested by

no test coverage detected