Files
loki/drizzle/0020_push_subscriptions.sql
g-butandCursor 60f0cff749 feat(push): web push subscriptions and stop-hook notifications
Adds VAPID-backed subscribe/notify API, service worker, top-bar pill,
and Stop hook push_notify_stop for ambient agent-done signals on mobile.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:05:35 +02:00

19 lines
808 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Web Push subscriptions — one row per (user × device-browser). Endpoint
-- is the push-service-issued URL; UNIQUE so resubscribing upserts cleanly.
-- The autopilot Stop hook (agent-hook-bridge.sh push_notify_stop) fans a
-- notification to every row for the calling daemon's user.
CREATE TABLE IF NOT EXISTS "push_subscriptions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
"user_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
"endpoint" text NOT NULL UNIQUE,
"p256dh" text NOT NULL,
"auth" text NOT NULL,
"user_agent" text,
"created_at" timestamptz NOT NULL DEFAULT now(),
"last_seen_at" timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS "idx_push_subscriptions_user_id"
ON "push_subscriptions" ("user_id");