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:
@@ -6,6 +6,9 @@
|
||||
// for the `ui-review` chat (add `ui-review=1` so the
|
||||
// chat has its title). `agentNoticePriority=2|3|4`
|
||||
// sets its priority (default 3).
|
||||
// `?agentNoticeClear=<ms>` then pushes `notifications_cleared` for it <ms>
|
||||
// after the subscription, as when the operator opens
|
||||
// the chat or taps the notification on another device.
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
@@ -40,6 +43,15 @@ JsonMap? agentNoticeReply(JsonMap request, void Function(JsonMap) emit) {
|
||||
});
|
||||
});
|
||||
}
|
||||
final clear = int.tryParse(_params['agentNoticeClear'] ?? '');
|
||||
if (clear != null) {
|
||||
Timer(Duration(milliseconds: clear), () {
|
||||
emit({
|
||||
'type': 'notifications_cleared',
|
||||
'ids': ['chat:ui-review:notify:shown_capture'],
|
||||
});
|
||||
});
|
||||
}
|
||||
return {
|
||||
'id': request['id'],
|
||||
'type': 'notifications_subscribed',
|
||||
|
||||
@@ -69,6 +69,7 @@ JsonMap chatShownFixture(Object? sessionId) => {
|
||||
'message': 'All three stages passed; the release is ready to publish.',
|
||||
'priority': 'default',
|
||||
'delivered': true,
|
||||
'channels': ['apps', 'phone'],
|
||||
},
|
||||
{
|
||||
'id': 'shown-diff',
|
||||
|
||||
Reference in New Issue
Block a user