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
/** Synchronous admission shared by derived-render cleanup and its consumers. */
import { musicVideoEvents } from './events.js';
import { ServerError } from '../../lib/errorHandler.js';
const cleaning = new Set();
export function assertRenderCleanupIdle(projectId) {
if (cleaning.has(projectId)) throw new ServerError('Render cleanup is in progress. Try again when it finishes.', { status: 409, code: 'RENDER_CLEANUP_ACTIVE' });
}
export async function withRenderCleanupReservation(projectId, work, { notify = true } = {}) {
assertRenderCleanupIdle(projectId);
cleaning.add(projectId);
try { return await work(); } finally { cleaning.delete(projectId); if (notify) musicVideoEvents.emit('render-cleanup-idle', { projectId }); }
}