Merge claudedo/3a3e87648400492bba6e9643007703db
This commit is contained in:
@@ -29,6 +29,10 @@ namespace ClaudeDo.Worker.Hub;
|
||||
|
||||
public record ActiveTaskDto(string Slot, string TaskId, DateTime StartedAt);
|
||||
|
||||
/// <summary>Git SHA the running worker was built from. Null when the build wasn't stamped
|
||||
/// (e.g. a local dev build without the SourceRevisionId target).</summary>
|
||||
public record WorkerBuildInfoDto(string? BuildSha);
|
||||
|
||||
public record AppSettingsDto(
|
||||
string DefaultClaudeInstructions,
|
||||
string DefaultModel,
|
||||
@@ -159,6 +163,20 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
private static readonly string Version =
|
||||
Assembly.GetExecutingAssembly().GetName().Version?.ToString(3) ?? "0.0.0";
|
||||
|
||||
// SourceRevisionId (set by ClaudeDo.Worker.csproj's git-rev-parse build target) is appended
|
||||
// by the SDK to InformationalVersion as "+{sha}" -- take the segment after the LAST '+' so
|
||||
// this stays correct even when MinVer's own pre-release metadata already contains a '+'.
|
||||
private static readonly string? BuildSha = ParseBuildSha(
|
||||
Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion);
|
||||
|
||||
internal static string? ParseBuildSha(string? informationalVersion)
|
||||
{
|
||||
if (string.IsNullOrEmpty(informationalVersion)) return null;
|
||||
var plusIndex = informationalVersion.LastIndexOf('+');
|
||||
if (plusIndex < 0 || plusIndex == informationalVersion.Length - 1) return null;
|
||||
return informationalVersion[(plusIndex + 1)..];
|
||||
}
|
||||
|
||||
private readonly QueueService _queue;
|
||||
private readonly IQueueWaker _waker;
|
||||
private readonly AgentFileService _agentService;
|
||||
@@ -325,6 +343,11 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
|
||||
public string Ping() => $"pong v{Version}";
|
||||
|
||||
/// <summary>Lets the UI detect a worker that's still running an older build than the code it's
|
||||
/// comparing against (e.g. a just-merged main) — a separate diagnostic rather than extending
|
||||
/// Ping's "pong vX.Y.Z" text, since that format isn't ours to break for any existing caller.</summary>
|
||||
public WorkerBuildInfoDto GetWorkerBuildInfo() => new(BuildSha);
|
||||
|
||||
public IReadOnlyList<ActiveTaskDto> GetActive()
|
||||
{
|
||||
return _queue.GetActive()
|
||||
|
||||
Reference in New Issue
Block a user