mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 08:47:02 +01:00
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>
19 lines
808 B
SQL
19 lines
808 B
SQL
-- 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");
|