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
feat(execution): refine landing race and engine, extend destination whitelist, approvals, notify prefs and rate limits, with tests
nirholas6666b1cad0b5
diff --git a/api/_lib/execution-engine.js b/api/_lib/execution-engine.jsindex d69b7d4e3..e369a1372 100644--- a/api/_lib/execution-engine.js+++ b/api/_lib/execution-engine.js@@ -308,7 +308,7 @@ async function fetchJitoTipFloorLamports() {// Resolve the tip for this attempt: max(mode floor, live tip-floor) scaled by the// mode multiplier and the attempt index, hard-capped by the mode ceiling.-function resolveTipLamports(tipMode, tipFloorLamports, attempt, maxTipLamports = null) {+export function resolveTipLamports(tipMode, tipFloorLamports, attempt, maxTipLamports = null) {const profile = TIP_PROFILE[tipMode];if (!profile) return 0n;const base = tipFloorLamports != null && tipFloorLamports > profile.floor ? tipFloorLamports : profile.floor;diff --git a/api/_lib/notify-prefs.js b/api/_lib/notify-prefs.jsindex 083117637..a8d9e2086 100644--- a/api/_lib/notify-prefs.js+++ b/api/_lib/notify-prefs.js@@ -117,6 +117,9 @@ const TYPE_CATEGORY = {'payment-earned': 'sales',payment_received: 'sales',referral_earned: 'sales',+ creator_payout_sent: 'sales',+ creator_payout_held: 'sales',+ creator_payout_wallet: 'account',referral_signup: 'sales',referral_reward: 'sales',pump_launch_filled: 'sales',@@ -378,6 +381,9 @@ const PUSH_COPY = {forge_complete: (p) => ['Your 3D model is ready ✨', p.prompt ? `"${String(p.prompt).slice(0, 80)}" finished generating` : 'Your generation finished. Tap to view it'],forge_failed: (p) => ['Generation failed ⚠️', p.prompt ? `"${String(p.prompt).slice(0, 80)}" could not be generated. Tap to retry` : 'A generation could not be completed. Tap to retry'],withdrawal_completed: () => ['Withdrawal complete ✅', 'Your withdrawal has been sent'],+ creator_payout_sent: (p) => ['Creator fees sent', p.message || 'Your creator-fee share was sent to your payout wallet'],+ creator_payout_held: (p) => ['Creator fees held', p.message || 'A creator-fee share is held. Open your payouts page to see why'],+ creator_payout_wallet: (p) => ['Payout wallet changed', p.message || 'The payout wallet for your creator fees changed'],labor_escrow_update: (p) => [p.title || 'Escrow update', p.message || 'A bounty escrow changed state'],labor_deadline_soon: (p) => [p.title || 'Deadline approaching', p.message || 'A bounty deadline is close'],labor_payout_delayed: (p) => [p.title || 'Payout delayed', p.message || 'An escrow payout is delayed and will retry'],diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.jsindex c77e1b96b..500ebdb1c 100644--- a/api/_lib/rate-limit.js+++ b/api/_lib/rate-limit.js@@ -2405,6 +2405,8 @@ export const limits = {whitelistUser: (userId) => getLimiter('whitelist:user', { limit: 120, window: '5 m' }).limit(userId),whitelistStepUp: (userId) => getLimiter('whitelist:stepup', { limit: 10, window: '10 m' }).limit(userId),whitelistCancelIp: (ip) => getLimiter('whitelist:cancel-ip', { limit: 30, window: '10 m' }).limit(ip),+ creatorPayoutUser: (userId) => getLimiter('creator-payout:user', { limit: 120, window: '5 m' }).limit(userId),+ creatorPayoutInfoIp: (ip) => getLimiter('creator-payout:info-ip', { limit: 60, window: '1 m' }).limit(ip),// Agent self-signup (api/v1/agents/signup.js). Creating an account mints// wallets, so both lanes are tight and fail closed when Redis is down: a// per-IP lane against one host spraying keys, and a per-public-key lanediff --git a/tests/landing-race.test.js b/tests/landing-race.test.jsindex 741f64363..139892f33 100644--- a/tests/landing-race.test.js+++ b/tests/landing-race.test.js@@ -8,7 +8,7 @@ import { Connection, Keypair, SystemProgram, VersionedTransaction } from '@solanimport { PGlite } from '@electric-sql/pglite';import { readFileSync } from 'node:fs';import bs58 from 'bs58';-import { submitProtected } from '../api/_lib/execution-engine.js';+import { resolveTipLamports, submitProtected } from '../api/_lib/execution-engine.js';import {LandingStats,createSqlStatsStore,@@ -223,7 +223,7 @@ describe('submitProtected through the landing race', () => {it('reports a single landing from the faster extra provider while the slow primary is outpaced', async () => {const { result, primaryNode, extraNode } = await engineRun({- primary: { delayMs: 900, landOnSend: false },+ primary: { delayMs: 300, landOnSend: false },extra: {},});console.log('ENGINE', JSON.stringify({ route: result.route, landedBy: result.landedBy, lanes: result.lanes }));@@ -234,3 +234,16 @@ describe('submitProtected through the landing race', () => {expect(result.signature).toMatch(/^[1-9A-HJ-NP-Za-km-z]{80,90}$/);});});++describe('per-trade tip ceiling', () => {+ it('clamps every mode and attempt to the ceiling, and never exceeds the mode ceiling without one', () => {+ for (const mode of ['economy', 'turbo']) {+ for (let attempt = 0; attempt < 3; attempt++) {+ expect(resolveTipLamports(mode, 400_000n, attempt, 50_000n)).toBeLessThanOrEqual(50_000n);+ }+ }+ expect(resolveTipLamports('turbo', 10_000_000n, 2)).toBe(5_000_000n);+ expect(resolveTipLamports('economy', null, 0, 20_000n)).toBe(15_000n);+ expect(resolveTipLamports('economy', null, 0, 5_000n)).toBe(5_000n);+ });+});