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(reputation): tell a staker why staking is closed and expose net conviction to SDK consumers
nirholas18c0572b9fc9
diff --git a/docs/reputation-staking-market.md b/docs/reputation-staking-market.mdindex 36e57b358..a7923ff35 100644--- a/docs/reputation-staking-market.md+++ b/docs/reputation-staking-market.md@@ -135,6 +135,20 @@ surplus. If accrued earnings exceed the surplus, the payout clamps to thesurplus and the settlement records `clamped: true`. Principal always returnsin full.+### What a withdrawal does to the agent's reputation++Settling retires the conviction the stake expressed. The agent's reputation card+(`GET /api/agents/solana-reputation`) counts what is **still** staked, so your+position drops out of `stake.total_lamports` and out of `stake.top_stakers` the+moment the settlement lands. Backing an agent and then walking away does not+leave a permanent endorsement behind.++The history is not erased: `stake.gross_lamports` still reports everything ever+staked and `stake.retired_lamports` what settlement gave back, so "1 SOL staked,+3 SOL withdrawn" stays distinguishable from "1 SOL staked". Only the market+escrow's settlements retire anything, so nobody can deflate an agent's standing+by writing a memo naming somebody else's stake. Spec §3.3.+## Verify it yourselfThe database behind the market is an index, not the ledger. Every position isdiff --git a/docs/solana-reputation.md b/docs/solana-reputation.mdindex ba1e461b9..af248725e 100644--- a/docs/solana-reputation.md+++ b/docs/solana-reputation.md@@ -78,6 +78,21 @@ The crawler (`crawlAgentAttestations`) calls `getSignaturesForAddress(asset)` fr- An **accept**/**dispute** is `verified` only if the signer is the agent owner.- **feedback**/**validation**/**task** are `verified` when structurally valid; their *trust tier* is decided at read time.+### Staked conviction is reported net, not gross++The `stake` block of the reputation response counts what is **still** staked. When a staker withdraws through the [Reputation Staking Market](reputation-staking-market.md), the escrow writes a `threews.unstake.v1` memo naming that stake, and the conviction it expressed stops counting: withdrawn conviction is not conviction. Only the market escrow's own settlements retire anything, so a stranger cannot deflate an agent's standing with a memo naming somebody else's stake.++The history is reported alongside the net figure rather than erased:++| Field | Meaning |+|---|---|+| `stake.total_lamports` | Net conviction: still staked right now. |+| `stake.gross_lamports` | Everything ever staked behind this agent. |+| `stake.retired_lamports` / `stake.retired_count` | What settlement gave back. |+| `stake.count` / `stake.unique_stakers` / `stake.top_stakers` | Net: a fully withdrawn staker is no longer listed as backing the agent. |++The rule is pinned in [`specs/REPUTATION_STAKING_MARKET.md`](../specs/REPUTATION_STAKING_MARKET.md) §3.3 and implemented by `netConviction` in `api/_lib/reputation-market.js`.+### The trust tiers (the Sybil-resistance ladder)The reputation API (`GET /api/agents/solana-reputation?asset=<pubkey>&network=<mainnet|devnet>`) doesn't return one number — it returns the same score computed at four trust levels, strongest first:diff --git a/packages/reputation/src/index.js b/packages/reputation/src/index.jsindex 49f04fe05..f7255f1df 100644--- a/packages/reputation/src/index.js+++ b/packages/reputation/src/index.js@@ -269,12 +269,21 @@ function shapeSolanaReputation(res) {};}+// `totalLamports` is NET conviction: settled positions are retired out of it+// (REPUTATION_STAKING_MARKET.md §3.3). `grossLamports` and `retiredLamports` keep+// the history readable, so "3 SOL staked, 2 withdrawn" is still tellable from+// "1 SOL staked".function shapeStake(stake) {- if (!stake || typeof stake !== 'object') return { totalLamports: '0', count: 0, uniqueStakers: 0, topStakers: [] };+ if (!stake || typeof stake !== 'object') {+ return { totalLamports: '0', count: 0, uniqueStakers: 0, grossLamports: '0', retiredLamports: '0', retiredCount: 0, topStakers: [] };+ }return {totalLamports: stake.total_lamports ?? '0',count: stake.count ?? 0,uniqueStakers: stake.unique_stakers ?? 0,+ grossLamports: stake.gross_lamports ?? stake.total_lamports ?? '0',+ retiredLamports: stake.retired_lamports ?? '0',+ retiredCount: stake.retired_count ?? 0,topStakers: Array.isArray(stake.top_stakers)? stake.top_stakers.map((s) => ({ attester: s.attester ?? null, lamports: s.lamports ?? '0', score: s.score ?? null })): [],diff --git a/public/reputation/market/market.js b/public/reputation/market/market.jsindex d2e231b54..2847ccc36 100644--- a/public/reputation/market/market.js+++ b/public/reputation/market/market.js@@ -232,13 +232,27 @@ async function loadMarket() {*/function syncWritability() {const m = state.market;- const blocked = !m || !m.escrow || (state.network === 'mainnet' && !m.mainnet_open);+ // Name the reason, never just grey the button out: a disabled control with no+ // visible explanation reads as a broken page, and a title tooltip is invisible+ // to touch and to screen readers.+ let reason = '';+ if (!m) reason = 'The market has not loaded yet, so staking is unavailable. Reload to try again.';+ else if (!m.escrow) reason = `This deployment has no staking escrow configured on ${m.network}, so there is nowhere for principal to go. Nothing can be staked here yet.`;+ else if (state.network === 'mainnet' && !m.mainnet_open) reason = 'Mainnet staking is owner-gated on this deployment. Devnet is open and free.';++ const blocked = Boolean(reason);for (const el of [els.stakeGo, els.recordForm.querySelector('button')]) {el.disabled = blocked;- el.title = blocked ? 'This network is not open for staking on this deployment.' : '';+ el.title = reason;}- if (blocked && m && state.network === 'mainnet' && !m.mainnet_open) {- say(els.stakeMsg, 'Mainnet staking is owner-gated on this deployment. Devnet is open.', '');+ els.stakeForm.setAttribute('aria-disabled', String(blocked));+ if (blocked) {+ say(els.stakeMsg, reason);+ els.stakeMsg.dataset.blocked = '1';+ } else if (els.stakeMsg.dataset.blocked) {+ // Clear only a reason this function wrote, never a live signing status.+ say(els.stakeMsg, '');+ delete els.stakeMsg.dataset.blocked;}}