feat: nation-op rename review — confirm/reject routes, client dialog, AGENTS.md (P4a, #16)

Wire the 'LLM proposes, player confirms' nation-rename flow end to end:
- server: POST /api/games/:id/nation-op/confirm|reject (404/400, version-bumped SSE state)
- client: confirmNationOp/rejectNationOp api helpers + NationOpDialog (editable rename) wired into the Action panel via a 'Nation proposals' trigger
- AGENTS.md: document the pendingNationOps mechanism, routes, nationRef resolution, stub-never-proposes
This commit is contained in:
2026-10-14 13:00:28 +00:00
parent e9fa267fd0
commit 9f230606c4
7 changed files with 335 additions and 12 deletions
+17
View File
@@ -6,9 +6,11 @@ import type {
AddActionResponse,
AddDiplomacyResponse,
AdvisorResponse,
ConfirmNationOpResponse,
CreateGameResponse,
DeleteGameResponse,
GameSummary,
RejectNationOpResponse,
RemoveQueueItemResponse,
TurnResponse,
} from '@shared/protocol';
@@ -60,6 +62,21 @@ export const api = {
method: 'POST',
body: JSON.stringify({ index }),
}),
// (v0.23, #16 P4a) Confirm a pending nation-op proposal by its index in
// `game.pendingNationOps` (a rename takes effect; `edits.name` overrides the
// proposed name). Fast, non-LLM — no turn advance. Returns the updated game.
confirmNationOp: (id: string, index: number, edits?: { name?: string }) =>
req<ConfirmNationOpResponse>(`/api/games/${id}/nation-op/confirm`, {
method: 'POST',
body: JSON.stringify({ index, ...(edits ? { edits } : {}) }),
}),
// (v0.23, #16 P4a) Reject (drop) a pending nation-op proposal by index,
// without applying it. Fast, non-LLM — no turn advance. Returns the updated game.
rejectNationOp: (id: string, index: number) =>
req<RejectNationOpResponse>(`/api/games/${id}/nation-op/reject`, {
method: 'POST',
body: JSON.stringify({ index }),
}),
// Commit the whole pending round (or an empty one) in a single LLM turn.
jump: (id: string) =>
req<TurnResponse>(`/api/games/${id}/jump`, {