Skip to main content

agentmux_srv_core/backend/reactive/
name_bindings.rs

1// Copyright 2025-2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! A registered block's names (`Handler::block_names`).
5
6/// A block's names, typed (identity M2, spec §4.4.2).
7///
8/// `display` is the name the block was most recently registered under —
9/// the Register-tail and the HTTP presence path supply it every time — and
10/// is **replaced** on re-registration, so a retired name does not linger and
11/// make a later agent ambiguous. `stable` is the `AGENTMUX_AGENT_ID` parked
12/// at spawn (what the alias map used to hold) and is **kept** across display
13/// changes: it is the value GitHub PR-body tags embed precisely because it
14/// does not change on rename (`INCIDENT_2026_09_09_JEKT_STABLE_ID_ALIAS.md`).
15#[derive(Debug, Clone, PartialEq, Eq)]
16pub struct NameBindings {
17    pub display: String,
18    pub stable: Option<String>,
19}
20
21impl NameBindings {
22    /// Every lowercased key this block is bound under.
23    pub(super) fn keys(&self) -> Vec<String> {
24        let mut keys = vec![self.display.to_lowercase()];
25        if let Some(s) = &self.stable {
26            let k = s.to_lowercase();
27            if !keys.contains(&k) {
28                keys.push(k);
29            }
30        }
31        keys
32    }
33}