Modern UI contract: envelope, career and manager ids, session and desktop reads

First engine delivery for the Modern interface handoff (docs/new_ui/integration,
issue #15): ModernSession::ui_read answers in the draft envelope with careerId,
worldId, stateRevision, date, season, scope and Money in minor units. Careers and
human managers get persistent ids (saved in state/modern.json, older saves get
them on load). Reads: session and desktop. Engine decisions on the P0 points in
docs/new_engine/ui-anbindung.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 08:17:18 +01:00
1 parent 9061123c7e
commit 3336d01004
9 files changed
+342 -2

No files matched your search

+13
View File
@@ -3,6 +3,7 @@
#pragma once
#include "modern/content/projections.hpp"
#include "modern/content/statistics.hpp"
#include "modern/content/ui_contract.hpp"
#include "modern/content/world_expand.hpp"
// The engine side of the UI's career handoff (src/ui/flow.hpp, ENGINE_BINDING.md).
//
@@ -835,6 +836,18 @@ public:
cli::Json read(const cli::Json& request) const {
return query_projection(g_, int(g_.memory.has(::bmh::layout::ActiveManager) ? g_.memory.u8(::bmh::layout::ActiveManager) : 0), request);
}
// The interface contract (docs/new_engine/ui-anbindung.md): a read in the contract's envelope
// for the manager at the desk, at the revision the caller holds. Read-only.
cli::Json ui_read(const cli::Json& request, uint64_t revision) const {
UiContext context;
context.state_revision = revision;
context.manager = int(g_.memory.has(::bmh::layout::ActiveManager) ? g_.memory.u8(::bmh::layout::ActiveManager) : 0);
const ui::DeskState desk = desktop_projection(revision);
context.next_opponent = desk.next_opponent;
context.next_competition = desk.next_competition_label;
context.next_away = desk.next_match_away;
return modern::ui_read(g_, context, request);
}
ModernState& state() { return g_; }
const TurnResultSnapshot& last_turn_results() const { return turn_driver_.last_results; }
// Owned presentation for the event completed by the last accepted kickoff.