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

Function helpLoop

src/index.js:1530–1547  ·  view source on GitHub ↗
(client, sessionID)

Source from the content-addressed store, hash-verified

1528 { sessionID, parts: [{ type: "text", text: promptText }] },
1529 )
1530 return { startsAssistantTurn: true }
1531}
1532
1533async function maybeRunDueJobs(directory, client, sessionID, options = {}) {
1534 rememberSession(directory, client, sessionID)
1535 const reschedule = async (minDelayMs = 0) => { await scheduleDueWork(directory, client, sessionID, minDelayMs) }
1536
1537 if (runLocks.has(sessionID)) {
1538 await reschedule(BUSY_RETRY_MS)
1539 return
1540 }
1541 runLocks.set(sessionID, now())
1542 let job
1543 try {
1544 await finalizeActiveRun(directory, client, sessionID, { requireIdle: true, forceStale: true })
1545 if (!await sessionIsIdle(client, sessionID, directory)) {
1546 if (options.force) await toast(client, "Loop queued: session is busy; it will run on the next idle check.", "info")
1547 await reschedule(BUSY_RETRY_MS)
1548 return
1549 }
1550

Callers 1

handleCommandFunction · 0.85

Calls 1

sayFunction · 0.85

Tested by

no test coverage detected