feat(phase2): observation-only LLMPolicy entry (D1) + pinned schema_version (P0.1)
- LLMPolicy is now Callable[[Observation], tuple[Action, ...]]: the snapshot is the policy's sole information source; the live CombatantState is no longer passed to new-style policies. - CombatEngine._llm_adapter keeps a compatibility path for pre-D1 two-argument callables: the signature is inspected ONCE at wrap time (_accepts_state) and legacy policies still receive (observation, state). - Observation.to_dict() carries schema_version (OBSERVATION_SCHEMA_VERSION=1) as its first pinned key; bump only on removal/meaning change. - Pinned keyset tests updated (test_observation, test_observation_enriched); new tests: observation-only e2e, legacy 2-arg e2e through the adapter, schema_version pin + JSON-serializability. - README: documents the new entry signature and the schema_version key.
This commit is contained in:
@@ -229,7 +229,7 @@ def test_results_visible_in_next_turn_observation() -> None:
|
||||
# the second invocation must already see the first turn's rejection.
|
||||
seen: list[Observation] = []
|
||||
|
||||
def llm_policy(obs: Observation, state: CombatantState) -> tuple[Action, ...]:
|
||||
def llm_policy(obs: Observation) -> tuple[Action, ...]:
|
||||
seen.append(obs)
|
||||
if len(seen) == 1:
|
||||
return (Action(kind="move"),)
|
||||
|
||||
Reference in New Issue
Block a user