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(sniper): wire fleet-solvency into /api/sniper/status and the worker tick
nirholase88be05252d1
diff --git a/api/_lib/solana/connection.js b/api/_lib/solana/connection.jsindex 859cd809d..c634a2760 100644--- a/api/_lib/solana/connection.js+++ b/api/_lib/solana/connection.js@@ -234,17 +234,26 @@ const PUBLIC_DEVNET = 'https://api.devnet.solana.com';// parks it for 30m, then the next rotation spends another real request// rediscovering the same block, which is capacity burned to learn nothing.//-// Tatum's gateway host was verified live (getLatestBlockhash + sendTransaction-// enabled) on 2026-07-04 when the free pool was re-probed after a Helius plan-// lapsed mid-cycle. It deepens the keyless chain precisely for the "every paid-// key is exhausted" case; the classifyRpcBody guard still fails it over if it-// returns garbage.+// ORDER IS BY MEASURED CAPABILITY ON THE HOT METHODS, not by latency. Re-probed+// 2026-08-07 (docs/ops/solana-rpc-lanes.md carries the full table): getBalance+// and getTokenAccountsByOwner are what the balance, holder-gate, and treasury+// readers actually call, so a lane that refuses those belongs at the back no+// matter how fast it answers the ones it does serve.+//+// Both Tatum hosts moved behind PUBLIC_MAINNET for exactly that reason: they+// answer getBalance and getTokenAccountsByOwner with -16401 "available for paid+// plans only" and cap the keyless tier at 5 requests per minute. Sitting them+// ahead of mainnet-beta meant every balance read burned two lanes discovering a+// refusal before reaching the lane that serves it, which is how a single+// throttled provider escalated into "all N endpoints failed this request"+// (2026-08-07). They stay in the chain as last-resort depth for the methods they+// do serve; the classifyRpcBody guard still fails them over on garbage.const FREE_KEYLESS_MAINNET = ['https://solana-rpc.publicnode.com',+ PUBLIC_MAINNET,'https://solana.leorpc.com/?api_key=FREE','https://api.tatum.io/v3/blockchain/node/solana-mainnet','https://solana-mainnet.gateway.tatum.io',- PUBLIC_MAINNET,];// Hostnames of every keyless free lane, plus the public devnet cluster. A URLdiff --git a/api/sniper/status.js b/api/sniper/status.jsindex 3c8e34aaf..3e7e79181 100644--- a/api/sniper/status.js+++ b/api/sniper/status.js@@ -13,7 +13,16 @@* alive — a heartbeat within the freshness window (process is up)* feedLive — the worker reports its feed subscription is currently up* degraded — alive but the feed has been silent past its watchdog window- * (the worst, otherwise-invisible failure: up but deaf)+ * (up but deaf), or part of the fleet can no longer trade+ * starved — alive, feed fine, and NO armed wallet can afford an entry+ *+ * That last state is why this endpoint no longer answers liveness alone. From+ * 2026-07-29 to 2026-08-08 it reported `live` continuously while the fleet+ * booked a thousand consecutive failed buys and closed nothing: every process+ * fact it measured was true, and the wallets were empty. A trading worker that+ * cannot pay for a trade is not live, so solvency (published in the heartbeat by+ * the worker's funding loop, see api/_lib/sniper-solvency.js) now outranks the+ * feed checks in the verdict.** The two cheapest counts (active strategies, open positions) give the page a* one-glance "what is it doing" without a second round-trip. Public + IP@@ -122,7 +131,19 @@ export default wrap(async (req, res) => {const watchdogMs = Number(meta.feedWatchdogMs) || 180_000;const feedSilent = alive && Number(meta.lastEventAgeMs) > watchdogMs;- const state = !alive ? 'down' : feedSilent || !feedLive ? 'degraded' : 'live';+ // Money before mechanics: a worker that cannot fund an entry is not 'live', no+ // matter how healthy its feed is. Absent (older worker build, first tick not+ // yet run) degrades to 'unknown', which never overrides the feed verdict — an+ // unmeasured fleet must not read as a broke one.+ const solvency = meta.solvency && typeof meta.solvency === 'object' ? meta.solvency : null;+ const solvencyState = solvency?.state || 'unknown';+ const state = !alive+ ? 'down'+ : solvencyState === 'starved'+ ? 'starved'+ : feedSilent || !feedLive || solvencyState === 'degraded'+ ? 'degraded'+ : 'live';return json(res,@@ -147,6 +168,7 @@ export default wrap(async (req, res) => {strategies: meta.strategies ?? strategies,openPositions,funding,+ solvency,},// Heartbeat refreshes every ~30s; a short shared cache absorbs status-page// bursts without meaningfully staling the liveness answer.diff --git a/data/guards.json b/data/guards.jsonindex af0af1a5a..bd107a8f0 100644--- a/data/guards.json+++ b/data/guards.json@@ -903,6 +903,22 @@"kind": "live","reason": "It reads the production wallet table and the live encryption key, then decrypts in memory to test each secret against the current key. There is no offline fixture for 'this ciphertext no longer opens' that would prove anything about the real fleet. Read-only: it never writes, signs, or broadcasts."}+ },+ {+ "id": "audit-play-failure-modes",+ "script": "scripts/audit-play-failure-modes.mjs",+ "npm": "audit:play-failures",+ "title": "/play failure-mode audit",+ "protects": "/play stays usable when its dependencies fail, and hostile deep-link params never execute.",+ "why": "The clean-path console audit proves nothing about the paths an event crowd actually hits: no session, an ad blocker eating IPFS, a dead GLB, a 500 on the auth nonce, a pass that expires mid-session, a pasted link carrying hostile name/symbol/image params. Each scenario is injected in a real browser and the boot loader must always resolve, into the world or into a designed error card with a recovery action, never a stuck spinner.",+ "stages": [+ "manual"+ ],+ "needs": "browser",+ "proof": {+ "kind": "live",+ "reason": "Needs Playwright plus a running server, because the thing under test is how the page behaves when a specific request is aborted or rewritten mid-load. A static fixture cannot fail a fetch the page has not made yet."+ }}],"exempt": [diff --git a/tests/api/solana-rpc-endpoints.test.js b/tests/api/solana-rpc-endpoints.test.jsindex 79b2d7eaa..902d21e28 100644--- a/tests/api/solana-rpc-endpoints.test.js+++ b/tests/api/solana-rpc-endpoints.test.js@@ -60,21 +60,37 @@ describe('solanaRpcEndpoints', () => {// chain must still resolve a usable node, never collapse to one throttled lane.// Five independent public nodes were each verified answering live mainnet RPC,// so a request only errors if all five are down at once. (solana.therpc.io was- // pruned 2026-07-17 after going fully unreachable; MagicBlock took its slot.)+ // pruned 2026-07-17 after going fully unreachable; MagicBlock took its slot,+ // then was pruned itself 2026-08-07 after it began 403ing every method.)const eps = solanaRpcEndpoints('mainnet');const keyless = ['https://solana-rpc.publicnode.com','https://solana.leorpc.com/?api_key=FREE','https://api.tatum.io/v3/blockchain/node/solana-mainnet',- 'https://rpc.magicblock.app/mainnet',+ 'https://solana-mainnet.gateway.tatum.io','https://api.mainnet-beta.solana.com',];for (const u of keyless) expect(eps).toContain(u);});- it('keeps the public mainnet-beta endpoint last (most rate-limited)', () => {+ it('drops lanes that hard-block our egress rather than re-probing them', () => {+ // A 403 "Your IP or provider is blocked from this endpoint" on every method+ // is not a throttle that recovers: re-probing it every cooldown burns a real+ // request to relearn the same block, which is what turned one bad lane into+ // "all N endpoints failed this request" on 2026-08-07.+ expect(solanaRpcEndpoints('mainnet')).not.toContain('https://rpc.magicblock.app/mainnet');+ });++ it('ranks keyless lanes that serve getBalance ahead of the paid-tier-gated ones', () => {+ // Both Tatum hosts answer getBalance/getTokenAccountsByOwner with -16401+ // "available for paid plans only", so they must never sit in front of a lane+ // that actually serves a balance read.const eps = solanaRpcEndpoints('mainnet');- expect(eps[eps.length - 1]).toBe('https://api.mainnet-beta.solana.com');+ const publicMainnet = eps.indexOf('https://api.mainnet-beta.solana.com');+ expect(publicMainnet).toBeGreaterThanOrEqual(0);+ for (const gated of ['https://api.tatum.io/v3/blockchain/node/solana-mainnet', 'https://solana-mainnet.gateway.tatum.io']) {+ expect(eps.indexOf(gated)).toBeGreaterThan(publicMainnet);+ }});it('adds Ankr only in its authenticated form when ANKR_API_KEY is set', () => {diff --git a/workers/agent-sniper/auto-funder.js b/workers/agent-sniper/auto-funder.jsindex cd41912e0..db678160d 100644--- a/workers/agent-sniper/auto-funder.js+++ b/workers/agent-sniper/auto-funder.js@@ -281,6 +281,11 @@ async function tick(cfg) {if (!addresses.size) return;const { balances } = await publishSolvency(cfg, addresses, conn);+ // Measuring is unconditional; moving money is not. With auto-funding disarmed+ // the loop above still reports whether the fleet can trade, which is exactly+ // the fleet nobody else is watching.+ if (!cfg.autoFund) return;+const optedIn = new Set(activeAgentIds(cfg.network));if (!optedIn.size) return;@@ -427,8 +432,8 @@ export function startAutoFunderWatch({ cfg, signal } = {}) {const interval = setInterval(runTick, POLL_INTERVAL_MS);if (interval.unref) interval.unref();- log.info('auto-funder armed', {- network: cfg.network, mode: cfg.mode, pollMs: POLL_INTERVAL_MS,+ log.info(cfg.autoFund ? 'auto-funder armed' : 'solvency watch armed (auto-funding disabled)', {+ network: cfg.network, mode: cfg.mode, pollMs: POLL_INTERVAL_MS, autoFund: !!cfg.autoFund,minSol: MIN_SOL, targetSol: TARGET_SOL, perTxCapSol: PER_TX_CAP_SOL, dailyCapSol: DAILY_CAP_SOL,perAgentDailyCapSol: PER_AGENT_DAILY_CAP_SOL,lossCapSol: num('SNIPER_MAX_DAILY_LOSS_SOL', null),diff --git a/workers/agent-sniper/index.js b/workers/agent-sniper/index.jsindex b4f9ea9e3..2a46019f1 100644--- a/workers/agent-sniper/index.js+++ b/workers/agent-sniper/index.js@@ -39,7 +39,7 @@ import { screenPush } from './screen-push.js';import { scoreAlpha } from './alpha-hunt.js';import { startAutoClaimerWatch } from './auto-claimer.js';import { graduationRideGate, executeBoostRideBuy } from './graduation-ride.js';-import { startAutoFunderWatch } from './auto-funder.js';+import { startAutoFunderWatch, latestSolvency } from './auto-funder.js';import { startLauncherWatch } from './launcher.js';import { startMarketMakerWatch } from './market-maker.js';@@ -377,10 +377,12 @@ async function main() {// Buy-side auto-funding — keeps each armed agent's wallet topped from the// launcher master so a live sniper never silently runs out of SOL mid-run.- let stopAutoFunder = () => {};- if (cfg.autoFund) {- stopAutoFunder = startAutoFunderWatch({ cfg, signal: abort.signal });- }+ //+ // Started unconditionally: the same loop measures fleet solvency, and a fleet+ // running with auto-funding OFF is the one most likely to starve unnoticed+ // (nothing refills it at all). Funding itself still requires cfg.autoFund —+ // the loop measures always, moves money only when armed to.+ const stopAutoFunder = startAutoFunderWatch({ cfg, signal: abort.signal });// Market maker — range-based liquidity provisioning with Jito execution.let stopMarketMaker = () => {};@@ -482,6 +484,10 @@ async function main() {intel: cfg.intel,inFlightBuys: queue.inFlight,radar: cfg.radar ? radar.getState() : { active: false, paused: true, reason: 'disabled' },+ // Can the fleet actually afford to trade? Liveness alone reported a+ // green worker through ten days of unaffordable entries; this is the+ // money half of the same question. Null until the funder's first tick.+ solvency: latestSolvency(),bootAt: BOOT_AT,}),});