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
feat(labor-market): bring escrow online with self-healing release gas
qbdz721332231368
diff --git a/api/_lib/labor-escrow.js b/api/_lib/labor-escrow.jsindex 7f48b90c2..fd6deaa5d 100644--- a/api/_lib/labor-escrow.js+++ b/api/_lib/labor-escrow.js@@ -18,10 +18,27 @@ import bs58 from 'bs58';import { transferSolanaUSDC } from './solana-transfer.js';import { TOKEN_MINT } from './token/config.js';+import {+ isConfigured as treasuryConfigured, getTreasuryKeypair,+ transferSol, lamportBalance, treasuryConnection, SOL,+} from './platform-treasury.js';let _escrowKp = null;let _escrowWarned = false;+// The escrow wallet pays its own SOL fees when it RELEASES funds (worker payout,+// royalty, poster refund). Posting only ever credits escrow, so a fresh escrow+// wallet can hold $THREE without SOL — but it cannot release without gas. Keep a+// small SOL buffer topped up from the platform treasury so settlements never get+// stuck waiting on a hand-funded gas balance. A dedicated LABOR_ESCROW_GAS_SECRET+// overrides the shared treasury when an operator wants the gas to come from its+// own wallet. With neither configured this is a clean no-op (releases proceed on+// whatever SOL the escrow already holds; if that is zero the transfer fails loud+// and the bounty stays in a resumable state).+const GAS_OVERRIDE_ENV = 'LABOR_ESCROW_GAS_SECRET';+const GAS_FLOOR_LAMPORTS = BigInt(Math.floor(0.01 * SOL)); // top up when escrow dips below this+const GAS_TOPUP_LAMPORTS = BigInt(Math.floor(0.04 * SOL)); // amount sent per top-up+/** The base58 secret for the escrow wallet, or null (read paths). */function escrowSecretOrNull() {const s = process.env.LABOR_ESCROW_SECRET_BASE58;@@ -101,6 +118,30 @@ export async function fundEscrow({ fromKeypair, amountAtomics }) {});}+/**+ * Ensure the escrow wallet holds enough SOL to pay release fees, topping it up+ * from the platform treasury when it dips below the floor. Best-effort: never+ * throws (a release can still succeed on the escrow's existing balance), and a+ * no-op when neither a gas wallet nor the shared treasury is configured.+ * @returns {Promise<{ topped: boolean, reason?: string, sig?: string, balance?: string }>}+ */+export async function ensureEscrowGas() {+ const addr = escrowAddressOrNull();+ if (!addr) return { topped: false, reason: 'escrow_unconfigured' };+ if (!treasuryConfigured(GAS_OVERRIDE_ENV)) return { topped: false, reason: 'gas_source_unconfigured' };+ try {+ const conn = treasuryConnection('mainnet');+ const balance = await lamportBalance(conn, addr);+ if (balance >= GAS_FLOOR_LAMPORTS) return { topped: false, reason: 'sufficient', balance: balance.toString() };+ const gasKp = await getTreasuryKeypair(GAS_OVERRIDE_ENV);+ const sig = await transferSol(conn, gasKp, addr, Number(GAS_TOPUP_LAMPORTS));+ return { topped: true, sig, balance: balance.toString() };+ } catch (e) {+ console.error('[labor-escrow] gas top-up failed', e?.message);+ return { topped: false, reason: 'topup_failed' };+ }+}+/*** Release from escrow to a destination wallet (worker payout, author royalty, or* poster refund). Returns the real settlement tx signature.diff --git a/api/_lib/labor-settle.js b/api/_lib/labor-settle.jsindex 5fb842725..6a8c963ab 100644--- a/api/_lib/labor-settle.js+++ b/api/_lib/labor-settle.js@@ -22,7 +22,7 @@ import {autoBidForBounty, autoAwardIfReady, performJob,} from './labor-match.js';import { getBounty, getJobByBounty } from './agent-labor.js';-import { payFromEscrow } from './labor-escrow.js';+import { payFromEscrow, ensureEscrowGas } from './labor-escrow.js';import { recoverSolanaAgentKeypair } from './agent-wallet.js';import { recordInvocationReceipt } from './agent-invocation-onchain.js';import { recordCustodyEvent } from './agent-trade-guards.js';@@ -51,6 +51,11 @@ export async function runSettlement({ job, bounty, verdict: providedVerdict = nureturn { idempotent: true, status: cur?.status || job.status, job: cur || job };}+ // Both terminal paths below release SOL-paying transfers from escrow (payout or+ // refund). Top the escrow's gas buffer up first so a settlement never stalls on a+ // drained fee balance. Best-effort — never throws.+ await ensureEscrowGas().catch((e) => console.warn('[labor-settle] gas ensure failed', e?.message));+// ── Verify ───────────────────────────────────────────────────────────────const verdict = providedVerdict || (await verifyDeliverable({ bounty, deliverable: claimed.deliverable }));await recordVerdict(job.id, verdict);diff --git a/data/changelog.json b/data/changelog.jsonindex d87cb7836..09daa187c 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,40 @@{"$comment": "Curated changelog entries for three.ws \u2014 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-30",+ "title": "Memory seeding no longer times out",+ "summary": "Building your agent's memory seed from your connected accounts could fail with an opaque error when the language model took a moment to respond — the request was being cut off before it finished and the page showed a generic failure. The synthesis step now has the time it needs to complete, automatically falls over to a backup provider if one is slow, and when it genuinely can't run it tells you plainly instead of failing silently.",+ "tags": [+ "fix"+ ]+ },+ {+ "date": "2026-06-30",+ "title": "Agent Labor Market escrow is live",+ "summary": "The Agent Labor Market now settles in real $THREE on-chain. When an agent posts a bounty, the reward moves from its wallet into a dedicated escrow wallet that actually holds the funds until the work is verified — then releases the worker's payout and the skill author's royalty, or refunds the poster if the work fails the neutral verifier. The market header shows escrow status as Live, posting a bounty is open, and the escrow wallet keeps its own gas topped up so settlements never stall. Every move is a real SPL transfer with an explorer link.",+ "tags": [+ "feature"+ ],+ "link": "/labor-market"+ },+ {+ "date": "2026-06-30",+ "title": "Marketplace & trading viability get a dedicated page",+ "summary": "The two \"honest signal\" panels — marketplace viability (real $THREE skill GMV, take-rate, repeat buyers, trading pairs) and trading viability (real guarded coin-trade flow, cost and realized P&L on closed positions) — now live on their own page at /viability. The Money Pulse stays focused on the live event feed and links across to the full viability breakdown, so each surface does one thing well. Same real on-chain numbers, just easier to read and share.",+ "tags": [+ "improvement"+ ],+ "link": "/viability"+ },+ {+ "date": "2026-06-30",+ "title": "Agent profiles show the agent's real 3D body again",+ "summary": "An agent page now renders the avatar the agent actually wears — including non-humanoid bodies like animals and props — instead of falling back to the default mannequin. The profile was discarding the model link returned for the agent's avatar before it reached the 3D stage, so any agent whose body came through that field silently showed the placeholder figure. The real model now flows through to the hero and fullscreen viewers, and bodies with their own built-in animation play it on the spot.",+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-29","title": "Live data feeds stay online through database hiccups",diff --git a/tests/api-labor-lifecycle.test.js b/tests/api-labor-lifecycle.test.jsindex 26dc96c04..0265c96e2 100644--- a/tests/api-labor-lifecycle.test.js+++ b/tests/api-labor-lifecycle.test.js@@ -47,7 +47,8 @@ vi.mock('../api/_lib/labor-match.js', () => ({}));const payFromEscrow = vi.fn(async ({ toAddress, amountAtomics }) => `SIG:${toAddress}:${amountAtomics}`);-vi.mock('../api/_lib/labor-escrow.js', () => ({ payFromEscrow }));+const ensureEscrowGas = vi.fn(async () => ({ topped: false, reason: 'gas_source_unconfigured' }));+vi.mock('../api/_lib/labor-escrow.js', () => ({ payFromEscrow, ensureEscrowGas }));vi.mock('../api/_lib/agent-wallet.js', () => ({recoverSolanaAgentKeypair: vi.fn(async () => ({ publicKey: { toBase58: () => 'WADDR' } })),