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
refactor(x-mentions): count X post length with one module and drop the stale twitter-text dependency
nirholas2db9cf288315
diff --git a/api/_lib/x-mention-reply.js b/api/_lib/x-mention-reply.jsindex def222b15..c085aa625 100644--- a/api/_lib/x-mention-reply.js+++ b/api/_lib/x-mention-reply.js@@ -16,13 +16,11 @@// untrusted data: it is quoted into the user turn as data, never merged into// the system prompt.-import twitterText from 'twitter-text';import { llmComplete } from './llm.js';import { resolveAgentBrain } from './agent-brain.js';import { modelChain } from './agent-model.js';import { normalizeText, CHAT_MAX } from './x-mention-intents.js';--const { parseTweet, extractUrls } = twitterText;+import { weightedLength as xWeightedLength, findUrls } from './x-text-weight.js';export const MAX_REPLY_WEIGHT = 260;export const THREE_CA = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';@@ -82,7 +80,7 @@ const CONTROL_RE = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F-/** Weighted length as X counts it: links 23, CJK and emoji 2, the rest 1. */export function weightedLength(text) {- return parseTweet(String(text ?? '')).weightedLength;+ return xWeightedLength(text);}/** Whether a URL string points at three.ws over https. */@@ -110,7 +108,8 @@ export function checkReply(text) {const weight = weightedLength(t);if (weight > MAX_REPLY_WEIGHT) return { ok: false, reason: 'too_long', detail: String(weight) };- for (const url of extractUrls(t)) {+ for (const span of findUrls(t)) {+ const url = t.slice(span.start, span.end);if (!allowedUrl(url)) return { ok: false, reason: 'link_not_allowed', detail: url };}if (/\b(?:t\.co|bit\.ly|tinyurl\.com|[\w-]+\.(?:com|net|org|io|xyz|app|dev|co|gg|fun|finance|exchange))\b/i.test(t.replace(/\bhttps:\/\/(?:[\w-]+\.)*three\.ws\S*/gi, ''))) {diff --git a/package-lock.json b/package-lock.jsonindex e134e1188..4ec7235aa 100644--- a/package-lock.json+++ b/package-lock.json@@ -235,7 +235,6 @@"three-pathfinding": "^1.3.0","trading-signals": "^8.3.0","twitter-api-v2": "^1.29.0",- "twitter-text": "^3.1.0","undici": "^7.30.0","unpdf": "^1.8.0","uuid": "^14.0.2",@@ -33370,14 +33369,6 @@"version": "2.1.4","license": "MIT"},- "node_modules/core-js": {- "version": "2.6.12",- "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",- "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==",- "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.",- "hasInstallScript": true,- "license": "MIT"- },"node_modules/core-js-compat": {"version": "3.49.0","dev": true,@@ -50977,33 +50968,10 @@"version": "0.15.1","license": "Unlicense"},- "node_modules/twemoji-parser": {- "version": "11.0.2",- "resolved": "https://registry.npmjs.org/twemoji-parser/-/twemoji-parser-11.0.2.tgz",- "integrity": "sha512-5kO2XCcpAql6zjdLwRwJjYvAZyDy3+Uj7v1ipBzLthQmDL7Ce19bEqHr3ImSNeoSW2OA8u02XmARbXHaNO8GhA==",- "license": "MIT"- },"node_modules/twitter-api-v2": {"version": "1.29.0","license": "Apache-2.0"},- "node_modules/twitter-text": {- "version": "3.1.0",- "resolved": "https://registry.npmjs.org/twitter-text/-/twitter-text-3.1.0.tgz",- "integrity": "sha512-nulfUi3FN6z0LUjYipJid+eiwXvOLb8Ass7Jy/6zsXmZK3URte043m8fL3FyDzrK+WLpyqhHuR/TcARTN/iuGQ==",- "dependencies": {- "@babel/runtime": "^7.3.1",- "core-js": "^2.5.0",- "punycode": "1.4.1",- "twemoji-parser": "^11.0.2"- }- },- "node_modules/twitter-text/node_modules/punycode": {- "version": "1.4.1",- "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",- "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==",- "license": "MIT"- },"node_modules/type-check": {"version": "0.4.0","dev": true,diff --git a/package.json b/package.jsonindex 53a645e72..acfd52031 100644--- a/package.json+++ b/package.json@@ -698,7 +698,6 @@"three-pathfinding": "^1.3.0","trading-signals": "^8.3.0","twitter-api-v2": "^1.29.0",- "twitter-text": "^3.1.0","undici": "^7.30.0","unpdf": "^1.8.0","uuid": "^14.0.2",