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>
379 lines
13 KiB
C#
379 lines
13 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using System.Text.Json;
|
|
using Codex.Dal;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace Codex.Dal.Migrations
|
|
{
|
|
[DbContext(typeof(CodexDbContext))]
|
|
[Migration("20251026190533_InitialAgentSchema")]
|
|
partial class InitialAgentSchema
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "8.0.11")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
|
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.Agent", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<string>("ApiKeyEncrypted")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<int>("ConversationWindowSize")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("Description")
|
|
.IsRequired()
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("character varying(1000)");
|
|
|
|
b.Property<bool>("EnableMemory")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<bool>("IsDeleted")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<int>("MaxTokens")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("ModelEndpoint")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("character varying(500)");
|
|
|
|
b.Property<string>("ModelName")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<string>("ModelProvider")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("character varying(200)");
|
|
|
|
b.Property<int>("ProviderType")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("SystemPrompt")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<double>("Temperature")
|
|
.HasColumnType("double precision");
|
|
|
|
b.Property<int>("Type")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Type");
|
|
|
|
b.HasIndex("Status", "IsDeleted");
|
|
|
|
b.ToTable("Agents");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.AgentExecution", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<Guid>("AgentId")
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<DateTime?>("CompletedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<Guid?>("ConversationId")
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<string>("ErrorMessage")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<decimal?>("EstimatedCost")
|
|
.HasPrecision(18, 6)
|
|
.HasColumnType("numeric(18,6)");
|
|
|
|
b.Property<long?>("ExecutionTimeMs")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<string>("Input")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<int?>("InputTokens")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("Output")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("text")
|
|
.HasDefaultValue("");
|
|
|
|
b.Property<int?>("OutputTokens")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<DateTime>("StartedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("ToolCallResults")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("ToolCalls")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<int?>("TotalTokens")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("UserPrompt")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ConversationId");
|
|
|
|
b.HasIndex("Status");
|
|
|
|
b.HasIndex("AgentId", "StartedAt")
|
|
.IsDescending(false, true);
|
|
|
|
b.ToTable("AgentExecutions");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.AgentTool", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<Guid>("AgentId")
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<string>("ApiBaseUrl")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("character varying(500)");
|
|
|
|
b.Property<string>("ApiKeyEncrypted")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<JsonDocument>("Configuration")
|
|
.HasColumnType("jsonb");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<bool>("IsEnabled")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<string>("McpAuthTokenEncrypted")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("McpServerUrl")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("character varying(500)");
|
|
|
|
b.Property<string>("ToolName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("character varying(200)");
|
|
|
|
b.Property<int>("Type")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Type");
|
|
|
|
b.HasIndex("AgentId", "IsEnabled");
|
|
|
|
b.ToTable("AgentTools");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.Conversation", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<DateTime>("LastMessageAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<int>("MessageCount")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<DateTime>("StartedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("Summary")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("character varying(2000)");
|
|
|
|
b.Property<string>("Title")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("character varying(500)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("IsActive", "LastMessageAt")
|
|
.IsDescending(false, true);
|
|
|
|
b.ToTable("Conversations");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.ConversationMessage", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<string>("Content")
|
|
.IsRequired()
|
|
.HasColumnType("text");
|
|
|
|
b.Property<Guid>("ConversationId")
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<Guid?>("ExecutionId")
|
|
.HasColumnType("uuid");
|
|
|
|
b.Property<bool>("IsInActiveWindow")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<int>("MessageIndex")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("Role")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int?>("TokenCount")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("ToolCalls")
|
|
.HasColumnType("text");
|
|
|
|
b.Property<string>("ToolResults")
|
|
.HasColumnType("text");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ExecutionId");
|
|
|
|
b.HasIndex("Role");
|
|
|
|
b.HasIndex("ConversationId", "MessageIndex");
|
|
|
|
b.HasIndex("ConversationId", "IsInActiveWindow", "MessageIndex");
|
|
|
|
b.ToTable("ConversationMessages");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.AgentExecution", b =>
|
|
{
|
|
b.HasOne("Codex.Dal.Entities.Agent", "Agent")
|
|
.WithMany("Executions")
|
|
.HasForeignKey("AgentId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Codex.Dal.Entities.Conversation", "Conversation")
|
|
.WithMany("Executions")
|
|
.HasForeignKey("ConversationId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
|
|
b.Navigation("Agent");
|
|
|
|
b.Navigation("Conversation");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.AgentTool", b =>
|
|
{
|
|
b.HasOne("Codex.Dal.Entities.Agent", "Agent")
|
|
.WithMany("Tools")
|
|
.HasForeignKey("AgentId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Agent");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.ConversationMessage", b =>
|
|
{
|
|
b.HasOne("Codex.Dal.Entities.Conversation", "Conversation")
|
|
.WithMany("Messages")
|
|
.HasForeignKey("ConversationId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Codex.Dal.Entities.AgentExecution", "Execution")
|
|
.WithMany("Messages")
|
|
.HasForeignKey("ExecutionId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
|
|
b.Navigation("Conversation");
|
|
|
|
b.Navigation("Execution");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.Agent", b =>
|
|
{
|
|
b.Navigation("Executions");
|
|
|
|
b.Navigation("Tools");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.AgentExecution", b =>
|
|
{
|
|
b.Navigation("Messages");
|
|
});
|
|
|
|
modelBuilder.Entity("Codex.Dal.Entities.Conversation", b =>
|
|
{
|
|
b.Navigation("Executions");
|
|
|
|
b.Navigation("Messages");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|