feat(web): add WebSocket transport for message event streaming with SSE fallback (#764)

* feat: add websocket message stream transport

* fix: avoid false missing session directories in sidebar

* fix: re-probe project root session directories

* refactor: use button group for message stream transport

* fix: resolve chat input hook dependency warning

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Yifan
2026-04-17 11:07:26 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent fd8972a7d9
commit bee9d19f3a
26 changed files with 1515 additions and 163 deletions
@@ -4,6 +4,7 @@ export const createNotificationEmitterRuntime = (dependencies) => {
getDesktopNotifyEnabled,
desktopNotifyPrefix,
getUiNotificationClients,
getBroadcastGlobalUiEvent,
} = dependencies;
const writeSseEvent = (res, payload) => {
@@ -34,6 +35,25 @@ export const createNotificationEmitterRuntime = (dependencies) => {
return;
}
const syntheticPayload = {
type: 'openchamber:notification',
properties: {
...payload,
// Tell the UI whether the sidecar stdout notification channel is active.
// When true, the desktop UI should skip this SSE notification to avoid duplicates.
// When false (e.g. tauri dev), the UI must handle this SSE notification itself.
desktopStdoutActive: desktopNotifyEnabled,
},
};
const broadcastGlobalUiEvent = typeof getBroadcastGlobalUiEvent === 'function'
? getBroadcastGlobalUiEvent()
: null;
if (broadcastGlobalUiEvent) {
broadcastGlobalUiEvent(syntheticPayload);
return;
}
const clients = getUiNotificationClients();
if (clients.size === 0) {
return;
@@ -41,16 +61,7 @@ export const createNotificationEmitterRuntime = (dependencies) => {
for (const res of clients) {
try {
writeSseEvent(res, {
type: 'openchamber:notification',
properties: {
...payload,
// Tell the UI whether the sidecar stdout notification channel is active.
// When true, the desktop UI should skip this SSE notification to avoid duplicates.
// When false (e.g. tauri dev), the UI must handle this SSE notification itself.
desktopStdoutActive: desktopNotifyEnabled,
},
});
writeSseEvent(res, syntheticPayload);
} catch {
// ignore
}