Share upstream event stream hub

This commit is contained in:
Bohdan Triapitsyn
2026-04-24 12:30:11 +03:00
parent 8e610ca8b3
commit 7030549d78
12 changed files with 1436 additions and 201 deletions
+8
View File
@@ -33,6 +33,7 @@ import { detectSayTtsCapability } from './lib/tts/capability-runtime.js';
import { createTerminalRuntime } from './lib/terminal/runtime.js';
import {
createGlobalUiEventBroadcaster,
createGlobalMessageStreamHub,
createMessageStreamWsRuntime,
} from './lib/event-stream/index.js';
import { createFsSearchRuntime as createFsSearchRuntimeFactory } from './lib/fs/search.js';
@@ -648,11 +649,17 @@ const notificationTriggerRuntime = createNotificationTriggerRuntime({
const maybeSendPushForTrigger = (...args) => notificationTriggerRuntime.maybeSendPushForTrigger(...args);
const setAutoAcceptSession = (...args) => notificationTriggerRuntime.setAutoAcceptSession(...args);
const globalMessageStreamHub = createGlobalMessageStreamHub({
buildOpenCodeUrl,
getOpenCodeAuthHeaders,
});
const openCodeWatcherRuntime = createOpenCodeWatcherRuntime({
waitForOpenCodePort: (...args) => waitForOpenCodePort(...args),
buildOpenCodeUrl,
getOpenCodeAuthHeaders,
parseSseDataPayload: (...args) => parseSseDataPayload(...args),
globalEventHub: globalMessageStreamHub,
onPayload: (payload) => {
maybeCacheSessionInfoFromEvent(payload);
void maybeSendPushForTrigger(payload);
@@ -1155,6 +1162,7 @@ async function main(options = {}) {
rejectWebSocketUpgrade,
buildOpenCodeUrl,
getOpenCodeAuthHeaders,
globalEventHub: globalMessageStreamHub,
processForwardedEventPayload,
messageStreamWsClients: uiNotificationWsClients,
terminalHeartbeatIntervalMs: TERMINAL_INPUT_WS_HEARTBEAT_INTERVAL_MS,