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: build TripoSR CUDA extension on devel base + scope Cloud Build uploads via .gcloudignore; app-next UI updates

nirholasb99a0e622fb3
diff --git a/.gcloudignore b/.gcloudignore
new file mode 100644
index 000000000..a3854e5eb
--- /dev/null
+++ b/.gcloudignore
@@ -0,0 +1,3 @@
+/*
+!/workers/
+!/.gcloudignore
diff --git a/pages/app-next.html b/pages/app-next.html
index d3b2cd541..c0fe3ae10 100644
--- a/pages/app-next.html
+++ b/pages/app-next.html
@@ -242,6 +242,10 @@
</div>
</aside>
+ <!-- Switchable scene backdrop — bottommost layer behind the transparent canvas.
+ Painted by app-next-overlay.js (saved preset, picker, or agent chat). -->
+ <div class="nxt-stage-backdrop" id="nxt-stage-backdrop" aria-hidden="true"></div>
+
<!-- The 3D viewer (required by app.js) -->
<div class="viewer-container nxt-viewer" id="viewer-container"></div>
@@ -377,6 +381,43 @@
<kbd>A</kbd>
</button>
+ <button
+ class="nxt-action nxt-action--ghost"
+ id="nxt-avatar-btn"
+ type="button"
+ title="Switch avatar from the gallery"
+ >
+ <svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true">
+ <circle cx="10" cy="7" r="3.2" stroke="currentColor" stroke-width="1.5" fill="none" />
+ <path d="M4.5 16c.8-3 3-4.5 5.5-4.5s4.7 1.5 5.5 4.5" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" />
+ </svg>
+ <span>Avatar</span>
+ </button>
+
+ <div class="nxt-backdrop-wrap">
+ <button
+ class="nxt-action nxt-action--ghost"
+ id="nxt-backdrop-btn"
+ type="button"
+ aria-haspopup="true"
+ aria-expanded="false"
+ aria-controls="nxt-backdrop-popover"
+ title="Change the scene backdrop"
+ >
+ <svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true">
+ <rect x="3" y="4" width="14" height="12" rx="2" stroke="currentColor" stroke-width="1.5" fill="none" />
+ <circle cx="7.5" cy="8" r="1.4" fill="currentColor" />
+ <path d="M4 14l3.5-3.5L11 14l2.5-2.5L16 14" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round" />
+ </svg>
+ <span>Backdrop</span>
+ </button>
+
+ <div class="nxt-backdrop-popover" id="nxt-backdrop-popover" role="menu" aria-label="Scene backdrops" hidden>
+ <div class="nxt-backdrop-popover__head">Backdrop</div>
+ <div class="nxt-backdrop-grid" id="nxt-backdrop-grid"></div>
+ </div>
+ </div>
+
<label class="nxt-action nxt-action--ghost" for="file-input" title="Drop or pick a GLB/glTF (U)">
<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true">
<path d="M10 3v9m-4-4l4-4 4 4M4 15h12" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round" />
diff --git a/public/app-next.css b/public/app-next.css
index 76dc94138..d345ff395 100644
--- a/public/app-next.css
+++ b/public/app-next.css
@@ -545,6 +545,117 @@ body.app-next-body {
.nxt-hidden-hosts { display: none !important; }
+/* ── Scene backdrop (switchable) ───────────────────────────────────────────
+ Bottommost stage layer behind the transparent avatar canvas. Painted by
+ app-next-overlay.js from a saved preset, the Backdrop picker, or agent chat
+ (setBgColor → nxt:backdrop). Sits below the floor glow + vignette so those
+ keep reading on top of whatever scene is chosen. */
+.nxt-stage-backdrop {
+ position: absolute;
+ inset: 0;
+ z-index: 1;
+ pointer-events: none;
+ background: radial-gradient(circle at 50% 28%, #2b2b33 0%, #111116 72%);
+ transition: background 0.45s ease;
+}
+
+/* ── Avatar switch button (loading state) ──────────────────────────────── */
+.nxt-action.is-loading {
+ opacity: 0.6;
+ pointer-events: none;
+}
+
+/* ── Backdrop picker ───────────────────────────────────────────────────── */
+.nxt-backdrop-wrap {
+ position: relative;
+ display: inline-flex;
+}
+
+.nxt-backdrop-popover {
+ position: absolute;
+ bottom: calc(100% + 10px);
+ left: 50%;
+ transform: translateX(-50%);
+ width: 248px;
+ padding: 12px;
+ background: var(--nxt-glass-strong);
+ border: 1px solid var(--nxt-stroke);
+ border-radius: var(--nxt-radius);
+ backdrop-filter: blur(20px) saturate(140%);
+ -webkit-backdrop-filter: blur(20px) saturate(140%);
+ box-shadow: 0 24px 54px rgba(0, 0, 0, 0.6);
+ z-index: 36;
+ animation: nxt-backdrop-in 0.16s ease-out both;
+}
+
+.nxt-backdrop-popover[hidden] { display: none; }
+
+@keyframes nxt-backdrop-in {
+ from { opacity: 0; transform: translate(-50%, 6px); }
+ to { opacity: 1; transform: translate(-50%, 0); }
+}
+
+.nxt-backdrop-popover__head {
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--nxt-ink-fade);
+ margin: 0 2px 10px;
+}
+
+.nxt-backdrop-grid {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 8px;
+}
+
+.nxt-backdrop-swatch {
+ position: relative;
+ aspect-ratio: 1 / 1;
+ border: 1px solid var(--nxt-stroke);
+ border-radius: var(--nxt-radius-sm);
+ cursor: pointer;
+ padding: 0;
+ overflow: hidden;
+ transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
+}
+
+.nxt-backdrop-swatch:hover {
+ transform: translateY(-1px);
+ border-color: rgba(255, 255, 255, 0.28);
+ box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
+}
+
+.nxt-backdrop-swatch.is-active {
+ border-color: var(--nxt-ink);
+ box-shadow: 0 0 0 2px var(--nxt-ink) inset;
+}
+
+.nxt-backdrop-swatch__label {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ padding: 3px 5px;
+ font-size: 10px;
+ font-weight: 600;
+ letter-spacing: 0.02em;
+ color: #fff;
+ background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
+ text-align: left;
+}
+
+.nxt-backdrop-swatch.is-light .nxt-backdrop-swatch__label {
+ color: #1a1a1a;
+ background: linear-gradient(to top, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
+}
+
+.nxt-backdrop-swatch:focus-visible {
+ outline: 2px solid var(--nxt-ink);
+ outline-offset: 2px;
+}
+
/* ── Animation picker sheet ────────────────────────────────────────────── */
.nxt-anim-sheet {
diff --git a/workers/model-triposr/Dockerfile b/workers/model-triposr/Dockerfile
index dbeb79e4f..4f81cffec 100644
--- a/workers/model-triposr/Dockerfile
+++ b/workers/model-triposr/Dockerfile
@@ -1,20 +1,31 @@
-FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
+FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
+# devel (not runtime) base: TripoSR pulls torchmcubes, which compiles a CUDA
+# extension at install time and needs nvcc. TORCH_CUDA_ARCH_LIST targets the
+# Cloud Run L4 (compute capability 8.9) so the kernels build for it.
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
- DEBIAN_FRONTEND=noninteractive
+ DEBIAN_FRONTEND=noninteractive \
+ TORCH_CUDA_ARCH_LIST="8.9+PTX" \
+ PYTHONPATH=/opt/triposr
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 python3.10-dev python3-pip \
- git curl wget \
+ git curl wget build-essential ninja-build \
libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3.10 /usr/bin/python3 \
&& ln -sf /usr/bin/python3.10 /usr/bin/python \
&& pip install --upgrade pip setuptools wheel
-RUN pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cu121
+# torch first (cached layer), matching the CUDA 12.1 base.
+RUN pip install torch==2.3.1 torchvision==0.18.1 --index-url https://download.pytorch.org/whl/cu121
+
+# TripoSR is not a pip package (no setup.py/pyproject) — clone it, install its
+# own deps (incl. torchmcubes, which compiles here), and put it on PYTHONPATH.
+RUN git clone --depth 1 https://github.com/VAST-AI-Research/TripoSR.git /opt/triposr \
+ && pip install -r /opt/triposr/requirements.txt
COPY requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
diff --git a/workers/model-triposr/requirements.txt b/workers/model-triposr/requirements.txt
index b56e0f9cc..e6324bff8 100644
--- a/workers/model-triposr/requirements.txt
+++ b/workers/model-triposr/requirements.txt
@@ -1,5 +1,7 @@
# ── TripoSR (VAST-AI / Stability AI) ──────────────────────────────────────────
-tsr @ git+https://github.com/VAST-AI-Research/TripoSR.git@main
+# The `tsr` package is NOT pip-installable (no setup.py/pyproject); the Dockerfile
+# clones the repo to /opt/triposr and puts it on PYTHONPATH instead. Its own deps
+# (incl. the CUDA-compiled torchmcubes) come from /opt/triposr/requirements.txt.
torch>=2.3.0
trimesh>=4.4.0