🤖 Add Completion Notifications (Desktop + Web + Mobile PWA) #445
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Adds optional notifications when agent streams complete. Works across:
Implementation
Backend (NotificationService)
IPC Layer
Added 4 new channels:
NOTIFICATION_SUBSCRIBE_PUSH- Register push subscriptionNOTIFICATION_UNSUBSCRIBE_PUSH- Remove push subscriptionNOTIFICATION_GET_VAPID_KEY- Get public VAPID keyNOTIFICATION_SEND- Trigger notificationFrontend
src/utils/notifications/pushSubscription.ts)public/service-worker.js)Trigger Logic
stream-endKey Design Decisions
Backend vs Frontend Trigger
Frontend triggers notifications after checking localStorage preference. Keeps backend agnostic to UI preferences.
Push Subscription Storage
In-memory Map (not persisted). Frontend re-subscribes on app load if permission already granted. Avoids stale subscriptions.
Global vs Per-Workspace Subscriptions
Global subscriptions (not per-workspace). Simpler UX - one device receives all completion notifications.
VAPID Key Storage
Stored in
~/.cmux/vapid.json. Generated once on first notification enable. Persists across restarts.Testing
Manual testing checklist:
Files Changed
New Files
src/services/NotificationService.ts(151 lines) - VAPID keys, push notificationssrc/utils/notifications/pushSubscription.ts(99 lines) - Push subscription managementsrc/types/notification.ts(32 lines) - Type definitionsModified Files
public/service-worker.js(+43 lines) - Push event handlerssrc/constants/storage.ts(+6 lines) - Notification preference keysrc/constants/ipc-constants.ts(+4 lines) - IPC channelssrc/services/ipcMain.ts(+62 lines) - IPC handlers, NotificationService integrationsrc/stores/WorkspaceStore.ts(+13 lines) - Trigger logicsrc/components/CommandPalette.tsx- Command palette toggle (via sources.ts)src/utils/commands/sources.ts(+40 lines) - Settings section with togglesrc/browser/api.ts(+9 lines) - Web API implementationsrc/preload.ts(+9 lines) - Preload API exposuresrc/types/ipc.ts(+6 lines) - API type definitionssrc/App.stories.tsx(+6 lines) - Mock API for Storybooksrc/main-server.ts(+1 line) - Pass isDesktop=falseTotal: ~370 lines added
Future Enhancements
Generated with
cmux