Add Luna.Configuration with TOML-based agent and provider config

Implement configuration system with embedded TOML resources for agent
and provider definitions, custom IConfigurationSource/Provider for
agent and provider options, and DI extension methods. Includes config
models for agents, providers, sessions, and Telegram integration.
This commit is contained in:
2026-04-04 04:09:57 +02:00
parent dcdd77b5ae
commit a4ed65e452
18 changed files with 456 additions and 0 deletions
@@ -0,0 +1,40 @@
using Luna.Configuration.Services.Agents;
using Luna.Configuration.Services.Providers;
using Microsoft.Extensions.Configuration;
namespace Luna.Configuration.Extensions;
public static class ConfigurationBuilderExtensions
{
private static string[] AgentConfigSearchPaths =
[
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".luna", "agents")
];
private static string[] ProviderConfigSearchPaths =
[
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".luna", "providers")
];
extension(IConfigurationBuilder builder)
{
public IConfigurationBuilder AddLunaConfiguration()
{
builder.Add(new AgentOptionsConfigurationSource());
foreach (var searchPath in AgentConfigSearchPaths)
{
builder.Add(new AgentOptionsConfigurationSource(searchPath));
}
builder.Add(new ProviderOptionsConfigurationSource());
foreach (var searchPath in ProviderConfigSearchPaths)
{
builder.Add(new ProviderOptionsConfigurationSource(searchPath));
}
return builder;
}
}
}