refactor: remove legacy types.ts file and update frontend to use new contracts feat: add applyActions function to manage action application and world state mutation chore: remove empty .gitkeep file from sqlite data directory refactor: update frontend App component to align with new API contracts and improve UX docs: revise project.md to reflect updated architecture and system requirements docs: update thoughts.md with current status, architecture decisions, and remaining checks
2.1 KiB
2.1 KiB
thoughts.md
Current Status (clean-break)
- Backend is running the new contract-native API shape:
GET /api/state->{ worldState, turns }POST /api/turn->{ rawText, actions, validation, worldState }
- Runtime blocker is resolved:
- old SQLite schema conflict (
turns.raw_text) was fixed by wiping old DB state - stale legacy files removed from backend source tree:
app/src/types.tsapp/src/latentEntities.tsapp/src/llmAdapter.ts
- old SQLite schema conflict (
- Door/key MVP smoke checks pass:
open doorbefore key ->locked_requires_keytake key-> successopen doorafter key -> success
Architecture Now
- Core contracts in
app/src/contracts/:action.tsvalidation.tsturn.tsentity.tsworld.ts
- Deterministic truth engine:
app/src/truthEngine.tswithvalidateActions(actions, worldState)
- Ordered turn pipeline:
app/src/turns/processTurn.tsparse -> validate -> apply -> persist
- World mutation:
app/src/world/applyActions.ts
- Persistence:
app/src/db.tswith tablesturns,actions,validation_results,entities,world_states
- App seed domain:
app/src/app.tsdoor/key world (room_start,room_exit,player,door_1,key_1)
New Endpoint
- Added
POST /api/resetinapp/src/index.ts - App-level reset implementation in
app/src/app.ts - DB wipe support in
app/src/db.ts - Verified reset behavior:
- returns
{ worldState, turns } turnsis empty after resetplayerandkey_1return toroom_start
- returns
Frontend Migration Notes
frontend/src/App.tsxmigrated to consume new backend contracts.- Removed dependencies on old fields (
narration,events,beliefs,summaries,parser_feedback). - Turn submit flow now refreshes snapshot via
GET /api/stateafterPOST /api/turn. - Reset call now sends JSON body/content-type to satisfy Fastify media-type validation.
Remaining Checks
- Frontend build pass completed in container (
docker compose exec frontend npm run build). - Validate inspector UX manually against the door/key flow.
- Expand parser coverage only within current clean MVP domain.