Modern UI contract: session.advance

The desk's kickoff as a command: the calendar runs to the next human desk,
the season end desk or the end of the career (matches without live view for
now). A missing desk decision or a failed step answers decision_pending or
advance_failed and leaves the state as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 08:45:07 +01:00
1 parent a1590a34ef
commit ae817c6d6d
3 files changed
+37

No files matched your search

+23
View File
@@ -9045,6 +9045,29 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
if (!ok) { restore(); return refuse(error.empty() ? "invalid_training" : error, "Training nicht übernommen: " + error); }
if (revision != previous) revision = previous + 1;
answer = modern::ui_command_result(request_id, previous, revision, {"training"}, "Training übernommen.");
} else if (kind == "session.advance") {
// payload {}: the kickoff of the desk - the calendar runs (matches without live view) to the
// next desk of a human manager, the season end desk or the end of the career
ui::DeskRequest kickoff;
kickoff.kind = ui::DeskRequestKind::advance_turn;
kickoff.manager_slot = manager;
kickoff.revision = revision;
const TurnAdvanceResult r = dispatch_kickoff(kickoff, revision, error);
if (r.kind == TurnDeskKind::Failed || r.kind == TurnDeskKind::WaitingAtDesk) {
restore();
const std::string reason = r.reason.empty() ? error : r.reason;
return refuse(r.kind == TurnDeskKind::WaitingAtDesk ? "decision_pending" : "advance_failed",
"Weiter nicht möglich: " + reason);
}
modern::ensure_ui_identities(g_);
revision = previous + 1;
const char* what = r.kind == TurnDeskKind::SeasonEndDesk ? "Saisonende." : r.kind == TurnDeskKind::CareerComplete
? "Die Karriere ist zu Ende." : "Weiter zum nächsten Termin.";
answer = modern::ui_command_result(request_id, previous, revision,
{"session", "desktop", "squad", "lineup", "tactics", "training", "camps", "bank",
"statistics", "almanac"}, what);
if (r.kind == TurnDeskKind::CareerComplete)
std::get<cli::Json::Object>(answer.value)["outcome"] = "career_ended";
} else if (kind == "bank.commit") {
// payload {action: deposit|withdraw, amount: Money} or {action: buy|sell, assetId: stock:<n>|fund:<n>, count}
const std::string action = ui_text(*payload, "action");