Skip to repository content142 lines · 4.8 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T01:32:52.152Z 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
feedback.rs
1use app_identity::{
2 PRODUCT_BUG_REPORT_URL, PRODUCT_FEATURE_REQUEST_URL, PRODUCT_REPOSITORY_URL,
3};
4use client::telemetry;
5use extension_host::ExtensionStore;
6use gpui::{App, ClipboardItem, PromptLevel, actions};
7use system_specs::{CopySystemSpecsIntoClipboard, SystemSpecs};
8use util::ResultExt;
9use workspace::Workspace;
10use zed_actions::feedback::{EmailOpenAgents, FileBugReport, RequestFeature};
11
12actions!(
13 omega,
14 [
15 /// Opens the Omega repository on GitHub.
16 #[action(deprecated_aliases = ["zed::OpenZedRepo"])]
17 OpenRepository,
18 /// Copies installed extensions to the clipboard for bug reports.
19 #[action(deprecated_aliases = ["zed::CopyInstalledExtensionsIntoClipboard"])]
20 CopyInstalledExtensionsIntoClipboard
21 ]
22);
23
24fn file_bug_report_url(specs: &SystemSpecs) -> String {
25 format!(
26 "{}&environment={}",
27 PRODUCT_BUG_REPORT_URL,
28 urlencoding::encode(&specs.to_string())
29 )
30}
31
32fn email_openagents_url(specs: &SystemSpecs) -> String {
33 format!(
34 concat!("mailto:hello@openagents.com", "?", "body={}"),
35 email_body(specs)
36 )
37}
38
39fn email_body(specs: &SystemSpecs) -> String {
40 let body = format!("\n\nSystem Information:\n\n{}", specs);
41 urlencoding::encode(&body).to_string()
42}
43
44pub fn init(cx: &mut App) {
45 cx.observe_new(|workspace: &mut Workspace, _, _| {
46 workspace
47 .register_action(|_, _: &CopySystemSpecsIntoClipboard, window, cx| {
48 let specs =
49 SystemSpecs::new(window, cx, telemetry::os_name(), telemetry::os_version());
50
51 cx.spawn_in(window, async move |_, cx| {
52 let specs = specs.await.to_string();
53
54 cx.update(|_, cx| {
55 cx.write_to_clipboard(ClipboardItem::new_string(specs.clone()))
56 })
57 .log_err();
58
59 cx.prompt(
60 PromptLevel::Info,
61 "Copied into clipboard",
62 Some(&specs),
63 &["OK"],
64 )
65 .await
66 })
67 .detach();
68 })
69 .register_action(|_, _: &CopyInstalledExtensionsIntoClipboard, window, cx| {
70 let clipboard_text = format_installed_extensions_for_clipboard(cx);
71 cx.write_to_clipboard(ClipboardItem::new_string(clipboard_text.clone()));
72 drop(window.prompt(
73 PromptLevel::Info,
74 "Copied into clipboard",
75 Some(&clipboard_text),
76 &["OK"],
77 cx,
78 ));
79 })
80 .register_action(|_, _: &RequestFeature, _, cx| {
81 cx.open_url(PRODUCT_FEATURE_REQUEST_URL);
82 })
83 .register_action(move |_, _: &FileBugReport, window, cx| {
84 let specs =
85 SystemSpecs::new(window, cx, telemetry::os_name(), telemetry::os_version());
86 cx.spawn_in(window, async move |_, cx| {
87 let specs = specs.await;
88 cx.update(|_, cx| {
89 cx.open_url(&file_bug_report_url(&specs));
90 })
91 .log_err();
92 })
93 .detach();
94 })
95 .register_action(move |_, _: &EmailOpenAgents, window, cx| {
96 let specs =
97 SystemSpecs::new(window, cx, telemetry::os_name(), telemetry::os_version());
98 cx.spawn_in(window, async move |_, cx| {
99 let specs = specs.await;
100 cx.update(|_, cx| {
101 cx.open_url(&email_openagents_url(&specs));
102 })
103 .log_err();
104 })
105 .detach();
106 })
107 .register_action(move |_, _: &OpenRepository, _, cx| {
108 cx.open_url(PRODUCT_REPOSITORY_URL);
109 });
110 })
111 .detach();
112}
113
114fn format_installed_extensions_for_clipboard(cx: &mut App) -> String {
115 let store = ExtensionStore::global(cx);
116 let store = store.read(cx);
117 let mut lines = Vec::with_capacity(store.extension_index.extensions.len());
118
119 for (extension_id, entry) in store.extension_index.extensions.iter() {
120 let line = format!(
121 "- {} ({}) v{}{}",
122 entry.manifest.name,
123 extension_id,
124 entry.manifest.version,
125 if entry.dev { " (dev)" } else { "" }
126 );
127 lines.push(line);
128 }
129
130 lines.sort();
131
132 if lines.is_empty() {
133 return "No extensions installed.".to_string();
134 }
135
136 format!(
137 "Installed extensions ({}):\n{}",
138 lines.len(),
139 lines.join("\n")
140 )
141}
142