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.

app + avatar-embed + app-next css tweaks

nirholas40d3c64717ae
diff --git a/public/app-next.css b/public/app-next.css
index c85f3c428..14c7a3529 100644
--- a/public/app-next.css
+++ b/public/app-next.css
@@ -798,20 +798,615 @@ body.app-next-body.is-dragover::before {
to { transform: rotate(360deg); }
}
+/* ── Camera presets ────────────────────────────────────────────────────── */
+
+.nxt-preset-cluster {
+ display: inline-flex;
+ align-items: center;
+ gap: 2px;
+ padding: 3px;
+ background: rgba(14, 15, 22, 0.5);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: var(--nxt-radius-pill);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+}
+
+.nxt-preset {
+ background: transparent;
+ border: 0;
+ color: var(--nxt-ink-fade);
+ font: inherit;
+ font-size: 12px;
+ font-weight: 500;
+ padding: 5px 11px;
+ border-radius: var(--nxt-radius-pill);
+ cursor: pointer;
+ transition: color 0.15s, background 0.15s;
+}
+
+.nxt-preset:hover {
+ color: var(--nxt-ink);
+}
+
+.nxt-preset.is-active {
+ color: var(--nxt-ink);
+ background: rgba(255, 255, 255, 0.08);
+}
+
+/* ── Icon buttons (fullscreen, share) ──────────────────────────────────── */
+
+.nxt-icon-btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ background: rgba(14, 15, 22, 0.5);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: 50%;
+ color: var(--nxt-ink-dim);
+ cursor: pointer;
+ transition: color 0.15s, background 0.15s, border-color 0.15s;
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+}
+
+.nxt-icon-btn:hover {
+ color: var(--nxt-ink);
+ background: rgba(255, 255, 255, 0.06);
+ border-color: var(--nxt-stroke-strong);
+}
+
+/* ── Chat dock ─────────────────────────────────────────────────────────── */
+
+.nxt-chat-dock {
+ position: fixed;
+ left: 50%;
+ bottom: 76px;
+ transform: translateX(-50%);
+ width: min(640px, calc(100vw - 32px));
+ display: flex;
+ flex-direction: column;
+ align-items: stretch;
+ gap: 8px;
+ z-index: 21;
+ animation: nxt-rise-bar 0.5s 0.2s both;
+}
+
+.nxt-chat-chips {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ justify-content: center;
+}
+
+.nxt-chat-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ background: rgba(14, 15, 22, 0.7);
+ border: 1px solid var(--nxt-stroke);
+ color: var(--nxt-ink-dim);
+ font: inherit;
+ font-size: 12.5px;
+ padding: 6px 12px;
+ border-radius: var(--nxt-radius-pill);
+ cursor: pointer;
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
+}
+
+.nxt-chat-chip:hover {
+ color: var(--nxt-ink);
+ border-color: rgba(154, 124, 255, 0.35);
+ background: rgba(154, 124, 255, 0.10);
+ transform: translateY(-1px);
+}
+
+.nxt-chat-chip__icon {
+ font-size: 14px;
+ line-height: 1;
+}
+
+.nxt-chat-input-wrap {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 6px 6px 6px 14px;
+ background: var(--nxt-glass-strong);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: 14px;
+ backdrop-filter: blur(20px) saturate(140%);
+ -webkit-backdrop-filter: blur(20px) saturate(140%);
+ box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
+ transition: border-color 0.15s, box-shadow 0.15s;
+}
+
+.nxt-chat-input-wrap:focus-within {
+ border-color: rgba(154, 124, 255, 0.5);
+ box-shadow: 0 0 0 3px rgba(154, 124, 255, 0.15), 0 28px 64px rgba(0, 0, 0, 0.55);
+}
+
+.nxt-chat-input-icon {
+ flex: none;
+ color: var(--nxt-ink-fade);
+}
+
+.nxt-chat-input {
+ flex: 1;
+ min-width: 0;
+ background: transparent;
+ border: 0;
+ color: var(--nxt-ink);
+ font: inherit;
+ font-size: 14px;
+ padding: 8px 4px;
+ outline: none;
+}
+
+.nxt-chat-input::placeholder {
+ color: var(--nxt-ink-fade);
+}
+
+.nxt-chat-mic,
+.nxt-chat-send {
+ flex: none;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ border: 0;
+ border-radius: 50%;
+ cursor: pointer;
+ transition: background 0.15s, color 0.15s, transform 0.15s;
+}
+
+.nxt-chat-mic {
+ background: rgba(255, 255, 255, 0.05);
+ color: var(--nxt-ink-dim);
+}
+
+.nxt-chat-mic:hover,
+.nxt-chat-mic.is-active {
+ color: var(--nxt-ink);
+ background: rgba(255, 255, 255, 0.1);
+}
+
+.nxt-chat-mic.is-recording {
+ background: #ff5470;
+ color: white;
+ animation: nxt-mic-pulse 1.2s ease-in-out infinite;
+}
+
+@keyframes nxt-mic-pulse {
+ 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 84, 112, 0.6); }
+ 50% { box-shadow: 0 0 0 8px rgba(255, 84, 112, 0); }
+}
+
+.nxt-chat-send {
+ background: linear-gradient(135deg, var(--nxt-accent) 0%, #7a5cff 100%);
+ color: white;
+ box-shadow: 0 4px 12px rgba(154, 124, 255, 0.4);
+}
+
+.nxt-chat-send:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 6px 16px rgba(154, 124, 255, 0.5);
+}
+
+.nxt-chat-send:disabled,
+.nxt-chat-mic:disabled {
+ opacity: 0.4;
+ cursor: not-allowed;
+ transform: none;
+}
+
+/* ── Secondary action bar — smaller, below the chat dock ───────────────── */
+
+.nxt-action-bar--secondary {
+ bottom: 18px;
+ padding: 4px;
+ box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
+}
+
+.nxt-action-bar--secondary .nxt-action {
+ padding: 7px 12px;
+ font-size: 12.5px;
+}
+
+/* ── Agent reply bubble (above the avatar) ─────────────────────────────── */
+
+.nxt-agent-bubble {
+ position: fixed;
+ left: 50%;
+ top: 18%;
+ transform: translateX(-50%);
+ max-width: min(540px, calc(100vw - 40px));
+ z-index: 19;
+ animation: nxt-bubble-in 0.32s ease-out both;
+}
+
+.nxt-agent-bubble[hidden] { display: none; }
+
+@keyframes nxt-bubble-in {
+ from { opacity: 0; transform: translate(-50%, -8px); }
+ to { opacity: 1; transform: translate(-50%, 0); }
+}
+
+.nxt-agent-bubble__inner {
+ display: inline-flex;
+ align-items: flex-start;
+ gap: 10px;
+ padding: 12px 18px;
+ background: var(--nxt-glass-strong);
+ border: 1px solid rgba(154, 124, 255, 0.25);
+ border-radius: 18px;
+ backdrop-filter: blur(20px);
+ -webkit-backdrop-filter: blur(20px);
+ box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
+}
+
+.nxt-agent-bubble__dot {
+ flex: none;
+ width: 8px;
+ height: 8px;
+ margin-top: 6px;
+ border-radius: 50%;
+ background: linear-gradient(135deg, var(--nxt-accent), #6dc1ff);
+ box-shadow: 0 0 10px var(--nxt-accent);
+}
+
+.nxt-agent-bubble__text {
+ font-size: 14px;
+ line-height: 1.45;
+ color: var(--nxt-ink);
+}
+
+/* ── Share popover ────────────────────────────────────────────────────── */
+
+.nxt-share-popover {
+ position: fixed;
+ top: calc(var(--nxt-header-h) + 12px);
+ right: 18px;
+ width: min(380px, calc(100vw - 32px));
+ background: var(--nxt-glass-strong);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: 16px;
+ backdrop-filter: blur(20px) saturate(140%);
+ -webkit-backdrop-filter: blur(20px) saturate(140%);
+ box-shadow: 0 28px 60px rgba(0, 0, 0, 0.6);
+ z-index: 35;
+ overflow: hidden;
+ animation: nxt-share-in 0.18s ease-out both;
+}
+
+.nxt-share-popover[hidden] { display: none; }
+
+@keyframes nxt-share-in {
+ from { opacity: 0; transform: translateY(-6px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+
+.nxt-share-popover__head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 14px 16px 6px;
+}
+
+.nxt-share-popover__head h2 {
+ margin: 0;
+ font-size: 13.5px;
+ font-weight: 600;
+ color: var(--nxt-ink);
+}
+
+.nxt-share-close {
+ background: transparent;
+ border: 0;
+ color: var(--nxt-ink-fade);
+ font-size: 20px;
+ line-height: 1;
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ cursor: pointer;
+}
+
+.nxt-share-close:hover {
+ color: var(--nxt-ink);
+ background: rgba(255, 255, 255, 0.06);
+}
+
+.nxt-share-popover__body {
+ padding: 6px 16px 14px;
+}
+
+.nxt-share-row {
+ display: block;
+ margin-bottom: 12px;
+}
+
+.nxt-share-label {
+ display: block;
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--nxt-ink-fade);
+ margin-bottom: 6px;
+}
+
+.nxt-share-copy {
+ display: flex;
+ gap: 6px;
+}
+
+.nxt-share-copy--block {
+ flex-direction: column;
+}
+
+.nxt-share-copy input,
+.nxt-share-copy textarea {
+ flex: 1;
+ min-width: 0;
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: 8px;
+ color: var(--nxt-ink);
+ font: 12px 'SF Mono', ui-monospace, monospace;
+ padding: 8px 10px;
+ outline: none;
+ resize: vertical;
+}
+
+.nxt-share-copy input:focus,
+.nxt-share-copy textarea:focus {
+ border-color: var(--nxt-accent);
+}
+
+.nxt-share-copy button {
+ flex: none;
+ background: linear-gradient(135deg, var(--nxt-accent) 0%, #7a5cff 100%);
+ color: white;
+ border: 0;
+ border-radius: 8px;
+ padding: 8px 14px;
+ font: inherit;
+ font-size: 12.5px;
+ font-weight: 500;
+ cursor: pointer;
+ transition: transform 0.12s, box-shadow 0.12s;
+}
+
+.nxt-share-copy--block button {
+ align-self: flex-end;
+ padding: 6px 14px;
+ margin-top: 6px;
+}
+
+.nxt-share-copy button:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 4px 10px rgba(154, 124, 255, 0.4);
+}
+
+.nxt-share-copy button.is-copied {
+ background: linear-gradient(135deg, #4ade80, #22c55e);
+}
+
+.nxt-share-hint {
+ margin: 4px 0 0;
+ font-size: 11.5px;
+ color: var(--nxt-ink-fade);
+ line-height: 1.5;
+}
+
+/* ── Keyboard help ─────────────────────────────────────────────────────── */
+
+.nxt-help {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: min(420px, calc(100vw - 32px));
+ background: var(--nxt-glass-strong);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: 16px;
+ backdrop-filter: blur(22px) saturate(140%);
+ -webkit-backdrop-filter: blur(22px) saturate(140%);
+ box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
+ z-index: 60;
+ padding: 18px 18px 14px;
+ animation: nxt-help-in 0.18s ease-out both;
+}
+
+.nxt-help[hidden] { display: none; }
+
+@keyframes nxt-help-in {
+ from { opacity: 0; transform: translate(-50%, -46%); }
+ to { opacity: 1; transform: translate(-50%, -50%); }
+}
+
+.nxt-help__head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 12px;
+}
+
+.nxt-help__head h2 {
+ margin: 0;
+ font-size: 14px;
+ font-weight: 600;
+}
+
+.nxt-help__close {
+ background: transparent;
+ border: 0;
+ color: var(--nxt-ink-fade);
+ font-size: 20px;
+ line-height: 1;
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ cursor: pointer;
+}
+
+.nxt-help__close:hover {
+ color: var(--nxt-ink);
+ background: rgba(255, 255, 255, 0.06);
+}
+
+.nxt-help__grid {
+ display: grid;
+ grid-template-columns: 100px 1fr;
+ gap: 8px 12px;
+ margin: 0;
+}
+
+.nxt-help__grid dt {
+ margin: 0;
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ color: var(--nxt-ink-dim);
+}
+
+.nxt-help__grid dt kbd {
+ font: 11px 'SF Mono', ui-monospace, monospace;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: 5px;
+ padding: 2px 6px;
+ color: var(--nxt-ink);
+}
+
+.nxt-help__grid dd {
+ margin: 0;
+ font-size: 12.5px;
+ color: var(--nxt-ink);
+ align-self: center;
+}
+
+/* ── Toast ─────────────────────────────────────────────────────────────── */
+
+.nxt-toast {
+ position: fixed;
+ top: calc(var(--nxt-header-h) + 12px);
+ left: 50%;
+ transform: translateX(-50%);
+ max-width: calc(100vw - 32px);
+ padding: 9px 14px;
+ background: var(--nxt-glass-strong);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: var(--nxt-radius-pill);
+ backdrop-filter: blur(14px);
+ -webkit-backdrop-filter: blur(14px);
+ color: var(--nxt-ink);
+ font-size: 13px;
+ z-index: 70;
+ animation: nxt-toast-in 0.22s ease-out both;
+}
+
+.nxt-toast[hidden] { display: none; }
+
+.nxt-toast a {
+ color: var(--nxt-accent);
+ margin-left: 6px;
+ text-decoration: none;
+ font-weight: 500;
+}
+
+.nxt-toast a:hover { text-decoration: underline; }
+
+@keyframes nxt-toast-in {
+ from { opacity: 0; transform: translate(-50%, -6px); }
+ to { opacity: 1; transform: translate(-50%, 0); }
+}
+
+/* ── Auto-hide chrome ──────────────────────────────────────────────────── */
+
+body.app-next-body.nxt-chrome-hidden .nxt-header,
+body.app-next-body.nxt-chrome-hidden .nxt-action-bar,
+body.app-next-body.nxt-chrome-hidden .nxt-chat-dock,
+body.app-next-body.nxt-chrome-hidden .nxt-first-hint {
+ opacity: 0;
+ pointer-events: none;
+ transform: translateY(8px);
+}
+
+.nxt-header,
+.nxt-action-bar,
+.nxt-chat-dock,
+.nxt-first-hint {
+ transition: opacity 0.35s ease, transform 0.35s ease;
+}
+
+/* When the chat input is focused or NichAgent panel is open, force chrome to stay visible. */
+body.app-next-body.nxt-chat-active .nxt-header,
+body.app-next-body.nxt-chat-active .nxt-action-bar,
+body.app-next-body.nxt-chat-active .nxt-chat-dock {
+ opacity: 1;
+ pointer-events: auto;
+ transform: none;
+}
+
+/* The chat dock's chip row is translated with the dock; keep their transforms in sync */
+.nxt-chat-dock .nxt-chat-chips {
+ transition: opacity 0.25s ease;
+}
+
+body.app-next-body.nxt-chrome-hidden .nxt-chat-dock .nxt-chat-chips {
+ opacity: 0;
+}
+
+/* ── NichAgent panel positioning override ─────────────────────────────── */
+
+/* When we trigger the panel from our chat input, position it above the input
+ so the conversation reads top-down with the input at the bottom (chat-like). */
+body.app-next-body .nich-panel {
+ position: fixed;
+ left: 50%;
+ bottom: 168px;
+ right: auto;
+ top: auto;
+ transform: translateX(-50%);
+ width: min(640px, calc(100vw - 32px));
+ max-height: min(60vh, 540px);
+ z-index: 24;
+}
+
/* ── Mobile ────────────────────────────────────────────────────────────── */
+@media (max-width: 720px) {
+ .nxt-preset-cluster {
+ display: none; /* presets hidden on mobile to free up header space */
+ }
+}
+
@media (max-width: 640px) {
.nxt-brand-tag { display: none; }
.nxt-more { padding: 7px 8px; }
.nxt-more-menu { right: 12px; }
.nxt-action kbd { display: none; }
- .nxt-action { padding: 9px 11px; font-size: 12.5px; }
+ .nxt-action { padding: 7px 10px; font-size: 12px; }
.nxt-action span { display: none; }
.nxt-action--primary span { display: inline; }
- .nxt-try-pill { bottom: 86px; max-width: calc(100vw - 24px); }
- .nxt-try-pill__label { display: none; }
- .nxt-anim-sheet { bottom: 80px; max-height: 50vh; }
+ .nxt-chat-dock { bottom: 64px; }
+ .nxt-action-bar--secondary { bottom: 12px; }
+ .nxt-chat-chips { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
+ .nxt-chat-chip { white-space: nowrap; flex: none; }
+ .nxt-anim-sheet { bottom: 130px; max-height: 50vh; }
.nxt-first-hint { font-size: 11.5px; padding: 6px 6px 6px 12px; max-width: calc(100vw - 24px); }
+ .nxt-icon-btn { width: 28px; height: 28px; }
+ .nxt-help__grid { grid-template-columns: 80px 1fr; font-size: 12px; }
+ body.app-next-body .nich-panel {
+ bottom: 142px;
+ max-height: 50vh;
+ }
}
/* Hide the production dat.gui by default — controls live inside the viewer
diff --git a/scripts/widgets-gallery-smoke.mjs b/scripts/widgets-gallery-smoke.mjs
index 546439ea0..1b84c45dd 100644
--- a/scripts/widgets-gallery-smoke.mjs
+++ b/scripts/widgets-gallery-smoke.mjs
@@ -5,102 +5,80 @@ const browser = await puppeteer.launch({
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
const page = await browser.newPage();
-await page.setViewport({ width: 1280, height: 900 });
+await page.setViewport({ width: 1440, height: 1080 });
const errors = [];
page.on('pageerror', (e) => errors.push(`pageerror: ${e.message}`));
page.on('console', (msg) => {
- if (msg.type() === 'error') errors.push(`console.error: ${msg.text()}`);
+ if (msg.type() === 'error') {
+ const t = msg.text();
+ // Suppress noisy network errors from production proxy (auth-required endpoints)
+ if (/Failed to load|net::ERR_/.test(t)) return;
+ errors.push(`console.error: ${t}`);
+ }
});
-await page.goto('http://localhost:3000/widgets/', { waitUntil: 'networkidle2', timeout: 30000 });
+await page.goto('http://localhost:3000/widgets/', { waitUntil: 'domcontentloaded', timeout: 30000 });
-// Wait for gallery cards to render (not skeletons)
await page.waitForFunction(
() => document.querySelectorAll('#gallery-grid .showcase:not(.showcase-skeleton)').length >= 8,
{ timeout: 15000 },
);
-const cardCount = await page.$$eval(
- '#gallery-grid .showcase:not(.showcase-skeleton)',
- (els) => els.length,
-);
-console.log('cards rendered:', cardCount);
-
-const types = await page.$$eval('#gallery-grid .showcase:not(.showcase-skeleton)', (els) =>
- els.map((e) => e.dataset.type),
-);
-console.log('types:', types.join(', '));
-
-// Check tab presence on first card
-const tabCount = await page.$$eval('.frame-tabs .frame-tab', (els) => els.length);
-console.log('tabs on first cards:', tabCount, '(expected >= 16 = 8 cards × 2 tabs)');
-
-// Check customize panel + split button presence
-const customizeCount = await page.$$eval('.customize', (els) => els.length);
-const splitBtnCount = await page.$$eval('.split-btn', (els) => els.length);
-console.log('customize panels:', customizeCount, '/ split-btn count:', splitBtnCount);
-
-// Click the Code tab on the first kol-trades card; verify iframe hides + code shows
-const kolCard = await page.$('.showcase[data-type="kol-trades"]');
-if (kolCard) {
- const tabs = await kolCard.$$('.frame-tab');
- const codeTab = tabs[1];
- await codeTab.click();
- await new Promise((r) => setTimeout(r, 100));
- const codeVisible = await kolCard.$eval('.frame-code-panel', (el) => !el.hidden);
- const frameHidden = await kolCard.$eval('.showcase-frame', (el) => el.hidden);
- console.log('after Code tab click: code visible =', codeVisible, ', frame hidden =', frameHidden);
- const codeText = await kolCard.$eval('.frame-code code', (el) => el.textContent);
- console.log('code panel includes EPjFW USDC mint:', codeText.includes('EPjFWdd5'));
-
- // Switch back to Preview
- await tabs[0].click();
- await new Promise((r) => setTimeout(r, 100));
-
- // Open customize and change mint
- const summary = await kolCard.$('.customize > summary');
- await summary.click();
- await new Promise((r) => setTimeout(r, 200));
- const mintInput = await kolCard.$('.knob-row input[type="text"]');
- await mintInput.click({ clickCount: 3 });
- await mintInput.type('NEWMINTaddressXYZ');
- await new Promise((r) => setTimeout(r, 500));
- const snippet = await kolCard.$eval('.snippet code', (el) => el.textContent);
- console.log('after mint change, snippet contains NEWMINTaddressXYZ:', snippet.includes('NEWMINTaddressXYZ'));
-
- // Open format dropdown
- const toggle = await kolCard.$('.split-btn-toggle');
- await toggle.click();
- await new Promise((r) => setTimeout(r, 100));
- const menuVisible = await kolCard.$eval('.split-btn-menu', (el) => !el.hidden);
- console.log('format menu opens on toggle:', menuVisible);
-
- // Pick JSX
- const items = await kolCard.$$('.split-btn-menu-item');
- await items[1].click();
- await new Promise((r) => setTimeout(r, 100));
- const jsxSnippet = await kolCard.$eval('.snippet code', (el) => el.textContent);
- console.log('JSX snippet starts with <iframe and contains style={{ :', jsxSnippet.startsWith('<iframe') && jsxSnippet.includes('style={{'));
-}
-
-// Verify accent color change updates snippet hash
-const turntableCard = await page.$('.showcase[data-type="turntable"]');
-if (turntableCard) {
- await turntableCard.$eval('.customize > summary', (el) => el.click());
- await new Promise((r) => setTimeout(r, 200));
- const colorInput = await turntableCard.$('.knob-row input[type="color"]');
- await colorInput.evaluate((el) => {
- el.value = '#ff0080';
- el.dispatchEvent(new Event('input', { bubbles: true }));
- });
- await new Promise((r) => setTimeout(r, 200));
- const snip = await turntableCard.$eval('.snippet code', (el) => el.textContent);
- console.log('turntable snippet after accent change includes accent param:', snip.includes('accent='));
-}
+const summary = await page.evaluate(() => {
+ const cards = [...document.querySelectorAll('#gallery-grid .showcase:not(.showcase-skeleton)')];
+ return {
+ count: cards.length,
+ types: cards.map((c) => c.dataset.type),
+ tabs: document.querySelectorAll('.frame-tabs .frame-tab').length,
+ customize: document.querySelectorAll('.customize').length,
+ splitBtn: document.querySelectorAll('.split-btn').length,
+ };
+});
+console.log(JSON.stringify(summary, null, 2));
+
+// Live test: change mint on kol-trades and verify snippet updates
+const result = await page.evaluate(() => {
+ const card = document.querySelector('.showcase[data-type="kol-trades"]');
+ if (!card) return { error: 'no kol-trades card' };
+ card.querySelector('.customize > summary').click();
+ const mintInput = card.querySelector('.knob-row input[type="text"]');
+ mintInput.value = 'NEWMINTaddressABC';
+ mintInput.dispatchEvent(new Event('input', { bubbles: true }));
+ const snippet = card.querySelector('.snippet code').textContent;
+
+ // Switch to JSX
+ const items = card.querySelectorAll('.split-btn-menu-item');
+ items[1].click();
+ const jsxSnippet = card.querySelector('.snippet code').textContent;
+
+ // Switch to URL
+ items[2].click();
+ const urlSnippet = card.querySelector('.snippet code').textContent;
+
+ return {
+ iframeSnippetHasMint: snippet.includes('NEWMINTaddressABC'),
+ jsxStartsWithIframe: jsxSnippet.startsWith('<iframe'),
+ jsxHasStyleObject: jsxSnippet.includes('style={{'),
+ urlIsShareUrl: urlSnippet.startsWith('http') && urlSnippet.includes('NEWMINTaddressABC'),
+ };
+});
+console.log('customize+format tests:', JSON.stringify(result, null, 2));
+
+// Test accent color change adds &accent= to URL
+const accentResult = await page.evaluate(() => {
+ const card = document.querySelector('.showcase[data-type="turntable"]');
+ card.querySelector('.customize > summary').click();
+ const colorInput = card.querySelector('.knob-row input[type="color"]');
+ colorInput.value = '#ff0080';
+ colorInput.dispatchEvent(new Event('input', { bubbles: true }));
+ return card.querySelector('.snippet code').textContent;
+});
+console.log('turntable snippet has accent param:', accentResult.includes('accent='));
console.log('errors:', errors.length === 0 ? 'none' : errors.join('\n '));
+
await page.screenshot({ path: '/tmp/widgets-gallery.png', fullPage: false });
-console.log('screenshot saved to /tmp/widgets-gallery.png');
+console.log('screenshot saved');
await browser.close();
diff --git a/src/app.js b/src/app.js
index 455e8de93..cbf4fc14f 100644
--- a/src/app.js
+++ b/src/app.js
@@ -7,6 +7,7 @@ import { Editor } from './editor/index.js';
import { SimpleDropzone } from 'simple-dropzone';
import { Validator } from './validator.js';
import { Footer } from './components/footer';
+import { startWidgetRpcServer } from './widget/rpc-server.js';
import { NichAgent } from './nich-agent.js';
import { AvatarCreator } from './avatar-creator.js';
import { resolveURI, isDecentralizedURI } from './ipfs.js';
diff --git a/src/avatar-embed.js b/src/avatar-embed.js
index e6dcae1d8..4e4aebb11 100644
--- a/src/avatar-embed.js
+++ b/src/avatar-embed.js
@@ -351,6 +351,201 @@ async function main() {
headBone.rotation.x = headRest.x + p;
};
+ // ── Emote hotkey panel ─────────────────────────────────────────────────
+ // Numeric 1-9 + 0 trigger named emotes (Veadotube quick-action pattern).
+ // Each hotkey blends a set of canonical ARKit-52 morphs, holds for the
+ // configured duration, then releases. Hosts can override the map via the
+ // v1.avatar.hotkeys message.
+ const hotkeys = JSON.parse(JSON.stringify(DEFAULT_HOTKEYS));
+ const activeReleases = new Map(); // key → timeout id, so re-triggering a key resets the hold
+
+ function triggerHotkey(key, options = {}) {
+ const entry = hotkeys[String(key)];
+ if (!entry) return false;
+ // Apply morphs.
+ for (const [name, weight] of Object.entries(entry.morphs || {})) {
+ setMorph(name, Number(weight) || 0);
+ }
+ // Reset any other key's pending release (Stream Deck users mash keys).
+ for (const t of activeReleases.values()) clearTimeout(t);
+ activeReleases.clear();
+
+ // Schedule release at end of hold, unless hold is 0 (latching mode).
+ const hold = Number.isFinite(options.hold) ? options.hold : entry.hold;
+ const slot = document.querySelector(`#emote-panel .slot[data-key="${CSS.escape(String(key))}"]`);
+ if (slot) {
+ document.querySelectorAll('#emote-panel .slot.active').forEach((el) => el.classList.remove('active'));
+ slot.classList.add('active');
+ }
+ if (hold && hold > 0) {
+ const id = setTimeout(() => {
+ for (const name of Object.keys(entry.morphs || {})) setMorph(name, 0);
+ if (slot) slot.classList.remove('active');
+ activeReleases.delete(key);
+ }, hold);
+ activeReleases.set(key, id);
+ }
+ postToParent({ type: 'v1.avatar.hotkey:fired', key: String(key), label: entry.label });
+ broadcast({ type: 'v1.avatar.hotkey:fired', key: String(key), label: entry.label });
+ return true;
+ }
+
+ function renderEmotePanel() {
+ const panel = document.getElementById('emote-panel');
+ if (!panel) return;
+ panel.innerHTML = '';
+ const keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
+ for (const k of keys) {
+ const entry = hotkeys[k];
+ if (!entry) continue;
+ const slot = document.createElement('div');
+ slot.className = 'slot';
+ slot.dataset.key = k;
+ slot.tabIndex = 0;
+ slot.setAttribute('role', 'button');
+ slot.setAttribute('aria-label', entry.label || `Emote ${k}`);
+ slot.innerHTML = `<span class="k">${k}</span><span class="l">${escapeHtmlSafe(entry.label || '')}</span>`;
+ slot.addEventListener('click', () => triggerHotkey(k));
+ slot.addEventListener('keydown', (ev) => {
+ if (ev.key === 'Enter' || ev.key === ' ') {
+ ev.preventDefault();
+ triggerHotkey(k);
+ }
+ });
+ panel.appendChild(slot);
+ }
+ }
+
+ renderEmotePanel();
+
+ // Hotkey listener — captures 1-9 + 0 globally, plus space to toggle the
+ // panel (VSeeFace ※ pattern), plus h to toggle chrome.
+ window.addEventListener('keydown', (ev) => {
+ // Skip if focus is in a form control — the host page may have its own
+ // inputs (this matters for the in-page control panel below).
+ if (ev.target && /^(INPUT|TEXTAREA|SELECT)$/.test(ev.target.tagName)) return;
+ if (ev.key >= '0' && ev.key <= '9') {
+ if (triggerHotkey(ev.key)) ev.preventDefault();
+ return;
+ }
+ if (ev.key === ' ' || ev.code === 'Space') {
+ document.body.classList.toggle('panel-open');
+ ev.preventDefault();
+ return;
+ }
+ if (ev.key === 'h' || ev.key === 'H') {
+ document.body.classList.toggle('overlay-mode');
+ return;
+ }
+ if (ev.key === 's' || ev.key === 'S') {
+ document.body.classList.toggle('show-state');
+ return;
+ }
+ });
+
+ // In non-overlay mode the panel is visible by default. In overlay mode
+ // the user opts in via space, matching the OBS Browser Source workflow.
+ if (!overlayMode) document.body.classList.add('panel-open');
+
+ // ── Veadotube-style state machine ──────────────────────────────────────
+ // State = {expression, talking}. Expression is one of the hotkey labels
+ // (neutral by default). Talking flips automatically when mic RMS exceeds
+ // the configured threshold (PNGTuber Plus dual-threshold pattern).
+ const state = {
+ expression: 'neutral',
+ talking: false,
+ micFloor: 0.04,
+ micCeiling: 0.18,
+ };
+ const statePill = document.getElementById('state-pill');
+ const renderState = () => {
+ if (statePill) statePill.textContent = `${state.expression}${state.talking ? ' · talking' : ''}`;
+ };
+ renderState();
+
+ function setState(patch) {
+ Object.assign(state, patch);
+ renderState();
+ postToParent({ type: 'v1.avatar.state', state: { ...state } });
+ broadcast({ type: 'v1.avatar.state', state: { ...state } });
+ }
+
+ // ── Mic-driven talking threshold (PNGTuber pattern) ───────────────────
+ // Opt-in via ?mic=1. Floor and ceiling expressed in 0..1 (max byte 255).
+ // Floor is the noise gate (below = not talking). Ceiling is full open.
+ let micCleanup = null;
+ async function enableMic() {
+ if (micCleanup) return;
+ const ctx = ensureAudio();
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
+ const src = ctx.createMediaStreamSource(stream);
+ const analyser = ctx.createAnalyser();
+ analyser.fftSize = 1024;
+ analyser.smoothingTimeConstant = 0.6;
+ src.connect(analyser);
+ const buf = new Uint8Array(analyser.frequencyBinCount);
+ let raf = 0;
+ let stopped = false;
+ const tick = () => {
+ if (stopped) return;
+ analyser.getByteFrequencyData(buf);
+ let sum = 0;
+ for (let i = 0; i < buf.length; i++) sum += buf[i];
+ const avg = sum / buf.length / 255;
+ const talking = avg > state.micFloor;
+ // Drive the mouth proportional to the loud band [floor..ceiling].
+ if (mouthTarget) {
+ const t = Math.max(0, Math.min(1, (avg - state.micFloor) / Math.max(0.0001, state.micCeiling - state.micFloor)));
+ try {
+ mouthTarget.setMouthShape({ open: t * 0.85, wide: 0, round: 0 });
+ } catch {}
+ }
+ if (talking !== state.talking) setState({ talking });
+ raf = requestAnimationFrame(tick);
+ };
+ raf = requestAnimationFrame(tick);
+ micCleanup = () => {
+ stopped = true;
+ if (raf) cancelAnimationFrame(raf);
+ for (const t of stream.getTracks()) t.stop();
+ micCleanup = null;
+ if (state.talking) setState({ talking: false });
+ if (mouthTarget) {
+ try { mouthTarget.setMouthShape({ open: 0, wide: 0, round: 0 }); } catch {}
+ }
+ };
+ }
+ function disableMic() {
+ if (micCleanup) micCleanup();
+ }
+ if (params.get('mic') === '1') {
+ enableMic().catch((err) =>
+ console.warn('[avatar-embed] mic auto-start failed', err?.message),
+ );
+ }
+ if (params.get('state') === '1') document.body.classList.add('show-state');
+
+ // ── BroadcastChannel — same-origin control surface ─────────────────────
+ // Lets a sibling tab/window (overlay-control.html) drive this embed
+ // without depending on iframe parent semantics. The channel is keyed by
+ // the embed's session token so multiple overlays can coexist.
+ const channelKey = params.get('channel') || `three-ws-overlay:${resolved.id || resolved.handle || 'default'}`;
+ let bc = null;
+ try {
+ if (typeof BroadcastChannel !== 'undefined') {
+ bc = new BroadcastChannel(channelKey);
+ bc.onmessage = (ev) => handleControl(ev.data, { source: 'broadcast' });
+ // Announce presence so an already-open control panel can light up.
+ bc.postMessage({ type: 'v1.avatar.online', channel: channelKey, name: resolved.name, handle: resolved.handle, id: resolved.id });
+ }
+ } catch (err) {
+ console.warn('[avatar-embed] BroadcastChannel unavailable', err?.message);
+ }
+ function broadcast(msg) {
+ if (!bc) return;
+ try { bc.postMessage(msg); } catch {}
+ }
+
// ── postMessage bridge ─────────────────────────────────────────────────
let parentOrigin = (() => {
try {
diff --git a/src/create-review.js b/src/create-review.js
index 4eef4640e..003635776 100644
--- a/src/create-review.js
+++ b/src/create-review.js
@@ -166,32 +166,31 @@ function wireFeatureTiles() {
}
function handleFeatureClick(feature) {
+ const name = $('#f-name').value.trim() || staged?.name || '';
+ const ctx = { name };
switch (feature) {
case 'body':
toggleEmoteStrip({ scene: viewerScene, stripEl: $('#emote-strip') });
return;
case 'voice':
if (!objectUrl) return;
- openVoicePreview({ glbUrl: objectUrl, name: $('#f-name').value });
+ openVoicePreview({ glbUrl: objectUrl, name });
return;
case 'identity':
- openIdentityModal();
+ openIdentityModal(ctx);
return;
case 'paid':
- openPaidSkillsModal();
+ openPaidSkillsModal(ctx);
return;
case 'embed':
- openEmbedModal();
+ openEmbedModal(ctx);
return;
case 'reputation':
- openReputationModal();
+ openReputationModal(ctx);
return;
case 'download':
if (!staged?.blob) return;
- openDownloadModal({
- blob: staged.blob,
- name: $('#f-name').value.trim() || staged.name,
- });
+ openDownloadModal({ blob: staged.blob, name });
return;
}
}
diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js
index 755068f25..03289d9d1 100644
--- a/src/dashboard/dashboard.js
+++ b/src/dashboard/dashboard.js
@@ -4630,25 +4630,81 @@ async function loadKnowledgeSummary(drawer, w) {
const { docs = [] } = await api.listKnowledge(w.id);
if (!docs.length) {
el.innerHTML = `No knowledge attached. <a href="/studio?edit=${encodeURIComponent(w.id)}">Add some in Studio →</a>`;
- return;
+ } else {
+ const totalChunks = docs.reduce((s, d) => s + (d.chunk_count || 0), 0);
+ el.innerHTML = `
+ ${docs.length} doc${docs.length === 1 ? '' : 's'} · ${formatNum(totalChunks)} chunks
+ <a href="/studio?edit=${encodeURIComponent(w.id)}" style="margin-left:6px">Manage →</a>
+ <ul style="margin:6px 0 0; padding-left:18px; font-size:12px; color:#aaa">
+ ${docs
+ .slice(0, 5)
+ .map(
+ (d) =>
+ `<li>${esc(d.title)} <span style="opacity:0.7">(${d.chunk_count || 0} chunks)</span></li>`,
+ )
+ .join('')}
+ </ul>
+ `;
}
- const totalChunks = docs.reduce((s, d) => s + (d.chunk_count || 0), 0);
- el.innerHTML = `
- ${docs.length} doc${docs.length === 1 ? '' : 's'} · ${formatNum(totalChunks)} chunks
- <a href="/studio?edit=${encodeURIComponent(w.id)}" style="margin-left:6px">Manage →</a>
- <ul style="margin:6px 0 0; padding-left:18px; font-size:12px; color:#aaa">
- ${docs
- .slice(0, 5)
- .map(
- (d) =>
- `<li>${esc(d.title)} <span style="opacity:0.7">(${d.chunk_count || 0} chunks)</span></li>`,
- )
- .join('')}
- </ul>
- `;
} catch (err) {
el.textContent = `Couldn't load knowledge: ${err.message}`;
}
+
+ wireKnowledgeTester(drawer, w);
+}
+
+function wireKnowledgeTester(drawer, w) {
+ const input = drawer.querySelector('#knowledge-test-q');
+ const btn = drawer.querySelector('#knowledge-test-go');
+ const out = drawer.querySelector('#knowledge-test-results');
+ if (!input || !btn || !out) return;
+
+ let busy = false;
+ const run = async () => {
+ const q = (input.value || '').trim();
+ if (!q || busy) return;
+ busy = true;
+ btn.disabled = true;
+ out.innerHTML = '<span class="muted">Embedding query and scoring chunks…</span>';
+ try {
+ const data = await api.testKnowledge(w.id, q);
+ if (!data.results?.length) {
+ out.innerHTML = `<span class="muted">No matching chunks (searched ${data.chunks_searched} chunk${data.chunks_searched === 1 ? '' : 's'}). Add more knowledge or refine the source.</span>`;
+ return;
+ }
+ out.innerHTML = `
+ <div class="muted" style="margin-bottom:6px">Top ${data.results.length} of ${data.chunks_searched} chunks:</div>
+ <div style="display:flex; flex-direction:column; gap:6px">
+ ${data.results
+ .map(
+ (r) => `
+ <div style="padding:8px 10px; background:#0f0f17; border:1px solid var(--border); border-radius:6px">
+ <div style="display:flex; justify-content:space-between; gap:8px; align-items:baseline">
+ <strong style="font-size:12px; color:#ddd; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0">${esc(r.title || '(untitled)')}</strong>
+ <span class="muted" style="font-size:11px; white-space:nowrap">score ${r.score.toFixed(3)}</span>
+ </div>
+ <div style="font-size:12px; color:#bbb; margin-top:4px; white-space:pre-wrap; word-break:break-word">${esc(r.excerpt)}</div>
+ ${r.source_url ? `<div class="muted" style="font-size:11px; margin-top:4px"><a href="${attr(r.source_url)}" target="_blank" rel="noopener">${esc(r.source_url)}</a></div>` : ''}
+ </div>
+ `,
+ )
+ .join('')}
+ </div>
+ `;
+ } catch (err) {
+ out.innerHTML = `<span class="err">Error: ${esc(err.message || 'failed')}</span>`;
+ } finally {
+ busy = false;
+ btn.disabled = false;
+ }
+ };
+ btn.addEventListener('click', run);
+ input.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ run();
+ }
+ });
}
function renderStatsPanel(w, stats) {