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.

feat(avatar-chat): add option to disable avatar chat and update related functionality

nirholasb829e903c8bd
diff --git a/specs/EMBED_SPEC.md b/specs/EMBED_SPEC.md
index ea8aedbdd..26ead0b2a 100644
--- a/specs/EMBED_SPEC.md
+++ b/specs/EMBED_SPEC.md
@@ -434,6 +434,23 @@ Parent host is determined from `window.location.ancestorOrigins` (Chromium) or `
**We ship permissionless by default.** On-chain identity is public — any embedder can show any agent unless the owner has explicitly set a policy. The policy path exists so owners _can_ restrict later; it doesn't gate the default experience.
+### URL hash params (SPA iframe embeds)
+
+When embedding the SPA directly as an iframe (e.g. `src="/app#widget=..."`), the following hash params are supported as per-embed overrides:
+
+| Hash param | Effect |
+|---|---|
+| `#kiosk` | Hides header and footer chrome |
+| `#noAnimations` | Disables animation clip picker |
+| `#noChat` | Suppresses the chat UI entirely |
+| `#noControls` | Hides orbit/pan/zoom controls |
+| `#avatar-chat=off` | Disables the inline avatar layout and walk animation; restores the original bottom-bar chat layout |
+
+Example:
+```html
+<iframe src="https://three.ws/app#widget=wdgt_abc&avatar-chat=off"></iframe>
+```
+
## Delegations (optional, v0.2+)
The `<agent-3d>` embed can surface and redeem ERC-7710 delegations granted to an agent. This section specifies how the embed discovers delegations, which host configurations unlock redemption, and how hosts communicate with the embed over the post-message channel.
diff --git a/src/app.js b/src/app.js
index 351780e7e..a1292a4ab 100644
--- a/src/app.js
+++ b/src/app.js
@@ -158,6 +158,7 @@ class App {
noAnimations: Boolean(hash.noAnimations),
noChat: Boolean(hash.noChat),
noControls: Boolean(hash.noControls),
+ avatarChatOff: hash['avatar-chat'] === 'off',
};
// Fire-and-forget silent wallet reconnect. Cheap (single `eth_accounts`
@@ -957,6 +958,7 @@ class App {
if (this.options.noAnimations) cfg.showClipPicker = false;
if (this.options.noChat) cfg._noChat = true;
if (this.options.noControls) cfg.showControls = false;
+ if (this.options.avatarChatOff) cfg.avatarChatOff = true;
// Apply config to options BEFORE creating the viewer so first frame is right.
if (Array.isArray(cfg.cameraPosition) && cfg.cameraPosition.length === 3) {
diff --git a/src/element.js b/src/element.js
index 0aa99e52e..9a3051cb7 100644
--- a/src/element.js
+++ b/src/element.js
@@ -1726,6 +1726,7 @@ class Agent3DElement extends HTMLElement {
}
}
+ // Hides bubble, clears buffer, and cancels any pending RAF/timer.
_clearThoughtBubble() {
this._bubbleBuffer = '';
this._bubbleRafPending = false;
@@ -1769,6 +1770,7 @@ class Agent3DElement extends HTMLElement {
}
}
+ // Walk animation: debounced — keeps walking as long as chunks arrive within 600ms of each other.
_onStreamChunk() {
if (!this._scene || this.getAttribute('avatar-chat') === 'off') return;
if (this.hasAttribute('kiosk')) return;
@@ -1783,6 +1785,7 @@ class Agent3DElement extends HTMLElement {
this._walkStopDebounce = setTimeout(() => this._stopWalkAnimation(), 600);
}
+ // Crossfade walk→idle; safe to call even if not currently walking.
_stopWalkAnimation() {
if (!this._isWalking) return;
this._isWalking = false;
@@ -2274,17 +2277,22 @@ class Agent3DElement extends HTMLElement {
/**
* Enable the inline avatar-in-chat layout.
- * Avatar walks during LLM streaming and shows a thought bubble.
- * This is the default state — only needed to re-enable after `disableAvatarChat()`.
+ * The avatar canvas is visible through a transparent window between the chat
+ * history and the input bar. The avatar walks during LLM streaming and shows
+ * a thought bubble with streaming text above its head.
+ * This is the default state. Call to re-enable after {@link disableAvatarChat}.
+ * @returns {void}
*/
enableAvatarChat() {
this.removeAttribute('avatar-chat');
}
/**
- * Disable the inline avatar-in-chat layout.
- * Restores the original bottom-bar chat overlay.
- * Stops any in-progress walk animation and clears the thought bubble.
+ * Disable the inline avatar-in-chat layout and restore the original
+ * bottom-bar chat layout (messages left, input right, avatar in background).
+ * Walk animation and thought bubble will not fire while disabled.
+ * Equivalent to setting the `avatar-chat="off"` attribute.
+ * @returns {void}
*/
disableAvatarChat() {
this.setAttribute('avatar-chat', 'off');