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(x402): pay dance-tip on GET so the breaker and fee validator stop buying 405s
nirholas7bd3d4addc6d
diff --git a/api/_lib/x402/pipelines/circuit-breaker.js b/api/_lib/x402/pipelines/circuit-breaker.jsindex 5da245766..099e7649e 100644--- a/api/_lib/x402/pipelines/circuit-breaker.js+++ b/api/_lib/x402/pipelines/circuit-breaker.js@@ -50,8 +50,17 @@ const NET_BSC = 'eip155:56';// side effect the volume entries already produce, so an hourly breaker tip is// consistent with existing traffic. A 402 challenge alone (the probe) books// nothing; the ticket is created only after payment settles.-const PROBE_PATH = '/api/x402/dance-tip';-const PROBE_BODY = { dancer: '4', dance: 'hiphop' };+//+// dance-tip is a GET route (paidEndpoint({ method: 'GET' }) in api/x402/dance-tip.js)+// and takes its dancer/dance selection as QUERY params. The paid endpoint answers a+// credential-less request on the wrong method with the 402 challenge (so discovery+// still works), but a request that CARRIES a payment on the wrong method gets a+// strict 405, which is exactly what the breaker's settle leg was collecting every+// hour ("solana FAILED" with a hidden http_405 in signal_data). Probe and settle+// both ride the documented GET now.+const PROBE_QUERY = 'dancer=4&dance=hiphop';+const PROBE_PATH = `/api/x402/dance-tip?${PROBE_QUERY}`;+const PROBE_METHOD = 'GET';// Networks the breaker expects the platform to advertise. `settle` flags the one// network we actually pay on (Solana) vs. those we only route-verify (Base/BSC).@@ -198,12 +207,11 @@ export async function runCircuitBreaker(ctx) {let challenge;try {const probe = await fetchWithTimeout(endpointUrl, {- method: 'POST',+ method: PROBE_METHOD,headers: {'content-type': 'application/json','user-agent': 'threews-x402-circuit-breaker/1.0',},- body: JSON.stringify(PROBE_BODY),});if (probe.status !== 402) {// A $0.001 paid endpoint that does NOT challenge is itself a stack fault.@@ -262,8 +270,8 @@ export async function runCircuitBreaker(ctx) {try {const r = await payX402({url: endpointUrl,- method: 'POST',- body: PROBE_BODY,+ method: PROBE_METHOD,+ body: null,buyer, conn, blockhash, mintInfo,remainingCap: remainingCap ?? Infinity,userAgent: 'threews-x402-circuit-breaker/1.0',@@ -319,4 +327,4 @@ export async function runCircuitBreaker(ctx) {};}-export const CIRCUIT_BREAKER_PROBE = Object.freeze({ path: PROBE_PATH, body: PROBE_BODY });+export const CIRCUIT_BREAKER_PROBE = Object.freeze({ path: PROBE_PATH, method: PROBE_METHOD });diff --git a/api/_lib/x402/pipelines/fee-calculation-validator.js b/api/_lib/x402/pipelines/fee-calculation-validator.jsindex be420540e..c4c2b952f 100644--- a/api/_lib/x402/pipelines/fee-calculation-validator.js+++ b/api/_lib/x402/pipelines/fee-calculation-validator.js@@ -71,8 +71,14 @@ const BOUNDARY_ATOMICS = [1, 999, 1000, 1001, 999999];// The live boundary we actually settle on-chain. dance-tip quotes exactly $0.001// (1000 atomics) via priceFor — one of the boundaries above — so a real payment// closes the loop on the deployed quote vs. the local fee math.-const LIVE_ROUTE = '/api/x402/dance-tip';-const LIVE_BODY = { dancer: '1', dance: 'hiphop' };+// dance-tip is declared GET (paidEndpoint({ method: 'GET' }) in api/x402/dance-tip.js)+// and reads its selection from QUERY params. A credential-less request on any+// method still gets the 402 challenge, so the free quote probe worked either way,+// but the PAID replay on the wrong method is answered with a strict 405: the+// validator's live settle leg had never once landed. Both legs ride GET now.+const LIVE_QUERY = 'dancer=1&dance=hiphop';+const LIVE_ROUTE = `/api/x402/dance-tip?${LIVE_QUERY}`;+const LIVE_METHOD = 'GET';const LIVE_EXPECTED_ATOMIC = Number(priceFor('dance-tip', '1000'));const MINT = () => USDC_MINT || env.X402_ASSET_MINT_SOLANA || 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';@@ -195,9 +201,8 @@ async function probeLiveQuote(origin) {const url = `${origin}${LIVE_ROUTE}`;try {const res = await fetchWithTimeout(url, {- method: 'POST',+ method: LIVE_METHOD,headers: { 'content-type': 'application/json', 'user-agent': 'threews-x402-autonomous/1.0' },- body: JSON.stringify(LIVE_BODY),});if (res.status !== 402) {return { quotedAtomic: null, error: `unexpected_status_${res.status}` };@@ -228,6 +233,12 @@ async function probeLiveQuote(origin) {* @param {object} [ctx.mintInfo] USDC mint info (fetched if absent)* @param {number} [ctx.remainingCap] spend ceiling for this run (atomics)*/+// The live boundary leg's HTTP shape, exported so the registry shape guard can+// assert it against ring-catalog.js (the source of truth for every paid route's+// method + query form). A pipeline that drifts off its endpoint's method pays for+// a 405 instead of a settlement.+export const FEE_VALIDATOR_PROBE = Object.freeze({ path: LIVE_ROUTE, method: LIVE_METHOD });+export async function run(ctx = {}) {const t0 = Date.now();const runId = ctx.runId || randomUUID();@@ -290,8 +301,8 @@ export async function run(ctx = {}) {}const r = await payX402({url: `${origin}${LIVE_ROUTE}`,- method: 'POST',- body: LIVE_BODY,+ method: LIVE_METHOD,+ body: null,buyer, conn, blockhash, mintInfo,remainingCap,userAgent: 'threews-x402-fee-validator/1.0',diff --git a/tests/x402-registry-http-shape.test.js b/tests/x402-registry-http-shape.test.jsindex fdcddea71..f2ec07fa5 100644--- a/tests/x402-registry-http-shape.test.js+++ b/tests/x402-registry-http-shape.test.js@@ -1,6 +1,9 @@import { describe, it, expect } from 'vitest';import { getSelfRegistry } from '../api/_lib/x402/autonomous-registry.js';+import { RING_CATALOG } from '../api/_lib/x402/ring-catalog.js';+import { CIRCUIT_BREAKER_PROBE } from '../api/_lib/x402/pipelines/circuit-breaker.js';+import { FEE_VALIDATOR_PROBE } from '../api/_lib/x402/pipelines/fee-calculation-validator.js';// Regression guard for the July 2026 405 wave: the three "Dance Tip Volume"// entries POSTed a JSON body at /api/x402/dance-tip, a GET-only endpoint that@@ -21,6 +24,25 @@ describe('autonomous registry HTTP shape', () => {}});+ // run()-style pipelines own their whole call sequence, so the registry shape+ // guard above cannot see them. Both of these settle against dance-tip and both+ // POSTed at it, which the paid endpoint answers with a strict 405 once a+ // payment is attached: the circuit breaker reported "solana FAILED" every hour+ // and the fee validator's live settle leg had never once landed.+ it('run()-style dance-tip probes match the catalog HTTP shape', () => {+ const catalogEntry = RING_CATALOG.find((e) => e.slug === 'dance-tip');+ expect(catalogEntry).toBeDefined();+ for (const probe of [CIRCUIT_BREAKER_PROBE, FEE_VALIDATOR_PROBE]) {+ const [path, query] = probe.path.split('?');+ expect(path).toBe(catalogEntry.path);+ expect(probe.method).toBe(catalogEntry.method);+ // A GET endpoint takes its selection as query params, never a body.+ expect(probe).not.toHaveProperty('body');+ expect(new URLSearchParams(query).get('dancer')).toMatch(/^\d+$/);+ expect(new URLSearchParams(query).get('dance')).toBeTruthy();+ }+ });+it('no fetch-style entry sends a body on a GET', () => {// run()-style entries own their whole call and are exempt; plain entries// are fetched by the loop with { method, body } verbatim, where a GET with