feat(ui): subscribe to WorkerLog SignalR event

This commit is contained in:
mika kuns
2026-04-23 14:49:43 +02:00
parent e8056553fd
commit e80e3fccc0

View File

@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.SignalR.Client;
namespace ClaudeDo.Ui.Services; namespace ClaudeDo.Ui.Services;
public record ActiveTask(string Slot, string TaskId, DateTime StartedAt); public record ActiveTask(string Slot, string TaskId, DateTime StartedAt);
public sealed record WorkerLogEntry(string Message, WorkerLogLevel Level, DateTime TimestampUtc);
sealed class IndefiniteRetryPolicy : IRetryPolicy sealed class IndefiniteRetryPolicy : IRetryPolicy
{ {
@@ -46,6 +47,7 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable
public event Action<string>? WorktreeUpdatedEvent; public event Action<string>? WorktreeUpdatedEvent;
public event Action<string>? RunNowRequestedEvent; public event Action<string>? RunNowRequestedEvent;
public event Action<string>? ListUpdatedEvent; public event Action<string>? ListUpdatedEvent;
public event Action<WorkerLogEntry>? WorkerLogReceivedEvent;
public WorkerClient(string signalRUrl) public WorkerClient(string signalRUrl)
{ {
@@ -116,6 +118,11 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable
{ {
Dispatcher.UIThread.Post(() => ListUpdatedEvent?.Invoke(listId)); Dispatcher.UIThread.Post(() => ListUpdatedEvent?.Invoke(listId));
}); });
_hub.On<string, WorkerLogLevel, DateTime>("WorkerLog", (message, level, timestampUtc) =>
{
WorkerLogReceivedEvent?.Invoke(new WorkerLogEntry(message, level, timestampUtc));
});
} }
public Task StartAsync() public Task StartAsync()