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(x-content): count bare domains as links, the way X renders them
nirholasd4d8f32a583a
diff --git a/api/_lib/x-content/editorial.js b/api/_lib/x-content/editorial.jsindex 1971b8f5c..649b9c666 100644--- a/api/_lib/x-content/editorial.js+++ b/api/_lib/x-content/editorial.js@@ -16,9 +16,12 @@import { existsSync, readFileSync } from 'node:fs';import { resolve } from 'node:path';import { mediaType } from './media.js';+import { urlsIn } from './quality.js';-const URLS = /(?:https?:\/\/|\b(?:www\.)?three\.ws\/)[^\s]+/gi;-const withoutUrls = (text) => String(text || '').replace(URLS, ' ');+// Prose checks strip links but keep bare domains, so a brand name written+// "Three.ws" is still caught; link counting uses X's own notion of a link.+const LINKS_WITH_PATHS = /https?:\/\/[^\s]+|(?<![@\w.-])(?:[a-z0-9-]+\.)+[a-z]{2,}\/[^\s]*/gi;+const withoutUrls = (text) => String(text || '').replace(LINKS_WITH_PATHS, ' ');// Written wrong -> written right. Case-sensitive on purpose.export const BRAND_RULES = [@@ -103,7 +106,7 @@ export function languageProblems(text) {if (oneWord.some((flag, index) => flag && oneWord[index + 1] && oneWord[index + 2])) {problems.push({ rule: 'structure', severity: 'blocking', message: 'one-word-sentence drumbeat reads as ad copy' });}- const links = String(text).match(URLS) || [];+ const links = urlsIn(text);if (links.length > 1) problems.push({ rule: 'links', severity: 'blocking', message: `${links.length} links; one post links one surface` });const mentions = prose.match(/(?<![\w@])@\w{1,15}/g) || [];if (mentions.length > 2) problems.push({ rule: 'mentions', severity: 'major', message: `${mentions.length} mentions; more than two reads as tag-baiting` });diff --git a/api/_lib/x-content/quality.js b/api/_lib/x-content/quality.jsindex d242e0ef6..3ea9e6443 100644--- a/api/_lib/x-content/quality.js+++ b/api/_lib/x-content/quality.js@@ -3,8 +3,14 @@// machine-generated: launch-deck openers, hype vocabulary, hashtags, emoji,// shouting, and a post that repeats an earlier one.-const URL_PATTERN = String.raw`(?:https?:\/\/|\b(?:www\.)?three\.ws\/)[^\s]+`;-const urlRe = (flags = '') => new RegExp(URL_PATTERN, flags);+// What X turns into a t.co link: anything with a scheme, and any bare domain+// on a common TLD, with or without a path. Bare domains matter: X linked the+// brand name "three.ws" inside the first pipeline test post, which cost 23+// weighted characters and a second link the one-link rule never saw.+const TLDS = 'com|net|org|io|ai|ws|dev|app|co|xyz|gg|so|sh|fun|me|tv|us|uk|de|gl|ly|to|fm|cc|info|tech|site|online|cloud|link|news|blog';+export const URL_PATTERN = String.raw`https?:\/\/[^\s]+|(?<![@\w.-])(?:[a-z0-9-]+\.)+(?:${TLDS})\b(?:\/[^\s]*)?`;+export const urlRe = (flags = '') => new RegExp(URL_PATTERN, flags);+export const urlsIn = (value) => String(value || '').match(urlRe('gi')) || [];export const hasUrl = (value) => urlRe('i').test(String(value || ''));diff --git a/api/_lib/x-content/verify.js b/api/_lib/x-content/verify.jsindex d7c316043..eeb0d7817 100644--- a/api/_lib/x-content/verify.js+++ b/api/_lib/x-content/verify.js@@ -19,8 +19,8 @@ import { existsSync, readFileSync } from 'node:fs';import { resolve } from 'node:path';import { pathToFileURL } from 'node:url';import { mentionsIn } from './editorial.js';+import { urlRe, urlsIn } from './quality.js';-const URLS = /(?:https?:\/\/|\b(?:www\.)?three\.ws\/)[^\s]+/gi;const UA = 'three.ws editorial verifier (+https://three.ws)';const normalize = (text) => String(text || '').replace(/\s+/g, ' ').trim().toLowerCase();@@ -30,7 +30,7 @@ export function itemTexts(item) {export function linksIn(texts) {const links = new Set();- for (const text of texts) for (const match of String(text).match(URLS) || []) links.add(/^https?:/i.test(match) ? match : `https://${match}`);+ for (const text of texts) for (const match of urlsIn(text)) links.add(/^https?:/i.test(match) ? match : `https://${match}`);return [...links].map((link) => link.replace(/[).,;:!?]+$/, ''));}@@ -187,7 +187,7 @@ async function mentionChecks(texts, env) {async function spellingChecks(item, texts, glossary) {const { spellCheckDocument } = await import('cspell-lib');const handles = mentionsIn(texts.join('\n')).map((handle) => handle.slice(1));- const prose = texts.join('\n').replace(URLS, ' ').replace(/\$THREE\b/g, ' ');+ const prose = texts.join('\n').replace(urlRe('gi'), ' ').replace(/\$THREE\b/g, ' ');const altTexts = (item.posts || []).flatMap((post) => (post.media || []).map((media) => media.alt)).filter(Boolean);const result = await spellCheckDocument({ uri: 'file:///x-content.txt', text: [prose, ...altTexts].join('\n'), languageId: 'plaintext', locale: 'en-US,en-GB' },diff --git a/data/x-content/queue.json b/data/x-content/queue.jsonindex b4ff82ac8..5c5b6a92f 100644--- a/data/x-content/queue.json+++ b/data/x-content/queue.json@@ -188,7 +188,7 @@},"posts": [{- "text": "Agents on three.ws spend against budgets, never private keys. How we authorize that spending, and the $THREE token layer behind it, on @awscloud's Builder Center: https://builder.aws.com/content/3JAVvvItd3ZSVjYCDb4qjj5VBb9/budgets-entitlements-and-the-dollarthree-token-layer-how-we-authorize-autonomous-agent-spending-or-threews-an-aws-partner",+ "text": "Our agents spend against budgets, never private keys. How we authorize that spending, and the $THREE token layer behind it, on @awscloud's Builder Center: https://builder.aws.com/content/3JAVvvItd3ZSVjYCDb4qjj5VBb9/budgets-entitlements-and-the-dollarthree-token-layer-how-we-authorize-autonomous-agent-spending-or-threews-an-aws-partner","textFrom": "docs/announcements/aws-builder-center-authorization-spine.post.txt","media": [{diff --git a/docs/announcements/aws-builder-center-authorization-spine.post.txt b/docs/announcements/aws-builder-center-authorization-spine.post.txtindex c842b9dbd..e4944522e 100644--- a/docs/announcements/aws-builder-center-authorization-spine.post.txt+++ b/docs/announcements/aws-builder-center-authorization-spine.post.txt@@ -1 +1 @@-Agents on three.ws spend against budgets, never private keys. How we authorize that spending, and the $THREE token layer behind it, on @awscloud's Builder Center: https://builder.aws.com/content/3JAVvvItd3ZSVjYCDb4qjj5VBb9/budgets-entitlements-and-the-dollarthree-token-layer-how-we-authorize-autonomous-agent-spending-or-threews-an-aws-partner+Our agents spend against budgets, never private keys. How we authorize that spending, and the $THREE token layer behind it, on @awscloud's Builder Center: https://builder.aws.com/content/3JAVvvItd3ZSVjYCDb4qjj5VBb9/budgets-entitlements-and-the-dollarthree-token-layer-how-we-authorize-autonomous-agent-spending-or-threews-an-aws-partnerdiff --git a/tests/x-content.test.js b/tests/x-content.test.jsindex d6c37ae97..89b1840e2 100644--- a/tests/x-content.test.js+++ b/tests/x-content.test.js@@ -264,7 +264,7 @@ describe('editorial', () => {it('blocks brand errors, financial promotion, slang, pushy asks, and ad-copy structure', async () => {const { languageProblems } = await import('../api/_lib/x-content/editorial.js');const rules = (text) => languageProblems(text).map((row) => `${row.rule}:${row.severity}`);- expect(rules('Three.ws ships agents on Github: three.ws/a')).toEqual(['brand:blocking', 'brand:blocking']);+ expect(rules('Three.ws ships agents on Github: three.ws/a')).toEqual(['brand:blocking', 'brand:blocking', 'links:blocking']);expect(rules('$THREE has 100x potential for holders: three.ws/a')).toContain('compliance:blocking');expect(rules('gm frens, agents are live: three.ws/a')).toContain('register:blocking');expect(rules('A robust agent runtime: three.ws/a')).toEqual(['register:major']);@@ -274,6 +274,15 @@ describe('editorial', () => {expect(rules('Two links: three.ws/a and three.ws/b')).toContain('links:blocking');});+ it('counts a bare domain as a link, the way X renders it', async () => {+ const { urlsIn, weightedLength } = await import('../api/_lib/x-content/quality.js');+ const { languageProblems } = await import('../api/_lib/x-content/editorial.js');+ expect(urlsIn('Agents on three.ws spend budgets: https://builder.aws.com/x')).toEqual(['three.ws', 'https://builder.aws.com/x']);+ expect(urlsIn('A .glb loads in Three.js and Node.js; write to [email protected]')).toEqual([]);+ expect(weightedLength('on three.ws')).toBe(3 + 23);+ expect(languageProblems('Agents on three.ws spend budgets: https://builder.aws.com/x').map((row) => row.rule)).toEqual(['links']);+ });+it('treats names as names and ordinals as numbers', async () => {const { assertionsIn } = await import('../api/_lib/x-content/editorial.js');expect(assertionsIn('3D agents on ERC-8004 with $THREE: three.ws/a').numbers).toEqual([]);