// ===== STARTUP RECOVERY QUERY ===== // This function should be triggered on Node-RED startup via an inject node // with "Inject once after 0.1 seconds" // Query for most recent active session msg.topic = ` SELECT * FROM session_state WHERE is_active = 1 ORDER BY updated_at DESC LIMIT 1; `; msg._mode = "startup-recovery-query"; return msg;