feat(morrowind): add Perception/Command protocol + SQLite command log (#859, #855)

Implement two foundational infrastructure pieces for the Morrowind integration:

1. Perception/Command Protocol (Issue #859):
   - Formal spec document with JSON schemas, API contracts, versioning strategy
   - Engine-agnostic design following the Falsework Rule
   - Pydantic v2 models (PerceptionOutput, CommandInput) for runtime validation

2. SQLite Command Log + Training Pipeline (Issue #855):
   - SQLAlchemy model for command_log table with full indexing
   - CommandLogger class with log_command(), query(), export_training_data()
   - TrainingExporter with chat-completion, episode, and instruction formats
   - Storage management (rotation/archival) utilities
   - Alembic migration for the new table

Includes 39 passing tests covering schema validation, logging, querying, and export.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 22:33:13 +00:00
parent e4864b14f2
commit 215329146a
9 changed files with 1664 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
"""Morrowind engine-agnostic perception/command protocol.
This package implements the Perception/Command protocol defined in
``docs/protocol/morrowind-perception-command-spec.md``. It provides:
- Pydantic v2 schemas for runtime validation (``schemas``)
- SQLite command logging and query interface (``command_log``)
- Training-data export pipeline (``training_export``)
"""
from .schemas import CommandInput, CommandType, EntityType, PerceptionOutput
__all__ = [
"CommandInput",
"CommandType",
"EntityType",
"PerceptionOutput",
]