File size: 1,243 Bytes
921d377
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Runtime interaction engine — the layer that drives the viewer turn.

Submodules:

  types.py     ActionResult + Transition + session-scoped enums.
  state.py     Per-session state machine (current_node_id,
               character mood, cumulative progress).
  router.py    resolve_next(session, action) — the core function
               called on every viewer action. Applies policy,
               progression, character-state updates, and returns
               the next payload.
  cooldown.py  Per-action cooldown tracking per session.

Every function here is pure-ish: given a session snapshot +
action, returns what should happen next. Persistence is done by
callers (the router module in batch 7) so the runtime is easy to
unit-test without SQLite writes on the hot path.
"""
from .cooldown import CooldownTracker, check_cooldown, mark_used
from .router import ActionPayload, ResolvedTurn, resolve_next
from .state import RuntimeState, build_runtime_state
from .types import Transition, TransitionKind

__all__ = [
    "CooldownTracker",
    "check_cooldown",
    "mark_used",
    "ActionPayload",
    "ResolvedTurn",
    "resolve_next",
    "RuntimeState",
    "build_runtime_state",
    "Transition",
    "TransitionKind",
]