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
Punctuation cleanup in this session's added lines
nirholas7199713e0390
diff --git a/api/_lib/avatar-render.js b/api/_lib/avatar-render.jsindex 4482469e3..27a1a033a 100644--- a/api/_lib/avatar-render.js+++ b/api/_lib/avatar-render.js@@ -281,7 +281,7 @@ async function getBrowser() {// GltfRig.applyPose) that lands presets on top of any bind stance. The// sources are shipped to the page as data: URL modules in its import map,// with pose-rig's relative imports rewritten to the bare specifiers the map-// defines. Never reintroduce a hand-rolled alias table here — it silently+// defines. Never reintroduce a hand-rolled alias table here, it silently// missed every Mixamo rig (GLTFLoader strips ':' from node names) and stomped// absolute local Eulers over bind rotations on the rest.const SRC_DIR = new URL('../../src/', import.meta.url);@@ -290,7 +290,7 @@ function poseModuleDataUrl(file, rewrites = []) {let code = readFileSync(new URL(file, SRC_DIR), 'utf8');for (const [from, to] of rewrites) code = code.replaceAll(from, to);if (/from\s+['"]\.{1,2}\//.test(code)) {- throw new Error(`avatar-render: ${file} still has relative imports after rewrite — update poseRuntimeModules()`);+ throw new Error(`avatar-render: ${file} still has relative imports after rewrite, update poseRuntimeModules()`);}return 'data:text/javascript;base64,' + Buffer.from(code, 'utf8').toString('base64');}@@ -378,7 +378,7 @@ rim.position.set(-0.5, 2.5, -4); scene.add(rim);// Preset poses are authored in the mannequin convention (src/pose-presets.js);// poseFromMannequinPreset converts them to canonical world-frame deltas and// GltfRig.applyPose replays those on the avatar's OWN rest pose with-// reference-stance alignment — the same path the /pose studio uses, so a+// reference-stance alignment, the same path the /pose studio uses, so a// preset lands identically here whether the rig binds in a T-pose or A-pose,// and whatever naming convention its bones use. Rigs with no recognizable// humanoid skeleton stay in bind pose (there is no safe mapping for those).@@ -405,7 +405,7 @@ ${computeCameraFraming.toString()}function frameCameraForScene(root, orbit, preset) {// The bounding box must reflect the POSED skin, not the bind-pose geometry:// three's Box3.setFromObject defers to SkinnedMesh.computeBoundingBox (CPU- // skinning), which needs current bone matrices — update the graph and each+ // skinning), which needs current bone matrices, update the graph and each// skeleton first. (Never reset rigs via THREE.Skeleton's pose method: it// reconstructs bind from inverse-bind matrices and collapses Mixamo rigs.)root.updateMatrixWorld(true);@@ -417,7 +417,7 @@ function frameCameraForScene(root, orbit, preset) {preset, ${width} / ${height}, camera.fov, orbit,);// Scale-aware clip planes: pipeline GLBs are ~1.7 units tall but Mixamo- // cm-scale exports are ~170 — a fixed near/far would clip one or the other.+ // cm-scale exports are ~170, a fixed near/far would clip one or the other.camera.near = Math.max(framing.distance / 1000, 0.001);camera.far = framing.distance * 10;camera.updateProjectionMatrix();diff --git a/api/_lib/coingecko.js b/api/_lib/coingecko.jsindex d9827e660..c1bf4f1ee 100644--- a/api/_lib/coingecko.js+++ b/api/_lib/coingecko.js@@ -89,7 +89,7 @@ export async function geckoFetch(path, { ttlMs = 60_000, timeoutMs = 8000 } = {}return stale;}if (resp.status !== 404) {- // Cold instance, throttled upstream, nothing in memory — the shared+ // Cold instance, throttled upstream, nothing in memory, the shared// last-good copy is the difference between minutes-stale data and a 502.const durable = await durableStale(path);if (durable !== null) {@@ -105,7 +105,7 @@ export async function geckoFetch(path, { ttlMs = 60_000, timeoutMs = 8000 } = {}const value = await resp.json();_cache.set(path, { value, expiresAt: now + ttlMs, staleUntil: now + ttlMs + STALE_MS });if (_cache.size > MAX_ENTRIES) _cache.delete(_cache.keys().next().value);- // Fire-and-forget durable mirror — never let a cache fault fail a live fetch.+ // Fire-and-forget durable mirror, never let a cache fault fail a live fetch.Promise.resolve(cacheSet(durableKey(path), value, DURABLE_STALE_S)).catch(() => {});return value;}diff --git a/api/cron/db-retention.js b/api/cron/db-retention.jsindex 6674af010..a096bddce 100644--- a/api/cron/db-retention.js+++ b/api/cron/db-retention.js@@ -95,7 +95,7 @@ const SERIES_MAX_PER_RUN = 50_000; // per-table ceiling per tickconst ORPHAN_BATCH = 5000; // orphaned satellite rows per table per tick// Compaction bounds (section D). VACUUM FULL rewrites a table into a fresh file-// under an ACCESS EXCLUSIVE lock — cheap on Neon for these churn tables (a+// under an ACCESS EXCLUSIVE lock, cheap on Neon for these churn tables (a// 500 MB table compacted in ~2 s in the July 2026 recovery) but never free, so// only tables with real reclaimable space qualify and each tick rewrites at// most a few. Smallest-first ordering matters near the hard cap: each rewrite@@ -450,7 +450,7 @@ async function compactTables({ minFreeMb, maxTables }) {for (const t of COMPACT_CANDIDATES) {if (!(await tableExists(t))) continue;try {- // t is a fixed constant from the retention config above — safe to splice.+ // t is a fixed constant from the retention config above, safe to splice.const [r] = await sql(`SELECT * FROM pgstattuple_approx('public.${t}'::regclass)`);candidates.push({table: t,@@ -573,7 +573,7 @@ export default wrapCron(async (req, res) => {: '';sendOpsAlert('db retention pressure valve engaged',- `db ${sizeBeforeMb}MB ≥ high-water ${highWaterMb}MB — tightened firehose retention to ${minDays}d; pruned ${firehose.mints} mints, ${seriesDeleted} series rows, ${runLogsDeleted} autopilot run-log rows, ${orphansDeleted} orphaned satellite rows.${compactLine} Largest tables: ${topLine || 'n/a'}. Raise the Neon storage plan (or DB_RETENTION_HIGH_WATER_MB / PUMP_INTEL_RETENTION_DAYS) for a longer window.`,+ `db ${sizeBeforeMb}MB ≥ high-water ${highWaterMb}MB, tightened firehose retention to ${minDays}d; pruned ${firehose.mints} mints, ${seriesDeleted} series rows, ${runLogsDeleted} autopilot run-log rows, ${orphansDeleted} orphaned satellite rows.${compactLine} Largest tables: ${topLine || 'n/a'}. Raise the Neon storage plan (or DB_RETENTION_HIGH_WATER_MB / PUMP_INTEL_RETENTION_DAYS) for a longer window.`,{ signature: 'db:retention-pressure' },);}diff --git a/api/cron/intel-learn.js b/api/cron/intel-learn.jsindex 282ab5fc1..e6754c3cb 100644--- a/api/cron/intel-learn.js+++ b/api/cron/intel-learn.js@@ -44,7 +44,7 @@ export default wrapCron(async (req, res) => {// Retrain once there's enough labeled history. Skips quietly below the floor.// The sample ceiling keeps the training query's memory bounded (the signals- // JSONB per row is heavy) — freshest labeled coins win, which also tracks+ // JSONB per row is heavy), freshest labeled coins win, which also tracks// regime shifts in the launch meta.const maxSamples = Number.parseInt(process.env.INTEL_TRAIN_MAX_SAMPLES || '', 10);const train = await trainWeights({diff --git a/api/cron/treasury-topup.js b/api/cron/treasury-topup.jsindex 7bc4c9e9d..ce9f96789 100644--- a/api/cron/treasury-topup.js+++ b/api/cron/treasury-topup.js@@ -119,7 +119,7 @@ export default wrapCron(async (req, res) => {// (0.02) the self-facilitator fail-closes every settle and the autonomous// economy flat-lines. The master can never be a top-up TARGET (it is the// funding root), so its own shortfall must count as deficit here or the- // reclaim/refuel self-healing below never fires for it — the July 2026+ // reclaim/refuel self-healing below never fires for it, the July 2026// recurrences all stalled exactly this way, with the master a few thousand// lamports under the settle floor while the deficit read as engines-only.// Operating floor = reserve + working headroom for sponsor co-sign fees;@@ -134,7 +134,7 @@ export default wrapCron(async (req, res) => {masterSolBefore = (await connection.getBalance(new PublicKey(ECONOMY_MASTER_ADDRESS), 'confirmed')) / 1e9;masterDeficitSol = Math.max(0, RESERVE_SOL + masterOperatingSol - masterSolBefore);} catch {- /* balance read failed — engines-only deficit this tick, next tick retries */+ /* balance read failed, engines-only deficit this tick, next tick retries */}const totalDeficitSol = engineDeficitSol + masterDeficitSol;diff --git a/api/marketplace/[action].js b/api/marketplace/[action].jsindex 2f36a669e..6773d7428 100644--- a/api/marketplace/[action].js+++ b/api/marketplace/[action].js@@ -1127,8 +1127,8 @@ export function buildPreviewRoutes() {}}// Keyless funded anchor (GCP credits): the one lane that stays up when every- // free tier throttles at once and the paid keys are dead. Strict tail — never- // a primary — mirroring chat.js / llm.js providerChain semantics. Headers are+ // free tier throttles at once and the paid keys are dead. Strict tail, never+ // a primary, mirroring chat.js / llm.js providerChain semantics. Headers are// minted per attempt (OAuth token), so this route carries getHeaders instead// of a static headers object.if (vertexGeminiAvailable()) {diff --git a/docs/economy-master.md b/docs/economy-master.mdindex 78ac7b8d6..9f65a8252 100644--- a/docs/economy-master.md+++ b/docs/economy-master.md@@ -119,7 +119,7 @@ When the master can't cover the real deficit, the topup cron self-heals in twoautomatic steps before it ever pages a human, in cheapest-first order. Thedeficit counts the engines under floor **plus the master's own shortfall**: themaster doubles as the x402 sponsor fee wallet, and below the sponsor SOL floor-(0.02) every autonomous settle fail-closes — but the master can never be a topup+(0.02) every autonomous settle fail-closes, but the master can never be a topuptarget (it is the funding root), so without this term the self-healing neverfired for it and the economy stalled with the master a hair under the settlefloor (the July 2026 recurrences). The master's operating floor isdiff --git a/docs/ops/db-retention.md b/docs/ops/db-retention.mdindex dbc885288..55136e81f 100644--- a/docs/ops/db-retention.md+++ b/docs/ops/db-retention.md@@ -62,7 +62,7 @@ Bounded + idempotent. Each tick:across the pruned tables while every write-heavy cron sat skipped. When atick starts over the high-water mark, the cron now measures reclaimable spaceper managed table (`pgstattuple_approx`, extension auto-installed) and- `VACUUM FULL`s the worst offenders — smallest file first (each rewrite needs+ `VACUUM FULL`s the worst offenders, smallest file first (each rewrite needsheadroom about equal to the table's live size), bounded per tick, and onlyever on tables this cron itself manages. The rewrites returned`pump_coin_intel` 576→194 MB and `oracle_conviction` 386→137 MB in ~2 s eachdiff --git a/tests/api/avatar-render-framing.test.js b/tests/api/avatar-render-framing.test.jsindex afa2126ea..bfb80eaed 100644--- a/tests/api/avatar-render-framing.test.js+++ b/tests/api/avatar-render-framing.test.js@@ -64,7 +64,7 @@ describe('computeCameraFraming', () => {const bandTop = box.min.y + sizeY * preset.band[1];const covered = f.target.y + verticalHalfCoverage(f.distance, FOV);// The frustum top at the target plane must clear the band top,- // which itself is above the crown — no decapitation possible.+ // which itself is above the crown, no decapitation possible.expect(covered, `${name} @ aspect ${aspect}`).toBeGreaterThanOrEqual(bandTop);expect(bandTop).toBeGreaterThanOrEqual(box.max.y);expect(f.distance).toBeGreaterThan(0);diff --git a/tests/api/coingecko-stale.test.js b/tests/api/coingecko-stale.test.jsindex 6067b80f3..ab635cbfe 100644--- a/tests/api/coingecko-stale.test.js+++ b/tests/api/coingecko-stale.test.js@@ -70,7 +70,7 @@ describe('geckoFetch — stale-on-error', () => {// The memory stale buffer dies with the instance. The durable last-good copy// (shared cache, written on every good fetch) is what keeps a COLD instance- // serving through an upstream storm instead of 502ing — the exact failure the+ // serving through an upstream storm instead of 502ing, the exact failure the// 2026-07-22 api-sweep caught on /api/coin/exchanges.it('falls back to the durable last-good copy when memory has nothing (throttled upstream)', async () => {const path = `/coins/durable-429-${Math.round(performance.now())}`;diff --git a/tests/db-retention-compaction.test.js b/tests/db-retention-compaction.test.jsindex 0dcf25b1a..c67282445 100644--- a/tests/db-retention-compaction.test.js+++ b/tests/db-retention-compaction.test.js@@ -1,4 +1,4 @@-// pickCompactionTargets — the pure selection bounds behind db-retention's+// pickCompactionTargets, the pure selection bounds behind db-retention's// section D (VACUUM FULL under storage pressure). The floors and ordering are// what keep the rewrite step safe: never touch mostly-live tables, never// rewrite more than the per-tick cap, and always free the small files first so@@ -18,9 +18,9 @@ const pick = (candidates, over = {}) =>describe('pickCompactionTargets', () => {it('keeps only tables clearing both the absolute and ratio floors', () => {const targets = pick([- { table: 'bloated', tableMb: 100, freeMb: 60 }, // 60% free — in- { table: 'small_free', tableMb: 40, freeMb: 20 }, // 50% free but < 25 MB — out- { table: 'big_live', tableMb: 500, freeMb: 60 }, // 60 MB free but only 12% — out+ { table: 'bloated', tableMb: 100, freeMb: 60 }, // 60% free, in+ { table: 'small_free', tableMb: 40, freeMb: 20 }, // 50% free but < 25 MB, out+ { table: 'big_live', tableMb: 500, freeMb: 60 }, // 60 MB free but only 12%, out{ table: 'healthy', tableMb: 80, freeMb: 2 }, // out on both]);expect(targets.map((t) => t.table)).toEqual(['bloated']);