Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T05:17:23.995Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

app_identity.rs

166 lines · 5.4 KB · rust
1use std::{env, str::FromStr, sync::LazyLock};
2
3pub const BINARY_NAME: &str = "omega";
4
5/// When false, Omega must not contact Zed production hosts on a normal start.
6///
7/// Set `OMEGA_ALLOW_ZED_SERVICES=1` only for explicitly approved compatibility
8/// experiments. Release candidates keep this disabled.
9pub const ZED_PRODUCTION_SERVICES_ENABLED: bool = false;
10
11/// Returns whether inherited Zed production services may be contacted.
12pub fn zed_production_services_enabled() -> bool {
13    ZED_PRODUCTION_SERVICES_ENABLED
14        || std::env::var("OMEGA_ALLOW_ZED_SERVICES").as_deref() == Ok("1")
15}
16
17/// Public product name shown in the Omega shell.
18pub const PRODUCT_NAME: &str = "Omega";
19/// Publisher shown beside Omega product surfaces.
20pub const PUBLISHER_NAME: &str = "OpenAgents";
21/// Tagline used on welcome and onboarding headers.
22pub const PRODUCT_TAGLINE: &str = "Your last IDE.";
23/// Owned Omega repository.
24pub const PRODUCT_REPOSITORY_URL: &str = "https://github.com/OpenAgentsInc/omega";
25/// Owned documentation entry point for Help actions.
26pub const PRODUCT_DOCS_URL: &str = "https://github.com/OpenAgentsInc/omega#readme";
27/// Bug report destination for Help actions.
28pub const PRODUCT_BUG_REPORT_URL: &str =
29    "https://github.com/OpenAgentsInc/omega/issues/new?template=10_bug_report.yml";
30/// Feature request destination for Help actions.
31pub const PRODUCT_FEATURE_REQUEST_URL: &str =
32    "https://github.com/OpenAgentsInc/omega/issues/new/choose";
33
34pub static CHANNEL: LazyLock<AppChannel> = LazyLock::new(|| {
35    let channel_name = if cfg!(debug_assertions) {
36        env::var("ZED_RELEASE_CHANNEL")
37            .unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").trim().to_string())
38    } else {
39        include_str!("../../zed/RELEASE_CHANNEL").trim().to_string()
40    };
41
42    channel_name
43        .parse()
44        .unwrap_or_else(|_| panic!("invalid release channel {channel_name}"))
45});
46
47#[derive(Debug, Copy, Clone, PartialEq, Eq)]
48pub enum AppChannel {
49    Dev,
50    Nightly,
51    Rc,
52    Stable,
53}
54
55impl AppChannel {
56    pub const ALL: [Self; 4] = [Self::Dev, Self::Nightly, Self::Rc, Self::Stable];
57
58    pub const fn display_name(self) -> &'static str {
59        match self {
60            Self::Dev => "Omega Dev",
61            Self::Nightly => "Omega Nightly",
62            Self::Rc => "Omega RC",
63            Self::Stable => "Omega",
64        }
65    }
66
67    pub const fn storage_slug(self) -> &'static str {
68        match self {
69            Self::Dev => "omega-dev",
70            Self::Nightly => "omega-nightly",
71            Self::Rc => "omega-rc",
72            Self::Stable => "omega",
73        }
74    }
75
76    pub const fn app_id(self) -> &'static str {
77        match self {
78            Self::Dev => "com.openagents.omega.dev",
79            Self::Nightly => "com.openagents.omega.nightly",
80            Self::Rc => "com.openagents.omega.rc",
81            Self::Stable => "com.openagents.omega",
82        }
83    }
84
85    pub const fn credential_namespace(self) -> &'static str {
86        match self {
87            Self::Dev => "com.openagents.omega.credentials.dev",
88            Self::Nightly => "com.openagents.omega.credentials.nightly",
89            Self::Rc => "com.openagents.omega.credentials.rc",
90            Self::Stable => "com.openagents.omega.credentials",
91        }
92    }
93
94    pub const fn protocol_scheme(self) -> &'static str {
95        self.storage_slug()
96    }
97}
98
99impl FromStr for AppChannel {
100    type Err = InvalidAppChannel;
101
102    fn from_str(channel: &str) -> Result<Self, Self::Err> {
103        match channel {
104            "dev" => Ok(Self::Dev),
105            "nightly" => Ok(Self::Nightly),
106            "preview" | "rc" => Ok(Self::Rc),
107            "stable" => Ok(Self::Stable),
108            _ => Err(InvalidAppChannel),
109        }
110    }
111}
112
113#[derive(Debug, Copy, Clone, PartialEq, Eq)]
114pub struct InvalidAppChannel;
115
116#[cfg(test)]
117mod icon_family;
118#[cfg(test)]
119mod public_branding;
120#[cfg(test)]
121mod release_record;
122#[cfg(test)]
123mod service_isolation;
124#[cfg(test)]
125mod shell_branding;
126
127#[cfg(test)]
128mod tests {
129    use std::collections::HashSet;
130
131    use super::*;
132
133    #[test]
134    fn channel_identity_values_are_unique_and_not_zed() {
135        let display_names = AppChannel::ALL.map(AppChannel::display_name);
136        let storage_slugs = AppChannel::ALL.map(AppChannel::storage_slug);
137        let app_ids = AppChannel::ALL.map(AppChannel::app_id);
138        let credential_namespaces = AppChannel::ALL.map(AppChannel::credential_namespace);
139        let protocol_schemes = AppChannel::ALL.map(AppChannel::protocol_scheme);
140
141        for values in [
142            display_names.as_slice(),
143            storage_slugs.as_slice(),
144            app_ids.as_slice(),
145            credential_namespaces.as_slice(),
146            protocol_schemes.as_slice(),
147        ] {
148            assert_eq!(values.iter().copied().collect::<HashSet<_>>().len(), 4);
149            assert!(
150                values
151                    .iter()
152                    .all(|value| !value.to_lowercase().contains("zed"))
153            );
154        }
155    }
156
157    #[test]
158    fn preview_maps_to_omega_rc() {
159        let channel = "preview".parse::<AppChannel>();
160        assert_eq!(channel, Ok(AppChannel::Rc));
161        assert_eq!(AppChannel::Rc.display_name(), "Omega RC");
162        assert_eq!(AppChannel::Rc.storage_slug(), "omega-rc");
163        assert_eq!(AppChannel::Rc.app_id(), "com.openagents.omega.rc");
164    }
165}
166
Served at tenant.openagents/omega Member data and write actions are omitted.