feat(engine): widen state value unions and add 'ending' transcript kind

Drops redundant string[] casts in dispatcher paths and prepares the
TranscriptLine kind for the ending-screen render path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 13:28:14 -05:00
parent e21a308e9d
commit 6cffb87a63
+4 -4
View File
@@ -35,13 +35,13 @@ export type Theme = 'amber' | 'ansi'
export interface ItemInstance {
id: ItemId
/** Per-instance state: lit/unlit, broken/whole, etc. */
state: Record<string, string | boolean | number>
state: Record<string, string | boolean | number | string[]>
}
export type EncounterPhase = string // phase names are encounter-specific
export interface TranscriptLine {
kind: 'narration' | 'player' | 'system'
kind: 'narration' | 'player' | 'system' | 'ending'
text: string
}
@@ -56,9 +56,9 @@ export interface GameState {
location: RoomId
inventory: ItemInstance[]
/** Per-room state: visited, items dropped, descriptive flags. */
roomState: Record<RoomId, Record<string, string | boolean | number>>
roomState: Record<RoomId, Record<string, string | boolean | number | string[]>>
/** Story-wide flags (e.g. 'gateOpened', 'mirrorTarnished'). */
flags: Record<string, string | boolean | number>
flags: Record<string, string | boolean | number | string[]>
resolveLevel: ResolveLevel
/** Active encounter phase by encounter id, or null if no encounter is mid-flight. */
encounterState: Record<EncounterId, EncounterPhase>