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(oracle): reject an unknown sizing rule instead of silently replaying a fixed one
nirholas36fe98ae58a2
diff --git a/api/oracle/leaderboard.js b/api/oracle/leaderboard.jsindex ed997d106..84180b5c7 100644--- a/api/oracle/leaderboard.js+++ b/api/oracle/leaderboard.js@@ -11,13 +11,19 @@* Cache: 120s public CDN.*/-import { cors, json, method, rateLimited } from '../_lib/http.js';+import { cors, json, method, wrap, rateLimited } from '../_lib/http.js';import { limits, clientIp } from '../_lib/rate-limit.js';import { sql } from '../_lib/db.js';const NETWORKS = new Set(['mainnet', 'devnet']);-export default async function handleOracleLeaderboard(req, res) {+/** parseInt that never leaks NaN into a bound query parameter. */+function intParam(raw, fallback, min, max) {+ const n = parseInt(raw ?? '', 10);+ return Math.min(max, Math.max(min, Number.isFinite(n) ? n : fallback));+}++export default wrap(async function handleOracleLeaderboard(req, res) {if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;if (!method(req, res, ['GET'])) return;@@ -27,17 +33,21 @@ export default async function handleOracleLeaderboard(req, res) {const params = new URL(req.url, 'http://x').searchParams;const network = NETWORKS.has(params.get('network')) ? params.get('network') : 'mainnet';- const limit = Math.min(50, Math.max(1, parseInt(params.get('limit') || '20', 10)));- const minActions = Math.max(1, parseInt(params.get('min_actions') || '3', 10));+ const limit = intParam(params.get('limit'), 20, 1, 50);+ const minActions = intParam(params.get('min_actions'), 3, 1, 1000);// Aggregate per agent: count wins, losses, open, realized PnL, total size.- // Join agent_identities for display fields. Filter to agents with enough- // resolved actions to trust the win rate.+ // Join agent_identities for display fields (its portrait lives in+ // profile_image_url, with avatar_url as the fallback — there is no+ // image_url column, and selecting one returned an empty board on every+ // request). Filter to agents with enough resolved actions to trust the+ // win rate. No .catch() swallow here: this query IS the response, so an+ // empty array must mean "nobody qualifies", never "the query broke".const rows = await sql`selecta.agent_id,i.name as agent_name,- i.image_url as agent_image,+ coalesce(i.profile_image_url, i.avatar_url) as agent_image,count(*)::int as total,count(*) filter (where a.outcome = 'win')::int as wins,count(*) filter (where a.outcome = 'loss')::int as losses,@@ -45,9 +55,9 @@ export default async function handleOracleLeaderboard(req, res) {coalesce(sum(a.realized_pnl_sol), 0)::float as realized_pnl_sol,coalesce(sum(a.size_sol), 0)::float as deployed_solfrom oracle_watch_actions a- left join agent_identities i on i.id = a.agent_id+ left join agent_identities i on i.id = a.agent_id and i.deleted_at is nullwhere a.network = ${network}- group by a.agent_id, i.name, i.image_url+ group by a.agent_id, i.name, i.profile_image_url, i.avatar_urlhaving count(*) filter (where a.outcome in ('win','loss')) >= ${minActions}order byround(@@ -56,7 +66,7 @@ export default async function handleOracleLeaderboard(req, res) {) desc nulls last,count(*) desclimit ${limit}- `.catch(() => []);+ `;const agents = rows.map((r, idx) => {const resolved = r.wins + r.losses;@@ -85,4 +95,4 @@ export default async function handleOracleLeaderboard(req, res) {min_actions: minActions,agents,}, { 'cache-control': 'public, max-age=120, s-maxage=120' });-}+});diff --git a/docs/oracle.md b/docs/oracle.mdindex e9139c05c..1e23a85a4 100644--- a/docs/oracle.md+++ b/docs/oracle.md@@ -260,9 +260,10 @@ GET https://three.ws/api/oracle/trades?mint=<mint>- Conviction for up to 20 mints at once at `/api/oracle/batch`.- Score time series at `/api/oracle/history`, biggest conviction moves at `/api/oracle/movers`, accuracy stats at `/api/oracle/backtest`, proven calls at `/api/oracle/wins`, agent rankings at `/api/oracle/leaderboard`.- Global KPIs, per-category intel, symbol search, a single agent's record, and the global action feed at `/api/oracle/stats`, `/categories`, `/search`, `/agent-stats`, and `/activity`.+- Realized calibration per conviction band at `/api/oracle/calibration`: the fleet's actual win rate from real fills, next to what the band predicted, plus the bounded correction factor the scorer applies.- A dynamic 1200x630 OpenGraph conviction card (SVG) for sharing a coin at `/api/oracle/og`.-The write endpoints, all auth-scoped: `GET·POST /api/oracle/watch` reads or arms an agent's watch config with server-side validation clamping every limit; `POST·DELETE /api/oracle/follow` subscribes a Telegram chat to an agent's signals; `POST /api/oracle/test-alert` sends a test alert; `POST /api/oracle/social` ingests tweets to additively boost virality (never downgrades an LLM read).+The write endpoints. Two are auth-scoped to the agent's owner: `GET·POST /api/oracle/watch` reads or arms an agent's watch config with server-side validation clamping every limit, and `POST /api/oracle/test-alert` sends a test alert. Two are public and IP rate-limited instead: `POST·DELETE /api/oracle/follow` subscribes a Telegram chat to an agent's signals (the chat id the caller supplies is the identity, so there is no session to scope to), and `POST /api/oracle/social` ingests tweets to additively boost virality (never downgrades an LLM read).### Through MCP