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

@@ -9,13 +9,11 @@ describe("IntentDecoder Unit Tests (Tier 1)", () => {
const alice = new Entity("alice");
world.addEntity(alice);
const mockResponse: IntentSequence = {
const mockResponse = {
intents: [
{
type: "action",
originalText: "Alice opened the chest.",
description: "Open the wooden chest.",
selfDescription: "You open the wooden chest.",
content: "I open the wooden chest.",
targetIds: [],
modifiers: [],
},
@@ -34,6 +32,7 @@ describe("IntentDecoder Unit Tests (Tier 1)", () => {
expect(result.intents).toHaveLength(1);
expect(result.intents[0].type).toBe("action");
expect(result.intents[0].actorId).toBe("alice");
expect(result.intents[0].content).toContain("entity@alice[I]");
expect(result.intents[0].targetIds).toEqual([]);
});
@@ -44,13 +43,11 @@ describe("IntentDecoder Unit Tests (Tier 1)", () => {
world.addEntity(alice);
world.addEntity(bob);
const mockResponse: IntentSequence = {
const mockResponse = {
intents: [
{
type: "dialogue",
originalText: '"Do you have the key?" Alice asked Bob.',
description: "Alice asks Bob if he has the key.",
selfDescription: "You ask Bob if he has the key.",
content: '"Do you have the key?" I asked Bob.',
targetIds: ["bob"],
modifiers: [],
},
@@ -68,6 +65,7 @@ describe("IntentDecoder Unit Tests (Tier 1)", () => {
expect(result.intents).toHaveLength(1);
expect(result.intents[0].type).toBe("dialogue");
expect(result.intents[0].content).toContain("entity@alice[I]");
expect(result.intents[0].targetIds).toEqual(["bob"]);
});
@@ -78,21 +76,17 @@ describe("IntentDecoder Unit Tests (Tier 1)", () => {
world.addEntity(alice);
world.addEntity(bob);
const mockResponse: IntentSequence = {
const mockResponse = {
intents: [
{
type: "dialogue",
originalText: '"Cover me," Alice whispered to Bob.',
description: "Alice whispers to Bob requesting cover.",
selfDescription: "You whisper to Bob requesting cover.",
content: '"Cover me," I whispered to Bob.',
targetIds: ["bob"],
modifiers: [],
},
{
type: "action",
originalText: "She crept towards the door and pulled the handle.",
description: "Creep towards the door and pull the handle.",
selfDescription: "You creep towards the door and pull the handle.",
content: "I crept towards the door and pulled the handle.",
targetIds: [],
modifiers: [],
},
@@ -113,6 +107,7 @@ describe("IntentDecoder Unit Tests (Tier 1)", () => {
expect(result.intents[0].targetIds).toEqual(["bob"]);
expect(result.intents[1].type).toBe("action");
expect(result.intents[1].actorId).toBe("alice");
expect(result.intents[1].content).toContain("entity@alice[I]");
});
test("throws on LLM failure", async () => {