using AIStudio.Chat; namespace AIStudio.Tools.AssistantSessions; /// /// Immutable-style view of an assistant session for UI consumers and message bus events. /// /// /// The service creates snapshots by copying its internal runtime state. Consumers must /// treat the contained chat thread and state objects as read-only views of the session. /// public sealed record AssistantSessionSnapshot { /// /// Identifies the concrete run represented by this snapshot. /// public required Guid SessionId { get; init; } /// /// Identifies the assistant and logical session slot represented by this snapshot. /// public required AssistantSessionKey Key { get; init; } /// /// Gets the user-visible assistant title. /// public required string Title { get; init; } /// /// Gets the current lifecycle status. /// public required AssistantSessionStatus Status { get; init; } /// /// Gets when the session run started. /// public required DateTimeOffset StartedAt { get; init; } /// /// Gets when the session was last changed. /// public required DateTimeOffset UpdatedAt { get; init; } /// /// Gets when the session reached a terminal state. /// public DateTimeOffset? FinishedAt { get; init; } /// /// Gets the user-visible error message for failed sessions. /// public string ErrorMessage { get; init; } = string.Empty; /// /// Gets the assistant chat thread captured for this session. /// public ChatThread? ChatThread { get; init; } /// /// Gets the assistant component state captured for this session. /// public IReadOnlyDictionary State { get; init; } = new Dictionary(); /// /// Gets whether the session is still running or canceling. /// public bool IsActive => this.Status is AssistantSessionStatus.RUNNING or AssistantSessionStatus.CANCELING; }