Add person-aware state and sync roadmap

This commit is contained in:
Jacob Dubin
2026-05-14 20:48:55 -05:00
parent f299cef9be
commit ec786be797
10 changed files with 156 additions and 12 deletions

View File

@@ -216,4 +216,17 @@ public sealed class JiboCloudProtocolServiceTests
using var payload = JsonDocument.Parse(result.BodyText);
Assert.Single(payload.RootElement.EnumerateArray());
}
[Fact]
public void InMemoryCloudStateStore_SeedsPeopleForTheDefaultAccountLoop()
{
var store = new InMemoryCloudStateStore();
var people = store.GetPeople();
Assert.NotEmpty(people);
Assert.Contains(people, person => person.IsPrimary);
Assert.Contains(people, person => string.Equals(person.AccountId, store.GetAccount().AccountId, StringComparison.OrdinalIgnoreCase));
Assert.Contains(people, person => string.Equals(person.LoopId, store.GetLoops()[0].LoopId, StringComparison.OrdinalIgnoreCase));
}
}

View File

@@ -183,6 +183,54 @@ public sealed class JiboInteractionServiceTests
Assert.True(DateTimeOffset.TryParse(decision.ContextUpdates[GreetingLastReactiveUtcKey]?.ToString(), out _));
}
[Fact]
public async Task BuildDecisionAsync_GoodMorning_UsesPersonScopedNameWhenSpeakerIsKnown()
{
var memoryStore = new InMemoryPersonalMemoryStore();
memoryStore.SetName(new PersonalMemoryTenantScope("acct-a", "loop-a", "device-a", "person-1"), "alex");
var service = CreateService(memoryStore);
var decision = await service.BuildDecisionAsync(new TurnContext
{
RawTranscript = "good morning",
NormalizedTranscript = "good morning",
Attributes = new Dictionary<string, object?>
{
["accountId"] = "acct-a",
["loopId"] = "loop-a",
["context"] = """{"runtime":{"perception":{"speaker":"person-1"},"loop":{"users":[{"id":"person-1","firstName":"jake"}]}}}"""
},
DeviceId = "device-a"
});
Assert.Equal("good_morning", decision.IntentName);
Assert.Equal("Good morning, Alex. It is great to see you.", decision.ReplyText);
}
[Fact]
public async Task BuildDecisionAsync_WhoAmI_UsesPersonScopedNameWhenSpeakerIsKnown()
{
var memoryStore = new InMemoryPersonalMemoryStore();
memoryStore.SetName(new PersonalMemoryTenantScope("acct-b", "loop-b", "device-b", "person-2"), "sam");
var service = CreateService(memoryStore);
var decision = await service.BuildDecisionAsync(new TurnContext
{
RawTranscript = "who am i",
NormalizedTranscript = "who am i",
Attributes = new Dictionary<string, object?>
{
["accountId"] = "acct-b",
["loopId"] = "loop-b",
["context"] = """{"runtime":{"perception":{"speaker":"person-2"},"loop":{"users":[{"id":"person-2","firstName":"sam"}]}}}"""
},
DeviceId = "device-b"
});
Assert.Equal("memory_get_name", decision.IntentName);
Assert.Equal("I think you are Sam.", decision.ReplyText);
}
[Fact]
public async Task BuildDecisionAsync_TriggerWithKnownIdentity_BuildsProactiveGreetingAndContext()
{
@@ -803,7 +851,7 @@ public sealed class JiboInteractionServiceTests
});
Assert.Equal("memory_get_name", recallDecision.IntentName);
Assert.Equal("You told me your name is alex.", recallDecision.ReplyText);
Assert.Equal("You told me your name is Alex.", recallDecision.ReplyText);
}
[Fact]