Issue for this PR
Closes #58428
Stacked on #58399, which fixes notifications on Android. This PR adds Web Push on top of it.
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Adds opt-in Web Push notifications for paired browsers. The local OpenCode server stores a VAPID key and one subscription per browser installation, encrypts each notification, and sends it directly to the browser vendor's push service. There is no OpenCode relay and no new hosted infrastructure.
The app registers a dedicated worker under /push/<server-key>/ and adds a per-server push switch to Settings → Notifications. The existing Agent, Permissions, Questions, and Errors switches choose which events are pushed.
Payloads contain a localized title, the session route, a tag, and the event kind. They omit prompts, source code, session titles, errors, and tool output. Push endpoints are allowlisted, redirects are rejected, and a 404/410 response removes the subscription.
I opened #58428 for design approval and am keeping this as a draft until it gets a decision.
How did you verify your code works?
bun run check (34/34 tasks)
bun run generate in packages/client (no diff)
bun run probe:workerd in packages/server
bun test test/push.test.ts in packages/server (5 passed)
- App unit tests: 19 passed; browser notification state: 4 passed
bun run test:service-worker (13 passed, including a stopped-worker push injection)
- Not verified: live APNs/FCM delivery and physical-device behavior.
Screenshots / recordings
Desktop web app:

Mobile portrait (390×844):

Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR