FEAT!(voice): Implement intent hydration, dehydration system fixes: #29

This commit is contained in:
2026-07-19 13:13:07 +05:30
parent 84bff92631
commit a4b620502a
38 changed files with 622 additions and 211 deletions

View File

@@ -145,8 +145,14 @@ export class ScenarioLoader {
timestamp: mem.timestamp,
locationId: mem.locationId,
intent: {
...mem.intent,
selfDescription: mem.intent.selfDescription ?? "",
type: mem.intent.type,
content:
mem.intent.content ||
mem.intent.description ||
mem.intent.originalText ||
"",
actorId: mem.intent.actorId,
targetIds: mem.intent.targetIds,
modifiers: mem.intent.modifiers ?? [],
},
outcome: mem.outcome,

View File

@@ -31,8 +31,9 @@ export const ScenarioMemoryEntrySchema = z.object({
locationId: z.string().nullable(),
intent: z.object({
type: z.enum(["dialogue", "action", "monologue", "thought"]),
originalText: z.string(),
description: z.string(),
content: z.string().optional(),
originalText: z.string().optional(),
description: z.string().optional(),
selfDescription: z.string().optional(),
actorId: z.string(),
targetIds: z.array(z.string()),

View File

@@ -139,7 +139,7 @@ describe("Scenario Validation & Schema Tests (Tier 1)", () => {
expect(memories[0].id).toBe("mem-seed-1");
expect(memories[0].timestamp).toBe("2026-07-09T07:55:00.000Z");
expect(memories[0].locationId).toBe("lobby");
expect(memories[0].intent.description).toBe("entered the house");
expect(memories[0].intent.content).toBe("entered the house");
db.close();
});

View File

@@ -131,20 +131,17 @@ describe("Talking Room Demo Scenario Test (Tier 1)", () => {
expect(alphaMemories).toHaveLength(2);
expect(alphaMemories[0].id).toBe("ab3f29d2-cf11-4111-9a99-b13c126d123e");
expect(alphaMemories[0].intent.type).toBe("monologue");
expect(alphaMemories[0].intent.originalText).toContain("jail");
expect(alphaMemories[0].intent.description).toBe("");
expect(alphaMemories[0].intent.content).toContain("jail");
expect(alphaMemories[1].id).toBe("zz3f29d2-as11-9811-9a99-b13c126d123e");
expect(alphaMemories[1].intent.type).toBe("action");
expect(alphaMemories[1].intent.originalText).toContain("sleep");
expect(alphaMemories[1].intent.description).toBe("");
expect(alphaMemories[1].intent.content).toContain("sleep");
const betaMemories = bufferRepo.listForOwner(betaId);
expect(betaMemories).toHaveLength(1);
expect(betaMemories[0].id).toBe("zx1f29d2-cf11-4111-9a99-b13c126d123e");
expect(betaMemories[0].intent.type).toBe("action");
expect(betaMemories[0].intent.originalText).toContain("unfamiliar");
expect(betaMemories[0].intent.description).toBe("");
expect(betaMemories[0].intent.content).toContain("unfamiliar");
db.close();
});