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/packages/widget/src/auto-init.ts
overstepping00f9332a4183
diff --git a/xspace-agent/xspace-agent/packages/widget/src/auto-init.ts b/xspace-agent/xspace-agent/packages/widget/src/auto-init.tsnew file mode 100644index 000000000..20660fa0a--- /dev/null+++ b/xspace-agent/xspace-agent/packages/widget/src/auto-init.ts@@ -0,0 +1,43 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§32]++/**+ * Auto-init entry point for UMD bundle.+ * Detects <script> tag data-* attributes and auto-initializes a widget.+ * Also exposes XSpaceWidget and createWidget on window.XSpace for manual usage.+ */+import { XSpaceWidget, createWidget } from './index'+import type { WidgetConfig, Position, ThemeMode } from './index'++export * from './index'++// Attach to window for UMD consumers+const api = { XSpaceWidget, createWidget }+;(window as any).XSpace = { ...(window as any).XSpace, ...api }++// Auto-init from <script> tag data attributes+function autoInit(): void {+ const script = document.currentScript as HTMLScriptElement | null+ if (!script) return++ const serverUrl = script.dataset.serverUrl+ if (!serverUrl) return++ const config: WidgetConfig = {+ serverUrl,+ agentId: script.dataset.agentId,+ theme: (script.dataset.theme as ThemeMode) || undefined,+ position: (script.dataset.position as Position) || undefined,+ apiKey: script.dataset.token,+ }++ createWidget(config)+}++if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', autoInit)+} else {+ autoInit()+}++