Skip to main content

agentmux_common/deeplinks/
mod.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Deep links: one address for every place AgentMux can show
5//! (docs/specs/SPEC_DEEP_LINKS_ONE_FRAMEWORK_2026_11_20.md). The registry of destinations
6//! (`crates/common/deeplinks/destinations.json`) is generated into `registry.rs`; `parse` reads a link
7//! against it. srv's guard and the `Pane` tool read both; the app has the same pair in `frontend/app/deeplinks/`.
8
9// Generated: its layout is the generator's, and `--check` compares it byte for byte.
10#[rustfmt::skip]
11mod registry;
12pub mod parse;
13pub mod types;
14
15#[cfg(test)]
16mod conformance_tests;
17
18pub use parse::{format_link, parse_link, path_problem, LinkError, ParsedLink, Value};
19pub use registry::REGISTRY;
20pub use types::{AgentRule, Effect, Kind, Place, Registry, Segment, Sensitivity, View};
21
22/// The label key of a parsed link's place, for the words a person sees: the enum value's own label when the place
23/// is one enum segment (`settings.sections.recording`), else the place's label; None for the view as it is.
24pub fn place_label_key(link: &ParsedLink) -> Option<&'static str> {
25    let place = link.place?;
26    if let Some(key) = place.label_key {
27        return Some(key);
28    }
29    place.segments.iter().find_map(|s| match s {
30        Segment::Var(v) if v.kind == Kind::Enum => {
31            let held = link.values.get(v.name)?.to_string();
32            v.values.iter().find(|e| e.id == held).map(|e| e.label_key)
33        }
34        _ => None,
35    })
36}