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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><agent-presence> — standalone harness · three.ws</title>
<meta name="robots" content="noindex" />
<style>
:root {
color-scheme: dark;
--bg: #0a0a0a;
--panel: rgba(255, 255, 255, 0.04);
--stroke: rgba(255, 255, 255, 0.12);
--ink: #e8e8e8;
--dim: #888;
--accent: #8b5cf6;
font-family: 'Inter', system-ui, sans-serif;
}
body {
margin: 0;
background: var(--bg);
color: var(--ink);
padding: 24px;
line-height: 1.6;
}
h1 { font-size: 22px; margin: 0 0 4px; }
p.sub { color: var(--dim); margin: 0 0 20px; font-size: 14px; }
.controls {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
margin-bottom: 20px;
padding: 14px;
background: var(--panel);
border: 1px solid var(--stroke);
border-radius: 14px;
}
.controls label { font-size: 12px; color: var(--dim); }
input[type='text'] {
background: rgba(255, 255, 255, 0.06);
border: 1px solid var(--stroke);
color: var(--ink);
border-radius: 8px;
padding: 7px 10px;
font-size: 13px;
min-width: 280px;
}
button {
appearance: none;
cursor: pointer;
border: 1px solid var(--stroke);
background: rgba(255, 255, 255, 0.06);
color: var(--ink);
border-radius: 8px;
padding: 7px 12px;
font-size: 13px;
font-weight: 600;
transition: background 0.15s, transform 0.1s;
}
button:hover { background: rgba(255, 255, 255, 0.12); }
button:active { transform: scale(0.96); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.group { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.group + .group { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--stroke); }
#mount {
border: 1px dashed var(--stroke);
border-radius: 14px;
background: radial-gradient(120% 80% at 50% 0%, rgba(139, 92, 246, 0.1), transparent 60%);
overflow: hidden;
transition: width 0.25s, height 0.25s;
}
#mount[data-mode='stage'] { width: 100%; height: 600px; }
#mount[data-mode='companion'] { width: 360px; height: 460px; }
#mount[data-mode='mini'] { width: 100%; height: 200px; border-style: solid; opacity: 0.5; }
#mount[data-mode='mini']::after {
content: 'mini mode renders as a fixed, draggable, bottom-right companion →';
display: grid;
place-items: center;
height: 100%;
color: var(--dim);
font-size: 13px;
}
.hint { font-size: 12px; color: var(--dim); margin-top: 12px; }
code { background: rgba(255, 255, 255, 0.08); padding: 1px 5px; border-radius: 4px; }
</style>
</head>
<body>
<h1><agent-presence> harness</h1>
<p class="sub">
Standalone test for the global presence element — all three modes + live market reactions, on real data.
</p>
<div class="controls">
<div class="group">
<label for="id-input">agent / avatar id</label>
<input id="id-input" type="text" placeholder="paste an agent-id or avatar-id (blank = your signed-in agent)" />
<button id="apply-id">Load</button>
</div>
<div class="group">
<label>mode</label>
<button data-mode="stage">stage</button>
<button data-mode="companion">companion</button>
<button data-mode="mini">mini</button>
</div>
<div class="group">
<label>react</label>
<button data-react="snipe:filled">snipe:filled 🎉</button>
<button data-react="position:down">position:down 😟</button>
<button data-react="price:up">price:up</button>
<button data-react="alert">alert</button>
</div>
</div>
<div id="mount" data-mode="stage">
<agent-presence id="presence" data-mode="stage"></agent-presence>
</div>
<p class="hint">
Reaction buttons call <code>element.reactTo({ type })</code> directly and also broadcast via
<code>studio.emitMarket(...)</code>. Edit your agent in <code>/agent-studio</code> in another tab and watch
this avatar update live (when using your signed-in agent).
</p>
<script type="module">
import '../src/studio/agent-presence.js';
import { studio } from '../src/studio/agent-studio-store.js';
const mount = document.getElementById('mount');
let el = document.getElementById('presence');
// Apply id from query string for quick deep-links (?agent= / ?avatar=).
const qs = new URLSearchParams(location.search);
const qAgent = qs.get('agent');
const qAvatar = qs.get('avatar');
if (qAgent) el.setAttribute('data-agent-id', qAgent);
if (qAvatar) el.setAttribute('data-avatar-id', qAvatar);
function rebuild(attrs) {
// Re-create the element so a fresh boot picks up the new source.
const next = document.createElement('agent-presence');
next.id = 'presence';
next.setAttribute('data-mode', mount.dataset.mode);
if (attrs?.agentId) next.setAttribute('data-agent-id', attrs.agentId);
if (attrs?.avatarId) next.setAttribute('data-avatar-id', attrs.avatarId);
el.remove();
mount.appendChild(next);
el = next;
}
document.getElementById('apply-id').addEventListener('click', () => {
const v = document.getElementById('id-input').value.trim();
// A UUID with a leading 'a'/agent heuristic isn't reliable; treat the
// pasted id as an agent-id first (the element falls back to avatar lookup).
rebuild(v ? { agentId: v } : {});
});
for (const b of document.querySelectorAll('[data-mode]')) {
b.addEventListener('click', () => {
mount.dataset.mode = b.dataset.mode;
el.setAttribute('data-mode', b.dataset.mode);
});
}
for (const b of document.querySelectorAll('[data-react]')) {
b.addEventListener('click', () => {
const evt = { type: b.dataset.react, mint: 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump' };
el.reactTo(evt);
studio.emitMarket(evt);
});
}
</script>
</body>
</html>