import { db } from '../db/index.js'; /** Only the latest lifecycle operation can describe the current server. */ export function isProvisioning(server: string): boolean { const operation = db().prepare(`SELECT action, state FROM server_deployments WHERE server = ? AND server_deleted_at IS NULL ORDER BY rowid DESC LIMIT 1`).get(server) as { action: string; state: string } | undefined; return !!operation && ['create', 'rebuild', 'start'].includes(operation.action) && ['queued', 'running', 'awaiting-health'].includes(operation.state); }