feat(engine): detect endings on every successful turn
After each state-mutating dispatch, evaluate world.endings in priority
order (true > wrong > bad). The first whose whenFlags are all satisfied
sets state.endedWith and appends a kind:'ending' transcript line. Once
ended, further dispatches return a "story has ended" narration.
Also update test-world fixtures and placeholder ending markdown files
to use whenFlags: { _never: true } instead of {} so that vacuously-true
empty flags don't accidentally fire on every successful turn.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -61,9 +61,9 @@ const world: World = {
|
||||
},
|
||||
},
|
||||
endings: {
|
||||
true: { whenFlags: {}, narration: '' },
|
||||
wrong: { whenFlags: {}, narration: '' },
|
||||
bad: { whenFlags: {}, narration: '' },
|
||||
true: { whenFlags: { _never: true }, narration: '' },
|
||||
wrong: { whenFlags: { _never: true }, narration: '' },
|
||||
bad: { whenFlags: { _never: true }, narration: '' },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user