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/packages/server/public/js/agent-loader.js

overstepping87d71c076c55
diff --git a/xspace-agent/xspace-agent/packages/server/public/js/agent-loader.js b/xspace-agent/xspace-agent/packages/server/public/js/agent-loader.js
new file mode 100644
index 000000000..463be74a9
--- /dev/null
+++ b/xspace-agent/xspace-agent/packages/server/public/js/agent-loader.js
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§69]
+
+// Dynamic provider loader — fetches config and initializes the right provider
+(async function() {
+ // AGENT_CONFIG must be set before this script loads
+ const config = window.AGENT_CONFIG
+ if (!config) {
+ console.error("AGENT_CONFIG not set")
+ return
+ }
+
+ // Create the shared agent instance
+ const agent = new AgentCommon(config)
+
+ // Fetch server config to determine provider type
+ try {
+ const res = await fetch("/config")
+ const serverConfig = await res.json()
+
+ agent.log(`AI Provider: ${serverConfig.aiProvider} (${serverConfig.providerType} mode)`)
+
+ if (serverConfig.providerType === "webrtc") {
+ // Load OpenAI Realtime WebRTC provider
+ initOpenAIRealtime(agent)
+ } else {
+ // Load Socket.IO-based provider (Claude/Groq)
+ initSocketProvider(agent)
+ }
+ } catch (err) {
+ agent.log("Failed to load config: " + err.message, "error")
+ }
+})()
+
+