Send the owner its outstanding mutation offer over v10

Session protocol v10 adds type 26: the life's earned offer with its unranked
candidates in operator order and each successor's capability value,
maintenance and total mass. The cellular bridge sends it when the offer or the
owner's session changes and clears a consumed offer; the client keeps the
latest one for the maintainer's choice UI (ADR-0121, 11.4d server half).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 23:07:50 -04:00
co-authored by Claude Opus 5.5
parent 187b1a7b98
commit f77956e579
16 changed files with 314 additions and 17 deletions
+3
View File
@@ -95,6 +95,9 @@ class RegionSessionClient {
// Newest owner-filtered cellular sensor view (v8), cleared when no owned life exists.
[[nodiscard]] const std::optional<network::CellularPerception>&
cellular_perception() const noexcept;
// The owned life's outstanding mutation offer (v10), cleared when consumed or absent.
[[nodiscard]] const std::optional<network::CellularMutationOffer>&
mutation_offer() const noexcept;
[[nodiscard]] std::expected<client::EnvironmentPresentation, client::ViewError>
environment() const;
[[nodiscard]] std::expected<client::OrganismPresentation, client::ViewError> organisms() const;
+22 -2
View File
@@ -66,7 +66,8 @@ enum class SessionMessageType : std::uint8_t {
cellular_intention = 22,
cellular_action = 23,
cellular_perception = 24,
cellular_mutation_action = 25
cellular_mutation_action = 25,
cellular_mutation_offer = 26 // Server -> owner, stream (v10).
};
// Admission answers for intentions and actions (wire 0..10).
enum class AdmitStatus : std::uint8_t {
@@ -195,6 +196,24 @@ struct CellularMutationAction {
std::uint16_t operator_id{};
friend bool operator==(const CellularMutationAction&, const CellularMutationAction&) = default;
};
// v10 server-to-owner offer (ADR-0121, 11.4d): the life's outstanding earned offer, its
// candidates in stable operator order (never ranked). Each candidate states the successor's
// actual tradeoffs: its capability value and its maintenance and total mass. No candidates
// (and zero event/offer) clears a consumed or absent offer.
struct CellularOfferedCandidate {
std::uint16_t operator_id{};
std::uint8_t capability{}, effect{}; // biology::Capability, biology::MutationEffect.
std::uint32_t parameter{}; // The successor's value; zero when shed.
std::uint64_t maintenance{}, total_mass{};
friend bool operator==(const CellularOfferedCandidate&,
const CellularOfferedCandidate&) = default;
};
inline constexpr std::size_t max_cellular_offered_candidates = 8;
struct CellularMutationOffer {
std::uint64_t tick{}, life_identity{}, event_index{}, offer_tick{};
std::vector<CellularOfferedCandidate> candidates;
friend bool operator==(const CellularMutationOffer&, const CellularMutationOffer&) = default;
};
// v8 server-to-owner view. Addresses and current inventory are already filtered by
// authoritative cell position/range; provenance and account identity are omitted.
struct CellularPerceivedPatch {
@@ -351,7 +370,8 @@ using SessionMessage =
SimulatedThrough, SessionAction, ActionReceipt, ActionOutcome, ActionQuery,
SessionInterest, SnapshotChunk, SnapshotAck, HandoffOffer, SessionRedirect,
PrimitiveLifeRequest, PrimitiveLifeReceipt, PrimitiveLifeOutcome,
PrimitiveLifeQuery, CellularPerception, CellularMutationAction>;
PrimitiveLifeQuery, CellularPerception, CellularMutationAction,
CellularMutationOffer>;
[[nodiscard]] std::vector<std::uint8_t> encode_session(const SessionMessage& message);
[[nodiscard]] std::vector<std::uint8_t> encode_session(const SessionMessage& message,
@@ -68,6 +68,10 @@ struct CellularMutationReply {
// insufficient funding) is `committed_no_effect`, and the owner's view shows the cell.
[[nodiscard]] network::AdmitStatus admit_status(CellularMutationAdmission admission) noexcept;
[[nodiscard]] network::ActionOutcome action_outcome(const FinalCellularMutation& mutation) noexcept;
// The owner's view of a life's outstanding offer at `tick` (11.4d): candidates in their
// stable operator order; no offer gives an empty view that clears the client's.
[[nodiscard]] network::CellularMutationOffer offer_view(const CellularOwnedLife& life,
std::uint64_t tick);
// Single-writer profile-4 authority. The caller supplies a complete bounded trace;
// the host replays it from its recovered state and advances only on a confirmed head.
+3
View File
@@ -183,6 +183,9 @@ class RegionSessions {
// A published v10 choice's outcome, to the account's current v10 session if any.
[[nodiscard]] bool send_mutation_outcome(const network::AccountId& account,
const network::ActionOutcome& outcome);
// The owner's outstanding offer (11.4d), to the account's current v10 session if any.
[[nodiscard]] bool send_mutation_offer(const network::AccountId& account,
const network::CellularMutationOffer& offer);
[[nodiscard]] network::ReplicationStats replication_stats() const;
// M10.9a (ADR-0097): the host's load governor output. While `refuse_logins`, a Hello
// carrying a grant is closed with `capacity` before signature work (handoff tickets are