Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
import { NanobotClient } from "@/lib/nanobot-client";
import type { InboundEvent } from "@/lib/types";
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);
},
};
}