Entscheidungen aus dem Testbetrieb umgesetzt (#572): #577 #579 #581 #589 #193 #205 #594 #595 #597 #598 #599 #588
- Engine: leere Antworten nachfassen, Aufgaben enden mit Ergebniszeile (EmptyResponse/Incomplete), gleiche Fehlschlaege erkennen (RepeatedFailure), Zeitzeile vor Chatnachrichten, Werkzeugergebnisse gerahmt, Vorpruefung vor dem Staging, Belegkosten wie RunUsage - Staging: gescheiterte Freigaben als Failed; AgentEditor-Aenderungen freigabepflichtig, Selbstbearbeitung gesperrt (allowSelfEdit) - Taskboard: Termine beim Anlegen pruefen, naechster/letzter Lauf, pausieren, Sofortlauf, Kostenprognose, Hinweis auf wachsenden Kontext; Jobs-Reiter und /api/jobs entfernt - Release: Instanzmanager samt Weboberflaeche im Paket, setup.json fragt manager.json ab, Token nicht mehr ins systemd-Journal Version 0.1.6. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,6 @@ internal static class ApiEndpoints
|
||||
api.MapInfo();
|
||||
api.MapAgents();
|
||||
api.MapChat();
|
||||
api.MapJobs();
|
||||
api.MapServices();
|
||||
api.MapTasks();
|
||||
api.MapStaging();
|
||||
@@ -207,44 +206,6 @@ internal static class ApiEndpoints
|
||||
});
|
||||
}
|
||||
|
||||
// ─── Geplante Läufe ───
|
||||
|
||||
private static void MapJobs(this RouteGroupBuilder api)
|
||||
{
|
||||
var jobs = api.MapGroup("/jobs");
|
||||
|
||||
jobs.MapGet("/", (AppHost host) => host.JobAdmin.List()
|
||||
.Select(j => j.ToDto(host.Runs.LastRun(j.JobId)))
|
||||
.ToList());
|
||||
|
||||
jobs.MapPost("/", (AppHost host, JobInputDto input) =>
|
||||
host.JobAdmin.Add(input.ToDefinition()).ToResponse());
|
||||
|
||||
jobs.MapPut("/{jobId}", (AppHost host, string jobId, JobInputDto input) =>
|
||||
host.JobAdmin.Update(jobId, input.ToDefinition()).ToResponse());
|
||||
|
||||
jobs.MapDelete("/{jobId}", (AppHost host, string jobId, string agentId, string kind) =>
|
||||
host.JobAdmin.Remove(
|
||||
agentId,
|
||||
jobId,
|
||||
string.Equals(kind, "toolJob", StringComparison.OrdinalIgnoreCase)
|
||||
? JobKind.ToolJob
|
||||
: JobKind.AgentWakeup).ToResponse());
|
||||
|
||||
jobs.MapPut("/{jobId}/enabled", (
|
||||
AppHost host, string jobId, string agentId, bool enabled) =>
|
||||
host.JobAdmin.SetEnabled(agentId, jobId, enabled).ToResponse());
|
||||
|
||||
jobs.MapPost("/{jobId}/run", async (
|
||||
AppHost host, string jobId, CancellationToken ct) =>
|
||||
{
|
||||
if (host.JobAdmin.List().FirstOrDefault(j => j.JobId == jobId) is not { } job)
|
||||
return Results.NotFound(new OutcomeDto(false, $"Kein geplanter Lauf '{jobId}'."));
|
||||
|
||||
return (await host.Runs.RunAsync(job, ct)).ToResponse();
|
||||
});
|
||||
}
|
||||
|
||||
// ─── Dienste ───
|
||||
|
||||
private static void MapServices(this RouteGroupBuilder api)
|
||||
@@ -272,17 +233,24 @@ internal static class ApiEndpoints
|
||||
{
|
||||
var tasks = api.MapGroup("/tasks");
|
||||
|
||||
// #594: Das Taskboard ist die einzige Stelle fuer geplante Arbeit. Die frueheren
|
||||
// /api/jobs bearbeiteten die Alt-Konfiguration, die nach der Uebernahme nichts mehr bewirkte.
|
||||
tasks.MapGet("/", async (AppHost host, CancellationToken ct, int limit = 50) =>
|
||||
{
|
||||
if (host.Board is not { } board)
|
||||
return Unavailable(
|
||||
"Kein Taskboard: Den Agenten dieser Instanz fehlt ein gemeinsamer Arbeitsbereich.");
|
||||
await host.TaskAdmin.ListAsync(limit, ct) is { } list
|
||||
? Results.Ok(list.Select(t => t.ToDto()).ToList())
|
||||
: Unavailable("Kein Taskboard: Den Agenten dieser Instanz fehlt ein gemeinsamer Arbeitsbereich."));
|
||||
|
||||
var items = await board.ListAsync(
|
||||
new Core.Tasks.TaskQuery { Limit = Math.Clamp(limit, 1, 500) }, ct);
|
||||
tasks.MapPost("/", async (AppHost host, TaskInputDto input, CancellationToken ct) =>
|
||||
(await host.TaskAdmin.CreateAsync(input.ToInput(), ct)).ToResponse());
|
||||
|
||||
return Results.Ok(items.Select(t => t.ToDto()).ToList());
|
||||
});
|
||||
tasks.MapPut("/{id}", async (AppHost host, string id, TaskInputDto input, CancellationToken ct) =>
|
||||
(await host.TaskAdmin.UpdateAsync(id, input.ToInput(), ct)).ToResponse());
|
||||
|
||||
tasks.MapPut("/{id}/enabled", async (AppHost host, string id, bool enabled, CancellationToken ct) =>
|
||||
(await host.TaskAdmin.SetEnabledAsync(id, enabled, ct)).ToResponse());
|
||||
|
||||
tasks.MapPost("/{id}/run", async (AppHost host, string id, CancellationToken ct) =>
|
||||
(await host.TaskAdmin.RunNowAsync(id, ct)).ToResponse());
|
||||
|
||||
tasks.MapGet("/{id}", async (AppHost host, string id, CancellationToken ct) =>
|
||||
{
|
||||
@@ -344,6 +312,12 @@ internal static class ApiEndpoints
|
||||
var recent = await usage.GetRecentAsync(Math.Clamp(limit, 1, 1000), ct);
|
||||
return Results.Ok(recent.Select(r => r.ToDto()).ToList());
|
||||
});
|
||||
|
||||
// #595: Hochrechnung aus Terminen und bisherigen Laeufen.
|
||||
api.MapGet("/usage/forecast", async (AppHost host, CancellationToken ct) =>
|
||||
await host.TaskAdmin.ForecastAsync(ct) is { } prognose
|
||||
? Results.Ok(prognose.ToDto())
|
||||
: Unavailable("Keine Prognose: In dieser Instanz gibt es kein Taskboard."));
|
||||
}
|
||||
|
||||
// ─── Protokoll ───
|
||||
|
||||
Reference in New Issue
Block a user