Runs scheduled database maintenance tasks via cron.
import { join } from 'node:path'
import { homedir } from 'node:os'
import cron from 'node-cron'
import type Database from 'better-sqlite3'
import * as queries from '../shared/db-queries'
import { APP_NAME } from '../shared/constants'
import { executeTask, isTaskRunning, cancelRunningTasksForRoom } from '../shared/task-runner'
import { startCommentaryEngine, stopCommentaryEngine } from './clerk-commentary'
import { clearRoomLaunchState, pauseAgent } from '../shared/agent-loop'
import {
ensureCloudRoomToken,
fetchCloudRoomMessages,
getRoomCloudId,
sendCloudRoomMessage,
} from '../shared/cloud-sync'
import { pollQueenInbox } from './routes/contacts'
import { relayPendingKeeperRequests } from './clerk-notifications'
import { eventBus } from './event-bus'
const SCHEDULER_REFRESH_MS = 1
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key