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(reputation): document and prove the conviction staking market
nirholasf6663852d2da
diff --git a/docs/reputation-staking-market.md b/docs/reputation-staking-market.mdnew file mode 100644index 000000000..9f1b38d52--- /dev/null+++ b/docs/reputation-staking-market.md@@ -0,0 +1,172 @@+# Docs: Reputation Staking Market++Stake conviction on an agent, earn from its attested action history. The+Reputation Staking Market turns the existing `threews.stake.v1` conviction+signal into escrowed positions: principal sits in a market escrow, yield is+derived per epoch from the agent's signed on-chain attestations, and a+withdrawal returns principal plus earnings in one settlement transaction.++The load-bearing contract is+[specs/REPUTATION_STAKING_MARKET.md](https://github.com/nirholas/three.ws/blob/main/specs/REPUTATION_STAKING_MARKET.md)+(`rsm.v1`). This page is the walkthrough; when the two disagree, the spec wins.++Live surface: [/reputation/market](/reputation/market).++## What the market pays for++Reputation is already attested on Solana as signed SPL-Memo envelopes indexed+into `solana_attestations` (see [docs/solana-reputation](./solana-reputation.md)).+An agent's `threews.accept.v1`, `threews.task.v1`, `threews.validation.v1`,+`threews.feedback.v1`, `threews.dispute.v1`, and `threews.revoke.v1` envelopes+are its attested action history: work it shipped, validations it passed or+failed, and reviews it earned.++The market reads exactly that history and pays stakers for backing agents+whose history is real. Each epoch (one UTC day) a fixed reward pool splits+across every open position in proportion to:++```+posWeight = principal × epochFraction × agentWeight+```++where `agentWeight` comes from the agent's attestations that epoch: passed+validations and accepted tasks count as work, failed validations, disputes,+and revocations count as faults (at double weight), and the 1-5 feedback scale+sets a quality multiplier. The full table, rounding rules, and constants live+in spec §5; the only implementation is `src/shared/reputation-staking.js`,+which runs identically on the server and in the browser.++Two consequences worth knowing before you stake:++- **An idle agent earns nothing.** Zero attested work in an epoch means+ `agentWeight === 0` for that epoch, so its stakers earn zero that epoch.+ Principal is never at risk; conviction on a quiet agent is just unrewarded.+- **Positions are never slashed.** Bad conviction is punished by zero yield,+ not confiscated principal. The market expresses trust; it does not+ underwrite an agent's losses.++## Networks++| Network | Status | What it costs |+|---|---|---|+| devnet | open | Nothing. Airdropped lamports, the free proof path. |+| mainnet | owner-gated | Writes refuse with `mainnet_gated` until the owner sets `REPUTATION_MARKET_ALLOW_MAINNET=1` on the service. |++Opening mainnet is one owner action, one command:++```bash+gcloud run services update three-ws-api --region us-central1 \+ --update-env-vars REPUTATION_MARKET_ALLOW_MAINNET=1+```++Everything below works on devnet today, unchanged.++## Stake++A stake is a transaction **you** sign and broadcast; the market never signs it.+One transaction, two instructions: a transfer of your principal to the market+escrow, and an SPL Memo envelope tagged `market: "rsm.v1"` naming the agent,+your 1-5 conviction score, and the escrow. The transaction signature is your+position id.++From the page, connect a Solana wallet on [/reputation/market](/reputation/market),+pick an agent, choose an amount (minimum 0.001 SOL) and a conviction score, and+sign. The page then calls `POST /api/reputation/market-stake` with the+signature; the server verifies the transaction against the chain (memo shape,+escrow match, balance delta) and indexes the position. Verification is a chain+read, so no caller can assert a principal the chain did not record.++From code, `stakeOnMarket` in `src/solana-stake.js` builds the exact+transaction:++```js+import { stakeOnMarket } from '/solana-stake.js';++const signature = await stakeOnMarket({+ agentAsset: agent.solanaAsset, // the agent's Solana asset pubkey+ escrow, // from GET /api/reputation/market+ lamports: 5_000_000n, // 0.005 SOL+ score: 4, // 1-5 conviction+ network: 'devnet',+ wallet, // a connected wallet adapter+});+await fetch('/api/reputation/market-stake', {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ signature, network: 'devnet' }),+});+```++## Earn++The position starts accruing in the epoch it opens, for the fraction of the+day it was actually open. Pending earnings recompute on every read; they are+only fixed when a settlement lands. Watch them on the positions section of+[/reputation/market](/reputation/market) or read them directly:++```bash+curl "https://three.ws/api/reputation/market-positions?staker=<wallet>&network=devnet"+```++Every position row carries a per-epoch breakdown, so the number the page+quotes is auditable against the spec, epoch by epoch.++## Withdraw++There is no lockup. Withdraw any time:++```bash+curl -X POST https://three.ws/api/reputation/market-withdraw \+ -H 'content-type: application/json' \+ -d '{"signature": "<stake signature>", "network": "devnet"}'+```++The market escrow signs one settlement transaction paying principal plus+earnings back to the staker recorded on-chain, with a `threews.unstake.v1`+memo carrying both numbers. Only the escrow ever signs a settlement, and it+pays only the on-chain staker, so nobody can route your payout to themselves.++Withdrawal is idempotent: the position flips to `settling` before the payout+is signed, so a crash is retried, never double-paid; a second withdrawal of a+`closed` position returns the original settlement.++One solvency rule (spec §2): earnings can never exceed the escrow's reward+surplus. If accrued earnings exceed the surplus, the payout clamps to the+surplus and the settlement records `clamped: true`. Principal always returns+in full.++## Verify it yourself++The database behind the market is an index, not the ledger. Every position is+re-derivable by replaying the chain: positions from `threews.stake.v1` memos+into the escrow, settlements from `threews.unstake.v1` memos out of it.++`scripts/reputation-market-proof.mjs` runs the whole contract against Solana+devnet with airdropped lamports: fund, stake, verify, accrue against real+attested action history, withdraw, and re-read the chain to confirm the+settlement. It takes no arguments:++```bash+node scripts/reputation-market-proof.mjs+```++## HTTP surface++| Endpoint | Method | Purpose |+|---|---|---|+| `/api/reputation/market?network=devnet` | GET | Agents ranked by net staked conviction, epoch weight, realized yield. |+| `/api/reputation/market-positions?staker=<wallet>&network=devnet` | GET | Every position a wallet holds, with pending earnings. |+| `/api/reputation/market-stake` | POST | Index a stake transaction. Body: `{ signature, network }`. |+| `/api/reputation/market-withdraw` | POST | Settle a position. Body: `{ signature, network }`. |++Failure codes (`market_not_configured`, `mainnet_gated`, `tx_not_found`,+`not_a_market_stake`, `stake_below_minimum`, `unknown_position`,+`already_closed`, `escrow_unsigned`) are pinned in spec §9.++## Related++- [Docs: Agent Reputation on Solana](./solana-reputation.md): the attestation+ layer the market reads.+- [Docs: Reputation System](./reputation.md): the cross-chain reputation model.+- [Reputation Explorer](/reputation): inspect any agent's score and+ attestations.diff --git a/public/reputation/market/index.html b/public/reputation/market/index.htmlindex 33dde1e42..c54e3b9bf 100644--- a/public/reputation/market/index.html+++ b/public/reputation/market/index.html@@ -29,7 +29,7 @@<meta property="og:url" content="https://three.ws/reputation/market" /><metaproperty="og:image"- content="https://three.ws/api/page-og?s=agent-tools&t=Reputation+Staking+Market&d=Stake+conviction+on+an+agent+and+earn+from+its+attested+action+history.&p=%2Freputation%2Fmarket"+ content="https://three.ws/api/page-og?s=agent-tools&t=Reputation+Staking+Market&d=Stake+conviction+on+an+agent+and+earn+from+its+attested+action+history%3A+escrowed+principal%2C+per-epoch+yield+derived+from+signed+on-chain+attestations%2C+withdraw&p=%2Freputation%2Fmarket"/><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="630" />@@ -194,7 +194,15 @@.rsm-head { align-items: flex-start; }}</style>- </head>++ <link rel="canonical" href="https://three.ws/reputation/market">+ <meta property="og:locale" content="en_US">+ <meta property="og:image:alt" content="Reputation Staking Market - three.ws">+ <meta name="twitter:title" content="Reputation Staking Market · three.ws">+ <meta name="twitter:description" content="Stake conviction on an agent and earn from its attested action history: escrowed principal, per-epoch yield derived from signed on-chain attestations, withdraw any time.">+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=agent-tools&t=Reputation+Staking+Market&d=Stake+conviction+on+an+agent+and+earn+from+its+attested+action+history%3A+escrowed+principal%2C+per-epoch+yield+derived+from+signed+on-chain+attestations%2C+withdraw&p=%2Freputation%2Fmarket">+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Reputation Staking Market","description":"Stake conviction on an agent and earn from its attested action history: escrowed principal, per-epoch yield derived from signed on-chain attestations, withdraw any time.","url":"https://three.ws/reputation/market","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=agent-tools&t=Reputation+Staking+Market&d=Stake+conviction+on+an+agent+and+earn+from+its+attested+action+history%3A+escrowed+principal%2C+per-epoch+yield+derived+from+signed+on-chain+attestations%2C+withdraw&p=%2Freputation%2Fmarket"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"Reputation","item":"https://three.ws/reputation"},{"@type":"ListItem","position":3,"name":"Market","item":"https://three.ws/reputation/market"}]}]}</script>+</head><body><a href="#rsm-content" class="h-skip-link">Skip to content</a>diff --git a/scripts/reputation-market-proof.mjs b/scripts/reputation-market-proof.mjsnew file mode 100644index 000000000..e3259fd9a--- /dev/null+++ b/scripts/reputation-market-proof.mjs@@ -0,0 +1,318 @@+#!/usr/bin/env node+// Reputation Staking Market: the executable end-to-end proof (spec §10).+//+// Runs the full rsm.v1 contract against Solana devnet with airdropped+// lamports, no database and no live server required:+//+// 1. fund : generate a staker + an agent identity, airdrop devnet SOL+// 2. attest : write a real attested action history for the agent on-chain+// (accept, passed validation, feedback: three signed SPL-Memo+// envelopes naming the agent, exactly what the index crawls)+// 3. stake : the staker signs a market stake (transfer + rsm.v1 memo)+// 4. verify : verifyStakeTx re-derives the position from the chain alone+// 5. accrue : quoteEarnings over the on-chain action history (the same+// function the HTTP surface and settlement path call)+// 6. withdraw: the escrow signs the settlement (principal + earnings back to+// the staker, threews.unstake.v1 memo), then the chain is+// re-read to confirm both the transfer and the memo+//+// Escrow resolution, in order:+// 1. REPUTATION_MARKET_ESCROW_SECRET_KEY (the real deployment escrow: the+// settlement is signed by the same key the service would use)+// 2. an ephemeral escrow generated for the run, funded by the staker+// Either way the proof settles with a real signature; mode 2 exists so the+// proof is runnable by anyone with no credentials at all.+//+// Env (all optional):+// REPUTATION_MARKET_ESCROW_SECRET_KEY escrow secret (base58/base64/JSON)+// SOLANA_RPC_URL_DEVNET devnet RPC override+// REPUTATION_MARKET_EPOCH_POOL_LAMPORTS epoch pool for the quote+// (default 2000000: 0.002 SOL)+//+// Exit 0 on a fully verified cycle, 1 with the failing stage named otherwise.++import { Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js';++import {+ marketConfig,+ verifyStakeTx,+ readActionHistoryFromChain,+ quoteEarnings,+ lamportsReceivedBy,+ feePayerOf,+ MARKET_TAG,+ MIN_STAKE_LAMPORTS,+ UNSTAKE_KIND,+} from '../api/_lib/reputation-market.js';+import { RPC, extractMemoPayload, validatePayload } from '../api/_lib/solana-attestations.js';+import { decodeAttesterSecret } from '../api/_lib/attest-event.js';+import { solanaConnection } from '../api/_lib/solana/connection.js';+import { sendAndConfirm } from '../api/_lib/solana/confirm.js';+import { epochOf, formatSol } from '../src/shared/reputation-staking.js';++const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');+const NETWORK = 'devnet';+const STAKE_LAMPORTS = 2_000_000n; // 0.002 SOL, twice the minimum+const DEFAULT_POOL_LAMPORTS = 2_000_000n;+const AIRDROP_LAMPORTS = 100_000_000; // 0.1 SOL per request, devnet-friendly+const CONFIRM_TIMEOUT_MS = 60_000;++const results = [];+function step(name, ok, detail) {+ results.push({ step: name, ok, detail });+ console.log(`${ok ? 'PASS' : 'FAIL'} ${name}${detail ? ` (${detail})` : ''}`);+ if (!ok) {+ console.error(JSON.stringify({ ok: false, failed: name, results }, null, 2));+ process.exit(1);+ }+}++async function fundWithAirdrops(conn, pubkey, targetLamports) {+ let balance = BigInt(await conn.getBalance(pubkey, 'confirmed'));+ while (balance < BigInt(targetLamports)) {+ let advanced = false;+ for (let attempt = 0; attempt < 5 && !advanced; attempt++) {+ try {+ const sig = await conn.requestAirdrop(pubkey, AIRDROP_LAMPORTS);+ await conn.confirmTransaction(sig, 'confirmed');+ advanced = true;+ } catch (err) {+ // Devnet faucets rate-limit hard; back off and retry.+ await new Promise((r) => setTimeout(r, 3_000 * (attempt + 1)));+ if (attempt === 4) throw new Error(`airdrop failed: ${err.message}`);+ }+ }+ balance = BigInt(await conn.getBalance(pubkey, 'confirmed'));+ }+ return balance;+}++async function attest(conn, signer, agentAsset, payload) {+ const memoIx = new TransactionInstruction({+ keys: [+ { pubkey: signer.publicKey, isSigner: true, isWritable: false },+ { pubkey: agentAsset, isSigner: false, isWritable: false },+ ],+ programId: MEMO_PROGRAM_ID,+ data: Buffer.from(JSON.stringify(payload), 'utf8'),+ });+ const tx = new Transaction().add(memoIx);+ return sendAndConfirm(conn, tx, [signer], { commitment: 'confirmed', timeoutMs: CONFIRM_TIMEOUT_MS });+}++const main = async () => {+ const conn = solanaConnection({ url: RPC[NETWORK], commitment: 'confirmed' });++ // ── 1. fund ───────────────────────────────────────────────────────────+ const staker = Keypair.generate();+ const agent = Keypair.generate();+ const agentAsset = agent.publicKey;++ const envSecret = process.env.REPUTATION_MARKET_ESCROW_SECRET_KEY;+ let escrowKeypair;+ let escrowMode;+ if (envSecret && decodeAttesterSecret(envSecret)) {+ escrowKeypair = Keypair.fromSecretKey(decodeAttesterSecret(envSecret));+ escrowMode = 'configured';+ } else {+ escrowKeypair = Keypair.generate();+ escrowMode = 'ephemeral';+ }+ const escrow = escrowKeypair.publicKey;+ step('config', true, `network=${NETWORK} escrow=${escrow.toBase58()} (${escrowMode})`);++ await fundWithAirdrops(conn, staker.publicKey, 20_000_000); // stake + fees + headroom+ step('fund', true, `staker=${staker.publicKey.toBase58()}`);++ const poolLamports = process.env.REPUTATION_MARKET_EPOCH_POOL_LAMPORTS+ ? BigInt(process.env.REPUTATION_MARKET_EPOCH_POOL_LAMPORTS)+ : DEFAULT_POOL_LAMPORTS;++ // The escrow needs the earnings it will pay out, plus fees and its rent floor.+ // A configured escrow may already be funded; an ephemeral one never is, so+ // top up only the shortfall.+ const rentFloor = BigInt(await conn.getMinimumBalanceForRentExemption(0));+ const wantEscrow = poolLamports + rentFloor + 20_000n;+ const escrowHave = BigInt(await conn.getBalance(escrow, 'confirmed'));+ if (escrowHave < wantEscrow) {+ const topUp = new Transaction().add(+ SystemProgram.transfer({+ fromPubkey: staker.publicKey,+ toPubkey: escrow,+ lamports: wantEscrow - escrowHave,+ }),+ );+ await sendAndConfirm(conn, topUp, [staker], { commitment: 'confirmed', timeoutMs: CONFIRM_TIMEOUT_MS });+ }+ step('escrow-funded', true, `balance=${await conn.getBalance(escrow, 'confirmed')} lamports`);++ // ── 2. attest: a real action history for the agent ────────────────────+ const runId = Date.now().toString(36);+ const attestations = [+ { v: 1, kind: 'threews.task.v1', agent: agentAsset.toBase58(), task_id: `rsm-proof-${runId}`, scope_hash: `rsm-proof-${runId}` },+ { v: 1, kind: 'threews.accept.v1', agent: agentAsset.toBase58(), task_id: `rsm-proof-${runId}` },+ { v: 1, kind: 'threews.validation.v1', agent: agentAsset.toBase58(), task_hash: `rsm-proof-${runId}`, passed: true },+ { v: 1, kind: 'threews.feedback.v1', agent: agentAsset.toBase58(), score: 5, task_id: `rsm-proof-${runId}` },+ ];+ for (const payload of attestations) {+ await attest(conn, staker, agentAsset, payload);+ }+ step('attest', true, `${attestations.length} signed memos on ${agentAsset.toBase58()}`);++ // ── 3. stake: staker-signed transfer + rsm.v1 memo ────────────────────+ const stakeMemo = JSON.stringify({+ v: 1,+ kind: 'threews.stake.v1',+ market: MARKET_TAG,+ agent: agentAsset.toBase58(),+ score: 4,+ escrow: escrow.toBase58(),+ });+ const stakeTx = new Transaction().add(+ SystemProgram.transfer({ fromPubkey: staker.publicKey, toPubkey: escrow, lamports: STAKE_LAMPORTS }),+ new TransactionInstruction({+ keys: [{ pubkey: staker.publicKey, isSigner: true, isWritable: false }],+ programId: MEMO_PROGRAM_ID,+ data: Buffer.from(stakeMemo, 'utf8'),+ }),+ );+ const stakeSignature = await sendAndConfirm(conn, stakeTx, [staker], {+ commitment: 'confirmed',+ timeoutMs: CONFIRM_TIMEOUT_MS,+ });+ step('stake', true, `signature=${stakeSignature} principal=${STAKE_LAMPORTS}`);++ // ── 4. verify: the position re-derived from the chain alone ───────────+ const env = {+ ...process.env,+ REPUTATION_MARKET_ESCROW_PUBKEY: escrow.toBase58(),+ REPUTATION_MARKET_ESCROW_SECRET_KEY: undefined,+ REPUTATION_MARKET_EPOCH_POOL_LAMPORTS: poolLamports.toString(),+ };+ const verified = await verifyStakeTx({ signature: stakeSignature, network: NETWORK, env });+ const verifyOk =+ verified.staker === staker.publicKey.toBase58() &&+ verified.agentAsset === agentAsset.toBase58() &&+ verified.principalLamports === STAKE_LAMPORTS &&+ verified.score === 4;+ step('verify', verifyOk, `staker=${verified.staker} principal=${verified.principalLamports}`);++ // ── 5. accrue: earnings quoted from the on-chain action history ───────+ const now = Math.floor(Date.now() / 1000);+ const history = await readActionHistoryFromChain({ agentAsset: agentAsset.toBase58(), network: NETWORK });+ const epoch = epochOf(now);+ const inEpoch = history.filter((a) => epochOf(a.blockTime) === epoch);+ step('history', inEpoch.length >= attestations.length, `${inEpoch.length} attested actions in epoch ${epoch}`);++ const position = {+ id: stakeSignature,+ agentAsset: agentAsset.toBase58(),+ principalLamports: STAKE_LAMPORTS,+ openedAt: verified.openedAt,+ closedAt: null,+ };+ const { byPosition, agentWeightsByEpoch } = quoteEarnings({+ positions: [position],+ historyByAgent: new Map([[agentAsset.toBase58(), history]]),+ poolLamports,+ now,+ });+ const quote = byPosition.get(stakeSignature);+ const agentWeight = agentWeightsByEpoch.get(epoch)?.get(agentAsset.toBase58()) ?? 0;+ if (!(agentWeight > 0)) {+ step('accrue', false, `agentWeight is ${agentWeight}; the attested history produced no work`);+ }+ step(+ 'accrue',+ quote && quote.lamports > 0n,+ `agentWeight=${agentWeight} earnings=${quote?.lamports} lamports over ${quote?.byEpoch.length} epoch(s)`,+ );++ // ── 6. withdraw: escrow-signed settlement, verified back on-chain ─────+ const earnings = quote.lamports;+ const payout = STAKE_LAMPORTS + earnings;+ const settleMemo = JSON.stringify({+ v: 1,+ kind: UNSTAKE_KIND,+ market: MARKET_TAG,+ agent: agentAsset.toBase58(),+ stake: stakeSignature,+ principal: STAKE_LAMPORTS.toString(),+ earnings: earnings.toString(),+ });+ const settleTx = new Transaction().add(+ SystemProgram.transfer({ fromPubkey: escrow, toPubkey: staker.publicKey, lamports: payout }),+ new TransactionInstruction({ keys: [], programId: MEMO_PROGRAM_ID, data: Buffer.from(settleMemo, 'utf8') }),+ );+ const settleSignature = await sendAndConfirm(conn, settleTx, [escrowKeypair], {+ commitment: 'confirmed',+ timeoutMs: CONFIRM_TIMEOUT_MS,+ });+ step('withdraw', true, `signature=${settleSignature} payout=${payout} lamports`);++ // Re-read the settlement from the chain: the staker received exactly the+ // payout, the memo validates as threews.unstake.v1, and it names this stake.+ const settledTx = await conn.getTransaction(settleSignature, {+ commitment: 'confirmed',+ maxSupportedTransactionVersion: 0,+ });+ const received = lamportsReceivedBy(settledTx, staker.publicKey.toBase58());+ const payer = feePayerOf(settledTx);+ const memoBack = extractMemoPayload(settledTx);+ const chainOk =+ received === payout &&+ payer === escrow.toBase58() &&+ memoBack &&+ validatePayload(memoBack) &&+ memoBack.kind === UNSTAKE_KIND &&+ memoBack.stake === stakeSignature &&+ memoBack.principal === STAKE_LAMPORTS.toString() &&+ memoBack.earnings === earnings.toString();+ step(+ 'settlement-on-chain',+ Boolean(chainOk),+ `staker received ${received} lamports; memo validates and names stake ${stakeSignature.slice(0, 12)}…`,+ );++ const cfg = marketConfig(NETWORK, env);+ if (!cfg.escrow || cfg.escrow.toBase58() !== escrow.toBase58()) {+ step('config-echo', false, 'marketConfig did not resolve the escrow the proof used');+ }+ step('config-echo', true, 'marketConfig resolves the same escrow the proof settled from');++ console.log(+ JSON.stringify(+ {+ ok: true,+ network: NETWORK,+ escrowMode,+ escrow: escrow.toBase58(),+ agent: agentAsset.toBase58(),+ staker: staker.publicKey.toBase58(),+ stake: {+ signature: stakeSignature,+ principalLamports: STAKE_LAMPORTS.toString(),+ explorer: `https://explorer.solana.com/tx/${stakeSignature}?cluster=devnet`,+ },+ settlement: {+ signature: settleSignature,+ earningsLamports: earnings.toString(),+ payoutLamports: payout.toString(),+ explorer: `https://explorer.solana.com/tx/${settleSignature}?cluster=devnet`,+ },+ epoch,+ agentWeight,+ stakeSol: formatSol(STAKE_LAMPORTS),+ earningsSol: formatSol(earnings),+ steps: results.map((r) => r.step),+ },+ null,+ 2,+ ),+ );+};++main().catch((err) => {+ console.error(`FAIL ${err.message}`);+ process.exit(1);+});