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
Add zauth SDK Solana ESM postinstall patch to keep @solana imports off Vercel NFT trace
nirholas4d9b573ccca4
diff --git a/package.json b/package.jsonindex 0e1321c11..987e17f6a 100644--- a/package.json+++ b/package.json@@ -55,7 +55,7 @@]},"scripts": {- "postinstall": "(node scripts/build-cache.mjs check agent-payments-sdk agent-payments-sdk/src agent-payments-sdk/package.json || (npm run build --prefix agent-payments-sdk && node scripts/build-cache.mjs stamp agent-payments-sdk agent-payments-sdk/src agent-payments-sdk/package.json)) && (node scripts/fix-pump-sdk-esm.mjs & node scripts/fix-x402-extensions-esm.mjs & node scripts/fix-colyseus-storage.mjs & node scripts/copy-three-decoders.mjs & node scripts/setup-claude-skills.mjs & wait)",+ "postinstall": "(node scripts/build-cache.mjs check agent-payments-sdk agent-payments-sdk/src agent-payments-sdk/package.json || (npm run build --prefix agent-payments-sdk && node scripts/build-cache.mjs stamp agent-payments-sdk agent-payments-sdk/src agent-payments-sdk/package.json)) && (node scripts/fix-pump-sdk-esm.mjs & node scripts/fix-x402-extensions-esm.mjs & node scripts/fix-zauth-sdk-solana-esm.mjs & node scripts/fix-colyseus-storage.mjs & node scripts/copy-three-decoders.mjs & node scripts/setup-claude-skills.mjs & wait)","setup": "node scripts/setup-dev.mjs","dev": "vite --port 3000","dev:multi": "npm run dev --prefix multiplayer",diff --git a/scripts/fix-zauth-sdk-solana-esm.mjs b/scripts/fix-zauth-sdk-solana-esm.mjsnew file mode 100644index 000000000..24d9b4d3d--- /dev/null+++ b/scripts/fix-zauth-sdk-solana-esm.mjs@@ -0,0 +1,88 @@+// Patches @zauthx402/sdk after install to keep its @solana/* refund imports off+// Vercel's NFT trace.+//+// The SDK is consumed via api/_lib/zauth.js, which api/_lib/http.js imports, which+// in turn is imported by ~517 API routes. scripts/bundle-api.mjs INLINES the SDK+// into every one of those route bundles (it is not in that script's EXTERNALS).+// The SDK lazy-loads its Solana refund path with three LITERAL dynamic imports:+//+// await import('@solana/signers')+// await import('@solana/kit')+// await import('@solana-program/token')+//+// @solana/* and @solana-program/* ARE in bundle-api's EXTERNALS, so esbuild+// leaves those literal imports in place. Vercel's @vercel/nft follows literal+// dynamic imports, so it traced the ~162 MB @solana tree once per route across+// all 517 bundles — 41 minutes of post-build function packaging, blowing the+// 45-minute build timeout (deploy Ca7BCT7LH). This is the same failure mode that+// removed @sentry/node from the http.js path (see api/_lib/sentry.js's header).+//+// Fix: rewrite each @solana/@solana-program literal specifier to atob('<base64>').+// Neither esbuild nor NFT decode base64, so the static trace stops at the SDK;+// the specifier is reconstructed at runtime, so the import resolves exactly as+// before from whatever node_modules the lambda ships (the Solana payment/agent+// routes that actually run refunds import @solana statically anyway, so the tree+// is present where it is used). EVM refunds are unaffected — viem is inlined, not+// externalized, so NFT never traced it.+//+// Idempotent (the atob() form no longer matches the literal-import regex);+// survives `npm ci` via postinstall. Scoped to @solana/@solana-program only —+// other dynamic imports the SDK makes (viem, bs58) are inlined by esbuild and+// must keep their literal specifiers.++import { existsSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';++const root = dirname(fileURLToPath(import.meta.url));+const repo = dirname(root);+const distDir = join(repo, 'node_modules/@zauthx402/sdk/dist');++if (!existsSync(distDir)) {+ console.log('[fix-zauth-sdk-solana-esm] package not installed, skipping');+ process.exit(0);+}++// Match literal dynamic imports of @solana/* and @solana-program/* only.+const LITERAL_SOLANA_IMPORT = /import\(\s*(['"])(@solana(?:-program)?\/[A-Za-z0-9._-]+)\1\s*\)/g;++function patchSource(src) {+ let count = 0;+ const out = src.replace(LITERAL_SOLANA_IMPORT, (_m, _q, spec) => {+ count++;+ const b64 = Buffer.from(spec, 'utf8').toString('base64');+ return `import(atob('${b64}'))`;+ });+ return { out, count };+}++function collectDistFiles(dir, acc = []) {+ for (const entry of readdirSync(dir, { withFileTypes: true })) {+ const full = join(dir, entry.name);+ if (entry.isDirectory()) collectDistFiles(full, acc);+ else if (/\.(mjs|js|cjs)$/.test(entry.name)) acc.push(full);+ }+ return acc;+}++let filesPatched = 0;+let importsRewritten = 0;++for (const file of collectDistFiles(distDir)) {+ const src = readFileSync(file, 'utf8');+ if (!src.includes("import('@solana") && !src.includes('import("@solana')) continue;+ const { out, count } = patchSource(src);+ if (count > 0 && out !== src) {+ writeFileSync(file, out);+ filesPatched++;+ importsRewritten += count;+ }+}++if (importsRewritten > 0) {+ console.log(+ `[fix-zauth-sdk-solana-esm] obscured ${importsRewritten} @solana import(s) across ${filesPatched} file(s)`,+ );+} else {+ console.log('[fix-zauth-sdk-solana-esm] already patched');+}