MCPcopy Create free account
hub / github.com/ByBrawe/opencode-loop / dueJobs

Function dueJobs

src/index.js:979–990  ·  view source on GitHub ↗
(state, force = false)

Source from the content-addressed store, hash-verified

977function commandEventKey(sessionID, messageID) {
978 return `${sessionID || "no-session"}:event:${messageID || "no-message"}`;
979}
980function markHandled(sessionID, name, args) {
981 const key = commandKey(sessionID, name, args);
982 const previous = handledCommands.get(key);
983 const pending = previous && now() - previous.time < COMMAND_DEDUPE_MS ? previous.pending + 1 : 1;
984 handledCommands.set(key, { time: now(), pending });
985 for (const [entryKey, entry] of handledCommands.entries())
986 if (now() - entry.time > COMMAND_DEDUPE_MS)
987 handledCommands.delete(entryKey);
988 for (const [entryKey, time] of handledCommandEvents.entries())
989 if (now() - time > COMMAND_DEDUPE_MS)
990 handledCommandEvents.delete(entryKey);
991}
992function consumeHandled(sessionID, name, args) {
993 const key = commandKey(sessionID, name, args);

Callers 1

maybeRunDueJobsFunction · 0.85

Calls 2

nowFunction · 0.85
isGoalJobFunction · 0.85

Tested by

no test coverage detected