namespace Agent.App.Configuration; public sealed class AgentConfiguration { public int SchemaVersion { get; set; } public ApplicationOptions Application { get; set; } = new(); public McpOptions Mcp { get; set; } = new(); public RuntimeOptions Agent { get; set; } = new(); public OllamaConfiguration Ollama { get; set; } = new(); public PlannerOptions Planner { get; set; } = new(); public SandboxOptions Sandbox { get; set; } = new(); public FileEditOptions FileEdit { get; set; } = new(); public LimitOptions Limits { get; set; } = new(); public LocalizationOptions Localization { get; set; } = new(); public SkillOptions Skills { get; set; } = new(); public LoggingOptions Logging { get; set; } = new(); } public sealed class ApplicationOptions { public string Language { get; set; } = "en"; } public sealed class McpOptions { public string Transport { get; set; } = "stdio"; public HttpOptions Http { get; set; } = new(); public ImageOptions Images { get; set; } = new(); public McpTaskOptions Tasks { get; set; } = new(); } public sealed class HttpOptions { public string Host { get; set; } = "127.0.0.1"; public int Port { get; set; } = 8080; } public sealed class ImageOptions { public int MaxCount { get; set; } = 4; public long MaxBytesEach { get; set; } = 10 * 1024 * 1024; public long MaxTotalBytes { get; set; } = 20 * 1024 * 1024; } public sealed class McpTaskOptions { public int TimeToLiveHours { get; set; } = 24; public int PollIntervalMs { get; set; } = 1000; } public sealed class RuntimeOptions { public string UserSystemPrompt { get; set; } = "prompts/user-system.md"; public int MaxIterations { get; set; } = 128; public int SameFailureLimit { get; set; } = 5; } public sealed class OllamaConfiguration { public string Endpoint { get; set; } = "http://127.0.0.1:11434"; public string Model { get; set; } = string.Empty; public bool Think { get; set; } = true; public string KeepAlive { get; set; } = "5m"; public OllamaGenerationOptions Options { get; set; } = new(); public Dictionary ExtraOptions { get; set; } = new(StringComparer.Ordinal); } public sealed class OllamaGenerationOptions { public int? NumCtx { get; set; } public int? NumKeep { get; set; } public int? NumPredict { get; set; } public double? Temperature { get; set; } public int? Seed { get; set; } public int? TopK { get; set; } public double? TopP { get; set; } public double? MinP { get; set; } public double? TypicalP { get; set; } public double? TfsZ { get; set; } public int? RepeatLastN { get; set; } public double? RepeatPenalty { get; set; } public double? PresencePenalty { get; set; } public double? FrequencyPenalty { get; set; } public int? Mirostat { get; set; } public double? MirostatTau { get; set; } public double? MirostatEta { get; set; } public List Stop { get; set; } = []; } public sealed class PlannerOptions { public int MaxTasks { get; set; } = 32; } public sealed class SandboxOptions { public FilesystemOptions Filesystem { get; set; } = new(); public ProcessOptions Process { get; set; } = new(); public NetworkOptions Network { get; set; } = new(); public ResourceOptions Resources { get; set; } = new(); } public sealed class FilesystemOptions { public List Read { get; set; } = []; public List Write { get; set; } = []; public List Execute { get; set; } = []; public List Delete { get; set; } = []; } public sealed class ProcessOptions { public bool AllowShell { get; set; } = true; public List Approvals { get; set; } = []; public int MaxProcesses { get; set; } = 16; } public sealed class ExecutableApproval { public string Path { get; set; } = string.Empty; public string Sha256 { get; set; } = string.Empty; } public sealed class NetworkOptions { public string Mode { get; set; } = "deny"; public List Allow { get; set; } = []; } public sealed class NetworkAllowance { public string Host { get; set; } = string.Empty; public List Ports { get; set; } = []; } public sealed class ResourceOptions { public int MemoryMb { get; set; } = 4096; public int ProcessTimeoutSeconds { get; set; } = 1800; } public sealed class FileEditOptions { public int MemoryBackupLimitMb { get; set; } = 16; } public sealed class LimitOptions { public long WholeReadBytes { get; set; } = 1024 * 1024; public int SearchMaxResults { get; set; } = 1000; public int TailMaxLines { get; set; } = 10000; public double ContextSummaryRatio { get; set; } = 0.8; } public sealed class LocalizationOptions { public string Directory { get; set; } = "config/locales"; public string Fallback { get; set; } = "en"; } public sealed class SkillOptions { public string Directory { get; set; } = "skills"; } public sealed class LoggingOptions { public string Directory { get; set; } = "logs"; public string Level { get; set; } = "information"; public bool HttpRequests { get; set; } = true; public long MaxFileBytes { get; set; } = 10 * 1024 * 1024; public int RetainedFiles { get; set; } = 5; }