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
IRL pins: my-pins + PATCH; brand: Telegram link + token attribution; agent-detail owner bar CSS
nirholasaa7e9b40ab4f
diff --git a/api/_lib/three-brand.js b/api/_lib/three-brand.jsindex 8444434ac..7a918c4d9 100644--- a/api/_lib/three-brand.js+++ b/api/_lib/three-brand.js@@ -32,6 +32,7 @@ export const THREE_WS = {website: 'https://three.ws',x: 'https://x.com/trythreews',xHandle: '@trythreews',+ telegram: 'https://t.me/three_ws',github: 'https://github.com/nirholas/three.ws',docs: 'https://three.ws/docs',ogImage: 'https://three.ws/og-image.png',@@ -344,18 +345,25 @@ export function erc8004RegistryFields(origin = env.APP_ORIGIN) {* @param {string} [t.image]* @param {string} [t.website] defaults to the agent page (falls back to three.ws)* @param {string} [t.twitter] defaults to the three.ws X account- * @param {string} [t.telegram]+ * @param {string} [t.telegram] defaults to the three.ws Telegram channel* @param {string} [t.agentUrl] agent profile page* @param {string} [t.creatorAddress]* @param {string} [t.createdAt] ISO timestamp*/+// Attribution suffix stamped onto every user-provided pump.fun token description.+// Keeps the attribution short so it doesn't crowd out the user's copy.+const THREE_WS_ATTRIBUTION = '\n\nLaunched on three.ws · 3D AI agents on-chain.';+export function buildTokenMetadata(t) {const tok = threeTokenLinks();const website = t.website || t.agentUrl || THREE_WS.website;const twitter = t.twitter || THREE_WS.x;- const description =- t.description?.trim() ||- `${t.name} — an autonomous agent token launched on ${THREE_WS.name}.`;+ const telegram = t.telegram || THREE_WS.telegram;+ const userDesc = t.description?.trim() || '';+ const ATTR_LEN = THREE_WS_ATTRIBUTION.length;+ const description = userDesc+ ? `${userDesc.slice(0, 500 - ATTR_LEN)}${THREE_WS_ATTRIBUTION}`+ : `${t.name} — an autonomous agent token launched on ${THREE_WS.name}. ${THREE_WS_ATTRIBUTION.trim()}`;const attributes = [{ trait_type: 'Platform', value: THREE_WS.name },@@ -372,7 +380,7 @@ export function buildTokenMetadata(t) {createdOn: THREE_WS.website,website,twitter,- ...(t.telegram ? { telegram: t.telegram } : {}),+ telegram,// Standard + brand extras (explorers/wallets read these; pump ignores them)external_url: website,attributes,@@ -385,6 +393,7 @@ export function buildTokenMetadata(t) {name: THREE_WS.name,url: THREE_WS.website,x: THREE_WS.x,+ telegram: THREE_WS.telegram,github: THREE_WS.github,},token: { symbol: tok.symbol, mint: tok.mint, url: tok.pumpfun },diff --git a/api/irl/pins.js b/api/irl/pins.jsindex 47bbbbf30..9869c3a58 100644--- a/api/irl/pins.js+++ b/api/irl/pins.js@@ -1,13 +1,16 @@/*** IRL GPS Pins — place 3D agents at real-world GPS coordinates.*- * GET /api/irl/pins?lat=&lng=&radius=150 nearby pins (public)- * POST /api/irl/pins { lat, lng, heading, avatarUrl, avatarName, caption, agentId }- * DELETE /api/irl/pins?id= (requires device_token cookie match or auth)+ * GET /api/irl/pins?lat=&lng=&radius=150 nearby pins (public)+ * GET /api/irl/pins?mine=1 my pins (auth required)+ * POST /api/irl/pins { lat, lng, heading, avatarUrl, avatarName, caption, agentId }+ * PATCH /api/irl/pins { id, caption } edit caption (auth required)+ * DELETE /api/irl/pins?id= remove own pin (device_token or auth)*/import { cors, json, wrap } from '../_lib/http.js';import { sql } from '../_lib/db.js';+import { getSessionUser } from '../_lib/auth.js';// Haversine distance in meters between two GPS pointsfunction haversineDist(lat1, lng1, lat2, lng2) {@@ -47,11 +50,25 @@ async function ensureTable() {}export default wrap(async (req, res) => {- cors(req, res, { methods: ['GET', 'POST', 'DELETE', 'OPTIONS'] });+ cors(req, res, { methods: ['GET', 'POST', 'PATCH', 'DELETE', 'OPTIONS'] });if (req.method === 'OPTIONS') return res.end();await ensureTable();+ // ── GET — my pins (auth) ──────────────────────────────────────────────────+ if (req.method === 'GET' && req.query.mine === '1') {+ const session = await getSessionUser(req).catch(() => null);+ if (!session) return json(res, 401, { error: 'not authenticated' });+ const rows = await sql`+ SELECT id, lat, lng, heading, avatar_url, avatar_name, caption, agent_id, placed_at, expires_at+ FROM irl_pins+ WHERE user_id = ${session.id}+ ORDER BY placed_at DESC+ LIMIT 100+ `;+ return json(res, 200, { pins: rows });+ }+// ── GET — nearby pins ─────────────────────────────────────────────────────if (req.method === 'GET') {const lat = parseFloat(req.query.lat);@@ -101,25 +118,46 @@ export default wrap(async (req, res) => {return json(res, 400, { error: 'invalid coordinates' });}+ const session = await getSessionUser(req).catch(() => null);+ const userId = session?.id ?? null;+ // Authenticated users get permanent pins; anonymous expire in 7 days.+ const expiresAt = userId ? null : new Date(Date.now() + 7 * 24 * 3600 * 1000).toISOString();+const [pin] = await sql`INSERT INTO irl_pins(user_id, agent_id, device_token, lat, lng, heading,- avatar_url, avatar_name, caption, x402_endpoint)+ avatar_url, avatar_name, caption, x402_endpoint, expires_at)VALUES (- ${body.userId ?? null},- ${body.agentId ?? null},+ ${userId},+ ${body.agentId ?? null},${body.deviceToken ?? null},${lat}, ${lng},${parseFloat(body.heading) || 0},${body.avatarUrl ?? null},${body.avatarName ?? null},${body.caption ?? null},- ${body.x402Endpoint ?? null}+ ${body.x402Endpoint ?? null},+ ${expiresAt})RETURNING *`;- return json(res, 201, { pin });+ return json(res, 201, { pin: { ...pin, permanent: expiresAt === null } });+ }++ // ── PATCH — edit caption ──────────────────────────────────────────────────+ if (req.method === 'PATCH') {+ const session = await getSessionUser(req).catch(() => null);+ if (!session) return json(res, 401, { error: 'not authenticated' });+ const { id, caption } = req.body ?? {};+ if (!id) return json(res, 400, { error: 'id required' });+ const [row] = await sql`+ UPDATE irl_pins SET caption = ${caption ?? null}+ WHERE id = ${id} AND user_id = ${session.id}+ RETURNING id, caption+ `;+ if (!row) return json(res, 404, { error: 'not found' });+ return json(res, 200, { pin: row });}// ── DELETE — remove own pin ───────────────────────────────────────────────@@ -129,11 +167,18 @@ export default wrap(async (req, res) => {if (!id) return json(res, 400, { error: 'id required' });+ const session = await getSessionUser(req).catch(() => null);+ const userId = session?.id ?? null;+// Allow deletion by device_token (anonymous) or user_id (authenticated)const result = await sql`DELETE FROM irl_pinsWHERE id = ${id}- AND (device_token = ${deviceToken ?? ''} OR device_token IS NULL)+ AND (+ device_token = ${deviceToken ?? ''}+ OR user_id = ${userId}+ OR (device_token IS NULL AND ${userId} IS NULL)+ )RETURNING id`;diff --git a/src/agent-detail.css b/src/agent-detail.cssindex 9319432ba..b59f1ff9c 100644--- a/src/agent-detail.css+++ b/src/agent-detail.css@@ -1011,6 +1011,40 @@ a {color: var(--ad-muted);}+/* Owner action bar — edit, manage, deploy CTAs shown only to the agent owner */+.ad-owner-bar {+ display: flex;+ align-items: center;+ gap: 8px;+ flex-wrap: wrap;+ margin: 10px 0 6px;+ padding: 10px 12px;+ background: rgba(139, 92, 246, 0.07);+ border: 1px solid rgba(139, 92, 246, 0.18);+ border-radius: 10px;+}+.ad-owner-bar .ad-btn {+ font-size: 12.5px;+ padding: 6px 13px;+ text-decoration: none;+}+.ad-btn-deploy {+ background: rgba(139, 92, 246, 0.15) !important;+ border-color: rgba(139, 92, 246, 0.4) !important;+ color: #c4b5fd !important;+}+.ad-btn-deploy:hover {+ background: rgba(139, 92, 246, 0.25) !important;+}++/* Deploy slot in BLOCKCHAIN DETAILS — inline OnchainDeployButton */+.ad-deploy-slot {+ margin: 12px 0 4px;+}+.ad-deploy-slot:empty {+ display: none;+}+/* Hero actions */.ad-market-actions {display: inline-flex;