/** * RobotInfo heartbeat helpers — Phase 1.d completion. * * `agenticros_discovery` publishes `/agenticros/robot_info` at 1 Hz. * Consumers treat a robot as online when the last stamp is within * {@link DEFAULT_HEARTBEAT_STALENESS_MS} (5 s per strategy memo). * * Topic-scan path: when adapters only have `listTopics()`, presence of * `//agenticros/robot_info` on the graph is a weak online signal * (same as cmd_vel). Prefer {@link mergeRobotHeartbeats} when message * payloads with stamps are available. */ import type { TopicInfo } from "./transport/types.js"; import type { RobotSensors } from "./robots.js"; /** Default staleness window — strategy §4(d): 1 Hz + 5 s. */ export declare const DEFAULT_HEARTBEAT_STALENESS_MS = 5000; /** Parsed robot_info payload (subset of agenticros_msgs/RobotInfo). */ export interface RobotHeartbeat { /** Stable id (falls back to namespace). */ id: string; name: string; kind: string; /** ROS namespace without leading slash. */ robot_namespace: string; capability_ids: string[]; sensors: RobotSensors; /** Epoch ms of the heartbeat stamp (0 when unknown). */ stamp_ms: number; /** Topic the heartbeat was observed on. */ topic: string; } export interface HeartbeatOnlineOptions { /** Wall clock now (ms). Defaults to Date.now(). */ nowMs?: number; /** Staleness window in ms. Defaults to 5000. */ stalenessMs?: number; } /** * Extract namespace from `//agenticros/robot_info` (or without leading slash). * Returns "" for unnamespaced `/agenticros/robot_info`. */ export declare function namespaceFromRobotInfoTopic(topic: string): string; /** True when the topic name is a robot_info heartbeat topic. */ export declare function isRobotInfoTopic(topic: string): boolean; /** * Detect namespaces that advertise `agenticros/robot_info` on the topic graph * (no stamp available — treat as online for discovery fallback). */ export declare function detectHeartbeatNamespacesFromTopics(topics: TopicInfo[]): string[]; /** * Parse a plain RobotInfo-like message into {@link RobotHeartbeat}. * Tolerates missing optional fields. */ export declare function parseRobotInfoMessage(topic: string, msg: Record): RobotHeartbeat; /** True when the heartbeat stamp is within the staleness window. */ export declare function isHeartbeatFresh(heartbeat: RobotHeartbeat, options?: HeartbeatOnlineOptions): boolean; /** * Merge heartbeats into an online-id set keyed by configured robot id * when `configuredIdByNamespace` is provided, else by heartbeat id / * effective namespace. */ export declare function onlineIdsFromHeartbeats(heartbeats: readonly RobotHeartbeat[], options?: HeartbeatOnlineOptions & { /** Map effective cmd_vel namespace → configured robot id. */ configuredIdByNamespace?: ReadonlyMap; }): Set; /** * Build a map of effective-namespace → latest fresh heartbeat. */ export declare function mergeRobotHeartbeats(heartbeats: readonly RobotHeartbeat[], options?: HeartbeatOnlineOptions): Map; //# sourceMappingURL=heartbeat.d.ts.map