feat: refactor turn processing and world state management; remove obsolete files and enhance database interactions
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
19
thoughts.md
19
thoughts.md
@@ -18,6 +18,18 @@
|
||||
- Interpreter envelopes are persisted per turn and surfaced to the UI timeline.
|
||||
- LLM resolver now calls an HTTP model backend (Ollama-compatible) with hybrid deterministic fallback.
|
||||
- Rulebooks now include a version field with backward-compatible DB migration.
|
||||
- Turn log now returns populated actions and validation results per turn (previously always empty).
|
||||
- Active rulebook ID is now persisted on worldState and survives restarts.
|
||||
- `take` sets `has_<item_id>` generically on the actor (was hardcoded to key_1 only).
|
||||
|
||||
### Structural refactoring completed (April 2026)
|
||||
|
||||
- **Deleted `turns/processTurn.ts`** — was a 3-line shim over runTurnManager. app.ts now calls runTurnManager directly.
|
||||
- **Deleted `truthEngine.ts`** — was a thin wrapper over rulebookEngine.validateWithRulebook. turnManager.ts now calls validateWithRulebook directly.
|
||||
- **Extracted `world/seedWorld.ts`** — createSeedWorldState, mergeSeedWorldState, ensureSeedState moved out of app.ts. App factory is now clean.
|
||||
- **Fixed `db.listTurns()`** — now reads back actions and validation_results from their tables. Frontend turn log now has real data.
|
||||
- **Fixed `worldState.rulebookId` persistence** — upsertRulebook now updates worldState.rulebookId and persists a world snapshot so the active rulebook survives restarts.
|
||||
- **Generalized `has_<item_id>` in applyActions** — `take` now sets `has_<item_id>` on the actor for all taken items, not just `key_1`. The attributeRef rulebook check continues to work generically.
|
||||
|
||||
### Confirmed via containerized validation
|
||||
|
||||
@@ -58,6 +70,13 @@
|
||||
- Existing DBs may hold older rulebooks missing new action rule sets.
|
||||
- Need explicit upgrade path/versioning.
|
||||
|
||||
4. Parser is world-specific
|
||||
- parseTextToActions.ts hardcodes entity IDs (room_exit, door_1, key_1, groundskeeper).
|
||||
- The parser is used only inside the deterministic resolver adapter; keeping it isolated limits blast radius, but a future world-context-aware resolver would eliminate this entirely.
|
||||
|
||||
5. Entity table vs world_state blob redundancy
|
||||
- `entities` table and `world_states.state_json` both store entity data. The entities table is the live read target; world_states is the history log. No query capability on history. Acceptable for MVP.
|
||||
|
||||
## Path Forward (Next 3 Iterations)
|
||||
|
||||
### Iteration 1: LLM adapter hardening
|
||||
|
||||
Reference in New Issue
Block a user