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/agent-voice-chat/lib/sse-parser.js
oversteppinga4d560f293b2
diff --git a/xspace-agent/agent-voice-chat/lib/sse-parser.js b/xspace-agent/agent-voice-chat/lib/sse-parser.jsnew file mode 100644index 000000000..2cb81e93b--- /dev/null+++ b/xspace-agent/agent-voice-chat/lib/sse-parser.js@@ -0,0 +1,49 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent)++/**+ * Parse a single SSE chunk (string or Buffer) and yield content deltas.+ * Returns { deltas: string[], done: boolean }+ */+function parseSSEChunk(chunk) {+ const text = typeof chunk === "string" ? chunk : chunk.toString()+ const lines = text.split("\n").filter(l => l.startsWith("data: "))+ const deltas = []+ let done = false++ for (const line of lines) {+ const data = line.slice(6).trim()+ if (data === "[DONE]") {+ done = true+ break+ }+ try {+ const parsed = JSON.parse(data)+ const delta = parsed.choices?.[0]?.delta?.content+ if (delta) {+ deltas.push(delta)+ }+ } catch (e) {+ // skip malformed JSON+ }+ }++ return { deltas, done }+}++/**+ * Async generator that consumes an SSE stream and yields content deltas.+ */+async function* parseSSEStream(stream) {+ for await (const chunk of stream) {+ const { deltas, done } = parseSSEChunk(chunk)+ for (const delta of deltas) {+ yield delta+ }+ if (done) return+ }+}++module.exports = { parseSSEChunk, parseSSEStream }++