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(agora-citizens): seat the specialist crafts before the platform agents
nirholasdbb1c6e469c8
diff --git a/tests/agora-work-proof.test.js b/tests/agora-work-proof.test.jsindex d95b8770f..bebb61155 100644--- a/tests/agora-work-proof.test.js+++ b/tests/agora-work-proof.test.js@@ -23,7 +23,7 @@ import {} from '../workers/agora-citizens/work/_skills.js';import { runVerifier } from '../workers/agora-citizens/work/verifier.js';import { ACTIVE_PROFESSIONS, hasRunner, runProfession } from '../workers/agora-citizens/work/index.js';-import { buildRoster, primaryProfession } from '../workers/agora-citizens/roster.js';+import { buildRoster, primaryProfession, professionForAgent } from '../workers/agora-citizens/roster.js';const sha = (s) => createHash('sha256').update(s).digest('hex');const dataUrl = (bytes, mime = 'application/octet-stream') =>@@ -144,6 +144,44 @@ describe('active roster — ships only professions with a reachable runner', ()}});+ it('the crafts survive a fleet crowded with platform agents', () => {+ // Every shapeSeeded() platform agent primaries `fetcher`; the crafts exist+ // only among the standalone specialists. When the platform-agent pool was+ // seated first, a populated DB plus the default cap of 4 cut every craft and+ // silently rebuilt the Fetcher-only workforce this task exists to replace.+ const seeds = Array.from({ length: 40 }, (_, i) => ({ id: `1111111${i}-0000-4000-8000-00000000000${i % 10}`, name: `Platform Agent ${i}` }));+ const fleet = buildRoster(seeds, { maxCitizens: 4 });++ expect(fleet).toHaveLength(4);+ const primaries = fleet.map((c) => c.profession);+ expect(primaries).not.toEqual(['fetcher', 'fetcher', 'fetcher', 'fetcher']);+ expect(primaries).toContain('sculptor');+ for (const c of fleet) expect(hasRunner(c.profession)).toBe(true);+ });++ it('platform agents still fill the fleet once the crafts are seated', () => {+ const seeds = Array.from({ length: 40 }, (_, i) => ({ id: `2222222${i}-0000-4000-8000-00000000000${i % 10}`, name: `Platform Agent ${i}` }));+ const fleet = buildRoster(seeds, { maxCitizens: 20 });++ expect(fleet).toHaveLength(20);+ // The seven standalone specialists, then real platform agents for the rest.+ expect(fleet.filter((c) => c.agentDbId != null).length).toBe(13);+ expect(new Set(fleet.map((c) => c.profession))).toContain('scribe');+ });++ it('professionForAgent never assigns a craft with no runner', () => {+ // Both paths: a real signal (category/tags/name) and the signal-less spread.+ const signalled = ['3d scene', 'world map', 'diorama builder', 'spatial architect', 'voice narrator', 'defi analytics', 'ens resolver', 'fact-check audit', 'research writing'];+ for (const category of signalled) {+ const prof = professionForAgent({ id: `sig-${category}`, category, tags: [], name: category });+ expect(hasRunner(prof), `"${category}" mapped to "${prof}"`).toBe(true);+ }+ for (let i = 0; i < 200; i++) {+ const prof = professionForAgent({ id: `signal-less-${i}`, category: null, tags: [], name: `Agent ${i}` });+ expect(hasRunner(prof), `signal-less agent ${i} mapped to "${prof}"`).toBe(true);+ }+ });+it('verifier is never a citizen primary (it needs a verification target)', () => {// runVerifier requires job.target; if a citizen primaried it, a normal task// (no target) would always fail. Verifier is only ever a secondary bit.diff --git a/workers/agora-citizens/roster.js b/workers/agora-citizens/roster.jsindex 1fded5d74..c8712ec64 100644--- a/workers/agora-citizens/roster.js+++ b/workers/agora-citizens/roster.js@@ -160,17 +160,27 @@ export function buildRoster(seededAgents, cfg) {// This is also the deterministic fleet for a local devnet run or a CI smoke.const seeds = cfg.standaloneOnly ? [] : seededAgents || [];- for (let i = 0; i < seeds.length && specs.length < cfg.maxCitizens; i++) {- const spec = shapeSeeded(seeds[i], specs.length);+ // Standalone specialists are seated FIRST, and the reason is the whole point of+ // the profession roster: every shapeSeeded() platform agent primaries `fetcher`+ // (its real skills are not yet mapped to capability bits), while the crafts+ // (Sculptor, Scribe, Crier, Appraiser, Namekeeper) exist ONLY here. Filling from+ // the platform-agent pool first, as this did, silently rebuilt the Fetcher-only+ // workforce: maxCitizens defaults to 4 and any populated DB returns far more+ // than 4 agents, so the specialists were always cut and no citizen ever sculpted+ // or wrote anything. Seating the crafts first guarantees the labour market+ // actually has labour in it at every cap; platform agents take every remaining+ // slot, which is most of them once the cap is raised past the seven specialists.+ for (let i = 0; specs.length < cfg.maxCitizens && i < STANDALONE.length; i++) {+ const spec = shapeStandalone(STANDALONE[i], specs.length);if (seen.has(spec.key)) continue;seen.add(spec.key);specs.push(spec);}- // Fill to the floor (and up to the cap) with standalone citizens so the world- // is never empty even on a fresh DB with no agents.- for (let i = 0; specs.length < cfg.maxCitizens && i < STANDALONE.length; i++) {- const spec = shapeStandalone(STANDALONE[i], specs.length);+ // Real platform agents fill the rest of the fleet, so the world is populated by+ // the platform's own agents rather than only the founding workforce.+ for (let i = 0; i < seeds.length && specs.length < cfg.maxCitizens; i++) {+ const spec = shapeSeeded(seeds[i], specs.length);if (seen.has(spec.key)) continue;seen.add(spec.key);specs.push(spec);@@ -203,14 +213,17 @@ function hashStr(str) {// signal-less agent is spread across so the Commons reads as a varied labour// market. Every craft is backed by a real platform skill (work/*.js), so the// assignment is a JOB, never a fabricated capability.-const CRAFTS = ['sculptor', 'scribe', 'cartographer', 'crier', 'appraiser', 'namekeeper', 'verifier'];+const CRAFTS = ['sculptor', 'scribe', 'crier', 'appraiser', 'namekeeper', 'verifier'];// Real-signal to profession, checked before the deterministic spread so an agent// that actually carries a signal works the matching craft.const SIGNAL_PROFESSION = [[/voice|audio|music|speech|sing|podcast|narrat|entertain/i, 'crier'],[/design|3d|model|sculpt|render|\bart\b|avatar|blender|mesh/i, 'sculptor'],- [/scene|\bmap\b|world|diorama|architect|spatial|environment/i, 'cartographer'],+ // Scene/world signals route to Sculptor, the nearest craft that actually+ // ships. Cartographer (bit 3) is deferred and has no runner, so labelling a+ // citizen with it would seat a worker that fails every job it is handed.+ [/scene|\bmap\b|world|diorama|architect|spatial|environment/i, 'sculptor'],[/market|token|trad|finance|invest|intel|analy|\bdao\b|governance|defi|price/i, 'appraiser'],[/name|\bens\b|domain|registr|resolver/i, 'namekeeper'],[/verif|audit|proof|security|moderat|fact.?check/i, 'verifier'],@@ -230,9 +243,13 @@ export function professionForAgent(agent) {.filter(Boolean).join(' ');for (const [re, prof] of SIGNAL_PROFESSION) if (re.test(hay)) return prof;- // Signal-less: even deterministic spread across ALL professions (including the- // universal Fetcher) so the Commons reads as a balanced labour market.- const all = PROFESSIONS.map((p) => p.key);+ // Signal-less: even deterministic spread across the ACTIVE professions (the+ // shipped crafts plus the universal Fetcher) so the Commons reads as a balanced+ // labour market. Spreading across the full PROFESSIONS bitmap instead would+ // hand some agents a deferred craft with no runner: a citizen that can only+ // ever fail. Deferred bits stay documented in PROFESSIONS; they are just never+ // assigned as somebody's job.+ const all = [...CRAFTS, 'fetcher'];return all[hashStr(agent.id) % all.length];}