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(pump/intel): make the feed's verdict filter and search see past page one
nirholasd0fecb77638d
diff --git a/api/pump/dex-trades.js b/api/pump/dex-trades.jsindex 76a715a4b..f52b09c5d 100644--- a/api/pump/dex-trades.js+++ b/api/pump/dex-trades.js@@ -141,7 +141,11 @@ export function normalizeGtTrade(t, mint) {}export default wrap(async (req, res) => {- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;+ // Keyless public tape, same as every sibling pump read (intel, launch-detail,+ // ghost-copy, helius-stats): any origin may consume it. Without `origins: '*'`+ // a cross-origin agent got the response with no allow-origin header and the+ // browser dropped it, for data that needs no account and carries no secret.+ if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;if (!method(req, res, ['GET'])) return;const u = new URL(req.url, 'http://x');diff --git a/api/pump/intel-enrich.js b/api/pump/intel-enrich.jsindex 12965feb4..5db4854af 100644--- a/api/pump/intel-enrich.js+++ b/api/pump/intel-enrich.js@@ -73,6 +73,9 @@ export default wrap(async (req, res) => {`;mints = rows.map((r) => r.mint);} catch (err) {+ // The caller still gets a clean 503, but swallowing the cause left no way+ // to tell "the intel store is down" from "nothing to enrich" in the logs.+ console.error('[pump/intel-enrich] backfill query failed:', err?.message || err);return error(res, 503, 'intel_unavailable', 'intel store is temporarily unavailable');}if (!mints.length) {diff --git a/api/pump/intel.js b/api/pump/intel.jsindex 3a7487350..a9b076dfd 100644--- a/api/pump/intel.js+++ b/api/pump/intel.js@@ -13,6 +13,7 @@// ?view=feed recent observed coins, newest first (filters: category, minQuality, verdict, q)// ?view=leaderboard highest-quality recent coins + confirmed winners (graduated/pumped)// ?view=learning learned per-signal weights + outcome distribution (what the model learned)+// ?view=traders cross-coin wallet reputation: who trades these launches, and how well//// Public, cacheable briefly. No auth: this is read-only market intelligence.// Degrades gracefully (200 with degraded:true) if the engine tables don't exist@@ -253,25 +254,36 @@ async function getCoin(mint, network) {}// ── recent feed (the live radar) ─────────────────────────────────────────────+// How deep to look when a filter can only be evaluated after a row is shaped.+// `verdict` is derived in JS from quality_score + risk_flags, so it can't be a+// WHERE clause; filtering only the newest `limit` rows made ?verdict=strong+// &limit=60 answer with a single coin on a busy feed, which reads as "the engine+// found nothing" rather than "you were shown page one". Scan a wider recent+// window, then slice to the requested page after the filter.+const FEED_SCAN_CAP = 600;+// Escape the LIKE metacharacters so a caller searching for "100%" or "a_b" gets+// those literal strings back instead of a wildcard match. Postgres' default+// LIKE escape character is the backslash.+const likeNeedle = (s) => `%${s.replace(/[\\%_]/g, (ch) => `\\${ch}`)}%`;+async function getFeed({ network, limit, category, minQuality, verdict, q }) {const cap = Math.max(1, Math.min(120, limit || 60));+ // `q` IS expressible in SQL, so push it down rather than post-filtering: a+ // search has to reach the whole observed feed, not only its newest page.+ const needle = q ? likeNeedle(q) : null;+ const scan = verdict ? Math.min(FEED_SCAN_CAP, cap * 8) : cap;const rows = await coinSql`where network = ${network}and (${category}::text is null or category = ${category})and (${minQuality}::int is null or quality_score >= ${minQuality})+ and (${needle}::text is null+ or name ilike ${needle} or symbol ilike ${needle} or mint ilike ${needle})order by first_seen_at desc- limit ${cap}+ limit ${scan}`;let coins = rows.map(shapeCoin);if (verdict) coins = coins.filter((c) => c.verdict.key === verdict);- if (q) {- const needle = q.toLowerCase();- coins = coins.filter((c) =>- (c.name || '').toLowerCase().includes(needle) ||- (c.symbol || '').toLowerCase().includes(needle) ||- (c.mint || '').toLowerCase().includes(needle));- }- return { coins };+ return { coins: coins.slice(0, cap) };}// ── leaderboard: best-quality recent + confirmed winners ─────────────────────@@ -299,8 +311,10 @@ async function getLeaderboard({ network, limit }) {// ── traders: classify external wallets across every observed coin ────────────// Aggregates the per-coin wallet ledger into a cross-coin reputation per trader,-// then labels it. win_rate is real: of the coins this wallet bought, the share-// that graduated or pumped (only counted once ≥3 of its coins are labeled).+// then labels it. win_rate is real: of this wallet's coins that the engine has+// actually labeled, the share that graduated or pumped. It is null until at+// least one of them is labeled, and `labeled` ships alongside it so a caller can+// see how thin the sample is; the smart_money label needs 3 labeled coins.// smart_money: proven win-rate across enough labeled coins// whale : large lifetime buy volume// serial : trades a high number of distinct coinsdiff --git a/prompts/swarm-100/api-pump-02.md b/prompts/swarm-100/api-pump-02.mddeleted file mode 100644index 122afe7c6..000000000--- a/prompts/swarm-100/api-pump-02.md+++ /dev/null@@ -1,110 +0,0 @@-# API audit: api/pump batch 02 (10 files)--How to run: paste this file's repo path into a fresh Claude Code chat in this-repository and say "run this work order". This file is fully self-contained:-it depends on no other prompt file anywhere. If neighboring files in-prompts/swarm-100/ are gone, that work is done; if present, ignore them.-Every claim below rots; step 0 re-measures, and what you measure wins.--## Operating clause (binding)--- Read CLAUDE.md first. Its rules override everything, including this file.-- Finish 100% in this session. Never end the turn with a question, an option- list, or an unexecuted plan. A judgment call goes in one line of the final- report; it never becomes a question that halts work.-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real- funds or any irreversible on-chain write, git push or a production deploy,- committing content that references a crypto project other than $THREE, and- destroying unrecoverable data.-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no- commented-out code. Real APIs and real integrations only.-- The em-dash and en-dash characters are banned in everything you write.-- Concurrent agents share this worktree: stage explicit paths only (never a- bare add-everything), and commit finished work promptly.-- Before committing, run: npm run check:rules -- --paths <files you touched>.- It must exit 0.--## Step 0: re-derive the current state--1. Confirm each file below still exists; deleted ones are done, skip them.-2. For each, decide routability: grep its path in vercel.json and read how- server/index.mjs maps filesystem handlers. Routed files get an endpoint- audit; internal modules get a code and test audit.-3. Start a local server for endpoint checks: node server/index.mjs with .env- loaded, on a free PORT if 3000 is busy.--## Task: audit these api files, then fix everything found--Files in this batch:--- api/pump/dashboard.js-- api/pump/deliver-telegram.js-- api/pump/dex-trades.js-- api/pump/ghost-copy.js-- api/pump/helius-stats.js-- api/pump/helius-webhook.js-- api/pump/intel-enrich.js-- api/pump/intel.js-- api/pump/launch-agent.js-- api/pump/launch-detail.js--For every routed handler:--1. Exercise it with curl against the local server: the success path returns- real data with the correct status; malformed input returns a 4xx JSON- error, never a stack trace or an HTML error page; auth is enforced where- the code intends it; CORS matches neighboring handlers.-2. Hard-rule scan: no mock fallbacks, no fake-data arrays, no stubbed- responses, no unfinished markers. Errors are handled at the boundary and- internal code trusts itself.-3. Do not spend funds or sign anything on-chain while probing. Payment and- trading handlers get their validation and error paths exercised, never a- live settlement.--For every internal (non-routed) module:--4. Something must import it; if nothing does, delete it as dead code (verify- with a repo-wide grep first).-5. Its main path and one failure path must be covered in tests/; add the- missing test if not.--## Definition of done--- [ ] Every listed file has recorded evidence: a curl transcript for routed- handlers, a passing test or a deletion for internal modules.-- [ ] Zero hard-rule violations remain in these files.-- [ ] vitest run passes; npm run check:rules -- --paths <touched files>- exits 0.--## Never blocked--| Blocker | Resolution (act, do not ask) |-|---|---|-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |-| Playwright browser missing | npx playwright install chromium |-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |--## Close out (required)--1. Verify every Definition of done line with the actual command output in- front of you. Never claim a line you did not verify.-2. Commit with explicit paths and a subject that describes the diff (house- style: type(scope): what changed and why a reader cares).-3. Delete this prompt file in that same commit:-- git rm prompts/swarm-100/api-pump-02.md-- The shrinking directory is this campaign's only progress ledger; there is- no progress log to update.-4. Final report: what step 0 measured, what changed (file list), evidence per- Definition of done line, and any one-line judgment calls. No trailing- questions, no unexecuted plans.--If a line genuinely cannot pass inside this session (an external party must-respond, or an owner-gated action is the final step), finish everything else,-leave this file in place, and state exactly which line remains and who owns-it. Never delete this file on a partial.diff --git a/tests/pump-intel-api-boundaries.test.js b/tests/pump-intel-api-boundaries.test.jsindex 612fcd4ee..f31a53c23 100644--- a/tests/pump-intel-api-boundaries.test.js+++ b/tests/pump-intel-api-boundaries.test.js@@ -225,6 +225,78 @@ describe('GET /api/pump/helius-stats probe reporting', () => {});});+describe('GET /api/pump/intel?view=feed filters reach past page one', () => {+ // A row shaped so deriveVerdict() lands on `key`. quality_score alone decides+ // it once risk_flags is empty.+ const coinRow = (i, quality) => ({+ mint: `M${i}`, network: 'mainnet', symbol: `S${i}`, name: `name ${i}`,+ quality_score: quality, risk_flags: [], signals: {},+ first_seen_at: '2026-08-01T00:00:00.000Z',+ });++ it('scans deeper than the page when verdict (a JS-derived filter) is set', async () => {+ // 79 "avoid" rows followed by 12 "strong" ones. Scanning only the requested+ // 10 would answer with zero strong coins while 12 sit just past the cursor,+ // which reads as "the engine found nothing".+ const rows = [+ ...Array.from({ length: 79 }, (_, i) => coinRow(i, 10)),+ ...Array.from({ length: 12 }, (_, i) => coinRow(100 + i, 90)),+ ];+ let sqlParams = null;+ sqlMock.mockImplementation((_statics, ...params) => {+ sqlParams = params;+ return Promise.resolve(rows);+ });+ const { res, body } = await callIntel('?view=feed&verdict=strong&limit=10');+ expect(res.statusCode).toBe(200);+ // limit is the last bound param: 8x the page when a JS filter is active.+ expect(sqlParams.at(-1)).toBe(80);+ // …and the page the caller asked for is still the page they get back.+ expect(body.coins).toHaveLength(10);+ expect(body.coins.every((c) => c.verdict.key === 'strong')).toBe(true);+ });++ it('scans exactly one page when no JS-derived filter is set', async () => {+ let sqlParams = null;+ sqlMock.mockImplementation((_statics, ...params) => {+ sqlParams = params;+ return Promise.resolve([]);+ });+ await callIntel('?view=feed&limit=10');+ expect(sqlParams.at(-1)).toBe(10);+ });++ it('pushes the text search into SQL instead of filtering the newest page', async () => {+ // The JS post-filter searched only the rows already fetched, so a coin that+ // matched but sat past the cursor was invisible to search.+ let sqlText = '';+ let sqlParams = null;+ sqlMock.mockImplementation((statics, ...params) => {+ sqlText = statics.join('?');+ sqlParams = params;+ return Promise.resolve([coinRow(1, 60)]);+ });+ const { body } = await callIntel('?view=feed&q=wolf&limit=25');+ expect(sqlText).toContain('ilike');+ expect(sqlParams).toContain('%wolf%');+ expect(sqlParams.at(-1)).toBe(25); // no over-fetch: ilike is a real WHERE+ // The row the DB returned is served as-is; nothing re-filters it in JS.+ expect(body.coins).toHaveLength(1);+ });++ it('escapes LIKE metacharacters so "100%" and "a_b" stay literal', async () => {+ let sqlParams = null;+ sqlMock.mockImplementation((_statics, ...params) => {+ sqlParams = params;+ return Promise.resolve([]);+ });+ await callIntel('?view=feed&q=100%25');+ expect(sqlParams).toContain('%100\\%%');+ await callIntel('?view=feed&q=a_b');+ expect(sqlParams).toContain('%a\\_b%');+ });+});+describe('/api/pump/intel still reads real intel rows', () => {it('shapes a coin row into the documented record, verdict included', async () => {sqlMock.mockImplementation((statics) => {