export function recordHeartbeatRunnerError(runtime, error) { const body = error instanceof Error ? error.message : String(error || "LOCAL_AGENT_HEARTBEAT_FAILED"); const result = { ok: false, status: 0, body, }; if (runtime && typeof runtime === "object") { runtime.lastHeartbeatAt = new Date().toISOString(); runtime.lastHeartbeatOk = false; runtime.lastHeartbeatStatus = 0; runtime.lastHeartbeatBody = body; } return result; }