feat(admin): read-only admin portal and API (ADR-0182 step 1, schema 61)
evo-admin-api serves the portal at srs.aeternalisgames.com and read-only JSON for world 100 behind Keycloak (realm role aevolution-admin, audience aevolution-admin, client aevolution-admin-portal): accounts with session, status, lives, deaths, resets and mutation choices; one account's lives; the world's regions; and a live 2D region view of cells, wildlife, pools and bubbles. The portal is plain HTML/CSS/JS with PKCE sign-in, a strict CSP and no third-party code. - Schema 61: three bounded SECURITY DEFINER read functions, fenced in the privilege audit; no table or existing function changes. - Cellular regions answer GET /admin/view on the ops port (NetworkPolicy: Prometheus and the admin portal only); CellularLives::extent_of reads the existing phenotype budget. No simulation, checkpoint or wire change. - TokenVerifier takes an optional realm role and returns the email; the ops server's response bound is configurable (16 KiB default unchanged). - DEV component admin-portal-dev (Deployment, Service, NetworkPolicies); the Ingress and the aevolution-admin-pg Secret are created out of band. - CI scripts pinned to schema 60 now expect 61. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "evo/server/lifecycle/cellular_lives.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
// 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,"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],...],
|
||||
// "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. 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.
|
||||
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 = {});
|
||||
// Lowercase 8-4-4-4-12 text of a 16-byte account.
|
||||
[[nodiscard]] std::string cellular_account_text(const LifeAccount& account);
|
||||
} // namespace evo::server
|
||||
@@ -328,6 +328,9 @@ class CellularLives {
|
||||
[[nodiscard]] accounting::Inventory heat() const noexcept;
|
||||
// Rules 13: burned matter and kill remainders waiting to drip back as bubbles.
|
||||
[[nodiscard]] accounting::Inventory spent() const noexcept;
|
||||
// ADR-0182 observers: a life's square footprint side in micrometres, as the step uses it;
|
||||
// nullopt when its genome cannot be costed. Reads the state; changes nothing.
|
||||
[[nodiscard]] std::optional<std::uint32_t> extent_of(const CellularOwnedLife& life) const;
|
||||
[[nodiscard]] accounting::Inventory opening_total() const noexcept;
|
||||
[[nodiscard]] accounting::Inventory current_total() const noexcept;
|
||||
[[nodiscard]] const CellularBoundaryLedger& boundary_ledger() const noexcept;
|
||||
|
||||
Reference in New Issue
Block a user