import { postHeartbeat } from "./api-client.js"; import { env } from "./config.js"; import { runOnce, startScheduler } from "./scheduler.js"; // Tell `apps/api` we're alive as early as possible — before either the // one-shot run or the cron loop — so the admin monitoring board reflects a // fresh deploy immediately, not only after the first scheduled fire. await postHeartbeat({ event: "boot" }); /** * Entrypoint — `RUN_ONCE=true` runs both jobs a single time and exits * (manual/CI-triggered invocation, `pnpm start`), otherwise starts the * long-lived cron loop (the container's normal mode, see `Dockerfile`). */ if (env.RUN_ONCE) { try { await runOnce(); process.exit(0); } catch (err) { console.error("[tech-step-llm-worker] run failed:", err); process.exit(1); } } else { startScheduler(); }