CODEX_ADK/BACKEND/Codex.Dal/Entities/ConversationMessage.cs
jean-philippe 3fae2fcbe1 Initial commit: CODEX_ADK (Svrnty Console) MVP v1.0.0
This is the initial commit for the CODEX_ADK project, a full-stack AI agent
management platform featuring:

BACKEND (ASP.NET Core 8.0):
- CQRS architecture with 6 commands and 7 queries
- 16 API endpoints (all working and tested)
- PostgreSQL database with 5 entities
- AES-256 encryption for API keys
- FluentValidation on all commands
- Rate limiting and CORS configured
- OpenAPI/Swagger documentation
- Docker Compose setup (PostgreSQL + Ollama)

FRONTEND (Flutter 3.x):
- Dark theme with Svrnty branding
- Collapsible sidebar navigation
- CQRS API client with Result<T> error handling
- Type-safe endpoints from OpenAPI schema
- Multi-platform support (Web, iOS, Android, macOS, Linux, Windows)

DOCUMENTATION:
- Comprehensive API reference
- Architecture documentation
- Development guidelines for Claude Code
- API integration guides
- context-claude.md project overview

Status: Backend ready (Grade A-), Frontend integration pending

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 18:32:38 -04:00

79 lines
2.3 KiB
C#

using Codex.Dal.Enums;
namespace Codex.Dal.Entities;
/// <summary>
/// Represents a single message in a conversation.
/// Messages are stored permanently for audit trail, with IsInActiveWindow for efficient memory management.
/// </summary>
public class ConversationMessage
{
/// <summary>
/// Unique identifier for the message
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Foreign key to the conversation
/// </summary>
public Guid ConversationId { get; set; }
/// <summary>
/// Role of the message sender
/// </summary>
public MessageRole Role { get; set; }
/// <summary>
/// Content of the message
/// </summary>
public string Content { get; set; } = string.Empty;
/// <summary>
/// Tool calls made in this message (stored as JSON array if applicable)
/// </summary>
public string? ToolCalls { get; set; }
/// <summary>
/// Tool results from this message (stored as JSON array if applicable)
/// </summary>
public string? ToolResults { get; set; }
/// <summary>
/// Order of the message in the conversation (0-indexed)
/// </summary>
public int MessageIndex { get; set; }
/// <summary>
/// Whether this message is within the active conversation window for LLM context.
/// System messages are always in the active window.
/// For user/assistant/tool messages, only the last N are in the window (N = Agent.ConversationWindowSize).
/// </summary>
public bool IsInActiveWindow { get; set; } = true;
/// <summary>
/// Estimated token count for this message
/// </summary>
public int? TokenCount { get; set; }
/// <summary>
/// Foreign key to the execution that generated this message (nullable for user messages)
/// </summary>
public Guid? ExecutionId { get; set; }
/// <summary>
/// When this message was created
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
/// <summary>
/// The conversation this message belongs to
/// </summary>
public Conversation Conversation { get; set; } = null!;
/// <summary>
/// The execution that generated this message (if applicable)
/// </summary>
public AgentExecution? Execution { get; set; }
}