Notify: an agent's notify reaches every connected app

The notify tool now records a chat_notify app notification with its own
id per call (no dedupe of repeated words) and the tool's priority, so
every subscribed client gets it and a reconnecting client replays it.
ntfy delivery is unchanged; the tool result names where it went.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 15:44:39 +00:00
parent 3e817a189b
commit c8541f29b7
11 changed files with 195 additions and 47 deletions
+7 -5
View File
@@ -131,22 +131,24 @@ func (a *appNotifier) detach(clientID string) {
}
}
// record persists n and pushes it when it is new. Failures are logged only:
// recording must never block or fail the ntfy publication beside it.
func (a *appNotifier) record(ctx context.Context, n pipeline.AppNotificationRecord) {
// record persists n and pushes it when it is new, and reports whether it is
// recorded. Failures are logged only: recording must never block or fail the
// ntfy publication beside it.
func (a *appNotifier) record(ctx context.Context, n pipeline.AppNotificationRecord) bool {
if a == nil {
return
return false
}
a.mu.Lock()
defer a.mu.Unlock()
stored, fresh, err := a.store.RecordAppNotification(ctx, n, a.now())
if err != nil {
log.Printf("record app notification %s: %v", n.ID, err)
return
return false
}
if fresh {
a.enqueueLocked(protocol.Message{Type: protocol.NotificationPush, Notification: &stored}, "")
}
return true
}
// clear clears ids and pushes the ones that changed to every subscriber but