SessionConversationResolver
AgentPrism.Core.dllResolves the internal chat-history conversation id SqlChatHistoryProvider
attaches to a session, for data subject export/erasure.
public sealed class SessionConversationResolverInheritance
Section titled “Inheritance”object ← SessionConversationResolver
Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”A session’s internal conversation id is not a queryable SQL column — the
conversations/conversation_items tables carry no session_id
at all. It lives inside the session’s own state bag instead, under
AgentPrismSessionStateKeys.ChatHistory, because
SqlChatHistoryProvider’s single instance is shared across every session
(Microsoft Agent Framework’s explicit constraint) and cannot keep it as a field.
Finding it therefore needs the session restored through its own agent — the
same mechanism ConversationBranchService already uses for
branching — not a SQL query.
Without this step, DataSubjectScope.SessionIds alone can erase a session’s row but never its chat history: the resolver a consumer writes knows only their own session ids, never AgentPrism’s internal conversation id, and has no supported way to discover it. This type closes that gap so a data subject’s ordinary agent-session chat history — not just the separate OpenAI-compatible Conversations API — is actually reachable.
A session whose agent can no longer be resolved, or whose state cannot be deserialized (a version mismatch, for example), is skipped and logged rather than thrown: one unresolvable session must not block export/erasure of every other session in the same request.
Constructors
Section titled “Constructors”SessionConversationResolver(ISessionStore, IAgentCatalog, ILogger<SessionConversationResolver>?)
Section titled “ SessionConversationResolver(ISessionStore, IAgentCatalog, ILogger<SessionConversationResolver>?)”Creates a new resolver.
public SessionConversationResolver(ISessionStore sessions, IAgentCatalog catalog, ILogger<SessionConversationResolver>? logger = null)Parameters
Section titled “Parameters”sessions ISessionStore
The session store.
catalog IAgentCatalog
The agent catalog, needed to restore a session through its own agent.
logger ILogger<SessionConversationResolver>?
The logger for an unresolvable session.
Exceptions
Section titled “Exceptions”A required dependency is null.
Methods
Section titled “Methods”ResolveAsync(IReadOnlyList<string>, CancellationToken)
Section titled “ ResolveAsync(IReadOnlyList<string>, CancellationToken)”Resolves the internal conversation id of every session that has one.
public ValueTask<IReadOnlyList<Guid>> ResolveAsync(IReadOnlyList<string> sessionIds, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”sessionIds IReadOnlyList<string>
The session ids to look up.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<Guid>>
The resolved conversation ids. Shorter than sessionIds when a
session does not exist, has no conversation yet, or could not be restored.