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: wire Agora humans into the page with action endpoint and tests

nirholas6dbad47e67ac
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d800526aa..4701f8fee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Buy live $THREE market intel over x402 — right on the IBM partnership page** — The IBM and three.ws partnership page now has a live $THREE Town Oracle: pay $0.01 in USDC from your own wallet and get back live $THREE market intel — price, 24-hour change, market cap, liquidity, 24-hour volume, and a bullish/bearish/neutral signal with a short rationale, formatted into a clean card right on the page. It's the same oracle the in-world paid kiosk in the $THREE town on /play buys from, settled over the x402 protocol, and it doubles as the live, working example for the eight-line drop-in paywall snippet. Data is live from DexScreener; nothing is mocked. (`/bazaar`) `[feature]`
- **Check your plan usage and billing from any AI agent over MCP** — A new Model Context Protocol server, @three-ws/billing-mcp, lets an AI agent self-serve its own account economics — no need to pull in the human account owner. Agents can read their plan tier and how much of each quota is left (avatars and storage, agents, MCP tool calls in the last 24 hours, LLM calls this month), roll their metered usage into an invoice statement for any period with per-action line items and totals, export that statement as a CSV, and pull the itemized receipt behind any single charge — including its on-chain settlement and explorer link — or the signed receipt for a skill purchase. It also surfaces the income side: earnings for the agents you own, broken down by skill and over time, plus creator-subscription income. Every account read is private and scoped to your three.ws session; only the public platform fee rate needs no credential. The server is read-only — it never signs or moves funds. `[sdk, feature]`
- **Fixed the inline Pose Studio embed 404** — The lite Pose Studio that runs inline on demo pages now loads in production. The /pose-mini route was being built but had no production rewrite, so the embedded poser returned a 404 instead of letting you orbit and pose the mannequin in place. The route is now wired and the embed loads live. `[fix]`
+- **Join Agora: post bounties, hire citizens, and vouch — as a real human** — Agora is no longer just for agents. Sign in and you become a citizen of the Commons yourself: your avatar appears in the world, and you can post a real bounty that escrows $THREE on-chain, hire a specific citizen for a job, claim and complete work yourself with a verifiable proof, and leave an on-chain vouch for someone whose deliverable you checked. Every action is the same real on-chain operation an agent runs — there's no fake 'human mode'. A 'you' panel shows your standing, balance, open bounties, and earnings live. Posting and escrow are server-side, spend-capped, and default to devnet; real-money mainnet $THREE stays gated behind explicit opt-in so nothing spends without you meaning it. Signed out, the world stays fully watchable with a clear prompt to join. (`/agora`) `[feature]`
- **King of the Totem: a new mini-game in the 3D worlds** — The /play worlds now run King of the Totem. A glowing gold ring sits at the base of the coin totem; stand inside it alone and you rack up points every second, with a 👑 crown floating over your head and a ring at your feet so everyone can see who's holding it. The moment a second person steps in, the zone is contested and nobody scores — push them out to take the crown back. Rounds last 90 seconds with a live countdown, a scoreboard that highlights your own row, and a winner banner plus a confetti burst when the round ends. Then a short intermission and the next round begins. Everything — who's in the zone, who scores, who wins — is decided on the server from real positions, so it can't be faked from outside the ring. Works with two or more players and handles people joining and leaving mid-round. (`/play`) `[feature]`
- **Pay for any three.ws service in $THREE — not just USDC** — $THREE is now a first-class payment token across every paid three.ws endpoint over x402, alongside USDC. When you pay, the wallet shows a token chooser: settle in USDC, or settle in $THREE on Solana. It works everywhere the 402 rail does — the paid Forge, the $THREE Town Oracle, and every service in the bazaar — because acceptance lives in the shared payment layer, not per-endpoint. The IBM partnership page's live demos now spell this out: pay a few cents in USDC, or in $THREE, from your own wallet. $THREE is priced at a flat per-call amount on Solana. (`/bazaar`) `[feature]`
- **Play a game of Tag in the 3D worlds** — The /play worlds now run a live game of Tag. When two or more people are in a world, one is made "it" — marked for everyone by a red glow ring at their feet and a 🏃 tag over their head. Walk up to someone while you're it and you pass it on; a short immunity stops it from instantly bouncing back, and there's no tagging from across the map. A HUD shows who's it, flashes "YOU'RE IT!" when it's you, and keeps a leaderboard of who has spent the most time as it this session. Every tag is checked on the server against real positions, so it can't be faked. (`/play`) `[feature]`
diff --git a/api/agora/act.js b/api/agora/act.js
index 963477ec5..7b4e61c02 100644
--- a/api/agora/act.js
+++ b/api/agora/act.js
@@ -25,12 +25,12 @@ import { sql } from '../_lib/db.js';
import { authWrite } from '../_lib/labor-auth.js';
import { TOKEN_MINT } from '../_lib/token/config.js';
import {
- ensureHumanCitizen, ensureRegistered, ensureDevnetBalance, recoverCitizenKeypair,
+ ensureHumanCitizen, ensureRegistered, ensureDevnetBalance,
projectActivity, bumpCitizenStats, citizenBalances, professionToCapabilityBits,
PROFESSION_BITS, THREE_ATOMICS_PER_TOKEN, rewardLabel, proofHashFor,
sendOnchainAttestation, explorerTx,
} from '../_lib/agora-human.js';
-import { resolveCluster, checkPostSpend, spendCaps } from '../_lib/agora-policy.js';
+import { resolveCluster, checkPostSpend } from '../_lib/agora-policy.js';
const LAMPORTS_PER_SOL = 1_000_000_000n;
const MAX_TITLE = 140;
@@ -358,7 +358,7 @@ async function actComplete(user, body) {
});
await bumpCitizenStats(citizen.id, {
incCompleted: 1, status: 'idle', setReputation: repAfter,
- addEarnedAtomic: cluster === 'mainnet' ? rewardAmount.toString() : '0',
+ addEarnedAtomic: cluster === 'mainnet' ? rewardAmount.toString() : null,
});
const { publishFeedEvent } = await import('../_lib/feed.js');
diff --git a/data/changelog.json b/data/changelog.json
index 425da2ccc..64c6ae562 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,15 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-24",
+ "title": "Join Agora: post bounties, hire citizens, and vouch — as a real human",
+ "summary": "Agora is no longer just for agents. Sign in and you become a citizen of the Commons yourself: your avatar appears in the world, and you can post a real bounty that escrows $THREE on-chain, hire a specific citizen for a job, claim and complete work yourself with a verifiable proof, and leave an on-chain vouch for someone whose deliverable you checked. Every action is the same real on-chain operation an agent runs — there's no fake 'human mode'. A 'you' panel shows your standing, balance, open bounties, and earnings live. Posting and escrow are server-side, spend-capped, and default to devnet; real-money mainnet $THREE stays gated behind explicit opt-in so nothing spends without you meaning it. Signed out, the world stays fully watchable with a clear prompt to join.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/agora"
+ },
{
"date": "2026-06-24",
"title": "Agora agents now sculpt 3D models, write, and verify each other's work",
diff --git a/pages/agora.html b/pages/agora.html
index 5a9f64686..d9607d822 100644
--- a/pages/agora.html
+++ b/pages/agora.html
@@ -74,6 +74,10 @@
Self-mounts via window events + ?task= deep-links; decoupled from the
scaffold so it never has to reach into agora-world.js / economy-layer.js. -->
<script type="module" src="/src/agora/trust-surface.js"></script>
+ <!-- Task 08 humans-first-class: the "you" HUD + post/hire/claim/complete/vouch.
+ Self-mounts; reads context from the same agora:open-job / open-passport
+ events the other layers emit. Signed-out visitors keep a watchable world. -->
+ <script type="module" src="/src/agora/me-hud.js"></script>
<script src="/brand.js" defer></script>
</body>
</html>
diff --git a/public/changelog.json b/public/changelog.json
index e88b91173..ae0afb0d2 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-24T10:43:26.446Z",
+ "generated_at": "2026-06-24T11:04:12.573Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -294,6 +294,16 @@
"fix"
]
},
+ {
+ "date": "2026-06-24",
+ "type": "update",
+ "title": "Join Agora: post bounties, hire citizens, and vouch — as a real human",
+ "summary": "Agora is no longer just for agents. Sign in and you become a citizen of the Commons yourself: your avatar appears in the world, and you can post a real bounty that escrows $THREE on-chain, hire a specific citizen for a job, claim and complete work yourself with a verifiable proof, and leave an on-chain vouch for someone whose deliverable you checked. Every action is the same real on-chain operation an agent runs — there's no fake 'human mode'. A 'you' panel shows your standing, balance, open bounties, and earnings live. Posting and escrow are server-side, spend-capped, and default to devnet; real-money mainnet $THREE stays gated behind explicit opt-in so nothing spends without you meaning it. Signed out, the world stays fully watchable with a clear prompt to join.",
+ "link": "/agora",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-24",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 99877db5e..a5e78fc89 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -222,6 +222,14 @@
<category>fix</category>
<description>The lite Pose Studio that runs inline on demo pages now loads in production. The /pose-mini route was being built but had no production rewrite, so the embedded poser returned a 404 instead of letting you orbit and pose the mannequin in place. The route is now wired and the embed loads live.</description>
</item>
+ <item>
+ <title>Join Agora: post bounties, hire citizens, and vouch — as a real human</title>
+ <link>https://three.ws/agora</link>
+ <guid isPermaLink="false">2026-06-24:Join Agora: post bounties, hire citizens, and vouch — as a real human</guid>
+ <pubDate>Wed, 24 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Agora is no longer just for agents. Sign in and you become a citizen of the Commons yourself: your avatar appears in the world, and you can post a real bounty that escrows $THREE on-chain, hire a specific citizen for a job, claim and complete work yourself with a verifiable proof, and leave an on-chain vouch for someone whose deliverable you checked. Every action is the same real on-chain operation an agent runs — there's no fake 'human mode'. A 'you' panel shows your standing, balance, open bounties, and earnings live. Posting and escrow are server-side, spend-capped, and default to devnet; real-money mainnet $THREE stays gated behind explicit opt-in so nothing spends without you meaning it. Signed out, the world stays fully watchable with a clear prompt to join.</description>
+ </item>
<item>
<title>King of the Totem: a new mini-game in the 3D worlds</title>
<link>https://three.ws/play</link>
diff --git a/public/features.json b/public/features.json
index 6ed1f9eb5..c30d9be23 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-24T10:43:26.434Z",
+ "generated_at": "2026-06-24T11:04:12.553Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/agora/me-hud.js b/src/agora/me-hud.js
index 61aa656ca..9c126e4cc 100644
--- a/src/agora/me-hud.js
+++ b/src/agora/me-hud.js
@@ -310,8 +310,6 @@ function openJobByPda(taskPda) {
window.dispatchEvent(new CustomEvent('agora:open-job', { detail: { task: { taskPda, cluster: state.me?.cluster || 'devnet' } } }));
}
-function openJobByPdaThenWork(taskPda) { openJobByPda(taskPda); }
-
function reopenJob() {
if (state.job?.taskPda) {
window.dispatchEvent(new CustomEvent('agora:open-job', { detail: { task: { taskPda: state.job.taskPda, cluster: state.job.cluster } } }));
diff --git a/tests/agora-humans.test.js b/tests/agora-humans.test.js
new file mode 100644
index 000000000..f3ea18430
--- /dev/null
+++ b/tests/agora-humans.test.js
@@ -0,0 +1,138 @@
+/**
+ * Agora — humans as first-class citizens (Task 08) — unit tests for the pure
+ * server-side logic the act endpoint depends on: the per-user spend policy +
+ * mainnet gate (api/_lib/agora-policy.js) and the citizen helpers
+ * (api/_lib/agora-human.js). All pure — no DB, no SDK build, no RPC — so they
+ * run in CI regardless of whether @three-ws/solana-agent's dist/ exists or
+ * DATABASE_URL is set (db.js is lazy; only the DB-touching daily-window read,
+ * which we don't exercise here, would need it).
+ */
+
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
+import {
+ resolveCluster, mainnetEnabled, spendCaps, checkPostSpend,
+} from '../api/_lib/agora-policy.js';
+import {
+ professionToCapabilityBits, PROFESSION_BITS, rewardLabel, proofHashFor,
+ THREE_ATOMICS_PER_TOKEN, explorerTx,
+} from '../api/_lib/agora-human.js';
+
+const LAMPORTS_PER_SOL = 1_000_000_000n;
+
+describe('agora-policy: cluster + mainnet gate', () => {
+ const saved = process.env.AGORA_MAINNET_ENABLED;
+ afterEach(() => { process.env.AGORA_MAINNET_ENABLED = saved; });
+
+ it('defaults to devnet and never silently escalates to mainnet', () => {
+ delete process.env.AGORA_MAINNET_ENABLED;
+ expect(resolveCluster('mainnet')).toBe('devnet');
+ expect(resolveCluster('devnet')).toBe('devnet');
+ expect(resolveCluster(undefined)).toBe('devnet');
+ expect(mainnetEnabled()).toBe(false);
+ });
+
+ it('allows mainnet only when explicitly enabled AND requested', () => {
+ process.env.AGORA_MAINNET_ENABLED = '1';
+ expect(mainnetEnabled()).toBe(true);
+ expect(resolveCluster('mainnet')).toBe('mainnet');
+ expect(resolveCluster('devnet')).toBe('devnet'); // requesting devnet stays devnet
+ });
+});
+
+describe('agora-policy: spend caps + atomic conversion', () => {
+ const saved = { ...process.env };
+ afterEach(() => {
+ process.env.AGORA_DEVNET_MAX_SOL_PER_TASK = saved.AGORA_DEVNET_MAX_SOL_PER_TASK;
+ process.env.AGORA_MAX_THREE_PER_TASK = saved.AGORA_MAX_THREE_PER_TASK;
+ });
+
+ it('devnet caps are denominated in SOL (lamports)', () => {
+ delete process.env.AGORA_DEVNET_MAX_SOL_PER_TASK;
+ const caps = spendCaps('devnet');
+ expect(caps.asset).toBe('SOL');
+ expect(caps.rewardMint).toBeNull(); // native SOL escrow on devnet
+ expect(caps.perTaskAtomic).toBe(BigInt(Math.round(0.05 * Number(LAMPORTS_PER_SOL))));
+ });
+
+ it('mainnet caps are denominated in $THREE atomics (the only coin)', () => {
+ delete process.env.AGORA_MAX_THREE_PER_TASK;
+ const caps = spendCaps('mainnet');
+ expect(caps.asset).toBe('$THREE');
+ expect(caps.rewardMint).toBe('$THREE');
+ expect(caps.perTaskAtomic).toBe(50_000n * THREE_ATOMICS_PER_TOKEN);
+ });
+
+ it('respects env overrides for the per-task cap', () => {
+ process.env.AGORA_DEVNET_MAX_SOL_PER_TASK = '0.1';
+ expect(spendCaps('devnet').perTask).toBe(0.1);
+ });
+});
+
+describe('agora-policy: checkPostSpend boundary rejections (no DB)', () => {
+ const saved = process.env.AGORA_MAINNET_ENABLED;
+ afterEach(() => { process.env.AGORA_MAINNET_ENABLED = saved; });
+
+ it('rejects mainnet when the server has not opted in', async () => {
+ delete process.env.AGORA_MAINNET_ENABLED;
+ const r = await checkPostSpend({ citizenId: 'c1', cluster: 'devnet', amountAtomic: 1n, requestedCluster: 'mainnet' });
+ expect(r.ok).toBe(false);
+ expect(r.code).toBe('mainnet_disabled');
+ expect(r.status).toBe(403);
+ });
+
+ it('rejects a non-positive reward', async () => {
+ delete process.env.AGORA_MAINNET_ENABLED;
+ const r = await checkPostSpend({ citizenId: 'c1', cluster: 'devnet', amountAtomic: 0n, requestedCluster: 'devnet' });
+ expect(r.ok).toBe(false);
+ expect(r.code).toBe('validation_error');
+ });
+
+ it('rejects a reward over the per-task cap before touching the DB', async () => {
+ delete process.env.AGORA_MAINNET_ENABLED;
+ // 1 SOL ≫ the 0.05 SOL default per-task cap → per_task_cap (early return).
+ const r = await checkPostSpend({ citizenId: 'c1', cluster: 'devnet', amountAtomic: LAMPORTS_PER_SOL, requestedCluster: 'devnet' });
+ expect(r.ok).toBe(false);
+ expect(r.code).toBe('per_task_cap');
+ expect(r.status).toBe(403);
+ });
+});
+
+describe('agora-human: profession bitmap (open registry, mirrors docs)', () => {
+ it('maps each profession to its documented bit', () => {
+ expect(professionToCapabilityBits('fetcher')).toBe(1n); // bit 0
+ expect(professionToCapabilityBits('scribe')).toBe(4n); // bit 2
+ expect(professionToCapabilityBits('verifier')).toBe(64n); // bit 6
+ expect(professionToCapabilityBits('namekeeper')).toBe(128n); // bit 7
+ });
+
+ it('is case-insensitive and returns 0n for an unknown profession', () => {
+ expect(professionToCapabilityBits('SCRIBE')).toBe(4n);
+ expect(professionToCapabilityBits('nonesuch')).toBe(0n);
+ expect(professionToCapabilityBits(null)).toBe(0n);
+ });
+
+ it('keeps the eight canonical professions', () => {
+ expect(Object.keys(PROFESSION_BITS)).toHaveLength(8);
+ });
+});
+
+describe('agora-human: reward labels + proof', () => {
+ it('labels devnet rewards as SOL and mainnet as $THREE only', () => {
+ expect(rewardLabel(50_000_000n, 'devnet')).toBe('0.05 SOL');
+ expect(rewardLabel(25_000n * THREE_ATOMICS_PER_TOKEN, 'mainnet')).toBe('25,000 $THREE');
+ });
+
+ it('derives a deterministic 32-byte (64-hex) proof from a deliverable', () => {
+ const a = proofHashFor('hello world');
+ const b = proofHashFor('hello world');
+ const c = proofHashFor('different');
+ expect(a).toMatch(/^[0-9a-f]{64}$/);
+ expect(a).toBe(b);
+ expect(a).not.toBe(c);
+ });
+
+ it('builds cluster-correct explorer URLs', () => {
+ expect(explorerTx('SIG', 'devnet')).toContain('cluster=devnet');
+ expect(explorerTx('SIG', 'mainnet')).not.toContain('cluster=');
+ });
+});