2026-04-01 12:49:07 +02:00
|
|
|
using DebugTools.MccMcpWebPlayground.Api;
|
|
|
|
|
using DebugTools.MccMcpWebPlayground.Harness;
|
|
|
|
|
using DebugTools.MccMcpWebPlayground.Infrastructure.Mcp;
|
|
|
|
|
using DebugTools.MccMcpWebPlayground.Infrastructure.OpenRouter;
|
|
|
|
|
using Microsoft.AspNetCore.Http.Timeouts;
|
2026-03-28 04:12:37 +01:00
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
2026-04-01 12:49:07 +02:00
|
|
|
builder.Services.AddOptions<MccWebHarnessOptions>()
|
|
|
|
|
.Bind(builder.Configuration.GetSection(MccWebHarnessOptions.SectionName));
|
2026-03-28 04:12:37 +01:00
|
|
|
|
2026-04-01 12:49:07 +02:00
|
|
|
builder.Services.AddRequestTimeouts(options =>
|
2026-03-28 04:12:37 +01:00
|
|
|
{
|
2026-04-01 12:49:07 +02:00
|
|
|
options.AddPolicy("mcc-stream", new RequestTimeoutPolicy
|
2026-03-28 04:12:37 +01:00
|
|
|
{
|
2026-04-01 12:49:07 +02:00
|
|
|
Timeout = TimeSpan.FromMinutes(10)
|
2026-03-28 04:12:37 +01:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-01 12:49:07 +02:00
|
|
|
builder.Services.AddHttpClient("openrouter", client =>
|
2026-03-28 04:12:37 +01:00
|
|
|
{
|
2026-04-01 12:49:07 +02:00
|
|
|
client.Timeout = TimeSpan.FromMinutes(15);
|
2026-03-28 04:12:37 +01:00
|
|
|
});
|
|
|
|
|
|
2026-04-01 12:49:07 +02:00
|
|
|
builder.Services.AddSingleton<MccMcpSessionFactory>();
|
|
|
|
|
builder.Services.AddSingleton<MccGuidanceSource>();
|
|
|
|
|
builder.Services.AddSingleton<MccContextCompressor>();
|
|
|
|
|
builder.Services.AddSingleton<MccFinalizer>();
|
|
|
|
|
builder.Services.AddSingleton<MccPromptComposer>();
|
|
|
|
|
builder.Services.AddSingleton<OpenRouterChatClient>();
|
|
|
|
|
builder.Services.AddScoped<IMccAgentRunService, MccAgentRunService>();
|
2026-03-28 04:12:37 +01:00
|
|
|
|
2026-04-01 12:49:07 +02:00
|
|
|
var app = builder.Build();
|
2026-03-28 04:12:37 +01:00
|
|
|
|
2026-04-01 12:49:07 +02:00
|
|
|
app.UseRequestTimeouts();
|
|
|
|
|
app.UseDefaultFiles();
|
|
|
|
|
app.UseStaticFiles();
|
|
|
|
|
app.MapMccPlaygroundEndpoints();
|
2026-03-28 04:12:37 +01:00
|
|
|
|
2026-04-01 12:49:07 +02:00
|
|
|
app.Run();
|