cli: FIRST RUN!!!! ITS ALIVE!

This commit is contained in:
2026-07-09 02:51:57 +05:30
parent 701bc56d0c
commit fadea41e6f
11 changed files with 417 additions and 46 deletions

View File

@@ -45,13 +45,14 @@
],
"entities": [
{
"id": "subject-alpha",
"id": "7c9b83b3-8cfb-4e89-8d77-626a5757d591",
"locationId": "white-room",
"attributes": [
{
"name": "name",
"value": "Subject Alpha",
"visibility": "PUBLIC"
"value": "Bob",
"visibility": "PRIVATE",
"allowedEntities": ["7c9b83b3-8cfb-4e89-8d77-626a5757d591"]
},
{
"name": "appearance",
@@ -67,7 +68,7 @@
"name": "knowledge",
"value": "I woke up here. I know my name is Alpha. I know I agreed to participate in a paid scientific experiment, but my memories of who I was or my life before this room are gone.",
"visibility": "PRIVATE",
"allowedEntities": ["subject-alpha"]
"allowedEntities": ["7c9b83b3-8cfb-4e89-8d77-626a5757d591"]
},
{
"name": "neural_erasure_dose",
@@ -77,7 +78,7 @@
}
],
"aliases": {
"subject-beta": "the person in the Beta jumpsuit"
"bf3f29d2-cf11-4b11-9a99-b13c126d400e": "the person in the Beta jumpsuit"
},
"initialMemories": [
{
@@ -88,20 +89,21 @@
"type": "action",
"originalText": "I woke up on the floor. I stood up and looked around the white room, realizing my memories were wiped.",
"description": "wake up on the cold floor and stand up",
"actorId": "subject-alpha",
"actorId": "7c9b83b3-8cfb-4e89-8d77-626a5757d591",
"targetIds": []
}
}
]
},
{
"id": "subject-beta",
"id": "bf3f29d2-cf11-4b11-9a99-b13c126d400e",
"locationId": "white-room",
"attributes": [
{
"name": "name",
"value": "Subject Beta",
"visibility": "PUBLIC"
"value": "Bill",
"visibility": "PRIVATE",
"allowedEntities": ["bf3f29d2-cf11-4b11-9a99-b13c126d400e"]
},
{
"name": "appearance",
@@ -117,7 +119,7 @@
"name": "knowledge",
"value": "I remember my name is Beta. I remember signing up for a paid research study. My past memories have been completely erased. I am disoriented.",
"visibility": "PRIVATE",
"allowedEntities": ["subject-beta"]
"allowedEntities": ["bf3f29d2-cf11-4b11-9a99-b13c126d400e"]
},
{
"name": "neural_erasure_dose",
@@ -127,7 +129,7 @@
}
],
"aliases": {
"subject-alpha": "the person in the Alpha jumpsuit"
"7c9b83b3-8cfb-4e89-8d77-626a5757d591": "the person in the Alpha jumpsuit"
},
"initialMemories": [
{
@@ -138,7 +140,7 @@
"type": "action",
"originalText": "I opened my eyes, sitting against the wall. I rubbed my temples, trying to remember how I got here.",
"description": "wake up sitting against the wall and rub temples",
"actorId": "subject-beta",
"actorId": "bf3f29d2-cf11-4b11-9a99-b13c126d400e",
"targetIds": []
}
}

View File

@@ -24,9 +24,9 @@ export class ScenarioLoader {
// 2. Instantiate running WorldState using the target instance ID
const world = new WorldState(targetWorldId, new Date(scenario.startTime));
// Seed world-level attributes
world.addAttribute("name", scenario.name, AttributeVisibility.PUBLIC);
world.addAttribute("description", scenario.description, AttributeVisibility.PUBLIC);
// Seed world-level attributes as system-only (private, empty ACL)
world.addAttribute("name", scenario.name, AttributeVisibility.PRIVATE, new Set());
world.addAttribute("description", scenario.description, AttributeVisibility.PRIVATE, new Set());
if (scenario.world?.attributes) {
for (const attr of scenario.world.attributes) {

View File

@@ -36,6 +36,9 @@ describe("Talking Room Demo Scenario Test (Tier 1)", () => {
const world = coreRepo.loadWorldState(worldInstanceId);
expect(world).not.toBeNull();
expect(world!.attributes.get("name")?.getValue()).toBe("Talking Room");
expect(world!.attributes.get("name")?.visibility).toBe("PRIVATE");
expect(world!.attributes.get("description")?.getValue()).toBe(scenarioJson.description);
expect(world!.attributes.get("description")?.visibility).toBe("PRIVATE");
expect(world!.attributes.get("experiment_codename")?.getValue()).toBe("Project Tabula Rasa (Phase 3)");
expect(world!.attributes.get("experiment_codename")?.visibility).toBe("PRIVATE");
expect(world!.attributes.get("experiment_codename")?.getAllowedEntities()).toHaveLength(0); // System only!
@@ -47,38 +50,47 @@ describe("Talking Room Demo Scenario Test (Tier 1)", () => {
expect(locations[0].attributes.get("description")?.getValue()).toContain("A pristine, featureless room");
// 6. Assert entities and their private attributes / allowedEntities
const alpha = world!.getEntity("subject-alpha");
const alphaId = "7c9b83b3-8cfb-4e89-8d77-626a5757d591";
const betaId = "bf3f29d2-cf11-4b11-9a99-b13c126d400e";
const alpha = world!.getEntity(alphaId);
expect(alpha).toBeDefined();
expect(alpha!.locationId).toBe("white-room");
expect(alpha!.attributes.get("name")?.getValue()).toBe("Subject Alpha");
// Name visibility check
const alphaName = alpha!.attributes.get("name")!;
expect(alphaName.getValue()).toBe("Bob");
expect(alphaName.visibility).toBe("PRIVATE");
expect(alphaName.hasAccess(alphaId)).toBe(true);
expect(alphaName.hasAccess(betaId)).toBe(false);
// Check private knowledge attribute visibility
const alphaKnowledge = alpha!.attributes.get("knowledge")!;
expect(alphaKnowledge.visibility).toBe("PRIVATE");
expect(alphaKnowledge.hasAccess("subject-alpha")).toBe(true);
expect(alphaKnowledge.hasAccess("subject-beta")).toBe(false);
expect(alphaKnowledge.hasAccess(alphaId)).toBe(true);
expect(alphaKnowledge.hasAccess(betaId)).toBe(false);
// Check system-only attribute (neural_erasure_dose)
const alphaDose = alpha!.attributes.get("neural_erasure_dose")!;
expect(alphaDose.visibility).toBe("PRIVATE");
expect(alphaDose.hasAccess("subject-alpha")).toBe(false);
expect(alphaDose.hasAccess("subject-beta")).toBe(false);
expect(alphaDose.hasAccess(alphaId)).toBe(false);
expect(alphaDose.hasAccess(betaId)).toBe(false);
// Check subjective aliases
expect(alpha!.aliases.get("subject-beta")).toBe("the person in the Beta jumpsuit");
expect(alpha!.aliases.get(betaId)).toBe("the person in the Beta jumpsuit");
const beta = world!.getEntity("subject-beta");
const beta = world!.getEntity(betaId);
expect(beta).toBeDefined();
expect(beta!.locationId).toBe("white-room");
expect(beta!.aliases.get("subject-alpha")).toBe("the person in the Alpha jumpsuit");
expect(beta!.aliases.get(alphaId)).toBe("the person in the Alpha jumpsuit");
// 7. Assert initial pre-seeded memories
const alphaMemories = bufferRepo.listForOwner("subject-alpha");
const alphaMemories = bufferRepo.listForOwner(alphaId);
expect(alphaMemories).toHaveLength(1);
expect(alphaMemories[0].id).toBe("alpha-wake");
expect(alphaMemories[0].intent.description).toBe("wake up on the cold floor and stand up");
const betaMemories = bufferRepo.listForOwner("subject-beta");
const betaMemories = bufferRepo.listForOwner(betaId);
expect(betaMemories).toHaveLength(1);
expect(betaMemories[0].id).toBe("beta-wake");
expect(betaMemories[0].intent.description).toBe("wake up sitting against the wall and rub temples");