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(resilience): keep a soft-failing upstream from answering a question it never reached
nirholase585b917161c
diff --git a/api/news/archive.js b/api/news/archive.jsindex 9a7bf35c8..bb622ee0b 100644--- a/api/news/archive.js+++ b/api/news/archive.js@@ -70,6 +70,12 @@ function httpErr(status, code, message) {const e = new Error(message);e.status = status;e.code = code;+ // Marks a status this endpoint chose deliberately. The shared upstream fetch+ // synthesizes its own status on a transport failure (503 for an unreachable+ // host), and without this flag that transport code would surface at the+ // boundary in place of the 502 archive_unavailable contract this endpoint+ // documents and its callers match on.+ e.deliberate = true;return e;}@@ -421,6 +427,7 @@ export default wrap(async (req, res) => {{ 'cache-control': 'public, max-age=120, s-maxage=300, stale-while-revalidate=3600' },);} catch (e) {- return error(res, e.status || 502, e.code || 'archive_unavailable', e.message);+ const status = e.deliberate && e.status ? e.status : 502;+ return error(res, status, e.code || 'archive_unavailable', e.message);}});diff --git a/api/v1/token/security.js b/api/v1/token/security.jsindex 5dc3234ff..874d6421d 100644--- a/api/v1/token/security.js+++ b/api/v1/token/security.js@@ -235,7 +235,14 @@ export default defineEndpoint({address,account: { answered: answered(acct), result: answered(acct) ? acct.value?.result : undefined },largest: { answered: answered(largest), result: answered(largest) ? largest.value?.result : undefined },- market: { answered: mkt.status === 'fulfilled', data: mkt.value },+ // fetchTokenMarket answers null both for "this token has no indexed+ // pair" and for "DexScreener could not be reached at all", so a+ // fulfilled promise is not proof anything answered. Only a real payload+ // counts, which keeps the definitive 404 below ("not a resolvable+ // token") for cases where some source actually spoke: telling a caller+ // their real token does not exist because every upstream was down is a+ // worse answer than admitting we could not check.+ market: { answered: mkt.status === 'fulfilled' && mkt.value != null, data: mkt.value },});if (resolved) {diff --git a/tests/api/ca2x402-resolve.test.js b/tests/api/ca2x402-resolve.test.jsindex 4c921d2a0..249ae8733 100644--- a/tests/api/ca2x402-resolve.test.js+++ b/tests/api/ca2x402-resolve.test.js@@ -144,9 +144,24 @@ describe('GET /api/ca2x402/resolve', () => {expect(res.headers['cache-control']).toBe('no-store');});- it('reports the same designed 404 when DexScreener itself is failing', async () => {+ it('keeps answering from the remembered payload when DexScreener itself is failing', async () => {+ // A throttled DexScreener used to make a live token read as "not found"+ // here, which 503'd the paid token-intel service downstream. The market+ // read now falls back to the last payload it saw for this mint, so a blip+ // costs a few minutes of staleness instead of denying a real token.+ const warm = await call({ query: `?mint=${MINT}` });+ expect(warm.statusCode).toBe(200);dexOk = false;const res = await call({ query: `?mint=${MINT}` });+ expect(res.statusCode).toBe(200);+ expect(parse(res).ok).toBe(true);+ });++ it('still reports the designed 404 when DexScreener fails for a mint it has never seen', async () => {+ // Nothing remembered for this mint, so there is no honest answer to give:+ // the caller gets the designed miss rather than a fabricated one.+ dexOk = false;+ const res = await call({ query: '?mint=THREEsyntheticNeverSeen11111111111111111111' });expect(res.statusCode).toBe(404);expect(parse(res).error).toBe('token_not_found');});