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

Function readState

src/index.js:322–329  ·  view source on GitHub ↗
(directory, sessionID)

Source from the content-addressed store, hash-verified

320async function ensureDir(directory) { await fs.mkdir(directory, { recursive: true }) }
321async function pathExists(filePath) { try { await fs.access(filePath); return true } catch { return false } }
322
323async function readState(directory, sessionID) {
324 try {
325 const parsed = JSON.parse(await fs.readFile(statePath(directory, sessionID), "utf8"))
326 return { version: 4, jobs: Array.isArray(parsed.jobs) ? parsed.jobs : [] }
327 } catch {
328 return { version: 4, jobs: [] }
329 }
330}
331
332async function writeState(directory, sessionID, state) {

Callers 15

startWatchdogFunction · 0.85
scheduleDueWorkFunction · 0.85
setGoalCompleteFunction · 0.85
setGoalBlockedFunction · 0.85
setGoalProgressFunction · 0.85
finalizeActiveRunFunction · 0.85
maybeRunDueJobsFunction · 0.85
addLoopFunction · 0.85
stopLoopFunction · 0.85
updateJobStateFunction · 0.85
statusGoalFunction · 0.85
pauseGoalFunction · 0.85

Calls 1

statePathFunction · 0.85

Tested by

no test coverage detected