Import the wilm agent store, WINC adoption work and batches CLI, with four fixes

This commit is contained in:
2026-09-03 08:16:38 -04:00
parent 4b21aa3887
commit b0bd73f62d
51 changed files with 5107 additions and 90 deletions

View File

@@ -19,6 +19,7 @@ public sealed class EndpointReport
[JsonPropertyName("ipaddress")] public string? IpAddress { get; set; }
[JsonPropertyName("machinenumber")] public string? MachineNumber { get; set; }
[JsonPropertyName("agentversion")] public string? AgentVersion { get; set; }
[JsonPropertyName("trayversion")] public string? TrayVersion { get; set; }
[JsonPropertyName("lastboottime")] public DateTimeOffset? LastBootTime { get; set; }
[JsonPropertyName("uptimeseconds")] public long? UptimeSeconds { get; set; }
[JsonPropertyName("idleseconds")] public long? IdleSeconds { get; set; }

View File

@@ -37,6 +37,7 @@ public sealed class EndpointCollector : ICollector
{
Hostname = Environment.MachineName,
AgentVersion = agentVersion,
TrayVersion = GetTrayVersion(),
Adopt = adopt ? true : null,
LoggedInUser = GetLoggedInUser(),
SerialNumber = GetSerialNumber(),
@@ -65,6 +66,34 @@ public sealed class EndpointCollector : ICollector
return report;
}
// The interactive tray app ships and updates independently of this service,
// so the agent reports the tray's file version as its own field. Resolve the
// tray exe beside the agent first (the normal install layout), then the
// default install dir; degrade to null when it is absent or unreadable so a
// tray-less install simply omits the field rather than failing the report.
private const string TrayExeName = "shopdb-endpoint-tray.exe";
private const string DefaultInstallDir = @"C:\Program Files\ShopDB\EndpointAgent";
private string? GetTrayVersion()
{
try
{
var beside = Path.Combine(AppContext.BaseDirectory, TrayExeName);
var installed = Path.Combine(DefaultInstallDir, TrayExeName);
var trayExe = File.Exists(beside) ? beside
: File.Exists(installed) ? installed
: null;
if (trayExe is null)
return null;
return FileVersionInfo.GetVersionInfo(trayExe).FileVersion;
}
catch (Exception ex)
{
logger.LogDebug(ex, "could not resolve tray version");
return null;
}
}
// Combined watch list: interactive processes (by image name) and Windows
// services (by service key name). Both land in report.Services with a shared
// {name, app, kind, state, running, count} shape so the server/UI renders

View File

@@ -8,6 +8,11 @@
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>ShopDbEndpointAgent.Tray</RootNamespace>
<AssemblyName>shopdb-endpoint-tray</AssemblyName>
<!-- 1.0.0: first explicitly stamped tray version. The tray and the agent
service version independently (they are separate exes and can be pushed
apart), so the tray carries its own <Version> and the agent reports it
as trayversion alongside its own agentversion (AGENT-CONTRACT.md 2). -->
<Version>1.0.0</Version>
<InvariantGlobalization>true</InvariantGlobalization>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>