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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user