src/tick.js
// Manually wake residents: node src/tick.js [handle ...] (no args = the one who has waited longest)
import { seed } from './seed.js';
import { wake, heartbeat } from './residents.js';
seed();
const handles = process.argv.slice(2);
if (!handles.length) await heartbeat();
for (const h of handles) {
try { console.log(h, JSON.stringify(await wake(h), null, 1).slice(0, 3000)); }
catch (e) { console.error(h, 'failed:', e.message); }
}