http://localhost:8081 (Fastify on SERVER_PORT). CORS: CORS_ORIGIN=* by default; tighten in production.
Health
{ ok: true, ... }.
Oracles
fillCount so the UI can rank parallel oracle ladders by liquidity.
Quotes
QUOTE_CACHE_TTL_S, default 300s). Miss to quote-worker schedules a fresh poll.
Positions
/v1/users/:address/redemptions returns one row per redemption (predict + binary settlement::Redeemed), with realized P&L computed at read time as payout - qty × avg_fill_cost per (oracle, strike, side). Binary rows have null basis (pair mints are cost-neutral; basis lives in future V3 fills). Supports ?afterMs=<ms> to filter to a specific window (used by /agents/:id to exclude pre-registration manual trades).
Agents
/v1/agents LEFT JOINs agent_runtime so mandate + llmModel come back for hosted-fleet agents. mandate is null for CLI-registered agents.
/v1/agents/:id/actions returns the per-tick decision log. Each row carries the model’s reasoning and structured decision (action, strike, confidence) plus the tx digest if a mint landed. Powers the Why? expand on /agents/:id settlement rows.
/v1/agents/:id/operator returns the ephemeral signing address (the actual on-chain trader). Frontend uses this for redemption + position queries instead of agent.owner, since fleet agents trade from the ephemeral key.
Hosted-fleet agent control plane
These endpoints power the Create wizard, Owner Controls, and the fleet runtime itself.DarkPool · Create agent · owner=<addr> · ts=<ms>, 5-min replay window), enforces MAX_AGENTS_PER_OWNER, mints an ephemeral keypair, AES-GCM encrypts the secret, signs two sponsored PTBs, INSERT into agent_runtime, double-writes to agents so the leaderboard sees it immediately.
predict_manager::deposit<DUSDC> for the deposited coin, updates last_funded_ms.
agent_runtime can call). Server decrypts the agent key, signs predict_manager::withdraw_all<DUSDC> and transfers to the fixed ownerAddress from the DB. Recipient is never user-supplied. the agent always reclaims to its registered owner.
GET /v1/agents/fleet is Authorization: Bearer ${FLEET_REGISTRY_TOKEN} only. Returns decrypted secrets for the fleet runtime. Gate at the edge (nginx) on production deployments. Runs auto-disable inline: any agent with <$1 PM balance and now - max(created_ms, last_funded_ms) > 3 days gets enabled=false.
POST .../:id/tick atomically increments counters via sql\$ + 1`and inserts a row intoagent_actions`.
Vaults
Binary markets
.binary-markets/registry.json from disk + merges live Settlement state (finalOutcome, expiryMs) with a 4s LRU. New markets show up immediately, no migration needed.
Optimistic Oracle
Trades fast-path
fills table so the UI can refresh activity without waiting for the indexer poll.
Self-sponsorship
WebSocket
See WebSocket API.Files
Every route lives underpackages/server/src/routes/:
packages/server/src/entrypoints/api.ts.
