09eaf360a3
SharedKernel: IWorkerModule seam (RegisterWorker runs in the worker host only).
Bootstrap: AddTeamUpWorkerServices; the worker host now wires it.
Assembler module (schema "assembler", InitialAssembler migration):
- Job (Pending→Processing→Done/Failed) + AgentRun (Queued→Running→Completed/Failed) entities.
- JobQueue: enqueue + ClaimNextAsync using `FOR UPDATE SKIP LOCKED` in a transaction.
- AgentRunExecutor (Increment-1 placeholder — real assemble/model/parse lands in Increment 2).
- JobProcessor BackgroundService drains the queue on the worker host (web off the model path).
- POST /api/assembler/runs enqueues a run; GET /api/assembler/runs/{id} reads it.
Verified: build green; ArchitectureTests 8/8 (Assembler references only SharedKernel);
IntegrationTests 28/28 incl. enqueue→claim(SKIP LOCKED)→process→Completed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using Microsoft.AspNetCore.Routing;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using TeamUp.SharedKernel.Modularity;
|
|
|
|
namespace TeamUp.Bootstrap;
|
|
|
|
public static class TeamUpModuleExtensions
|
|
{
|
|
/// <summary>Runs every module's <c>Register</c>. Called by BOTH hosts.</summary>
|
|
public static IServiceCollection AddTeamUpModules(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
foreach (var module in ModuleCatalog.All)
|
|
{
|
|
module.Register(services, configuration);
|
|
}
|
|
|
|
return services;
|
|
}
|
|
|
|
/// <summary>Runs every module's <c>MapEndpoints</c>. Called by the WEB host only.</summary>
|
|
public static IEndpointRouteBuilder MapTeamUpModules(this IEndpointRouteBuilder endpoints)
|
|
{
|
|
foreach (var module in ModuleCatalog.All)
|
|
{
|
|
module.MapEndpoints(endpoints);
|
|
}
|
|
|
|
return endpoints;
|
|
}
|
|
|
|
/// <summary>Runs <c>RegisterWorker</c> for modules with background services. WORKER host only.</summary>
|
|
public static IServiceCollection AddTeamUpWorkerServices(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
foreach (var module in ModuleCatalog.All)
|
|
{
|
|
if (module is IWorkerModule workerModule)
|
|
{
|
|
workerModule.RegisterWorker(services, configuration);
|
|
}
|
|
}
|
|
|
|
return services;
|
|
}
|
|
}
|