Notifications: agent notify reaches every device and clears everywhere
- Server: chat ntfy messages carry a sequence id derived from their app id; clearing a chat app notification also clears it in ntfy (PUT /<topic>/<seq>/clear, verified on ntfy v2.38.1). - Server: a turn that sent an agent notify does not also send chat_reply. - notify tool and MCP instructions: Pipelines already notifies at reply end and for questions/approvals; notify is for mid-turn or background news. - Shown notify items carry channels (apps/phone); the transcript row says where it went. - App: NotificationBridge.close(tag); web closes tracked Notifications and tells other tabs over a BroadcastChannel; native bridge cancels by tag and now supports macOS. AgentNotices closes on notifications_cleared and on resubscribe cleared ids, and a tap sends clear_notifications. - Docs: skill, chat reference, ntfy/notifications docs, app note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,15 +3,28 @@ import 'package:flutter/material.dart';
|
||||
import '../../../../../core/api_gateway.dart';
|
||||
import 'chat_shown_surface.dart';
|
||||
|
||||
/// What a `notify` entry says: the phone notification was accepted for
|
||||
/// delivery, or why it was not sent.
|
||||
/// What a `notify` entry says: where the notification went (the server's
|
||||
/// `channels`: the operator's signed-in Pipelines `apps` and/or their `phone`),
|
||||
/// or why it was not sent.
|
||||
String chatShownNotifyText(JsonMap item) {
|
||||
final title = chatShownTitle(item, 'notification');
|
||||
if (item['delivered'] == true) return 'Notified your phone: $title';
|
||||
if (item['delivered'] == true) return '${_notifiedWhere(item)}: $title';
|
||||
final detail = '${item['detail'] ?? ''}'.trim();
|
||||
return detail.isEmpty
|
||||
? 'Phone notification not sent: $title'
|
||||
: 'Phone notification not sent: $title — $detail';
|
||||
? 'Notification not sent: $title'
|
||||
: 'Notification not sent: $title — $detail';
|
||||
}
|
||||
|
||||
String _notifiedWhere(JsonMap item) {
|
||||
final raw = item['channels'];
|
||||
final channels = raw is List ? raw.map((c) => '$c').toSet() : <String>{};
|
||||
final apps = channels.contains('apps');
|
||||
final phone = channels.contains('phone');
|
||||
if (apps && phone) return 'Notified your apps and phone';
|
||||
if (apps) return 'Notified your apps';
|
||||
if (phone) return 'Notified your phone';
|
||||
// An entry recorded before the server said where it went.
|
||||
return 'Notified you';
|
||||
}
|
||||
|
||||
/// One secondary line in the agent's column for a `notify` entry, with the
|
||||
|
||||
Reference in New Issue
Block a user