email: push new-mail to /email via SSE (IMAP IDLE -> sidecar -> server -> EventSource)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 17:29:20 +00:00
co-authored by Claude Opus 4.8
parent 5a0b9ce70f
commit 4b08d0b99c
6 changed files with 93 additions and 4 deletions
+7
View File
@@ -15,6 +15,7 @@ import { findEntryByProxyId, touchEntry } from './servers/api/dev-server/router'
import officerWeb from './apps/officer-web/index.html';
import { startBrowserRelay } from './servers/api/browser/relay';
import { registerSidecar, unregisterSidecar, handleSidecarMessage } from './servers/sidecar-registry';
import { broadcastEmailNew } from './servers/api/email/email';
import type { SidecarRegistration } from './servers/sidecar/registration-protocol';
import { toShellUsername } from './servers/data-path';
@@ -71,6 +72,12 @@ const sidecarWebsocket = {
return;
}
// Email IDLE watcher reporting new mail → push to that user's /email SSE clients.
if (msg.type === 'email:new' && typeof msg.userEmail === 'string') {
broadcastEmailNew(msg.userEmail);
return;
}
const id = sidecarConnections.get(ws);
if (id) {
handleSidecarMessage(id, msg);