Files
Luna/Luna.Core/Program.cs
T
darman bc25dc7b07 Add Luna.Core server with SignalR hub, session management, and tool system
Implement the core application server as an ASP.NET web host with:
- SignalR ChatHub for real-time client communication
- Session management with token estimation for context windowing
- Extensible tool system with attribute-based tool discovery
- Chat stream update builder for streaming AI responses
- App configuration with appsettings for development and production
2026-04-04 04:10:58 +02:00

51 lines
1.2 KiB
C#

using System.Text.Json;
using System.Text.Json.Serialization;
using Luna.Agents.Extensions;
using Luna.Channels.Extensions;
using Luna.Configuration.Extensions;
using Luna.Core.Abstractions;
using Luna.Core.Hubs;
using Luna.Core.Services.Extensions;
using Luna.Core.Tools.Extensions;
using Luna.Memory.Extensions;
using Luna.Providers.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration
.AddLunaConfiguration();
builder.Services
.AddOpenApi()
.AddProviders()
.AddAgents()
.AddTools()
.AddMemoryStore()
.AddSessionManager()
.AddChannels();
builder.Services.AddSignalR()
.AddJsonProtocol(options =>
{
options.PayloadSerializerOptions.Converters.Add(
new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
});
builder.Services.AddTransient<IChatHubContext, ChatHubContext>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.MapHub<ChatHub>("/chat");
app.Run();
// Expose Program type for WebApplicationFactory in integration tests
namespace Luna.Core
{
public partial class Program { }
}