Files
aevolution/include/evo/server/lifecycle/cellular_admin_view.hpp
T
dingoandClaude Opus 5.5 7273b157d6
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (checks) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Successful in 29s
Foundation / server-image (push) Successful in 4m42s
Foundation / image (push) Successful in 5m55s
feat(admin): live tuning revisions adopted at recorded ticks (schema 66)
ADR-0182 section 13. The admin portal's Tuning page edits the world's
rules-13 tuning (the Git revamp file format); the admin API checks it,
stores an append-only revision and queues an adopt_tuning admin command
(kind 7: revision and rules digest) for every region of the world.

- Lifecycle: adopt_tuning replaces the region's rules after births when
  a resolver names the rules for that revision and digest; the safety
  revision cannot change live. At most one adoption per batch.
- Host: fetches the revision text, rebuilds and digests the rules before
  appending the command; publication and recovery name the rules from
  the successor state, checked against the recorded digest.
- Schema 66: tuning_revisions, admin_set_tuning_v1, load_tuning_revision_v1
  (runtime), admin_tuning_revisions_v1, admin_tuning_text_v1.
- OpsServer: optional bounded request bodies (Content-Length, 413).
- Region view: rules_sha256, so the portal shows each region's revision.
- Portal: Tuning page; baseline from the mounted cellular-revamp.tuning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 19:35:09 -04:00

41 lines
2.2 KiB
C++

#pragma once
#include "evo/server/lifecycle/cellular_lives.hpp"
#include <cstddef>
#include <functional>
#include <string>
#include <string_view>
// 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],"cells_total":N,"deposits_total":N,
// "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.
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<bool(const LifeAccount&)>;
[[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