Skip to content

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.

add xspace-agent/xspace-agent/agent-voice-chat/providers/sse-parser.js

overstepping2e77e2a4f333
diff --git a/xspace-agent/xspace-agent/agent-voice-chat/providers/sse-parser.js b/xspace-agent/xspace-agent/agent-voice-chat/providers/sse-parser.js
new file mode 100644
index 000000000..85da5901e
--- /dev/null
+++ b/xspace-agent/xspace-agent/agent-voice-chat/providers/sse-parser.js
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent)
+
+/**
+ * Async generator that parses an SSE stream from a fetch/axios response.
+ * Yields parsed JSON data objects from each `data: {...}` line.
+ * Stops on `data: [DONE]`.
+ */
+async function* parseSSEStream(responseStream) {
+ for await (const chunk of responseStream) {
+ const lines = chunk.toString().split("\n").filter(l => l.startsWith("data: "))
+ for (const line of lines) {
+ const data = line.slice(6).trim()
+ if (data === "[DONE]") return
+ try {
+ yield JSON.parse(data)
+ } catch (e) {
+ // skip malformed chunks
+ }
+ }
+ }
+}
+
+module.exports = { parseSSEStream }
+
+