#pragma once #include "evo/server/lifecycle/cellular_lives.hpp" #include #include #include #include // ADR-0182 read-only region view for the admin portal: every cell, pool and bubble of a // cellular owner as compact JSON. It reads the committed in-memory state and changes nothing; // it is not a simulation output, a checkpoint or a client protocol. // // {"world":W,"region":R,"tick":T,"rules":N,["rules_sha256":"hex",]"area":[w,h], // "spent":[e,c,n,p,o],"heat":pj, // ["drip":[interval_ticks,bubble_pj,bubble_fg,heat_recycle_per_mille,absorb],] // "cells_total":N,"deposits_total":N, // "counts":[players,wildlife,patches,pools,bubbles], // "totals":{"reserve":[e,c,n,p,o],"body":[...],"patches":[...],"pools":[...],"bubbles":[...]}, // "cells":[["life","organism","account",x,y,extent,flags,members, // reserve_e,reserve_c,reserve_n,reserve_p,reserve_o,body_mass,"root"],...], // "deposits":[[id,kind,x,y,radius,e,c,n,p,o],...]} // // Cell positions are the lower-left corner of the square footprint and deposits their centre, // in micrometres. Life and organism ids are decimal strings (bud ids exceed 2^53); `account` // is the lowercase UUID, empty for wildlife; `root` the lineage root (the founder whose life // request a lineage descends from, cellular_lineage_root). Flags: 1 wildlife, 2 the account's // session is connected, 4 lingering, 8 suspended. Deposit kind: 0 patch, 1 pool, 2 bubble. Energy // in pJ, matter in fg. Cells and deposits beyond the limits are left out (by ascending life id and // deposit id); the totals still count them. `rules_sha256` is given by the caller (the SHA-256 // of encode_cellular_revamp_rules, which tuning revisions are adopted by) and left out when empty. // `heat` is the energy the region's cells have used and not yet recycled (CellularLives::heat). // `drip` is the rules-13 spent-pool drip (cellular_drip_spent) and its energy cycle (ADR-0182 // section 14), left out before rules 13. // `counts` and `totals` cover every life and deposit, whatever the limits: the region's stock // is the totals plus `spent`. namespace evo::server { struct CellularAdminViewLimits { std::size_t cells{4096}, deposits{16384}; }; // True when the account's session is connected to this region. using CellularAdminOnline = std::function; [[nodiscard]] std::string render_cellular_admin_view(const CellularLives& state, const CellularAdminOnline& online, CellularAdminViewLimits limits = {}, std::string_view rules_sha256 = {}); // Lowercase 8-4-4-4-12 text of a 16-byte account. [[nodiscard]] std::string cellular_account_text(const LifeAccount& account); } // namespace evo::server