Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
/**
* Shared eventScheduler registration for periodic garbage-collection sweeps.
*
* Each GC gets one delayed boot pass plus one recurring interval. Keeping both
* in eventScheduler makes them cancellable and visible in scheduler history.
*/
import { cancel, getEvent, schedule } from './eventScheduler.js';
const INITIAL_SUFFIX = ':initial';
export function createSweepScheduler({ id, intervalMs, initialDelayMs, handler, source }) {
const initialId = `${id}${INITIAL_SUFFIX}`;
return {
start() {
if (getEvent(id)?.active) return;
schedule({
id: initialId,
type: 'once',
delayMs: initialDelayMs,
handler,
metadata: { source },
});
schedule({
id,
type: 'interval',
intervalMs,
handler,
metadata: { source },
});
},
stop() {
cancel(initialId);
cancel(id);
},
};
}