refactor(heartbeat): centralize [Heartbeat] prefix as a shared constant

P2-36: Multiple subsystems were string-coupled via the magic
'[Heartbeat]' prefix. Introduce src/main/orchestration/heartbeat-task.ts
as the single source of truth and replace scattered literals in
heartbeat dispatch, automation actions, and run completion.

P3-52: Collapse 5-deep ternary in automation-actions' wake-trigger
selection into lookup helpers (deriveHeartbeatWakeTrigger,
deriveEscalationWakeTrigger).
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:53:19 -04:00
1 parent 4838750009
commit bb397dff02
4 files changed
+48 -26

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
/**
* Heartbeat task title conventions.
*
* Heartbeat tasks are synthesized by the orchestrator when an agent wakes with
* no actionable work; they carry the `[Heartbeat]` title prefix so the rest of
* the system can detect them without a dedicated `kind` column.
*
* Centralizing the prefix here prevents drift between the writer (heartbeat
* dispatch) and readers (automation, escalation, route filters).
*/
export const HEARTBEAT_TASK_TITLE_PREFIX = "[Heartbeat]";
export function isHeartbeatTaskTitle(title: string | null | undefined): boolean {
return !!title && title.startsWith(HEARTBEAT_TASK_TITLE_PREFIX);
}