Define cellular owner diagnostics v9
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m1s
Foundation / checks (client) (push) Failing after 4m26s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 01:52:33 -04:00
parent a6a18dd6cd
commit fe03a0f8e4
9 changed files with 313 additions and 42 deletions
+38 -9
View File
@@ -3,6 +3,7 @@
#include <cstddef>
#include <cstdint>
#include <expected>
#include <optional>
#include <span>
#include <string>
#include <variant>
@@ -29,6 +30,8 @@ inline constexpr std::uint16_t session_protocol_v6 = 6;
inline constexpr std::uint16_t session_protocol_v7 = 7;
// v8 adds the authenticated owner's exact, bounded cellular perception view.
inline constexpr std::uint16_t session_protocol_v8 = 8;
// v9 adds owner-only current reserve and last committed tick effects to the v8 view.
inline constexpr std::uint16_t session_protocol_v9 = 9;
inline constexpr std::size_t max_cellular_perceived_patches = 256;
inline constexpr std::size_t session_address_bytes = 64; // Endpoint or server name field.
inline constexpr std::size_t session_datagram_bytes = 1200; // Whole message, ADR-0089.
@@ -77,7 +80,7 @@ enum class AdmitStatus : std::uint8_t {
};
// Wire u16 (SessionAction::kind carries the raw value; admission validates it).
enum class ActionKind : std::uint8_t {
probe = 1, // No effect on biology: proves admission, scheduling and durability (M10.4).
probe = 1, // No effect on biology: proves admission, scheduling and durability (M10.4).
cellular = 2 // v7 biological input, committed with profile-4 state (ADR-0111/0112).
};
enum class ActionResult : std::uint8_t {
@@ -181,12 +184,38 @@ struct CellularPerceivedPatch {
std::uint32_t x_um{}, y_um{};
std::uint64_t energy_pj{};
std::array<std::uint64_t, 4> matter_fg{};
friend bool operator==(const CellularPerceivedPatch&, const CellularPerceivedPatch&) =
default;
friend bool operator==(const CellularPerceivedPatch&, const CellularPerceivedPatch&) = default;
};
enum class CellularMovementResult : std::uint8_t {
not_reported,
no_movement,
moved,
blocked,
insufficient_energy
};
enum class CellularIntakeResult : std::uint8_t {
not_reported,
not_requested,
acquired,
missing_patch,
out_of_contact
};
struct CellularLifeDiagnostics {
std::uint64_t reserve_energy_pj{};
std::array<std::uint64_t, 4> reserve_matter_fg{};
std::uint64_t maintenance_cost_pj{}, movement_cost_pj{};
CellularMovementResult movement{CellularMovementResult::not_reported};
CellularIntakeResult intake{CellularIntakeResult::not_reported};
bool has_tick_effects{};
friend bool operator==(const CellularLifeDiagnostics&,
const CellularLifeDiagnostics&) = default;
};
struct CellularPerception {
std::uint64_t tick{}, life_identity{}; // zero life plus no patches clears the view.
std::uint64_t tick{}, life_identity{}; // zero life plus no patches clears the view.
std::vector<CellularPerceivedPatch> patches; // strictly ordered by (x_um, y_um).
// Present only on v9 for an active life. The values are authoritative observations,
// not client claims or additional simulation state.
std::optional<CellularLifeDiagnostics> diagnostics;
friend bool operator==(const CellularPerception&, const CellularPerception&) = default;
};
struct IntentionReceipt {
@@ -301,11 +330,11 @@ struct SessionRedirect {
};
using SessionMessage =
std::variant<SessionHello, SessionWelcome, SessionRefresh, SessionRefreshResult, SessionClose,
SessionIntention, CellularIntention, CellularAction, IntentionReceipt, SimulatedThrough,
SessionAction, ActionReceipt, ActionOutcome, ActionQuery, SessionInterest,
SnapshotChunk, SnapshotAck, HandoffOffer, SessionRedirect, PrimitiveLifeRequest,
PrimitiveLifeReceipt, PrimitiveLifeOutcome, PrimitiveLifeQuery,
CellularPerception>;
SessionIntention, CellularIntention, CellularAction, IntentionReceipt,
SimulatedThrough, SessionAction, ActionReceipt, ActionOutcome, ActionQuery,
SessionInterest, SnapshotChunk, SnapshotAck, HandoffOffer, SessionRedirect,
PrimitiveLifeRequest, PrimitiveLifeReceipt, PrimitiveLifeOutcome,
PrimitiveLifeQuery, CellularPerception>;
[[nodiscard]] std::vector<std::uint8_t> encode_session(const SessionMessage& message);
[[nodiscard]] std::vector<std::uint8_t> encode_session(const SessionMessage& message,