-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Desktop notifications for child agents #10136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3286,6 +3286,55 @@ impl Workspace { | |
| // Re-render so the vertical tabs panel can update unread-activity dots. | ||
| ctx.notify(); | ||
| } | ||
| AgentManagementEvent::SendDesktopNotification { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if long term we would move to having agent management model fire notifications for non-child agents too? |
||
| title, | ||
| body, | ||
| is_completed, | ||
| } => { | ||
| // Only send desktop notifications when the user has navigated | ||
| // away from the Warp window (matching regular agent behavior). | ||
| let active_window = ctx.windows().active_window(); | ||
| if Some(ctx.window_id()) == active_window { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this might be legit |
||
| return; | ||
| } | ||
|
|
||
| let notification_settings = | ||
| SessionSettings::as_ref(ctx).notifications.value().clone(); | ||
| if notification_settings.mode != NotificationsMode::Enabled { | ||
| return; | ||
| } | ||
| if *is_completed && !notification_settings.is_agent_task_completed_enabled { | ||
| return; | ||
| } | ||
| if !*is_completed && !notification_settings.is_needs_attention_enabled { | ||
| return; | ||
| } | ||
|
|
||
| let play_sound = notification_settings.play_notification_sound; | ||
| ctx.send_desktop_notification( | ||
| UserNotification::new_with_sound( | ||
| title.clone(), | ||
| body.clone(), | ||
| None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agent mode tells me we might need to specify BlockOrigin here for a click on the notification to focus the source |
||
| play_sound, | ||
| ), | ||
| |_workspace, notification_error, ctx| { | ||
| if let NotificationSendError::Other { error_message } = | ||
| ¬ification_error | ||
| { | ||
| log::error!( | ||
| "Failed to send child agent desktop notification: {error_message}" | ||
| ); | ||
| } | ||
| send_telemetry_from_ctx!( | ||
| TelemetryEvent::NotificationFailedToSend { | ||
| error: notification_error.clone() | ||
| }, | ||
| ctx | ||
| ); | ||
| }, | ||
| ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we purposefully skip cancelled?