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
+7 -2
View File
@@ -1,6 +1,7 @@
package server
import (
"strconv"
"strings"
"git.a-wan.net/alan/pipelines/internal/protocol"
@@ -28,7 +29,7 @@ func (h *chatHub) noteReplyAttentionLocked(prior *protocol.ChatStep, frame proto
if prior == nil || (prior.Status == protocol.ChatStepEnded && !prior.Intermediate) {
return
}
if !chatAttentionConfigured() {
if !h.attentionWanted() {
return
}
if step.TurnID != "" && !h.claimChatAttentionLocked("reply\x00"+frame.SessionID+"\x00"+step.TurnID) {
@@ -38,7 +39,11 @@ func (h *chatHub) noteReplyAttentionLocked(prior *protocol.ChatStep, frame proto
if body == "" {
body = chatReplyFallbackBody
}
h.startChatAttention(chatAttention{sessionID: frame.SessionID, reply: true, body: body})
turnID := step.TurnID
if turnID == "" {
turnID = strconv.FormatInt(h.clock().UnixNano(), 36)
}
h.startChatAttention(chatAttention{sessionID: frame.SessionID, reply: true, body: body, id: chatNotificationID(frame.SessionID, "reply", turnID)})
}
// finalReplyTextLocked returns a bounded single-line excerpt of the latest