From 026df8d8f65a9c125f07e64cb9d770831339b41d Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Tue, 14 Apr 2026 16:20:39 +0200 Subject: [PATCH] feat(ui): add RunNowRequestedEvent and GetAgentsAsync to WorkerClient Co-Authored-By: Claude Sonnet 4.6 --- src/ClaudeDo.Ui/Services/WorkerClient.cs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/ClaudeDo.Ui/Services/WorkerClient.cs b/src/ClaudeDo.Ui/Services/WorkerClient.cs index 05458a9..107748e 100644 --- a/src/ClaudeDo.Ui/Services/WorkerClient.cs +++ b/src/ClaudeDo.Ui/Services/WorkerClient.cs @@ -42,6 +42,7 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable public event Action? TaskMessageEvent; public event Action? TaskUpdatedEvent; public event Action? WorktreeUpdatedEvent; + public event Action? RunNowRequestedEvent; public WorkerClient(string signalRUrl) { @@ -162,6 +163,7 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable public async Task RunNowAsync(string taskId) { + RunNowRequestedEvent?.Invoke(taskId); await _hub.InvokeAsync("RunNow", taskId); } @@ -175,6 +177,24 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable await _hub.InvokeAsync("WakeQueue"); } + public async Task> GetAgentsAsync() + { + try + { + var agents = await _hub.InvokeAsync>("GetAgents"); + return agents ?? []; + } + catch + { + return []; + } + } + + public async Task RefreshAgentsAsync() + { + await _hub.InvokeAsync("RefreshAgents"); + } + private async Task SeedActiveTasksAsync() { try @@ -200,7 +220,7 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable await _hub.DisposeAsync(); } - // DTO for deserializing the GetActive response + // DTOs for deserializing hub responses private sealed class ActiveTaskDto { public string Slot { get; set; } = ""; @@ -208,3 +228,5 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable public DateTime StartedAt { get; set; } } } + +public record AgentInfo(string Name, string Description, string Path);