refactor: Serializers include available location attributes

This commit is contained in:
2026-07-09 03:04:48 +05:30
parent fadea41e6f
commit 6cf099821b
4 changed files with 102 additions and 0 deletions

View File

@@ -72,6 +72,7 @@ export class ScenarioLoader {
}
// Save location record linked to the world instance
world.addLocation(location);
this.coreRepo.saveLocation(location, world.id);
}
}
@@ -102,6 +103,7 @@ export class ScenarioLoader {
}
// Save entity record linked to the world instance
world.addEntity(entity);
this.coreRepo.saveEntity(entity, world.id);
// Seed initial memory buffer history

View File

@@ -84,6 +84,21 @@ describe("Talking Room Demo Scenario Test (Tier 1)", () => {
expect(beta!.locationId).toBe("white-room");
expect(beta!.aliases.get(alphaId)).toBe("the person in the Alpha jumpsuit");
// Verify subjective world state serializes the location attributes (epistemic inclusion)
const { serializeSubjectiveWorldState } = await import("@omnia/core");
const subjectiveState = serializeSubjectiveWorldState(world!, alphaId);
expect(subjectiveState).toContain("You are at location: white-room");
expect(subjectiveState).toContain("Location attributes:");
expect(subjectiveState).toContain("description: A pristine, featureless room");
expect(subjectiveState).toContain("lighting: Bright, uniform illumination");
// Verify objective world state serializes locations (physics awareness)
const { serializeObjectiveWorldState } = await import("@omnia/core");
const objectiveState = serializeObjectiveWorldState(world!);
expect(objectiveState).toContain("Locations:");
expect(objectiveState).toContain("- Location [ID: white-room]:");
expect(objectiveState).toContain("description: A pristine, featureless room");
// 7. Assert initial pre-seeded memories
const alphaMemories = bufferRepo.listForOwner(alphaId);
expect(alphaMemories).toHaveLength(1);