From 3c3bb30696f013669067fc551f48e5eb4dfff11f Mon Sep 17 00:00:00 2001 From: mika kuns Date: Mon, 24 Aug 2026 13:50:51 +0200 Subject: [PATCH] feat(ui): add TokenTracker status, refresh and install to the worker client --- .../Services/Interfaces/IWorkerClient.cs | 3 ++ src/ClaudeDo.Ui/Services/WorkerClient.cs | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/ClaudeDo.Ui/Services/Interfaces/IWorkerClient.cs b/src/ClaudeDo.Ui/Services/Interfaces/IWorkerClient.cs index 45a0db68..24f961df 100644 --- a/src/ClaudeDo.Ui/Services/Interfaces/IWorkerClient.cs +++ b/src/ClaudeDo.Ui/Services/Interfaces/IWorkerClient.cs @@ -207,4 +207,7 @@ public interface IWorkerClient : INotifyPropertyChanged Task RefreshUsageAsync(); Task> GetModelUsageAsync(DateOnly from, DateOnly to); Task> GetTaskUsageAsync(DateOnly from, DateOnly to); + Task GetTokenTrackerStatusAsync(); + Task RefreshTokenTrackerAsync(); + Task InstallTokenTrackerAsync(); } diff --git a/src/ClaudeDo.Ui/Services/WorkerClient.cs b/src/ClaudeDo.Ui/Services/WorkerClient.cs index a5f8a85c..dcc2b98e 100644 --- a/src/ClaudeDo.Ui/Services/WorkerClient.cs +++ b/src/ClaudeDo.Ui/Services/WorkerClient.cs @@ -689,6 +689,15 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC public async Task> GetTaskUsageAsync(DateOnly from, DateOnly to) => await TryInvokeAsync>("GetTaskUsage", from, to) ?? []; + public Task GetTokenTrackerStatusAsync() + => TryInvokeAsync("GetTokenTrackerStatus"); + + public Task RefreshTokenTrackerAsync() + => TryInvokeAsync("RefreshTokenTracker"); + + public Task InstallTokenTrackerAsync() + => TryInvokeAsync("InstallTokenTracker"); + // IWorkerClient explicit implementations (drop typed return values) async Task IWorkerClient.StartPlanningSessionAsync(string taskId, CancellationToken ct) => await StartPlanningSessionAsync(taskId, ct); @@ -846,7 +855,8 @@ public sealed record ModelUsageRowDto( long OutputTokens, long CacheReadTokens, long CacheCreationTokens, - int Messages); + int Messages, + double? CostUsd = null); public sealed record TaskUsageRowDto( string TaskId, @@ -856,4 +866,18 @@ public sealed record TaskUsageRowDto( string? Model, int Runs, long TokensIn, - long TokensOut); + long TokensOut, + double? CostUsd = null, + int? Retries = null, + bool? Productive = null, + bool? OneShot = null); + +public sealed record TokenTrackerStatusDto( + bool Installed, + string? Version, + bool NodeOk, + string? NodeVersion, + DateTime? LastFetchedUtc, + string? LastError, + int? FormatVersion, + int SessionCount);