feat: per-user notification preference toggles

Add per-namespace notification preferences so users can choose which
event types trigger push notifications (permission requests, session
ready, task notifications, session completion). Adds the
notification_preferences table (schema v20), GET/PUT
/api/notification-preferences, POST /api/push/test for test pushes, and
a Notifications settings page in the web app with a confirm dialog for
disabling permission requests. Defaults keep all event types enabled.

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-05 11:16:08 +08:00
co-authored by HAPI Claude
parent 27bc6bade3
commit dd1cd24a46
24 changed files with 869 additions and 13 deletions
+17
View File
@@ -176,6 +176,23 @@ export type PushVapidPublicKeyResponse = {
publicKey: string
}
export type NotificationPreferences = {
namespace: string
permissionRequests: number
sessionReady: number
taskNotifications: number
sessionCompletion: number
updatedAt: number
}
export type NotificationPreferencesUpdate = Partial<
Pick<NotificationPreferences, 'permissionRequests' | 'sessionReady' | 'taskNotifications' | 'sessionCompletion'>
>
export type TestPushResponse =
| { ok: true }
| { error: string }
export type CodexDesktopScriptResponse = {
success: boolean
message?: string