Agent Zero AI framework
Polish the update notification action
Alessandro831bed7a0cc3
diff --git a/extensions/python/user_message_ui/AGENTS.md b/extensions/python/user_message_ui/AGENTS.mdindex 5755ea69d..2d9a3b706 100644--- a/extensions/python/user_message_ui/AGENTS.md+++ b/extensions/python/user_message_ui/AGENTS.md@@ -11,7 +11,7 @@## Local Contracts- Keep proactive UI messages relevant, non-spammy, and safe for display.-- Keep update-available notifications visible until the user dismisses them.+- Keep update-available notifications visible until the user dismisses them or opens the updater.- Do not expose local diagnostics or update data that should stay internal.## Work Guidancediff --git a/extensions/python/user_message_ui/_10_update_check.py b/extensions/python/user_message_ui/_10_update_check.pyindex 00cf5fa2f..6d26c1d92 100644--- a/extensions/python/user_message_ui/_10_update_check.py+++ b/extensions/python/user_message_ui/_10_update_check.py@@ -98,10 +98,22 @@ class UpdateCheck(Extension):if not self.agent:return+ message = notif.get(+ "message",+ "A newer version of Agent Zero is available. Please update to the latest version.",+ )+ message = message.replace(+ '<a href="#" @click.prevent="$store.selfUpdateStore.openModal()">Open updater</a>.',+ '<div class="toast-action-row">'+ '<button type="button" class="button confirm" '+ '@click="$store.selfUpdateStore.openModal(); '+ '$store.notificationStore.dismissToast(toast.toastId)">'+ "Open updater</button></div>",+ )notifs = self.agent.context.get_notification_manager()notifs.send_notification(title=notif.get("title", "Newer version available"),- message=notif.get("message", "A newer version of Agent Zero is available. Please update to the latest version."),+ message=message,type=notif.get("type", "info"),detail=notif.get("detail", ""),display_time=0,diff --git a/tests/test_download_toast_regressions.py b/tests/test_download_toast_regressions.pyindex cdf5db3f1..291050e6e 100644--- a/tests/test_download_toast_regressions.py+++ b/tests/test_download_toast_regressions.py@@ -88,6 +88,7 @@ def previous_non_space(source: str, index: int) -> str:def test_notification_store_supports_persistent_grouped_toasts():store = read("webui", "components", "notifications", "notification-store.js")+ toast_stack = read("webui", "components", "notifications", "notification-toast-stack.html")api = read("api", "notification_create.py")plugins = read("helpers", "plugins.py")update_check = read("extensions", "python", "user_message_ui", "_10_update_check.py")@@ -103,6 +104,10 @@ def test_notification_store_supports_persistent_grouped_toasts():assert 'id=notif.get("id", "update_check_available"),' in update_checkassert "display_time=0," in pluginsassert "display_time=0," in update_check+ assert 'class="toast-action-row"' in update_check+ assert 'class="button confirm"' in update_check+ assert "$store.notificationStore.dismissToast(toast.toastId)" in update_check+ assert ".toast-action-row" in toast_stackdef test_backup_zip_downloads_emit_grouped_preparing_and_downloading_toasts():diff --git a/webui/components/notifications/notification-toast-stack.html b/webui/components/notifications/notification-toast-stack.htmlindex 3a9fc29c1..7a002c6fc 100644--- a/webui/components/notifications/notification-toast-stack.html+++ b/webui/components/notifications/notification-toast-stack.html@@ -150,6 +150,10 @@margin-bottom: 4px;}+ .toast-action-row {+ margin-top: 10px;+ }+.toast-timestamp {font-size: 0.75rem;color: var(--color-text);