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.

968 B
Raw Blame
/**
 * Body Studio — mount bootstrap (P3)
 * ==================================
 * Binds the Body Studio to the Agent Studio shell's Body tab on
 * `studio-shell:ready`. Mirrors P1/P2 mounts: idempotent and order-independent
 * (handles both event-after-subscribe and already-ready).
 *
 * The agent-studio page loads this alongside the shell:
 *   <script type="module" src="/src/studio/body/body-mount.js"></script>
 */

import { studio } from '../agent-studio-store.js';
import { mountBodyStudio } from './body-studio.js';

const SELECTOR = '[data-studio-mount="body"]';

function mount() {
	const panel = document.querySelector(SELECTOR);
	if (!panel || panel.dataset.bodyMounted) return false;
	mountBodyStudio(panel, { studio });
	return true;
}

document.addEventListener('studio-shell:ready', mount, { once: false });

if (!mount()) {
	let tries = 0;
	const t = setInterval(() => {
		if (mount() || ++tries > 60) clearInterval(t); // ~6s ceiling
	}, 100);
}