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(agents): drop duplicate skill_prices block and best-effort auth on public GET

nirholasc14a088e3046
diff --git a/api/agents.js b/api/agents.js
index a5ae5787e..d5ee2037c 100644
--- a/api/agents.js
+++ b/api/agents.js
@@ -202,24 +202,16 @@ export async function handleGetOne(req, res, id) {
const prices = await sql`
SELECT skill_name, amount, currency_mint FROM agent_skill_prices WHERE agent_id = ${id}
`;
- const skill_prices = prices.reduce((acc, p) => {
+ row.skill_prices = prices.reduce((acc, p) => {
acc[p.skill_name] = { amount: p.amount, currency_mint: p.currency_mint };
return acc;
}, {});
- row.skill_prices = skill_prices;
-
- const prices = await sql`
- SELECT skill_name, amount, currency_mint FROM agent_skill_prices WHERE agent_id = ${id}
- `;
- const skill_prices = prices.reduce((acc, p) => {
- acc[p.skill_name] = { amount: p.amount, currency_mint: p.currency_mint };
- return acc;
- }, {});
- row.skill_prices = skill_prices;
await healStaleAvatarId(row);
- // Public fields if not owner; full record if owner
+ // Public fields if not owner; full record if owner. Auth on a public GET
+ // is best-effort — anonymous viewers still get the public projection.
+ const auth = await resolveAuth(req).catch(() => null);
const isOwner = auth?.userId === row.user_id;
return json(res, 200, { agent: decorate(row, isOwner) });
}