#pragma once #include "evo/network/intent_admission.hpp" #include "evo/server/lifecycle/cellular_batch.hpp" #include "evo/persistence/region_lease.hpp" #include #include #include #include #include #include namespace evo::server { enum class CellularSessionBatchError : std::uint8_t { tick, intents, action, life, duplicate_action, duplicate_birth, invalid_birth, unperceived_target, head, batch_full, action_limit, biology }; struct CellularSessionTick { CellularTickIntents intents; std::vector actions; }; // Overlays authenticated v7 actions onto the scheduler's complete per-life input set. // The scheduler owns all non-player and no-message behavior; this adapter only binds a // durable action to the one live account-owned life and preserves its canonical bytes. [[nodiscard]] std::expected prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick, std::span baseline, std::span actions); // Builds one bounded publication from the last durable head. Its working copy is private; // only the host may publish, and callers must discard it after uncertainty until the host // resolves that exact prepared batch. class CellularSessionBatchBuilder { public: [[nodiscard]] static std::expected create(const CellularLives& committed_state, const persistence::RegionHead& committed_head); [[nodiscard]] std::expected append(std::uint64_t tick, std::span baseline, std::span actions, std::span births = {}); [[nodiscard]] const CellularBatch& batch() const noexcept { return batch_; } [[nodiscard]] std::span actions() const noexcept { return actions_; } [[nodiscard]] const CellularLives& candidate() const noexcept { return *working_; } private: explicit CellularSessionBatchBuilder(std::unique_ptr working) : working_{std::move(working)} {} std::unique_ptr working_; CellularBatch batch_; std::vector actions_; }; } // namespace evo::server