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(mirror): stop self-follows from inflating a leader's public follower count
nirholas0326cb0aa6b1
diff --git a/api/_lib/meta-allocator.js b/api/_lib/meta-allocator.jsindex 0807dff49..02195f99f 100644--- a/api/_lib/meta-allocator.js+++ b/api/_lib/meta-allocator.js@@ -77,11 +77,15 @@ export async function gatherLeaders(network = 'mainnet', { limit = 200 } = {}) {max(closed_at) as last_closed_atfrom closed group by agent_id),+ -- Self-follows excluded, same as the mirror leaderboard: an owner's own+ -- mirror edges must not weight this allocator's view of a leader.followers as (- select leader_agent_id as agent_id,+ select f.leader_agent_id as agent_id,count(*)::int as followers,- count(*) filter (where enabled)::int as active_followers- from agent_mirror_follows where network = ${network} group by leader_agent_id+ count(*) filter (where f.enabled)::int as active_followers+ from agent_mirror_follows f+ join agent_identities la on la.id = f.leader_agent_id and la.user_id <> f.owner_user_id+ where f.network = ${network} group by f.leader_agent_id)select a.id, a.name, a.avatar_url, a.profile_image_url,g.settled, g.wins, g.pnl_lamports, g.entry_lamports, g.avg_entry_lamports,diff --git a/api/_lib/mirror-stats.js b/api/_lib/mirror-stats.jsindex 50fa83b09..4ca733a2a 100644--- a/api/_lib/mirror-stats.js+++ b/api/_lib/mirror-stats.js@@ -44,11 +44,15 @@ export async function leaderTrackRecord(agentId, network = 'mainnet') {where agent_id = ${agentId} and network = ${network}and category = 'trade' and status in ('confirmed', 'ok')`.catch(() => [{}]),+ // Self-follows are excluded: an owner pointing their own agents at this one+ // is legitimate, but it must not inflate the public follower count that the+ // leaderboard score and the Trader Card both read as social proof.sql`select count(*)::int as total,- count(*) filter (where enabled = true)::int as active- from agent_mirror_follows- where leader_agent_id = ${agentId} and network = ${network}+ count(*) filter (where f.enabled = true)::int as active+ from agent_mirror_follows f+ join agent_identities la on la.id = f.leader_agent_id and la.user_id <> f.owner_user_id+ where f.leader_agent_id = ${agentId} and f.network = ${network}`.catch(() => [{ total: 0, active: 0 }]),]);@@ -116,11 +120,12 @@ export async function leaderTrackRecord(agentId, network = 'mainnet') {export async function followCounts(agentIds, network = 'mainnet') {if (!Array.isArray(agentIds) || agentIds.length === 0) return new Map();const rows = await sql`- select leader_agent_id as id, count(*)::int as followers,- count(*) filter (where enabled = true)::int as active_followers- from agent_mirror_follows- where leader_agent_id = any(${agentIds}) and network = ${network}- group by leader_agent_id+ select f.leader_agent_id as id, count(*)::int as followers,+ count(*) filter (where f.enabled = true)::int as active_followers+ from agent_mirror_follows f+ join agent_identities la on la.id = f.leader_agent_id and la.user_id <> f.owner_user_id+ where f.leader_agent_id = any(${agentIds}) and f.network = ${network}+ group by f.leader_agent_id`.catch(() => []);const m = new Map();for (const r of rows) m.set(r.id, { followers: Number(r.followers), active: Number(r.active_followers) });diff --git a/api/mirror/leaderboard.js b/api/mirror/leaderboard.jsindex a46ca8b32..7d380dd6e 100644--- a/api/mirror/leaderboard.js+++ b/api/mirror/leaderboard.js@@ -68,13 +68,19 @@ export default wrap(async function handler(req, res) {WHERE network = ${network} AND category = 'trade' AND status IN ('confirmed','ok')GROUP BY agent_id),+ -- Followers exclude self-follows: an owner mirroring between two agents they+ -- both own is a legitimate strategy, but counting it here let anyone buy up+ -- to 20 points of composite score (the follower nudge in rankLeaders) by+ -- creating agents and pointing them at themselves. The edge still works and+ -- still shows on the owner's own dashboard; it just no longer buys rank.followers AS (- SELECT leader_agent_id AS agent_id,+ SELECT f.leader_agent_id AS agent_id,count(*)::int AS followers,- count(*) FILTER (WHERE enabled)::int AS active_followers- FROM agent_mirror_follows- WHERE network = ${network}- GROUP BY leader_agent_id+ count(*) FILTER (WHERE f.enabled)::int AS active_followers+ FROM agent_mirror_follows f+ JOIN agent_identities la ON la.id = f.leader_agent_id AND la.user_id <> f.owner_user_id+ WHERE f.network = ${network}+ GROUP BY f.leader_agent_id)SELECT a.id, a.name, a.avatar_url, a.profile_image_url,COALESCE(c.settled, 0) AS settled, COALESCE(c.wins, 0) AS wins,