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.
03. Auto-resolution from our own data
Read docs/prompts/event-markets/README.md first.
The problem
A market is only trusted if it settles by a rule everyone could read in advance, from data anyone can inspect, with no human picking the winner. Our events already produce that data. Nothing reads it back into a market.
Build
Check for the contract in api/_lib/event-markets/. If absent, create the minimal seam from the README first.
api/_lib/event-markets/resolvers/: one module persource_kind, each exportingdescribe(rule)(plain-language rule for the UI) andresolve(market)returning{ winnerOutcomeId, evidence }or{ pending: true }or{ void: true, reason }.arena_tournament: final standings of the tournament (readdocs/trading-arenas.mdand the data behindapi/arena-og.js).event_leaderboard: rank 1 at window end fromapi/play/event-leaderboard.jslogic, using its own tiebreak.launch_cohort: highest metric (volume, holders or market cap, chosen inresolution_rule) among the cohort's launches, from our launch records only.build_round: winner of a program round once judging data exists.bounty: the submission the bounty owner accepts.
- Evidence: every resolution stores the inputs it read (ids, values, timestamps) in the market row so anyone can audit why it resolved the way it did. The market page shows it.
- Lifecycle cron: lock at
locks_at, resolve at or afterresolves_at, retry whilepending, void on a documented timeout. Idempotent: running twice never double-settles. Register it invercel.jsoncrons and sync with the scheduler script as the repo does for other crons. - Ties: define and document the rule per source kind (split, tiebreak or void). Never leave a market stuck.
- Disputes: an admin
overrideroute that requires a written reason, is logged, and shows on the market page. The default path never needs it. - Settlement of points: on resolve, award or deduct points per the contract, once, in one transaction.
Docs and wiring
docs/event-markets.md section "How markets resolve" with one paragraph per source kind. STRUCTURE.md row, changelog entry tagged feature.
Acceptance
- Run each resolver against a real finished event in our data and show the evidence it stored.
- Re-running the cron on a resolved market changes nothing.
- A tie, a no-data event and a cancelled event each end in the documented state.
- Tests with fixtures taken from real records.
npm testgreen.