Skip to repository content1063 lines · 33.3 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T02:59:33.462Z 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
lib.rs
1use gpui::{Action, actions};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4use std::{path::PathBuf, sync::Arc};
5
6// If the zed binary doesn't use anything in this crate, it will be optimized away
7// and the actions won't initialize. So we just provide an empty initialization function
8// to be called from main.
9//
10// These may provide relevant context:
11// https://github.com/rust-lang/rust/issues/47384
12// https://github.com/mmastrac/rust-ctor/issues/280
13pub fn init() {}
14
15/// Opens a URL in the system's default web browser.
16#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
17#[action(namespace = omega, deprecated_aliases = ["zed::OpenBrowser"])]
18#[serde(deny_unknown_fields)]
19pub struct OpenBrowser {
20 pub url: Arc<str>,
21}
22
23/// Opens an application URL — the Omega channel scheme, or the legacy
24/// `zed://` scheme kept for compatibility with existing links.
25#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
26#[action(namespace = omega, deprecated_aliases = ["zed::OpenZedUrl"])]
27#[serde(deny_unknown_fields)]
28pub struct OpenAppUrl {
29 pub url: Arc<str>,
30}
31
32/// Opens the keymap to either add a keybinding or change an existing one
33#[derive(PartialEq, Clone, Default, Action, JsonSchema, Serialize, Deserialize)]
34#[action(namespace = omega, no_json, no_register, deprecated_aliases = ["zed::ChangeKeybinding"])]
35pub struct ChangeKeybinding {
36 pub action: String,
37}
38
39actions!(
40 omega,
41 [
42 /// Opens the settings editor.
43 #[action(deprecated_aliases = ["zed::OpenSettings", "zed_actions::OpenSettingsEditor"])]
44 OpenSettings,
45 /// Opens the settings JSON file.
46 #[action(deprecated_aliases = ["zed::OpenSettingsFile", "zed_actions::OpenSettings"])]
47 OpenSettingsFile,
48 /// Opens project-specific settings.
49 #[action(deprecated_aliases = ["zed::OpenProjectSettings", "zed_actions::OpenProjectSettings"])]
50 OpenProjectSettings,
51 /// Opens the project tasks configuration.
52 #[action(deprecated_aliases = ["zed::OpenProjectTasks"])]
53 OpenProjectTasks,
54 /// Opens the project tasks configuration with worktree setup guidance.
55 #[action(deprecated_aliases = ["zed::OpenWorktreeSetupTasks"])]
56 OpenWorktreeSetupTasks,
57 /// Opens the default keymap file.
58 #[action(deprecated_aliases = ["zed::OpenDefaultKeymap"])]
59 OpenDefaultKeymap,
60 /// Opens the user keymap file.
61 #[action(deprecated_aliases = ["zed::OpenKeymapFile", "zed_actions::OpenKeymap"])]
62 OpenKeymapFile,
63 /// Opens the keymap editor.
64 #[action(deprecated_aliases = ["zed::OpenKeymap", "zed_actions::OpenKeymapEditor"])]
65 OpenKeymap,
66 /// Opens account settings.
67 #[action(deprecated_aliases = ["zed::OpenAccountSettings"])]
68 OpenAccountSettings,
69 /// Opens server settings.
70 #[action(deprecated_aliases = ["zed::OpenServerSettings"])]
71 OpenServerSettings,
72 /// Quits the application.
73 #[action(deprecated_aliases = ["zed::Quit"])]
74 Quit,
75 /// Shows information about Omega.
76 #[action(deprecated_aliases = ["zed::About"])]
77 About,
78 /// Opens the documentation website.
79 #[action(deprecated_aliases = ["zed::OpenDocs"])]
80 OpenDocs,
81 /// Views open source licenses.
82 #[action(deprecated_aliases = ["zed::OpenLicenses"])]
83 OpenLicenses,
84 /// Opens the Omega status page.
85 #[action(deprecated_aliases = ["zed::OpenStatusPage"])]
86 OpenStatusPage,
87 /// Opens the Omega merch store.
88 #[action(deprecated_aliases = ["zed::GetMerch"])]
89 GetMerch,
90 /// Opens the telemetry log.
91 #[action(deprecated_aliases = ["zed::OpenTelemetryLog"])]
92 OpenTelemetryLog,
93 /// Opens the performance profiler.
94 #[action(deprecated_aliases = ["zed::OpenPerformanceProfiler"])]
95 OpenPerformanceProfiler,
96 /// Shows the auto-update notification for testing.
97 #[action(deprecated_aliases = ["zed::ShowUpdateNotification"])]
98 ShowUpdateNotification,
99 ]
100);
101
102actions!(
103 omega,
104 [
105 /// Opens Editor Onboarding (theme, keymap, identity).
106 ///
107 /// Prefer the command palette (`cmd-shift-p` on macOS /
108 /// `ctrl-shift-p` elsewhere), not the file picker (`cmd-p` /
109 /// `ctrl-p`). Also available from Help → Editor Onboarding and
110 /// Welcome → Return to Onboarding.
111 #[action(deprecated_aliases = ["zed::OpenOnboarding"])]
112 OpenOnboarding,
113 /// Opens Editor Onboarding (same journey as OpenOnboarding).
114 ///
115 /// Prefer the command palette (`cmd-shift-p` on macOS /
116 /// `ctrl-shift-p` elsewhere), not the file picker (`cmd-p` /
117 /// `ctrl-p`).
118 #[action(deprecated_aliases = ["zed::OpenEditorOnboarding"])]
119 OpenEditorOnboarding,
120 ]
121);
122
123#[derive(PartialEq, Clone, Copy, Debug, Deserialize, JsonSchema)]
124#[serde(rename_all = "snake_case")]
125pub enum ExtensionCategoryFilter {
126 Themes,
127 IconThemes,
128 Languages,
129 Grammars,
130 LanguageServers,
131 ContextServers,
132 Snippets,
133 DebugAdapters,
134}
135
136/// Opens the extensions management interface.
137#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
138#[action(namespace = omega, deprecated_aliases = ["zed::Extensions"])]
139#[serde(deny_unknown_fields)]
140pub struct Extensions {
141 /// Filters the extensions page down to extensions that are in the specified category.
142 #[serde(default)]
143 pub category_filter: Option<ExtensionCategoryFilter>,
144 /// Focuses just the extension with the specified ID.
145 #[serde(default)]
146 pub id: Option<String>,
147}
148
149/// Opens the ACP registry.
150#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
151#[action(namespace = omega, deprecated_aliases = ["zed::AcpRegistry"])]
152#[serde(deny_unknown_fields)]
153pub struct AcpRegistry;
154
155/// Show call diagnostics and connection quality statistics.
156#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
157#[action(namespace = collab)]
158#[serde(deny_unknown_fields)]
159pub struct ShowCallStats;
160
161/// Decreases the font size in the editor buffer.
162#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
163#[action(namespace = omega, deprecated_aliases = ["zed::DecreaseBufferFontSize"])]
164#[serde(deny_unknown_fields)]
165pub struct DecreaseBufferFontSize {
166 #[serde(default)]
167 pub persist: bool,
168}
169
170/// Increases the font size in the editor buffer.
171#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
172#[action(namespace = omega, deprecated_aliases = ["zed::IncreaseBufferFontSize"])]
173#[serde(deny_unknown_fields)]
174pub struct IncreaseBufferFontSize {
175 #[serde(default)]
176 pub persist: bool,
177}
178
179/// Opens the settings editor at a specific path.
180#[derive(PartialEq, Clone, Debug, Deserialize, JsonSchema, Action)]
181#[action(namespace = omega, deprecated_aliases = ["zed::OpenSettingsAt"])]
182#[serde(deny_unknown_fields)]
183pub struct OpenSettingsAt {
184 /// A path to a specific setting (e.g. `theme.mode`)
185 pub path: String,
186 /// The settings file to select before opening `path`. When omitted, the
187 /// existing settings file selection is preserved.
188 #[serde(default)]
189 pub target: Option<OpenSettingsAtTarget>,
190}
191
192#[derive(PartialEq, Clone, Debug, Deserialize, JsonSchema, Action)]
193#[action(namespace = omega, deprecated_aliases = ["zed::OpenSettingsPage"])]
194#[serde(deny_unknown_fields)]
195pub struct OpenSettingsPage {
196 /// A settings page title (e.g. `AI`).
197 pub page: String,
198 /// The settings file to select before opening `page`. When omitted, the
199 /// existing settings file selection is preserved.
200 #[serde(default)]
201 pub target: Option<OpenSettingsAtTarget>,
202}
203
204/// `OpenSettingsAt` path of the agent skills page in the settings UI.
205pub const AGENT_SKILLS_SETTINGS_PATH: &str = "agent.skills";
206
207/// `OpenSettingsAt` path of the agent sandbox permissions page in the settings
208/// UI.
209pub const AGENT_SANDBOX_SETTINGS_PATH: &str = "agent.sandbox_permissions";
210
211#[derive(PartialEq, Clone, Debug, Deserialize, JsonSchema)]
212#[serde(rename_all = "snake_case")]
213pub enum OpenSettingsAtTarget {
214 User,
215 Project { worktree_id: usize },
216}
217
218/// Resets the buffer font size to the default value.
219#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
220#[action(namespace = omega, deprecated_aliases = ["zed::ResetBufferFontSize"])]
221#[serde(deny_unknown_fields)]
222pub struct ResetBufferFontSize {
223 #[serde(default)]
224 pub persist: bool,
225}
226
227/// Decreases the font size of the user interface.
228#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
229#[action(namespace = omega, deprecated_aliases = ["zed::DecreaseUiFontSize"])]
230#[serde(deny_unknown_fields)]
231pub struct DecreaseUiFontSize {
232 #[serde(default)]
233 pub persist: bool,
234}
235
236/// Increases the font size of the user interface.
237#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
238#[action(namespace = omega, deprecated_aliases = ["zed::IncreaseUiFontSize"])]
239#[serde(deny_unknown_fields)]
240pub struct IncreaseUiFontSize {
241 #[serde(default)]
242 pub persist: bool,
243}
244
245/// Resets the UI font size to the default value.
246#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
247#[action(namespace = omega, deprecated_aliases = ["zed::ResetUiFontSize"])]
248#[serde(deny_unknown_fields)]
249pub struct ResetUiFontSize {
250 #[serde(default)]
251 pub persist: bool,
252}
253
254/// Resets all zoom levels (UI and buffer font sizes, including in the agent panel) to their default values.
255#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
256#[action(namespace = omega, deprecated_aliases = ["zed::ResetAllZoom"])]
257#[serde(deny_unknown_fields)]
258pub struct ResetAllZoom {
259 #[serde(default)]
260 pub persist: bool,
261}
262
263pub mod editor {
264 use gpui::actions;
265 actions!(
266 editor,
267 [
268 /// Moves cursor up.
269 MoveUp,
270 /// Moves cursor down.
271 MoveDown,
272 /// Reveals the current file in the system file manager.
273 RevealInFileManager,
274 ]
275 );
276}
277
278pub mod dev {
279 use gpui::actions;
280
281 actions!(
282 dev,
283 [
284 /// Toggles the developer inspector for debugging UI elements.
285 ToggleInspector,
286 /// Clears Omega onboarding completion records (debug builds).
287 ///
288 /// Use the command palette (`cmd-shift-p` on macOS / `ctrl-shift-p`
289 /// elsewhere), not the file picker (`cmd-p` / `ctrl-p`).
290 ResetOnboarding,
291 ]
292 );
293}
294
295pub mod remote_debug {
296 use gpui::actions;
297
298 actions!(
299 remote_debug,
300 [
301 /// Simulates a disconnection from the remote server for testing purposes.
302 /// This will trigger the reconnection logic.
303 SimulateDisconnect,
304 /// Simulates a timeout/slow connection to the remote server for testing purposes.
305 /// This will cause heartbeat failures and trigger reconnection.
306 SimulateTimeout,
307 /// Simulates a timeout/slow connection to the remote server for testing purposes.
308 /// This will cause heartbeat failures and attempting a reconnection while having exhausted all attempts.
309 SimulateTimeoutExhausted,
310 ]
311 );
312}
313
314pub mod workspace {
315 use gpui::actions;
316
317 actions!(
318 workspace,
319 [
320 #[action(deprecated_aliases = ["editor::CopyPath", "outline_panel::CopyPath", "project_panel::CopyPath"])]
321 CopyPath,
322 #[action(deprecated_aliases = ["editor::CopyRelativePath", "outline_panel::CopyRelativePath", "project_panel::CopyRelativePath"])]
323 CopyRelativePath,
324 /// Opens the selected file with the system's default application.
325 #[action(deprecated_aliases = ["project_panel::OpenWithSystem"])]
326 OpenWithSystem,
327 ]
328 );
329}
330
331/// Describes which ref to base a new git worktree on. The worktree is
332/// always created in a detached HEAD state; users can opt into creating
333/// a branch afterwards from the worktree itself.
334#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
335#[serde(rename_all = "snake_case", tag = "kind")]
336pub enum NewWorktreeBranchTarget {
337 /// Create a detached worktree from the current HEAD.
338 #[default]
339 CurrentBranch,
340 /// Create a detached worktree at the tip of an existing branch.
341 ExistingBranch { name: String },
342 /// Create a detached worktree at the tip of a remote-tracking branch.
343 RemoteBranch {
344 remote_name: String,
345 branch_name: String,
346 },
347}
348
349/// Creates a new git worktree and switches the workspace to it.
350/// Dispatched by the unified worktree picker when the user selects a "Create new worktree" entry.
351#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Action)]
352#[action(namespace = git)]
353#[serde(deny_unknown_fields)]
354pub struct CreateWorktree {
355 /// When this is None, Omega will randomly generate a worktree name.
356 pub worktree_name: Option<String>,
357 pub branch_target: NewWorktreeBranchTarget,
358}
359
360/// Switches the workspace to an existing linked worktree.
361/// Dispatched by the unified worktree picker when the user selects an existing worktree.
362#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Action)]
363#[action(namespace = git)]
364#[serde(deny_unknown_fields)]
365pub struct SwitchWorktree {
366 pub path: PathBuf,
367 pub display_name: String,
368}
369
370/// Opens an existing worktree in a new window.
371/// Dispatched by the worktree picker's "Open in New Window" button.
372#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Action)]
373#[action(namespace = git)]
374#[serde(deny_unknown_fields)]
375pub struct OpenWorktreeInNewWindow {
376 pub path: PathBuf,
377}
378
379pub mod git {
380 use gpui::actions;
381
382 actions!(
383 git,
384 [
385 /// Checks out a different git branch.
386 CheckoutBranch,
387 /// Switches to a different git branch.
388 Switch,
389 /// Selects a different repository.
390 SelectRepo,
391 /// Filter remotes.
392 FilterRemotes,
393 /// Create a git remote.
394 CreateRemote,
395 /// Opens the git branch selector.
396 #[action(deprecated_aliases = ["branches::OpenRecent"])]
397 Branch,
398 /// Shows uncommitted changes across the project.
399 ViewUncommittedChanges,
400 /// Shows unstaged changes across the project.
401 ViewUnstagedChanges,
402 /// Shows staged changes across the project.
403 ViewStagedChanges,
404 /// Opens the git stash selector.
405 ViewStash,
406 /// Opens the git worktree selector.
407 Worktree,
408 /// Creates a pull request for the current branch.
409 CreatePullRequest
410 ]
411 );
412}
413
414pub mod toast {
415 use gpui::actions;
416
417 actions!(
418 toast,
419 [
420 /// Runs the action associated with a toast notification.
421 RunAction
422 ]
423 );
424}
425
426pub mod command_palette {
427 use gpui::actions;
428
429 actions!(
430 command_palette,
431 [
432 /// Toggles the command palette.
433 Toggle,
434 ]
435 );
436}
437
438pub mod text_finder {
439 use gpui::actions;
440
441 actions!(
442 text_finder,
443 [
444 /// Opens the Project Search Picker.
445 Toggle,
446 ]
447 );
448}
449
450pub mod project_panel {
451 use gpui::actions;
452
453 actions!(
454 project_panel,
455 [
456 /// Toggles the project panel.
457 Toggle,
458 /// Toggles focus on the project panel.
459 ToggleFocus
460 ]
461 );
462}
463pub mod feedback {
464 use gpui::actions;
465
466 actions!(
467 feedback,
468 [
469 /// Opens email client to send feedback to OpenAgents support.
470 #[action(deprecated_aliases = ["feedback::EmailZed"])]
471 EmailOpenAgents,
472 /// Opens the bug report form.
473 FileBugReport,
474 /// Opens the feature request form.
475 RequestFeature
476 ]
477 );
478}
479
480pub mod theme {
481 use gpui::actions;
482
483 actions!(theme, [ToggleMode]);
484}
485
486pub mod theme_selector {
487 use gpui::Action;
488 use schemars::JsonSchema;
489 use serde::Deserialize;
490
491 /// Toggles the theme selector interface.
492 #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
493 #[action(namespace = theme_selector)]
494 #[serde(deny_unknown_fields)]
495 pub struct Toggle {
496 /// A list of theme names to filter the theme selector down to.
497 pub themes_filter: Option<Vec<String>>,
498 }
499}
500
501pub mod icon_theme_selector {
502 use gpui::Action;
503 use schemars::JsonSchema;
504 use serde::Deserialize;
505
506 /// Toggles the icon theme selector interface.
507 #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
508 #[action(namespace = icon_theme_selector)]
509 #[serde(deny_unknown_fields)]
510 pub struct Toggle {
511 /// A list of icon theme names to filter the theme selector down to.
512 pub themes_filter: Option<Vec<String>>,
513 }
514}
515
516pub mod search {
517 use gpui::actions;
518 actions!(
519 search,
520 [
521 /// Toggles searching in ignored files.
522 ToggleIncludeIgnored
523 ]
524 );
525}
526pub mod buffer_search {
527 use gpui::{Action, actions};
528 use schemars::JsonSchema;
529 use serde::Deserialize;
530
531 /// Opens the buffer search interface with the specified configuration.
532 #[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
533 #[action(namespace = buffer_search)]
534 #[serde(deny_unknown_fields)]
535 pub struct Deploy {
536 #[serde(default = "util::serde::default_true")]
537 pub focus: bool,
538 #[serde(default)]
539 pub replace_enabled: bool,
540 #[serde(default)]
541 pub selection_search_enabled: bool,
542 }
543
544 impl Deploy {
545 pub fn find() -> Self {
546 Self {
547 focus: true,
548 replace_enabled: false,
549 selection_search_enabled: false,
550 }
551 }
552
553 pub fn replace() -> Self {
554 Self {
555 focus: true,
556 replace_enabled: true,
557 selection_search_enabled: false,
558 }
559 }
560 }
561
562 actions!(
563 buffer_search,
564 [
565 /// Deploys the search and replace interface.
566 DeployReplace,
567 /// Dismisses the search bar.
568 Dismiss,
569 /// Focuses back on the editor.
570 FocusEditor,
571 /// Sets the search query from the selection or word under cursor.
572 UseSelectionForFind,
573 ]
574 );
575}
576pub mod settings_profile_selector {
577 use gpui::Action;
578 use schemars::JsonSchema;
579 use serde::Deserialize;
580
581 #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
582 #[action(namespace = settings_profile_selector)]
583 pub struct Toggle;
584}
585
586pub mod agent {
587 use gpui::{Action, SharedString, actions};
588 use schemars::JsonSchema;
589 use serde::Deserialize;
590
591 actions!(
592 agent,
593 [
594 /// Opens the agent settings UI.
595 #[action(deprecated_aliases = ["agent::OpenConfiguration"])]
596 OpenSettings,
597 /// Opens the agent onboarding modal.
598 OpenOnboardingModal,
599 /// Resets the agent onboarding state.
600 ResetOnboarding,
601 /// Starts a chat conversation with the agent.
602 Chat,
603 /// Toggles the language model selector dropdown.
604 #[action(deprecated_aliases = ["assistant::ToggleModelSelector", "assistant2::ToggleModelSelector"])]
605 ToggleModelSelector,
606 /// Triggers re-authentication on Gemini
607 ReauthenticateAgent,
608 /// Logs out of the current external agent
609 LogoutAgent,
610 /// Add the current selection as context for threads in the agent panel.
611 #[action(deprecated_aliases = ["assistant::QuoteSelection", "agent::QuoteSelection"])]
612 AddSelectionToThread,
613 /// Resets the agent panel zoom levels (agent UI and buffer font sizes).
614 ResetAgentZoom,
615 /// Pastes clipboard content without any formatting.
616 PasteRaw,
617 ]
618 );
619
620 /// Selects the agent used for new threads in the agent panel, without
621 /// opening the panel. The selected agent is launched the next time the
622 /// panel is opened.
623 #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
624 #[action(namespace = agent)]
625 #[serde(deny_unknown_fields)]
626 pub struct SelectAgent {
627 /// The id of the agent to select.
628 pub agent: String,
629 }
630
631 /// Opens a new agent thread with the provided branch diff for review.
632 #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
633 #[action(namespace = agent)]
634 #[serde(deny_unknown_fields)]
635 pub struct ReviewBranchDiff {
636 /// The full text of the diff to review.
637 pub diff_text: SharedString,
638 /// The base ref that the diff was computed against (e.g. "main").
639 pub base_ref: SharedString,
640 }
641
642 /// A single merge conflict region extracted from a file.
643 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema)]
644 pub struct ConflictContent {
645 pub file_path: String,
646 pub conflict_text: String,
647 pub ours_branch_name: String,
648 pub theirs_branch_name: String,
649 }
650
651 /// Opens a new agent thread to resolve specific merge conflicts.
652 #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
653 #[action(namespace = agent)]
654 #[serde(deny_unknown_fields)]
655 pub struct ResolveConflictsWithAgent {
656 /// Individual conflicts with their full text.
657 pub conflicts: Vec<ConflictContent>,
658 }
659
660 /// Opens a new agent thread to resolve merge conflicts in the given file paths.
661 #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
662 #[action(namespace = agent)]
663 #[serde(deny_unknown_fields)]
664 pub struct ResolveConflictedFilesWithAgent {
665 /// File paths with unresolved conflicts (for project-wide resolution).
666 pub conflicted_file_paths: Vec<String>,
667 }
668}
669
670pub mod assistant {
671 use gpui::{Action, actions};
672 use schemars::JsonSchema;
673 use serde::Deserialize;
674
675 actions!(
676 agent,
677 [
678 /// Toggles the agent panel.
679 Toggle,
680 #[action(deprecated_aliases = ["assistant::ToggleFocus"])]
681 ToggleFocus,
682 FocusAgent,
683 /// Opens the skill creator window for creating a new skill.
684 OpenSkillCreator,
685 /// Opens the skill creator window to import a skill from a GitHub URL.
686 CreateSkillFromUrl,
687 /// Opens the user-global AGENTS.md rules file.
688 #[action(name = "OpenGlobalAGENTS.mdRules")]
689 OpenGlobalAgentsMdRules,
690 /// Opens the project AGENTS.md rules file.
691 #[action(name = "OpenProjectAGENTS.mdRules")]
692 OpenProjectAgentsMdRules,
693 /// Opens the skills manager in the settings window.
694 #[action(deprecated_aliases = ["agent::OpenRulesLibrary", "assistant::OpenRulesLibrary", "assistant::DeployPromptLibrary"])]
695 ManageSkills,
696 ]
697 );
698
699 /// Deploys the assistant interface with the specified configuration.
700 #[derive(Clone, Default, Deserialize, PartialEq, JsonSchema, Action)]
701 #[action(namespace = assistant)]
702 #[serde(deny_unknown_fields)]
703 pub struct InlineAssist {
704 pub prompt: Option<String>,
705 }
706}
707
708/// Opens the recent projects interface.
709#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
710#[action(namespace = projects)]
711#[serde(deny_unknown_fields)]
712pub struct OpenRecent {
713 #[serde(default)]
714 pub create_new_window: Option<bool>,
715}
716
717/// Creates a project from a selected template.
718#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
719#[action(namespace = projects)]
720#[serde(deny_unknown_fields)]
721pub struct OpenRemote {
722 #[serde(default)]
723 pub from_existing_connection: bool,
724 #[serde(default)]
725 pub create_new_window: Option<bool>,
726}
727
728/// Opens the dev container connection modal.
729#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
730#[action(namespace = projects)]
731#[serde(deny_unknown_fields)]
732pub struct OpenDevContainer;
733
734/// Where to spawn the task in the UI.
735#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
736#[serde(rename_all = "snake_case")]
737pub enum RevealTarget {
738 /// In the central pane group, "main" editor area.
739 Center,
740 /// In the terminal dock, "regular" terminal items' place.
741 #[default]
742 Dock,
743}
744
745/// Spawns a task with name or opens tasks modal.
746#[derive(Debug, PartialEq, Clone, Deserialize, JsonSchema, Action)]
747#[action(namespace = task)]
748#[serde(untagged)]
749pub enum Spawn {
750 /// Spawns a task by the name given.
751 ByName {
752 task_name: String,
753 #[serde(default)]
754 reveal_target: Option<RevealTarget>,
755 },
756 /// Spawns a task by the tag given.
757 ByTag {
758 task_tag: String,
759 #[serde(default)]
760 reveal_target: Option<RevealTarget>,
761 },
762 /// Spawns a task via modal's selection.
763 ViaModal {
764 /// Selected task's `reveal_target` property override.
765 #[serde(default)]
766 reveal_target: Option<RevealTarget>,
767 },
768}
769
770impl Spawn {
771 pub fn modal() -> Self {
772 Self::ViaModal {
773 reveal_target: None,
774 }
775 }
776}
777
778/// Reruns the last task.
779#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
780#[action(namespace = task)]
781#[serde(deny_unknown_fields)]
782pub struct Rerun {
783 /// Controls whether the task context is reevaluated prior to execution of a task.
784 /// If it is not, environment variables such as ZED_COLUMN, ZED_FILE are gonna be the same as in the last execution of a task
785 /// If it is, these variables will be updated to reflect current state of editor at the time task::Rerun is executed.
786 /// default: false
787 #[serde(default)]
788 pub reevaluate_context: bool,
789 /// Overrides `allow_concurrent_runs` property of the task being reran.
790 /// Default: null
791 #[serde(default)]
792 pub allow_concurrent_runs: Option<bool>,
793 /// Overrides `use_new_terminal` property of the task being reran.
794 /// Default: null
795 #[serde(default)]
796 pub use_new_terminal: Option<bool>,
797
798 /// If present, rerun the task with this ID, otherwise rerun the last task.
799 #[serde(skip)]
800 pub task_id: Option<String>,
801}
802
803pub mod outline {
804 use std::sync::OnceLock;
805
806 use gpui::{AnyView, App, Window, actions};
807
808 actions!(
809 outline,
810 [
811 #[action(name = "Toggle")]
812 ToggleOutline
813 ]
814 );
815 /// A pointer to outline::toggle function, exposed here to sewer the breadcrumbs <-> outline dependency.
816 pub static TOGGLE_OUTLINE: OnceLock<fn(AnyView, &mut Window, &mut App)> = OnceLock::new();
817}
818
819actions!(
820 omega_predict_onboarding,
821 [
822 /// Opens the Omega Predict onboarding modal.
823 #[action(deprecated_aliases = ["zed_predict_onboarding::OpenZedPredictOnboarding"])]
824 OpenOmegaPredictOnboarding
825 ]
826);
827actions!(
828 git_onboarding,
829 [
830 /// Opens the git integration onboarding modal.
831 OpenGitIntegrationOnboarding
832 ]
833);
834
835pub mod debug_panel {
836 use gpui::actions;
837 actions!(
838 debug_panel,
839 [
840 /// Toggles the debug panel.
841 Toggle,
842 /// Toggles focus on the debug panel.
843 ToggleFocus
844 ]
845 );
846}
847
848pub mod full_auto_panel {
849 use gpui::actions;
850 actions!(
851 full_auto_panel,
852 [
853 /// Toggles focus on the Full Auto panel.
854 ToggleFocus,
855 /// Opens the Full Auto launcher (never a composer toggle).
856 OpenLauncher
857 ]
858 );
859}
860
861pub mod agent_computer {
862 use gpui::actions;
863 actions!(
864 agent_computer,
865 [
866 /// Opens the Agent Computer panel.
867 OpenPanel,
868 /// Starts one Agent Computer cloud turn from the panel.
869 StartTurn
870 ]
871 );
872}
873
874pub mod workroom {
875 use gpui::actions;
876 actions!(
877 workroom,
878 [
879 /// Opens the Sarah workroom panel.
880 OpenPanel,
881 /// Focuses the Sarah workroom composer.
882 FocusComposer,
883 /// Sends the composer text as an owner message (pending until confirmed).
884 SendMessage,
885 /// Sends a typed interrupt intent for the active Sarah turn.
886 InterruptTurn
887 ]
888 );
889}
890
891actions!(
892 debugger,
893 [
894 /// Toggles the enabled state of a breakpoint.
895 ToggleEnableBreakpoint,
896 /// Removes a breakpoint.
897 UnsetBreakpoint,
898 /// Opens the project debug tasks configuration.
899 OpenProjectDebugTasks,
900 ]
901);
902
903pub mod vim {
904 use gpui::actions;
905
906 actions!(
907 vim,
908 [
909 /// Opens the default keymap file.
910 OpenDefaultKeymap
911 ]
912 );
913}
914
915#[derive(Debug, Clone, PartialEq, Eq, Hash)]
916pub struct WslConnectionOptions {
917 pub distro_name: String,
918 pub user: Option<String>,
919}
920
921#[cfg(target_os = "windows")]
922pub mod wsl_actions {
923 use gpui::Action;
924 use schemars::JsonSchema;
925 use serde::Deserialize;
926
927 /// Opens a folder inside Wsl.
928 #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
929 #[action(namespace = projects)]
930 #[serde(deny_unknown_fields)]
931 pub struct OpenFolderInWsl {
932 #[serde(default)]
933 pub create_new_window: Option<bool>,
934 }
935
936 /// Open a wsl distro.
937 #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
938 #[action(namespace = projects)]
939 #[serde(deny_unknown_fields)]
940 pub struct OpenWsl {
941 #[serde(default)]
942 pub create_new_window: Option<bool>,
943 }
944}
945
946pub mod preview {
947 pub mod markdown {
948 use gpui::actions;
949
950 actions!(
951 markdown,
952 [
953 /// Opens a markdown preview for the current file.
954 OpenPreview,
955 /// Opens a markdown preview in a split pane.
956 OpenPreviewToTheSide,
957 ]
958 );
959 }
960
961 pub mod svg {
962 use gpui::actions;
963
964 actions!(
965 svg,
966 [
967 /// Opens an SVG preview for the current file.
968 OpenPreview,
969 /// Opens an SVG preview in a split pane.
970 OpenPreviewToTheSide,
971 ]
972 );
973 }
974}
975
976pub mod agents_sidebar {
977 use gpui::{Action, actions};
978 use schemars::JsonSchema;
979 use serde::Deserialize;
980
981 /// Toggles the thread switcher popup when the sidebar is focused.
982 #[derive(PartialEq, Clone, Deserialize, JsonSchema, Default, Action)]
983 #[action(namespace = agents_sidebar)]
984 #[serde(deny_unknown_fields)]
985 pub struct ToggleThreadSwitcher {
986 #[serde(default)]
987 pub select_last: bool,
988 }
989
990 actions!(
991 agents_sidebar,
992 [
993 /// Moves focus to the sidebar's search/filter editor.
994 FocusSidebarFilter,
995 ]
996 );
997}
998
999pub mod notebook {
1000 use gpui::actions;
1001
1002 actions!(
1003 notebook,
1004 [
1005 /// Opens a Jupyter notebook file.
1006 OpenNotebook,
1007 /// Runs all cells in the notebook.
1008 RunAll,
1009 /// Runs the current cell and stays on it.
1010 Run,
1011 /// Runs the current cell and advances to the next cell.
1012 RunAndAdvance,
1013 /// Clears all cell outputs.
1014 ClearOutputs,
1015 /// Moves the current cell up.
1016 MoveCellUp,
1017 /// Moves the current cell down.
1018 MoveCellDown,
1019 /// Adds a new markdown cell.
1020 AddMarkdownBlock,
1021 /// Adds a new code cell.
1022 AddCodeBlock,
1023 /// Restarts the kernel.
1024 RestartKernel,
1025 /// Interrupts the current execution.
1026 InterruptKernel,
1027 /// Move down in cells.
1028 NotebookMoveDown,
1029 /// Move up in cells.
1030 NotebookMoveUp,
1031 /// Enters the current cell's editor (edit mode).
1032 EnterEditMode,
1033 /// Exits the cell editor and returns to cell command mode.
1034 EnterCommandMode,
1035 ]
1036 );
1037}
1038
1039pub mod git_panel {
1040 use gpui::actions;
1041
1042 actions!(
1043 git_panel,
1044 [
1045 /// Toggles focus on the git panel.
1046 ToggleFocus,
1047 ]
1048 );
1049}
1050
1051#[cfg(test)]
1052mod tests {
1053 use super::{OpenEditorOnboarding, OpenOnboarding, dev::ResetOnboarding};
1054 use gpui::Action;
1055
1056 #[test]
1057 fn onboarding_actions_use_omega_product_namespace() {
1058 assert_eq!(OpenOnboarding.name(), "omega::OpenOnboarding");
1059 assert_eq!(OpenEditorOnboarding.name(), "omega::OpenEditorOnboarding");
1060 assert_eq!(ResetOnboarding.name(), "dev::ResetOnboarding");
1061 }
1062}
1063