Skip to main content

agentmux_srv/backend/lan_discovery/
events.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! The LAN discovery events' payloads (`mps_events`: `laninstances`, `:error`, `:health`).
5
6use serde::Serialize;
7
8use super::LanInstance;
9
10/// `laninstances`: the LAN peers this instance sees now.
11#[derive(Debug, Clone, Serialize, ts_rs::TS)]
12#[ts(export, export_to = "../../../frontend/types/rpc/")]
13pub struct LanInstanceList(pub Vec<LanInstance>);
14
15/// `laninstances:error`: why LAN discovery couldn't start, or a rebuild failed.
16#[derive(Debug, Clone, Serialize, ts_rs::TS)]
17#[ts(export, export_to = "../../../frontend/types/rpc/")]
18pub struct LanDiscoveryError {
19    pub error: String,
20}
21
22/// `laninstances:health`: whether this instance is discoverable on every LAN interface.
23#[derive(Debug, Clone, Serialize, ts_rs::TS)]
24#[ts(export, export_to = "../../../frontend/types/rpc/")]
25pub struct LanDiscoverability {
26    #[ts(type = r#""healthy" | "degraded" | "undiscoverable" | "off""#)]
27    pub state: String,
28    /// IPv4 addresses the service was expected on but never announced on.
29    pub missing: Vec<String>,
30    /// Daemon rebuilds the watchdog has already tried.
31    pub rebuilds: u32,
32}