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.

fix(viewer): tell the user when a drop has no model instead of failing silently

nirholas540a0f197582
diff --git a/pages/agent-wallet.html b/pages/agent-wallet.html
index 70ef11df2..18f152179 100644
--- a/pages/agent-wallet.html
+++ b/pages/agent-wallet.html
@@ -38,6 +38,15 @@
max-width: 820px;
margin: 0 auto;
padding: calc(var(--space-md) * 2) var(--space-md) calc(var(--space-md) * 4);
+ /* style.css makes <body> a flex column, so this <main> is a flex item
+ and was sized from its content instead of the viewport: the tab
+ strip's 1554px of tabs stretched it to 792px on a 320px screen.
+ <html> does not scroll horizontally, so that overflow was silently
+ clipped and the Refresh button plus the right edge of every card
+ were unreachable on a phone. An explicit 100% resolves against the
+ body's content box, pinning the column to the viewport; the tab
+ strip keeps scrolling on its own overflow-x. */
+ width: 100%;
}
.awh-crumb {
font: var(--text-sm) var(--font-body);
diff --git a/pages/ar-studio.html b/pages/ar-studio.html
index 03a3a2c40..1db0ee688 100644
--- a/pages/ar-studio.html
+++ b/pages/ar-studio.html
@@ -40,6 +40,13 @@
--warn: #fca5a5;
--radius: 14px;
--font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
+ /* Design tokens the shared <lang-switcher> reads, mapped onto this page's
+ HUD palette so the picker matches the pills around it. */
+ --surface-2: rgba(12, 13, 17, 0.78);
+ --border: rgba(255, 255, 255, 0.16);
+ --border-strong: rgba(255, 255, 255, 0.28);
+ --text-2: #ecedf2;
+ --text: #fff;
}
* { box-sizing: border-box; }
/* Class display rules (flex/grid) must never override the hidden attribute —
@@ -72,7 +79,13 @@
#ars-hud > * { pointer-events: none; }
#ars-hud a, #ars-hud button, #ars-hud input, #ars-hud form,
#ars-hud .ars-top, #ars-hud .ars-dock, #ars-hud .ars-selbar,
- #ars-hud .ars-tray, #ars-hud .ars-modal { pointer-events: auto; }
+ #ars-hud .ars-tray, #ars-hud .ars-modal, #ars-hud lang-switcher { pointer-events: auto; }
+ /* The language picker lives in this page's own top bar. i18n.js floats its
+ bottom-right FAB only on pages that place no <lang-switcher> of their own,
+ and that FAB sat directly on top of the dock's right-hand controls, which
+ left Clear unclickable. Hosting it here keeps language switching reachable
+ and gives the dock its full width back. */
+ #ars-hud lang-switcher { display: inline-flex; flex: 0 1 auto; min-width: 0; max-width: 132px; }
/* ── Top bar ── */
.ars-top {
@@ -339,9 +352,14 @@
.ars-chip, .ars-status, .ars-selbar, .ars-tray-sheet { animation: none; }
.ars-spinner { animation-duration: 2.4s; }
}
- @media (max-width: 380px) {
+ @media (max-width: 420px) {
.ars-title { display: none; }
.ars-sel-name { max-width: 20vw; }
+ /* Phone widths: the top bar carries back + language + room + photo, so
+ the language picker gives up its width first and the room button drops
+ its label (the emoji plus its aria-label still name it). */
+ #ars-hud lang-switcher { max-width: 92px; }
+ #ars-room-label { display: none; }
}
</style>
@@ -358,7 +376,8 @@
<span class="ars-title" data-i18n="ar_studio.ar_studio">AR Studio</span>
<span class="ars-count" id="ars-count" hidden data-i18n="ar_studio.0_models">0 models</span>
<span class="ars-spacer"></span>
- <button class="ars-icon-btn" id="ars-room-btn" type="button" aria-haspopup="dialog" aria-label="Build together in a shared room" data-i18n="ar_studio.share_live" data-i18n-attr="aria-label:ar_studio.build_together_in_a_shared_r_arialabel">👥 Share live</button>
+ <lang-switcher></lang-switcher>
+ <button class="ars-icon-btn" id="ars-room-btn" type="button" aria-haspopup="dialog" aria-label="Build together in a shared room" data-i18n-attr="aria-label:ar_studio.build_together_in_a_shared_r_arialabel"><span aria-hidden="true">👥</span><span id="ars-room-label" data-i18n="ar_studio.share_live">Share live</span><span id="ars-room-code-label" hidden></span></button>
<button class="ars-icon-btn" id="ars-photo-btn" type="button" disabled aria-label="Capture a photo of your scene" data-i18n-attr="aria-label:ar_studio.capture_a_photo_of_your_scen_arialabel">📸</button>
<button class="ars-icon-btn" id="ars-qr-btn" type="button" hidden aria-label="Send this scene to your phone" data-i18n="ar_studio.phone" data-i18n-attr="aria-label:ar_studio.send_this_scene_to_your_phon_arialabel">Phone ↗</button>
</header>
diff --git a/src/agora/agora.css b/src/agora/agora.css
index 87f6d68ea..32a21ae1f 100644
--- a/src/agora/agora.css
+++ b/src/agora/agora.css
@@ -4,6 +4,39 @@
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+/* The Commons is a full-bleed canvas with four independent layers competing for
+ the bottom of a phone screen: the job board panel, the humans dock, the "Enter
+ the Commons" button, and the platform's language switcher. They each used to
+ pin themselves to `bottom: ~10px` in their own stylesheet, so on a 320px
+ viewport all four landed on the same 90 pixels and the primary call to action
+ ended up underneath two other controls. These two tokens are the shared
+ vocabulary that stacks them instead:
+
+ --agora-corner-band : the strip the global language switcher owns in the
+ bottom-right corner (src/i18n.js pins it 16px up).
+ --agora-pop-band : the strip the population chip owns in the bottom-left
+ corner. It only applies above 560px, where the chip is
+ still pinned to the bottom (below that it moves under
+ the title, see the responsive block at the end).
+ --agora-dock-floor : where the humans dock's bottom edge sits. Bottom-left
+ above the population chip on a wide screen; on a phone
+ the dock spans the full width, so it clears the
+ language switcher's corner instead.
+ --agora-dock-h : the humans dock's live measured height, published by
+ src/agora/me-hud.js as its content changes.
+
+ Everything that sits at the bottom of the world is positioned against these,
+ bottom up, so a state change in one layer moves the others instead of hiding
+ them. */
+:root {
+ --agora-corner-band: 52px;
+ --agora-pop-band: 67px;
+ --agora-dock-floor: var(--agora-pop-band);
+}
+@media (max-width: 640px) {
+ :root { --agora-dock-floor: calc(var(--agora-corner-band) + 4px); }
+}
+
html, body {
width: 100%; height: 100%;
overflow: hidden;
@@ -117,8 +150,12 @@ html, body {
#agora-enter:disabled { opacity: 0.6; cursor: progress; }
#agora-enter[aria-pressed="true"] { background: rgba(255, 255, 255, 0.08); }
@media (max-width: 640px) {
- /* Clear the touch stick + action cluster in play mode. */
- #agora-enter { bottom: 14px; font-size: 12px; padding: 9px 16px; }
+ /* Clear the touch stick + action cluster in play mode, and ride above the
+ humans dock so the world's primary invitation is never buried under it. */
+ #agora-enter {
+ bottom: calc(var(--agora-dock-floor, 56px) + var(--agora-dock-h, 0px) + 10px);
+ font-size: 12px; padding: 9px 16px;
+ }
}
#agora-controls-hint {
diff --git a/src/agora/economy-layer.css.js b/src/agora/economy-layer.css.js
index 882c6b4db..761cb956d 100644
--- a/src/agora/economy-layer.css.js
+++ b/src/agora/economy-layer.css.js
@@ -105,9 +105,14 @@ export const ECON_LAYER_CSS = `
.agora-econ-tip-sub { margin-top: 5px; font-size: 11px; color: var(--econ-dim); }
/* ── Ticker (left) ─────────────────────────────────────────────────────────── */
+/* Rides on top of the humans dock in the shared bottom-left stack (the tokens
+ are documented at the top of src/agora/agora.css). Pinned to a flat 16px it
+ sat underneath the dock, which hid the tail of the live activity feed. */
.agora-econ-ticker {
- position: absolute; left: 16px; bottom: 16px; width: 320px;
- max-height: calc(100vh - 120px); display: flex; flex-direction: column; gap: 12px;
+ position: absolute; left: 16px; width: 320px;
+ bottom: calc(var(--agora-dock-floor, 67px) + var(--agora-dock-h, 0px) + 10px);
+ max-height: calc(100vh - 120px - var(--agora-dock-floor, 67px) - var(--agora-dock-h, 0px));
+ display: flex; flex-direction: column; gap: 12px;
background: var(--econ-bg); border: 1px solid var(--econ-border);
border-radius: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
padding: 14px; pointer-events: auto; color: var(--econ-text);
@@ -181,16 +186,29 @@ export const ECON_LAYER_CSS = `
/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
.agora-econ-board-panel { width: 230px; top: 58px; right: 10px; max-height: 42vh; }
- .agora-econ-ticker { width: calc(100vw - 250px); max-width: 320px; left: 10px; bottom: 10px; max-height: 42vh; }
+ .agora-econ-ticker {
+ width: calc(100vw - 250px); max-width: 320px; left: 10px; max-height: 42vh;
+ bottom: calc(var(--agora-dock-floor, 67px) + var(--agora-dock-h, 0px) + 10px);
+ }
}
+/* Phone layout: both economy panels go full width and stack up from the bottom.
+ They sit above the world's other bottom furniture (the language switcher's
+ corner strip, the humans dock, the "Enter the Commons" button) rather than
+ under it, which is what used to clip the board's last few rows out of reach.
+ --agora-econ-floor is the top of that furniture; both panels measure from it,
+ so the stack stays sound when the dock changes height. */
@media (max-width: 560px) {
+ .agora-econ-root {
+ --agora-econ-floor: calc(var(--agora-dock-floor, 56px) + var(--agora-dock-h, 0px) + 54px);
+ }
.agora-econ-board-panel {
- top: auto; bottom: 10px; right: 10px; left: 10px; width: auto;
- max-height: 34vh; flex-direction: column;
+ top: auto; bottom: var(--agora-econ-floor); right: 10px; left: 10px; width: auto;
+ max-height: 26vh; flex-direction: column;
}
.agora-econ-ticker {
- left: 10px; right: 10px; bottom: calc(34vh + 18px); width: auto; max-width: none;
- max-height: 36vh;
+ left: 10px; right: 10px; width: auto; max-width: none;
+ bottom: calc(var(--agora-econ-floor) + 26vh + 10px);
+ max-height: 26vh;
}
.agora-econ-readout { grid-template-columns: repeat(3, 1fr); }
}
diff --git a/src/agora/humans.css.js b/src/agora/humans.css.js
index d07ac51d9..6171e4439 100644
--- a/src/agora/humans.css.js
+++ b/src/agora/humans.css.js
@@ -30,12 +30,26 @@ const HUMANS_CSS = `
.agora-h-root *, .agora-h-root *::before { box-sizing: border-box; }
/* ── Dock (bottom-left) ──────────────────────────────────────────────────── */
+/* The dock sits at the bottom-left, but it is not alone there: the population
+ chip is pinned below it and the economy ticker stacks above it. It used to
+ claim a flat 16px bottom like both of them, so all three drew on the same corner
+ and the dock (z-index 60) simply covered the other two. --agora-dock-floor is
+ the shared bottom-up stack the whole world's furniture measures from; see the
+ token block at the top of src/agora/agora.css. */
#agora-humans-dock {
- position: fixed; left: 16px; bottom: 16px; z-index: 60;
+ position: fixed; left: 16px; bottom: var(--agora-dock-floor, 67px); z-index: 60;
display: flex; align-items: stretch; gap: 8px;
max-width: min(92vw, 420px);
}
-@media (max-width: 640px) { #agora-humans-dock { left: 8px; right: 8px; bottom: 8px; max-width: none; } }
+/* On a phone the dock goes full width, which walks it straight into the global
+ language switcher pinned to the bottom-right corner (src/i18n.js, 16px up and
+ the topmost z-index on the page). At 320px the switcher covered the dock's own
+ "Sign in to join" button. Sit the dock above that corner strip instead; the
+ strip's height is shared with the rest of the world's bottom furniture through
+ --agora-corner-band (src/agora/agora.css). */
+@media (max-width: 640px) {
+ #agora-humans-dock { left: 8px; right: 8px; max-width: none; }
+}
.agora-h-card {
display: flex; align-items: center; gap: 10px;
diff --git a/src/agora/me-hud.js b/src/agora/me-hud.js
index e95be2361..4b992216e 100644
--- a/src/agora/me-hud.js
+++ b/src/agora/me-hud.js
@@ -32,6 +32,28 @@ const state = {
};
let dock, toasts, panel, root;
+let dockResize = null;
+
+// Publish the dock's live height as --agora-dock-h on :root.
+//
+// On a phone the dock spans the full width at the bottom of the world, and the
+// page's other bottom furniture (the "Enter the Commons" button, the job board
+// panel) has to sit above it or be swallowed by it. The dock's height is not a
+// constant the stylesheets could hardcode: it grows and shrinks with the signed
+// out invite, the signed in citizen card, and whatever job is in flight. So the
+// dock measures itself and the layout is expressed against that number, which
+// keeps the stack correct through every state instead of only the one somebody
+// measured once.
+function publishDockHeight() {
+ if (!dock || typeof ResizeObserver === 'undefined') return;
+ const push = () => {
+ const h = Math.round(dock.getBoundingClientRect().height);
+ document.documentElement.style.setProperty('--agora-dock-h', `${h}px`);
+ };
+ dockResize = new ResizeObserver(push);
+ dockResize.observe(dock);
+ push();
+}
function boot() {
if (typeof document === 'undefined') return;
@@ -41,6 +63,7 @@ function boot() {
toasts = h('div', { id: 'agora-humans-toasts', 'aria-live': 'polite' });
root.append(dock, toasts);
document.body.appendChild(root);
+ publishDockHeight();
panel = new Panel({ id: 'agora-you' }).mount(document.body);
diff --git a/src/app.js b/src/app.js
index 0ea3017d5..f44b46af8 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1830,7 +1830,20 @@ class App {
// stop. Falling through to view() would hand `undefined` to
// URL.createObjectURL ("Overload resolution failed") and throw an
// uncaught TypeError that pages the ops channel.
- this.onError('No .gltf or .glb asset found.');
+ //
+ // onError alone is console-only, so a user who dropped a .txt or a
+ // texture folder saw nothing happen at all. Retrying the same bad file
+ // is pointless; the recovery is to pick a different one, so re-open the
+ // picker and leave the stage clear rather than flashing a fake load.
+ // Warn, not error: picking the wrong file is ordinary user input, and
+ // the overlay below is now the surface that reports it.
+ this.hideSpinner();
+ log.warn('[3d-agent] no .gltf or .glb asset in selection');
+ this._showViewerError(
+ 'No .gltf or .glb file in that drop. Pick a model file to view it.',
+ () => this.inputEl?.click(),
+ { actionLabel: 'Choose a file', keepOpenUntilLoad: true },
+ );
return;
}
@@ -2239,21 +2252,31 @@ class App {
progressEl.hidden = false;
}
- _showViewerError(label, onRetry) {
+ /**
+ * @param {string} label What went wrong, in the user's terms.
+ * @param {?Function} onAction Recovery to run when the button is pressed.
+ * @param {{ actionLabel?: string, busyLabel?: string }} [opts]
+ * Wording for actions that aren't a plain retry of the same load, e.g.
+ * re-opening the file picker after an unusable drop.
+ */
+ _showViewerError(label, onAction, opts = {}) {
+ const actionLabel = opts.actionLabel || 'Retry';
+ const busyLabel = opts.busyLabel || 'Retrying…';
const el = this._ensureViewerStatusEl();
el.dataset.state = 'error';
el.innerHTML = `
<div class="viewer-status__card viewer-status__card--error" role="alert">
<div class="viewer-status__icon" aria-hidden="true">!</div>
<div class="viewer-status__label" data-label>${escHtml(label)}</div>
- ${onRetry ? '<button class="viewer-status__btn" type="button" data-retry>Retry</button>' : ''}
+ ${onAction ? `<button class="viewer-status__btn" type="button" data-retry>${escHtml(actionLabel)}</button>` : ''}
</div>
`;
el.hidden = false;
- if (onRetry) {
+ if (onAction) {
el.querySelector('[data-retry]')?.addEventListener('click', () => {
- this._showViewerLoading('Retrying…');
- Promise.resolve(onRetry()).catch(() => {});
+ if (opts.keepOpenUntilLoad) this._hideViewerStatus();
+ else this._showViewerLoading(busyLabel);
+ Promise.resolve(onAction()).catch(() => {});
});
}
}
diff --git a/src/ar-studio.js b/src/ar-studio.js
index a4394d782..99102930f 100644
--- a/src/ar-studio.js
+++ b/src/ar-studio.js
@@ -800,7 +800,17 @@ function updateRoomButton() {
if (!roomBtn) return;
const live = !!net && (net.status === 'online' || net.status === 'connecting');
roomBtn.classList.toggle('is-active', live);
- roomBtn.textContent = live ? `👥 ${roomCode || 'Room'}` : '👥 Share live';
+ // Two labels rather than one rewritten string: the idle one carries the page's
+ // data-i18n binding (rewriting the button's text would overwrite the
+ // translation with English), and the live one carries the room code, which
+ // stays visible at phone widths where the idle label is hidden.
+ const idleLabel = $('ars-room-label');
+ const codeLabel = $('ars-room-code-label');
+ if (idleLabel) idleLabel.hidden = live;
+ if (codeLabel) {
+ codeLabel.hidden = !live;
+ codeLabel.textContent = live ? roomCode || 'Room' : '';
+ }
// Keep the live modal panel in sync if it's open.
if (roomModal && !roomModal.hidden) renderRoomModal();
}
diff --git a/src/i18n.js b/src/i18n.js
index 85bf7ebc0..7304c94b3 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -388,8 +388,13 @@ function registerLangSwitcher() {
const root = this.attachShadow({ mode: 'open' });
root.innerHTML = `
<style>
- :host { display: inline-flex; }
- .wrap { position: relative; display: inline-flex; align-items: center; }
+ /* Shrinkable by default: the widest locale name makes this control
+ ~170px, which overflows a narrow header (a phone-width AR HUD, a
+ compact nav). A page that needs it smaller sets a max-width on the
+ host and the select follows instead of pushing its siblings off
+ screen. Unconstrained parents render exactly as before. */
+ :host { display: inline-flex; max-width: 100%; min-width: 0; }
+ .wrap { position: relative; display: inline-flex; align-items: center; max-width: 100%; min-width: 0; }
svg { position: absolute; left: 8px; width: 14px; height: 14px; opacity: .6; pointer-events: none; }
select {
appearance: none; -webkit-appearance: none;
@@ -399,6 +404,8 @@ function registerLangSwitcher() {
border: 1px solid var(--border, rgba(255,255,255,.12));
border-radius: 8px;
padding: 7px 26px 7px 28px;
+ max-width: 100%; min-width: 0;
+ text-overflow: ellipsis;
cursor: pointer;
transition: border-color .15s ease, background .15s ease, color .15s ease;
}