Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
add xspace-agent/xspace-agent/agent-voice-chat/tests/helpers/mock-websocket.js
overstepping21f0dd3aba93
diff --git a/xspace-agent/xspace-agent/agent-voice-chat/tests/helpers/mock-websocket.js b/xspace-agent/xspace-agent/agent-voice-chat/tests/helpers/mock-websocket.jsnew file mode 100644index 000000000..af92651a5--- /dev/null+++ b/xspace-agent/xspace-agent/agent-voice-chat/tests/helpers/mock-websocket.js@@ -0,0 +1,64 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent)++const { EventEmitter } = require("events")++/**+ * Mock WebSocket for testing WebRTC/realtime providers.+ * Mimics the browser WebSocket API surface used by realtime providers.+ */+class MockWebSocket extends EventEmitter {+ constructor(url) {+ super()+ this.url = url+ this.readyState = 1 // OPEN+ this.sent = []+ this.CONNECTING = 0+ this.OPEN = 1+ this.CLOSING = 2+ this.CLOSED = 3+ }++ send(data) {+ if (this.readyState !== 1) {+ throw new Error("WebSocket is not open")+ }+ this.sent.push(typeof data === "string" ? JSON.parse(data) : data)+ }++ close(code = 1000, reason = "") {+ this.readyState = 3+ this.emit("close", { code, reason })+ }++ /** Simulate receiving a message from the server */+ simulateMessage(event) {+ this.emit("message", { data: JSON.stringify(event) })+ }++ /** Simulate a WebSocket error */+ simulateError(error) {+ this.emit("error", error instanceof Error ? error : new Error(error))+ }++ /** Simulate the connection opening */+ simulateOpen() {+ this.readyState = 1+ this.emit("open")+ }++ /** Simulate an unexpected close */+ simulateUnexpectedClose(code = 1006, reason = "Abnormal closure") {+ this.readyState = 3+ this.emit("close", { code, reason, wasClean: false })+ }++ /** Reset sent messages for test isolation */+ resetSent() {+ this.sent = []+ }+}++module.exports = { MockWebSocket }++