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.

production fixes: marketplace + social schema migration, prod-issues rename, vercel routing tweaks

nirholasc560feb3d957
diff --git a/ISSUES.md b/ISSUES.md
new file mode 100644
index 000000000..3f23d654a
--- /dev/null
+++ b/ISSUES.md
@@ -0,0 +1,269 @@
+# Production Issues — three.ws / 3D-Agent
+
+> Source: Vercel log export `3dagent-log-export-2026-05-24T23-46-48.json`
+> 64,919 log records. 7,385 are 5xx. 13,274 are 4xx/5xx total.
+>
+> **Agent directive: Fix every item. No questions. No stubs. Wire 100%. Update when done.**
+
+---
+
+## CRITICAL — Fix Immediately
+
+### 1. `pump-agent-stats` cron — 7,000+ consecutive 504 timeouts
+
+**Endpoints:** `/api/cron/pump-agent-stats` across all deployments
+**Volume:** ~7,200 504 timeouts. `3dagent-lkvpaeq68` alone has 4,085.
+
+**Root cause:** The cron calls Pump.fun/Solana RPC for up to 100 mints per run. The public Solana RPC rate-limits at 429 immediately, so the retry loop (500ms → 1s → 2s → 4s) burns through Vercel's 30-second function timeout every single invocation without doing any useful work.
+
+```
+Server responded with 429 Too Many Requests. Retrying after 500ms delay...
+Server responded with 429 Too Many Requests. Retrying after 1000ms delay...
+Server responded with 429 Too Many Requests. Retrying after 2000ms delay...
+Server responded with 429 Too Many Requests. Retrying after 4000ms delay...
+Vercel Runtime Timeout Error: Task timed out after 30 seconds
+```
+
+**Fix:**
+- In `api/cron/[name].js` → `handlePumpAgentStats`: add a wall-clock deadline check — bail out of the mint loop when `Date.now() - startMs > 22_000` (leave buffer before Vercel's 30s kill).
+- Track a "circuit-open" flag in Upstash/KV: if the last 3 runs all timed out on 429, skip the run and log `{ skipped: 'rpc_circuit_open' }` — prevents piling invocations that all fail identically.
+- The retry logic inside `pumpStatsSnapshotMint` must catch 429 and re-throw immediately (no retries) when already under a deadline. The outer loop catches and logs it.
+- Use a configured RPC endpoint (`SOLANA_RPC_URL` env var) — the free mainnet endpoint is rate-limited by default. If `SOLANA_RPC_URL` is already set in production env, confirm it's not also using the public endpoint.
+
+**File:** `api/cron/[name].js` lines 631–825
+
+---
+
+### 2. `api/marketplace/agents` — 105 × 500 errors
+
+**Endpoint:** `GET /api/marketplace/agents` (the main public listing)
+**Volume:** 105 errors, plus 4 each on `/agents/1e6af976...`, `/agents/7f117fa4...`, `/agents/c5a761fe...`
+
+**Root cause:** Unknown — the logs don't capture the error message body for this endpoint. The `handleList` query in `api/marketplace/[action].js:279` is a large JOIN across 6 tables with 4 correlated subqueries (reviews, skill_purchases, asset_prices). Most likely: a DB timeout (Neon cold-start or query plan issue), or a missing column referenced in the query.
+
+**Fix:**
+- Add `try/catch` around the primary `sql\`` query in `handleList`, log the full error with `console.error('[marketplace/list]', err)`, and return a structured 500 response so the message appears in future logs.
+- Add a `statement_timeout` to the Neon connection for this query (e.g., `sql\`SET LOCAL statement_timeout = '8000'\`` before the main query) — prevents silent hangs.
+- Check that all referenced columns exist: `skill_purchases.confirmed_at`, `agent_reviews.rating`, `asset_prices.is_active`, `avatars.thumbnail_key`. Run `\d` on each table in Neon console to verify.
+
+**File:** `api/marketplace/[action].js` lines 279–355
+
+---
+
+### 3. `api/club/leaderboard` — 16 × 500 errors
+
+**Endpoint:** `GET /api/club/leaderboard`
+**Volume:** 16 errors
+
+**Root cause:** No error message captured in logs. The query joins `club_dancer_wallets` and `club_tips` tables. Most likely the `paid_at` column referenced in the query (`case when t.paid_at is null`) doesn't exist on `club_tips`, or one of the tables is missing entirely.
+
+**Fix:**
+- Wrap the `runForWindow(window)` call with try/catch and log: `console.error('[club/leaderboard]', err)` — without this, the `wrap()` helper returns a 500 with no server-side log line.
+- Verify `club_dancer_wallets` and `club_tips` tables exist in Neon. If `club_tips` is missing the `paid_at` column, add it: `ALTER TABLE club_tips ADD COLUMN paid_at timestamptz;`
+- The leaderboard is also missing a `vercel.json` route. It works via Vercel's default file-based routing (the file exists at `api/club/leaderboard.js`), but confirm this by testing `/api/club/leaderboard` on the deployed URL.
+
+**File:** `api/club/leaderboard.js`
+
+---
+
+### 4. `api/threews/subdomain` — 5 × 500 (ESM import crash)
+
+**Error message:**
+```
+[api] unhandled file:///var/task/node_modules/@bonfida/spl-name-service/dist/esm/instructions/burnInstruction.js:1
+import"../node_modules/buffer/index.js";import{TransactionInstruction as i}from"@solana/web3.js"
+```
+
+**Root cause:** `@bonfida/spl-name-service` ships as an ES module that uses bare `import` syntax. Vercel's Node.js serverless runtime bundles API functions as CJS by default; when the bundler encounters a bare ESM `import` inside a dependency it can't tree-shake, it crashes at runtime.
+
+**Fix:**
+- In `api/threews/subdomain.js` (or in `api/_lib/threews-sns.js`), wrap the import of anything from `@bonfida/spl-name-service` or `src/solana/sns-subdomain.js` in a dynamic `await import()` so the module is resolved at call time, not at function cold-start.
+- Alternatively: add `"@bonfida/spl-name-service"` and `"@solana/web3.js"` to the `external` array in `vite.config.js` for the API build so Vercel's bundler leaves them as native requires and doesn't try to inline them.
+- Also add `ZAUTH_API_KEY` to Vercel env (see issue #8) — the 500 also emits `[zauth] disabled` which suggests the request hits that check before crashing.
+
+**Files:** `api/threews/subdomain.js`, `api/_lib/threews-sns.js`, `vite.config.js`
+
+---
+
+### 5. `api/mocap/clips` — 6 × 500 errors
+
+**Endpoint:** `GET /api/mocap/clips` and `POST /api/mocap/clips`
+**Volume:** 6 errors (plus 2 × 405)
+
+**Root cause:** The `handleList` function builds a raw SQL string with positional params. The Neon serverless client does NOT support interpolated `sql\`...\`` fragments inside another tagged template. The comment in the code acknowledges this but the actual positional param array approach may have a gap when `kindFilter` is provided and the `SUPPORTED_FORMATS` check intersects with the param ordering.
+
+**Fix:**
+- Add `console.error('[mocap/clips/list]', err)` in the catch block so the actual error appears in logs.
+- Audit the raw SQL params array in `handleList` — ensure the `$N` placeholder indices match the `params.push()` order exactly, especially for the `kind` filter branch that appends conditionally.
+- The 405 on `POST /api/mocap/clips` is suspect: the handler accepts both GET and POST. Verify `vercel.json` has no route that rewrites this to a GET-only path. (Currently no vercel.json entry for this path — it relies on default routing, which should be fine.)
+
+**File:** `api/mocap/clips.js`
+
+---
+
+### 6. `api/permissions/list` — 2 × 500 errors
+
+**Endpoint:** `GET /api/permissions/list`
+**Volume:** 2 errors
+
+**Fix:** Add error logging in `api/permissions/[action].js` — same pattern as above. No message in logs means the error is swallowed. Log it and investigate the actual DB query.
+
+**File:** `api/permissions/[action].js`
+
+---
+
+### 7. Solana RPC 429 — all `/api/agents/{id}/solana` endpoints
+
+**Volume:** 400+ endpoints returning 404 (agent not found in DB), multiple returning 200 with logged errors.
+
+**Error message (200 responses):**
+```
+[agents/solana/wallet] balance fetch failed Error: failed to get balance of account X:
+Error: 429 Too Many Requests: {"jsonrpc":"2.0","error":{"code":-32429,"message":"max usage reached"}}
+```
+
+**Root cause:** The public Solana mainnet RPC (`api.mainnet-beta.solana.com`) is shared and rate-limits heavily. Every agent wallet balance check hits it directly with no caching.
+
+**Fix:**
+- In `api/agents/solana/_handlers.js` (or wherever `getConnection()` is called for balance checks): wrap the `getBalance()` call in a try/catch. On 429, return a cached value from Upstash (if available) rather than failing. Set a 60-second TTL on the cached balance.
+- If `SOLANA_RPC_URL` is not set in production env, add a fallback list of public RPC endpoints and rotate on 429.
+- The 404s on `/api/agents/{uuid}/solana` are not rate-limit errors — those agents simply don't have a Solana wallet registered in the DB. These are expected and not fixable without the agents creating wallets. They're not bugs.
+
+**Files:** `api/agents/solana/` handlers
+
+---
+
+### 8. `api/chat` — 18 × 502 errors
+
+**Endpoint:** `POST /api/chat`
+**Volume:** 18 502 (bad gateway) responses
+
+**Root cause:** The upstream AI API (Anthropic or OpenAI via a worker proxy) is returning 5xx during these calls. The `api/chat.js` handler forwards the response status verbatim, so a 502 from the provider becomes a 502 to the client.
+
+**Fix:**
+- In `api/chat.js`: when the upstream returns 5xx, retry once after 500ms before propagating the error to the client.
+- Log `console.error('[chat] upstream error:', upstream.status, text)` so future logs show what the actual upstream error message is.
+- If the worker proxy itself is the issue, check `workers/` for the chat proxy and add proper upstream error handling there too.
+
+**File:** `api/chat.js`
+
+---
+
+## ENVIRONMENT CONFIGURATION — Required for Full Feature Parity
+
+### 9. `ZAUTH_API_KEY` not set — affects 30+ endpoints
+
+**Endpoints affected:** `api/agents`, `api/agent-actions`, `api/auth/wallets`, `api/avatars`, `api/keys`, `api/marketplace/agents/mine`, `api/mcp`, `api/users/me/purchased-skills`, `api/widgets`, `api/x402-pay`, and many more.
+
+**Log message:** `[zauth] disabled: ZAUTH_API_KEY not set` — appears on virtually every authenticated endpoint.
+
+**Root cause:** The `zauth` middleware (`api/_lib/zauth.js`) is a zero-knowledge auth layer that requires `ZAUTH_API_KEY` to be set. When unset it disables itself and falls back to the regular session/bearer auth. The `[zauth] disabled` log line is emitted at INFO level but appears in error-level log exports because it co-occurs with auth failures.
+
+**Fix:** Set `ZAUTH_API_KEY` in Vercel environment variables for the production project. If zauth is intentionally disabled, suppress the log line so it doesn't pollute error analysis: change the `console.warn('[zauth] disabled...')` to `if (process.env.NODE_ENV !== 'production') console.warn(...)`.
+
+**File:** `api/_lib/env.js` line ~426, `api/_lib/zauth.js` (or wherever the log fires)
+
+---
+
+### 10. `api/avatars/reconstruct` — 14 × 501 (not configured)
+
+**Root cause:** `REPLICATE_RECONSTRUCT_MODEL` env var is not set. The Replicate provider (`api/_providers/replicate.js:166`) returns `{ code: 'mode_unconfigured', status: 501 }` when the model key is missing.
+
+**Fix:** Set `REPLICATE_RECONSTRUCT_MODEL` in Vercel env. The default fallback model is `firtoz/trellis` (see `api/_providers/replicate.js:60`). If intentionally disabled, the 501 response is correct behavior — but the `api/avatars/regenerate-status` poll loop should surface a user-facing "Reconstruction unavailable" message rather than silently spinning.
+
+---
+
+### 11. `api/onboarding/avaturn-session` — 10 × 501 (not configured)
+
+**Root cause:** `AVATURN_API_KEY` not set in production. The endpoint at `api/onboarding/[action].js:37` returns 501 when the key is missing.
+
+**Fix:** Set `AVATURN_API_KEY` in Vercel env, or update the frontend that calls this endpoint to show a graceful "Avatar editor unavailable" state rather than surfacing the 501 as a user-visible error.
+
+---
+
+### 12. `api/auth/register` — NeonDB cold-start failures
+
+**Error message:**
+```
+Unhandled Rejection: NeonDbError: Error connecting to database: fetch failed
+ at execute (...@neondatabase/serverless/index.mjs:1549)
+ at async seedDefaultAgent (api/_lib/seed-default-agent.js:20)
+```
+
+**Root cause:** `seedDefaultAgent` is called after successful registration but Neon's serverless HTTP driver occasionally fails with a network error on first connection (cold pool). The rejection is unhandled so it 500s the response even though the user account was already created.
+
+**Fix:** In `api/_lib/seed-default-agent.js`, wrap the entire function body in try/catch. Log failures but **do not propagate** — a missing seed agent is recoverable (the user can create one manually). The registration endpoint should return 201 regardless of whether seeding succeeded.
+
+**File:** `api/_lib/seed-default-agent.js`
+
+---
+
+## ROUTING GAPS — Missing vercel.json entries
+
+### 13. `api/agent-strategy` — 404 (no vercel.json route, endpoint exists)
+
+The file `api/agent-strategy.js` exists and is complete. Vercel's default file routing *should* serve it, but the 404s in logs suggest it's not being routed. Add an explicit entry to `vercel.json`:
+
+```json
+{ "src": "/api/agent-strategy", "dest": "/api/agent-strategy" }
+```
+
+---
+
+### 14. `api/widgets/index` — 404/405
+
+`GET /api/widgets/index` returns 404. The widgets listing may be at `/api/widgets` only. Verify the client code is calling the correct path. Add a route alias in `vercel.json` if needed:
+```json
+{ "src": "/api/widgets/index", "dest": "/api/widgets" }
+```
+
+---
+
+## LOWER PRIORITY
+
+### 15. `api/agents/8004/search` — 6 × 504 (ERC8004 search timeout)
+
+The ERC8004 search endpoint is timing out on complex on-chain queries. Add a timeout guard and return partial results rather than a 504. Limit query complexity.
+
+---
+
+### 16. `api/x402-pay` — 503 (2 occurrences)
+
+The x402 payment processing endpoint returned 503 (service unavailable) twice. Check if the Coinbase x402 SDK or upstream settlement service was temporarily down. Add retry logic for transient 5xx from the upstream payment network.
+
+---
+
+### 17. `/.well-known/x402` — 405 Method Not Allowed (11 occurrences)
+
+External scanners/bots are hitting `/.well-known/x402` with POST/DELETE methods. The `wk.js` handler only accepts GET (correct). The 405 responses are expected behavior — **not a bug**. No fix needed. Optionally add these bot IPs to a deny list if they're causing load.
+
+---
+
+### 18. `cron/erc8004-crawl` — multiple 504 timeouts
+
+ERC8004 crawl cron times out on some deployments. The `ERC8004_BLOCK_CHUNK = 2000` may be too large for certain RPC providers. Reduce to `1000` and confirm the cursor persists correctly between invocations.
+
+**File:** `api/cron/[name].js` line ~119
+
+---
+
+## Summary Table
+
+| Priority | Endpoint | Status | Root Cause | Volume |
+|----------|----------|--------|------------|--------|
+| P0 | `pump-agent-stats` cron | 504 | Solana RPC 429 burns timeout | 7,200+ |
+| P0 | `api/marketplace/agents` | 500 | DB query failure (unlogged) | 109 |
+| P0 | `api/club/leaderboard` | 500 | Missing table/column (unlogged) | 16 |
+| P1 | `api/threews/subdomain` | 500 | `@bonfida` ESM import crash | 5 |
+| P1 | `api/mocap/clips` | 500 | SQL positional param bug | 6 |
+| P1 | `api/permissions/list` | 500 | Unlogged error | 2 |
+| P1 | `api/agents/*/solana` | 200+err | Solana RPC 429, no cache | 400+ |
+| P1 | `api/chat` | 502 | Upstream AI API 5xx, no retry | 18 |
+| P1 | `api/auth/register` | 500 | NeonDB cold-start, unhandled | ~10 |
+| P2 | `ZAUTH_API_KEY` unset | log noise | Env var missing | pervasive |
+| P2 | `api/avatars/reconstruct` | 501 | `REPLICATE_RECONSTRUCT_MODEL` unset | 14 |
+| P2 | `api/onboarding/avaturn-session` | 501 | `AVATURN_API_KEY` unset | 10 |
+| P3 | `api/agent-strategy` | 404 | Possible missing vercel.json route | 2 |
+| P3 | `api/widgets/index` | 404 | Wrong path or missing route | 3 |
+| P3 | `api/agents/8004/search` | 504 | Query timeout | 6 |
+| P3 | `api/x402-pay` | 503 | Upstream payment network transient | 2 |
diff --git a/PRODUCTION_ISSUES.md b/PRODUCTION_ISSUES.md
deleted file mode 100644
index 0895629d1..000000000
--- a/PRODUCTION_ISSUES.md
+++ /dev/null
@@ -1,264 +0,0 @@
-# Production Issues — Vercel Log Audit (2026-05-24)
-
-**Directive:** Fix every item below completely. No shortcuts, no stubs, no TODOs. Wire 100%. Real APIs, real implementations. Do not report back until every issue is resolved and verified.
-
----
-
-## CRITICAL — Repeated 500 errors
-
-### 1. Missing DB table: `agent_reviews`
-- **Error:** `NeonDbError: relation "agent_reviews" does not exist` — 52× 500 from `/api/marketplace/[action]`
-- **Root cause:** `api/marketplace/[action].js:317-318` and `:377-378` query `agent_reviews` table which is absent from `api/_lib/schema.sql` entirely.
-- **Fix:** Add `agent_reviews` table to schema.sql (columns: `id uuid PK`, `agent_id uuid FK→agent_identities`, `user_id uuid FK→users`, `rating int`, `review text`, `created_at timestamptz`). Apply additive `ALTER TABLE IF NOT EXISTS` style. Also add a separate `api/marketplace/reviews.js` handler if it doesn't already work for the `reviews` action.
-
-### 2. Missing DB tables: `x_triggers`, `x_scheduled_posts`, `x_pending_reviews`
-- **Error:** `column "agent_id" does not exist` — 72× from `/api/cron/[name]` run-x-triggers
-- **Root cause:** `api/cron/[name].js:2686` queries `x_triggers` with columns `id, user_id, agent_id, kind, config, auto_publish, last_fired_at, last_state`. None of these three tables exist in `api/_lib/schema.sql`.
-- **Fix:** Add all three tables to schema.sql:
- - `x_triggers(id uuid PK, user_id uuid FK→users, agent_id uuid FK→agent_identities, kind text, config jsonb, auto_publish bool, enabled bool, last_fired_at timestamptz, last_state jsonb, created_at timestamptz)`
- - `x_scheduled_posts(id uuid PK, user_id uuid FK→users, agent_id uuid FK→agent_identities, text text, scheduled_at timestamptz, published_at timestamptz, created_at timestamptz)`
- - `x_pending_reviews(id uuid PK, user_id uuid FK→users, trigger_id uuid FK→x_triggers, agent_id uuid FK→agent_identities, text text, reviewed_at timestamptz, approved bool, created_at timestamptz)`
-
-### 3. Missing DB column: `club_tips.amount_atomics`
-- **Error:** `column "total_atomics" does not exist` — 7× 500 from `/api/club/leaderboard`
-- **Root cause:** `api/club/leaderboard.js` computes `sum(t.amount_atomics)` aliased as `total_atomics`. The column `amount_atomics` doesn't exist in the production `club_tips` table (schema.sql has it defined but the migration hasn't run or production table was created from an older schema).
-- **Fix:** Add `ALTER TABLE club_tips ADD COLUMN IF NOT EXISTS amount_atomics numeric;` migration to schema.sql. Verify `club_tips` schema matches all columns leaderboard.js and tips.js reference.
-
----
-
-## HIGH — Infrastructure & Rate Limiting (thousands of errors)
-
-### 4. Solana RPC Rate Limiting (Helius 429) — 900+ errors
-- **Error:** `[agents/solana/wallet] balance fetch failed ... 429 Too Many Requests: max usage reached` — 900+ occurrences across `/api/agents/[id]`
-- **Root cause:** Helius free/starter plan being exhausted. Every agent page load triggers a live Solana RPC call for balance. No caching.
-- **Fix:**
- - Add Redis/KV cache in `api/_lib/balances.js` (or inline in `api/agents/[id].js`): cache balance responses for 60s per wallet address.
- - Implement RPC endpoint rotation: fall through to public RPC (`https://api.mainnet-beta.solana.com`) when Helius returns 429.
- - Add exponential backoff retry (max 2 retries, 500ms/1s delays) before the fallback.
- - Same treatment for `getSignaturesForAddress` activity calls.
-
-### 5. Cron Timeout (504) — 393 occurrences
-- **Error:** `Vercel Runtime Timeout Error: Task timed out after 30 seconds` — from `index-delegations` cron
-- **Root cause:** EVM delegation indexer fetches too many blocks in one invocation; ETH mainnet RPC caps `eth_getLogs` at 50-block ranges. Each cron run tries to catch up many hundreds of blocks before the 30s deadline.
-- **Fix:**
- - In `api/cron/[name].js` `indexDelegations` handler: reduce block batch size to ≤25 for mainnet (chainId=1), ≤50 for L2s.
- - Add a hard time budget check (`Date.now() - start > 22000`) after each batch and break early, saving cursor progress.
- - Log a warning on early exit so the next invocation continues from the saved cursor.
-
-### 6. OpenRouter Free Model Rate-Limited — 7× 502 from `/api/chat`
-- **Error:** `[chat:openrouter] 429 ... meta-llama/llama-3.3-70b-instruct:free is temporarily rate-limited`
-- **Root cause:** Free tier model rate-limited upstream; no fallback model configured.
-- **Fix:** In the OpenRouter chat path, add model fallback chain: on 429, retry once with `meta-llama/llama-3.1-8b-instruct:free`, then fall back to `anthropic/claude-haiku` (paid). Log which model was actually used in the response.
-
----
-
-## HIGH — Missing Env Vars (configuration gaps)
-
-### 7. `X402_AGENT_SOLANA_SECRET_BASE58` not set — 1× 503
-- **Error:** `[api] unhandled Error: agent wallet not configured (set X402_AGENT_SOLANA_SECRET_BASE58)` from `/api/x402-pay`
-- **Root cause:** `api/x402-pay.js:287` throws when env var is absent. This error is unhandled (bubbles to Vercel as a 503).
-- **Fix:** Wrap `loadAgentKeypair()` call in a try/catch that returns `error(res, 503, 'config_missing', 'payment processing not available')` — same pattern used for subdomain minting. Also verify the env var is set in Vercel production dashboard.
-
-### 8. `ZAUTH_API_KEY` not set — 1954× 500 from `/api/threews/subdomain`
-- **Error:** `[zauth] disabled: ZAUTH_API_KEY not set` logged at `level=info` but response is 500
-- **Root cause:** The zauth instrument layer logs the "disabled" message but something else in `api/threews/subdomain.js` is throwing. Investigate: the subdomain handler calling into zauth when disabled may have an unguarded code path.
-- **Fix:** Confirm `api/_lib/zauth.js` `instrument()` returns cleanly (noop) when `ZAUTH_API_KEY` is absent. The 500 status on these requests indicates a secondary crash — trace the actual stack and fix the unhandled error. Set `ZAUTH_API_KEY` in Vercel env if the zauth service is in use.
-
----
-
-## HIGH — Unhandled Errors / Missing Error Handling
-
-### 9. `@bonfida/spl-name-service` ESM bundling crash — 2× 500 from `/api/threews/subdomain`
-- **Error:** `[api] unhandled file:///var/task/node_modules/@bonfida/spl-name-service/dist/esm/instructions/burnInstruction.js:1 import"../node_modules/buffer/index.js"` — SyntaxError from module parse
-- **Root cause:** Vercel's bundler is hitting an ESM module that re-imports `buffer` with a bare relative specifier that breaks in the serverless bundle.
-- **Fix:** Pin `@bonfida/spl-name-service` to a CommonJS-compatible version or add a Vercel `bundler` override in `vercel.json` to externalize it: `{ "functions": { "api/threews/subdomain.js": { "excludeFiles": "" } } }`. Alternatively switch to a direct Solana RPC call for SNS resolution to avoid the broken dependency.
-
-### 10. `api/permissions/[action].js` — unhandled UUID validation — 1× 500
-- **Error:** `NeonDbError: invalid input syntax for type uuid: "missing-id-xyz"`
-- **Root cause:** `handleList` passes user-supplied `id` directly into a UUID column without validation.
-- **Fix:** Before the SQL query, validate with `/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)` and return `error(res, 400, 'invalid_id', 'id must be a valid UUID')` if invalid.
-
-### 11. `api/widgets/view` — FK violation on insert — 1× error
-- **Error:** `insert or update on table "widget_views" violates foreign key constraint "widget_views_widget_id_fkey"`
-- **Root cause:** Widget views are being logged for widget IDs that don't exist in the `widgets` table (deleted or invalid).
-- **Fix:** Wrap the `widget_views` insert in a try/catch — this is a best-effort analytics write. Swallow FK violation errors (Postgres error code `23503`) silently. Already 204 status but the unhandled error logs it as a warning.
-
-### 12. `api/mocap/clips.js` — NeonDB `$1` syntax error still in production — 2× 500
-- **Error:** `NeonDbError: syntax error at or near "$1"` from `handleList`
-- **Root cause:** Fix was committed locally but may not be deployed, OR there is a second code path in `handleList` with the nested `sql\`...\`` template fragment pattern.
-- **Fix:** Audit the entire `handleList` function in `api/mocap/clips.js`. Every `sql\`...\`` that uses another `sql\`...\`` as a fragment must be converted to the positional-params pattern. Deploy.
-
----
-
-## MEDIUM — Missing Routes (404s)
-
-### 13. `/api/agents/[id]/solana` → 404 for 500+ requests
-- **Error:** 404 for `/api/agents/{uuid}/solana` — hits from many real agent UUIDs
-- **Root cause:** `vercel.json:603-604` routes `/api/agents/([^/]+)/solana` → `/api/agents/[id]` but the `[id].js` handler doesn't handle the `/solana` sub-action — it likely returns 404 for unrecognised paths.
-- **Fix:** In `api/agents/[id].js`, detect when the request path ends with `/solana` (check `req.url.includes('/solana')`), extract the agent UUID, and forward to the Solana wallet/balance handler. Return the correct Solana data (balance, address, etc.) at that endpoint.
-
-### 14. `/api/agent-strategy` — 404 × 2
-- **Error:** 404 for `/api/agent-strategy`
-- **Root cause:** No handler file exists at `api/agent-strategy.js` and no route in `vercel.json`.
-- **Fix:** Create `api/agent-strategy.js` implementing whatever the strategy endpoint should do (check git history / callers for intent), or add a redirect to the correct endpoint in `vercel.json`.
-
-### 15. Template literal in URL — `/agent/$%7Bo(p.value)%7D` — 2× 404
-- **Error:** 404 for `/agent/${o(p.value)}` (URL-encoded template literal)
-- **Root cause:** A JS template literal is being used as an href instead of being evaluated — likely a `href="\`/agent/${...}\`"` vs `href="/agent/${...}"` bug in a frontend component.
-- **Fix:** Search the frontend code for `href="\`/agent/` or `href='` + template literals and fix the string interpolation.
-
----
-
-## MEDIUM — Method Not Allowed (405s)
-
-### 16. x402 endpoints don't handle HEAD requests — 100+ occurrences
-- **Error:** 405 for `HEAD /api/x402/skill-marketplace`, `HEAD /api/x402/model-check`, `HEAD /api/x402/dance-tip`, `HEAD /api/x402/symbol-availability`, `HEAD /.well-known/x402`
-- **Root cause:** Health checkers and x402station probers send HEAD requests; the route handlers only accept GET/POST.
-- **Fix:** In `api/_lib/http.js` `method()` helper (or in `wrap()`), respond to HEAD requests with the same headers as GET but no body. Standard HTTP: HEAD must be supported wherever GET is. Add `'HEAD'` to allowed methods lists in all x402 handlers.
-
-### 17. `GET /api/x402/mint-to-mesh-batch` — 405 × 127
-- **Error:** 405 for GET on a POST-only endpoint
-- **Root cause:** `mint-to-mesh-batch.js` only allows POST but bots/probers are hitting it with GET.
-- **Fix:** The `method()` helper should return a proper `405 Method Not Allowed` with an `Allow: POST` header. Check that the current implementation does this (don't just return 405 with no body — include `Allow` header per RFC 7231).
-
-### 18. `GET /api/webhooks/replicate` — 405 × 4
-- **Error:** 405 for GET on webhook endpoint
-- **Root cause:** Webhooks only accept POST; GET needs to return 405 with `Allow: POST`.
-- **Fix:** Same as above — confirm `api/webhooks/replicate.js` returns proper 405 with `Allow` header for non-POST methods.
-
-### 19. `/api/x402/permit2-paid-demo` — accepts PUT/PATCH/DELETE — 10× 405
-- **Error:** Multiple 405s on methods that should not be accepted
-- **Fix:** Tighten `method()` guard to only allow the intended methods (GET or POST). Return `405 { Allow: 'GET, POST' }` for everything else.
-
----
-
-## MEDIUM — Cron / Background Job Failures
-
-### 20. `index-delegations` ETH mainnet getLogs range error — 7× per run
-- **Error:** `RPC eth_getLogs error: eth_getLogs is limited to 0 - 50 blocks range`
-- **Root cause:** The indexer builds block ranges larger than 50 for mainnet (chainId=1).
-- **Fix:** In `api/cron/[name].js` delegation indexer, enforce `const BATCH = chainId === 1 ? 25 : 150;` (mainnet is the bottleneck; other RPCs allow larger). Already partially noted under issue #5 — this is the specific constraint.
-
-### 21. `index-delegations` fetch failures — 54 occurrences
-- **Error:** `{"stage":"index-delegations","chainId":1,"error":"fetch failed"}` and `{"error":"This operation was aborted"}`
-- **Root cause:** Vercel function hitting 30s timeout mid-HTTP fetch to RPC endpoint; or network blip.
-- **Fix:** Add `AbortController` with 10s timeout on each RPC fetch inside the indexer. Catch `AbortError` and `fetch failed` separately; on timeout, save cursor and return 200 (partial success) instead of letting the whole function timeout at 30s.
-
-### 22. `api/club/tips-stream` timing out — 5× at 300s
-- **Error:** `Vercel Runtime Timeout Error: Task timed out after 300 seconds` from SSE stream endpoint
-- **Root cause:** SSE streams are holding connections open past Vercel's 300s Pro function limit.
-- **Fix:** Implement keep-alive heartbeat that sends a `: ping` comment every 25s. When approaching 280s (`Date.now() - start > 280000`), send a `retry: 1000` SSE directive and close the connection cleanly so the client auto-reconnects. This prevents the hard timeout while maintaining the streaming UX.
-
----
-
-## LOW — Cleanup & Configuration
-
-### 23. `api/auth/[action].js` seed-default-agent DB connection flaps — 6 failures
-- **Error:** `[seed-default-agent] failed ... error: 'Error connecting to database: fetch failed'`
-- **Root cause:** Transient Neon connection failures during auth flow. Currently the error is caught and logged but auth continues — verify the handler doesn't block sign-in on seed failure.
-- **Fix:** Confirm that `seed-default-agent` failures are fire-and-forget (non-blocking). If auth returns 200 even when seeding fails, this is acceptable. Add retry with 1s delay (one retry only) before giving up.
-
-### 24. Fake/test agent UUID in production — `11111111-2222-3333-4444-555555555555` 404 × 5
-- **Error:** 404 for `/api/agents/11111111-2222-3333-4444-555555555555`
-- **Root cause:** Test/placeholder UUID being requested in production — likely hardcoded in a client or demo page.
-- **Fix:** Search frontend/demo code for `11111111-2222-3333-4444-555555555555` and replace with a real agent UUID or make the endpoint handle gracefully.
-
-### 25. `api/marketplace/theme)` — 404 with trailing `)` in URL × 1
-- **Error:** 404 for `/api/marketplace/theme)` — a `)` character leaked into the URL
-- **Root cause:** Client-side bug — a URL is being constructed with an unclosed parenthesis (e.g., `\`/api/marketplace/${action)\`...`).
-- **Fix:** Search marketplace-related frontend code for the malformed URL construction and fix the string concatenation/template.
-
----
-
-## Schema Migration Required
-
-The following SQL must be added to `api/_lib/schema.sql` and applied to the production Neon database:
-
-```sql
--- agent_reviews (for marketplace ratings)
-CREATE TABLE IF NOT EXISTS agent_reviews (
- id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
- agent_id uuid NOT NULL REFERENCES agent_identities(id) ON DELETE CASCADE,
- user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
- rating int NOT NULL CHECK (rating BETWEEN 1 AND 5),
- review text,
- created_at timestamptz NOT NULL DEFAULT now(),
- updated_at timestamptz NOT NULL DEFAULT now(),
- UNIQUE (agent_id, user_id)
-);
-CREATE INDEX IF NOT EXISTS agent_reviews_agent_id ON agent_reviews(agent_id);
-CREATE INDEX IF NOT EXISTS agent_reviews_user_id ON agent_reviews(user_id);
-
--- x_triggers (social automation triggers)
-CREATE TABLE IF NOT EXISTS x_triggers (
- id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
- user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
- agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
- kind text NOT NULL,
- config jsonb NOT NULL DEFAULT '{}',
- auto_publish boolean NOT NULL DEFAULT false,
- enabled boolean NOT NULL DEFAULT true,
- last_fired_at timestamptz,
- last_state jsonb,
- created_at timestamptz NOT NULL DEFAULT now()
-);
-CREATE INDEX IF NOT EXISTS x_triggers_user_id ON x_triggers(user_id) WHERE enabled;
-
--- x_scheduled_posts (queued social posts)
-CREATE TABLE IF NOT EXISTS x_scheduled_posts (
- id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
- user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
- agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
- text text NOT NULL,
- scheduled_at timestamptz NOT NULL,
- published_at timestamptz,
- created_at timestamptz NOT NULL DEFAULT now()
-);
-CREATE INDEX IF NOT EXISTS x_scheduled_posts_pending ON x_scheduled_posts(scheduled_at) WHERE published_at IS NULL;
-
--- x_pending_reviews (posts waiting for human approval before publish)
-CREATE TABLE IF NOT EXISTS x_pending_reviews (
- id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
- user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
- trigger_id uuid REFERENCES x_triggers(id) ON DELETE SET NULL,
- agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
- text text NOT NULL,
- reviewed_at timestamptz,
- approved boolean,
- created_at timestamptz NOT NULL DEFAULT now()
-);
-CREATE INDEX IF NOT EXISTS x_pending_reviews_user_pending ON x_pending_reviews(user_id) WHERE reviewed_at IS NULL;
-
--- club_tips — add amount_atomics if table predates the column
-ALTER TABLE club_tips ADD COLUMN IF NOT EXISTS amount_atomics numeric;
-```
-
----
-
-## Summary by Priority
-
-| # | Issue | Errors | Status |
-|---|-------|--------|--------|
-| 1 | Missing `agent_reviews` table | 52× 500 | Schema + deploy |
-| 2 | Missing `x_triggers`/`x_scheduled_posts`/`x_pending_reviews` | 72× errors | Schema + deploy |
-| 3 | `club_tips.amount_atomics` column missing | 7× 500 | ALTER TABLE |
-| 4 | Solana RPC 429 rate limiting | 900+ errors | Cache + fallback RPC |
-| 5 | Cron 30s timeout | 393× 504 | Batch size + time budget |
-| 6 | OpenRouter free model rate-limited | 7× 502 | Model fallback chain |
-| 7 | `X402_AGENT_SOLANA_SECRET_BASE58` not set | 1× 503 | Error handler |
-| 8 | `ZAUTH_API_KEY` not set causing 500s | 1954× | Fix or set env var |
-| 9 | Bonfida ESM bundling crash | 2× 500 | Pin/externalize dep |
-| 10 | UUID validation in permissions | 1× 500 | Input validation |
-| 11 | widget_views FK violation | 1× | Swallow FK errors |
-| 12 | `mocap/clips` `$1` syntax error persists | 2× 500 | Re-audit + redeploy |
-| 13 | `/api/agents/[id]/solana` 404 | 500× 404 | Route handler |
-| 14 | `/api/agent-strategy` missing | 2× 404 | Create handler |
-| 15 | Template literal in URL | 2× 404 | Frontend string fix |
-| 16 | x402 HEAD requests → 405 | 100× 405 | Add HEAD support |
-| 17-19 | Various 405 missing Allow header | 150+ | Method guards |
-| 20 | getLogs range >50 blocks | 7× | Reduce batch size |
-| 21 | Index fetch timeouts | 54× | AbortController |
-| 22 | tips-stream 300s timeout | 5× | SSE keep-alive + reconnect |
-| 23 | seed-default-agent flaps | 6× | Verify non-blocking |
-| 24 | Test UUID in production | 5× | Remove hardcoded UUID |
-| 25 | Malformed marketplace URL | 1× | Fix template literal |
diff --git a/api/_lib/migrations/2026-05-25-marketplace-and-social-tables.sql b/api/_lib/migrations/2026-05-25-marketplace-and-social-tables.sql
new file mode 100644
index 000000000..942a078ea
--- /dev/null
+++ b/api/_lib/migrations/2026-05-25-marketplace-and-social-tables.sql
@@ -0,0 +1,67 @@
+-- Migration: agent_reviews, x_triggers, x_scheduled_posts, x_pending_reviews
+-- Also: club_tips.amount_atomics column if missing
+-- All idempotent.
+
+BEGIN;
+
+-- ── agent_reviews — marketplace ratings and reviews ──────────────────────────
+CREATE TABLE IF NOT EXISTS agent_reviews (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ agent_id uuid NOT NULL REFERENCES agent_identities(id) ON DELETE CASCADE,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ rating int NOT NULL CHECK (rating BETWEEN 1 AND 5),
+ review text,
+ created_at timestamptz NOT NULL DEFAULT now(),
+ updated_at timestamptz NOT NULL DEFAULT now(),
+ UNIQUE (agent_id, user_id)
+);
+CREATE INDEX IF NOT EXISTS agent_reviews_agent_id ON agent_reviews(agent_id);
+CREATE INDEX IF NOT EXISTS agent_reviews_user_id ON agent_reviews(user_id);
+
+-- ── x_triggers — social automation triggers ───────────────────────────────────
+CREATE TABLE IF NOT EXISTS x_triggers (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
+ kind text NOT NULL,
+ config jsonb NOT NULL DEFAULT '{}',
+ auto_publish boolean NOT NULL DEFAULT false,
+ enabled boolean NOT NULL DEFAULT true,
+ last_fired_at timestamptz,
+ last_state jsonb,
+ created_at timestamptz NOT NULL DEFAULT now()
+);
+CREATE INDEX IF NOT EXISTS x_triggers_user_id ON x_triggers(user_id) WHERE enabled;
+CREATE INDEX IF NOT EXISTS x_triggers_agent_id ON x_triggers(agent_id) WHERE enabled;
+
+-- ── x_scheduled_posts — queued social posts ───────────────────────────────────
+CREATE TABLE IF NOT EXISTS x_scheduled_posts (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
+ text text NOT NULL,
+ scheduled_at timestamptz NOT NULL,
+ published_at timestamptz,
+ created_at timestamptz NOT NULL DEFAULT now()
+);
+CREATE INDEX IF NOT EXISTS x_scheduled_posts_pending
+ ON x_scheduled_posts(scheduled_at) WHERE published_at IS NULL;
+
+-- ── x_pending_reviews — posts awaiting human approval ─────────────────────────
+CREATE TABLE IF NOT EXISTS x_pending_reviews (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ trigger_id uuid REFERENCES x_triggers(id) ON DELETE SET NULL,
+ agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
+ text text NOT NULL,
+ reviewed_at timestamptz,
+ approved boolean,
+ created_at timestamptz NOT NULL DEFAULT now()
+);
+CREATE INDEX IF NOT EXISTS x_pending_reviews_user_pending
+ ON x_pending_reviews(user_id) WHERE reviewed_at IS NULL;
+
+-- ── club_tips — backfill amount_atomics if column absent ─────────────────────
+ALTER TABLE club_tips ADD COLUMN IF NOT EXISTS amount_atomics numeric;
+
+COMMIT;
diff --git a/api/_lib/schema.sql b/api/_lib/schema.sql
index e82e205d8..06e33dadb 100644
--- a/api/_lib/schema.sql
+++ b/api/_lib/schema.sql
@@ -1463,3 +1463,61 @@ CREATE TABLE IF NOT EXISTS bsc_consumed_tx (
-- BSC archive nodes if needed.
CREATE INDEX IF NOT EXISTS bsc_consumed_tx_consumed_at
ON bsc_consumed_tx (consumed_at);
+
+-- ── agent_reviews — marketplace ratings ─────────────────────────────────────
+CREATE TABLE IF NOT EXISTS agent_reviews (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ agent_id uuid NOT NULL REFERENCES agent_identities(id) ON DELETE CASCADE,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ rating int NOT NULL CHECK (rating BETWEEN 1 AND 5),
+ review text,
+ created_at timestamptz NOT NULL DEFAULT now(),
+ updated_at timestamptz NOT NULL DEFAULT now(),
+ UNIQUE (agent_id, user_id)
+);
+CREATE INDEX IF NOT EXISTS agent_reviews_agent_id ON agent_reviews(agent_id);
+CREATE INDEX IF NOT EXISTS agent_reviews_user_id ON agent_reviews(user_id);
+
+-- ── x_triggers / x_scheduled_posts / x_pending_reviews — social automation ──
+CREATE TABLE IF NOT EXISTS x_triggers (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
+ kind text NOT NULL,
+ config jsonb NOT NULL DEFAULT '{}',
+ auto_publish boolean NOT NULL DEFAULT false,
+ enabled boolean NOT NULL DEFAULT true,
+ last_fired_at timestamptz,
+ last_state jsonb,
+ created_at timestamptz NOT NULL DEFAULT now()
+);
+CREATE INDEX IF NOT EXISTS x_triggers_user_enabled ON x_triggers(user_id) WHERE enabled;
+CREATE INDEX IF NOT EXISTS x_triggers_agent_enabled ON x_triggers(agent_id) WHERE enabled;
+
+CREATE TABLE IF NOT EXISTS x_scheduled_posts (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
+ text text NOT NULL,
+ scheduled_at timestamptz NOT NULL,
+ published_at timestamptz,
+ created_at timestamptz NOT NULL DEFAULT now()
+);
+CREATE INDEX IF NOT EXISTS x_scheduled_posts_pending
+ ON x_scheduled_posts(scheduled_at) WHERE published_at IS NULL;
+
+CREATE TABLE IF NOT EXISTS x_pending_reviews (
+ id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ trigger_id uuid REFERENCES x_triggers(id) ON DELETE SET NULL,
+ agent_id uuid REFERENCES agent_identities(id) ON DELETE SET NULL,
+ text text NOT NULL,
+ reviewed_at timestamptz,
+ approved boolean,
+ created_at timestamptz NOT NULL DEFAULT now()
+);
+CREATE INDEX IF NOT EXISTS x_pending_reviews_user_pending
+ ON x_pending_reviews(user_id) WHERE reviewed_at IS NULL;
+
+-- ── club_tips — backfill amount_atomics ──────────────────────────────────────
+ALTER TABLE club_tips ADD COLUMN IF NOT EXISTS amount_atomics numeric;
diff --git a/api/_lib/x402/api-keys.js b/api/_lib/x402/api-keys.js
index 0e5c75863..974a2fc01 100644
--- a/api/_lib/x402/api-keys.js
+++ b/api/_lib/x402/api-keys.js
@@ -22,7 +22,11 @@ import { randomToken, sha256 } from '../crypto.js';
const KEY_PREFIX = 'x402_live_';
let _redis = null;
+const IS_PROD = process.env.VERCEL_ENV === 'production' || process.env.NODE_ENV === 'production';
+const ALLOW_MEMORY_FALLBACK = process.env.X402_ALLOW_MEMORY_FALLBACK === '1';
+
let _redisChecked = false;
+let _memoryFallbackWarned = false;
function getRedis() {
if (_redisChecked) return _redis;
_redisChecked = true;
@@ -31,6 +35,20 @@ function getRedis() {
url: env.UPSTASH_REDIS_REST_URL,
token: env.UPSTASH_REDIS_REST_TOKEN,
});
+ return _redis;
+ }
+ if (IS_PROD && !ALLOW_MEMORY_FALLBACK) {
+ throw new Error(
+ '[x402/api-keys] UPSTASH_REDIS_REST_URL/TOKEN required in production. ' +
+ 'Set them, or set X402_ALLOW_MEMORY_FALLBACK=1 to accept per-instance subscription rate-limits.',
+ );
+ }
+ if (IS_PROD && !_memoryFallbackWarned) {
+ _memoryFallbackWarned = true;
+ console.warn(
+ '[x402/api-keys] Running in production with memory rate-limit; ' +
+ 'subscription caps are per-instance only.',
+ );
}
return _redis;
}
diff --git a/public/footer.css b/public/footer.css
index 0519281bd..ce2f45407 100644
--- a/public/footer.css
+++ b/public/footer.css
@@ -461,6 +461,45 @@
50% { opacity: 0.55; box-shadow: 0 0 4px rgba(74, 222, 128, 0.35); }
}
+.h-footer-ca-wrap {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.h-footer-ca-label {
+ font-family: 'Inter', sans-serif;
+ font-size: 0.72rem;
+ font-weight: 600;
+ color: rgba(255, 255, 255, 0.55);
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+ flex-shrink: 0;
+}
+
+.h-footer-ca-btn {
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.09);
+ border-radius: 6px;
+ padding: 0.22rem 0.6rem;
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ font-size: 0.68rem;
+ color: rgba(255, 255, 255, 0.45);
+ cursor: pointer;
+ letter-spacing: 0.01em;
+ transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 26ch;
+}
+
+.h-footer-ca-btn:hover {
+ color: rgba(255, 255, 255, 0.85);
+ border-color: rgba(255, 255, 255, 0.2);
+ background: rgba(255, 255, 255, 0.07);
+}
+
.h-footer-horizon a:focus-visible {
outline: 2px solid #ffd76a;
outline-offset: 3px;
diff --git a/src/solana/sns-subdomain.js b/src/solana/sns-subdomain.js
index 0a7cfed27..3f4d1e252 100644
--- a/src/solana/sns-subdomain.js
+++ b/src/solana/sns-subdomain.js
@@ -19,7 +19,7 @@
*/
import { createHash } from 'node:crypto';
-import { Connection, Keypair, PublicKey, SystemProgram, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
+import { Connection, Keypair, PublicKey, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
import bs58 from 'bs58';
const DEFAULT_RPC_URL = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
diff --git a/vercel.json b/vercel.json
index f3795e2cf..7a74f4549 100644
--- a/vercel.json
+++ b/vercel.json
@@ -8,15 +8,15 @@
},
"functions": {
"api/club/tips-stream.js": {
- "includeFiles": "node_modules/@zauthx402/sdk/dist/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
+ "includeFiles": "node_modules/@zauthx402/sdk/dist/**,node_modules/@bonfida/spl-name-service/dist/esm/node_modules/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
"maxDuration": 300
},
"api/avatars/[id].js": {
- "includeFiles": "node_modules/@zauthx402/sdk/dist/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
+ "includeFiles": "node_modules/@zauthx402/sdk/dist/**,node_modules/@bonfida/spl-name-service/dist/esm/node_modules/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
"maxDuration": 300
},
"api/tts/speak.js": {
- "includeFiles": "node_modules/@zauthx402/sdk/dist/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
+ "includeFiles": "node_modules/@zauthx402/sdk/dist/**,node_modules/@bonfida/spl-name-service/dist/esm/node_modules/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
"maxDuration": 60
},
"api/**/*.js": {
diff --git a/vite.config.js b/vite.config.js
index 379907913..1a12b0094 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -808,23 +808,83 @@ const appConfig = {
registerType: 'autoUpdate',
includeAssets: ['favicon.ico', 'pwa-192x192.png', 'pwa-512x512.png', 'pwa-icon.svg'],
manifest: {
- name: 'three.ws — AI-Powered 3D Model Viewer',
+ name: 'three.ws — Give Your AI a Body',
short_name: 'three.ws',
description:
- 'Drag and drop glTF, GLB, and 3D files to preview instantly in your browser.',
+ 'Create 3D AI agents, give them a voice and body, trade them on-chain, and embed them anywhere. The 3D layer for the agentic web.',
+ lang: 'en',
+ dir: 'ltr',
theme_color: '#000000',
background_color: '#080814',
display: 'standalone',
+ display_override: ['window-controls-overlay', 'standalone', 'browser'],
+ orientation: 'natural',
scope: '/',
- start_url: '/',
+ start_url: '/?source=pwa',
+ categories: ['productivity', 'entertainment', 'social', 'utilities'],
icons: [
- { src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
- { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
+ { src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
+ { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
+ { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
+ ],
+ shortcuts: [
+ {
+ name: 'Create Avatar',
+ short_name: 'Create',
+ description: 'Build a new 3D AI avatar',
+ url: '/create?source=pwa-shortcut',
+ icons: [{ src: 'pwa-192x192.png', sizes: '192x192' }],
+ },
+ {
+ name: 'Marketplace',
+ short_name: 'Discover',
+ description: 'Browse AI agents and avatars',
+ url: '/marketplace?source=pwa-shortcut',
+ icons: [{ src: 'pwa-192x192.png', sizes: '192x192' }],
+ },
+ {
+ name: 'My Agents',
+ short_name: 'My Agents',
+ description: 'Manage your AI agents',
+ url: '/agent-home?source=pwa-shortcut',
+ icons: [{ src: 'pwa-192x192.png', sizes: '192x192' }],
+ },
+ ],
+ screenshots: [
+ {
+ src: 'screenshots/landing.png',
+ sizes: '1280x800',
+ type: 'image/png',
+ form_factor: 'wide',
+ label: 'three.ws home — Give Your AI a Body',
+ },
{
- src: 'pwa-512x512.png',
- sizes: '512x512',
+ src: 'screenshots/create.png',
+ sizes: '1280x800',
type: 'image/png',
- purpose: 'any maskable',
+ form_factor: 'wide',
+ label: 'Create a 3D avatar',
+ },
+ {
+ src: 'screenshots/discover.png',
+ sizes: '1280x800',
+ type: 'image/png',
+ form_factor: 'wide',
+ label: 'Discover AI agents on the marketplace',
+ },
+ {
+ src: 'screenshots/studio.png',
+ sizes: '1280x800',
+ type: 'image/png',
+ form_factor: 'wide',
+ label: 'Agent studio and customization',
+ },
+ {
+ src: 'screenshots/features.png',
+ sizes: '1280x800',
+ type: 'image/png',
+ form_factor: 'wide',
+ label: 'Platform features overview',
},
],
},
@@ -843,7 +903,8 @@ const appConfig = {
'**/ddd.png',
'chat/**',
],
- navigateFallback: null,
+ navigateFallback: '/offline.html',
+ navigateFallbackDenylist: [/^\/api\//, /^\/chat\//],
skipWaiting: true,
clientsClaim: true,
cleanupOutdatedCaches: true,
@@ -866,6 +927,10 @@ const appConfig = {
cacheableResponse: { statuses: [0, 200] },
},
},
+ {
+ urlPattern: /^https:\/\/three\.ws\/api\/.*/i,
+ handler: 'NetworkOnly',
+ },
],
},
}),