Expand description
notifications.* method types — paginated history + ack +
push for incoming notifications.
The notification lifecycle (SPEC §2.12.8 emergency example):
- Operator publishes via backend HTTP API → backend writes to
NATS
NOTIFICATIONSJetStream. - Agent consumes the stream, fans out to connected clients via
notifications.newpush. - User clicks “確認” → client sends
notifications.ack→ agent writesnotifications_readKV (keyed by{pc_id}.{user_sid}.{notification_id}) AND publishesevents.notifications.acked.{pc_id}.{user_sid}.{notification_id}so the SPA can show per-user confirmation status. - Past notifications stay queryable via
notifications.list— that’s the recovery path when the agent missed a push during a network blip.
Structs§
- Notification
- Notification body — used both for
NotificationsListResultentries and theNotificationNewParamspush. - Notification
NewParams - Push payload for
notifications.new. The full notification body inline — no second round-trip needed. - Notifications
AckParams notifications.ackparams — mark this notification read for the caller’s user (SID derived from the OS at connect time, NOT from the payload). SPEC §2.12.4 forbids ack-ing other users’ notifications even on a shared PC — the agent rejects withUnauthorizedif the notification’s audience doesn’t include the caller.- Notifications
AckResult notifications.ackresponse — confirms the agent persisted the ack and published theevents.notifications.acked.>event.- Notifications
List Params notifications.listparams — paginated history of notifications this user has received (per-user, scoped via OS SID).- Notifications
List Result notifications.listresponse.- Notifications
Subscribe Params - Notifications
Subscribe Result - Notifications
Unsubscribe Params
Enums§
- Notification
Priority - Severity ladder. Drives the SPA color, toast/dialog choice, and
whether the Client App grabs window focus on push arrival.
#[non_exhaustive]so a future SPEC can add severities (e.g.Criticalabove Emergency) without a wire bump. - Notifications
Filter - History-list filter selector.