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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(seeker): load the wallet stack on demand, answer a pre-worker share honestly, and stop the offline page from reload-looping
nirholas1bf23b827d33
diff --git a/api/create-share.js b/api/create-share.jsnew file mode 100644index 000000000..e9c7c81d1--- /dev/null+++ b/api/create-share.js@@ -0,0 +1,27 @@+// POST /create/share is the Web Share Target declared in the web manifest. In+// normal operation the service worker (public/share-target-sw.js) intercepts+// the POST before it reaches the network, parks the shared files in the Cache+// API, and redirects into the right creation flow. This handler only answers+// when the worker is not there yet: the very first share after install, or a+// browser with the worker evicted. A multipart body cannot be handed back to+// the page from here without storing it, so the honest answer is a redirect+// with a reason the /create page explains ("share it again"), never a 404 page+// or an upload that silently vanishes.++import { wrap } from './_lib/http.js';++export default wrap(async (req, res) => {+ // Read and discard the body so the connection closes cleanly; the files+ // are never stored.+ await new Promise((resolve) => {+ req.on('data', () => {});+ req.on('end', resolve);+ req.on('error', resolve);+ if (req.readableEnded || req.complete) resolve();+ });+ const target = req.method === 'POST' ? '/create?shared=nosw' : '/create';+ res.statusCode = 303;+ res.setHeader('Location', target);+ res.setHeader('Cache-Control', 'no-store');+ res.end();+});diff --git a/public/offline.html b/public/offline.htmlindex b814ae969..51598cec0 100644--- a/public/offline.html+++ b/public/offline.html@@ -43,14 +43,23 @@var text = document.getElementById('status-text');var retry = document.getElementById('retry');function reload() { location.reload(); }+ // This page is served by the service worker when a navigation fails.+ // navigator.onLine can still read true (captive portal, server down),+ // so reloading on load would loop. Only the online transition and the+ // button trigger a reload; a probe confirms the origin answers first.function paint() {var on = navigator.onLine;dot.className = 'dot' + (on ? ' online' : '');- text.textContent = on ? 'Back online, reloading' : 'Waiting for a connection';- if (on) setTimeout(reload, 400);+ text.textContent = on ? 'Connected, but three.ws did not answer' : 'Waiting for a connection';}- retry.addEventListener('click', reload);- window.addEventListener('online', paint);+ function probeThenReload() {+ text.textContent = 'Checking';+ fetch('/manifest.webmanifest', { cache: 'no-store', mode: 'same-origin' })+ .then(function (r) { if (r.ok) reload(); else paint(); })+ .catch(paint);+ }+ retry.addEventListener('click', probeThenReload);+ window.addEventListener('online', function () { paint(); setTimeout(probeThenReload, 600); });window.addEventListener('offline', paint);paint();})();diff --git a/src/create.js b/src/create.jsindex e4a4f41ec..1818a9d76 100644--- a/src/create.js+++ b/src/create.js@@ -475,6 +475,14 @@ async function ingestSharedFile() {showStatus("We couldn't read the shared file. Try again from the app you shared it from.", 'error');return;}+ if (intent === 'nosw') {+ // The share reached the server instead of the service worker: the app+ // had not finished installing its worker yet (first launch), so the+ // file could not be handed over. One visit fixes it.+ clearSharedIntent();+ showStatus('three.ws just finished setting up. Share the file again and it will land here.', 'error');+ return;+ }if (intent === 'glb') {clearSharedIntent();let files = [];diff --git a/src/seeker.js b/src/seeker.jsindex a31ace10a..0968095ab 100644--- a/src/seeker.js+++ b/src/seeker.js@@ -6,10 +6,22 @@// shows what is theirs: their agents, and whether the wallet holds the Seeker// Genesis Token (verified through /api/seeker/verify, a read-only check).-import '../solana-mobile/src/index.js';import { isSolanaMobileTwa, isSolanaMobileDevice } from '../solana-mobile/src/seeker-detect.js';import { isUserRejection } from '../solana-mobile/src/mwa-errors.js';-import { SolanaAdapter } from './onchain/adapters/solana.js';++// The wallet stack (Mobile Wallet Adapter + @solana/web3.js) is ~700 KB. It+// is only needed to sign in, so the home screen loads without it: inside the+// TWA the MWA boot is started immediately (it resumes a remembered session+// silently), everywhere else the stack loads on the first tap of Sign in.+const walletBoot = (typeof window !== 'undefined' && isSolanaMobileTwa())+ ? import('../solana-mobile/src/index.js')+ : null;++async function loadAdapter() {+ if (walletBoot) await walletBoot;+ const { SolanaAdapter } = await import('./onchain/adapters/solana.js');+ return new SolanaAdapter();+}const $ = (id) => document.getElementById(id);@@ -85,7 +97,7 @@ async function signIn() {ui.signInLabel.textContent = 'Waiting for Seed Vault';ui.heroCta.disabled = true;try {- const adapter = new SolanaAdapter();+ const adapter = await loadAdapter();if (!adapter.isAvailable()) {toast(onSeeker()? 'Seed Vault did not respond. Open the Seed Vault wallet once, then try again.'diff --git a/vercel.json b/vercel.jsonindex a0cfa4de7..b9d230f80 100644--- a/vercel.json+++ b/vercel.json@@ -5066,6 +5066,10 @@"src": "/create/studio/","dest": "/avatar-studio.html"},+ {+ "src": "/create/share",+ "dest": "/api/create-share"+ },{"src": "/seeker","dest": "/seeker.html"