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
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
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 { }
|
||||
}
|
||||
Reference in New Issue
Block a user