feat: Implement tier 1 memory buffer

This commit is contained in:
2026-07-08 21:33:25 +05:30
parent 1aa00532ed
commit 74ffb456a7
12 changed files with 609 additions and 15 deletions

View File

@@ -41,5 +41,35 @@ describe("IntentDecoder Live Eval (Tier 3)", () => {
expect(actionIntent).toBeDefined();
expect(actionIntent!.actorId).toBe("alice");
expect(actionIntent!.originalText).toContain("slipped the silver key");
});
}, 15000);
test("resolves targets correctly using the actor's subjective alias map", async () => {
expect(llmConfig.GOOGLE_API_KEY).toBeDefined();
const provider = new GeminiProvider(llmConfig.GOOGLE_API_KEY);
const decoder = new IntentDecoder(provider);
const world = new WorldState("world-xyz");
const alice = new Entity("alice");
const bob = new Entity("bob");
// Register alias mapping: Bob is known to Alice as "the hooded stranger"
alice.aliases.set("bob", "the hooded stranger");
world.addEntity(alice);
world.addEntity(bob);
// Narrative prose referring to Bob only by the subjective alias
const narrativeProse = "Alice handed the silver key to the hooded stranger.";
const result = await decoder.decode(world, "alice", narrativeProse);
expect(result.intents).toHaveLength(1);
const intent = result.intents[0];
expect(intent.type).toBe("action");
expect(intent.actorId).toBe("alice");
// Verify target resolution resolved the alias back to the correct system entity ID
expect(intent.targetIds).toContain("bob");
}, 15000);
});