Stream ntfy notifications to app clients over /connect

Record every notification published to ntfy (run outbox, stage notify
hooks, chat question/approval/reply) in a persisted app_notifications
outbox and stream it to subscribe_notifications clients with an after
cursor; clear_notifications and ack_attention clear across devices, as do
runs leaving waiting, deleted runs and answered chat questions. Add the
notify.ntfy_enabled setting (default on) to stop only the ntfy publish.
This commit is contained in:
2026-11-01 02:03:58 +00:00
parent 6c7c32078c
commit d1846441cc
20 changed files with 1265 additions and 20 deletions
+9 -1
View File
@@ -63,7 +63,7 @@ func (h *attentionAckHub) broadcast(sender string, delta protocol.AttentionAcks)
// whether request was one of them. An ack that changes nothing (already
// dismissed, or a watermark that does not advance) replies with the whole set
// but pushes nothing.
func handleAttentionAcks(ctx context.Context, request protocol.Message, store attentionAckStore, hub *attentionAckHub, clientID string, write func(protocol.Message) error) bool {
func handleAttentionAcks(ctx context.Context, request protocol.Message, store attentionAckStore, hub *attentionAckHub, notes *appNotifier, clientID string, write func(protocol.Message) error) bool {
if request.Type != protocol.GetAttentionAcks && request.Type != protocol.AckAttention {
return false
}
@@ -86,5 +86,13 @@ func handleAttentionAcks(ctx context.Context, request protocol.Message, store at
if hub != nil && !delta.Empty() {
hub.broadcast(clientID, delta)
}
// The acknowledged items' app notifications clear on every device. The
// request (not only the delta) decides, so an ack repeated after a new
// notification still clears it.
if request.Type == protocol.AckAttention && notes != nil {
if valid, err := protocol.ValidateAttentionAck(request.AttentionAcks); err == nil {
notes.clearForAcks(ctx, valid)
}
}
return true
}