Skip to repository content104 lines · 3.3 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T03:38:29.319Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
zed_urls.rs
1//! Contains helper functions for constructing URLs to various Zed-related pages.
2//!
3//! These URLs will adapt to the configured server URL in order to construct
4//! links appropriate for the environment (e.g., by linking to a local copy of
5//! zed.dev in development).
6
7use gpui::App;
8use release_channel::ReleaseChannel;
9use settings::Settings;
10
11use crate::ClientSettings;
12
13fn server_url(cx: &App) -> &str {
14 &ClientSettings::get_global(cx).server_url
15}
16
17fn docs_url(cx: &App) -> String {
18 let server_url = server_url(cx);
19 match ReleaseChannel::try_global(cx).unwrap_or_default() {
20 ReleaseChannel::Stable => {
21 format!("{server_url}/docs")
22 }
23 ReleaseChannel::Preview => {
24 format!("{server_url}/docs/preview")
25 }
26 ReleaseChannel::Dev | ReleaseChannel::Nightly => {
27 format!("{server_url}/docs/nightly")
28 }
29 }
30}
31
32/// Returns the URL to the account page on zed.dev.
33pub fn account_url(cx: &App) -> String {
34 format!("{server_url}/account", server_url = server_url(cx))
35}
36
37/// Returns the URL to the start trial page on zed.dev.
38pub fn start_trial_url(cx: &App) -> String {
39 format!(
40 "{server_url}/account/start-trial",
41 server_url = server_url(cx)
42 )
43}
44
45/// Returns the URL to the upgrade page on zed.dev.
46pub fn upgrade_to_zed_pro_url(cx: &App) -> String {
47 format!("{server_url}/account/upgrade", server_url = server_url(cx))
48}
49
50/// Returns the URL to Zed's terms of service.
51pub fn terms_of_service(cx: &App) -> String {
52 format!("{server_url}/terms-of-service", server_url = server_url(cx))
53}
54
55/// Returns the URL to Zed AI's privacy and security docs.
56pub fn ai_privacy_and_security(cx: &App) -> String {
57 format!(
58 "{docs_url}/ai/privacy-and-security",
59 docs_url = docs_url(cx)
60 )
61}
62
63/// Returns the URL to Zed's edit prediction documentation.
64pub fn edit_prediction_docs(cx: &App) -> String {
65 format!("{docs_url}/ai/edit-prediction", docs_url = docs_url(cx))
66}
67
68pub fn skills_docs(cx: &App) -> String {
69 format!("{docs_url}/ai/skills", docs_url = docs_url(cx))
70}
71
72/// Returns the URL to the upstream Zed sandboxing documentation.
73///
74/// Pass `section` to deep-link to a specific section anchor on the page (for
75/// example, `Some("installing-bubblewrap")`); pass `None` to link to the top of
76/// the page.
77///
78/// Unlike the account/app links above, this targets `zed.dev/docs` (via
79/// [`release_channel::docs_url`]) rather than the configured `server_url`: the
80/// docs are a static site hosted on `zed.dev`, so pointing at a local dev
81/// `server_url` would 404.
82pub fn sandboxing_docs(section: Option<&str>, cx: &App) -> String {
83 let base = release_channel::docs_url("ai/sandboxing", cx);
84 match section {
85 Some(section) => format!("{base}#{section}"),
86 None => base,
87 }
88}
89pub fn llm_provider_docs(cx: &App) -> String {
90 format!("{docs_url}/ai/llm-providers", docs_url = docs_url(cx))
91}
92
93/// Returns the URL to Zed's ACP registry blog post.
94pub fn acp_registry_blog(cx: &App) -> String {
95 format!(
96 "{server_url}/blog/acp-registry",
97 server_url = server_url(cx)
98 )
99}
100
101pub fn shared_agent_thread_url(session_id: &str) -> String {
102 format!("zed://agent/shared/{}", session_id)
103}
104