@@ -2213,6 +2213,17 @@ private void OnPairingStatusChanged(object? sender, OpenClaw.Shared.PairingStatu
22132213 {
22142214 _toastService ! . MarkPairedToastShown ( deviceKey ) ;
22152215 AddRecentActivity ( "Node paired" , category : "node" , dashboardPath : "nodes" , nodeId : args . DeviceId ) ;
2216+ AppNotificationPublisher . Show (
2217+ _appNotificationService ,
2218+ LocalizationHelper . GetString ( "Toast_NodePaired" ) ,
2219+ LocalizationHelper . GetString ( "Toast_NodePairedDetail" ) ,
2220+ "node" ,
2221+ "pairing" ,
2222+ AppNotificationSeverity . Success ,
2223+ "node-paired:" + HashNotificationKey ( deviceKey ) ,
2224+ "connection" ,
2225+ LocalizationHelper . GetString ( "AppNotification_ActionOpenConnection" ) ,
2226+ id : BuildPairingPairedNotificationId ( deviceKey ) ) ;
22162227 _toastService ! . ShowToast ( new ToastContentBuilder ( )
22172228 . AddText ( LocalizationHelper . GetString ( "Toast_NodePaired" ) )
22182229 . AddText ( LocalizationHelper . GetString ( "Toast_NodePairedDetail" ) ) ,
@@ -2269,6 +2280,9 @@ public static string BuildPairingApprovalCommand(string deviceId) =>
22692280 private static string BuildPairingPendingNotificationId ( string deviceId ) =>
22702281 $ "node-pairing-pending:{ deviceId . Trim ( ) . ToLowerInvariant ( ) } ";
22712282
2283+ private static string BuildPairingPairedNotificationId ( string deviceId ) =>
2284+ $ "node-paired:{ deviceId . Trim ( ) . ToLowerInvariant ( ) } ";
2285+
22722286 private static string BuildPairingRejectedNotificationId ( string deviceId ) =>
22732287 $ "node-pairing-rejected:{ deviceId . Trim ( ) . ToLowerInvariant ( ) } ";
22742288
@@ -2461,19 +2475,33 @@ private void OnNodeNotificationRequested(object? sender, OpenClaw.Shared.Capabil
24612475 // Agent requested a notification via node.invoke system.notify
24622476 try
24632477 {
2464- _toastService ! . ShowToast ( new ToastContentBuilder ( )
2465- . AddText ( args . Title )
2466- . AddText ( args . Body ) ) ;
2478+ AppNotificationPublisher . Publish (
2479+ _appNotificationService ,
2480+ _toastService ,
2481+ new AppNotificationPublishRequest (
2482+ AppNotificationMapper . FromNodeSystemNotification ( args ) ,
2483+ new ToastContentBuilder ( )
2484+ . AddText ( args . Title )
2485+ . AddText ( args . Body ) ) ) ;
24672486 }
24682487 catch ( Exception ex )
24692488 {
24702489 Logger . Warn ( $ "Failed to show node notification: { ex . Message } ") ;
24712490 }
24722491 }
24732492
2474- private void OnNodeToastRequested ( object ? sender , Microsoft . Toolkit . Uwp . Notifications . ToastContentBuilder builder )
2493+ private void OnNodeToastRequested ( object ? sender , NodeToastRequestedEventArgs args )
24752494 => OnUiThread ( ( ) =>
2476- NonFatalAction . Run ( ( ) => _toastService ! . ShowToast ( builder ) , msg => Logger . Warn ( $ "Failed to show node toast: { msg } ") ) ) ;
2495+ NonFatalAction . Run (
2496+ ( ) => AppNotificationPublisher . Publish (
2497+ _appNotificationService ,
2498+ _toastService ,
2499+ new AppNotificationPublishRequest (
2500+ args . AppNotification ,
2501+ args . ToastBuilder ,
2502+ args . ToastTag ,
2503+ args . ToastDeviceId ) ) ,
2504+ msg => Logger . Warn ( $ "Failed to show node toast: { msg } ") ) ) ;
24772505
24782506 private void OnLocalExecApprovalRequested ( object ? sender , ExecApprovalPromptRequestedEventArgs args )
24792507 {
@@ -2787,9 +2815,26 @@ private void OnGatewaySessionCommandCompleted(object? sender, SessionCommandResu
27872815 dashboardPath : ! string . IsNullOrWhiteSpace ( result . Key ) ? $ "sessions/{ result . Key } " : "sessions" ,
27882816 sessionKey : result . Key ) ;
27892817
2790- _toastService ! . ShowToast ( new ToastContentBuilder ( )
2791- . AddText ( title )
2792- . AddText ( message ) ) ;
2818+ AppNotification ? appNotification = result . Ok
2819+ ? null
2820+ : new AppNotification
2821+ {
2822+ Title = title ,
2823+ Message = message ,
2824+ Source = "session" ,
2825+ Category = "status" ,
2826+ Severity = AppNotificationSeverity . Error ,
2827+ DedupeKey = "session-command:" + HashNotificationKey ( $ "{ result . Method } |{ key } |{ message } ")
2828+ } ;
2829+
2830+ AppNotificationPublisher . Publish (
2831+ _appNotificationService ,
2832+ _toastService ,
2833+ new AppNotificationPublishRequest (
2834+ appNotification ,
2835+ new ToastContentBuilder ( )
2836+ . AddText ( title )
2837+ . AddText ( message ) ) ) ;
27932838 }
27942839 catch ( Exception ex )
27952840 {
@@ -2870,7 +2915,14 @@ private void OnGatewayNotificationReceived(object? sender, OpenClawNotification
28702915 . AddArgument ( "sessionKey" , notification . SessionKey ?? "" ) ) ;
28712916 }
28722917
2873- _toastService ! . ShowToast ( builder ) ;
2918+ AppNotificationPublisher . Publish (
2919+ _appNotificationService ,
2920+ _toastService ,
2921+ new AppNotificationPublishRequest (
2922+ AppNotificationMapper . FromGatewayNotification (
2923+ notification ,
2924+ LocalizationHelper . GetString ( "AppNotification_ExecApprovalPending_OpenChatAction" ) ) ,
2925+ builder ) ) ;
28742926 }
28752927 catch ( Exception ex )
28762928 {
0 commit comments