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.

feat(seo): unfurl shared avatar links and finish the canonical agent routes

nirholas121a97f00d96
diff --git a/src/shared/skill-label.js b/src/shared/skill-label.js
new file mode 100644
index 000000000..141196689
--- /dev/null
+++ b/src/shared/skill-label.js
@@ -0,0 +1,44 @@
+/**
+ * Skill slug to display label.
+ *
+ * Skills travel as machine slugs (`nft-lookup`, `deep_diligence_card`) because
+ * that is what the agent record, the pricing map and the x402 call path all key
+ * on. Every surface that shows one to a person needs the same readable form, so
+ * it lives here once instead of being re-derived per page with slightly
+ * different rules (the studio's capability list, the dashboard's transaction
+ * table and its revenue breakdown were three separate answers).
+ *
+ * Acronyms are the reason a naive title-case is not enough: "nft-lookup" reads
+ * as "Nft Lookup", which looks like a typo. Words in `ACRONYMS` are uppercased
+ * whole; a token that is already mixed case (a brand like "watsonx") is left
+ * exactly as its author wrote it.
+ */
+
+// Uppercased whole when a slug token matches one, case-insensitively.
+const ACRONYMS = new Set([
+ '2d', '3d', 'ai', 'api', 'ar', 'cli', 'css', 'dao', 'dex', 'dm', 'eth', 'evm',
+ 'faq', 'glb', 'gltf', 'html', 'http', 'id', 'ip', 'json', 'kyc', 'llm', 'mcp',
+ 'nft', 'ocr', 'pdf', 'pnl', 'rag', 'rpc', 'sdk', 'seo', 'sol', 'sql', 'ssr',
+ 'svg', 'tts', 'ui', 'url', 'usd', 'usdc', 'ux', 'vr', 'x402', 'xr', 'yaml',
+]);
+
+/**
+ * @param {unknown} slug a skill slug, e.g. "nft-lookup"
+ * @param {string} [fallback] returned for an empty/absent slug
+ * @returns {string} e.g. "NFT Lookup"
+ */
+export function skillLabel(slug, fallback = 'Skill') {
+ const raw = String(slug ?? '').trim();
+ if (!raw) return fallback;
+ return raw
+ .split(/[\s_-]+/)
+ .filter(Boolean)
+ .map((word) => {
+ if (ACRONYMS.has(word.toLowerCase())) return word.toUpperCase();
+ // An author who wrote "watsonx" or "iOS" meant it; only plain
+ // lowercase and plain uppercase tokens get re-cased.
+ if (word !== word.toLowerCase() && word !== word.toUpperCase()) return word;
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
+ })
+ .join(' ');
+}
diff --git a/tests/skill-label.test.js b/tests/skill-label.test.js
new file mode 100644
index 000000000..86a359c25
--- /dev/null
+++ b/tests/skill-label.test.js
@@ -0,0 +1,40 @@
+/**
+ * skill-label: the one place a machine skill slug becomes something a person
+ * reads. Pins the cases that made three surfaces disagree before it existed.
+ */
+import { describe, it, expect } from 'vitest';
+import { skillLabel } from '../src/shared/skill-label.js';
+
+describe('skillLabel', () => {
+ it('title-cases a hyphenated slug', () => {
+ expect(skillLabel('portfolio-track')).toBe('Portfolio Track');
+ });
+
+ it('title-cases an underscored slug', () => {
+ expect(skillLabel('deep_diligence_card')).toBe('Deep Diligence Card');
+ });
+
+ it('uppercases acronyms instead of title-casing them', () => {
+ expect(skillLabel('nft-lookup')).toBe('NFT Lookup');
+ expect(skillLabel('api_calls')).toBe('API Calls');
+ expect(skillLabel('mcp-bridge')).toBe('MCP Bridge');
+ expect(skillLabel('x402-settle')).toBe('X402 Settle');
+ });
+
+ it('leaves a deliberately mixed-case token alone', () => {
+ expect(skillLabel('watsonx-orchestrate')).toBe('Watsonx Orchestrate');
+ expect(skillLabel('iOS-share')).toBe('iOS Share');
+ });
+
+ it('normalises shouty and mixed separators', () => {
+ expect(skillLabel('TRENDING')).toBe('Trending');
+ expect(skillLabel('quick signal_card')).toBe('Quick Signal Card');
+ expect(skillLabel(' spaced--out ')).toBe('Spaced Out');
+ });
+
+ it('falls back rather than rendering an empty label', () => {
+ expect(skillLabel('')).toBe('Skill');
+ expect(skillLabel(null)).toBe('Skill');
+ expect(skillLabel(undefined, 'Other')).toBe('Other');
+ });
+});