namespace NovelSoftware.Domain.Entities; /// A chat thread between the writer and the embedded agent, scoped to one project. public class AgentConversation { public Guid Id { get; set; } = Guid.NewGuid(); public Guid ProjectId { get; set; } public Project? Project { get; set; } public string Title { get; set; } = "New conversation"; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow; public List Messages { get; set; } = []; } /// /// One turn in an agent conversation. Assistant turns may carry a record of the tools /// the agent called, so the UI can show what it changed and the next request can replay /// the turn back to the model. /// public class AgentMessage { public Guid Id { get; set; } = Guid.NewGuid(); public Guid ConversationId { get; set; } public AgentConversation? Conversation { get; set; } public AgentRole Role { get; set; } /// /// Position in the conversation, 0-based. Timestamps are not enough to order a /// transcript: a fast turn can produce two messages inside the same tick. /// public int Sequence { get; set; } /// The visible text of the turn. public string Content { get; set; } = string.Empty; /// /// JSON array of { name, input, result } objects describing tool calls made /// during this turn. Null on user turns and on assistant turns that used no tools. /// public string? ToolCallsJson { get; set; } public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; }