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.
CZ Offline Fallback Demo
This directory contains the offline fallback for the CZ demo — a self-contained, zero-network-dependency copy of the demo that the operator can display if live internet fails during the event.
Overview
Purpose: Keep the demo running when the internet dies, RPC node is down, or the staging server is unreachable.
File: index.html — standalone HTML page with embedded assets.
Network: Zero external dependencies after initial page load. Avatar and state are served from origin only.
Usage: Open https://three.ws/cz/offline/ in a browser, or http://localhost:3000/cz/offline/ for local dev.
How It Works
Avatar Loading
- Tries to load
/avatars/cz.glbfrom the origin (served frompublic/avatars/cz.glb) - If available, renders with Three.js (if loaded on the page)
- If unavailable or WebGL fails, falls back to a canvas-drawn placeholder
- No external CDN calls; no IPFS gateway requests
Claim Flow
- User clicks "Claim Agent" button
- Modal plays a simulated claim sequence:
- "Initializing claim flow…" (800ms)
- "Connecting wallet…" (800ms)
- "Submitting claim…" (800ms)
- "Waiting for confirmation…" (800ms)
- "Claim Successful!" + confetti (no delay)
- No blockchain calls; no MetaMask interaction
- No transaction is actually submitted; this is purely visual
State Display
- Footer shows static values:
- Agent ID:
0x1234567(placeholder) - Chain:
Base Sepolia - Owner: Not displayed (since no real onchain state)
- Agent ID:
- All values are hardcoded; no API calls
Cache & Service Worker
- Page registers a service worker at
/cz/sw.js(if available) - If the page is cached, it loads instantly even if origin is unreachable
- Service worker is optional; page works without it
Testing the Offline Fallback
Test 1: Network Throttling
# Open DevTools → Network tab
# Set throttling to "Offline"
# Reload the page
# Avatar and claim flow should still work
Test 2: Hard Offline (Kill WiFi)
# Open /cz/offline/ in a browser
# Physically unplug ethernet or disable WiFi
# Page should still display avatar and respond to clicks
Test 3: Origin Unreachable
# Open /cz/offline/ normally
# Block the origin in DevTools (DevTools → Network → Disable)
# Reload page (from browser cache)
# Fallback image and claim flow work
Test 4: Timing (Dry Run)
# Open /cz/offline/
# Click "Claim Agent" button
# Observe:
# - First modal appears at 0ms: "Initializing…"
# - Second modal at 800ms: "Connecting…"
# - Confetti at 3200ms
# Total: ~4 seconds from click to success
Integration with Live Demo
When to Switch to Offline
- Avatar fails to load for > 30 seconds
- RPC node is down or extremely congested (claim stuck > 2 minutes)
- Entire staging server is unreachable (502/503)
- WiFi drops mid-demo
How to Switch
- In the browser: Open a new tab or window to
/cz/offline/ - Say to audience: "We're in offline mode now, but the agent is fully cached and ready."
- Run the demo: Same 9-step sequence, but the claim is instant (no real tx)
- Be honest: If asked, say "This is a pre-rendered demo version—on mainnet, this would be live."
Before/After Behavior
| Aspect | Live (/cz) |
Offline (/cz/offline/) |
|---|---|---|
| Avatar | Loaded from /avatars/cz.glb (live) |
Loaded from /avatars/cz.glb (cached) or fallback image |
| Claim TX | Real signature + submit to RPC | Fake modal, no tx |
| State | From /api/cz/identity (live API) |
Hardcoded placeholder |
| Claim Time | 30–60 seconds | ~4 seconds |
| Network | Requires live staging + RPC | Zero external calls |
Customization
Change Hardcoded Values
In index.html, search for these and update:
Agent ID: 0x1234567 // Change to real agentId
Chain: Base Sepolia // Keep or update
Change Claim Timing
In index.html, handleClaimClick() function:
setTimeout(() => { ... }, 800) // First modal at 800ms
setTimeout(() => { ... }, 1600) // Second modal at 1600ms
// etc.
Change Colors / Styling
In the <style> section:
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); /* bg color */
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* button color */
Add a Real Screenshot Fallback
If Three.js is unavailable, the fallback currently draws a placeholder on canvas. To add a real screenshot:
- Take a screenshot of the live demo (
/cz) with avatar rendered - Save as
fallback.pngin this directory - Update
loadFallback()inindex.htmlto use the image:fallback.src = '/cz/offline/fallback.png';
Limitations & Future Work
Current Limitations
- Avatar rendering is a placeholder (no Three.js integration yet)
- Claim flow is purely visual (no real blockchain state)
- State values are hardcoded (no dynamic data from API)
- Service worker (
/cz/sw.js) is not yet implemented
Future Enhancements
- Embed actual GLB file as base64 in HTML (self-contained binary)
- Integrate Three.js for full 3D avatar rendering
- Implement
/cz/sw.jsfor offline caching - Parameterize agentId and chain from URL query params
- Add pre-recorded video loop of agent interaction (if available)
- Support keyboard controls (arrow keys for camera, Space to claim)
Files
index.html— Main offline page (this is all you need)README.md— This file
Troubleshooting
Avatar shows as placeholder, not 3D
- Check DevTools Console for errors
- Verify
/avatars/cz.glbis being loaded (Network tab) - Confirm Three.js is available (try
typeof THREEin console)
Claim button doesn't respond
- Check DevTools Console for JavaScript errors
- Refresh the page
- Try in incognito mode (clear cookies)
Service worker not registered
/cz/sw.jsmay not exist yet (that's ok; page still works)- Check DevTools → Application → Service Workers for status
- This is optional for offline demo to work
Page is slow or jittery
- Close other browser tabs (free up memory)
- Disable browser extensions
- Try a different browser (Chrome, Firefox, Safari, Edge)
Contact / Issues
If the offline fallback isn't working or needs updates, file an issue or reach out to the team.
For live demo day:
- Backup operator: Have a second laptop with offline page pre-loaded
- Screenshot: Keep a static screenshot of the success state as a final fallback
- Notes: Write down any issues encountered for post-mortem