MCPcopy Create free account
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 progressCount: Array.isArray(job?.goalProgress) ? job.goalProgress.length : 0,
1409 evidence: String(job?.goalEvidence || ""),
1410 checksPassedAt: Number(job?.goalChecksPassedAt || 0),
1411 lastGoalCheckAt: Number(job?.lastGoalCheckAt || 0),
1412 lastVerifyAt: Number(job?.lastVerifyAt || 0),
1413 lastVerifyCode: Number.isFinite(Number(job?.lastVerifyCode)) ? Number(job.lastVerifyCode) : undefined
1414 };
1415}
1416function goalMadeMeaningfulProgress(beforeJob, afterJob) {
1417 const before = goalProgressSnapshot(beforeJob || {});
1418 const after = goalProgressSnapshot(afterJob || {});
1419 if (["completed", "blocked"].includes(after.status) && after.status !== before.status)
1420 return true;
1421 if (after.progressCount > before.progressCount)
1422 return true;
1423 if (after.evidence !== before.evidence && hasConcreteGoalEvidence(after.evidence))
1424 return true;
1425 if (after.checksPassedAt > before.checksPassedAt || goalChecksPassed(afterJob) && after.lastGoalCheckAt > before.lastGoalCheckAt)
1426 return true;
1427 if (after.lastVerifyAt > before.lastVerifyAt && after.lastVerifyCode === 0)
1428 return true;
1429 return false;

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