Skip to content

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.

fix(launcher): autonomous launch + fee-claim were 404ing on the wrong pump URL form

fudjia124c591b83e5
diff --git a/api/_lib/circulation.js b/api/_lib/circulation.js
index 96a36e090..42b01b7e1 100644
--- a/api/_lib/circulation.js
+++ b/api/_lib/circulation.js
@@ -752,7 +752,7 @@ async function actionLaunch(ctx) {
await ensureFunded(conn, treasuryKp, agent, LAUNCH_FLOOR);
const theme = pick(COIN_THEMES);
- const meta = await postAs(origin, agent.userId, '/api/pump?action=build-metadata', {
+ const meta = await postAs(origin, agent.userId, '/api/pump/build-metadata', {
name: theme.name,
symbol: theme.symbol,
description: theme.description,
@@ -764,7 +764,7 @@ async function actionLaunch(ctx) {
throw new Skip(`metadata build ${meta.status}: ${meta.body?.error || 'no url'}`);
}
- const launch = await postAs(origin, agent.userId, '/api/pump?action=launch-agent', {
+ const launch = await postAs(origin, agent.userId, '/api/pump/launch-agent', {
agent_id: agent.id,
name: theme.name,
symbol: theme.symbol,
diff --git a/api/_lib/launcher-engine.js b/api/_lib/launcher-engine.js
index 96d144a3a..dd73fd614 100644
--- a/api/_lib/launcher-engine.js
+++ b/api/_lib/launcher-engine.js
@@ -325,7 +325,7 @@ async function launchCoin(cfg, agent, coin) {
// Forward the agent's own socials when it has them; the metadata builder falls
// back to the agent profile page (website) and the three.ws X/Telegram otherwise,
// so every coin carries the fullest set of links we can supply autonomously.
- const meta = await postAs(agent.user_id, '/api/pump?action=build-metadata', {
+ const meta = await postAs(agent.user_id, '/api/pump/build-metadata', {
name: coin.name,
symbol: coin.symbol,
description: coin.description,
@@ -340,7 +340,7 @@ async function launchCoin(cfg, agent, coin) {
throw new Error(`metadata build ${meta.status}: ${meta.body?.error || 'no url'}`);
}
- const launch = await postAs(agent.user_id, '/api/pump?action=launch-agent', {
+ const launch = await postAs(agent.user_id, '/api/pump/launch-agent', {
agent_id: agent.id,
name: coin.name,
symbol: coin.symbol,
diff --git a/api/cron/launcher-claimer.js b/api/cron/launcher-claimer.js
index 8853773ee..81b2ac0ba 100644
--- a/api/cron/launcher-claimer.js
+++ b/api/cron/launcher-claimer.js
@@ -86,7 +86,7 @@ async function processMint(run) {
// 1. Fetch live claimable balance.
const feeRes = await agentFetch(
userId,
- `/api/pump?action=fee-info&mint=${encodeURIComponent(mint)}&network=${encodeURIComponent(network)}`,
+ `/api/pump/fee-info?mint=${encodeURIComponent(mint)}&network=${encodeURIComponent(network)}`,
);
if (!feeRes || !feeRes.ok) return { runId, status: 'fee-info-failed' };
const feeInfo = await feeRes.json().catch(() => null);
@@ -98,7 +98,7 @@ async function processMint(run) {
}
// 2. Claim — the agent signs its own fee claim (same identity that created the coin).
- const claimRes = await agentFetch(userId, '/api/pump?action=collect-creator-fee-agent', {
+ const claimRes = await agentFetch(userId, '/api/pump/collect-creator-fee-agent', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ agentId, mint, network }),
diff --git a/tests/pump-internal-caller-routes.test.js b/tests/pump-internal-caller-routes.test.js
new file mode 100644
index 000000000..8ce462fb1
--- /dev/null
+++ b/tests/pump-internal-caller-routes.test.js
@@ -0,0 +1,75 @@
+import { describe, it, expect } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { globSync } from 'glob';
+
+// Regression guard for a real production outage: `api/pump/[action].js` has NO
+// catch-all route — every action needs its OWN explicit `/api/pump/<action>`
+// line in vercel.json. Two things silently broke the autonomous economy because
+// of this:
+// 1. Internal callers used the QUERY form `/api/pump?action=<x>`, which has no
+// route at all and 404s → the launcher failed every mint on "metadata build
+// 404: no url" and tripped its breaker; the fee claimer 404'd on every claim.
+// 2. Actions like `fee-info` / `collect-creator-fee-agent` had no route even in
+// PATH form, so the claim→fee→buyback chain never ran.
+// This test fails if either regresses.
+
+const repoRoot = fileURLToPath(new URL('..', import.meta.url));
+const vercel = JSON.parse(readFileSync(new URL('../vercel.json', import.meta.url), 'utf8'));
+const routeSrcs = new Set((vercel.routes || []).map((r) => r.src));
+
+// Server-side files that call the pump API over HTTP against our own origin.
+const serverFiles = globSync('api/**/*.js', { cwd: repoRoot }).filter(
+ (f) => !f.includes('node_modules'),
+);
+
+function readCalls() {
+ const queryForm = [];
+ const pathForm = new Set();
+ for (const rel of serverFiles) {
+ const src = readFileSync(new URL(`../${rel}`, import.meta.url), 'utf8');
+ // Only count actual request URLs (string literals), not doc comments.
+ for (const line of src.split('\n')) {
+ if (line.trimStart().startsWith('*') || line.trimStart().startsWith('//')) continue;
+ for (const m of line.matchAll(/['"`]\/api\/pump\?action=([a-z-]+)/g)) {
+ queryForm.push({ rel, action: m[1] });
+ }
+ for (const m of line.matchAll(/['"`]\/api\/pump\/([a-z-]+)(?:[?'"`])/g)) {
+ pathForm.add(m[1]);
+ }
+ }
+ }
+ return { queryForm, pathForm: [...pathForm] };
+}
+
+describe('internal pump API callers hit routed path-form URLs', () => {
+ const { queryForm, pathForm } = readCalls();
+
+ it('no server file calls the unrouted /api/pump?action= query form', () => {
+ expect(
+ queryForm,
+ `These callers use the query form which has NO route and 404s. Use /api/pump/<action> instead:\n` +
+ queryForm.map((c) => ` ${c.rel}: /api/pump?action=${c.action}`).join('\n'),
+ ).toEqual([]);
+ });
+
+ it('every /api/pump/<action> handled by [action].js and called internally has a route', () => {
+ // A path-form call resolves one of two ways:
+ // · a standalone file api/pump/<x>.js → served by the filesystem handler
+ // · an action inside [action].js's switch → needs an EXPLICIT route to
+ // inject ?action=<x>, since the filesystem handler can't address it.
+ // Only the second kind can silently 404, so only it is asserted here.
+ const actionSrc = readFileSync(new URL('../api/pump/[action].js', import.meta.url), 'utf8');
+ const isActionCase = (a) => new RegExp(`case ['"]${a}['"]`).test(actionSrc);
+ const hasStandaloneFile = (a) =>
+ serverFiles.includes(`api/pump/${a}.js`);
+ const missing = pathForm.filter(
+ (a) => !routeSrcs.has(`/api/pump/${a}`) && !hasStandaloneFile(a) && isActionCase(a),
+ );
+ expect(
+ missing,
+ `These [action].js actions are called internally but have no route in vercel.json (they 404):\n` +
+ missing.map((a) => ` /api/pump/${a}`).join('\n'),
+ ).toEqual([]);
+ });
+});
diff --git a/vercel.json b/vercel.json
index 04e5cc386..98b438f0b 100644
--- a/vercel.json
+++ b/vercel.json
@@ -2986,6 +2986,14 @@
"src": "/api/pump/build-metadata",
"dest": "/api/pump/[action]?action=build-metadata"
},
+ {
+ "src": "/api/pump/fee-info",
+ "dest": "/api/pump/[action]?action=fee-info"
+ },
+ {
+ "src": "/api/pump/collect-creator-fee-agent",
+ "dest": "/api/pump/[action]?action=collect-creator-fee-agent"
+ },
{
"src": "/api/pump/channel-feed",
"dest": "/api/pump/[action]?action=channel-feed"