BlueGit

ict rusty-teams

feat(agents): Agents is its own page instead of a rail popover

- Rail > Agents opens a sidebar page like Saved (Ctrl+6)
- Running and Done lists, row click jumps to the message
- Ctrl+6 is ignored without actions; the page falls back to Chats when the last action goes
- Layout guard renders the agents list with demo runs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-13 · 7 weeks ago

Hash
aa28249ca086b8baa5326204e600364e4be5d14b
Parent
22425eb6
8 files changed +148 −146
README.md +1 −1
@@ -71,7 +71,7 @@
71 71 - Agents read allowed chats, channels, meetings and transcripts (images, reactions, files and cards included, newest messages across chats), and propose replies
72 72 - A proposal shows as a card above the composer: Send, Edit or Discard. Agents never send
73 73 - One-click install for Claude Code, Codex CLI, Copilot CLI, VS Code and Cursor, Windows and WSL. WSL needs `networkingMode=mirrored`
74 - Delegate a message to a coding-agent CLI (Claude Code, Copilot, any CLI) from the hover toolbar: progress chip, Agents rail entry, toast when it finishes, Open session
74 - Delegate a message to a coding-agent CLI (Claude Code, Copilot, any CLI) from the hover toolbar: progress chip, Agents page, toast when it finishes, Open session
75 75
76 76 **App**
77 77 - Dark theme, opens instantly from the cache
@@ -71,7 +71,7 @@
71- Agents read allowed chats, channels, meetings and transcripts (images, reactions, files and cards included, newest messages across chats), and propose replies
71- Agents read allowed chats, channels, meetings and transcripts (images, reactions, files and cards included, newest messages across chats), and propose replies
72- A proposal shows as a card above the composer: Send, Edit or Discard. Agents never send
72- A proposal shows as a card above the composer: Send, Edit or Discard. Agents never send
73- One-click install for Claude Code, Codex CLI, Copilot CLI, VS Code and Cursor, Windows and WSL. WSL needs `networkingMode=mirrored`
73- One-click install for Claude Code, Codex CLI, Copilot CLI, VS Code and Cursor, Windows and WSL. WSL needs `networkingMode=mirrored`
74- Delegate a message to a coding-agent CLI (Claude Code, Copilot, any CLI) from the hover toolbar: progress chip, Agents rail entry, toast when it finishes, Open session
74- Delegate a message to a coding-agent CLI (Claude Code, Copilot, any CLI) from the hover toolbar: progress chip, Agents page, toast when it finishes, Open session
75
75
76**App**
76**App**
77- Dark theme, opens instantly from the cache
77- Dark theme, opens instantly from the cache
crates/app/src/agents/runs_popover.rs crates/app/src/agents/agents_panel.rs renamed +50 −49
@@ -1,56 +1,48 @@
1 1 use gpui_kit::assets::IconName;
2 use gpui_kit::base::PopoverState;
3 2 use gpui_kit::component::{h_flex, v_flex};
4 3 use gpui_kit::prelude::FluentBuilder as _;
5 4 use gpui_kit::*;
6 5
7 6 use super::runs::{AgentRun, AgentRuns, RunState};
8 7 use super::spinner::spinner;
9 use crate::app_state::AppState;
10 use crate::notify::selection_for;
11 8 use crate::theme;
12 9 use crate::views::widgets::icon;
13 10
14 const POPOVER_WIDTH: f32 = 300.;
15 const DONE_LIMIT: usize = 10;
11 const DONE_LIMIT: usize = 50;
16 12 const HISTORY_WINDOW: usize = 60;
13 const EMPTY_TEXT: &str = "No agent runs yet. Hover a message and click the robot button.";
17 14 const STATUS_ICON: f32 = 12.;
18 15
19 pub struct RunsPopover {
20 app: Entity<AppState>,
16 pub enum AgentsPanelEvent {
17 Open {
18 conversation_id: String,
19 message_id: String,
20 },
21 }
22
23 pub struct AgentsPanel {
21 24 runs: Entity<AgentRuns>,
22 popover: Option<WeakEntity<PopoverState>>,
25 scroll: ScrollHandle,
23 26 _subscription: Subscription,
24 27 }
25 28
26 impl RunsPopover {
27 pub fn new(app: Entity<AppState>, runs: Entity<AgentRuns>, cx: &mut Context<Self>) -> Self {
29 impl EventEmitter<AgentsPanelEvent> for AgentsPanel {}
30
31 impl AgentsPanel {
32 pub fn new(runs: Entity<AgentRuns>, cx: &mut Context<Self>) -> Self {
28 33 let subscription = cx.observe(&runs, |_, _, cx| cx.notify());
29 RunsPopover {
30 app,
34 AgentsPanel {
31 35 runs,
32 popover: None,
36 scroll: ScrollHandle::new(),
33 37 _subscription: subscription,
34 38 }
35 39 }
36 40
37 pub fn set_popover(&mut self, popover: WeakEntity<PopoverState>) {
38 self.popover = Some(popover);
39 }
40
41 fn show(&mut self, run: &AgentRun, window: &mut Window, cx: &mut Context<Self>) {
42 let selection = selection_for(&self.app.read(cx).sidebar, &run.conversation_id);
43 if let Some(selection) = selection {
44 let message_id = run.message_id.clone();
45 self.app.update(cx, |state, cx| {
46 state.jump_to_message(selection, message_id, cx)
47 });
48 }
49 if let Some(popover) = &self.popover {
50 popover
51 .update(cx, |state, cx| state.dismiss(window, cx))
52 .ok();
53 }
41 fn show(&mut self, run: &AgentRun, cx: &mut Context<Self>) {
42 cx.emit(AgentsPanelEvent::Open {
43 conversation_id: run.conversation_id.clone(),
44 message_id: run.message_id.clone(),
45 });
54 46 }
55 47
56 48 fn row(&self, run: &AgentRun, cx: &mut Context<Self>) -> Stateful<Div> {
@@ -87,14 +79,14 @@ impl RunsPopover {
87 79 };
88 80 h_flex()
89 81 .id(("agent-run-row", run.id as usize))
90 .w_full()
82 .mx(px(6.))
91 83 .px(px(10.))
92 .py(px(6.))
93 .gap(px(10.))
84 .py(px(8.))
85 .gap(px(12.))
94 86 .items_start()
95 .rounded(px(6.))
87 .rounded(px(8.))
96 88 .cursor_pointer()
97 .hover(|row| row.bg(theme::popup_hover()))
89 .hover(|row| row.bg(theme::row_hover()))
98 90 .child(status.flex_none())
99 91 .child(
100 92 v_flex()
@@ -117,14 +109,14 @@ impl RunsPopover {
117 109 ),
118 110 )
119 111 .child(trailing.flex_none())
120 .on_click(cx.listener(move |this, _, window, cx| this.show(&shown, window, cx)))
112 .on_click(cx.listener(move |this, _, _, cx| this.show(&shown, cx)))
121 113 }
122 114 }
123 115
124 116 fn section_header(title: &'static str) -> Div {
125 117 div()
126 .px(px(10.))
127 .pt(px(6.))
118 .px(px(16.))
119 .pt(px(8.))
128 120 .pb(px(4.))
129 121 .text_size(px(11.))
130 122 .font_weight(FontWeight::SEMIBOLD)
@@ -138,7 +130,7 @@ pub fn split_runs(runs: Vec<&AgentRun>) -> (Vec<&AgentRun>, Vec<&AgentRun>) {
138 130 (running, finished.into_iter().take(DONE_LIMIT).collect())
139 131 }
140 132
141 impl Render for RunsPopover {
133 impl Render for AgentsPanel {
142 134 fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
143 135 let runs = self.runs.read(cx);
144 136 let (running, finished) = split_runs(runs.recent(HISTORY_WINDOW));
@@ -148,7 +140,13 @@ impl Render for RunsPopover {
148 140 );
149 141 let empty = running.is_empty() && finished.is_empty();
150 142 v_flex()
151 .w(px(POPOVER_WIDTH))
143 .id("agents-list")
144 .debug_selector(|| "shell/islands/sidebar/agents".into())
145 .flex_1()
146 .min_h_0()
147 .pb(px(12.))
148 .overflow_y_scroll()
149 .track_scroll(&self.scroll)
152 150 .when(!running.is_empty(), |list| {
153 151 list.child(section_header("Running"))
154 152 .children(running.iter().map(|run| self.row(run, cx)))
@@ -160,11 +158,14 @@ impl Render for RunsPopover {
160 158 .when(empty, |list| {
161 159 list.child(
162 160 div()
163 .px(px(10.))
164 .py(px(8.))
165 .text_size(px(12.))
166 .text_color(theme::text_faint())
167 .child("No agent runs yet"),
161 .py(px(32.))
162 .px(px(24.))
163 .flex()
164 .justify_center()
165 .text_center()
166 .text_size(px(13.))
167 .text_color(theme::text_muted())
168 .child(EMPTY_TEXT),
168 169 )
169 170 })
170 171 }
@@ -177,14 +178,14 @@ mod tests {
177 178 use crate::agents::runs::tests::finished_run;
178 179
179 180 #[test]
180 fn running_runs_go_first_and_done_is_capped_at_ten() {
181 let mut runs: Vec<_> = (0..14).map(finished_run).collect();
181 fn running_runs_go_first_and_done_is_capped_at_fifty() {
182 let mut runs: Vec<_> = (0..60).map(finished_run).collect();
182 183 runs[3].state = RunState::Running;
183 184 let newest_first: Vec<_> = runs.iter().rev().collect();
184 185 let (running, finished) = split_runs(newest_first);
185 186 assert_eq!(running.len(), 1);
186 187 assert_eq!(running[0].id, 3);
187 assert_eq!(finished.len(), 10);
188 assert_eq!(finished[0].id, 13);
188 assert_eq!(finished.len(), 50);
189 assert_eq!(finished[0].id, 59);
189 190 }
190 191 }
@@ -1,56 +1,48 @@
1use gpui_kit::assets::IconName;
1use gpui_kit::assets::IconName;
2use gpui_kit::base::PopoverState;
3use gpui_kit::component::{h_flex, v_flex};
2use gpui_kit::component::{h_flex, v_flex};
4use gpui_kit::prelude::FluentBuilder as _;
3use gpui_kit::prelude::FluentBuilder as _;
5use gpui_kit::*;
4use gpui_kit::*;
6
5
7use super::runs::{AgentRun, AgentRuns, RunState};
6use super::runs::{AgentRun, AgentRuns, RunState};
8use super::spinner::spinner;
7use super::spinner::spinner;
9use crate::app_state::AppState;
10use crate::notify::selection_for;
11use crate::theme;
8use crate::theme;
12use crate::views::widgets::icon;
9use crate::views::widgets::icon;
13
10
14const POPOVER_WIDTH: f32 = 300.;
11const DONE_LIMIT: usize = 50;
15const DONE_LIMIT: usize = 10;
16const HISTORY_WINDOW: usize = 60;
12const HISTORY_WINDOW: usize = 60;
13const EMPTY_TEXT: &str = "No agent runs yet. Hover a message and click the robot button.";
17const STATUS_ICON: f32 = 12.;
14const STATUS_ICON: f32 = 12.;
18
15
19pub struct RunsPopover {
16pub enum AgentsPanelEvent {
20 app: Entity<AppState>,
17 Open {
18 conversation_id: String,
19 message_id: String,
20 },
21}
22
23pub struct AgentsPanel {
21 runs: Entity<AgentRuns>,
24 runs: Entity<AgentRuns>,
22 popover: Option<WeakEntity<PopoverState>>,
25 scroll: ScrollHandle,
23 _subscription: Subscription,
26 _subscription: Subscription,
24}
27}
25
28
26impl RunsPopover {
29impl EventEmitter<AgentsPanelEvent> for AgentsPanel {}
27 pub fn new(app: Entity<AppState>, runs: Entity<AgentRuns>, cx: &mut Context<Self>) -> Self {
30
31impl AgentsPanel {
32 pub fn new(runs: Entity<AgentRuns>, cx: &mut Context<Self>) -> Self {
28 let subscription = cx.observe(&runs, |_, _, cx| cx.notify());
33 let subscription = cx.observe(&runs, |_, _, cx| cx.notify());
29 RunsPopover {
34 AgentsPanel {
30 app,
31 runs,
35 runs,
32 popover: None,
36 scroll: ScrollHandle::new(),
33 _subscription: subscription,
37 _subscription: subscription,
34 }
38 }
35 }
39 }
36
40
37 pub fn set_popover(&mut self, popover: WeakEntity<PopoverState>) {
41 fn show(&mut self, run: &AgentRun, cx: &mut Context<Self>) {
38 self.popover = Some(popover);
42 cx.emit(AgentsPanelEvent::Open {
39 }
43 conversation_id: run.conversation_id.clone(),
40
44 message_id: run.message_id.clone(),
41 fn show(&mut self, run: &AgentRun, window: &mut Window, cx: &mut Context<Self>) {
45 });
42 let selection = selection_for(&self.app.read(cx).sidebar, &run.conversation_id);
43 if let Some(selection) = selection {
44 let message_id = run.message_id.clone();
45 self.app.update(cx, |state, cx| {
46 state.jump_to_message(selection, message_id, cx)
47 });
48 }
49 if let Some(popover) = &self.popover {
50 popover
51 .update(cx, |state, cx| state.dismiss(window, cx))
52 .ok();
53 }
54 }
46 }
55
47
56 fn row(&self, run: &AgentRun, cx: &mut Context<Self>) -> Stateful<Div> {
48 fn row(&self, run: &AgentRun, cx: &mut Context<Self>) -> Stateful<Div> {
@@ -87,14 +79,14 @@ impl RunsPopover {
87 };
79 };
88 h_flex()
80 h_flex()
89 .id(("agent-run-row", run.id as usize))
81 .id(("agent-run-row", run.id as usize))
90 .w_full()
82 .mx(px(6.))
91 .px(px(10.))
83 .px(px(10.))
92 .py(px(6.))
84 .py(px(8.))
93 .gap(px(10.))
85 .gap(px(12.))
94 .items_start()
86 .items_start()
95 .rounded(px(6.))
87 .rounded(px(8.))
96 .cursor_pointer()
88 .cursor_pointer()
97 .hover(|row| row.bg(theme::popup_hover()))
89 .hover(|row| row.bg(theme::row_hover()))
98 .child(status.flex_none())
90 .child(status.flex_none())
99 .child(
91 .child(
100 v_flex()
92 v_flex()
@@ -117,14 +109,14 @@ impl RunsPopover {
117 ),
109 ),
118 )
110 )
119 .child(trailing.flex_none())
111 .child(trailing.flex_none())
120 .on_click(cx.listener(move |this, _, window, cx| this.show(&shown, window, cx)))
112 .on_click(cx.listener(move |this, _, _, cx| this.show(&shown, cx)))
121 }
113 }
122}
114}
123
115
124fn section_header(title: &'static str) -> Div {
116fn section_header(title: &'static str) -> Div {
125 div()
117 div()
126 .px(px(10.))
118 .px(px(16.))
127 .pt(px(6.))
119 .pt(px(8.))
128 .pb(px(4.))
120 .pb(px(4.))
129 .text_size(px(11.))
121 .text_size(px(11.))
130 .font_weight(FontWeight::SEMIBOLD)
122 .font_weight(FontWeight::SEMIBOLD)
@@ -138,7 +130,7 @@ pub fn split_runs(runs: Vec<&AgentRun>) -> (Vec<&AgentRun>, Vec<&AgentRun>) {
138 (running, finished.into_iter().take(DONE_LIMIT).collect())
130 (running, finished.into_iter().take(DONE_LIMIT).collect())
139}
131}
140
132
141impl Render for RunsPopover {
133impl Render for AgentsPanel {
142 fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
134 fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
143 let runs = self.runs.read(cx);
135 let runs = self.runs.read(cx);
144 let (running, finished) = split_runs(runs.recent(HISTORY_WINDOW));
136 let (running, finished) = split_runs(runs.recent(HISTORY_WINDOW));
@@ -148,7 +140,13 @@ impl Render for RunsPopover {
148 );
140 );
149 let empty = running.is_empty() && finished.is_empty();
141 let empty = running.is_empty() && finished.is_empty();
150 v_flex()
142 v_flex()
151 .w(px(POPOVER_WIDTH))
143 .id("agents-list")
144 .debug_selector(|| "shell/islands/sidebar/agents".into())
145 .flex_1()
146 .min_h_0()
147 .pb(px(12.))
148 .overflow_y_scroll()
149 .track_scroll(&self.scroll)
152 .when(!running.is_empty(), |list| {
150 .when(!running.is_empty(), |list| {
153 list.child(section_header("Running"))
151 list.child(section_header("Running"))
154 .children(running.iter().map(|run| self.row(run, cx)))
152 .children(running.iter().map(|run| self.row(run, cx)))
@@ -160,11 +158,14 @@ impl Render for RunsPopover {
160 .when(empty, |list| {
158 .when(empty, |list| {
161 list.child(
159 list.child(
162 div()
160 div()
163 .px(px(10.))
161 .py(px(32.))
164 .py(px(8.))
162 .px(px(24.))
165 .text_size(px(12.))
163 .flex()
166 .text_color(theme::text_faint())
164 .justify_center()
167 .child("No agent runs yet"),
165 .text_center()
166 .text_size(px(13.))
167 .text_color(theme::text_muted())
168 .child(EMPTY_TEXT),
168 )
169 )
169 })
170 })
170 }
171 }
@@ -177,14 +178,14 @@ mod tests {
177 use crate::agents::runs::tests::finished_run;
178 use crate::agents::runs::tests::finished_run;
178
179
179 #[test]
180 #[test]
180 fn running_runs_go_first_and_done_is_capped_at_ten() {
181 fn running_runs_go_first_and_done_is_capped_at_fifty() {
181 let mut runs: Vec<_> = (0..14).map(finished_run).collect();
182 let mut runs: Vec<_> = (0..60).map(finished_run).collect();
182 runs[3].state = RunState::Running;
183 runs[3].state = RunState::Running;
183 let newest_first: Vec<_> = runs.iter().rev().collect();
184 let newest_first: Vec<_> = runs.iter().rev().collect();
184 let (running, finished) = split_runs(newest_first);
185 let (running, finished) = split_runs(newest_first);
185 assert_eq!(running.len(), 1);
186 assert_eq!(running.len(), 1);
186 assert_eq!(running[0].id, 3);
187 assert_eq!(running[0].id, 3);
187 assert_eq!(finished.len(), 10);
188 assert_eq!(finished.len(), 50);
188 assert_eq!(finished[0].id, 13);
189 assert_eq!(finished[0].id, 59);
189 }
190 }
190}
191}
crates/app/src/agents/mod.rs +6 −2
@@ -1,3 +1,4 @@
1 mod agents_panel;
1 2 mod demo;
2 3 mod kills;
3 4 mod lanes;
@@ -5,7 +6,6 @@ mod mcp_bridge;
5 6 mod message_context;
6 7 mod run_chip;
7 8 mod runs;
8 mod runs_popover;
9 9 mod session_options;
10 10 mod settings_controls;
11 11 mod settings_forms;
@@ -23,9 +23,9 @@ use agents::{AgentAction, Environment};
23 23 use directories::ProjectDirs;
24 24 use gpui_kit::*;
25 25
26 pub use agents_panel::{AgentsPanel, AgentsPanelEvent};
26 27 pub use run_chip::run_chip;
27 28 pub use runs::{AgentRun, AgentRuns, AgentRunsEvent, AgentRunsHandle, RunState, StartOptions};
28 pub use runs_popover::RunsPopover;
29 29 pub use settings_section::AgentsSettings;
30 30 pub use start_dialog::{StartDialog, StartDialogEvent, StartRequest};
31 31
@@ -50,6 +50,10 @@ pub fn runs_handle(cx: &App) -> Option<Entity<AgentRuns>> {
50 50 .map(|handle| handle.0.clone())
51 51 }
52 52
53 pub fn agents_enabled(cx: &App) -> bool {
54 runs_handle(cx).is_some_and(|runs| !runs.read(cx).settings().actions.is_empty())
55 }
56
53 57 fn raise_notice(text: String, cx: &mut App) {
54 58 let Some(handle) = cx.try_global::<AppHandle>() else {
55 59 return;
@@ -1,3 +1,4 @@
1mod agents_panel;
1mod demo;
2mod demo;
2mod kills;
3mod kills;
3mod lanes;
4mod lanes;
@@ -5,7 +6,6 @@ mod mcp_bridge;
5mod message_context;
6mod message_context;
6mod run_chip;
7mod run_chip;
7mod runs;
8mod runs;
8mod runs_popover;
9mod session_options;
9mod session_options;
10mod settings_controls;
10mod settings_controls;
11mod settings_forms;
11mod settings_forms;
@@ -23,9 +23,9 @@ use agents::{AgentAction, Environment};
23use directories::ProjectDirs;
23use directories::ProjectDirs;
24use gpui_kit::*;
24use gpui_kit::*;
25
25
26pub use agents_panel::{AgentsPanel, AgentsPanelEvent};
26pub use run_chip::run_chip;
27pub use run_chip::run_chip;
27pub use runs::{AgentRun, AgentRuns, AgentRunsEvent, AgentRunsHandle, RunState, StartOptions};
28pub use runs::{AgentRun, AgentRuns, AgentRunsEvent, AgentRunsHandle, RunState, StartOptions};
28pub use runs_popover::RunsPopover;
29pub use settings_section::AgentsSettings;
29pub use settings_section::AgentsSettings;
30pub use start_dialog::{StartDialog, StartDialogEvent, StartRequest};
30pub use start_dialog::{StartDialog, StartDialogEvent, StartRequest};
31
31
@@ -50,6 +50,10 @@ pub fn runs_handle(cx: &App) -> Option<Entity<AgentRuns>> {
50 .map(|handle| handle.0.clone())
50 .map(|handle| handle.0.clone())
51}
51}
52
52
53pub fn agents_enabled(cx: &App) -> bool {
54 runs_handle(cx).is_some_and(|runs| !runs.read(cx).settings().actions.is_empty())
55}
56
53fn raise_notice(text: String, cx: &mut App) {
57fn raise_notice(text: String, cx: &mut App) {
54 let Some(handle) = cx.try_global::<AppHandle>() else {
58 let Some(handle) = cx.try_global::<AppHandle>() else {
55 return;
59 return;
crates/app/src/layout_guard.rs +6 −2
@@ -132,7 +132,7 @@ mod frames {
132 132 use crate::views::call_transcript::TranscriptPanel;
133 133 use crate::views::recap_tab::RECAP_REGION;
134 134 use crate::views::shell::{AppShell, Startup, bind_keys, install_globals, sidebar_hidden_in_call};
135 use crate::views::shortcuts::{OpenActivity, OpenCallsTab, OpenChannelsTab, OpenSaved};
135 use crate::views::shortcuts::{OpenActivity, OpenAgents, OpenCallsTab, OpenChannelsTab, OpenSaved};
136 136
137 137 const GUARDED: &[&str] = &[
138 138 "shell",
@@ -153,6 +153,7 @@ mod frames {
153 153 "shell/islands/main/call-controls/mic",
154 154 "shell/islands/main/call-controls/leave",
155 155 ];
156 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
156 157 const CALLS_TAGS: &[&str] = &[
157 158 "shell/islands/sidebar/calls-actions",
158 159 "shell/islands/sidebar/calls-actions/meet-now",
@@ -321,7 +322,7 @@ mod frames {
321 322 .chain(CALLS_TAGS)
322 323 .chain(PREJOIN_TAGS)
323 324 .chain(SHARE_GUARDED)
324 .chain([&CALL_TRANSCRIPT, &MENU, &RECAP_TAB, &RECAP_REGION, &PEOPLE_PANEL])
325 .chain([&AGENTS_LIST, &CALL_TRANSCRIPT, &MENU, &RECAP_TAB, &RECAP_REGION, &PEOPLE_PANEL])
325 326 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
326 327 .collect()
327 328 }
@@ -372,6 +373,7 @@ mod frames {
372 373 };
373 374 let state = cx.new(|_| AppState::new(Arc::new(store), mode));
374 375 install_globals(&state, UserInput::new(), cx);
376 crate::agents::install(state.clone(), cx);
375 377 demo::start_session(&state, cx);
376 378 let shared_state = state.clone();
377 379 let startup = Startup {
@@ -443,6 +445,7 @@ mod frames {
443 445 ),
444 446 Screen::Tab("saved", Some(|visual| visual.dispatch_action(OpenSaved))),
445 447 Screen::Tab("calls", Some(|visual| visual.dispatch_action(OpenCallsTab))),
448 Screen::Tab("agents", Some(|visual| visual.dispatch_action(OpenAgents))),
446 449 Screen::Prejoin,
447 450 Screen::StatusMenu,
448 451 Screen::Call,
@@ -547,6 +550,7 @@ mod frames {
547 550 }
548 551 match screen_name {
549 552 "calls" => expected.extend(CALLS_TAGS),
553 "agents" => expected.push(AGENTS_LIST),
550 554 "prejoin" => expected.extend(PREJOIN_TAGS),
551 555 _ => {}
552 556 }
@@ -132,7 +132,7 @@ mod frames {
132 use crate::views::call_transcript::TranscriptPanel;
132 use crate::views::call_transcript::TranscriptPanel;
133 use crate::views::recap_tab::RECAP_REGION;
133 use crate::views::recap_tab::RECAP_REGION;
134 use crate::views::shell::{AppShell, Startup, bind_keys, install_globals, sidebar_hidden_in_call};
134 use crate::views::shell::{AppShell, Startup, bind_keys, install_globals, sidebar_hidden_in_call};
135 use crate::views::shortcuts::{OpenActivity, OpenCallsTab, OpenChannelsTab, OpenSaved};
135 use crate::views::shortcuts::{OpenActivity, OpenAgents, OpenCallsTab, OpenChannelsTab, OpenSaved};
136
136
137 const GUARDED: &[&str] = &[
137 const GUARDED: &[&str] = &[
138 "shell",
138 "shell",
@@ -153,6 +153,7 @@ mod frames {
153 "shell/islands/main/call-controls/mic",
153 "shell/islands/main/call-controls/mic",
154 "shell/islands/main/call-controls/leave",
154 "shell/islands/main/call-controls/leave",
155 ];
155 ];
156 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
156 const CALLS_TAGS: &[&str] = &[
157 const CALLS_TAGS: &[&str] = &[
157 "shell/islands/sidebar/calls-actions",
158 "shell/islands/sidebar/calls-actions",
158 "shell/islands/sidebar/calls-actions/meet-now",
159 "shell/islands/sidebar/calls-actions/meet-now",
@@ -321,7 +322,7 @@ mod frames {
321 .chain(CALLS_TAGS)
322 .chain(CALLS_TAGS)
322 .chain(PREJOIN_TAGS)
323 .chain(PREJOIN_TAGS)
323 .chain(SHARE_GUARDED)
324 .chain(SHARE_GUARDED)
324 .chain([&CALL_TRANSCRIPT, &MENU, &RECAP_TAB, &RECAP_REGION, &PEOPLE_PANEL])
325 .chain([&AGENTS_LIST, &CALL_TRANSCRIPT, &MENU, &RECAP_TAB, &RECAP_REGION, &PEOPLE_PANEL])
325 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
326 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
326 .collect()
327 .collect()
327 }
328 }
@@ -372,6 +373,7 @@ mod frames {
372 };
373 };
373 let state = cx.new(|_| AppState::new(Arc::new(store), mode));
374 let state = cx.new(|_| AppState::new(Arc::new(store), mode));
374 install_globals(&state, UserInput::new(), cx);
375 install_globals(&state, UserInput::new(), cx);
376 crate::agents::install(state.clone(), cx);
375 demo::start_session(&state, cx);
377 demo::start_session(&state, cx);
376 let shared_state = state.clone();
378 let shared_state = state.clone();
377 let startup = Startup {
379 let startup = Startup {
@@ -443,6 +445,7 @@ mod frames {
443 ),
445 ),
444 Screen::Tab("saved", Some(|visual| visual.dispatch_action(OpenSaved))),
446 Screen::Tab("saved", Some(|visual| visual.dispatch_action(OpenSaved))),
445 Screen::Tab("calls", Some(|visual| visual.dispatch_action(OpenCallsTab))),
447 Screen::Tab("calls", Some(|visual| visual.dispatch_action(OpenCallsTab))),
448 Screen::Tab("agents", Some(|visual| visual.dispatch_action(OpenAgents))),
446 Screen::Prejoin,
449 Screen::Prejoin,
447 Screen::StatusMenu,
450 Screen::StatusMenu,
448 Screen::Call,
451 Screen::Call,
@@ -547,6 +550,7 @@ mod frames {
547 }
550 }
548 match screen_name {
551 match screen_name {
549 "calls" => expected.extend(CALLS_TAGS),
552 "calls" => expected.extend(CALLS_TAGS),
553 "agents" => expected.push(AGENTS_LIST),
550 "prejoin" => expected.extend(PREJOIN_TAGS),
554 "prejoin" => expected.extend(PREJOIN_TAGS),
551 _ => {}
555 _ => {}
552 }
556 }
crates/app/src/views/rail.rs +28 −88
@@ -1,6 +1,5 @@
1 1 use gpui_kit::assets::IconName;
2 use gpui_kit::base::Selectable;
3 use gpui_kit::component::{popover::Popover, tooltip::Tooltip, v_flex};
2 use gpui_kit::component::{tooltip::Tooltip, v_flex};
4 3 use gpui_kit::prelude::FluentBuilder as _;
5 4 use gpui_kit::*;
6 5
@@ -9,7 +8,7 @@ use super::shortcuts::keys_for_label;
9 8 use super::sidebar::{SidebarTab, SidebarView};
10 9 use super::widgets::icon;
11 10 use crate::activity::ActivityCenter;
12 use crate::agents::{AgentRuns, RunsPopover, runs_handle};
11 use crate::agents::{AgentRuns, runs_handle};
13 12 use crate::app_state::AppState;
14 13 use crate::format;
15 14 use crate::sidebar_model::{any_unread_channel, unread_chat_count};
@@ -29,15 +28,9 @@ enum RailBadge {
29 28 Dot,
30 29 }
31 30
32 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
33 enum RailTarget {
34 Tab(SidebarTab),
35 Agents,
36 }
37
38 31 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
39 32 struct RailItem {
40 target: RailTarget,
33 tab: SidebarTab,
41 34 label: &'static str,
42 35 shortcut_label: &'static str,
43 36 icon: IconName,
@@ -59,21 +52,21 @@ fn rail_items(
59 52 ) -> Vec<RailItem> {
60 53 let mut items = vec![
61 54 RailItem {
62 target: RailTarget::Tab(SidebarTab::Activity),
55 tab: SidebarTab::Activity,
63 56 label: "Activity",
64 57 shortcut_label: "Open Activity",
65 58 icon: IconName::Bell,
66 59 badge: count_badge_for(activity_unread),
67 60 },
68 61 RailItem {
69 target: RailTarget::Tab(SidebarTab::Chats),
62 tab: SidebarTab::Chats,
70 63 label: "Chats",
71 64 shortcut_label: "Show Chats",
72 65 icon: IconName::MessageSquare,
73 66 badge: count_badge_for(unread_chats),
74 67 },
75 68 RailItem {
76 target: RailTarget::Tab(SidebarTab::Channels),
69 tab: SidebarTab::Channels,
77 70 label: "Channels",
78 71 shortcut_label: "Show Channels",
79 72 icon: IconName::Users,
@@ -84,14 +77,14 @@ fn rail_items(
84 77 },
85 78 },
86 79 RailItem {
87 target: RailTarget::Tab(SidebarTab::Calls),
80 tab: SidebarTab::Calls,
88 81 label: "Calls",
89 82 shortcut_label: "Show Calls",
90 83 icon: IconName::Phone,
91 84 badge: RailBadge::None,
92 85 },
93 86 RailItem {
94 target: RailTarget::Tab(SidebarTab::Saved),
87 tab: SidebarTab::Saved,
95 88 label: "Saved",
96 89 shortcut_label: "Open Saved",
97 90 icon: IconName::Bookmark,
@@ -100,9 +93,9 @@ fn rail_items(
100 93 ];
101 94 if let Some(running) = agents_running {
102 95 items.push(RailItem {
103 target: RailTarget::Agents,
96 tab: SidebarTab::Agents,
104 97 label: "Agents",
105 shortcut_label: "Agents",
98 shortcut_label: "Open Agents",
106 99 icon: IconName::Bot,
107 100 badge: count_badge_for(running),
108 101 });
@@ -122,7 +115,6 @@ pub struct RailView {
122 115 activity: Entity<ActivityCenter>,
123 116 sidebar: Entity<SidebarView>,
124 117 runs: Option<Entity<AgentRuns>>,
125 runs_popover: Option<Entity<RunsPopover>>,
126 118 _observations: Vec<Subscription>,
127 119 }
128 120
@@ -167,29 +159,6 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {
167 159 .tooltip(move |window, cx| Tooltip::new(tooltip.clone()).build(window, cx))
168 160 }
169 161
170 #[derive(IntoElement)]
171 struct AgentsTrigger {
172 item: RailItem,
173 open: bool,
174 }
175
176 impl Selectable for AgentsTrigger {
177 fn selected(mut self, selected: bool) -> Self {
178 self.open = selected;
179 self
180 }
181
182 fn is_selected(&self) -> bool {
183 self.open
184 }
185 }
186
187 impl RenderOnce for AgentsTrigger {
188 fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement {
189 item_element(&self.item, self.open)
190 }
191 }
192
193 162 impl RailView {
194 163 pub fn new(
195 164 state: Entity<AppState>,
@@ -206,57 +175,28 @@ impl RailView {
206 175 if let Some(runs) = &runs {
207 176 observations.push(cx.observe(runs, |_, _, cx| cx.notify()));
208 177 }
209 let runs_popover = runs.clone().map(|runs| {
210 let app = state.clone();
211 cx.new(|cx| RunsPopover::new(app, runs, cx))
212 });
213 178 RailView {
214 179 state,
215 180 activity,
216 181 sidebar,
217 182 runs,
218 runs_popover,
219 183 _observations: observations,
220 184 }
221 185 }
222 186
223 187 fn item(&self, item: &RailItem, active: bool) -> AnyElement {
224 match item.target {
225 RailTarget::Tab(tab) => {
226 let sidebar = self.sidebar.clone();
227 item_element(item, active)
228 .on_click(move |_, _, cx| {
229 sidebar.update(cx, |sidebar, cx| sidebar.open_tab(tab, cx));
230 })
231 .into_any_element()
232 }
233 RailTarget::Agents => self.agents_item(item),
234 }
235 }
236
237 fn agents_item(&self, item: &RailItem) -> AnyElement {
238 let Some(content) = self.runs_popover.clone() else {
239 return div().into_any_element();
240 };
241 Popover::new("rail-agents-popover")
242 .anchor(Anchor::LeftCenter)
243 .offset(px(6.))
244 .p(px(4.))
245 .trigger(AgentsTrigger {
246 item: *item,
247 open: false,
248 })
249 .content(move |_, _, cx| {
250 let popover = cx.entity().downgrade();
251 content.update(cx, |content, _| content.set_popover(popover));
252 content.clone()
188 let tab = item.tab;
189 let sidebar = self.sidebar.clone();
190 item_element(item, active)
191 .on_click(move |_, _, cx| {
192 sidebar.update(cx, |sidebar, cx| sidebar.open_tab(tab, cx));
253 193 })
254 194 .into_any_element()
255 195 }
256 196
257 197 fn agents_running(&self, cx: &App) -> Option<usize> {
258 let runs = self.runs.as_ref()?.read(cx);
259 (!runs.settings().actions.is_empty()).then(|| runs.running_count())
198 let runs = self.runs.as_ref()?;
199 crate::agents::agents_enabled(cx).then(|| runs.read(cx).running_count())
260 200 }
261 201 }
262 202
@@ -318,30 +258,30 @@ impl Render for RailView {
318 258 .children(
319 259 items
320 260 .iter()
321 .map(|item| self.item(item, item.target == RailTarget::Tab(active))),
261 .map(|item| self.item(item, item.tab == active)),
322 262 )
323 263 }
324 264 }
325 265
326 266 #[cfg(test)]
327 267 mod tests {
328 use super::{RailBadge, RailTarget, count_badge_for, rail_items, tooltip_text};
268 use super::{RailBadge, count_badge_for, rail_items, tooltip_text};
329 269 use crate::views::sidebar::SidebarTab;
330 270
331 271 #[test]
332 272 fn items_follow_the_spec_order() {
333 let targets: Vec<RailTarget> = rail_items(0, 0, false, None)
273 let tabs: Vec<SidebarTab> = rail_items(0, 0, false, None)
334 274 .iter()
335 .map(|item| item.target)
275 .map(|item| item.tab)
336 276 .collect();
337 277 assert_eq!(
338 targets,
278 tabs,
339 279 [
340 RailTarget::Tab(SidebarTab::Activity),
341 RailTarget::Tab(SidebarTab::Chats),
342 RailTarget::Tab(SidebarTab::Channels),
343 RailTarget::Tab(SidebarTab::Calls),
344 RailTarget::Tab(SidebarTab::Saved)
280 SidebarTab::Activity,
281 SidebarTab::Chats,
282 SidebarTab::Channels,
283 SidebarTab::Calls,
284 SidebarTab::Saved
345 285 ]
346 286 );
347 287 }
@@ -351,7 +291,7 @@ mod tests {
351 291 assert_eq!(rail_items(0, 0, false, None).len(), 5);
352 292 let with_agents = rail_items(0, 0, false, Some(2));
353 293 assert_eq!(with_agents.len(), 6);
354 assert_eq!(with_agents[5].target, RailTarget::Agents);
294 assert_eq!(with_agents[5].tab, SidebarTab::Agents);
355 295 assert_eq!(with_agents[5].label, "Agents");
356 296 assert_eq!(with_agents[5].badge, RailBadge::Count(2));
357 297 assert_eq!(rail_items(0, 0, false, Some(0))[5].badge, RailBadge::None);
@@ -1,6 +1,5 @@
1use gpui_kit::assets::IconName;
1use gpui_kit::assets::IconName;
2use gpui_kit::base::Selectable;
2use gpui_kit::component::{tooltip::Tooltip, v_flex};
3use gpui_kit::component::{popover::Popover, tooltip::Tooltip, v_flex};
4use gpui_kit::prelude::FluentBuilder as _;
3use gpui_kit::prelude::FluentBuilder as _;
5use gpui_kit::*;
4use gpui_kit::*;
6
5
@@ -9,7 +8,7 @@ use super::shortcuts::keys_for_label;
9use super::sidebar::{SidebarTab, SidebarView};
8use super::sidebar::{SidebarTab, SidebarView};
10use super::widgets::icon;
9use super::widgets::icon;
11use crate::activity::ActivityCenter;
10use crate::activity::ActivityCenter;
12use crate::agents::{AgentRuns, RunsPopover, runs_handle};
11use crate::agents::{AgentRuns, runs_handle};
13use crate::app_state::AppState;
12use crate::app_state::AppState;
14use crate::format;
13use crate::format;
15use crate::sidebar_model::{any_unread_channel, unread_chat_count};
14use crate::sidebar_model::{any_unread_channel, unread_chat_count};
@@ -29,15 +28,9 @@ enum RailBadge {
29 Dot,
28 Dot,
30}
29}
31
30
32#[derive(Debug, Clone, Copy, PartialEq, Eq)]
33enum RailTarget {
34 Tab(SidebarTab),
35 Agents,
36}
37
38#[derive(Debug, Clone, Copy, PartialEq, Eq)]
31#[derive(Debug, Clone, Copy, PartialEq, Eq)]
39struct RailItem {
32struct RailItem {
40 target: RailTarget,
33 tab: SidebarTab,
41 label: &'static str,
34 label: &'static str,
42 shortcut_label: &'static str,
35 shortcut_label: &'static str,
43 icon: IconName,
36 icon: IconName,
@@ -59,21 +52,21 @@ fn rail_items(
59) -> Vec<RailItem> {
52) -> Vec<RailItem> {
60 let mut items = vec![
53 let mut items = vec![
61 RailItem {
54 RailItem {
62 target: RailTarget::Tab(SidebarTab::Activity),
55 tab: SidebarTab::Activity,
63 label: "Activity",
56 label: "Activity",
64 shortcut_label: "Open Activity",
57 shortcut_label: "Open Activity",
65 icon: IconName::Bell,
58 icon: IconName::Bell,
66 badge: count_badge_for(activity_unread),
59 badge: count_badge_for(activity_unread),
67 },
60 },
68 RailItem {
61 RailItem {
69 target: RailTarget::Tab(SidebarTab::Chats),
62 tab: SidebarTab::Chats,
70 label: "Chats",
63 label: "Chats",
71 shortcut_label: "Show Chats",
64 shortcut_label: "Show Chats",
72 icon: IconName::MessageSquare,
65 icon: IconName::MessageSquare,
73 badge: count_badge_for(unread_chats),
66 badge: count_badge_for(unread_chats),
74 },
67 },
75 RailItem {
68 RailItem {
76 target: RailTarget::Tab(SidebarTab::Channels),
69 tab: SidebarTab::Channels,
77 label: "Channels",
70 label: "Channels",
78 shortcut_label: "Show Channels",
71 shortcut_label: "Show Channels",
79 icon: IconName::Users,
72 icon: IconName::Users,
@@ -84,14 +77,14 @@ fn rail_items(
84 },
77 },
85 },
78 },
86 RailItem {
79 RailItem {
87 target: RailTarget::Tab(SidebarTab::Calls),
80 tab: SidebarTab::Calls,
88 label: "Calls",
81 label: "Calls",
89 shortcut_label: "Show Calls",
82 shortcut_label: "Show Calls",
90 icon: IconName::Phone,
83 icon: IconName::Phone,
91 badge: RailBadge::None,
84 badge: RailBadge::None,
92 },
85 },
93 RailItem {
86 RailItem {
94 target: RailTarget::Tab(SidebarTab::Saved),
87 tab: SidebarTab::Saved,
95 label: "Saved",
88 label: "Saved",
96 shortcut_label: "Open Saved",
89 shortcut_label: "Open Saved",
97 icon: IconName::Bookmark,
90 icon: IconName::Bookmark,
@@ -100,9 +93,9 @@ fn rail_items(
100 ];
93 ];
101 if let Some(running) = agents_running {
94 if let Some(running) = agents_running {
102 items.push(RailItem {
95 items.push(RailItem {
103 target: RailTarget::Agents,
96 tab: SidebarTab::Agents,
104 label: "Agents",
97 label: "Agents",
105 shortcut_label: "Agents",
98 shortcut_label: "Open Agents",
106 icon: IconName::Bot,
99 icon: IconName::Bot,
107 badge: count_badge_for(running),
100 badge: count_badge_for(running),
108 });
101 });
@@ -122,7 +115,6 @@ pub struct RailView {
122 activity: Entity<ActivityCenter>,
115 activity: Entity<ActivityCenter>,
123 sidebar: Entity<SidebarView>,
116 sidebar: Entity<SidebarView>,
124 runs: Option<Entity<AgentRuns>>,
117 runs: Option<Entity<AgentRuns>>,
125 runs_popover: Option<Entity<RunsPopover>>,
126 _observations: Vec<Subscription>,
118 _observations: Vec<Subscription>,
127}
119}
128
120
@@ -167,29 +159,6 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {
167 .tooltip(move |window, cx| Tooltip::new(tooltip.clone()).build(window, cx))
159 .tooltip(move |window, cx| Tooltip::new(tooltip.clone()).build(window, cx))
168}
160}
169
161
170#[derive(IntoElement)]
171struct AgentsTrigger {
172 item: RailItem,
173 open: bool,
174}
175
176impl Selectable for AgentsTrigger {
177 fn selected(mut self, selected: bool) -> Self {
178 self.open = selected;
179 self
180 }
181
182 fn is_selected(&self) -> bool {
183 self.open
184 }
185}
186
187impl RenderOnce for AgentsTrigger {
188 fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement {
189 item_element(&self.item, self.open)
190 }
191}
192
193impl RailView {
162impl RailView {
194 pub fn new(
163 pub fn new(
195 state: Entity<AppState>,
164 state: Entity<AppState>,
@@ -206,57 +175,28 @@ impl RailView {
206 if let Some(runs) = &runs {
175 if let Some(runs) = &runs {
207 observations.push(cx.observe(runs, |_, _, cx| cx.notify()));
176 observations.push(cx.observe(runs, |_, _, cx| cx.notify()));
208 }
177 }
209 let runs_popover = runs.clone().map(|runs| {
210 let app = state.clone();
211 cx.new(|cx| RunsPopover::new(app, runs, cx))
212 });
213 RailView {
178 RailView {
214 state,
179 state,
215 activity,
180 activity,
216 sidebar,
181 sidebar,
217 runs,
182 runs,
218 runs_popover,
219 _observations: observations,
183 _observations: observations,
220 }
184 }
221 }
185 }
222
186
223 fn item(&self, item: &RailItem, active: bool) -> AnyElement {
187 fn item(&self, item: &RailItem, active: bool) -> AnyElement {
224 match item.target {
188 let tab = item.tab;
225 RailTarget::Tab(tab) => {
189 let sidebar = self.sidebar.clone();
226 let sidebar = self.sidebar.clone();
190 item_element(item, active)
227 item_element(item, active)
191 .on_click(move |_, _, cx| {
228 .on_click(move |_, _, cx| {
192 sidebar.update(cx, |sidebar, cx| sidebar.open_tab(tab, cx));
229 sidebar.update(cx, |sidebar, cx| sidebar.open_tab(tab, cx));
230 })
231 .into_any_element()
232 }
233 RailTarget::Agents => self.agents_item(item),
234 }
235 }
236
237 fn agents_item(&self, item: &RailItem) -> AnyElement {
238 let Some(content) = self.runs_popover.clone() else {
239 return div().into_any_element();
240 };
241 Popover::new("rail-agents-popover")
242 .anchor(Anchor::LeftCenter)
243 .offset(px(6.))
244 .p(px(4.))
245 .trigger(AgentsTrigger {
246 item: *item,
247 open: false,
248 })
249 .content(move |_, _, cx| {
250 let popover = cx.entity().downgrade();
251 content.update(cx, |content, _| content.set_popover(popover));
252 content.clone()
253 })
193 })
254 .into_any_element()
194 .into_any_element()
255 }
195 }
256
196
257 fn agents_running(&self, cx: &App) -> Option<usize> {
197 fn agents_running(&self, cx: &App) -> Option<usize> {
258 let runs = self.runs.as_ref()?.read(cx);
198 let runs = self.runs.as_ref()?;
259 (!runs.settings().actions.is_empty()).then(|| runs.running_count())
199 crate::agents::agents_enabled(cx).then(|| runs.read(cx).running_count())
260 }
200 }
261}
201}
262
202
@@ -318,30 +258,30 @@ impl Render for RailView {
318 .children(
258 .children(
319 items
259 items
320 .iter()
260 .iter()
321 .map(|item| self.item(item, item.target == RailTarget::Tab(active))),
261 .map(|item| self.item(item, item.tab == active)),
322 )
262 )
323 }
263 }
324}
264}
325
265
326#[cfg(test)]
266#[cfg(test)]
327mod tests {
267mod tests {
328 use super::{RailBadge, RailTarget, count_badge_for, rail_items, tooltip_text};
268 use super::{RailBadge, count_badge_for, rail_items, tooltip_text};
329 use crate::views::sidebar::SidebarTab;
269 use crate::views::sidebar::SidebarTab;
330
270
331 #[test]
271 #[test]
332 fn items_follow_the_spec_order() {
272 fn items_follow_the_spec_order() {
333 let targets: Vec<RailTarget> = rail_items(0, 0, false, None)
273 let tabs: Vec<SidebarTab> = rail_items(0, 0, false, None)
334 .iter()
274 .iter()
335 .map(|item| item.target)
275 .map(|item| item.tab)
336 .collect();
276 .collect();
337 assert_eq!(
277 assert_eq!(
338 targets,
278 tabs,
339 [
279 [
340 RailTarget::Tab(SidebarTab::Activity),
280 SidebarTab::Activity,
341 RailTarget::Tab(SidebarTab::Chats),
281 SidebarTab::Chats,
342 RailTarget::Tab(SidebarTab::Channels),
282 SidebarTab::Channels,
343 RailTarget::Tab(SidebarTab::Calls),
283 SidebarTab::Calls,
344 RailTarget::Tab(SidebarTab::Saved)
284 SidebarTab::Saved
345 ]
285 ]
346 );
286 );
347 }
287 }
@@ -351,7 +291,7 @@ mod tests {
351 assert_eq!(rail_items(0, 0, false, None).len(), 5);
291 assert_eq!(rail_items(0, 0, false, None).len(), 5);
352 let with_agents = rail_items(0, 0, false, Some(2));
292 let with_agents = rail_items(0, 0, false, Some(2));
353 assert_eq!(with_agents.len(), 6);
293 assert_eq!(with_agents.len(), 6);
354 assert_eq!(with_agents[5].target, RailTarget::Agents);
294 assert_eq!(with_agents[5].tab, SidebarTab::Agents);
355 assert_eq!(with_agents[5].label, "Agents");
295 assert_eq!(with_agents[5].label, "Agents");
356 assert_eq!(with_agents[5].badge, RailBadge::Count(2));
296 assert_eq!(with_agents[5].badge, RailBadge::Count(2));
357 assert_eq!(rail_items(0, 0, false, Some(0))[5].badge, RailBadge::None);
297 assert_eq!(rail_items(0, 0, false, Some(0))[5].badge, RailBadge::None);
crates/app/src/views/shell.rs +23 −2
@@ -18,7 +18,7 @@ use super::rail::{RAIL_WIDTH, RailView};
18 18 use super::saved_panel::{SavedPanel, SavedPanelEvent};
19 19 use super::shortcuts::{
20 20 AcceptCall, DeclineCall, HangUpCall, JoinMeetingFromToast, NextConversation, OpenActivity,
21 OpenCallsTab, OpenChannelsTab, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
21 OpenAgents, OpenCallsTab, OpenChannelsTab, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
22 22 Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
23 23 ToggleCallHand, ToggleCallShare, ZoomShareIn, ZoomShareOut, ZoomShareReset,
24 24 };
@@ -112,6 +112,7 @@ pub struct AppShell {
112 112 _subscription: Subscription,
113 113 _call_media_observation: Subscription,
114 114 _panel_subscriptions: [Subscription; 2],
115 _agents_subscription: Option<Subscription>,
115 116 _agent_subscription: Option<Subscription>,
116 117 _escape_observation: Subscription,
117 118 _activation_observation: Subscription,
@@ -162,6 +163,20 @@ impl AppShell {
162 163 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
163 164 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
164 165 let saved_panel = cx.new(|cx| SavedPanel::new(state.clone(), cx));
166 let agents_panel = crate::agents::runs_handle(cx)
167 .map(|runs| cx.new(|cx| crate::agents::AgentsPanel::new(runs, cx)));
168 let agents_subscription = agents_panel.as_ref().map(|panel| {
169 cx.subscribe(
170 panel,
171 |this, _, event: &crate::agents::AgentsPanelEvent, cx| {
172 let crate::agents::AgentsPanelEvent::Open {
173 conversation_id,
174 message_id,
175 } = event;
176 this.open_message(conversation_id, message_id, cx);
177 },
178 )
179 });
165 180 let panel_subscriptions = [
166 181 cx.subscribe(
167 182 &activity_panel,
@@ -198,7 +213,7 @@ impl AppShell {
198 213 },
199 214 )
200 215 });
201 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, cx));
216 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, agents_panel, cx));
202 217 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
203 218 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
204 219 let subscription =
@@ -272,6 +287,7 @@ impl AppShell {
272 287 _subscription: subscription,
273 288 _call_media_observation: call_media_observation,
274 289 _panel_subscriptions: panel_subscriptions,
290 _agents_subscription: agents_subscription,
275 291 _agent_subscription: agent_subscription,
276 292 _escape_observation: escape_observation,
277 293 _activation_observation: activation_observation,
@@ -827,6 +843,11 @@ impl Render for AppShell {
827 843 this.sidebar
828 844 .update(cx, |sidebar, cx| sidebar.show_saved(cx));
829 845 }))
846 .on_action(cx.listener(|this, _: &OpenAgents, window, cx| {
847 this.close_image_viewer(window, cx);
848 this.sidebar
849 .update(cx, |sidebar, cx| sidebar.show_agents(cx));
850 }))
830 851 .on_action(cx.listener(|this, _: &OpenChatsTab, window, cx| {
831 852 this.close_image_viewer(window, cx);
832 853 this.sidebar
@@ -18,7 +18,7 @@ use super::rail::{RAIL_WIDTH, RailView};
18use super::saved_panel::{SavedPanel, SavedPanelEvent};
18use super::saved_panel::{SavedPanel, SavedPanelEvent};
19use super::shortcuts::{
19use super::shortcuts::{
20 AcceptCall, DeclineCall, HangUpCall, JoinMeetingFromToast, NextConversation, OpenActivity,
20 AcceptCall, DeclineCall, HangUpCall, JoinMeetingFromToast, NextConversation, OpenActivity,
21 OpenCallsTab, OpenChannelsTab, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
21 OpenAgents, OpenCallsTab, OpenChannelsTab, OpenChatsTab, OpenLobbyList, OpenSaved, PreviousConversation, PushToTalk,
22 Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
22 Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
23 ToggleCallHand, ToggleCallShare, ZoomShareIn, ZoomShareOut, ZoomShareReset,
23 ToggleCallHand, ToggleCallShare, ZoomShareIn, ZoomShareOut, ZoomShareReset,
24};
24};
@@ -112,6 +112,7 @@ pub struct AppShell {
112 _subscription: Subscription,
112 _subscription: Subscription,
113 _call_media_observation: Subscription,
113 _call_media_observation: Subscription,
114 _panel_subscriptions: [Subscription; 2],
114 _panel_subscriptions: [Subscription; 2],
115 _agents_subscription: Option<Subscription>,
115 _agent_subscription: Option<Subscription>,
116 _agent_subscription: Option<Subscription>,
116 _escape_observation: Subscription,
117 _escape_observation: Subscription,
117 _activation_observation: Subscription,
118 _activation_observation: Subscription,
@@ -162,6 +163,20 @@ impl AppShell {
162 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
163 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
163 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
164 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
164 let saved_panel = cx.new(|cx| SavedPanel::new(state.clone(), cx));
165 let saved_panel = cx.new(|cx| SavedPanel::new(state.clone(), cx));
166 let agents_panel = crate::agents::runs_handle(cx)
167 .map(|runs| cx.new(|cx| crate::agents::AgentsPanel::new(runs, cx)));
168 let agents_subscription = agents_panel.as_ref().map(|panel| {
169 cx.subscribe(
170 panel,
171 |this, _, event: &crate::agents::AgentsPanelEvent, cx| {
172 let crate::agents::AgentsPanelEvent::Open {
173 conversation_id,
174 message_id,
175 } = event;
176 this.open_message(conversation_id, message_id, cx);
177 },
178 )
179 });
165 let panel_subscriptions = [
180 let panel_subscriptions = [
166 cx.subscribe(
181 cx.subscribe(
167 &activity_panel,
182 &activity_panel,
@@ -198,7 +213,7 @@ impl AppShell {
198 },
213 },
199 )
214 )
200 });
215 });
201 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, cx));
216 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, agents_panel, cx));
202 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
217 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
203 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
218 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
204 let subscription =
219 let subscription =
@@ -272,6 +287,7 @@ impl AppShell {
272 _subscription: subscription,
287 _subscription: subscription,
273 _call_media_observation: call_media_observation,
288 _call_media_observation: call_media_observation,
274 _panel_subscriptions: panel_subscriptions,
289 _panel_subscriptions: panel_subscriptions,
290 _agents_subscription: agents_subscription,
275 _agent_subscription: agent_subscription,
291 _agent_subscription: agent_subscription,
276 _escape_observation: escape_observation,
292 _escape_observation: escape_observation,
277 _activation_observation: activation_observation,
293 _activation_observation: activation_observation,
@@ -827,6 +843,11 @@ impl Render for AppShell {
827 this.sidebar
843 this.sidebar
828 .update(cx, |sidebar, cx| sidebar.show_saved(cx));
844 .update(cx, |sidebar, cx| sidebar.show_saved(cx));
829 }))
845 }))
846 .on_action(cx.listener(|this, _: &OpenAgents, window, cx| {
847 this.close_image_viewer(window, cx);
848 this.sidebar
849 .update(cx, |sidebar, cx| sidebar.show_agents(cx));
850 }))
830 .on_action(cx.listener(|this, _: &OpenChatsTab, window, cx| {
851 .on_action(cx.listener(|this, _: &OpenChatsTab, window, cx| {
831 this.close_image_viewer(window, cx);
852 this.close_image_viewer(window, cx);
832 this.sidebar
853 this.sidebar
crates/app/src/views/shortcuts.rs +2 −0
@@ -20,6 +20,7 @@ actions!(
20 20 OpenChannelsTab,
21 21 OpenSaved,
22 22 OpenCallsTab,
23 OpenAgents,
23 24 PreviousConversation,
24 25 NextConversation,
25 26 AcceptCall,
@@ -108,6 +109,7 @@ pub const SHORTCUTS: &[Shortcut] = &[
108 109 shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),
109 110 shortcut!(Navigation, GlobalOverTextFields, "Open Saved", "ctrl-4", Some("cmd-4"), OpenSaved),
110 111 shortcut!(Navigation, GlobalOverTextFields, "Show Calls", "ctrl-5", Some("cmd-5"), OpenCallsTab),
112 shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),
111 113 shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),
112 114 shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),
113 115 shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),
@@ -20,6 +20,7 @@ actions!(
20 OpenChannelsTab,
20 OpenChannelsTab,
21 OpenSaved,
21 OpenSaved,
22 OpenCallsTab,
22 OpenCallsTab,
23 OpenAgents,
23 PreviousConversation,
24 PreviousConversation,
24 NextConversation,
25 NextConversation,
25 AcceptCall,
26 AcceptCall,
@@ -108,6 +109,7 @@ pub const SHORTCUTS: &[Shortcut] = &[
108 shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),
109 shortcut!(Navigation, GlobalOverTextFields, "Show Channels", "ctrl-3", Some("cmd-3"), OpenChannelsTab),
109 shortcut!(Navigation, GlobalOverTextFields, "Open Saved", "ctrl-4", Some("cmd-4"), OpenSaved),
110 shortcut!(Navigation, GlobalOverTextFields, "Open Saved", "ctrl-4", Some("cmd-4"), OpenSaved),
110 shortcut!(Navigation, GlobalOverTextFields, "Show Calls", "ctrl-5", Some("cmd-5"), OpenCallsTab),
111 shortcut!(Navigation, GlobalOverTextFields, "Show Calls", "ctrl-5", Some("cmd-5"), OpenCallsTab),
112 shortcut!(Navigation, GlobalOverTextFields, "Open Agents", "ctrl-6", Some("cmd-6"), OpenAgents),
111 shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),
113 shortcut!(Navigation, GlobalOverTextFields, "Previous chat or channel", "alt-up", None, PreviousConversation),
112 shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),
114 shortcut!(Navigation, GlobalOverTextFields, "Next chat or channel", "alt-down", None, NextConversation),
113 shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),
115 shortcut!(Composer, Global, "Reply to the message under the pointer", "alt-r", None, ReplyToHovered),
crates/app/src/views/sidebar.rs +32 −2
@@ -20,6 +20,7 @@ use super::calls_tab::calls_body;
20 20 use super::saved_panel::SavedPanel;
21 21 use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
22 22 use super::widgets::{count_badge, dot, icon, page_header, unread_marker};
23 use crate::agents::AgentsPanel;
23 24 use crate::app_state::{AppEvent, AppState, Selection};
24 25 use crate::chat_actions::TITLE_LIMIT;
25 26 use crate::data::{Directory, is_pending_folder};
@@ -64,6 +65,7 @@ pub enum SidebarTab {
64 65 Channels,
65 66 Calls,
66 67 Saved,
68 Agents,
67 69 }
68 70
69 71 impl SidebarTab {
@@ -74,6 +76,7 @@ impl SidebarTab {
74 76 SidebarTab::Channels => "Channels",
75 77 SidebarTab::Calls => "Calls",
76 78 SidebarTab::Saved => "Saved",
79 SidebarTab::Agents => "Agents",
77 80 }
78 81 }
79 82 }
@@ -472,6 +475,7 @@ pub struct SidebarView {
472 475 tab: SidebarTab,
473 476 activity_panel: Entity<ActivityPanel>,
474 477 saved_panel: Entity<SavedPanel>,
478 agents_panel: Option<Entity<AgentsPanel>>,
475 479 collapsed_teams: HashSet<String>,
476 480 revealed_channel_teams: HashSet<String>,
477 481 hidden_teams_open: bool,
@@ -483,6 +487,7 @@ pub struct SidebarView {
483 487 _subscription: Subscription,
484 488 _state_observation: Subscription,
485 489 _agent_observation: Option<Subscription>,
490 _runs_observation: Option<Subscription>,
486 491 }
487 492
488 493 fn preview_text(preview: &Preview) -> Option<(String, bool)> {
@@ -538,6 +543,7 @@ impl SidebarView {
538 543 state: Entity<AppState>,
539 544 activity_panel: Entity<ActivityPanel>,
540 545 saved_panel: Entity<SavedPanel>,
546 agents_panel: Option<Entity<AgentsPanel>>,
541 547 cx: &mut Context<Self>,
542 548 ) -> Self {
543 549 let subscription = cx.subscribe(&state, |this, state, event: &AppEvent, cx| {
@@ -562,6 +568,13 @@ impl SidebarView {
562 568 let state_observation = cx.observe(&state, |_, _, cx| cx.notify());
563 569 let agent_observation =
564 570 crate::agent_api::handle(cx).map(|api| cx.observe(&api, |_, _, cx| cx.notify()));
571 let runs_observation = crate::agents::runs_handle(cx).map(|runs| {
572 cx.observe(&runs, |view, _, cx| {
573 if view.tab == SidebarTab::Agents && !crate::agents::agents_enabled(cx) {
574 view.open_tab(SidebarTab::Chats, cx);
575 }
576 })
577 });
565 578 let tab = if state.read(cx).start_on_channels {
566 579 SidebarTab::Channels
567 580 } else {
@@ -587,6 +600,7 @@ impl SidebarView {
587 600 tab,
588 601 activity_panel,
589 602 saved_panel,
603 agents_panel,
590 604 collapsed_teams,
591 605 revealed_channel_teams: HashSet::new(),
592 606 hidden_teams_open: false,
@@ -598,6 +612,7 @@ impl SidebarView {
598 612 _subscription: subscription,
599 613 _state_observation: state_observation,
600 614 _agent_observation: agent_observation,
615 _runs_observation: runs_observation,
601 616 }
602 617 }
603 618
@@ -625,7 +640,14 @@ impl SidebarView {
625 640 self.open_tab(SidebarTab::Saved, cx);
626 641 }
627 642
643 pub fn show_agents(&mut self, cx: &mut Context<Self>) {
644 self.open_tab(SidebarTab::Agents, cx);
645 }
646
628 647 pub fn open_tab(&mut self, tab: SidebarTab, cx: &mut Context<Self>) {
648 if tab == SidebarTab::Agents && !crate::agents::agents_enabled(cx) {
649 return;
650 }
629 651 self.tab = tab;
630 652 match tab {
631 653 SidebarTab::Calls => self.state.update(cx, |state, cx| {
@@ -646,7 +668,9 @@ impl SidebarView {
646 668 .adjacent_chat_id(step)
647 669 .map(Selection::Chat),
648 670 SidebarTab::Channels => self.adjacent_channel_id(step, cx).map(Selection::Channel),
649 SidebarTab::Activity | SidebarTab::Calls | SidebarTab::Saved => None,
671 SidebarTab::Activity | SidebarTab::Calls | SidebarTab::Saved | SidebarTab::Agents => {
672 None
673 }
650 674 };
651 675 if let Some(selection) = selection {
652 676 self.state
@@ -1737,6 +1761,10 @@ impl Render for SidebarView {
1737 1761 SidebarTab::Channels => self.channels_body(cx),
1738 1762 SidebarTab::Calls => calls_body(&self.state, &self.calls_scroll, window_height, cx),
1739 1763 SidebarTab::Saved => self.saved_panel.clone().into_any_element(),
1764 SidebarTab::Agents => match &self.agents_panel {
1765 Some(panel) => panel.clone().into_any_element(),
1766 None => div().into_any_element(),
1767 },
1740 1768 };
1741 1769 let header = match self.tab {
1742 1770 SidebarTab::Chats => Some(
@@ -1744,7 +1772,9 @@ impl Render for SidebarView {
1744 1772 .child(self.chat_list_menu_button(cx))
1745 1773 .child(self.new_chat_button(cx)),
1746 1774 ),
1747 SidebarTab::Channels | SidebarTab::Calls => Some(page_header(self.tab.title())),
1775 SidebarTab::Channels | SidebarTab::Calls | SidebarTab::Agents => {
1776 Some(page_header(self.tab.title()))
1777 }
1748 1778 SidebarTab::Activity | SidebarTab::Saved => None,
1749 1779 };
1750 1780 v_flex()
@@ -20,6 +20,7 @@ use super::calls_tab::calls_body;
20use super::saved_panel::SavedPanel;
20use super::saved_panel::SavedPanel;
21use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
21use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
22use super::widgets::{count_badge, dot, icon, page_header, unread_marker};
22use super::widgets::{count_badge, dot, icon, page_header, unread_marker};
23use crate::agents::AgentsPanel;
23use crate::app_state::{AppEvent, AppState, Selection};
24use crate::app_state::{AppEvent, AppState, Selection};
24use crate::chat_actions::TITLE_LIMIT;
25use crate::chat_actions::TITLE_LIMIT;
25use crate::data::{Directory, is_pending_folder};
26use crate::data::{Directory, is_pending_folder};
@@ -64,6 +65,7 @@ pub enum SidebarTab {
64 Channels,
65 Channels,
65 Calls,
66 Calls,
66 Saved,
67 Saved,
68 Agents,
67}
69}
68
70
69impl SidebarTab {
71impl SidebarTab {
@@ -74,6 +76,7 @@ impl SidebarTab {
74 SidebarTab::Channels => "Channels",
76 SidebarTab::Channels => "Channels",
75 SidebarTab::Calls => "Calls",
77 SidebarTab::Calls => "Calls",
76 SidebarTab::Saved => "Saved",
78 SidebarTab::Saved => "Saved",
79 SidebarTab::Agents => "Agents",
77 }
80 }
78 }
81 }
79}
82}
@@ -472,6 +475,7 @@ pub struct SidebarView {
472 tab: SidebarTab,
475 tab: SidebarTab,
473 activity_panel: Entity<ActivityPanel>,
476 activity_panel: Entity<ActivityPanel>,
474 saved_panel: Entity<SavedPanel>,
477 saved_panel: Entity<SavedPanel>,
478 agents_panel: Option<Entity<AgentsPanel>>,
475 collapsed_teams: HashSet<String>,
479 collapsed_teams: HashSet<String>,
476 revealed_channel_teams: HashSet<String>,
480 revealed_channel_teams: HashSet<String>,
477 hidden_teams_open: bool,
481 hidden_teams_open: bool,
@@ -483,6 +487,7 @@ pub struct SidebarView {
483 _subscription: Subscription,
487 _subscription: Subscription,
484 _state_observation: Subscription,
488 _state_observation: Subscription,
485 _agent_observation: Option<Subscription>,
489 _agent_observation: Option<Subscription>,
490 _runs_observation: Option<Subscription>,
486}
491}
487
492
488fn preview_text(preview: &Preview) -> Option<(String, bool)> {
493fn preview_text(preview: &Preview) -> Option<(String, bool)> {
@@ -538,6 +543,7 @@ impl SidebarView {
538 state: Entity<AppState>,
543 state: Entity<AppState>,
539 activity_panel: Entity<ActivityPanel>,
544 activity_panel: Entity<ActivityPanel>,
540 saved_panel: Entity<SavedPanel>,
545 saved_panel: Entity<SavedPanel>,
546 agents_panel: Option<Entity<AgentsPanel>>,
541 cx: &mut Context<Self>,
547 cx: &mut Context<Self>,
542 ) -> Self {
548 ) -> Self {
543 let subscription = cx.subscribe(&state, |this, state, event: &AppEvent, cx| {
549 let subscription = cx.subscribe(&state, |this, state, event: &AppEvent, cx| {
@@ -562,6 +568,13 @@ impl SidebarView {
562 let state_observation = cx.observe(&state, |_, _, cx| cx.notify());
568 let state_observation = cx.observe(&state, |_, _, cx| cx.notify());
563 let agent_observation =
569 let agent_observation =
564 crate::agent_api::handle(cx).map(|api| cx.observe(&api, |_, _, cx| cx.notify()));
570 crate::agent_api::handle(cx).map(|api| cx.observe(&api, |_, _, cx| cx.notify()));
571 let runs_observation = crate::agents::runs_handle(cx).map(|runs| {
572 cx.observe(&runs, |view, _, cx| {
573 if view.tab == SidebarTab::Agents && !crate::agents::agents_enabled(cx) {
574 view.open_tab(SidebarTab::Chats, cx);
575 }
576 })
577 });
565 let tab = if state.read(cx).start_on_channels {
578 let tab = if state.read(cx).start_on_channels {
566 SidebarTab::Channels
579 SidebarTab::Channels
567 } else {
580 } else {
@@ -587,6 +600,7 @@ impl SidebarView {
587 tab,
600 tab,
588 activity_panel,
601 activity_panel,
589 saved_panel,
602 saved_panel,
603 agents_panel,
590 collapsed_teams,
604 collapsed_teams,
591 revealed_channel_teams: HashSet::new(),
605 revealed_channel_teams: HashSet::new(),
592 hidden_teams_open: false,
606 hidden_teams_open: false,
@@ -598,6 +612,7 @@ impl SidebarView {
598 _subscription: subscription,
612 _subscription: subscription,
599 _state_observation: state_observation,
613 _state_observation: state_observation,
600 _agent_observation: agent_observation,
614 _agent_observation: agent_observation,
615 _runs_observation: runs_observation,
601 }
616 }
602 }
617 }
603
618
@@ -625,7 +640,14 @@ impl SidebarView {
625 self.open_tab(SidebarTab::Saved, cx);
640 self.open_tab(SidebarTab::Saved, cx);
626 }
641 }
627
642
643 pub fn show_agents(&mut self, cx: &mut Context<Self>) {
644 self.open_tab(SidebarTab::Agents, cx);
645 }
646
628 pub fn open_tab(&mut self, tab: SidebarTab, cx: &mut Context<Self>) {
647 pub fn open_tab(&mut self, tab: SidebarTab, cx: &mut Context<Self>) {
648 if tab == SidebarTab::Agents && !crate::agents::agents_enabled(cx) {
649 return;
650 }
629 self.tab = tab;
651 self.tab = tab;
630 match tab {
652 match tab {
631 SidebarTab::Calls => self.state.update(cx, |state, cx| {
653 SidebarTab::Calls => self.state.update(cx, |state, cx| {
@@ -646,7 +668,9 @@ impl SidebarView {
646 .adjacent_chat_id(step)
668 .adjacent_chat_id(step)
647 .map(Selection::Chat),
669 .map(Selection::Chat),
648 SidebarTab::Channels => self.adjacent_channel_id(step, cx).map(Selection::Channel),
670 SidebarTab::Channels => self.adjacent_channel_id(step, cx).map(Selection::Channel),
649 SidebarTab::Activity | SidebarTab::Calls | SidebarTab::Saved => None,
671 SidebarTab::Activity | SidebarTab::Calls | SidebarTab::Saved | SidebarTab::Agents => {
672 None
673 }
650 };
674 };
651 if let Some(selection) = selection {
675 if let Some(selection) = selection {
652 self.state
676 self.state
@@ -1737,6 +1761,10 @@ impl Render for SidebarView {
1737 SidebarTab::Channels => self.channels_body(cx),
1761 SidebarTab::Channels => self.channels_body(cx),
1738 SidebarTab::Calls => calls_body(&self.state, &self.calls_scroll, window_height, cx),
1762 SidebarTab::Calls => calls_body(&self.state, &self.calls_scroll, window_height, cx),
1739 SidebarTab::Saved => self.saved_panel.clone().into_any_element(),
1763 SidebarTab::Saved => self.saved_panel.clone().into_any_element(),
1764 SidebarTab::Agents => match &self.agents_panel {
1765 Some(panel) => panel.clone().into_any_element(),
1766 None => div().into_any_element(),
1767 },
1740 };
1768 };
1741 let header = match self.tab {
1769 let header = match self.tab {
1742 SidebarTab::Chats => Some(
1770 SidebarTab::Chats => Some(
@@ -1744,7 +1772,9 @@ impl Render for SidebarView {
1744 .child(self.chat_list_menu_button(cx))
1772 .child(self.chat_list_menu_button(cx))
1745 .child(self.new_chat_button(cx)),
1773 .child(self.new_chat_button(cx)),
1746 ),
1774 ),
1747 SidebarTab::Channels | SidebarTab::Calls => Some(page_header(self.tab.title())),
1775 SidebarTab::Channels | SidebarTab::Calls | SidebarTab::Agents => {
1776 Some(page_header(self.tab.title()))
1777 }
1748 SidebarTab::Activity | SidebarTab::Saved => None,
1778 SidebarTab::Activity | SidebarTab::Saved => None,
1749 };
1779 };
1750 v_flex()
1780 v_flex()