mirror of
https://github.com/lahfir/agent-desktop.git
synced 2026-08-06 14:10:43 +00:00
- fix(core): wait --notification uses index-diff detection instead of count, passes text filter, checks deadline before sleep - fix(core): dismiss-all-notifications uses single NC session with batch adapter method and reports individual failures - refactor(macos): extract dismiss_entry helper to eliminate duplicate dismiss logic between single and batch operations - refactor(macos): restrict nc_session visibility to pub(crate), use absolute paths for pgrep/osascript, add bounded wait with kill fallback - refactor(macos): single-pass is_notification_group check using matches! macro - refactor: extract notification CLI args and dispatch into separate files to keep cli_args.rs and dispatch.rs under 400 LOC - refactor: rename DismissAllNotificationsArgs to DismissAllNotificationsCliArgs for consistency - fix(core): remove unused timestamp field from NotificationInfo - fix: remove poll_interval_ms from wait command (hardcode 500ms) - docs: update phases.md with completed notification status and cross-platform reference notes
45 lines
1.4 KiB
Rust
45 lines
1.4 KiB
Rust
use agent_desktop_core::{
|
|
adapter::PlatformAdapter,
|
|
commands::{
|
|
dismiss_all_notifications, dismiss_notification, list_notifications, notification_action,
|
|
},
|
|
error::AppError,
|
|
};
|
|
use serde_json::Value;
|
|
|
|
use crate::cli::Commands;
|
|
|
|
pub fn dispatch_notification(
|
|
cmd: Commands,
|
|
adapter: &dyn PlatformAdapter,
|
|
) -> Result<Value, AppError> {
|
|
match cmd {
|
|
Commands::ListNotifications(a) => list_notifications::execute(
|
|
list_notifications::ListNotificationsArgs {
|
|
app: a.app,
|
|
text: a.text,
|
|
limit: a.limit,
|
|
},
|
|
adapter,
|
|
),
|
|
Commands::DismissNotification(a) => dismiss_notification::execute(
|
|
dismiss_notification::DismissNotificationArgs {
|
|
index: a.index as usize,
|
|
app: a.app,
|
|
},
|
|
adapter,
|
|
),
|
|
Commands::DismissAllNotifications(a) => dismiss_all_notifications::execute(
|
|
dismiss_all_notifications::DismissAllNotificationsArgs { app: a.app },
|
|
adapter,
|
|
),
|
|
Commands::NotificationAction(a) => notification_action::execute(
|
|
notification_action::NotificationActionArgs {
|
|
index: a.index as usize,
|
|
action: a.action,
|
|
},
|
|
adapter,
|
|
),
|
|
_ => unreachable!(),
|
|
}
|
|
}
|