fix(webui): share sidebar and Composer run state (#6337)

This commit is contained in:
chengyongru authored and GitHub committed 2026-10-24 00:43:34 +08:00
1 parent 3d0f8feb77
commit 5ae49a43e7
13 files changed
+378 -374

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { NanobotClient } from "@/lib/nanobot-client";
import type { InboundEvent } from "@/lib/types";
/** Real lifecycle and dispatch with an in-memory transport. */
export function createStreamClient() {
const socket = {
readyState: 1,
onopen: null as (() => void) | null,
onmessage: null as ((event: MessageEvent) => void) | null,
send() {},
close() {},
};
const client = new NanobotClient({
url: "ws://test", reconnect: false,
socketFactory: () => socket as unknown as WebSocket,
});
client.connect();
socket.onopen?.();
return {
client,
receive(event: InboundEvent) {
socket.onmessage?.({ data: JSON.stringify(event) } as MessageEvent);
},
};
}