From 0ce444f3949f5c687d087739e5ef49b728d4787f50d88df8827095b6c5109ea7 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 19:56:19 -0400 Subject: [PATCH 01/26] feat(upgrades): contracts for MSI upgrades and semantic versions AgentVersions compares semantic versions (a fourth field for builds between releases, +metadata ignored) and sorts the calendar era (major 2000 or more) before them. Presence reports how the agent was installed; MSI installs upgrade from the MSI, with the current version's MSI for rollback; the watchdog hand-over gains an msi kind and the runner's journal. Co-Authored-By: Claude Opus 5.5 --- .../Messages/AgentUpgradePayloads.cs | 13 ++- src/Shared.Contracts/Messages/Payloads.cs | 6 +- src/Shared.Contracts/Models/AgentUpgrades.cs | 80 ++++++++++++++++--- src/Shared.Contracts/Models/WatchdogFiles.cs | 62 +++++++++++++- .../Serialization/WatchdogJsonContext.cs | 1 + 5 files changed, 147 insertions(+), 15 deletions(-) diff --git a/src/Shared.Contracts/Messages/AgentUpgradePayloads.cs b/src/Shared.Contracts/Messages/AgentUpgradePayloads.cs index 6e398f6..028e720 100644 --- a/src/Shared.Contracts/Messages/AgentUpgradePayloads.cs +++ b/src/Shared.Contracts/Messages/AgentUpgradePayloads.cs @@ -11,6 +11,13 @@ namespace Shared.Contracts.Messages; /// . The agent waits a random 0 to /// seconds before downloading, so one /// batch of devices does not start in the same instant. +/// +/// For an MSI upgrade ( "msi") the Rollback fields +/// name the MSI of the version the device runs now, when the server holds it, so +/// the runner can reinstall it if the new version is not healthy. The agent +/// prefers its own kept copy (WatchdogFiles.KeptPackages) and downloads +/// this one only when it has none. +/// /// public sealed record AgentUpgradeCommandPayload( Guid UpgradeId, @@ -21,7 +28,11 @@ public sealed record AgentUpgradeCommandPayload( long SizeBytes, bool Revert, int HealthDeadlineSeconds, - int StartJitterSeconds = 0); + int StartJitterSeconds = 0, + string? RollbackVersion = null, + string? RollbackDownloadUrl = null, + string? RollbackSha256 = null, + long? RollbackSizeBytes = null); /// /// Progress or outcome of one upgrade, published by the agent on diff --git a/src/Shared.Contracts/Messages/Payloads.cs b/src/Shared.Contracts/Messages/Payloads.cs index 5c58785..88003a4 100644 --- a/src/Shared.Contracts/Messages/Payloads.cs +++ b/src/Shared.Contracts/Messages/Payloads.cs @@ -5,7 +5,8 @@ namespace Shared.Contracts.Messages; /// /// Periodic agent heartbeat published on agent.<clientId>.presence. /// Runtime is the agent build's runtime identifier (e.g. win-x64), which -/// picks the package it upgrades from; older agents leave it out. +/// picks the package it upgrades from; Install is an AgentInstallKinds +/// value (msi or portable). Older agents leave both out. /// public sealed record PresencePayload( string ClientId, @@ -15,7 +16,8 @@ public sealed record PresencePayload( DateTimeOffset TimestampUtc, long UptimeSeconds, int ActiveJobs, - string? Runtime = null); + string? Runtime = null, + string? Install = null); /// Inventory snapshot published on agent.<clientId>.inventory. public sealed record InventoryPayload(InventoryReport Report); diff --git a/src/Shared.Contracts/Models/AgentUpgrades.cs b/src/Shared.Contracts/Models/AgentUpgrades.cs index 23a358e..867cd2b 100644 --- a/src/Shared.Contracts/Models/AgentUpgrades.cs +++ b/src/Shared.Contracts/Models/AgentUpgrades.cs @@ -50,6 +50,10 @@ public static class AgentUpgradeReasons public const string Watchdog = "watchdog"; /// Files could not be swapped (the previous version was put back). public const string Swap = "swap"; + /// Windows Installer failed or did not finish in time (its own transaction put the previous version back). + public const string Msi = "msi"; + /// Another installation kept Windows Installer busy (1618) through every retry. + public const string InstallerBusy = "installer-busy"; /// The new version did not report healthy before the deadline (rolled back). public const string HealthDeadline = "health-deadline"; /// The new version kept exiting (rolled back). @@ -75,10 +79,20 @@ public static class AgentUpgradeSources public const string Rollback = "rollback"; } +/// How an agent was installed, reported on presence (PresencePayload.Install). +public static class AgentInstallKinds +{ + /// Installed by the MSI (Windows Installer knows the product): upgrades go through the MSI. + public const string Msi = "msi"; + /// Unpacked from the portable package: upgrades swap files. + public const string Portable = "portable"; +} + /// -/// Agent package types: the file the server holds for each platform. Windows -/// upgrades always use the portable zip (also for MSI installs: files are -/// swapped in place, the MSI keeps its registration). +/// Agent package types: the file the server holds for each platform. An agent +/// the MSI installed upgrades through the MSI (installed in process through the +/// Windows Installer API by the watchdog's detached runner); a portable install +/// upgrades by swapping files (see ). /// public static class AgentPackageTypes { @@ -101,25 +115,44 @@ public static class AgentPackageTypes _ => null, }; - /// Types an upgrade can use (everything but the MSI). - public static readonly IReadOnlyList Upgradable = [WindowsZip, LinuxX64, LinuxArm64, MacX64, MacArm64]; + /// + /// The package a device upgrades from: the MSI for a Windows agent the MSI + /// installed (so Windows Installer, Programs and Features and detection tools + /// see the real version), otherwise the portable package of its runtime. + /// + public static string? ForDevice(string? runtimeIdentifier, string? install) + => install == AgentInstallKinds.Msi && string.Equals(runtimeIdentifier, "win-x64", StringComparison.OrdinalIgnoreCase) + ? Msi + : ForRuntime(runtimeIdentifier); + + /// Types the version catalog holds and upgrades use (the MSI included). + public static readonly IReadOnlyList Upgradable = [Msi, WindowsZip, LinuxX64, LinuxArm64, MacX64, MacArm64]; } /// -/// The one version comparison used everywhere. Versions are -/// yyyy.MM.dd.HHmm (four numeric parts); anything that does not parse -/// (e.g. a development "0.0.0.0" or a custom label) sorts before every real -/// version, then ordinally. +/// The one version comparison used everywhere (server, agent, watchdog, +/// installer custom action, console). Versions are semantic +/// major.minor.patch, with a fourth field on builds between releases +/// (1.4.0.7 = seven commits after 1.4.0); a missing fourth field is 0, +/// and +metadata (the commit) is ignored. The calendar era that came +/// before (yyyy.MM.dd.HHmm, major 2000 or more) sorts before every +/// semantic version. Anything that does not parse, and the development +/// fallback 0.0.0.0, sorts before everything, then ordinally. /// public static class AgentVersions { + /// Majors from this value on are calendar-era versions (2026.10.23.1400). + public const int CalendarEraMajor = 2000; + public static int Compare(string? left, string? right) { var a = Parse(left); var b = Parse(right); if (a is not null && b is not null) { - return a.CompareTo(b); + // Semantic (era 1) after calendar (era 0), then field by field. + var era = Era(a).CompareTo(Era(b)); + return era != 0 ? era : a.CompareTo(b); } if (a is not null) @@ -137,8 +170,33 @@ public static class AgentVersions public static bool IsNewer(string? candidate, string? than) => Compare(candidate, than) > 0; + /// The same version, ignoring a missing fourth field and +metadata (1.4.0 == 1.4.0.0). + public static bool AreSame(string? left, string? right) => Parse(left) is not null && Compare(left, right) == 0; + + /// True for a version this comparison understands (not the 0.0.0.0 fallback). + public static bool IsValid(string? value) => Parse(value) is not null; + + public static bool IsCalendarEra(string? value) => Parse(value) is { } version && Era(version) == 0; + public static IComparer Comparer { get; } = Comparer.Create(Compare); + private static int Era(Version version) => version.Major >= CalendarEraMajor ? 0 : 1; + + /// 3 or 4 numeric fields, +metadata stripped; missing fourth field normalized to 0. private static Version? Parse(string? value) - => Version.TryParse(value, out var version) && version.Major > 0 ? version : null; + { + if (string.IsNullOrWhiteSpace(value) || value.Length > 64) + { + return null; + } + + var core = value.Split('+')[0].Trim(); + if (!Version.TryParse(core, out var version) || core.Split('.').Length < 3) + { + return null; + } + + var normalized = new Version(version.Major, version.Minor, version.Build, Math.Max(version.Revision, 0)); + return normalized == new Version(0, 0, 0, 0) ? null : normalized; + } } diff --git a/src/Shared.Contracts/Models/WatchdogFiles.cs b/src/Shared.Contracts/Models/WatchdogFiles.cs index 07f0248..6f2e7a7 100644 --- a/src/Shared.Contracts/Models/WatchdogFiles.cs +++ b/src/Shared.Contracts/Models/WatchdogFiles.cs @@ -27,6 +27,21 @@ public static class WatchdogFiles public const string PreviousFolder = ".previous"; public const string FailedFolder = ".failed"; + /// MSI upgrades: the runner's journal (), beside handover.json. + public const string MsiJournal = "msi.json"; + /// MSI upgrades: upgrade/msi/ holds the MSIs being installed and the runner's copy of the watchdog binary. + public const string MsiFolder = "msi"; + /// + /// MSIs kept for rollback under <data>/packages/<sha256>/<file>.msi + /// (a data-root folder, not under upgrade/): the MSI an install ran from + /// (copied by the installer's KeepInstallerPackage custom action) and those + /// later upgrades brought; the newest 3 are kept. + /// + public const string KeptPackages = "packages"; + public const int KeptPackagesMax = 3; + /// The longest an MSI install (or the reinstall of the previous one) may run. + public static readonly TimeSpan MsiInstallTimeout = TimeSpan.FromMinutes(30); + public static readonly TimeSpan BeaconInterval = TimeSpan.FromSeconds(5); /// A beacon older than this while the agent should run: the watchdog restarts it (at most once per period). public static readonly TimeSpan BeaconStaleAfter = TimeSpan.FromMinutes(3); @@ -48,7 +63,24 @@ public sealed record WatchdogHandover( IReadOnlyList Files, int HealthDeadlineSeconds, bool Revert, - DateTimeOffset CreatedUtc); + DateTimeOffset CreatedUtc, + string Kind = WatchdogHandoverKinds.Files, + WatchdogFile? Msi = null, + WatchdogFile? RollbackMsi = null, + string? RollbackVersion = null); + +/// +/// How a hand-over is installed: files = the journalled in-place swap; +/// msi = the watchdog starts a detached copy of itself that installs +/// Msi through the Windows Installer API (no msiexec), checks the new +/// version's health and reinstalls RollbackMsi if it is not healthy. +/// For msi, Msi.Path and RollbackMsi.Path are absolute. +/// +public static class WatchdogHandoverKinds +{ + public const string Files = "files"; + public const string Msi = "msi"; +} /// /// The agent's heartbeat to the watchdog. Connected means its command @@ -88,6 +120,34 @@ public sealed record WatchdogJournal( DateTimeOffset? DeadlineUtc, int Attempts); +/// Phases of an MSI upgrade, run by the detached runner. +public static class WatchdogMsiPhases +{ + public const string Installing = "installing"; + public const string Verifying = "verifying"; + public const string RollingBack = "rolling-back"; +} + +/// +/// The MSI runner's journal. RunnerProcessId lets a restarted watchdog +/// tell a live runner from one that died (and resume it); Attempts counts +/// Windows Installer busy (1618) retries. +/// +public sealed record WatchdogMsiJournal( + Guid UpgradeId, + string Version, + string FromVersion, + string Phase, + WatchdogFile Msi, + WatchdogFile? RollbackMsi, + string? RollbackVersion, + int HealthDeadlineSeconds, + int RunnerProcessId, + int Attempts, + int? LastExitCode, + DateTimeOffset StartedUtc, + DateTimeOffset? DeadlineUtc); + /// How a swap ended: Result is succeeded, failed or rolled-back (AgentUpgradeStates). public sealed record WatchdogOutcome( Guid UpgradeId, diff --git a/src/Shared.Contracts/Serialization/WatchdogJsonContext.cs b/src/Shared.Contracts/Serialization/WatchdogJsonContext.cs index db264a3..dbeb2f1 100644 --- a/src/Shared.Contracts/Serialization/WatchdogJsonContext.cs +++ b/src/Shared.Contracts/Serialization/WatchdogJsonContext.cs @@ -19,4 +19,5 @@ namespace Shared.Contracts.Serialization; [JsonSerializable(typeof(WatchdogHealthBeacon))] [JsonSerializable(typeof(WatchdogJournal))] [JsonSerializable(typeof(WatchdogOutcome))] +[JsonSerializable(typeof(WatchdogMsiJournal))] public sealed partial class WatchdogJsonContext : JsonSerializerContext; -- 2.52.0 From 83057a24b39ac31af5e56d9b5928472821a7ef5461230cfee6bd73285ab23a62 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:09:27 -0400 Subject: [PATCH 02/26] feat(upgrades): MSI run files, outcome detail and the agent MSI's UpgradeCode The MSI journal records a console rollback (ALLOWDOWNGRADE from the start) and how many times a dead runner was resumed; the runner's lock, its binary folder and the rollback MSI folder get names. An outcome can carry the sentence the agent reports (exit code, log path, no MSI kept to go back to). Branding holds the agent MSI's UpgradeCode and the file name an agent MSI is kept under. Co-Authored-By: Claude Opus 5.5 --- src/Shared.Contracts/Models/WatchdogFiles.cs | 39 ++++++++++++++++--- .../Constants/Branding.cs | 10 +++++ 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/src/Shared.Contracts/Models/WatchdogFiles.cs b/src/Shared.Contracts/Models/WatchdogFiles.cs index 6f2e7a7..f5c8219 100644 --- a/src/Shared.Contracts/Models/WatchdogFiles.cs +++ b/src/Shared.Contracts/Models/WatchdogFiles.cs @@ -129,9 +129,15 @@ public static class WatchdogMsiPhases } /// -/// The MSI runner's journal. RunnerProcessId lets a restarted watchdog -/// tell a live runner from one that died (and resume it); Attempts counts -/// Windows Installer busy (1618) retries. +/// The MSI runner's journal. RunnerProcessId is the runner that owns the +/// run (it also holds while it lives, which +/// is how a restarted watchdog tells a live runner from one that died and +/// resumes it); Attempts counts Windows Installer busy (1618) retries. +/// StartedUtc is when the current phase's install began (a beacon must be +/// newer), DeadlineUtc the health deadline while verifying. +/// Revert: a rollback from the console, installed with +/// ALLOWDOWNGRADE=1 from the start. Resumes: how many times a dead +/// runner was started again for this run (bounded). /// public sealed record WatchdogMsiJournal( Guid UpgradeId, @@ -146,9 +152,29 @@ public sealed record WatchdogMsiJournal( int Attempts, int? LastExitCode, DateTimeOffset StartedUtc, - DateTimeOffset? DeadlineUtc); + DateTimeOffset? DeadlineUtc, + bool Revert = false, + int Resumes = 0); -/// How a swap ended: Result is succeeded, failed or rolled-back (AgentUpgradeStates). +/// Files of an MSI upgrade beside , private to the watchdog and its runner. +public static class WatchdogMsiFiles +{ + /// Held open (no sharing) by the runner for as long as it runs. + public const string RunnerLock = "msi.lock"; + /// upgrade/msi/runner/: the copy of the watchdog binary the runner runs from (the MSI replaces the installed one). + public const string RunnerFolder = "runner"; + /// upgrade/msi/rollback/: the MSI of the version the device ran, to go back to. + public const string RollbackFolder = "rollback"; + /// Hidden watchdog verb the detached runner is started with: msi-run <upgradeId> --install-dir … --data-dir …. + public const string RunVerb = "msi-run"; +} + +/// +/// How a swap or an MSI run ended: Result is succeeded, failed or +/// rolled-back (AgentUpgradeStates); Detail, when set, is the +/// sentence the agent reports (an MSI run's exit code, log path, or that no MSI +/// was kept to go back to). +/// public sealed record WatchdogOutcome( Guid UpgradeId, string Result, @@ -156,4 +182,5 @@ public sealed record WatchdogOutcome( string Version, string FromVersion, IReadOnlyList LastLog, - DateTimeOffset FinishedUtc); + DateTimeOffset FinishedUtc, + string? Detail = null); diff --git a/src/Shared.Infrastructure/Constants/Branding.cs b/src/Shared.Infrastructure/Constants/Branding.cs index b72216d..21b1afb 100644 --- a/src/Shared.Infrastructure/Constants/Branding.cs +++ b/src/Shared.Infrastructure/Constants/Branding.cs @@ -41,6 +41,16 @@ public static class Branding public const string WatchdogSystemdUnit = "executer-watchdog"; public const string WatchdogLaunchdLabel = "info.executer.watchdog"; + /// + /// The agent MSI's UpgradeCode (src/Installer/Product.wxs): Windows Installer + /// knows an MSI install of the agent by it (MsiEnumRelatedProducts), and the + /// agent checks a downloaded or kept MSI is the agent's before using it. + /// + public const string AgentMsiUpgradeCode = "{7F9C1A52-3F89-4BD4-9E11-2A67C33A5F10}"; + + /// The file name an agent MSI of a version is kept and installed under. + public static string AgentMsiFileName(string version) => $"ExecuteR-Agent-{version.Split('+')[0]}.msi"; + /// The agent binary's file name on the running platform. public static string AgentBinaryName => OperatingSystem.IsWindows() ? AgentExecutableName : AgentUnixExecutableName; -- 2.52.0 From 2ad81cfa2c87913857f7e1e2db6bd4decc606e0927c0c84d9730a7eebdb9ee0e Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:09:28 -0400 Subject: [PATCH 03/26] feat(agent): upgrade an MSI install through its MSI The agent asks Windows Installer (msi.dll, MsiEnumRelatedProductsW on the agent's UpgradeCode, the product's InstallLocation) whether it is an MSI install and reports msi or portable on presence. An MSI install takes the msi package only: downloaded and checked into upgrade/msi/, confirmed to be the agent's MSI of that version (its Property table), with the MSI of the running version set aside in upgrade/msi/rollback/ - a kept one from data/packages/, else the command's rollback package, downloaded, checked and kept - or noted as no automatic rollback. Every MSI an upgrade brings is kept under data/packages// (newest three). The hand-over has kind msi; a pending msi.json makes the agent busy. Co-Authored-By: Claude Opus 5.5 --- src/Agent/Progress/PresencePublisher.cs | 4 +- src/Agent/Service/AgentSession.cs | 1 + src/Agent/Upgrade/AgentUpgradeHandler.cs | 229 ++++++++++++++++--- src/Agent/Upgrade/KeptMsiPackages.cs | 160 ++++++++++++++ src/Agent/Upgrade/MsiInspector.cs | 233 ++++++++++++++++++++ src/Agent/Upgrade/UpgradeFolders.cs | 39 +++- src/Agent/Upgrade/UpgradeOutcomeReporter.cs | 6 +- 7 files changed, 640 insertions(+), 32 deletions(-) create mode 100644 src/Agent/Upgrade/KeptMsiPackages.cs create mode 100644 src/Agent/Upgrade/MsiInspector.cs diff --git a/src/Agent/Progress/PresencePublisher.cs b/src/Agent/Progress/PresencePublisher.cs index 45688c1..4e3ac6a 100644 --- a/src/Agent/Progress/PresencePublisher.cs +++ b/src/Agent/Progress/PresencePublisher.cs @@ -33,7 +33,9 @@ public sealed class PresencePublisher( UptimeSeconds: Environment.TickCount64 / 1000, ActiveJobs: activeJobCounter(), // The build's RID ("win-x64"): the server picks the upgrade package by it. - Runtime: RuntimeInformation.RuntimeIdentifier); + Runtime: RuntimeInformation.RuntimeIdentifier, + // msi or portable: an MSI install upgrades through its MSI. + Install: Upgrade.AgentInstall.Current); await publisher.PublishAsync(subject, MessageTypes.AgentPresence, payload, cancellationToken: cancellationToken); } diff --git a/src/Agent/Service/AgentSession.cs b/src/Agent/Service/AgentSession.cs index a476237..957f4dc 100644 --- a/src/Agent/Service/AgentSession.cs +++ b/src/Agent/Service/AgentSession.cs @@ -87,6 +87,7 @@ public sealed class AgentSession : IAgentSession Folders = folders, ClientId = credentials.ClientId, CanSelfUpgrade = runtime.CanSelfUpgrade, + InstallKind = AgentInstall.Current, ServerUrl = configuration.ServerUrl, TlsSkipVerify = configuration.TlsSkipVerify.Value, }, diff --git a/src/Agent/Upgrade/AgentUpgradeHandler.cs b/src/Agent/Upgrade/AgentUpgradeHandler.cs index 4d00b0d..e0762ef 100644 --- a/src/Agent/Upgrade/AgentUpgradeHandler.cs +++ b/src/Agent/Upgrade/AgentUpgradeHandler.cs @@ -46,6 +46,13 @@ public sealed class AgentUpgradeContext public string CurrentVersion { get; init; } = BuildVersion.Resolve(typeof(AgentUpgradeContext).Assembly); public string? RuntimeIdentifier { get; init; } = RuntimeInformation.RuntimeIdentifier; public bool CanSelfUpgrade { get; init; } + + /// How this agent was installed (): an MSI install upgrades through its MSI. + public string InstallKind { get; init; } = AgentInstallKinds.Portable; + + /// Reads an MSI's agent version and UpgradeCode (Windows Installer, read only). + public IMsiInspector MsiInspector { get; init; } = WindowsMsiInspector.Instance; + public ServerUrl? ServerUrl { get; init; } public bool TlsSkipVerify { get; init; } @@ -73,7 +80,10 @@ public sealed class AgentUpgradeContext /// and otherwise waits its start jitter, downloads the package (size and SHA-256 /// checked), unpacks it into the staging folder, makes sure the watchdog runs, /// and hands the package over to it. The swap's outcome is reported by whichever -/// version runs afterwards (). +/// version runs afterwards (). An agent the +/// MSI installed takes the MSI instead (package type msi), which the +/// watchdog's detached runner installs through the Windows Installer API, so +/// Windows Installer and Programs and Features carry the real version. /// public sealed class AgentUpgradeHandler(AgentUpgradeContext context, IUpgradeEvents events, IWatchdogInstaller watchdog, ILogger logger) { @@ -129,13 +139,17 @@ public sealed class AgentUpgradeHandler(AgentUpgradeContext context, IUpgradeEve return; } - var expected = AgentPackageTypes.ForRuntime(context.RuntimeIdentifier); + var expected = AgentPackageTypes.ForDevice(context.RuntimeIdentifier, context.InstallKind); if (expected is null || !string.Equals(expected, command.PackageType, StringComparison.OrdinalIgnoreCase)) { await FailAsync(command, AgentUpgradeReasons.Unsupported, expected is null ? $"No upgrade package is built for this platform ({context.RuntimeIdentifier})." - : $"This agent ({context.RuntimeIdentifier}) upgrades from the {expected} package, not {command.PackageType}.", + : string.Equals(command.PackageType, AgentPackageTypes.Msi, StringComparison.OrdinalIgnoreCase) + ? $"This agent was not installed by the MSI; it upgrades from the {expected} package." + : expected == AgentPackageTypes.Msi + ? $"This agent was installed by the MSI; it upgrades through the MSI, not the {command.PackageType} package." + : $"This agent ({context.RuntimeIdentifier}) upgrades from the {expected} package, not {command.PackageType}.", cancellationToken); return; } @@ -181,6 +195,12 @@ public sealed class AgentUpgradeHandler(AgentUpgradeContext context, IUpgradeEve return; } + if (string.Equals(command.PackageType, AgentPackageTypes.Msi, StringComparison.OrdinalIgnoreCase)) + { + await UpgradeByMsiAsync(command, url, cancellationToken); + return; + } + var package = await DownloadAsync(command, url, cancellationToken); if (package is null) { @@ -226,24 +246,55 @@ public sealed class AgentUpgradeHandler(AgentUpgradeContext context, IUpgradeEve /// The verified package in the downloads folder (reused when already there), or null after a failure was reported. private async Task DownloadAsync(AgentUpgradeCommandPayload command, Uri url, CancellationToken cancellationToken) { - var sha = command.Sha256.Trim().ToLowerInvariant(); - if (sha.Length != 64 || !sha.All(Uri.IsHexDigit)) + if (NormalizeSha(command.Sha256) is not { } sha) { await FailAsync(command, AgentUpgradeReasons.Hash, "The command carries no valid SHA-256.", cancellationToken); return null; } - Directory.CreateDirectory(Folders.Downloads); var path = Path.Combine(Folders.Downloads, sha + ".zip"); - if (File.Exists(path) && new FileInfo(path).Length == command.SizeBytes && await HashAsync(path, cancellationToken) == sha) + if (await FetchAsync(command, url, sha, command.SizeBytes, path, report: true, cancellationToken) is { } problem) { - logger.LogInformation("Upgrade {UpgradeId}: package already downloaded", command.UpgradeId); - File.SetLastWriteTimeUtc(path, DateTime.UtcNow); - await PublishAsync(command, AgentUpgradeStates.Downloading, null, "Package already downloaded.", cancellationToken); - return path; + await FailAsync(command, problem.Reason, problem.Detail, cancellationToken); + return null; + } + + return path; + } + + private static string? NormalizeSha(string? value) + { + var sha = value?.Trim().ToLowerInvariant(); + return sha is { Length: 64 } && sha.All(Uri.IsHexDigit) ? sha : null; + } + + /// + /// Downloads to (reused when + /// already there) and checks size and SHA-256; null when it is there and + /// matches, otherwise the reason and detail. : the + /// upgrade's own package, whose progress is published. + /// + private async Task<(string Reason, string Detail)?> FetchAsync( + AgentUpgradeCommandPayload command, Uri url, string sha, long sizeBytes, string path, bool report, CancellationToken cancellationToken) + { + Directory.CreateDirectory(Path.GetDirectoryName(path)!); + if (File.Exists(path) && new FileInfo(path).Length == sizeBytes && await HashAsync(path, cancellationToken) == sha) + { + logger.LogInformation("Upgrade {UpgradeId}: {File} already downloaded", command.UpgradeId, Path.GetFileName(path)); + File.SetLastWriteTimeUtc(path, DateTime.UtcNow); + if (report) + { + await PublishAsync(command, AgentUpgradeStates.Downloading, null, "Package already downloaded.", cancellationToken); + } + + return null; + } + + if (report) + { + await PublishAsync(command, AgentUpgradeStates.Downloading, null, $"Downloading 0% of {Megabytes(sizeBytes)}.", cancellationToken); } - await PublishAsync(command, AgentUpgradeStates.Downloading, null, $"Downloading 0% of {Megabytes(command.SizeBytes)}.", cancellationToken); var partial = path + ".partial"; try { @@ -261,17 +312,17 @@ public sealed class AgentUpgradeHandler(AgentUpgradeContext context, IUpgradeEve { await target.WriteAsync(buffer.AsMemory(0, read), cancellationToken); done += read; - if (done > command.SizeBytes) + if (done > sizeBytes) { break; } - var percent = command.SizeBytes > 0 ? (int)(done * 100 / command.SizeBytes) : 0; - if (percent >= reported + 10 && percent < 100) + var percent = sizeBytes > 0 ? (int)(done * 100 / sizeBytes) : 0; + if (report && percent >= reported + 10 && percent < 100) { reported = percent / 10 * 10; await PublishAsync(command, AgentUpgradeStates.Downloading, null, - $"Downloading {reported}% of {Megabytes(command.SizeBytes)}.", cancellationToken); + $"Downloading {reported}% of {Megabytes(sizeBytes)}.", cancellationToken); } } } @@ -280,23 +331,150 @@ public sealed class AgentUpgradeHandler(AgentUpgradeContext context, IUpgradeEve || (exception is TaskCanceledException && !cancellationToken.IsCancellationRequested)) { TryDelete(partial); - await FailAsync(command, AgentUpgradeReasons.Download, $"The package could not be downloaded ({exception.Message}).", cancellationToken); - return null; + return (AgentUpgradeReasons.Download, $"The package could not be downloaded ({exception.Message})."); } var size = new FileInfo(partial).Length; var actual = await HashAsync(partial, cancellationToken); - if (size != command.SizeBytes || actual != sha) + if (size != sizeBytes || actual != sha) { TryDelete(partial); - await FailAsync(command, AgentUpgradeReasons.Hash, - $"The package does not match: {size} bytes with SHA-256 {actual}, expected {command.SizeBytes} bytes with {sha}.", cancellationToken); - return null; + return (AgentUpgradeReasons.Hash, + $"The package does not match: {size} bytes with SHA-256 {actual}, expected {sizeBytes} bytes with {sha}."); } File.Move(partial, path, overwrite: true); - logger.LogInformation("Upgrade {UpgradeId}: package downloaded and verified", command.UpgradeId); - return path; + logger.LogInformation("Upgrade {UpgradeId}: {File} downloaded and verified", command.UpgradeId, Path.GetFileName(path)); + return null; + } + + /// + /// An agent the MSI installed upgrades through its MSI: downloaded and + /// checked into upgrade/msi/, and it is the agent's MSI of the version + /// asked for. The MSI of the version running now goes beside it + /// (upgrade/msi/rollback/) for a rollback: a kept one, else the one the + /// command names (downloaded, checked and kept); without either the upgrade + /// still goes on, but a new version that is not healthy stays. Both are kept + /// under <data>/packages/. The watchdog's detached runner installs + /// it through the Windows Installer API. + /// + private async Task UpgradeByMsiAsync(AgentUpgradeCommandPayload command, Uri url, CancellationToken cancellationToken) + { + if (NormalizeSha(command.Sha256) is not { } sha) + { + await FailAsync(command, AgentUpgradeReasons.Hash, "The command carries no valid SHA-256.", cancellationToken); + return; + } + + var msi = Path.Combine(Folders.Msi, Branding.AgentMsiFileName(command.Version)); + if (await FetchAsync(command, url, sha, command.SizeBytes, msi, report: true, cancellationToken) is { } problem) + { + await FailAsync(command, problem.Reason, problem.Detail, cancellationToken); + return; + } + + var carried = context.MsiInspector.ReadAgentVersion(msi); + if (carried is null || !AgentVersions.AreSame(carried, command.Version)) + { + TryDelete(msi); + await FailAsync(command, AgentUpgradeReasons.Package, carried is null + ? "The package is not the agent's MSI." + : $"The MSI is of version {carried}, not {command.Version}.", cancellationToken); + return; + } + + var kept = new KeptMsiPackages(Folders.KeptPackages, context.MsiInspector, logger); + var rollback = await RollbackMsiAsync(command, kept, cancellationToken); + TryKeep(kept, msi, sha, command.Version, rollback?.Version); + + if (await watchdog.EnsureRunningAsync(Folders.Msi, cancellationToken) is { } watchdogProblem) + { + await FailAsync(command, AgentUpgradeReasons.Watchdog, watchdogProblem, cancellationToken); + return; + } + + var handover = new WatchdogHandover(command.UpgradeId, command.Version, context.CurrentVersion, Folders.Msi, [], + command.HealthDeadlineSeconds, command.Revert, context.UtcNow(), + Kind: WatchdogHandoverKinds.Msi, + Msi: new WatchdogFile(msi, new FileInfo(msi).Length, sha), + RollbackMsi: rollback?.File, + RollbackVersion: rollback?.Version); + WatchdogFileStore.Write(Folders.Handover, handover, WatchdogJsonContext.Default.WatchdogHandover); + logger.LogInformation("Upgrade {UpgradeId} handed to the watchdog to install {Msi} through Windows Installer (rollback MSI: {Rollback})", + command.UpgradeId, msi, rollback?.File.Path ?? "none"); + await PublishAsync(command, AgentUpgradeStates.Installing, null, rollback is null + ? $"Handed to the watchdog to install through Windows Installer. No MSI of {context.CurrentVersion} is kept, so an unhealthy {command.Version} cannot be rolled back automatically." + : "Handed to the watchdog to install through Windows Installer.", cancellationToken); + + await WaitForPickupAsync(command, cancellationToken); + } + + /// The MSI of the running version in upgrade/msi/rollback/, or null when there is none to be had. + private async Task<(WatchdogFile File, string Version)?> RollbackMsiAsync( + AgentUpgradeCommandPayload command, KeptMsiPackages kept, CancellationToken cancellationToken) + { + var current = context.CurrentVersion; + var target = Path.Combine(Folders.MsiRollback, Branding.AgentMsiFileName(current)); + try + { + if (kept.Find(current) is { } own) + { + Directory.CreateDirectory(Folders.MsiRollback); + File.Copy(own.Path, target, overwrite: true); + File.SetLastWriteTimeUtc(target, DateTime.UtcNow); + if (await HashAsync(target, cancellationToken) == own.Sha256) + { + logger.LogInformation("Upgrade {UpgradeId}: the kept MSI of {Version} is the rollback", command.UpgradeId, current); + return (new WatchdogFile(target, own.Size, own.Sha256), current); + } + + TryDelete(target); + } + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + logger.LogWarning(exception, "Upgrade {UpgradeId}: the kept MSI of {Version} could not be set aside", command.UpgradeId, current); + } + + if (!AgentVersions.AreSame(command.RollbackVersion, current) + || NormalizeSha(command.RollbackSha256) is not { } sha + || command.RollbackSizeBytes is not { } size + || ResolveDownloadUrl(command.RollbackDownloadUrl ?? "", context.ServerUrl) is not { } url) + { + logger.LogWarning("Upgrade {UpgradeId}: no MSI of {Version} is kept and the server offers none; no automatic rollback", + command.UpgradeId, current); + return null; + } + + if (await FetchAsync(command, url, sha, size, target, report: false, cancellationToken) is { } problem) + { + logger.LogWarning("Upgrade {UpgradeId}: the MSI of {Version} to roll back to could not be had ({Detail}); no automatic rollback", + command.UpgradeId, current, problem.Detail); + return null; + } + + if (!AgentVersions.AreSame(context.MsiInspector.ReadAgentVersion(target), current)) + { + TryDelete(target); + logger.LogWarning("Upgrade {UpgradeId}: the server's MSI of {Version} is not that version's agent MSI; no automatic rollback", + command.UpgradeId, current); + return null; + } + + TryKeep(kept, target, sha, current); + return (new WatchdogFile(target, size, sha), current); + } + + private void TryKeep(KeptMsiPackages kept, string msi, string sha, string version, params string?[] protectedVersions) + { + try + { + kept.Keep(msi, sha, version, [context.CurrentVersion, .. protectedVersions.OfType()]); + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + logger.LogWarning(exception, "The MSI of {Version} could not be kept; the upgrade goes on", version); + } } private HttpMessageHandler CreateHandler() @@ -350,7 +528,8 @@ public sealed class AgentUpgradeHandler(AgentUpgradeContext context, IUpgradeEve { if (context.UtcNow() >= deadline) { - if (WatchdogFileStore.Read(Folders.Journal, WatchdogJsonContext.Default.WatchdogJournal)?.UpgradeId == command.UpgradeId) + if (WatchdogFileStore.Read(Folders.Journal, WatchdogJsonContext.Default.WatchdogJournal)?.UpgradeId == command.UpgradeId + || WatchdogFileStore.Read(Folders.MsiJournal, WatchdogJsonContext.Default.WatchdogMsiJournal)?.UpgradeId == command.UpgradeId) { return; } diff --git a/src/Agent/Upgrade/KeptMsiPackages.cs b/src/Agent/Upgrade/KeptMsiPackages.cs new file mode 100644 index 0000000..2d8b7e6 --- /dev/null +++ b/src/Agent/Upgrade/KeptMsiPackages.cs @@ -0,0 +1,160 @@ +using System.Security.Cryptography; +using System.Text.Json; +using Microsoft.Extensions.Logging; +using Shared.Contracts.Models; +using Shared.Contracts.Serialization; + +namespace Agent.Upgrade; + +/// One agent MSI kept for rollback. +public sealed record KeptMsi(string Path, string Sha256, long Size, string Version); + +/// +/// The agent MSIs kept under <data>/packages/<sha256>/<file>.msi +/// (): the one the device was installed +/// from (the installer's KeepInstallerPackage custom action copies it there) and +/// those later upgrades brought (kept here). The newest +/// stay. A package's version is read +/// from the MSI itself (its UNIFIEDVERSION property) unless a package.json +/// this class wrote beside it says; a file whose SHA-256 is not its folder's name +/// is never used. +/// +public sealed class KeptMsiPackages(string root, IMsiInspector inspector, ILogger logger) +{ + public const string DescriptionFile = "package.json"; + + public string Root { get; } = root; + + /// The kept MSI of whose bytes still match its hash, or null. + public KeptMsi? Find(string version) + { + foreach (var folder in Folders()) + { + foreach (var file in folder.EnumerateFiles("*.msi")) + { + var kept = Version(folder, file); + if (!AgentVersions.AreSame(kept, version)) + { + continue; + } + + try + { + var sha = Sha256(file.FullName); + if (string.Equals(sha, folder.Name, StringComparison.OrdinalIgnoreCase)) + { + return new KeptMsi(file.FullName, sha, file.Length, kept!); + } + + logger.LogWarning("Kept MSI {Path} does not match its SHA-256; it is not used", file.FullName); + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + logger.LogWarning(exception, "Kept MSI {Path} could not be read", file.FullName); + } + } + } + + return null; + } + + /// + /// Keeps a verified MSI (a copy, unless it is already kept), then removes + /// the oldest beyond the newest , + /// never one of . + /// + public void Keep(string source, string sha256, string version, params string[] protectedVersions) + { + var sha = sha256.ToLowerInvariant(); + var folder = Path.Combine(Root, sha); + var target = Path.Combine(folder, Shared.Infrastructure.Constants.Branding.AgentMsiFileName(version)); + Directory.CreateDirectory(folder); + if (!File.Exists(target) || new FileInfo(target).Length != new FileInfo(source).Length) + { + var partial = target + ".partial"; + File.Copy(source, partial, overwrite: true); + File.Move(partial, target, overwrite: true); + } + + File.WriteAllText(Path.Combine(folder, DescriptionFile), + JsonDefaults.Serialize(new Description(version, sha, new FileInfo(target).Length, Path.GetFileName(target)))); + Directory.SetLastWriteTimeUtc(folder, DateTime.UtcNow); + logger.LogInformation("Agent MSI {Version} kept at {Path}", version, target); + Prune([version, .. protectedVersions]); + } + + private void Prune(IReadOnlyCollection protectedVersions) + { + foreach (var folder in Folders().Skip(WatchdogFiles.KeptPackagesMax)) + { + var versions = folder.EnumerateFiles("*.msi").Select(f => Version(folder, f)).ToList(); + if (versions.Any(v => protectedVersions.Any(p => AgentVersions.AreSame(v, p)))) + { + continue; + } + + try + { + folder.Delete(recursive: true); + logger.LogInformation("Kept MSI folder {Folder} removed (more than {Max} kept)", folder.FullName, WatchdogFiles.KeptPackagesMax); + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + // In use; the next upgrade tries again. + } + } + } + + /// Package folders (named by a SHA-256), newest first. + private List Folders() + { + if (!Directory.Exists(Root)) + { + return []; + } + + return new DirectoryInfo(Root).GetDirectories() + .Where(d => d.Name.Length == 64 && d.Name.All(Uri.IsHexDigit)) + .OrderByDescending(Newest) + .ToList(); + } + + private static DateTime Newest(DirectoryInfo folder) + { + var newest = folder.LastWriteTimeUtc; + foreach (var file in folder.GetFiles("*.msi")) + { + newest = file.LastWriteTimeUtc > newest ? file.LastWriteTimeUtc : newest; + } + + return newest; + } + + private string? Version(DirectoryInfo folder, FileInfo file) + { + var description = Path.Combine(folder.FullName, DescriptionFile); + try + { + if (File.Exists(description) + && JsonDefaults.Deserialize(File.ReadAllText(description)) is { } d + && string.Equals(d.FileName, file.Name, StringComparison.OrdinalIgnoreCase) + && AgentVersions.IsValid(d.Version)) + { + return d.Version; + } + } + catch (Exception exception) when (exception is IOException or JsonException or UnauthorizedAccessException) + { + } + + return inspector.ReadAgentVersion(file.FullName); + } + + private static string Sha256(string path) + { + using var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); + return Convert.ToHexStringLower(SHA256.HashData(stream)); + } + + private sealed record Description(string Version, string Sha256, long Size, string FileName); +} diff --git a/src/Agent/Upgrade/MsiInspector.cs b/src/Agent/Upgrade/MsiInspector.cs new file mode 100644 index 0000000..f1f160d --- /dev/null +++ b/src/Agent/Upgrade/MsiInspector.cs @@ -0,0 +1,233 @@ +using System.Runtime.InteropServices; +using Shared.Contracts.Models; +using Shared.Infrastructure.Constants; + +namespace Agent.Upgrade; + +/// What the agent asks Windows Installer (read only); replaced in tests. +public interface IMsiInspector +{ + /// + /// msi when Windows Installer holds the agent product (its UpgradeCode) + /// installed in ; otherwise portable + /// (no product, another folder, linux/macOS, or no Windows Installer as in WinPE). + /// + string DetectInstall(string installDirectory); + + /// + /// The agent version an MSI file carries (its UNIFIEDVERSION property, else + /// ProductVersion); null when the file is not the agent's MSI (another + /// UpgradeCode) or does not open as one. + /// + string? ReadAgentVersion(string msiPath); +} + +/// +/// Windows Installer through msi.dll (what msiexec itself calls), read only: +/// related products of the agent's UpgradeCode, and an MSI file's Property +/// table. Never msiexec, never PowerShell. +/// +public sealed partial class WindowsMsiInspector : IMsiInspector +{ + public static WindowsMsiInspector Instance { get; } = new(); + + private const uint ErrorSuccess = 0; + private const uint ErrorMoreData = 234; + private const uint ErrorNoMoreItems = 259; + + /// MSIDBOPEN_READONLY: the persist argument is the integer 0, not a string. + private const nint MsiDbOpenReadOnly = 0; + + public string DetectInstall(string installDirectory) + { + if (!OperatingSystem.IsWindows()) + { + return AgentInstallKinds.Portable; + } + + try + { + var product = RelatedProduct(Branding.AgentMsiUpgradeCode); + if (product is null) + { + return AgentInstallKinds.Portable; + } + + // A portable copy run from elsewhere on a machine that also has the + // MSI install is not the MSI's agent. + var location = ProductInfo(product, "InstallLocation"); + return string.IsNullOrWhiteSpace(location) || SameFolder(location, installDirectory) + ? AgentInstallKinds.Msi + : AgentInstallKinds.Portable; + } + catch (Exception exception) when (exception is DllNotFoundException or EntryPointNotFoundException) + { + // No Windows Installer (WinPE): only the portable package runs there. + return AgentInstallKinds.Portable; + } + } + + public string? ReadAgentVersion(string msiPath) + { + if (!OperatingSystem.IsWindows() || !File.Exists(msiPath)) + { + return null; + } + + try + { + var properties = ReadProperties(msiPath, "UpgradeCode", "UNIFIEDVERSION", "ProductVersion"); + if (properties is null + || !properties.TryGetValue("UpgradeCode", out var upgradeCode) + || !string.Equals(upgradeCode, Branding.AgentMsiUpgradeCode, StringComparison.OrdinalIgnoreCase)) + { + return null; + } + + return properties.TryGetValue("UNIFIEDVERSION", out var unified) && !string.IsNullOrWhiteSpace(unified) + ? unified.Trim() + : properties.GetValueOrDefault("ProductVersion")?.Trim(); + } + catch (Exception exception) when (exception is DllNotFoundException or EntryPointNotFoundException) + { + return null; + } + } + + internal static bool SameFolder(string left, string right) + => string.Equals( + Path.TrimEndingDirectorySeparator(Path.GetFullPath(left)), + Path.TrimEndingDirectorySeparator(Path.GetFullPath(right)), + StringComparison.OrdinalIgnoreCase); + + private static unsafe string? RelatedProduct(string upgradeCode) + { + var buffer = stackalloc char[39]; + return MsiEnumRelatedProductsW(upgradeCode, 0, 0, buffer) == ErrorSuccess ? new string(buffer, 0, 38) : null; + } + + private static unsafe string? ProductInfo(string productCode, string property) + { + uint length = 512; + var buffer = new char[length]; + fixed (char* pointer = buffer) + { + var result = MsiGetProductInfoW(productCode, property, pointer, ref length); + if (result == ErrorMoreData) + { + return null; + } + + return result == ErrorSuccess ? new string(pointer, 0, (int)length) : null; + } + } + + /// The named rows of the package's Property table; null when it does not open. + private static Dictionary? ReadProperties(string msiPath, params string[] names) + { + if (MsiOpenDatabaseW(msiPath, MsiDbOpenReadOnly, out var database) != ErrorSuccess) + { + return null; + } + + try + { + if (MsiDatabaseOpenViewW(database, "SELECT `Property`, `Value` FROM `Property`", out var view) != ErrorSuccess) + { + return null; + } + + try + { + if (MsiViewExecute(view, 0) != ErrorSuccess) + { + return null; + } + + var wanted = new HashSet(names, StringComparer.Ordinal); + var found = new Dictionary(StringComparer.Ordinal); + while (MsiViewFetch(view, out var record) is var fetched && fetched != ErrorNoMoreItems) + { + if (fetched != ErrorSuccess) + { + break; + } + + try + { + if (RecordString(record, 1) is { } name && wanted.Contains(name) && RecordString(record, 2) is { } value) + { + found[name] = value; + } + } + finally + { + MsiCloseHandle(record); + } + } + + return found; + } + finally + { + MsiCloseHandle(view); + } + } + finally + { + MsiCloseHandle(database); + } + } + + private static unsafe string? RecordString(nint record, uint field) + { + uint length = 0; + char empty = '\0'; + var result = MsiRecordGetStringW(record, field, &empty, ref length); + if (result != ErrorMoreData && result != ErrorSuccess) + { + return null; + } + + length++; + var buffer = new char[length]; + fixed (char* pointer = buffer) + { + return MsiRecordGetStringW(record, field, pointer, ref length) == ErrorSuccess ? new string(pointer, 0, (int)length) : null; + } + } + + [LibraryImport("msi.dll", StringMarshalling = StringMarshalling.Utf16)] + private static unsafe partial uint MsiEnumRelatedProductsW(string upgradeCode, uint reserved, uint index, char* productCode); + + [LibraryImport("msi.dll", StringMarshalling = StringMarshalling.Utf16)] + private static unsafe partial uint MsiGetProductInfoW(string product, string property, char* value, ref uint length); + + [LibraryImport("msi.dll", StringMarshalling = StringMarshalling.Utf16)] + private static partial uint MsiOpenDatabaseW(string databasePath, nint persist, out nint database); + + [LibraryImport("msi.dll", StringMarshalling = StringMarshalling.Utf16)] + private static partial uint MsiDatabaseOpenViewW(nint database, string query, out nint view); + + [LibraryImport("msi.dll")] + private static partial uint MsiViewExecute(nint view, nint record); + + [LibraryImport("msi.dll")] + private static partial uint MsiViewFetch(nint view, out nint record); + + [LibraryImport("msi.dll")] + private static unsafe partial uint MsiRecordGetStringW(nint record, uint field, char* value, ref uint length); + + [LibraryImport("msi.dll")] + private static partial uint MsiCloseHandle(nint handle); +} + +/// How the running agent was installed, asked once (presence reports it; upgrades choose the package by it). +public static class AgentInstall +{ + private static readonly Lazy Detected = new(() => + WindowsMsiInspector.Instance.DetectInstall(AppContext.BaseDirectory)); + + /// msi or portable (). + public static string Current => Detected.Value; +} diff --git a/src/Agent/Upgrade/UpgradeFolders.cs b/src/Agent/Upgrade/UpgradeFolders.cs index 5d1f937..2cb01e9 100644 --- a/src/Agent/Upgrade/UpgradeFolders.cs +++ b/src/Agent/Upgrade/UpgradeFolders.cs @@ -13,6 +13,16 @@ public sealed class UpgradeFolders(string dataDirectory, string installDirectory public string Root { get; } = Path.Combine(dataDirectory, WatchdogFiles.Folder); + /// <data>/packages: the agent MSIs kept for rollback (). + public string KeptPackages { get; } = Path.Combine(dataDirectory, WatchdogFiles.KeptPackages); + + /// upgrade/msi/: the MSI an upgrade installs, the one it rolls back to (rollback/) and the runner's binary. + public string Msi => Path.Combine(Root, WatchdogFiles.MsiFolder); + + public string MsiRollback => Path.Combine(Msi, WatchdogMsiFiles.RollbackFolder); + + public string MsiJournal => Path.Combine(Root, WatchdogFiles.MsiJournal); + public string Downloads => Path.Combine(Root, WatchdogFiles.Downloads); public string Staging => Path.Combine(Root, WatchdogFiles.Staging); @@ -25,20 +35,41 @@ public sealed class UpgradeFolders(string dataDirectory, string installDirectory public string Outcome => Path.Combine(Root, WatchdogFiles.Outcome); - /// A hand-over, a swap or an outcome not yet reported: another upgrade must wait. - public bool UpgradePending => File.Exists(Handover) || File.Exists(Journal) || File.Exists(Outcome); + /// A hand-over, a swap, an MSI run or an outcome not yet reported: another upgrade must wait. + public bool UpgradePending => File.Exists(Handover) || File.Exists(Journal) || File.Exists(MsiJournal) || File.Exists(Outcome); /// /// Keeps the newest download and the newest staged package, removes the rest. - /// Never while a hand-over or a swap is under way (the watchdog reads the staging then). + /// Never while a hand-over, a swap or an MSI run is under way (the watchdog reads the staging then). + /// The MSI folder goes whole: what a later MSI upgrade needs is in . /// public void Tidy() { - if (File.Exists(Handover) || File.Exists(Journal)) + if (File.Exists(Handover) || File.Exists(Journal) || File.Exists(MsiJournal)) { return; } + if (Directory.Exists(Msi)) + { + // Not what an upgrade is downloading right now (written in the last hour). + var before = DateTime.UtcNow - TimeSpan.FromHours(1); + foreach (var entry in new DirectoryInfo(Msi).GetFileSystemInfos().Where(e => e.LastWriteTimeUtc < before)) + { + TryDelete(() => + { + if (entry is DirectoryInfo folder) + { + folder.Delete(recursive: true); + } + else + { + entry.Delete(); + } + }); + } + } + if (Directory.Exists(Downloads)) { foreach (var file in new DirectoryInfo(Downloads).GetFiles().OrderByDescending(f => f.LastWriteTimeUtc).Skip(1)) diff --git a/src/Agent/Upgrade/UpgradeOutcomeReporter.cs b/src/Agent/Upgrade/UpgradeOutcomeReporter.cs index c07ac7b..08be26b 100644 --- a/src/Agent/Upgrade/UpgradeOutcomeReporter.cs +++ b/src/Agent/Upgrade/UpgradeOutcomeReporter.cs @@ -63,7 +63,7 @@ public sealed class UpgradeOutcomeReporter( reported = true; tidied = false; } - else if (File.Exists(folders.Outcome) && !File.Exists(folders.Journal)) + else if (File.Exists(folders.Outcome) && !File.Exists(folders.Journal) && !File.Exists(folders.MsiJournal)) { // Unreadable, and no run that could still rewrite it: drop it. logger.LogWarning("Upgrade outcome at {Path} does not read; it is removed", folders.Outcome); @@ -81,7 +81,7 @@ public sealed class UpgradeOutcomeReporter( public static AgentUpgradeEventPayload ToEvent(WatchdogOutcome outcome, string clientId) { - var detail = outcome.Result switch + var detail = !string.IsNullOrWhiteSpace(outcome.Detail) ? outcome.Detail : outcome.Result switch { AgentUpgradeStates.Succeeded => $"Upgraded from {outcome.FromVersion} to {outcome.Version}.", AgentUpgradeStates.RolledBack => outcome.Reason switch @@ -96,6 +96,8 @@ public sealed class UpgradeOutcomeReporter( AgentUpgradeReasons.Hash => "The staged package did not match its SHA-256; nothing was changed.", AgentUpgradeReasons.Package => "The staged package was not usable; nothing was changed.", AgentUpgradeReasons.Swap => "The previous version could not be put back whole.", + AgentUpgradeReasons.Msi => $"Windows Installer did not install {outcome.Version}; {outcome.FromVersion} stays.", + AgentUpgradeReasons.InstallerBusy => $"Another installation kept Windows Installer busy; {outcome.FromVersion} stays.", _ => "The watchdog could not apply the package; nothing was changed.", }, }; -- 2.52.0 From a17c98c8d4bcd40a07526728fe8516320521aeaf4363fea69a8364b8be362f3b Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:19:59 -0400 Subject: [PATCH 04/26] feat(watchdog): install an MSI hand-over through Windows Installer in a detached runner An msi hand-over is never swapped. The watchdog checks the MSIs the agent left in upgrade/msi/ (size, SHA-256), journals the run in msi.json, copies its own binary to upgrade/msi/runner/ and starts it detached (CreateProcessW, DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP | CREATE_BREAKAWAY_FROM_JOB, without the breakaway when the job refuses it, | CREATE_NO_WINDOW) with the hidden verb msi-run, since the MSI stops both services. The runner holds msi.lock while it lives and calls msi.dll in process: MsiSetInternalUI(NONE), MsiEnableLogW(0x1FDF, /l*v) into /agent-msi--.log, MsiInstallProductW with REBOOT=ReallySuppress (ALLOWDOWNGRADE=1 for a console rollback). 0, 3010 and 1641 install; 1618 is retried every 30 s for 10 minutes, then installer-busy; any other code, or 30 minutes without an answer, is failed/msi with the code, the log path and its tail. It then waits for a connected beacon of the new version written since the install began; one not healthy by the deadline is taken back by the previous version's MSI with ALLOWDOWNGRADE=1 (its own log) and ends rolled-back with the new agent's log tail, or, with no MSI kept, ends failed/health-deadline saying so. Both services are left running, the outcome written, msi.json removed. A watchdog that finds msi.json leaves a live runner alone (its lock is held), resumes a dead one from the journal (verifying when it died installing a version that is already healthy), at most three times, and never supervises or starts the agent while the run is pending. Co-Authored-By: Claude Opus 5.5 --- src/Agent.Watchdog/Msi/MsiRunner.cs | 427 ++++++++++++++++++++ src/Agent.Watchdog/Msi/MsiRunnerLauncher.cs | 200 +++++++++ src/Agent.Watchdog/Msi/MsiUpgrade.cs | 312 ++++++++++++++ src/Agent.Watchdog/Msi/WindowsInstaller.cs | 100 +++++ src/Agent.Watchdog/UpgradeApplier.cs | 98 ++++- src/Agent.Watchdog/WatchdogCli.cs | 29 +- src/Agent.Watchdog/WatchdogOptions.cs | 14 + 7 files changed, 1167 insertions(+), 13 deletions(-) create mode 100644 src/Agent.Watchdog/Msi/MsiRunner.cs create mode 100644 src/Agent.Watchdog/Msi/MsiRunnerLauncher.cs create mode 100644 src/Agent.Watchdog/Msi/MsiUpgrade.cs create mode 100644 src/Agent.Watchdog/Msi/WindowsInstaller.cs diff --git a/src/Agent.Watchdog/Msi/MsiRunner.cs b/src/Agent.Watchdog/Msi/MsiRunner.cs new file mode 100644 index 0000000..6424743 --- /dev/null +++ b/src/Agent.Watchdog/Msi/MsiRunner.cs @@ -0,0 +1,427 @@ +using System.Text; +using Shared.Contracts.Models; +using Shared.Contracts.Serialization; + +namespace Agent.Watchdog.Msi; + +/// Timings of an MSI run; shortened in tests. +public sealed record MsiRunnerSettings +{ + /// Between tries while Windows Installer is busy with another installation (1618). + public TimeSpan BusyRetryDelay { get; init; } = TimeSpan.FromSeconds(30); + + /// How long a busy Windows Installer is waited out before the run gives up (installer-busy). + public TimeSpan BusyRetryFor { get; init; } = TimeSpan.FromMinutes(10); + + /// The longest one install may take (real time: Windows Installer's call cannot be cut short). + public TimeSpan InstallTimeout { get; init; } = WatchdogFiles.MsiInstallTimeout; +} + +/// +/// The detached MSI runner (ExecuteR-Watchdog.exe msi-run <upgradeId>, +/// started from a copy of the watchdog binary in upgrade/msi/runner/). +/// It owns the run in msi.json for as long as it holds +/// msi.lock, and depends on neither service, since the MSI stops both: +/// +/// installing: Windows Installer in process (no UI, verbose log +/// <logs>/agent-msi-<version>-<id>.log, REBOOT=ReallySuppress, +/// ALLOWDOWNGRADE=1 for a rollback from the console); 0, 3010 and 1641 +/// are success; 1618 (another installation) is tried again every 30 s for up +/// to 10 minutes, then installer-busy; anything else, or 30 minutes without an +/// answer, is failed / msi (Windows Installer's transaction leaves the previous +/// version in place); +/// verifying: the services the MSI started; a beacon of the new +/// version, connected, written since the install began, before the deadline; +/// rolling-back: the MSI of the previous version with +/// ALLOWDOWNGRADE=1 (its own log), then the previous version's health; +/// without that MSI the new version stays and the run ends failed. +/// +/// The outcome goes to outcome.json, both services are left running, +/// msi.json goes and the runner exits. +/// +public sealed class MsiRunner( + WatchdogOptions options, + IAgentService agent, + IAgentService? watchdogService, + IWindowsInstaller installer, + IWatchdogClock clock, + WatchdogLog log, + MsiRunnerSettings? settings = null) +{ + public const int LogLines = UpgradeApplier.LogLines; + public const int MaxExits = UpgradeApplier.MaxExits; + + public const string InstallProperties = "REBOOT=ReallySuppress"; + public const string DowngradeProperties = "REBOOT=ReallySuppress ALLOWDOWNGRADE=1"; + + private readonly MsiRunnerSettings timings = settings ?? new MsiRunnerSettings(); + + /// The new version's last log lines, taken before it is rolled back. + private List newVersionLog = []; + + /// Why the new version is being rolled back (a resumed rollback says health-deadline). + private string rollbackReason = AgentUpgradeReasons.HealthDeadline; + + /// Runs (or resumes) the run of ; 0 unless the run could not be read at all. + public async Task RunAsync(Guid upgradeId, CancellationToken cancellationToken) + { + using var held = MsiRunLock.TryHold(options.MsiRunnerLockPath); + if (held is null) + { + log.Info($"Another MSI runner owns upgrade {upgradeId}; this one exits"); + return 0; + } + + var journal = MsiUpgrade.ReadJournal(options); + if (journal is null || journal.UpgradeId != upgradeId) + { + log.Warn($"No MSI run of upgrade {upgradeId} is journalled; nothing to do"); + return journal is null ? 1 : 0; + } + + log.BeginRun(); + journal = journal with { RunnerProcessId = Environment.ProcessId }; + Write(journal); + log.Info($"MSI runner {Environment.ProcessId} owns upgrade {journal.UpgradeId}: {journal.FromVersion} -> {journal.Version} ({journal.Phase})"); + + try + { + while (true) + { + var next = journal.Phase switch + { + WatchdogMsiPhases.Installing => await InstallAsync(journal, cancellationToken), + WatchdogMsiPhases.Verifying => await VerifyAsync(journal, cancellationToken), + WatchdogMsiPhases.RollingBack => await RollBackAsync(journal, cancellationToken), + _ => await EndAsync(journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Watchdog, + $"The MSI run was in an unknown phase ({journal.Phase}).", log.RunTail(LogLines), cancellationToken), + }; + if (next is null) + { + return 0; + } + + journal = next; + } + } + catch (Exception exception) when (exception is not OperationCanceledException) + { + // Never leave the device without its services: end the run and say why. + log.Error("The MSI run failed", exception); + await EndAsync(journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Msi, + $"The MSI run failed ({exception.GetBaseException().Message}).", log.RunTail(LogLines), CancellationToken.None); + return 0; + } + } + + /// Installs the new version's MSI; the journal of the next phase, or null when the run ended. + private async Task InstallAsync(WatchdogMsiJournal journal, CancellationToken cancellationToken) + { + if (MsiUpgrade.Check(journal.Msi, options) is { } problem) + { + log.Error($"The MSI of {journal.Version} does not check out ({problem}); nothing was installed"); + return await EndAsync(journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Hash, + $"The MSI of {journal.Version} no longer matched what the agent checked ({problem}); nothing was installed, {journal.FromVersion} stays.", + log.RunTail(LogLines), cancellationToken); + } + + journal = journal with { StartedUtc = clock.UtcNow, DeadlineUtc = null }; + Write(journal); + var logPath = options.MsiLogPath(journal.Version, journal.UpgradeId); + var properties = journal.Revert ? DowngradeProperties : InstallProperties; + log.Info($"Installing {journal.Version} through Windows Installer ({properties}); its log is {logPath}"); + var (result, code, updated) = await InstallWithRetriesAsync(journal, journal.Msi.Path, properties, logPath, cancellationToken); + journal = updated; + + switch (result) + { + case InstallResult.TimedOut: + log.Error($"Windows Installer did not finish installing {journal.Version} within {timings.InstallTimeout.TotalMinutes:0} minutes"); + return await EndAsync(journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Msi, + $"Windows Installer did not finish installing {journal.Version} within {timings.InstallTimeout.TotalMinutes:0} minutes; its log is {logPath}.", + TailMsiLog(logPath), cancellationToken); + + case InstallResult.Busy: + log.Error($"Windows Installer stayed busy with another installation for {timings.BusyRetryFor.TotalMinutes:0} minutes; {journal.FromVersion} stays"); + return await EndAsync(journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.InstallerBusy, + $"Another installation kept Windows Installer busy (1618) for {timings.BusyRetryFor.TotalMinutes:0} minutes; {journal.FromVersion} stays.", + log.RunTail(LogLines), cancellationToken); + + case InstallResult.Failed: + log.Error($"Windows Installer ended with {code} ({MsiExitCodes.Describe(code)}); its transaction left {journal.FromVersion} in place"); + return await EndAsync(journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Msi, + $"Windows Installer ended with {code} ({MsiExitCodes.Describe(code)}) and left {journal.FromVersion} in place; its log is {logPath}.", + TailMsiLog(logPath), cancellationToken); + } + + var deadline = clock.UtcNow + (journal.HealthDeadlineSeconds > 0 + ? TimeSpan.FromSeconds(journal.HealthDeadlineSeconds) + : options.DefaultHealthDeadline); + log.Info(code == MsiExitCodes.Success + ? $"Windows Installer installed {journal.Version}; waiting until {deadline:O} for it to report healthy" + : $"Windows Installer installed {journal.Version} ({code}: {MsiExitCodes.Describe(code)}); waiting until {deadline:O} for it to report healthy"); + journal = journal with { Phase = WatchdogMsiPhases.Verifying, DeadlineUtc = deadline }; + Write(journal); + return journal; + } + + private async Task VerifyAsync(WatchdogMsiJournal journal, CancellationToken cancellationToken) + { + var deadline = journal.DeadlineUtc ?? clock.UtcNow + options.DefaultHealthDeadline; + var (healthy, exits) = await WaitHealthyAsync(journal.Version, journal.StartedUtc, deadline, cancellationToken); + if (healthy) + { + log.Info($"{journal.Version} is healthy; the upgrade is kept"); + return await EndAsync(journal, AgentUpgradeStates.Succeeded, null, null, [], cancellationToken); + } + + var reason = exits >= MaxExits ? AgentUpgradeReasons.Crashed : AgentUpgradeReasons.HealthDeadline; + rollbackReason = reason; + newVersionLog = UpgradeApplier.TailAgentLog(options, journal.StartedUtc); + var why = reason == AgentUpgradeReasons.Crashed ? "kept exiting" : "did not report healthy in time"; + if (journal.RollbackMsi is null || journal.RollbackVersion is null) + { + log.Error($"{journal.Version} {why}, and no MSI of {journal.FromVersion} was kept to go back to; it stays"); + return await EndAsync(journal, AgentUpgradeStates.Failed, reason, + $"{journal.Version} {why}; no MSI of {journal.FromVersion} was kept to go back to, so it stays.", + newVersionLog.Count > 0 ? newVersionLog : log.RunTail(LogLines), cancellationToken); + } + + log.Warn($"{journal.Version} {why}; installing the MSI of {journal.RollbackVersion} again"); + journal = journal with { Phase = WatchdogMsiPhases.RollingBack, StartedUtc = clock.UtcNow, DeadlineUtc = null, Attempts = 0, LastExitCode = null }; + Write(journal); + return journal; + } + + private async Task RollBackAsync(WatchdogMsiJournal journal, CancellationToken cancellationToken) + { + var lastLog = newVersionLog.Count > 0 ? newVersionLog : log.RunTail(LogLines); + var previous = journal.RollbackVersion ?? journal.FromVersion; + var why = rollbackReason == AgentUpgradeReasons.Crashed ? "kept exiting" : "did not report healthy in time"; + var rollback = journal.RollbackMsi; + var problem = rollback is null ? "it is not there" : MsiUpgrade.Check(rollback, options); + if (rollback is null || problem is not null) + { + log.Error($"The MSI of {previous} does not check out ({problem}); {journal.Version} stays"); + return await EndAsync(journal, AgentUpgradeStates.Failed, rollbackReason, + $"{journal.Version} {why}, and the MSI of {previous} to go back to no longer checked out; {journal.Version} stays.", + lastLog, cancellationToken); + } + + var started = clock.UtcNow; + journal = journal with { StartedUtc = started }; + Write(journal); + var logPath = options.MsiLogPath(previous, journal.UpgradeId); + log.Info($"Installing {previous} again through Windows Installer ({DowngradeProperties}); its log is {logPath}"); + var (result, code, updated) = await InstallWithRetriesAsync(journal, rollback.Path, DowngradeProperties, logPath, cancellationToken); + journal = updated; + if (result != InstallResult.Installed) + { + var what = result switch + { + InstallResult.TimedOut => $"did not finish within {timings.InstallTimeout.TotalMinutes:0} minutes", + InstallResult.Busy => "could not run: Windows Installer stayed busy (1618)", + _ => $"ended with {code} ({MsiExitCodes.Describe(code)})", + }; + log.Error($"Installing {previous} again {what}; {journal.Version} stays"); + return await EndAsync(journal, AgentUpgradeStates.Failed, rollbackReason, + $"{journal.Version} {why}, and installing the MSI of {previous} again {what}; its log is {logPath}.", + lastLog, cancellationToken); + } + + // The new version's beacon must not speak for the previous one. + WatchdogFileStore.TryDelete(options.HealthPath); + var (back, _) = await WaitHealthyAsync(previous, started, clock.UtcNow + options.RollbackHealthDeadline, cancellationToken); + log.Info(back + ? $"{previous} is back and healthy" + : $"{previous} is back; it has not reported healthy within {options.RollbackHealthDeadline.TotalMinutes:0} minutes"); + return await EndAsync(journal, AgentUpgradeStates.RolledBack, rollbackReason, + $"{journal.Version} {why}; the MSI of {previous} was installed again{(back ? "" : ", and it has not reported healthy yet")}.", + lastLog, cancellationToken); + } + + private enum InstallResult + { + Installed, + Failed, + Busy, + TimedOut, + } + + /// One install, tried again while Windows Installer answers 1618; every attempt and answer is journalled. + private async Task<(InstallResult Result, int Code, WatchdogMsiJournal Journal)> InstallWithRetriesAsync( + WatchdogMsiJournal journal, string package, string properties, string logPath, CancellationToken cancellationToken) + { + var giveUp = clock.UtcNow + timings.BusyRetryFor; + while (true) + { + journal = journal with { Attempts = journal.Attempts + 1 }; + Write(journal); + var code = await InstallOnceAsync(package, properties, logPath); + if (code is not { } answer) + { + return (InstallResult.TimedOut, -1, journal); + } + + journal = journal with { LastExitCode = answer }; + Write(journal); + if (answer != MsiExitCodes.InstallerBusy) + { + return (MsiExitCodes.Succeeded(answer) ? InstallResult.Installed : InstallResult.Failed, answer, journal); + } + + if (clock.UtcNow + timings.BusyRetryDelay > giveUp) + { + return (InstallResult.Busy, answer, journal); + } + + log.Warn($"Windows Installer is busy with another installation (1618); trying again in {timings.BusyRetryDelay.TotalSeconds:0} s (attempt {journal.Attempts})"); + await clock.DelayAsync(timings.BusyRetryDelay, cancellationToken); + } + } + + /// + /// Windows Installer's answer, or null when it gave none within the install + /// timeout. The call runs on a background thread of its own (the three calls + /// on the same thread); one cut off by the timeout ends with the process. + /// + private async Task InstallOnceAsync(string package, string properties, string logPath) + { + var install = Task.Factory.StartNew(() => + { + installer.SetSilentUI(); + installer.EnableLog(logPath); + return installer.InstallProduct(package, properties); + }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); + + try + { + return await install.WaitAsync(timings.InstallTimeout); + } + catch (TimeoutException) + { + return null; + } + } + + /// + /// Healthy: a beacon of , connected, written since + /// , before . The agent + /// found not running is started again; the third time ends the wait. + /// + private async Task<(bool Healthy, int Exits)> WaitHealthyAsync( + string version, DateTimeOffset since, DateTimeOffset deadline, CancellationToken cancellationToken) + { + var exits = 0; + var reported = clock.UtcNow; + while (clock.UtcNow < deadline && exits < MaxExits) + { + if (MsiUpgrade.IsHealthy(options, version, since)) + { + return (true, exits); + } + + if (clock.UtcNow - reported >= TimeSpan.FromMinutes(1)) + { + reported = clock.UtcNow; + log.Info($"Waiting for {version} to report healthy"); + } + + var status = await agent.QueryAsync(cancellationToken); + if (status.State == AgentRunState.Stopped) + { + exits++; + if (exits >= MaxExits) + { + log.Warn($"{version} exited {exits} times; the wait ends"); + break; + } + + log.Warn($"{version} is not running (exit {exits}); starting it"); + try + { + await agent.StartAsync(cancellationToken); + } + catch (Exception exception) when (exception is not OperationCanceledException) + { + log.Warn("The agent did not start", exception); + } + } + + await clock.DelayAsync(options.PollInterval, cancellationToken); + } + + return (MsiUpgrade.IsHealthy(options, version, since), exits); + } + + /// Both services running, the outcome written, the run's files gone; null (the run is over). + private async Task EndAsync( + WatchdogMsiJournal journal, string result, string? reason, string? detail, IReadOnlyList lastLog, CancellationToken cancellationToken) + { + await EnsureRunningAsync(agent, "agent", cancellationToken); + if (watchdogService is not null) + { + await EnsureRunningAsync(watchdogService, "watchdog", cancellationToken); + } + + MsiUpgrade.WriteOutcome(options, journal, result, reason, detail, lastLog, clock.UtcNow); + log.Info($"Upgrade {journal.UpgradeId} to {journal.Version} ended: {result}{(reason is null ? "" : $" ({reason})")}"); + WatchdogFileStore.TryDelete(options.MsiJournalPath); + MsiUpgrade.DeletePackages(options); + return null; + } + + private async Task EnsureRunningAsync(IAgentService service, string name, CancellationToken cancellationToken) + { + try + { + var status = await service.QueryAsync(cancellationToken); + if (status.State != AgentRunState.NotInstalled && !status.IsRunning) + { + await service.StartAsync(cancellationToken); + } + } + catch (Exception exception) when (exception is not OperationCanceledException) + { + log.Warn($"The {name} service could not be started", exception); + } + } + + private void Write(WatchdogMsiJournal journal) + => WatchdogFileStore.Write(options.MsiJournalPath, journal, WatchdogJsonContext.Default.WatchdogMsiJournal); + + /// The last lines of Windows Installer's log (UTF-16 with a BOM, or whatever its BOM says). + internal static List TailMsiLog(string path) + { + try + { + if (!File.Exists(path)) + { + return []; + } + + using var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); + using var reader = new StreamReader(stream, Encoding.Unicode, detectEncodingFromByteOrderMarks: true); + var lines = new Queue(); + while (reader.ReadLine() is { } line) + { + if (line.Length == 0) + { + continue; + } + + lines.Enqueue(line.Length <= 2000 ? line : line[..2000]); + if (lines.Count > LogLines) + { + lines.Dequeue(); + } + } + + return [.. lines]; + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + return []; + } + } +} diff --git a/src/Agent.Watchdog/Msi/MsiRunnerLauncher.cs b/src/Agent.Watchdog/Msi/MsiRunnerLauncher.cs new file mode 100644 index 0000000..5f480bd --- /dev/null +++ b/src/Agent.Watchdog/Msi/MsiRunnerLauncher.cs @@ -0,0 +1,200 @@ +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using System.Text; +using Shared.Contracts.Models; + +namespace Agent.Watchdog.Msi; + +/// Starts the MSI runner apart from the watchdog (the MSI stops the watchdog service); replaced in tests. +public interface IMsiRunnerLauncher +{ + /// Starts msi-run <upgradeId>; null when it started, otherwise why not. + string? Launch(Guid upgradeId); +} + +/// +/// Copies the watchdog's own binary to upgrade/msi/runner/ (the MSI +/// replaces the installed one while it runs) and starts the copy detached: its +/// own process group, no console, out of any job the service runs in, so +/// stopping both services (which the MSI does) never takes it down. +/// +[SupportedOSPlatform("windows")] +public sealed class WindowsMsiRunnerLauncher(WatchdogOptions options, WatchdogLog log) : IMsiRunnerLauncher +{ + public string? Launch(Guid upgradeId) + { + if (options.SelfPath is not { } self || !File.Exists(self) + || !string.Equals(Path.GetFileName(self), Shared.Infrastructure.Constants.Branding.WatchdogExecutableName, StringComparison.OrdinalIgnoreCase)) + { + return "the watchdog does not run from its own binary, so it has none to start the MSI runner from"; + } + + string runner; + try + { + Directory.CreateDirectory(options.MsiRunnerDirectory); + runner = Path.Combine(options.MsiRunnerDirectory, Path.GetFileName(self)); + File.Copy(self, runner, overwrite: true); + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + return $"the watchdog binary could not be copied for the MSI runner ({exception.Message})"; + } + + string[] arguments = + [ + WatchdogMsiFiles.RunVerb, upgradeId.ToString("D"), + "--install-dir", options.InstallDirectory, + "--data-dir", options.DataDirectory, + ]; + try + { + var processId = DetachedProcess.Start(runner, arguments, options.MsiRunnerDirectory); + log.Info($"MSI runner started (process {processId}) from {runner}"); + return null; + } + catch (Win32Exception exception) + { + return $"the MSI runner did not start ({exception.Message})"; + } + } +} + +/// CreateProcessW for a process that outlives its parent and the parent's service. +[SupportedOSPlatform("windows")] +public static partial class DetachedProcess +{ + private const uint DetachedProcessFlag = 0x00000008; + private const uint CreateNewProcessGroup = 0x00000200; + private const uint CreateBreakawayFromJob = 0x01000000; + private const uint CreateNoWindow = 0x08000000; + private const int ErrorAccessDenied = 5; + + /// + /// Starts with DETACHED_PROCESS | + /// CREATE_NEW_PROCESS_GROUP | CREATE_BREAKAWAY_FROM_JOB | CREATE_NO_WINDOW + /// (without the breakaway when the job refuses it) and returns its process id. + /// + public static unsafe int Start(string executable, IReadOnlyList arguments, string workingDirectory) + { + var commandLine = BuildCommandLine(executable, arguments); + var flags = DetachedProcessFlag | CreateNewProcessGroup | CreateNoWindow; + foreach (var breakaway in new[] { true, false }) + { + var buffer = (commandLine + '\0').ToCharArray(); + var startup = new StartupInfo { cb = sizeof(StartupInfo) }; + fixed (char* line = buffer) + { + if (CreateProcessW(executable, line, 0, 0, false, flags | (breakaway ? CreateBreakawayFromJob : 0), 0, workingDirectory, + ref startup, out var info)) + { + CloseHandle(info.hThread); + CloseHandle(info.hProcess); + return info.dwProcessId; + } + } + + var error = Marshal.GetLastPInvokeError(); + if (!breakaway || error != ErrorAccessDenied) + { + throw new Win32Exception(error); + } + + // A job that does not allow breakaway: the process stays in it, still detached. + } + + throw new Win32Exception(ErrorAccessDenied); + } + + /// Quotes each argument the way CommandLineToArgvW reads it back. + public static string BuildCommandLine(string executable, IReadOnlyList arguments) + { + var builder = new StringBuilder(); + Append(builder, executable); + foreach (var argument in arguments) + { + builder.Append(' '); + Append(builder, argument); + } + + return builder.ToString(); + } + + private static void Append(StringBuilder builder, string argument) + { + if (argument.Length > 0 && !argument.Any(c => c is ' ' or '\t' or '"')) + { + builder.Append(argument); + return; + } + + builder.Append('"'); + var backslashes = 0; + foreach (var c in argument) + { + if (c == '\\') + { + backslashes++; + continue; + } + + builder.Append('\\', c == '"' ? backslashes * 2 + 1 : backslashes); + backslashes = 0; + builder.Append(c); + } + + builder.Append('\\', backslashes * 2); + builder.Append('"'); + } + + [StructLayout(LayoutKind.Sequential)] + private struct StartupInfo + { + public int cb; + public nint lpReserved; + public nint lpDesktop; + public nint lpTitle; + public int dwX; + public int dwY; + public int dwXSize; + public int dwYSize; + public int dwXCountChars; + public int dwYCountChars; + public int dwFillAttribute; + public int dwFlags; + public short wShowWindow; + public short cbReserved2; + public nint lpReserved2; + public nint hStdInput; + public nint hStdOutput; + public nint hStdError; + } + + [StructLayout(LayoutKind.Sequential)] + private struct ProcessInformation + { + public nint hProcess; + public nint hThread; + public int dwProcessId; + public int dwThreadId; + } + + [LibraryImport("kernel32.dll", EntryPoint = "CreateProcessW", StringMarshalling = StringMarshalling.Utf16, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static unsafe partial bool CreateProcessW( + string applicationName, + char* commandLine, + nint processAttributes, + nint threadAttributes, + [MarshalAs(UnmanagedType.Bool)] bool inheritHandles, + uint creationFlags, + nint environment, + string currentDirectory, + ref StartupInfo startupInfo, + out ProcessInformation processInformation); + + [LibraryImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static partial bool CloseHandle(nint handle); +} diff --git a/src/Agent.Watchdog/Msi/MsiUpgrade.cs b/src/Agent.Watchdog/Msi/MsiUpgrade.cs new file mode 100644 index 0000000..4789796 --- /dev/null +++ b/src/Agent.Watchdog/Msi/MsiUpgrade.cs @@ -0,0 +1,312 @@ +using Shared.Contracts.Models; +using Shared.Contracts.Serialization; + +namespace Agent.Watchdog.Msi; + +/// +/// The watchdog's side of an MSI upgrade (hand-over kind msi): it checks +/// the MSIs the agent handed over (in upgrade/msi/, size and SHA-256), +/// journals the run in msi.json and starts the detached runner +/// (), which does the rest while the MSI stops and starts +/// both services. Whichever watchdog runs next (the new version's, started by the +/// MSI) leaves a live runner alone; a runner that died is started again from the +/// journal, at most times, or, when it died installing +/// and the new version already reports healthy, it resumes in verifying. +/// No file is swapped and the agent is never started while a run is pending: +/// that is the runner's to decide. +/// +public sealed class MsiUpgrade(WatchdogOptions options, IMsiRunnerLauncher? launcher, IAgentService agent, IWatchdogClock clock, WatchdogLog log) +{ + public const int MaxResumes = 3; + + private const string Mismatch = "its size or SHA-256 does not match"; + + /// A runner this watchdog just started is given this long to take its lock. + public static readonly TimeSpan LaunchGrace = TimeSpan.FromMinutes(1); + + private DateTimeOffset launchedUtc = DateTimeOffset.MinValue; + + /// An MSI run is journalled: the watchdog neither supervises the agent nor takes another hand-over. + public bool Pending => File.Exists(options.MsiJournalPath); + + /// Checks the hand-over's MSIs, journals the run and starts the runner; the run ends here (outcome written) when it cannot start. + public async Task StartAsync(WatchdogHandover handover, CancellationToken cancellationToken) + { + log.BeginRun(); + log.Info($"Upgrade {handover.UpgradeId} handed over: {handover.FromVersion} -> {handover.Version}{(handover.Revert ? " (rollback)" : "")} through its MSI"); + WatchdogFileStore.TryDelete(options.HandoverPath); + + var journal = new WatchdogMsiJournal(handover.UpgradeId, handover.Version, handover.FromVersion, WatchdogMsiPhases.Installing, + handover.Msi ?? new WatchdogFile("", 0, ""), null, null, handover.HealthDeadlineSeconds, RunnerProcessId: 0, Attempts: 0, + LastExitCode: null, clock.UtcNow, DeadlineUtc: null, handover.Revert); + + var detail = handover.Msi is null ? "the hand-over names no MSI" : Check(handover.Msi, options); + if (detail is not null) + { + log.Error($"The MSI handed over does not check out ({detail}); nothing was changed"); + WriteOutcome(options, journal, AgentUpgradeStates.Failed, + detail == Mismatch ? AgentUpgradeReasons.Hash : AgentUpgradeReasons.Package, + $"The MSI of {handover.Version} did not check out ({detail}); nothing was changed.", log.RunTail(UpgradeApplier.LogLines), clock.UtcNow); + return; + } + + if (handover.RollbackMsi is { } rollback && handover.RollbackVersion is { } rollbackVersion) + { + if (Check(rollback, options) is { } rollbackProblem) + { + log.Warn($"The MSI of {rollbackVersion} to go back to does not check out ({rollbackProblem}); this upgrade cannot be rolled back automatically"); + } + else + { + journal = journal with { RollbackMsi = rollback, RollbackVersion = rollbackVersion }; + } + } + + if (journal.RollbackMsi is null) + { + log.Warn($"No MSI of {handover.FromVersion} is kept: a {handover.Version} that does not report healthy stays"); + } + + if (launcher is null) + { + log.Error("This watchdog cannot run Windows Installer (not Windows); nothing was changed"); + WriteOutcome(options, journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Unsupported, + "MSI upgrades run only on Windows; nothing was changed.", log.RunTail(UpgradeApplier.LogLines), clock.UtcNow); + return; + } + + Write(journal); + await LaunchAsync(journal, cancellationToken); + } + + /// Each pass (and at start) while a run is journalled: a live runner is left alone, a dead one resumed or the run ended. + public async Task CheckAsync(CancellationToken cancellationToken) + { + var journal = ReadJournal(options); + if (journal is null) + { + if (Pending && !RunnerAlive) + { + var id = WatchdogFileStore.ReadUpgradeId(options.MsiJournalPath); + log.Error($"The MSI run's journal does not read; the run ends (upgrade {id?.ToString() ?? "unknown"})"); + WatchdogFileStore.TryDelete(options.MsiJournalPath); + if (id is { } upgradeId) + { + WatchdogFileStore.Write(options.OutcomePath, + new WatchdogOutcome(upgradeId, AgentUpgradeStates.Failed, AgentUpgradeReasons.Watchdog, "", "", log.RunTail(UpgradeApplier.LogLines), + clock.UtcNow, "The MSI run's journal could not be read."), + WatchdogJsonContext.Default.WatchdogOutcome); + } + + await EnsureAgentRunningAsync(cancellationToken); + } + + return; + } + + if (RunnerAlive || clock.UtcNow - launchedUtc < LaunchGrace) + { + return; + } + + log.BeginRun(); + if (journal.Resumes >= MaxResumes || launcher is null) + { + log.Error($"The MSI runner of upgrade {journal.UpgradeId} stopped {journal.Resumes + 1} times before the run ended; it is given up"); + await EnsureAgentRunningAsync(cancellationToken); + WriteOutcome(options, journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Msi, + $"The MSI runner stopped before the upgrade to {journal.Version} ended, {journal.Resumes + 1} times.", log.RunTail(UpgradeApplier.LogLines), clock.UtcNow); + WatchdogFileStore.TryDelete(options.MsiJournalPath); + DeletePackages(options); + return; + } + + if (journal.Phase == WatchdogMsiPhases.Installing && IsHealthy(options, journal.Version, journal.StartedUtc)) + { + // Installed (the MSI started the new version, which reports healthy) + // before the runner could say so: it goes on from verifying. + var deadline = journal.DeadlineUtc is { } at && at > clock.UtcNow ? at : clock.UtcNow + UpgradeApplier.RecheckWindow; + log.Warn($"The MSI runner stopped, but {journal.Version} is installed and healthy; the run goes on from verifying"); + journal = journal with { Phase = WatchdogMsiPhases.Verifying, DeadlineUtc = deadline }; + } + else + { + log.Warn($"The MSI runner of upgrade {journal.UpgradeId} stopped in {journal.Phase}; it is started again (resume {journal.Resumes + 1} of {MaxResumes})"); + } + + journal = journal with { Resumes = journal.Resumes + 1 }; + Write(journal); + await LaunchAsync(journal, cancellationToken); + } + + /// Removes the runner's binary copy, unless a run is pending. + public void Tidy() + { + if (!Pending) + { + SwapPaths.TryDeleteDirectory(options.MsiRunnerDirectory); + } + } + + private async Task LaunchAsync(WatchdogMsiJournal journal, CancellationToken cancellationToken) + { + if (launcher!.Launch(journal.UpgradeId) is { } problem) + { + log.Error($"The MSI runner could not be started: {problem}; nothing was installed"); + await EnsureAgentRunningAsync(cancellationToken); + WriteOutcome(options, journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Watchdog, + $"The watchdog could not start Windows Installer: {problem}.", log.RunTail(UpgradeApplier.LogLines), clock.UtcNow); + WatchdogFileStore.TryDelete(options.MsiJournalPath); + DeletePackages(options); + return; + } + + launchedUtc = clock.UtcNow; + log.Info($"Upgrade {journal.UpgradeId}: the MSI runner installs {journal.Version}; Windows Installer stops and starts both services"); + } + + private bool RunnerAlive => MsiRunLock.IsHeld(options.MsiRunnerLockPath); + + private async Task EnsureAgentRunningAsync(CancellationToken cancellationToken) + { + try + { + var status = await agent.QueryAsync(cancellationToken); + if (status.State != AgentRunState.NotInstalled && !status.IsRunning) + { + await agent.StartAsync(cancellationToken); + } + } + catch (Exception exception) when (exception is not OperationCanceledException || !cancellationToken.IsCancellationRequested) + { + log.Warn("The agent could not be started", exception); + } + } + + private void Write(WatchdogMsiJournal journal) + => WatchdogFileStore.Write(options.MsiJournalPath, journal, WatchdogJsonContext.Default.WatchdogMsiJournal); + + public static WatchdogMsiJournal? ReadJournal(WatchdogOptions options) + => WatchdogFileStore.Read(options.MsiJournalPath, WatchdogJsonContext.Default.WatchdogMsiJournal); + + /// Null when is an MSI in upgrade/msi/ of the size and SHA-256 named; otherwise what is wrong. + public static string? Check(WatchdogFile file, WatchdogOptions options) + { + if (string.IsNullOrWhiteSpace(file.Path) || !Path.IsPathFullyQualified(file.Path) + || !SwapPaths.IsInside(file.Path, options.MsiDirectory) + || !string.Equals(Path.GetExtension(file.Path), ".msi", StringComparison.OrdinalIgnoreCase)) + { + return "it is not an MSI in the data folder's upgrade/msi folder"; + } + + if (!File.Exists(file.Path)) + { + return "it is not there"; + } + + try + { + return new FileInfo(file.Path).Length == file.Size + && string.Equals(SwapPaths.Sha256(file.Path), file.Sha256, StringComparison.OrdinalIgnoreCase) + ? null + : Mismatch; + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + return $"it cannot be read ({exception.Message})"; + } + } + + /// A beacon of , connected, written at or after . + public static bool IsHealthy(WatchdogOptions options, string version, DateTimeOffset since) + => WatchdogFileStore.Read(options.HealthPath, WatchdogJsonContext.Default.WatchdogHealthBeacon) is { Connected: true } beacon + && beacon.AtUtc >= since + && AgentVersions.AreSame(beacon.Version, version); + + public static void WriteOutcome(WatchdogOptions options, WatchdogMsiJournal journal, string result, string? reason, string? detail, + IReadOnlyList lastLog, DateTimeOffset now) + => WatchdogFileStore.Write(options.OutcomePath, + new WatchdogOutcome(journal.UpgradeId, result, reason, journal.Version, journal.FromVersion, + [.. lastLog.Skip(Math.Max(0, lastLog.Count - UpgradeApplier.LogLines))], now, detail), + WatchdogJsonContext.Default.WatchdogOutcome); + + /// The MSIs of a finished run (kept copies live in <data>/packages); the runner's binary stays until the next tidy. + public static void DeletePackages(WatchdogOptions options) + { + if (!Directory.Exists(options.MsiDirectory)) + { + return; + } + + foreach (var entry in new DirectoryInfo(options.MsiDirectory).GetFileSystemInfos()) + { + if (string.Equals(entry.Name, WatchdogMsiFiles.RunnerFolder, StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + try + { + if (entry is DirectoryInfo folder) + { + folder.Delete(recursive: true); + } + else + { + entry.Delete(); + } + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + } + } + } +} + +/// +/// msi.lock, held open with no sharing by the runner for as long as it +/// lives: Windows releases it when the process ends however it ends, so a lock +/// nobody holds is a runner that is gone (a process id can be reused, a lock +/// cannot outlive its holder). +/// +public static class MsiRunLock +{ + public static FileStream? TryHold(string path) + { + try + { + Directory.CreateDirectory(Path.GetDirectoryName(path)!); + return new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); + } + catch (IOException) + { + return null; + } + } + + public static bool IsHeld(string path) + { + if (!File.Exists(path)) + { + return false; + } + + try + { + using var probe = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None); + return false; + } + catch (FileNotFoundException) + { + return false; + } + catch (IOException) + { + return true; + } + catch (UnauthorizedAccessException) + { + return false; + } + } +} diff --git a/src/Agent.Watchdog/Msi/WindowsInstaller.cs b/src/Agent.Watchdog/Msi/WindowsInstaller.cs new file mode 100644 index 0000000..c0cf237 --- /dev/null +++ b/src/Agent.Watchdog/Msi/WindowsInstaller.cs @@ -0,0 +1,100 @@ +using System.Runtime.InteropServices; + +namespace Agent.Watchdog.Msi; + +/// +/// The three Windows Installer calls an MSI upgrade makes, in process (msi.dll, +/// which is what msiexec.exe itself calls; never msiexec, never PowerShell). +/// Replaced in tests, which never run an MSI. +/// +public interface IWindowsInstaller +{ + /// MsiSetInternalUI(INSTALLUILEVEL_NONE): no UI at all (msiexec's /qn). + void SetSilentUI(); + + /// MsiEnableLogW: msiexec's /l*v into , appended to. + void EnableLog(string logPath); + + /// MsiInstallProductW: installs the package and returns Windows Installer's own code (what msiexec would exit with). + int InstallProduct(string package, string commandLine); +} + +/// Windows Installer's answers an MSI run acts on. +public static class MsiExitCodes +{ + public const int Success = 0; + /// ERROR_SUCCESS_REBOOT_REQUIRED: installed; a restart finishes it. + public const int SuccessRebootRequired = 3010; + /// ERROR_SUCCESS_REBOOT_INITIATED: installed; Windows Installer started a restart. + public const int SuccessRebootInitiated = 1641; + /// ERROR_INSTALL_ALREADY_RUNNING: another installation is under way; try again later. + public const int InstallerBusy = 1618; + /// ERROR_INSTALL_USEREXIT. + public const int UserExit = 1602; + /// ERROR_INSTALL_FAILURE: a fatal error; Windows Installer rolled its transaction back. + public const int InstallFailure = 1603; + /// ERROR_INSTALL_PACKAGE_INVALID. + public const int PackageInvalid = 1620; + /// ERROR_PRODUCT_VERSION: a newer version is installed (a downgrade without ALLOWDOWNGRADE=1). + public const int ProductVersion = 1638; + + /// Done, done with a restart pending, or done with a restart started. + public static bool Succeeded(int code) => code is Success or SuccessRebootRequired or SuccessRebootInitiated; + + public static string Describe(int code) => code switch + { + Success => "success", + SuccessRebootRequired => "success, a restart is required to finish", + SuccessRebootInitiated => "success, a restart was started", + InstallerBusy => "another installation is in progress", + UserExit => "the installation was cancelled", + InstallFailure => "a fatal error during installation", + PackageInvalid => "the package could not be opened", + ProductVersion => "another version of the product is already installed", + 1619 => "the package could not be opened", + 1625 => "the installation is forbidden by system policy", + 1633 => "the package is not supported on this platform", + _ => "see the Windows Installer log", + }; +} + +/// msi.dll through P/Invoke. +public sealed partial class WindowsInstallerApi : IWindowsInstaller +{ + /// INSTALLUILEVEL_NONE. + private const int InstallUiLevelNone = 2; + + /// + /// msiexec's /l*v (msi.h INSTALLLOGMODE_*): FATALEXIT 0x1, ERROR 0x2, + /// WARNING 0x4, USER 0x8, INFO 0x10, RESOLVESOURCE 0x40, OUTOFDISKSPACE 0x80, + /// ACTIONSTART 0x100, ACTIONDATA 0x200, PROPERTYDUMP 0x400, COMMONDATA 0x800 + /// (the * kinds, source resolution included) and VERBOSE 0x1000. + /// + public const uint LogEverythingVerbose = 0x1FDF; + + /// INSTALLLOGATTRIBUTES_APPEND: a retry adds to the run's log rather than replacing it. + private const uint LogAttributesAppend = 0x1; + + public void SetSilentUI() => MsiSetInternalUI(InstallUiLevelNone, 0); + + public void EnableLog(string logPath) + { + Directory.CreateDirectory(Path.GetDirectoryName(logPath)!); + var result = MsiEnableLogW(LogEverythingVerbose, logPath, LogAttributesAppend); + if (result != 0) + { + throw new IOException($"Windows Installer did not accept the log file {logPath} (error {result})."); + } + } + + public int InstallProduct(string package, string commandLine) => (int)MsiInstallProductW(package, commandLine); + + [LibraryImport("msi.dll")] + private static partial int MsiSetInternalUI(int level, nint window); + + [LibraryImport("msi.dll", StringMarshalling = StringMarshalling.Utf16)] + private static partial uint MsiEnableLogW(uint mode, string file, uint attributes); + + [LibraryImport("msi.dll", StringMarshalling = StringMarshalling.Utf16)] + private static partial uint MsiInstallProductW(string package, string commandLine); +} diff --git a/src/Agent.Watchdog/UpgradeApplier.cs b/src/Agent.Watchdog/UpgradeApplier.cs index 39db203..c501f13 100644 --- a/src/Agent.Watchdog/UpgradeApplier.cs +++ b/src/Agent.Watchdog/UpgradeApplier.cs @@ -34,7 +34,9 @@ public enum PassResult /// brings a newer one; or rolling-back: the new files go to .failed/<id>/, the previous ones come back, /// the previous agent starts, and the outcome says rolled-back with the new version's last log lines. /// -/// The watchdog's own binary is never part of the swap. +/// The watchdog's own binary is never part of the swap. A hand-over of kind +/// msi is not swapped at all: it goes to , +/// whose detached runner installs it through Windows Installer. /// public sealed class UpgradeApplier( WatchdogOptions options, @@ -42,7 +44,8 @@ public sealed class UpgradeApplier( IWatchdogClock clock, WatchdogLog log, ISmokeTest? smoke = null, - IWatchdogRestart? restart = null) + IWatchdogRestart? restart = null, + Msi.MsiUpgrade? msi = null) { public const int MaxAttempts = 3; public const int MoveAttempts = 10; @@ -63,7 +66,7 @@ public sealed class UpgradeApplier( private string Install => options.InstallDirectory; /// An upgrade waits or is under way: the agent is not supervised meanwhile. - public bool Pending => File.Exists(options.HandoverPath) || File.Exists(options.JournalPath); + public bool Pending => File.Exists(options.HandoverPath) || File.Exists(options.JournalPath) || File.Exists(options.MsiJournalPath); /// The watchdog's own binary relative to the install folder, when it runs from there. private string? SelfRelative => options.SelfPath is { } self && SwapPaths.IsInside(self, Install) @@ -93,7 +96,15 @@ public sealed class UpgradeApplier( /// One pass: takes a hand-over, or carries a waiting run on. Idle when there is nothing to do. public async Task PassAsync(CancellationToken cancellationToken) { - TakeHandover(); + if (await MsiPassAsync(cancellationToken)) + { + return PassResult.Worked; + } + + if (await TakeHandoverAsync(cancellationToken)) + { + return PassResult.Worked; + } var journal = ReadJournal(); if (journal is null) @@ -132,6 +143,11 @@ public sealed class UpgradeApplier( /// public async Task RecoverAsync(CancellationToken cancellationToken) { + if (await MsiPassAsync(cancellationToken)) + { + return PassResult.Worked; + } + var journal = ReadJournal(); if (journal is null) { @@ -217,6 +233,7 @@ public sealed class UpgradeApplier( /// public void Tidy() { + msi?.Tidy(); if (Pending || File.Exists(options.TakenHandoverPath)) { return; @@ -233,12 +250,62 @@ public sealed class UpgradeApplier( } } - /// handover.json → handover.taken.json and a new journal; a duplicate or unreadable one is set aside. - private void TakeHandover() + /// + /// While an MSI run is journalled it is the only work (the runner's, or + /// resuming a runner that died); true then. + /// + private async Task MsiPassAsync(CancellationToken cancellationToken) + { + if (!File.Exists(options.MsiJournalPath)) + { + return false; + } + + if (msi is null) + { + // A watchdog without MSI support leaves the run alone, and the agent too. + return true; + } + + await msi.CheckAsync(cancellationToken); + return true; + } + + /// + /// handover.json → handover.taken.json and a new journal; a duplicate or + /// unreadable one is set aside. An MSI hand-over goes to the MSI upgrade + /// (true: this pass worked on it). + /// + private async Task TakeHandoverAsync(CancellationToken cancellationToken) + { + if (TakeHandover() is not { Kind: WatchdogHandoverKinds.Msi } handover) + { + return false; + } + + if (msi is null) + { + log.Error($"Upgrade {handover.UpgradeId} is an MSI upgrade, which this watchdog cannot run; nothing was changed"); + WatchdogFileStore.TryDelete(options.HandoverPath); + WatchdogFileStore.Write(options.OutcomePath, + new WatchdogOutcome(handover.UpgradeId, AgentUpgradeStates.Failed, AgentUpgradeReasons.Unsupported, handover.Version, + handover.FromVersion, log.RunTail(LogLines), clock.UtcNow, "MSI upgrades run only on Windows; nothing was changed."), + WatchdogJsonContext.Default.WatchdogOutcome); + finished.Add(handover.UpgradeId); + return true; + } + + await msi.StartAsync(handover, cancellationToken); + finished.Add(handover.UpgradeId); + return true; + } + + /// The MSI hand-over to start, after the checks every hand-over gets; null when there is none (a files one is journalled here). + private WatchdogHandover? TakeHandover() { if (!File.Exists(options.HandoverPath)) { - return; + return null; } var handover = WatchdogFileStore.Read(options.HandoverPath, WatchdogJsonContext.Default.WatchdogHandover); @@ -254,7 +321,7 @@ public sealed class UpgradeApplier( WatchdogJsonContext.Default.WatchdogOutcome); } - return; + return null; } if (ReadJournal() is { } open) @@ -264,14 +331,20 @@ public sealed class UpgradeApplier( ? $"Upgrade {handover.UpgradeId} is already under way ({open.Phase}); the repeated hand-over is not applied again" : $"Upgrade {open.UpgradeId} is under way; hand-over {handover.UpgradeId} is set aside"); WatchdogFileStore.TryDelete(options.HandoverPath); - return; + return null; } if (finished.Contains(handover.UpgradeId) || ReadOutcome()?.UpgradeId == handover.UpgradeId) { log.Warn($"Upgrade {handover.UpgradeId} has already ended; the repeated hand-over is not applied again"); WatchdogFileStore.TryDelete(options.HandoverPath); - return; + return null; + } + + if (handover.Kind == WatchdogHandoverKinds.Msi) + { + // Installed by Windows Installer, never swapped. + return handover; } log.BeginRun(); @@ -290,6 +363,7 @@ public sealed class UpgradeApplier( DeadlineUtc: null, Attempts: 0)); notBefore = DateTimeOffset.MinValue; + return null; } private async Task AttemptAsync(WatchdogHandover handover, WatchdogJournal journal, CancellationToken cancellationToken) @@ -651,7 +725,7 @@ public sealed class UpgradeApplier( // A version that did not come up healthy is told by its own last log // lines (taken before it is stopped); a swap that broke, by the watchdog's. - var lastLog = reason is AgentUpgradeReasons.HealthDeadline or AgentUpgradeReasons.Crashed ? TailAgentLog(since) : []; + var lastLog = reason is AgentUpgradeReasons.HealthDeadline or AgentUpgradeReasons.Crashed ? TailAgentLog(options, since) : []; try { await agent.StopAsync(cancellationToken); @@ -794,7 +868,7 @@ public sealed class UpgradeApplier( } /// The agent's last log lines, from its newest log file written since . - private List TailAgentLog(DateTimeOffset since) + internal static List TailAgentLog(WatchdogOptions options, DateTimeOffset since) { try { diff --git a/src/Agent.Watchdog/WatchdogCli.cs b/src/Agent.Watchdog/WatchdogCli.cs index 79b0da0..c57c829 100644 --- a/src/Agent.Watchdog/WatchdogCli.cs +++ b/src/Agent.Watchdog/WatchdogCli.cs @@ -1,7 +1,10 @@ using System.Globalization; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using System.ServiceProcess; +using Agent.Watchdog.Msi; using Agent.Watchdog.Platform; +using Shared.Contracts.Models; using Shared.Infrastructure.Constants; namespace Agent.Watchdog; @@ -53,6 +56,10 @@ public static class WatchdogCli && int.TryParse(args[1], NumberStyles.None, CultureInfo.InvariantCulture, out var processId): return WindowsWatchdogRegistration.RestartAfterExit(processId); + case WatchdogMsiFiles.RunVerb when OperatingSystem.IsWindows() && args.Length > 1 + && Guid.TryParse(args[1], out var upgradeId): + return await RunMsiAsync(upgradeId, args[2..]); + case null or "help" or "-h" or "--help" or "/?": PrintUsage(); return command is null ? 1 : 0; @@ -129,7 +136,9 @@ public static class WatchdogCli : new UnixWatchdogRestart(log); var clock = SystemClock.Instance; - var applier = new UpgradeApplier(options, agent, clock, log, new ProcessSmokeTest(), restart); + var msi = new MsiUpgrade(options, OperatingSystem.IsWindows() && !processMode ? new WindowsMsiRunnerLauncher(options, log) : null, + agent, clock, log); + var applier = new UpgradeApplier(options, agent, clock, log, new ProcessSmokeTest(), restart, msi); var supervisor = new AgentSupervisor(options, agent, clock, log); var service = new WatchdogService(options, applier, supervisor, clock, log); @@ -168,6 +177,24 @@ public static class WatchdogCli } } + /// + /// Hidden: the detached MSI runner, started by the watchdog from its copy in + /// upgrade/msi/runner/ (see ). It logs to its own + /// file (the watchdog service writes the main one meanwhile). + /// + [SupportedOSPlatform("windows")] + private static async Task RunMsiAsync(Guid upgradeId, string[] args) + { + var (options, _) = ParseOptions(args); + options = options with { SelfPath = null }; + var log = new WatchdogLog(options.LogDirectory, console: false, name: "ExecuteR-Watchdog-msi"); + var agent = new WindowsAgentService(Branding.AgentServiceName, Path.Combine(options.InstallDirectory, options.AgentExecutable), log); + var watchdog = new WindowsAgentService(Branding.WatchdogServiceName, + Path.Combine(options.InstallDirectory, Branding.WatchdogExecutableName), log); + var runner = new MsiRunner(options, agent, watchdog, new WindowsInstallerApi(), SystemClock.Instance, log); + return await runner.RunAsync(upgradeId, CancellationToken.None); + } + private static void PrintUsage() { Console.WriteLine($"{Branding.WatchdogServiceDisplayName} {WatchdogVersion.Current}"); diff --git a/src/Agent.Watchdog/WatchdogOptions.cs b/src/Agent.Watchdog/WatchdogOptions.cs index e1a0057..9a02f8e 100644 --- a/src/Agent.Watchdog/WatchdogOptions.cs +++ b/src/Agent.Watchdog/WatchdogOptions.cs @@ -52,4 +52,18 @@ public sealed record WatchdogOptions public string JournalPath => Path.Combine(UpgradeDirectory, WatchdogFiles.Journal); public string OutcomePath => Path.Combine(UpgradeDirectory, WatchdogFiles.Outcome); + + /// MSI upgrades: upgrade/msi/, where the MSIs the agent hands over lie. + public string MsiDirectory => Path.Combine(UpgradeDirectory, WatchdogFiles.MsiFolder); + + /// The runner's copy of the watchdog binary (the MSI replaces the installed one while it runs). + public string MsiRunnerDirectory => Path.Combine(MsiDirectory, WatchdogMsiFiles.RunnerFolder); + + public string MsiJournalPath => Path.Combine(UpgradeDirectory, WatchdogFiles.MsiJournal); + + public string MsiRunnerLockPath => Path.Combine(UpgradeDirectory, WatchdogMsiFiles.RunnerLock); + + /// Windows Installer's verbose log of one MSI run, beside the agent's own logs. + public string MsiLogPath(string version, Guid upgradeId) + => Path.Combine(LogDirectory, $"agent-msi-{version.Split('+')[0]}-{upgradeId:N}.log"); } -- 2.52.0 From ceac8d1d1abbd5e18eeac6d555e5b2a2d1c83818ab46296777bd46a6f4c65020 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:19:59 -0400 Subject: [PATCH 05/26] test: the MSI runner's exit codes, busy retries, rollback and recovery A fake Windows Installer seam (the three msi.dll calls) and the fake clock and agent drive the runner: silent UI and the verbose log per install, 0/3010/1641 as installed, 1618 retried every 30 s and given up as installer-busy after ten minutes, other codes and a hung install as failed/msi, an unhealthy version reinstalled from the previous MSI with ALLOWDOWNGRADE=1 into its own log, the no-rollback failure, console rollbacks, the runner lock, and the watchdog leaving a live runner alone, resuming a dead one and giving up after three. Co-Authored-By: Claude Opus 5.5 --- tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs | 557 ++++++++++++++++++ 1 file changed, 557 insertions(+) create mode 100644 tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs diff --git a/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs b/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs new file mode 100644 index 0000000..86ce4cf --- /dev/null +++ b/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs @@ -0,0 +1,557 @@ +using System.Security.Cryptography; +using System.Text; +using Agent.Watchdog.Msi; +using Shared.Contracts.Models; +using Shared.Contracts.Serialization; +using Xunit; + +namespace Agent.Watchdog.Tests; + +/// +/// Windows Installer as the runner sees it. A successful install "installs" the +/// package's version (the agent binary says it) and, as the MSI's +/// ServiceControl does, stops and starts the agent; each answer comes from +/// , by package and attempt. +/// +public sealed class FakeWindowsInstaller(WatchdogFixture fixture) : IWindowsInstaller +{ + public List<(string Package, string CommandLine, string Log)> Installs { get; } = []; + public int SilentCalls { get; private set; } + public string? CurrentLog { get; private set; } + + /// Windows Installer's answer for a package (by its version) and attempt; 0 by default. + public Func Answer { get; set; } = (_, _) => MsiExitCodes.Success; + + /// Set to block every install until released (a hung Windows Installer). + public ManualResetEventSlim? Block { get; set; } + + public void SetSilentUI() => SilentCalls++; + + public void EnableLog(string logPath) + { + CurrentLog = logPath; + Directory.CreateDirectory(Path.GetDirectoryName(logPath)!); + File.AppendAllText(logPath, "=== Verbose logging started ===\r\nMSI (s) (00:00) [12:00:00:000]: Product: ExecuteR Agent -- done.\r\n", Encoding.Unicode); + } + + public int InstallProduct(string package, string commandLine) + { + Block?.Wait(TimeSpan.FromSeconds(30)); + Installs.Add((package, commandLine, CurrentLog!)); + var version = File.ReadAllText(package)["msi ".Length..]; + var code = Answer(version, Installs.Count(i => i.Package == package)); + if (MsiExitCodes.Succeeded(code)) + { + fixture.Agent.StopAsync(CancellationToken.None).GetAwaiter().GetResult(); + fixture.WriteInstalled(WatchdogFixture.AgentExe, $"agent {version}"); + fixture.Agent.StartAsync(CancellationToken.None).GetAwaiter().GetResult(); + } + + return code; + } +} + +public sealed class FakeLauncher : IMsiRunnerLauncher +{ + public List Launches { get; } = []; + public string? Problem { get; set; } + + public string? Launch(Guid upgradeId) + { + Launches.Add(upgradeId); + return Problem; + } +} + +/// The watchdog's own service, for the runner to leave running. +public sealed class FakeService : IAgentService +{ + public bool Running { get; set; } = true; + public int Starts { get; private set; } + + public Task QueryAsync(CancellationToken cancellationToken) + => Task.FromResult(new AgentServiceStatus(Running ? AgentRunState.Running : AgentRunState.Stopped, true, false)); + + public Task StartAsync(CancellationToken cancellationToken) + { + Starts++; + Running = true; + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + Running = false; + return Task.CompletedTask; + } +} + +public sealed class MsiUpgradeTests : IDisposable +{ + private readonly WatchdogFixture fixture = new(); + private readonly FakeLauncher launcher = new(); + private readonly FakeService watchdogService = new(); + private readonly FakeWindowsInstaller installer; + + public MsiUpgradeTests() + { + installer = new FakeWindowsInstaller(fixture); + } + + public void Dispose() => fixture.Dispose(); + + private WatchdogOptions Options => fixture.Options; + + private MsiUpgrade CreateMsiUpgrade() => new(Options, launcher, fixture.Agent, fixture.Clock, fixture.Log); + + private MsiRunner CreateRunner(MsiRunnerSettings? settings = null) + => new(Options, fixture.Agent, watchdogService, installer, fixture.Clock, fixture.Log, settings); + + /// An MSI "of a version" in upgrade/msi/ (its content names the version), as the agent leaves it. + private WatchdogFile Msi(string version, string? folder = null) + { + var directory = folder is null ? Options.MsiDirectory : Path.Combine(Options.MsiDirectory, folder); + Directory.CreateDirectory(directory); + var path = Path.Combine(directory, $"ExecuteR-Agent-{version}.msi"); + File.WriteAllText(path, $"msi {version}"); + return new WatchdogFile(path, new FileInfo(path).Length, Convert.ToHexStringLower(SHA256.HashData(File.ReadAllBytes(path)))); + } + + private WatchdogHandover HandOver(bool rollback = true, bool revert = false, WatchdogFile? msi = null) + { + var handover = new WatchdogHandover(Guid.NewGuid(), WatchdogFixture.ToVersion, WatchdogFixture.FromVersion, Options.MsiDirectory, [], 600, + revert, fixture.Clock.UtcNow, WatchdogHandoverKinds.Msi, + msi ?? Msi(WatchdogFixture.ToVersion), + rollback ? Msi(WatchdogFixture.FromVersion, WatchdogMsiFiles.RollbackFolder) : null, + rollback ? WatchdogFixture.FromVersion : null); + WatchdogFileStore.Write(Options.HandoverPath, handover, WatchdogJsonContext.Default.WatchdogHandover); + return handover; + } + + private WatchdogMsiJournal Journal(string phase = WatchdogMsiPhases.Installing, bool rollback = true, bool revert = false, int resumes = 0) + { + var journal = new WatchdogMsiJournal(Guid.NewGuid(), WatchdogFixture.ToVersion, WatchdogFixture.FromVersion, phase, + Msi(WatchdogFixture.ToVersion), + rollback ? Msi(WatchdogFixture.FromVersion, WatchdogMsiFiles.RollbackFolder) : null, + rollback ? WatchdogFixture.FromVersion : null, + HealthDeadlineSeconds: 600, RunnerProcessId: 0, Attempts: 0, LastExitCode: null, fixture.Clock.UtcNow, + DeadlineUtc: phase == WatchdogMsiPhases.Verifying ? fixture.Clock.UtcNow.AddMinutes(10) : null, revert, resumes); + WatchdogFileStore.Write(Options.MsiJournalPath, journal, WatchdogJsonContext.Default.WatchdogMsiJournal); + return journal; + } + + private WatchdogMsiJournal? ReadJournal() => MsiUpgrade.ReadJournal(Options); + + private void AssertRunEnded() + { + Assert.False(File.Exists(Options.MsiJournalPath)); + Assert.Empty(Directory.EnumerateFiles(Options.MsiDirectory, "*.msi", SearchOption.AllDirectories)); + Assert.True(fixture.Agent.Running); + Assert.True(watchdogService.Running); + } + + // ---- the watchdog takes the hand-over ---------------------------------- + + [Fact] + public async Task AnMsiHandOverIsJournalledAndGivenToTheDetachedRunnerWithoutSwappingAFile() + { + var handover = HandOver(); + var before = fixture.InstalledFiles(); + var applier = new UpgradeApplier(Options, fixture.Agent, fixture.Clock, fixture.Log, msi: CreateMsiUpgrade()); + + Assert.Equal(PassResult.Worked, await applier.PassAsync(CancellationToken.None)); + + Assert.Equal([handover.UpgradeId], launcher.Launches); + Assert.False(File.Exists(Options.HandoverPath)); + Assert.False(File.Exists(Options.JournalPath)); + var journal = ReadJournal(); + Assert.NotNull(journal); + Assert.Equal(WatchdogMsiPhases.Installing, journal.Phase); + Assert.Equal(handover.Msi, journal.Msi); + Assert.Equal(handover.RollbackMsi, journal.RollbackMsi); + Assert.Equal(WatchdogFixture.FromVersion, journal.RollbackVersion); + + // Nothing was swapped and the agent was not touched: the MSI does that. + Assert.Equal(before, fixture.InstalledFiles()); + Assert.Equal(0, fixture.Agent.Stops); + Assert.True(applier.Pending); + } + + [Fact] + public async Task AnMsiThatDoesNotMatchItsHashEndsTheRunBeforeAnythingStarts() + { + var msi = Msi(WatchdogFixture.ToVersion); + HandOver(msi: msi with { Sha256 = new string('0', 64) }); + + await new UpgradeApplier(Options, fixture.Agent, fixture.Clock, fixture.Log, msi: CreateMsiUpgrade()).PassAsync(CancellationToken.None); + + Assert.Empty(launcher.Launches); + Assert.False(File.Exists(Options.MsiJournalPath)); + Assert.Equal(AgentUpgradeStates.Failed, fixture.Outcome!.Result); + Assert.Equal(AgentUpgradeReasons.Hash, fixture.Outcome!.Reason); + } + + [Fact] + public async Task AnMsiOutsideTheUpgradeFolderIsRefused() + { + var outside = Path.Combine(fixture.Data, "elsewhere.msi"); + File.WriteAllText(outside, $"msi {WatchdogFixture.ToVersion}"); + HandOver(msi: new WatchdogFile(outside, new FileInfo(outside).Length, Convert.ToHexStringLower(SHA256.HashData(File.ReadAllBytes(outside))))); + + await CreateMsiUpgrade().StartAsync(WatchdogFileStore.Read(Options.HandoverPath, WatchdogJsonContext.Default.WatchdogHandover)!, CancellationToken.None); + + Assert.Empty(launcher.Launches); + Assert.Equal(AgentUpgradeReasons.Package, fixture.Outcome!.Reason); + } + + [Fact] + public async Task ARollbackMsiThatDoesNotCheckOutIsDroppedAndTheUpgradeGoesOn() + { + var handover = HandOver(); + File.AppendAllText(handover.RollbackMsi!.Path, "tampered"); + + await CreateMsiUpgrade().StartAsync(handover, CancellationToken.None); + + Assert.Single(launcher.Launches); + Assert.Null(ReadJournal()!.RollbackMsi); + } + + [Fact] + public async Task ARunnerThatCannotBeStartedEndsTheRunWithTheAgentRunning() + { + launcher.Problem = "the runner did not start"; + fixture.Agent.Running = false; + + await CreateMsiUpgrade().StartAsync(HandOver(), CancellationToken.None); + + Assert.Equal(AgentUpgradeReasons.Watchdog, fixture.Outcome!.Reason); + Assert.False(File.Exists(Options.MsiJournalPath)); + Assert.True(fixture.Agent.Running); + } + + [Fact] + public async Task WhileAnMsiRunIsPendingTheAgentIsNeitherSupervisedNorStarted() + { + Journal(); + using var runner = MsiRunLock.TryHold(Options.MsiRunnerLockPath); + fixture.Agent.Running = false; + fixture.Agent.StoppedWithFailure = true; + var applier = fixture.CreateApplier(); + var withMsi = new UpgradeApplier(Options, fixture.Agent, fixture.Clock, fixture.Log, msi: CreateMsiUpgrade()); + + Assert.Equal(PassResult.Worked, await withMsi.PassAsync(CancellationToken.None)); + Assert.Equal(PassResult.Worked, await applier.PassAsync(CancellationToken.None)); + Assert.Equal(PassResult.Worked, await withMsi.RecoverAsync(CancellationToken.None)); + + Assert.Equal(0, fixture.Agent.Starts); + Assert.Empty(launcher.Launches); + } + + // ---- the runner -------------------------------------------------------- + + [Fact] + public async Task InstallsInProcessSilentlyWithAVerboseLogAndKeepsAHealthyNewVersion() + { + var journal = Journal(); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + var install = Assert.Single(installer.Installs); + Assert.Equal(journal.Msi.Path, install.Package); + Assert.Equal("REBOOT=ReallySuppress", install.CommandLine); + Assert.Equal(Path.Combine(fixture.Install, "Logs", $"agent-msi-{WatchdogFixture.ToVersion}-{journal.UpgradeId:N}.log"), install.Log); + Assert.Equal(1, installer.SilentCalls); + + var outcome = fixture.Outcome!; + Assert.Equal(AgentUpgradeStates.Succeeded, outcome.Result); + Assert.Null(outcome.Reason); + Assert.Equal(WatchdogFixture.ToVersion, outcome.Version); + Assert.Equal(WatchdogFixture.FromVersion, outcome.FromVersion); + Assert.Equal($"agent {WatchdogFixture.ToVersion}", fixture.ReadInstalled(WatchdogFixture.AgentExe)); + AssertRunEnded(); + } + + [Theory] + [InlineData(MsiExitCodes.SuccessRebootRequired)] + [InlineData(MsiExitCodes.SuccessRebootInitiated)] + public async Task RestartCodesCountAsInstalled(int code) + { + installer.Answer = (_, _) => code; + var journal = Journal(); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Equal(AgentUpgradeStates.Succeeded, fixture.Outcome!.Result); + } + + [Fact] + public async Task ABusyWindowsInstallerIsTriedAgainEvery30Seconds() + { + installer.Answer = (_, attempt) => attempt < 3 ? MsiExitCodes.InstallerBusy : MsiExitCodes.Success; + var journal = Journal(); + var started = fixture.Clock.UtcNow; + var attempts = new List(); + fixture.Clock.Advanced += () => attempts.Add(ReadJournal()?.Attempts ?? -1); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Equal(3, installer.Installs.Count); + Assert.Equal([1, 2], attempts.Take(2)); + Assert.True(fixture.Clock.UtcNow - started >= TimeSpan.FromSeconds(60)); + Assert.Equal(AgentUpgradeStates.Succeeded, fixture.Outcome!.Result); + } + + [Fact] + public async Task AWindowsInstallerBusyThroughEveryRetryFailsAsInstallerBusy() + { + installer.Answer = (_, _) => MsiExitCodes.InstallerBusy; + var journal = Journal(); + var started = fixture.Clock.UtcNow; + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + var outcome = fixture.Outcome!; + Assert.Equal(AgentUpgradeStates.Failed, outcome.Result); + Assert.Equal(AgentUpgradeReasons.InstallerBusy, outcome.Reason); + Assert.InRange(installer.Installs.Count, 20, 21); + Assert.InRange(fixture.Clock.UtcNow - started, TimeSpan.FromMinutes(9.5), TimeSpan.FromMinutes(10)); + Assert.Equal($"agent {WatchdogFixture.FromVersion}", fixture.ReadInstalled(WatchdogFixture.AgentExe)); + AssertRunEnded(); + } + + [Theory] + [InlineData(MsiExitCodes.InstallFailure)] + [InlineData(MsiExitCodes.ProductVersion)] + [InlineData(MsiExitCodes.UserExit)] + public async Task AnyOtherAnswerFailsAsMsiWithItsCodeAndLog(int code) + { + installer.Answer = (_, _) => code; + fixture.Agent.Running = false; // the MSI stopped it before it failed + var journal = Journal(); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + var outcome = fixture.Outcome!; + Assert.Equal(AgentUpgradeStates.Failed, outcome.Result); + Assert.Equal(AgentUpgradeReasons.Msi, outcome.Reason); + Assert.Contains(code.ToString(System.Globalization.CultureInfo.InvariantCulture), outcome.Detail, StringComparison.Ordinal); + Assert.Contains(Options.MsiLogPath(WatchdogFixture.ToVersion, journal.UpgradeId), outcome.Detail, StringComparison.Ordinal); + Assert.Contains(outcome.LastLog, l => l.Contains("Verbose logging started", StringComparison.Ordinal)); + Assert.Single(installer.Installs); + AssertRunEnded(); + } + + [Fact] + public async Task AnInstallWithoutAnAnswerWithinTheTimeoutFailsAsMsi() + { + using var block = new ManualResetEventSlim(false); + installer.Block = block; + var journal = Journal(); + + try + { + await CreateRunner(new MsiRunnerSettings { InstallTimeout = TimeSpan.FromMilliseconds(200) }).RunAsync(journal.UpgradeId, CancellationToken.None); + } + finally + { + block.Set(); + } + + Assert.Equal(AgentUpgradeStates.Failed, fixture.Outcome!.Result); + Assert.Equal(AgentUpgradeReasons.Msi, fixture.Outcome!.Reason); + Assert.Contains("did not finish", fixture.Outcome!.Detail, StringComparison.Ordinal); + Assert.False(File.Exists(Options.MsiJournalPath)); + } + + [Fact] + public async Task ANewVersionThatIsNotHealthyIsRolledBackByTheMsiOfThePreviousOne() + { + fixture.Agent.Behave = version => version == WatchdogFixture.ToVersion ? AgentBehavior.Unconnected : AgentBehavior.Healthy; + fixture.WriteInstalled("Logs/ExecuteR-Agent-20261024.log", "new agent: could not connect\n"); + var journal = Journal(); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Equal(2, installer.Installs.Count); + var rollback = installer.Installs[1]; + Assert.Equal(journal.RollbackMsi!.Path, rollback.Package); + Assert.Equal("REBOOT=ReallySuppress ALLOWDOWNGRADE=1", rollback.CommandLine); + Assert.Equal(Options.MsiLogPath(WatchdogFixture.FromVersion, journal.UpgradeId), rollback.Log); + Assert.NotEqual(installer.Installs[0].Log, rollback.Log); + + var outcome = fixture.Outcome!; + Assert.Equal(AgentUpgradeStates.RolledBack, outcome.Result); + Assert.Equal(AgentUpgradeReasons.HealthDeadline, outcome.Reason); + Assert.Contains("new agent: could not connect", outcome.LastLog); + Assert.Equal($"agent {WatchdogFixture.FromVersion}", fixture.ReadInstalled(WatchdogFixture.AgentExe)); + AssertRunEnded(); + } + + [Fact] + public async Task WithoutAnMsiToGoBackToAnUnhealthyNewVersionStaysAndTheRunFails() + { + fixture.Agent.Behave = version => version == WatchdogFixture.ToVersion ? AgentBehavior.Silent : AgentBehavior.Healthy; + var journal = Journal(rollback: false); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Single(installer.Installs); + var outcome = fixture.Outcome!; + Assert.Equal(AgentUpgradeStates.Failed, outcome.Result); + Assert.Equal(AgentUpgradeReasons.HealthDeadline, outcome.Reason); + Assert.Contains($"no MSI of {WatchdogFixture.FromVersion} was kept to go back to", outcome.Detail, StringComparison.Ordinal); + Assert.Equal($"agent {WatchdogFixture.ToVersion}", fixture.ReadInstalled(WatchdogFixture.AgentExe)); + AssertRunEnded(); + } + + [Fact] + public async Task ARollbackFromTheConsoleInstallsWithAllowDowngradeFromTheStart() + { + var journal = Journal(revert: true); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Equal("REBOOT=ReallySuppress ALLOWDOWNGRADE=1", Assert.Single(installer.Installs).CommandLine); + Assert.Equal(AgentUpgradeStates.Succeeded, fixture.Outcome!.Result); + } + + [Fact] + public async Task AnMsiChangedSinceTheHandOverIsNotInstalled() + { + var journal = Journal(); + File.AppendAllText(journal.Msi.Path, "changed"); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Empty(installer.Installs); + Assert.Equal(AgentUpgradeReasons.Hash, fixture.Outcome!.Reason); + } + + [Fact] + public async Task ASecondRunnerLeavesTheRunToTheOneHoldingTheLock() + { + var journal = Journal(); + using var first = MsiRunLock.TryHold(Options.MsiRunnerLockPath); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Empty(installer.Installs); + Assert.Equal(WatchdogMsiPhases.Installing, ReadJournal()!.Phase); + } + + [Fact] + public async Task TheRunnerRecordsItsProcessAndHoldsTheLockWhileItRuns() + { + var journal = Journal(); + var held = false; + int? owner = null; + installer.Answer = (_, _) => + { + held = MsiRunLock.IsHeld(Options.MsiRunnerLockPath); + owner = ReadJournal()?.RunnerProcessId; + return MsiExitCodes.Success; + }; + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.True(held); + Assert.Equal(Environment.ProcessId, owner); + Assert.False(MsiRunLock.IsHeld(Options.MsiRunnerLockPath)); + } + + // ---- recovery ---------------------------------------------------------- + + [Fact] + public async Task ALiveRunnerIsLeftAlone() + { + Journal(); + using var runner = MsiRunLock.TryHold(Options.MsiRunnerLockPath); + + await CreateMsiUpgrade().CheckAsync(CancellationToken.None); + + Assert.Empty(launcher.Launches); + Assert.Equal(0, ReadJournal()!.Resumes); + } + + [Fact] + public async Task ADeadRunnerIsStartedAgainFromTheJournal() + { + var journal = Journal(); + + await CreateMsiUpgrade().CheckAsync(CancellationToken.None); + + Assert.Equal([journal.UpgradeId], launcher.Launches); + Assert.Equal(WatchdogMsiPhases.Installing, ReadJournal()!.Phase); + Assert.Equal(1, ReadJournal()!.Resumes); + } + + [Fact] + public async Task ARunnerThatDiedInstallingAVersionNowHealthyGoesOnFromVerifying() + { + var journal = Journal(); + fixture.WriteBeacon(WatchdogFixture.ToVersion, connected: true); + + await CreateMsiUpgrade().CheckAsync(CancellationToken.None); + + Assert.Single(launcher.Launches); + Assert.Equal(WatchdogMsiPhases.Verifying, ReadJournal()!.Phase); + + // The resumed runner sees it healthy and installs nothing again. + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + Assert.Empty(installer.Installs); + Assert.Equal(AgentUpgradeStates.Succeeded, fixture.Outcome!.Result); + } + + [Fact] + public async Task ARunnerThatKeepsDyingIsGivenUpWithTheAgentRunning() + { + Journal(resumes: MsiUpgrade.MaxResumes); + fixture.Agent.Running = false; + + await CreateMsiUpgrade().CheckAsync(CancellationToken.None); + + Assert.Empty(launcher.Launches); + Assert.Equal(AgentUpgradeStates.Failed, fixture.Outcome!.Result); + Assert.Equal(AgentUpgradeReasons.Msi, fixture.Outcome!.Reason); + Assert.False(File.Exists(Options.MsiJournalPath)); + Assert.True(fixture.Agent.Running); + } + + [Fact] + public async Task AResumedRollbackInstallsThePreviousMsiAgain() + { + var journal = Journal(WatchdogMsiPhases.RollingBack); + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + Assert.Equal(journal.RollbackMsi!.Path, Assert.Single(installer.Installs).Package); + Assert.Equal(AgentUpgradeStates.RolledBack, fixture.Outcome!.Result); + } + + [Fact] + public void ExitCodesThatMeanInstalled() + { + Assert.True(MsiExitCodes.Succeeded(0)); + Assert.True(MsiExitCodes.Succeeded(3010)); + Assert.True(MsiExitCodes.Succeeded(1641)); + Assert.False(MsiExitCodes.Succeeded(1618)); + Assert.False(MsiExitCodes.Succeeded(1603)); + } + + [Fact] + public void TheLogModeIsMsiexecsVerboseEverything() + => Assert.Equal(0x1FDFu, WindowsInstallerApi.LogEverythingVerbose); + + [Theory] + [InlineData(new[] { "msi-run", "id" }, "exe msi-run id")] + [InlineData(new[] { "--data-dir", @"C:\Program Data\ExecuteR" }, @"exe --data-dir ""C:\Program Data\ExecuteR""")] + [InlineData(new[] { @"C:\trailing slash\" }, @"exe ""C:\trailing slash\\""")] + [InlineData(new[] { "" }, @"exe """"")] + public void TheRunnerCommandLineQuotesWhatNeedsQuoting(string[] arguments, string expected) + { + if (OperatingSystem.IsWindows()) + { + Assert.Equal(expected, DetachedProcess.BuildCommandLine("exe", arguments)); + } + } +} -- 2.52.0 From b3675112bec0c6129a8e0c3d94291ce9ceb4dd525cf78244639d9fea6a5e2751 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:22:36 -0400 Subject: [PATCH 06/26] test: the agent's MSI upgrade, rollback MSI and kept packages An MSI install hands the MSI over with the kept MSI of its version (or the server's, downloaded, checked and kept; or none, said so), keeps what it brought, refuses the zip, and is refused by a portable install; a kept MSI whose bytes are not its folder's hash is not used; an MSI of another version or not the agent's fails as package; msi.json makes it busy; kept packages stay at the newest three plus those still needed. The outcome reporter passes an MSI run's own detail on. Co-Authored-By: Claude Opus 5.5 --- tests/Agent.Tests/AgentMsiUpgradeTests.cs | 269 ++++++++++++++++++ .../UpgradeOutcomeReporterTests.cs | 21 ++ 2 files changed, 290 insertions(+) create mode 100644 tests/Agent.Tests/AgentMsiUpgradeTests.cs diff --git a/tests/Agent.Tests/AgentMsiUpgradeTests.cs b/tests/Agent.Tests/AgentMsiUpgradeTests.cs new file mode 100644 index 0000000..d41c8ef --- /dev/null +++ b/tests/Agent.Tests/AgentMsiUpgradeTests.cs @@ -0,0 +1,269 @@ +using System.Net; +using System.Security.Cryptography; +using System.Text; +using Agent.Upgrade; +using Microsoft.Extensions.Logging.Abstractions; +using Shared.Contracts.Messages; +using Shared.Contracts.Models; +using Shared.Contracts.Serialization; +using Shared.Infrastructure.Routing; +using Xunit; + +namespace Agent.Tests; + +/// An MSI is a file whose text is "msi <version>"; anything else is not the agent's MSI. +internal sealed class FakeMsiInspector : IMsiInspector +{ + public string Install { get; set; } = AgentInstallKinds.Msi; + + public string DetectInstall(string installDirectory) => Install; + + public string? ReadAgentVersion(string msiPath) + { + var text = File.Exists(msiPath) ? File.ReadAllText(msiPath) : ""; + return text.StartsWith("msi ", StringComparison.Ordinal) ? text["msi ".Length..] : null; + } +} + +public sealed class AgentMsiUpgradeTests : IDisposable +{ + private const string Current = "1.3.0"; + private const string Target = "1.4.0"; + private const string MsiUrl = "/api/agent/packages/by-sha/target"; + private const string RollbackUrl = "/api/agent/packages/by-sha/rollback"; + + private readonly string root = Path.Combine(Path.GetTempPath(), "executer-msi-upgrade-tests", Guid.NewGuid().ToString("N")); + private readonly UpgradeFolders folders; + private readonly RecordingEvents events = new(); + private readonly FakeWatchdog watchdog = new(); + private readonly FakeMsiInspector inspector = new(); + private readonly List requests = []; + private byte[] target = Encoding.UTF8.GetBytes($"msi {Target}"); + private readonly byte[] previous = Encoding.UTF8.GetBytes($"msi {Current}"); + private WatchdogHandover? handedOver; + + public AgentMsiUpgradeTests() + { + folders = new UpgradeFolders(Path.Combine(root, "data"), Path.Combine(root, "install")); + Directory.CreateDirectory(folders.InstallDirectory); + } + + public void Dispose() + { + try + { + Directory.Delete(root, recursive: true); + } + catch (IOException) + { + } + } + + private static string Sha(byte[] bytes) => Convert.ToHexStringLower(SHA256.HashData(bytes)); + + private AgentUpgradeHandler CreateHandler(string install = AgentInstallKinds.Msi) + { + inspector.Install = install; + return new AgentUpgradeHandler(new AgentUpgradeContext + { + Folders = folders, + ClientId = "client-1", + CurrentVersion = Current, + RuntimeIdentifier = "win-x64", + CanSelfUpgrade = true, + InstallKind = install, + MsiInspector = inspector, + ServerUrl = ServerUrl.Parse("https://control.example.com"), + CreateHttpHandler = () => new Stub(request => + { + var path = request.RequestUri!.AbsolutePath; + requests.Add(path); + return new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new ByteArrayContent(path.EndsWith("rollback", StringComparison.Ordinal) ? previous : target), + }; + }), + Delay = (_, _) => + { + // The watchdog takes the hand-over at its first look. + handedOver ??= WatchdogFileStore.Read(folders.Handover, WatchdogJsonContext.Default.WatchdogHandover); + File.Delete(folders.Handover); + return Task.CompletedTask; + }, + RandomMilliseconds = max => max, + Gate = new UpgradeGate(), + }, events, watchdog, NullLogger.Instance); + } + + private AgentUpgradeCommandPayload Command(bool rollbackFields = false, string packageType = AgentPackageTypes.Msi) + => new(Guid.NewGuid(), Target, packageType, MsiUrl, Sha(target), target.Length, Revert: false, HealthDeadlineSeconds: 600, + RollbackVersion: rollbackFields ? Current : null, + RollbackDownloadUrl: rollbackFields ? RollbackUrl : null, + RollbackSha256: rollbackFields ? Sha(previous) : null, + RollbackSizeBytes: rollbackFields ? previous.Length : null); + + /// The MSI the device was installed from, as the installer's KeepInstallerPackage leaves it (no description file). + private string KeepInstalled(byte[] bytes, string? folderName = null) + { + var folder = Path.Combine(folders.KeptPackages, folderName ?? Sha(bytes)); + Directory.CreateDirectory(folder); + var path = Path.Combine(folder, "ExecuteR-Agent.msi"); + File.WriteAllBytes(path, bytes); + return path; + } + + private AgentUpgradeEventPayload Last => events.Published[^1]; + + [Fact] + public async Task AnMsiInstallHandsTheMsiOverWithTheKeptMsiOfItsVersionToRollBackTo() + { + KeepInstalled(previous); + var command = Command(); + + await CreateHandler().RunAsync(command, CancellationToken.None); + + Assert.Equal([MsiUrl], requests); + Assert.Equal(AgentUpgradeStates.Installing, Last.State); + Assert.NotNull(handedOver); + Assert.Equal(WatchdogHandoverKinds.Msi, handedOver.Kind); + Assert.Empty(handedOver.Files); + Assert.Equal(Current, handedOver.FromVersion); + + var msi = handedOver.Msi!; + Assert.Equal(Path.Combine(folders.Msi, "ExecuteR-Agent-1.4.0.msi"), msi.Path); + Assert.True(Path.IsPathFullyQualified(msi.Path)); + Assert.Equal(Sha(target), msi.Sha256); + Assert.Equal(target.Length, msi.Size); + + var rollback = handedOver.RollbackMsi!; + Assert.Equal(Path.Combine(folders.MsiRollback, "ExecuteR-Agent-1.3.0.msi"), rollback.Path); + Assert.Equal(Sha(previous), rollback.Sha256); + Assert.Equal(previous, File.ReadAllBytes(rollback.Path)); + Assert.Equal(Current, handedOver.RollbackVersion); + + // The MSI the upgrade brought is kept for the next one's rollback. + Assert.Equal(target, File.ReadAllBytes(Path.Combine(folders.KeptPackages, Sha(target), "ExecuteR-Agent-1.4.0.msi"))); + Assert.Equal(folders.Msi, watchdog.EnsuredFor); + } + + [Fact] + public async Task WithoutAKeptMsiTheServersMsiOfTheRunningVersionIsDownloadedCheckedAndKept() + { + await CreateHandler().RunAsync(Command(rollbackFields: true), CancellationToken.None); + + Assert.Equal([MsiUrl, RollbackUrl], requests); + Assert.Equal(Sha(previous), handedOver!.RollbackMsi!.Sha256); + Assert.Equal(Current, handedOver.RollbackVersion); + Assert.True(File.Exists(Path.Combine(folders.KeptPackages, Sha(previous), "ExecuteR-Agent-1.3.0.msi"))); + } + + [Fact] + public async Task WithNoMsiToGoBackToTheUpgradeGoesOnAndSaysItCannotRollBack() + { + await CreateHandler().RunAsync(Command(), CancellationToken.None); + + Assert.NotNull(handedOver); + Assert.Null(handedOver.RollbackMsi); + Assert.Null(handedOver.RollbackVersion); + Assert.Equal(AgentUpgradeStates.Installing, Last.State); + Assert.Contains("cannot be rolled back automatically", Last.Detail, StringComparison.Ordinal); + } + + [Fact] + public async Task AKeptMsiWhoseBytesDoNotMatchItsFolderIsNotUsed() + { + KeepInstalled(previous, folderName: new string('a', 64)); + + await CreateHandler().RunAsync(Command(rollbackFields: true), CancellationToken.None); + + Assert.Equal([MsiUrl, RollbackUrl], requests); + Assert.NotNull(handedOver!.RollbackMsi); + } + + [Fact] + public async Task APortableInstallRefusesTheMsi() + { + await CreateHandler(AgentInstallKinds.Portable).RunAsync(Command(), CancellationToken.None); + + Assert.Equal(AgentUpgradeStates.Failed, Last.State); + Assert.Equal(AgentUpgradeReasons.Unsupported, Last.Reason); + Assert.Empty(requests); + } + + [Fact] + public async Task AnMsiInstallRefusesThePortableZip() + { + await CreateHandler().RunAsync(Command(packageType: AgentPackageTypes.WindowsZip), CancellationToken.None); + + Assert.Equal(AgentUpgradeReasons.Unsupported, Last.Reason); + Assert.Contains("through the MSI", Last.Detail, StringComparison.Ordinal); + Assert.Empty(requests); + } + + [Fact] + public async Task AnMsiOfAnotherVersionFailsAsPackage() + { + target = Encoding.UTF8.GetBytes("msi 1.5.0"); + + await CreateHandler().RunAsync(Command(), CancellationToken.None); + + Assert.Equal(AgentUpgradeReasons.Package, Last.Reason); + Assert.Null(handedOver); + } + + [Fact] + public async Task APackageThatIsNotTheAgentsMsiFailsAsPackage() + { + target = Encoding.UTF8.GetBytes("PK zip bytes"); + + await CreateHandler().RunAsync(Command(), CancellationToken.None); + + Assert.Equal(AgentUpgradeReasons.Package, Last.Reason); + Assert.False(File.Exists(folders.Handover)); + } + + [Fact] + public async Task AnMsiRunUnderWayMakesTheAgentBusy() + { + Directory.CreateDirectory(folders.Root); + File.WriteAllText(folders.MsiJournal, "{}"); + + await CreateHandler().RunAsync(Command(), CancellationToken.None); + + Assert.Equal(AgentUpgradeReasons.Busy, Last.Reason); + Assert.Empty(requests); + } + + [Fact] + public void KeptPackagesStayAtTheNewestThreePlusTheOnesStillNeeded() + { + var kept = new KeptMsiPackages(folders.KeptPackages, inspector, NullLogger.Instance); + var source = Path.Combine(root, "source.msi"); + var start = DateTime.UtcNow.AddHours(-10); + string[] versions = ["1.0.0", "1.1.0", "1.2.0", Current, Target]; + for (var i = 0; i < versions.Length; i++) + { + var bytes = Encoding.UTF8.GetBytes($"msi {versions[i]}"); + File.WriteAllBytes(source, bytes); + kept.Keep(source, Sha(bytes), versions[i], "1.0.0"); + var folder = Path.Combine(folders.KeptPackages, Sha(bytes)); + foreach (var file in Directory.GetFiles(folder)) + { + File.SetLastWriteTimeUtc(file, start.AddHours(i)); + } + + Directory.SetLastWriteTimeUtc(folder, start.AddHours(i)); + } + + var left = Directory.GetDirectories(folders.KeptPackages).Select(d => File.ReadAllText(Directory.GetFiles(d, "*.msi").Single())).Order().ToList(); + Assert.Equal(["msi 1.0.0", "msi 1.2.0", $"msi {Current}", $"msi {Target}"], left); + Assert.Equal(Target, kept.Find(Target)!.Version); + Assert.Null(kept.Find("1.1.0")); + } + + private sealed class Stub(Func respond) : HttpMessageHandler + { + protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + => Task.FromResult(respond(request)); + } +} diff --git a/tests/Agent.Tests/UpgradeOutcomeReporterTests.cs b/tests/Agent.Tests/UpgradeOutcomeReporterTests.cs index b41e523..6eab4cd 100644 --- a/tests/Agent.Tests/UpgradeOutcomeReporterTests.cs +++ b/tests/Agent.Tests/UpgradeOutcomeReporterTests.cs @@ -54,6 +54,27 @@ public sealed class UpgradeOutcomeReporterTests : IDisposable Assert.False(File.Exists(folders.Outcome)); } + [Fact] + public async Task AnMsiRunsOwnDetailIsWhatIsReported() + { + var outcome = new WatchdogOutcome(Guid.NewGuid(), AgentUpgradeStates.Failed, AgentUpgradeReasons.HealthDeadline, "1.4.0", "1.3.0", [], + DateTimeOffset.UtcNow, "1.4.0 did not report healthy in time; no MSI of 1.3.0 was kept to go back to, so it stays."); + WatchdogFileStore.Write(folders.Outcome, outcome, WatchdogJsonContext.Default.WatchdogOutcome); + + Assert.True(await CreateReporter().ReportPendingAsync(CancellationToken.None)); + + Assert.Equal(outcome.Detail, Assert.Single(events.Published).Detail); + } + + [Fact] + public void AnMsiFailureWithoutDetailSaysThePreviousVersionStays() + { + var reported = UpgradeOutcomeReporter.ToEvent(new WatchdogOutcome(Guid.NewGuid(), AgentUpgradeStates.Failed, AgentUpgradeReasons.InstallerBusy, + "1.4.0", "1.3.0", [], DateTimeOffset.UtcNow), "client-1"); + + Assert.Contains("1.3.0 stays", reported.Detail, StringComparison.Ordinal); + } + [Fact] public async Task ReportsASuccess() { -- 2.52.0 From 42af03dd0fe54590f4d18bd65cdca02ee652c5f1c447f981de3d0dd7589f78b2 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:28:13 -0400 Subject: [PATCH 07/26] feat(upgrades): serve MSI installs their MSI, with the running version's MSI to go back to The catalog imports Agent.msi beside the zips (the same VERSION marker). A device remembers from presence how its agent was installed (AgentInstall, migration AgentInstallKind for SQLite, PostgreSQL and SQL Server; also on the device DTO), and start, automatic upgrades and roll back pick its package with AgentPackageTypes.ForDevice: an MSI install of win-x64 gets the MSI, or is left out as no-package when the catalog holds no MSI of that version (never the zip). An MSI command carries the catalog's MSI of the version the device runs now (AreSame) as its rollback package, when held. Co-Authored-By: Claude Opus 5.5 --- src/Backend/Api/DeviceEndpoints.cs | 3 +- src/Backend/Data/AppDbContext.cs | 1 + src/Backend/Data/Entities.cs | 2 + ...0261024002507_AgentInstallKind.Designer.cs | 1218 +++++++++++++++++ .../20261024002507_AgentInstallKind.cs | 29 + .../PostgresAppDbContextModelSnapshot.cs | 4 + ...0261024002532_AgentInstallKind.Designer.cs | 1218 +++++++++++++++++ .../20261024002532_AgentInstallKind.cs | 29 + .../SqlServerAppDbContextModelSnapshot.cs | 4 + ...0261024002447_AgentInstallKind.Designer.cs | 1205 ++++++++++++++++ .../Sqlite/20261024002447_AgentInstallKind.cs | 29 + .../Sqlite/SqliteAppDbContextModelSnapshot.cs | 4 + src/Backend/Files/AgentPackageService.cs | 4 +- src/Backend/Messaging/MessagingWorkers.cs | 2 + src/Backend/Upgrades/AgentCatalog.cs | 15 + src/Backend/Upgrades/AgentUpgradeScheduler.cs | 18 +- src/Backend/Upgrades/AgentUpgradeService.cs | 15 +- src/Shared.Contracts/Api/ResourceDtos.cs | 3 +- 18 files changed, 3790 insertions(+), 13 deletions(-) create mode 100644 src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.Designer.cs create mode 100644 src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.cs create mode 100644 src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.Designer.cs create mode 100644 src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.cs create mode 100644 src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.Designer.cs create mode 100644 src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.cs diff --git a/src/Backend/Api/DeviceEndpoints.cs b/src/Backend/Api/DeviceEndpoints.cs index 80e4703..97c1120 100644 --- a/src/Backend/Api/DeviceEndpoints.cs +++ b/src/Backend/Api/DeviceEndpoints.cs @@ -178,6 +178,7 @@ public static class DeviceEndpoints Tags: Groups.DeviceGroupService.ParseTags(device.TagsJson), IsOrphaned: device.IsOrphaned, PublicIp: device.PublicIp, - GroupIds: groupIds); + GroupIds: groupIds, + AgentInstall: device.AgentInstall); } } diff --git a/src/Backend/Data/AppDbContext.cs b/src/Backend/Data/AppDbContext.cs index 8b8dd25..9c6a8bd 100644 --- a/src/Backend/Data/AppDbContext.cs +++ b/src/Backend/Data/AppDbContext.cs @@ -185,6 +185,7 @@ public class AppDbContext(DbContextOptions options) : DbContext(op entity.HasKey(e => e.ClientId); entity.HasIndex(e => e.Hostname); entity.Property(e => e.AgentRuntime).HasMaxLength(32); + entity.Property(e => e.AgentInstall).HasMaxLength(16); entity.HasOne(e => e.Inventory) .WithOne() .HasForeignKey(e => e.ClientId) diff --git a/src/Backend/Data/Entities.cs b/src/Backend/Data/Entities.cs index 4f20e0f..a0aad4e 100644 --- a/src/Backend/Data/Entities.cs +++ b/src/Backend/Data/Entities.cs @@ -187,6 +187,8 @@ public sealed class DeviceEntity public string? AgentVersion { get; set; } /// The agent build's runtime identifier from presence (e.g. win-x64); null from older agents. public string? AgentRuntime { get; set; } + /// How the agent was installed, from presence: msi or portable (AgentInstallKinds); null from older agents. + public string? AgentInstall { get; set; } /// Enrolled NATS user public key bound to this device. public required string NkeyPublic { get; set; } public Guid EnrollmentId { get; set; } diff --git a/src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.Designer.cs b/src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.Designer.cs new file mode 100644 index 0000000..02fdfe8 --- /dev/null +++ b/src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.Designer.cs @@ -0,0 +1,1218 @@ +// +using System; +using Backend.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Backend.Data.Migrations.Postgres +{ + [DbContext(typeof(PostgresAppDbContext))] + [Migration("20261024002507_AgentInstallKind")] + partial class AgentInstallKind + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Backend.Data.AgentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ImportedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("PackageType") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("S3Key") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("Sha256") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("SizeBytes") + .HasColumnType("bigint"); + + b.Property("StoragePath") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("Sha256"); + + b.HasIndex("Version", "PackageType") + .IsUnique(); + + b.ToTable("AgentPackages", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AgentUpgradeEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Attempts") + .HasColumnType("integer"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("uuid"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("FinishedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("FromVersion") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LastEventUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("LastLogJson") + .HasColumnType("text"); + + b.Property("PackageId") + .HasColumnType("uuid"); + + b.Property("PackageType") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Reason") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("RequestedBy") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("SentUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Sha256") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("State") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("TargetVersion") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("State"); + + b.HasIndex("ClientId", "State"); + + b.ToTable("AgentUpgrades", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AppSettingEntity", b => + { + b.Property("Key") + .HasColumnType("text"); + + b.Property("Etag") + .HasColumnType("text"); + + b.Property("IsSecret") + .HasColumnType("boolean"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Key"); + + b.ToTable("AppSettings", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AuditEventEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Action") + .IsRequired() + .HasColumnType("text"); + + b.Property("Actor") + .HasColumnType("text"); + + b.Property("Category") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientId") + .HasColumnType("text"); + + b.Property("Detail") + .HasColumnType("text"); + + b.Property("RemoteIp") + .HasColumnType("text"); + + b.Property("TimestampUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("TimestampUtc"); + + b.ToTable("AuditEvents", (string)null); + }); + + modelBuilder.Entity("Backend.Data.BootstrapTokenEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("MaxUses") + .HasColumnType("integer"); + + b.Property("Note") + .HasColumnType("text"); + + b.Property("Revoked") + .HasColumnType("boolean"); + + b.Property("TokenHash") + .IsRequired() + .HasColumnType("text"); + + b.Property("Uses") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TokenHash") + .IsUnique(); + + b.ToTable("BootstrapTokens", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceEntity", b => + { + b.Property("ClientId") + .HasColumnType("text"); + + b.Property("AgentInstall") + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("AgentRuntime") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("AgentVersion") + .HasColumnType("text"); + + b.Property("BootstrapTokenId") + .HasColumnType("uuid"); + + b.Property("EnrolledUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("EnrollmentId") + .HasColumnType("uuid"); + + b.Property("Hostname") + .IsRequired() + .HasColumnType("text"); + + b.Property("IpAddressesJson") + .HasColumnType("text"); + + b.Property("IsOrphaned") + .HasColumnType("boolean"); + + b.Property("LastSeenUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Manufacturer") + .HasColumnType("text"); + + b.Property("Model") + .HasColumnType("text"); + + b.Property("NkeyPublic") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrphanedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("OsCaption") + .HasColumnType("text"); + + b.Property("OsVersion") + .HasColumnType("text"); + + b.Property("PublicIp") + .HasColumnType("text"); + + b.Property("ReadyUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("TagsJson") + .HasColumnType("text"); + + b.HasKey("ClientId"); + + b.HasIndex("Hostname"); + + b.ToTable("Devices", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Kind") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RulesJson") + .HasColumnType("text"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("DeviceGroups", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceGroupMemberEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AddedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("GroupId", "ClientId") + .IsUnique(); + + b.ToTable("DeviceGroupMembers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceInventoryEntity", b => + { + b.Property("ClientId") + .HasColumnType("text"); + + b.Property("ReportJson") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("ClientId"); + + b.ToTable("DeviceInventory", (string)null); + }); + + modelBuilder.Entity("Backend.Data.FunctionModuleEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("FunctionModules", (string)null); + }); + + modelBuilder.Entity("Backend.Data.JobEntity", b => + { + b.Property("JobId") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("CompletedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("ExitCode") + .HasColumnType("integer"); + + b.Property("OutputSummary") + .HasColumnType("text"); + + b.Property("RequestedBy") + .HasColumnType("text"); + + b.Property("RunId") + .HasColumnType("uuid"); + + b.Property("ScriptId") + .HasColumnType("uuid"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("StartedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("State") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("JobId"); + + b.HasIndex("ClientId"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("RunId"); + + b.HasIndex("ScriptId", "RunId"); + + b.ToTable("Jobs", (string)null); + }); + + modelBuilder.Entity("Backend.Data.JobOutputEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("Stream") + .IsRequired() + .HasColumnType("text"); + + b.Property("Text") + .IsRequired() + .HasColumnType("text"); + + b.Property("TimestampUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("JobId", "Sequence") + .IsUnique(); + + b.ToTable("JobOutput", (string)null); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("LocalGroups", (string)null); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupMemberEntity", b => + { + b.Property("GroupId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("GroupId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("LocalGroupMembers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RoleBindingEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("PrincipalId") + .IsRequired() + .HasMaxLength(450) + .HasColumnType("character varying(450)"); + + b.Property("PrincipalKind") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("PrincipalName") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("PrincipalKind", "PrincipalId", "RoleId") + .IsUnique(); + + b.ToTable("RoleBindings", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RoleEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DeviceScopeGroupIdsJson") + .HasColumnType("text"); + + b.Property("IsSystem") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("OidcClaimValuesJson") + .HasColumnType("text"); + + b.Property("PermissionsJson") + .HasColumnType("text"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RunEntity", b => + { + b.Property("RunId") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("OnlineOnly") + .HasColumnType("boolean"); + + b.Property("RequestedBy") + .HasColumnType("text"); + + b.Property("ScriptId") + .HasColumnType("uuid"); + + b.Property("ScriptName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SkippedJson") + .IsRequired() + .HasColumnType("text"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("TargetsLabel") + .HasMaxLength(400) + .HasColumnType("character varying(400)"); + + b.Property("TriggerId") + .HasColumnType("uuid"); + + b.HasKey("RunId"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("ScriptId"); + + b.ToTable("Runs", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("FileBindingsJson") + .HasColumnType("text"); + + b.Property("FunctionModuleIdsJson") + .HasColumnType("text"); + + b.Property("Language") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParametersJson") + .HasColumnType("text"); + + b.Property("SecretBindingsJson") + .HasColumnType("text"); + + b.Property("SecretsVariableName") + .HasColumnType("text"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Scripts", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptTriggerEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ArgumentsJson") + .HasColumnType("text"); + + b.Property("ClientId") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("uuid"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("CronExpression") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("GroupId") + .HasColumnType("uuid"); + + b.Property("LastResult") + .HasColumnType("text"); + + b.Property("LastRunId") + .HasColumnType("uuid"); + + b.Property("LastRunUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("NextRunUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("OncePerDevice") + .HasColumnType("boolean"); + + b.Property("RunOnceUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("ScriptId") + .HasColumnType("uuid"); + + b.Property("TimeZoneId") + .IsRequired() + .HasColumnType("text"); + + b.Property("TriggerType") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("NextRunUtc"); + + b.HasIndex("TriggerType"); + + b.ToTable("ScriptTriggers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptTriggerRunEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("FiredUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("TriggerId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TriggerId", "ClientId") + .IsUnique(); + + b.ToTable("ScriptTriggerRuns", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SecretsProviderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConfigProtected") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Kind") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("SecretsProviders", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SessionEntity", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("AbsoluteExpiresUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("ClientAddress") + .HasColumnType("text"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("CsrfHash") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ExpiresUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("GroupsJson") + .HasColumnType("text"); + + b.Property("LastSeenUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Provider") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("RevokedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UserAgent") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("AbsoluteExpiresUtc"); + + b.HasIndex("UserId"); + + b.ToTable("Sessions", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ShellSessionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("text"); + + b.Property("CloseReason") + .HasColumnType("text"); + + b.Property("ClosedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("RequestedBy") + .HasColumnType("text"); + + b.Property("State") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("ShellSessions", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SignInRequestEntity", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CodeVerifier") + .HasColumnType("text"); + + b.Property("CompletedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("ExpiresUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Nonce") + .HasColumnType("text"); + + b.Property("Provider") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("ReturnUrl") + .HasColumnType("text"); + + b.Property("SettingsEtag") + .HasColumnType("text"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("StepUpSessionId") + .HasColumnType("text"); + + b.Property("TestSessionId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ExpiresUtc"); + + b.HasIndex("TestSessionId"); + + b.ToTable("SignInRequests", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SignInThrottleEntity", b => + { + b.Property("Key") + .HasMaxLength(300) + .HasColumnType("character varying(300)"); + + b.Property("BlockedUntilUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Failures") + .HasColumnType("integer"); + + b.Property("FirstFailureUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("LastFailureUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Key"); + + b.ToTable("SignInThrottles", (string)null); + }); + + modelBuilder.Entity("Backend.Data.StepUpEntity", b => + { + b.Property("SessionId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Method") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("VerifiedUtc") + .HasColumnType("timestamp with time zone"); + + b.HasKey("SessionId"); + + b.ToTable("StepUps", (string)null); + }); + + modelBuilder.Entity("Backend.Data.UserEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("ExternalId") + .HasMaxLength(450) + .HasColumnType("character varying(450)"); + + b.Property("IsBreakGlass") + .HasColumnType("boolean"); + + b.Property("Kind") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("LastSignInUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("LegacyRole") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("LegacyRoleId") + .HasColumnType("uuid"); + + b.Property("MustChangePassword") + .HasColumnType("boolean"); + + b.Property("PasswordChangedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("UpdatedUtc") + .HasColumnType("timestamp with time zone"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("WindowsGroupsJson") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Kind", "ExternalId"); + + b.HasIndex("Kind", "UserName") + .IsUnique(); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceInventoryEntity", b => + { + b.HasOne("Backend.Data.DeviceEntity", null) + .WithOne("Inventory") + .HasForeignKey("Backend.Data.DeviceInventoryEntity", "ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupMemberEntity", b => + { + b.HasOne("Backend.Data.LocalGroupEntity", null) + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Backend.Data.UserEntity", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.RoleBindingEntity", b => + { + b.HasOne("Backend.Data.RoleEntity", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.SessionEntity", b => + { + b.HasOne("Backend.Data.UserEntity", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Backend.Data.DeviceEntity", b => + { + b.Navigation("Inventory"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.cs b/src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.cs new file mode 100644 index 0000000..37cdfed --- /dev/null +++ b/src/Backend/Data/Migrations/Postgres/20261024002507_AgentInstallKind.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Backend.Data.Migrations.Postgres +{ + /// + public partial class AgentInstallKind : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AgentInstall", + table: "Devices", + type: "character varying(16)", + maxLength: 16, + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AgentInstall", + table: "Devices"); + } + } +} diff --git a/src/Backend/Data/Migrations/Postgres/PostgresAppDbContextModelSnapshot.cs b/src/Backend/Data/Migrations/Postgres/PostgresAppDbContextModelSnapshot.cs index 9729279..bd04ae8 100644 --- a/src/Backend/Data/Migrations/Postgres/PostgresAppDbContextModelSnapshot.cs +++ b/src/Backend/Data/Migrations/Postgres/PostgresAppDbContextModelSnapshot.cs @@ -266,6 +266,10 @@ namespace Backend.Data.Migrations.Postgres b.Property("ClientId") .HasColumnType("text"); + b.Property("AgentInstall") + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + b.Property("AgentRuntime") .HasMaxLength(32) .HasColumnType("character varying(32)"); diff --git a/src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.Designer.cs b/src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.Designer.cs new file mode 100644 index 0000000..be2baf2 --- /dev/null +++ b/src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.Designer.cs @@ -0,0 +1,1218 @@ +// +using System; +using Backend.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Backend.Data.Migrations.SqlServer +{ + [DbContext(typeof(SqlServerAppDbContext))] + [Migration("20261024002532_AgentInstallKind")] + partial class AgentInstallKind + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Backend.Data.AgentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ImportedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("PackageType") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("S3Key") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Sha256") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SizeBytes") + .HasColumnType("bigint"); + + b.Property("StoragePath") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Sha256"); + + b.HasIndex("Version", "PackageType") + .IsUnique(); + + b.ToTable("AgentPackages", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AgentUpgradeEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Attempts") + .HasColumnType("int"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("FinishedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("FromVersion") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LastEventUtc") + .HasColumnType("datetimeoffset"); + + b.Property("LastLogJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PackageId") + .HasColumnType("uniqueidentifier"); + + b.Property("PackageType") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Reason") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("RequestedBy") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("SentUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Sha256") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("State") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("TargetVersion") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("State"); + + b.HasIndex("ClientId", "State"); + + b.ToTable("AgentUpgrades", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AppSettingEntity", b => + { + b.Property("Key") + .HasColumnType("nvarchar(450)"); + + b.Property("Etag") + .HasColumnType("nvarchar(max)"); + + b.Property("IsSecret") + .HasColumnType("bit"); + + b.Property("UpdatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Key"); + + b.ToTable("AppSettings", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AuditEventEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Action") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Actor") + .HasColumnType("nvarchar(max)"); + + b.Property("Category") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("nvarchar(max)"); + + b.Property("Detail") + .HasColumnType("nvarchar(max)"); + + b.Property("RemoteIp") + .HasColumnType("nvarchar(max)"); + + b.Property("TimestampUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("TimestampUtc"); + + b.ToTable("AuditEvents", (string)null); + }); + + modelBuilder.Entity("Backend.Data.BootstrapTokenEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("ExpiresUtc") + .HasColumnType("datetimeoffset"); + + b.Property("MaxUses") + .HasColumnType("int"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("Revoked") + .HasColumnType("bit"); + + b.Property("TokenHash") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Uses") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TokenHash") + .IsUnique(); + + b.ToTable("BootstrapTokens", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceEntity", b => + { + b.Property("ClientId") + .HasColumnType("nvarchar(450)"); + + b.Property("AgentInstall") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("AgentRuntime") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("AgentVersion") + .HasColumnType("nvarchar(max)"); + + b.Property("BootstrapTokenId") + .HasColumnType("uniqueidentifier"); + + b.Property("EnrolledUtc") + .HasColumnType("datetimeoffset"); + + b.Property("EnrollmentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Hostname") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("IpAddressesJson") + .HasColumnType("nvarchar(max)"); + + b.Property("IsOrphaned") + .HasColumnType("bit"); + + b.Property("LastSeenUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Manufacturer") + .HasColumnType("nvarchar(max)"); + + b.Property("Model") + .HasColumnType("nvarchar(max)"); + + b.Property("NkeyPublic") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OrphanedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("OsCaption") + .HasColumnType("nvarchar(max)"); + + b.Property("OsVersion") + .HasColumnType("nvarchar(max)"); + + b.Property("PublicIp") + .HasColumnType("nvarchar(max)"); + + b.Property("ReadyUtc") + .HasColumnType("datetimeoffset"); + + b.Property("TagsJson") + .HasColumnType("nvarchar(max)"); + + b.HasKey("ClientId"); + + b.HasIndex("Hostname"); + + b.ToTable("Devices", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Kind") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("RulesJson") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("DeviceGroups", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceGroupMemberEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("GroupId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("GroupId", "ClientId") + .IsUnique(); + + b.ToTable("DeviceGroupMembers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceInventoryEntity", b => + { + b.Property("ClientId") + .HasColumnType("nvarchar(450)"); + + b.Property("ReportJson") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("ClientId"); + + b.ToTable("DeviceInventory", (string)null); + }); + + modelBuilder.Entity("Backend.Data.FunctionModuleEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("UpdatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("FunctionModules", (string)null); + }); + + modelBuilder.Entity("Backend.Data.JobEntity", b => + { + b.Property("JobId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CompletedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("ExitCode") + .HasColumnType("int"); + + b.Property("OutputSummary") + .HasColumnType("nvarchar(max)"); + + b.Property("RequestedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("RunId") + .HasColumnType("uniqueidentifier"); + + b.Property("ScriptId") + .HasColumnType("uniqueidentifier"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("State") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("JobId"); + + b.HasIndex("ClientId"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("RunId"); + + b.HasIndex("ScriptId", "RunId"); + + b.ToTable("Jobs", (string)null); + }); + + modelBuilder.Entity("Backend.Data.JobOutputEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("JobId") + .HasColumnType("uniqueidentifier"); + + b.Property("Sequence") + .HasColumnType("bigint"); + + b.Property("Stream") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Text") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TimestampUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("JobId", "Sequence") + .IsUnique(); + + b.ToTable("JobOutput", (string)null); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("LocalGroups", (string)null); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupMemberEntity", b => + { + b.Property("GroupId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("GroupId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("LocalGroupMembers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RoleBindingEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("PrincipalId") + .IsRequired() + .HasMaxLength(450) + .HasColumnType("nvarchar(450)"); + + b.Property("PrincipalKind") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("PrincipalName") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("PrincipalKind", "PrincipalId", "RoleId") + .IsUnique(); + + b.ToTable("RoleBindings", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RoleEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DeviceScopeGroupIdsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("IsSystem") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("OidcClaimValuesJson") + .HasColumnType("nvarchar(max)"); + + b.Property("PermissionsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RunEntity", b => + { + b.Property("RunId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("OnlineOnly") + .HasColumnType("bit"); + + b.Property("RequestedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("ScriptId") + .HasColumnType("uniqueidentifier"); + + b.Property("ScriptName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("SkippedJson") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TargetsLabel") + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TriggerId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("RunId"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("ScriptId"); + + b.ToTable("Runs", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FileBindingsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("FunctionModuleIdsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("Language") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ParametersJson") + .HasColumnType("nvarchar(max)"); + + b.Property("SecretBindingsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("SecretsVariableName") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Scripts", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptTriggerEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArgumentsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("CronExpression") + .HasColumnType("nvarchar(max)"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("GroupId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastResult") + .HasColumnType("nvarchar(max)"); + + b.Property("LastRunId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastRunUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NextRunUtc") + .HasColumnType("datetimeoffset"); + + b.Property("OncePerDevice") + .HasColumnType("bit"); + + b.Property("RunOnceUtc") + .HasColumnType("datetimeoffset"); + + b.Property("ScriptId") + .HasColumnType("uniqueidentifier"); + + b.Property("TimeZoneId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TriggerType") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("NextRunUtc"); + + b.HasIndex("TriggerType"); + + b.ToTable("ScriptTriggers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptTriggerRunEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("FiredUtc") + .HasColumnType("datetimeoffset"); + + b.Property("JobId") + .HasColumnType("uniqueidentifier"); + + b.Property("TriggerId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TriggerId", "ClientId") + .IsUnique(); + + b.ToTable("ScriptTriggerRuns", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SecretsProviderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConfigProtected") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Kind") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("UpdatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("SecretsProviders", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SessionEntity", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("AbsoluteExpiresUtc") + .HasColumnType("datetimeoffset"); + + b.Property("ClientAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("CsrfHash") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ExpiresUtc") + .HasColumnType("datetimeoffset"); + + b.Property("GroupsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("LastSeenUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Provider") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("RevokedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("UserAgent") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AbsoluteExpiresUtc"); + + b.HasIndex("UserId"); + + b.ToTable("Sessions", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ShellSessionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("CloseReason") + .HasColumnType("nvarchar(max)"); + + b.Property("ClosedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("RequestedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("ShellSessions", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SignInRequestEntity", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CodeVerifier") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("ExpiresUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Nonce") + .HasColumnType("nvarchar(max)"); + + b.Property("Provider") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("ReturnUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("SettingsEtag") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("StepUpSessionId") + .HasColumnType("nvarchar(max)"); + + b.Property("TestSessionId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("ExpiresUtc"); + + b.HasIndex("TestSessionId"); + + b.ToTable("SignInRequests", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SignInThrottleEntity", b => + { + b.Property("Key") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("BlockedUntilUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Failures") + .HasColumnType("int"); + + b.Property("FirstFailureUtc") + .HasColumnType("datetimeoffset"); + + b.Property("LastFailureUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("Key"); + + b.ToTable("SignInThrottles", (string)null); + }); + + modelBuilder.Entity("Backend.Data.StepUpEntity", b => + { + b.Property("SessionId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Method") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("VerifiedUtc") + .HasColumnType("datetimeoffset"); + + b.HasKey("SessionId"); + + b.ToTable("StepUps", (string)null); + }); + + modelBuilder.Entity("Backend.Data.UserEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExternalId") + .HasMaxLength(450) + .HasColumnType("nvarchar(450)"); + + b.Property("IsBreakGlass") + .HasColumnType("bit"); + + b.Property("Kind") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("LastSignInUtc") + .HasColumnType("datetimeoffset"); + + b.Property("LegacyRole") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("LegacyRoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("MustChangePassword") + .HasColumnType("bit"); + + b.Property("PasswordChangedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedUtc") + .HasColumnType("datetimeoffset"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("WindowsGroupsJson") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Kind", "ExternalId"); + + b.HasIndex("Kind", "UserName") + .IsUnique(); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceInventoryEntity", b => + { + b.HasOne("Backend.Data.DeviceEntity", null) + .WithOne("Inventory") + .HasForeignKey("Backend.Data.DeviceInventoryEntity", "ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupMemberEntity", b => + { + b.HasOne("Backend.Data.LocalGroupEntity", null) + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Backend.Data.UserEntity", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.RoleBindingEntity", b => + { + b.HasOne("Backend.Data.RoleEntity", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.SessionEntity", b => + { + b.HasOne("Backend.Data.UserEntity", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Backend.Data.DeviceEntity", b => + { + b.Navigation("Inventory"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.cs b/src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.cs new file mode 100644 index 0000000..90a7602 --- /dev/null +++ b/src/Backend/Data/Migrations/SqlServer/20261024002532_AgentInstallKind.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Backend.Data.Migrations.SqlServer +{ + /// + public partial class AgentInstallKind : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AgentInstall", + table: "Devices", + type: "nvarchar(16)", + maxLength: 16, + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AgentInstall", + table: "Devices"); + } + } +} diff --git a/src/Backend/Data/Migrations/SqlServer/SqlServerAppDbContextModelSnapshot.cs b/src/Backend/Data/Migrations/SqlServer/SqlServerAppDbContextModelSnapshot.cs index e19d559..df884c8 100644 --- a/src/Backend/Data/Migrations/SqlServer/SqlServerAppDbContextModelSnapshot.cs +++ b/src/Backend/Data/Migrations/SqlServer/SqlServerAppDbContextModelSnapshot.cs @@ -266,6 +266,10 @@ namespace Backend.Data.Migrations.SqlServer b.Property("ClientId") .HasColumnType("nvarchar(450)"); + b.Property("AgentInstall") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + b.Property("AgentRuntime") .HasMaxLength(32) .HasColumnType("nvarchar(32)"); diff --git a/src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.Designer.cs b/src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.Designer.cs new file mode 100644 index 0000000..d08dc9d --- /dev/null +++ b/src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.Designer.cs @@ -0,0 +1,1205 @@ +// +using System; +using Backend.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Backend.Data.Migrations.Sqlite +{ + [DbContext(typeof(SqliteAppDbContext))] + [Migration("20261024002447_AgentInstallKind")] + partial class AgentInstallKind + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.10"); + + modelBuilder.Entity("Backend.Data.AgentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("ImportedUtc") + .HasColumnType("INTEGER"); + + b.Property("PackageType") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("S3Key") + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("Sha256") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("SizeBytes") + .HasColumnType("INTEGER"); + + b.Property("StoragePath") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Sha256"); + + b.HasIndex("Version", "PackageType") + .IsUnique(); + + b.ToTable("AgentPackages", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AgentUpgradeEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Attempts") + .HasColumnType("INTEGER"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("FinishedUtc") + .HasColumnType("INTEGER"); + + b.Property("FromVersion") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("LastEventUtc") + .HasColumnType("INTEGER"); + + b.Property("LastLogJson") + .HasColumnType("TEXT"); + + b.Property("PackageId") + .HasColumnType("TEXT"); + + b.Property("PackageType") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("Reason") + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("SentUtc") + .HasColumnType("INTEGER"); + + b.Property("Sha256") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("State") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("TargetVersion") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("State"); + + b.HasIndex("ClientId", "State"); + + b.ToTable("AgentUpgrades", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AppSettingEntity", b => + { + b.Property("Key") + .HasColumnType("TEXT"); + + b.Property("Etag") + .HasColumnType("TEXT"); + + b.Property("IsSecret") + .HasColumnType("INTEGER"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Key"); + + b.ToTable("AppSettings", (string)null); + }); + + modelBuilder.Entity("Backend.Data.AuditEventEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Action") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Actor") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ClientId") + .HasColumnType("TEXT"); + + b.Property("Detail") + .HasColumnType("TEXT"); + + b.Property("RemoteIp") + .HasColumnType("TEXT"); + + b.Property("TimestampUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("TimestampUtc"); + + b.ToTable("AuditEvents", (string)null); + }); + + modelBuilder.Entity("Backend.Data.BootstrapTokenEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("ExpiresUtc") + .HasColumnType("INTEGER"); + + b.Property("MaxUses") + .HasColumnType("INTEGER"); + + b.Property("Note") + .HasColumnType("TEXT"); + + b.Property("Revoked") + .HasColumnType("INTEGER"); + + b.Property("TokenHash") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Uses") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("TokenHash") + .IsUnique(); + + b.ToTable("BootstrapTokens", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceEntity", b => + { + b.Property("ClientId") + .HasColumnType("TEXT"); + + b.Property("AgentInstall") + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("AgentRuntime") + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("AgentVersion") + .HasColumnType("TEXT"); + + b.Property("BootstrapTokenId") + .HasColumnType("TEXT"); + + b.Property("EnrolledUtc") + .HasColumnType("INTEGER"); + + b.Property("EnrollmentId") + .HasColumnType("TEXT"); + + b.Property("Hostname") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IpAddressesJson") + .HasColumnType("TEXT"); + + b.Property("IsOrphaned") + .HasColumnType("INTEGER"); + + b.Property("LastSeenUtc") + .HasColumnType("INTEGER"); + + b.Property("Manufacturer") + .HasColumnType("TEXT"); + + b.Property("Model") + .HasColumnType("TEXT"); + + b.Property("NkeyPublic") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OrphanedUtc") + .HasColumnType("INTEGER"); + + b.Property("OsCaption") + .HasColumnType("TEXT"); + + b.Property("OsVersion") + .HasColumnType("TEXT"); + + b.Property("PublicIp") + .HasColumnType("TEXT"); + + b.Property("ReadyUtc") + .HasColumnType("INTEGER"); + + b.Property("TagsJson") + .HasColumnType("TEXT"); + + b.HasKey("ClientId"); + + b.HasIndex("Hostname"); + + b.ToTable("Devices", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("Kind") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ParentId") + .HasColumnType("TEXT"); + + b.Property("RulesJson") + .HasColumnType("TEXT"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("DeviceGroups", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceGroupMemberEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedUtc") + .HasColumnType("INTEGER"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GroupId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("GroupId", "ClientId") + .IsUnique(); + + b.ToTable("DeviceGroupMembers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceInventoryEntity", b => + { + b.Property("ClientId") + .HasColumnType("TEXT"); + + b.Property("ReportJson") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("ClientId"); + + b.ToTable("DeviceInventory", (string)null); + }); + + modelBuilder.Entity("Backend.Data.FunctionModuleEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("FunctionModules", (string)null); + }); + + modelBuilder.Entity("Backend.Data.JobEntity", b => + { + b.Property("JobId") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CompletedUtc") + .HasColumnType("INTEGER"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("ExitCode") + .HasColumnType("INTEGER"); + + b.Property("OutputSummary") + .HasColumnType("TEXT"); + + b.Property("RequestedBy") + .HasColumnType("TEXT"); + + b.Property("RunId") + .HasColumnType("TEXT"); + + b.Property("ScriptId") + .HasColumnType("TEXT"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StartedUtc") + .HasColumnType("INTEGER"); + + b.Property("State") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("JobId"); + + b.HasIndex("ClientId"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("RunId"); + + b.HasIndex("ScriptId", "RunId"); + + b.ToTable("Jobs", (string)null); + }); + + modelBuilder.Entity("Backend.Data.JobOutputEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("JobId") + .HasColumnType("TEXT"); + + b.Property("Sequence") + .HasColumnType("INTEGER"); + + b.Property("Stream") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Text") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TimestampUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("JobId", "Sequence") + .IsUnique(); + + b.ToTable("JobOutput", (string)null); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("LocalGroups", (string)null); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupMemberEntity", b => + { + b.Property("GroupId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("GroupId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("LocalGroupMembers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RoleBindingEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("PrincipalId") + .IsRequired() + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property("PrincipalKind") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("PrincipalName") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("PrincipalKind", "PrincipalId", "RoleId") + .IsUnique(); + + b.ToTable("RoleBindings", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RoleEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DeviceScopeGroupIdsJson") + .HasColumnType("TEXT"); + + b.Property("IsSystem") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("OidcClaimValuesJson") + .HasColumnType("TEXT"); + + b.Property("PermissionsJson") + .HasColumnType("TEXT"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Backend.Data.RunEntity", b => + { + b.Property("RunId") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("OnlineOnly") + .HasColumnType("INTEGER"); + + b.Property("RequestedBy") + .HasColumnType("TEXT"); + + b.Property("ScriptId") + .HasColumnType("TEXT"); + + b.Property("ScriptName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("SkippedJson") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("TargetsLabel") + .HasMaxLength(400) + .HasColumnType("TEXT"); + + b.Property("TriggerId") + .HasColumnType("TEXT"); + + b.HasKey("RunId"); + + b.HasIndex("CreatedUtc"); + + b.HasIndex("ScriptId"); + + b.ToTable("Runs", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("FileBindingsJson") + .HasColumnType("TEXT"); + + b.Property("FunctionModuleIdsJson") + .HasColumnType("TEXT"); + + b.Property("Language") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ParametersJson") + .HasColumnType("TEXT"); + + b.Property("SecretBindingsJson") + .HasColumnType("TEXT"); + + b.Property("SecretsVariableName") + .HasColumnType("TEXT"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Scripts", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptTriggerEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ArgumentsJson") + .HasColumnType("TEXT"); + + b.Property("ClientId") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("CreatedBy") + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("CronExpression") + .HasColumnType("TEXT"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("GroupId") + .HasColumnType("TEXT"); + + b.Property("LastResult") + .HasColumnType("TEXT"); + + b.Property("LastRunId") + .HasColumnType("TEXT"); + + b.Property("LastRunUtc") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("NextRunUtc") + .HasColumnType("INTEGER"); + + b.Property("OncePerDevice") + .HasColumnType("INTEGER"); + + b.Property("RunOnceUtc") + .HasColumnType("INTEGER"); + + b.Property("ScriptId") + .HasColumnType("TEXT"); + + b.Property("TimeZoneId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TriggerType") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NextRunUtc"); + + b.HasIndex("TriggerType"); + + b.ToTable("ScriptTriggers", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ScriptTriggerRunEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FiredUtc") + .HasColumnType("INTEGER"); + + b.Property("JobId") + .HasColumnType("TEXT"); + + b.Property("TriggerId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("TriggerId", "ClientId") + .IsUnique(); + + b.ToTable("ScriptTriggerRuns", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SecretsProviderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ConfigProtected") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Kind") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdatedBy") + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("SecretsProviders", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SessionEntity", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("AbsoluteExpiresUtc") + .HasColumnType("INTEGER"); + + b.Property("ClientAddress") + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("CsrfHash") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("ExpiresUtc") + .HasColumnType("INTEGER"); + + b.Property("GroupsJson") + .HasColumnType("TEXT"); + + b.Property("LastSeenUtc") + .HasColumnType("INTEGER"); + + b.Property("Provider") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("RevokedUtc") + .HasColumnType("INTEGER"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserAgent") + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AbsoluteExpiresUtc"); + + b.HasIndex("UserId"); + + b.ToTable("Sessions", (string)null); + }); + + modelBuilder.Entity("Backend.Data.ShellSessionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CloseReason") + .HasColumnType("TEXT"); + + b.Property("ClosedUtc") + .HasColumnType("INTEGER"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("RequestedBy") + .HasColumnType("TEXT"); + + b.Property("State") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("ShellSessions", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SignInRequestEntity", b => + { + b.Property("Id") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("CodeVerifier") + .HasColumnType("TEXT"); + + b.Property("CompletedUtc") + .HasColumnType("INTEGER"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("TEXT"); + + b.Property("ExpiresUtc") + .HasColumnType("INTEGER"); + + b.Property("Nonce") + .HasColumnType("TEXT"); + + b.Property("Provider") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("ReturnUrl") + .HasColumnType("TEXT"); + + b.Property("SettingsEtag") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("StepUpSessionId") + .HasColumnType("TEXT"); + + b.Property("TestSessionId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ExpiresUtc"); + + b.HasIndex("TestSessionId"); + + b.ToTable("SignInRequests", (string)null); + }); + + modelBuilder.Entity("Backend.Data.SignInThrottleEntity", b => + { + b.Property("Key") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("BlockedUntilUtc") + .HasColumnType("INTEGER"); + + b.Property("Failures") + .HasColumnType("INTEGER"); + + b.Property("FirstFailureUtc") + .HasColumnType("INTEGER"); + + b.Property("LastFailureUtc") + .HasColumnType("INTEGER"); + + b.HasKey("Key"); + + b.ToTable("SignInThrottles", (string)null); + }); + + modelBuilder.Entity("Backend.Data.StepUpEntity", b => + { + b.Property("SessionId") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("Method") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("VerifiedUtc") + .HasColumnType("INTEGER"); + + b.HasKey("SessionId"); + + b.ToTable("StepUps", (string)null); + }); + + modelBuilder.Entity("Backend.Data.UserEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedUtc") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasColumnType("TEXT"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("ExternalId") + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property("IsBreakGlass") + .HasColumnType("INTEGER"); + + b.Property("Kind") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("TEXT"); + + b.Property("LastSignInUtc") + .HasColumnType("INTEGER"); + + b.Property("LegacyRole") + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("LegacyRoleId") + .HasColumnType("TEXT"); + + b.Property("MustChangePassword") + .HasColumnType("INTEGER"); + + b.Property("PasswordChangedUtc") + .HasColumnType("INTEGER"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("UpdatedUtc") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("WindowsGroupsJson") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Kind", "ExternalId"); + + b.HasIndex("Kind", "UserName") + .IsUnique(); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("Backend.Data.DeviceInventoryEntity", b => + { + b.HasOne("Backend.Data.DeviceEntity", null) + .WithOne("Inventory") + .HasForeignKey("Backend.Data.DeviceInventoryEntity", "ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.LocalGroupMemberEntity", b => + { + b.HasOne("Backend.Data.LocalGroupEntity", null) + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Backend.Data.UserEntity", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.RoleBindingEntity", b => + { + b.HasOne("Backend.Data.RoleEntity", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Backend.Data.SessionEntity", b => + { + b.HasOne("Backend.Data.UserEntity", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Backend.Data.DeviceEntity", b => + { + b.Navigation("Inventory"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.cs b/src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.cs new file mode 100644 index 0000000..1e0d1b5 --- /dev/null +++ b/src/Backend/Data/Migrations/Sqlite/20261024002447_AgentInstallKind.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Backend.Data.Migrations.Sqlite +{ + /// + public partial class AgentInstallKind : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AgentInstall", + table: "Devices", + type: "TEXT", + maxLength: 16, + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AgentInstall", + table: "Devices"); + } + } +} diff --git a/src/Backend/Data/Migrations/Sqlite/SqliteAppDbContextModelSnapshot.cs b/src/Backend/Data/Migrations/Sqlite/SqliteAppDbContextModelSnapshot.cs index bbdc222..bf26e1b 100644 --- a/src/Backend/Data/Migrations/Sqlite/SqliteAppDbContextModelSnapshot.cs +++ b/src/Backend/Data/Migrations/Sqlite/SqliteAppDbContextModelSnapshot.cs @@ -259,6 +259,10 @@ namespace Backend.Data.Migrations.Sqlite b.Property("ClientId") .HasColumnType("TEXT"); + b.Property("AgentInstall") + .HasMaxLength(16) + .HasColumnType("TEXT"); + b.Property("AgentRuntime") .HasMaxLength(32) .HasColumnType("TEXT"); diff --git a/src/Backend/Files/AgentPackageService.cs b/src/Backend/Files/AgentPackageService.cs index c236379..31db29d 100644 --- a/src/Backend/Files/AgentPackageService.cs +++ b/src/Backend/Files/AgentPackageService.cs @@ -107,8 +107,8 @@ public sealed class AgentPackageService( : "volume"; /// - /// The upgradable packages visible right now (portable zip and the Unix - /// builds, not the MSI), each with the version from its VERSION marker: + /// The upgradable packages visible right now (the MSI, the portable zip and + /// the Unix builds), each with the version from its VERSION marker: /// what the agent catalog imports. /// public IEnumerable<(string PackageType, string Path, string? Version)> LocateUpgradePackages() diff --git a/src/Backend/Messaging/MessagingWorkers.cs b/src/Backend/Messaging/MessagingWorkers.cs index 0fb1985..b9fbbba 100644 --- a/src/Backend/Messaging/MessagingWorkers.cs +++ b/src/Backend/Messaging/MessagingWorkers.cs @@ -111,6 +111,8 @@ public sealed class MessagingWorkers( device.AgentVersion = payload.AgentVersion; // Older agents send no runtime; what a newer build reported stands. device.AgentRuntime = payload.Runtime ?? device.AgentRuntime; + // msi or portable: an MSI install upgrades through its MSI. + device.AgentInstall = payload.Install is AgentInstallKinds.Msi or AgentInstallKinds.Portable ? payload.Install : device.AgentInstall; await db.SaveChangesAsync(cancellationToken); lock (lastKnownStatus) diff --git a/src/Backend/Upgrades/AgentCatalog.cs b/src/Backend/Upgrades/AgentCatalog.cs index b6469db..7b45129 100644 --- a/src/Backend/Upgrades/AgentCatalog.cs +++ b/src/Backend/Upgrades/AgentCatalog.cs @@ -321,6 +321,21 @@ public sealed class AgentCatalogService( => db.AgentPackages.AsNoTracking() .SingleOrDefaultAsync(p => p.Version == version && p.PackageType == packageType, cancellationToken); + /// + /// The package of the same version (: + /// 1.4.0 and 1.4.0.0 match, +metadata ignored) for the platform, or null. + /// + public async Task FindSameAsync(string? version, string packageType, CancellationToken cancellationToken) + { + if (!AgentVersions.IsValid(version)) + { + return null; + } + + return (await db.AgentPackages.AsNoTracking().Where(p => p.PackageType == packageType).ToListAsync(cancellationToken)) + .FirstOrDefault(p => AgentVersions.AreSame(p.Version, version)); + } + /// The newest package per platform (what upgrades default to). public async Task> NewestByTypeAsync(CancellationToken cancellationToken) => (await db.AgentPackages.AsNoTracking().ToListAsync(cancellationToken)) diff --git a/src/Backend/Upgrades/AgentUpgradeScheduler.cs b/src/Backend/Upgrades/AgentUpgradeScheduler.cs index c3bfd21..c149bb4 100644 --- a/src/Backend/Upgrades/AgentUpgradeScheduler.cs +++ b/src/Backend/Upgrades/AgentUpgradeScheduler.cs @@ -167,7 +167,8 @@ public sealed class AgentUpgradeScheduler( await upgrades.BroadcastAsync(row, devices.GetValueOrDefault(row.ClientId)?.Hostname ?? row.ClientId, cancellationToken); } - var sent = await SendBatchAsync(db, upgrades, catalog, settings, rows, Online, now, cancellationToken); + var sent = await SendBatchAsync(db, upgrades, catalog, settings, rows, Online, + clientId => devices.GetValueOrDefault(clientId)?.AgentVersion, now, cancellationToken); if (sent > 0 || queued.Count > 0) { await services.GetRequiredService().BroadcastActivityAsync(new ActivityEventPayload( @@ -188,7 +189,8 @@ public sealed class AgentUpgradeScheduler( /// private async Task SendBatchAsync( AppDbContext db, AgentUpgradeService upgrades, AgentCatalogService catalog, Shared.Contracts.Api.AgentUpgradeSettingsDto settings, - List rows, Func online, DateTimeOffset now, CancellationToken cancellationToken) + List rows, Func online, Func runningVersion, DateTimeOffset now, + CancellationToken cancellationToken) { var ready = rows.Where(r => r.State == AgentUpgradeStates.Queued && online(r.ClientId)).ToList(); var readyIds = ready.Select(r => r.Id).ToHashSet(); @@ -245,13 +247,23 @@ public sealed class AgentUpgradeScheduler( continue; // Cancelled or taken meanwhile. } + // An MSI upgrade carries the MSI of the version the device runs now, + // when the catalog holds it: the device's own kept copy comes first, + // this one is for a device that kept none (its first upgrade). + var rollback = row.PackageType == AgentPackageTypes.Msi + ? await catalog.FindSameAsync(runningVersion(row.ClientId) ?? row.FromVersion, AgentPackageTypes.Msi, cancellationToken) + : null; var command = new AgentUpgradeCommandPayload( row.Id, row.TargetVersion, row.PackageType, await catalog.DownloadUrlAsync(package, cancellationToken), package.Sha256, package.SizeBytes, Revert: row.Source == AgentUpgradeSources.Rollback, HealthDeadlineSeconds: settings.HealthDeadlineMinutes * 60, - StartJitterSeconds: StartJitterSeconds); + StartJitterSeconds: StartJitterSeconds, + RollbackVersion: rollback?.Version, + RollbackDownloadUrl: rollback is null ? null : await catalog.DownloadUrlAsync(rollback, cancellationToken), + RollbackSha256: rollback?.Sha256, + RollbackSizeBytes: rollback?.SizeBytes); if (!await sender.DispatchAgentUpgradeAsync(row.ClientId, command, cancellationToken)) { diff --git a/src/Backend/Upgrades/AgentUpgradeService.cs b/src/Backend/Upgrades/AgentUpgradeService.cs index bde8a48..fd7c427 100644 --- a/src/Backend/Upgrades/AgentUpgradeService.cs +++ b/src/Backend/Upgrades/AgentUpgradeService.cs @@ -42,13 +42,15 @@ public sealed class AgentUpgradeService( }; /// - /// The package a device upgrades from: its reported runtime, or for older - /// agents that do not report one, the OS platform and architecture from - /// inventory (Windows is only built for x64). Null when there is no build. + /// The package a device upgrades from: the MSI for a Windows agent the MSI + /// installed (so Windows Installer and detection tools see the real + /// version), otherwise its reported runtime's package, or for older agents + /// that report no runtime, the OS platform and architecture from inventory + /// (Windows is only built for x64). Null when there is no build. /// - public static string? ResolvePackageType(string? runtime, string? osCaption, string? architecture) + public static string? ResolvePackageType(string? runtime, string? osCaption, string? architecture, string? install = null) { - if (AgentPackageTypes.ForRuntime(runtime) is { } fromRuntime) + if (AgentPackageTypes.ForDevice(runtime, install) is { } fromRuntime) { return fromRuntime; } @@ -123,7 +125,8 @@ public sealed class AgentUpgradeService( result[device.ClientId] = ResolvePackageType( device.AgentRuntime, report?.Os.Caption ?? device.OsCaption, - report?.Os.Architecture ?? report?.Identity.SystemType); + report?.Os.Architecture ?? report?.Identity.SystemType, + device.AgentInstall); } return result; diff --git a/src/Shared.Contracts/Api/ResourceDtos.cs b/src/Shared.Contracts/Api/ResourceDtos.cs index 4c78074..9f50c33 100644 --- a/src/Shared.Contracts/Api/ResourceDtos.cs +++ b/src/Shared.Contracts/Api/ResourceDtos.cs @@ -18,7 +18,8 @@ public sealed record DeviceDto( IReadOnlyList? Tags = null, bool IsOrphaned = false, string? PublicIp = null, - IReadOnlyList? GroupIds = null); + IReadOnlyList? GroupIds = null, + string? AgentInstall = null); /// /// Device group resource. MemberCount/OnlineCount include the -- 2.52.0 From 1a216992f83e96f5ec673c798cf0e27c061bb6efa80bbbb40877fe10cb2069e8 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:28:13 -0400 Subject: [PATCH 08/26] test: MSI devices get the MSI and its rollback fields; the catalog imports the MSI The catalog test now expects the MSI imported as Agent.msi. MSI devices get the MSI and portable ones the zip, an MSI device without an MSI of the target is left out as no-package, the MSI command carries the running version's MSI (or none when the server has none), a rollback goes through the previous MSI, and the device DTO says how the agent was installed. Co-Authored-By: Claude Opus 5.5 --- tests/Backend.Tests/AgentMsiUpgradeTests.cs | 146 ++++++++++++++++++++ tests/Backend.Tests/AgentUpgradeTestKit.cs | 3 +- tests/Backend.Tests/AgentUpgradeTests.cs | 9 +- 3 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 tests/Backend.Tests/AgentMsiUpgradeTests.cs diff --git a/tests/Backend.Tests/AgentMsiUpgradeTests.cs b/tests/Backend.Tests/AgentMsiUpgradeTests.cs new file mode 100644 index 0000000..51c2afd --- /dev/null +++ b/tests/Backend.Tests/AgentMsiUpgradeTests.cs @@ -0,0 +1,146 @@ +using System.Net.Http.Json; +using Backend.Api; +using Backend.Upgrades; +using Microsoft.Extensions.DependencyInjection; +using Shared.Contracts.Api; +using Shared.Contracts.Models; +using Shared.Contracts.Serialization; +using Xunit; +using static Backend.Tests.AgentUpgradeTestKit; + +namespace Backend.Tests; + +/// Devices the MSI installed upgrade (and roll back) through the MSI; portable ones through their zip. +public class AgentMsiUpgradeTests(BackendTestFixture fixture) : IClassFixture +{ + [Fact] + public void TheInstallKindPicksThePackage() + { + Assert.Equal(AgentPackageTypes.Msi, AgentUpgradeService.ResolvePackageType("win-x64", null, null, AgentInstallKinds.Msi)); + Assert.Equal(AgentPackageTypes.WindowsZip, AgentUpgradeService.ResolvePackageType("win-x64", null, null, AgentInstallKinds.Portable)); + Assert.Equal(AgentPackageTypes.WindowsZip, AgentUpgradeService.ResolvePackageType("win-x64", null, null)); + Assert.Equal(AgentPackageTypes.LinuxX64, AgentUpgradeService.ResolvePackageType("linux-x64", null, null, AgentInstallKinds.Msi)); + } + + [Fact] + public async Task AnMsiDeviceGetsTheMsiAPortableOneTheZipAndAnMsiDeviceWithoutAnMsiOfTheTargetIsLeftOut() + { + await fixture.ResetAsync(); + await fixture.SeedPackageAsync(V2); + await fixture.SeedPackageAsync(V2, AgentPackageTypes.Msi); + await fixture.SeedPackageAsync(V3); + + var msi = await fixture.SeedAgentAsync("MSI-1", V1, install: AgentInstallKinds.Msi); + var portable = await fixture.SeedAgentAsync("PORTABLE-1", V1, install: AgentInstallKinds.Portable); + + using var admin = await fixture.SignedInAsync("msi-admin"); + var batch = await (await admin.PostAsJsonAsync(ApiRoutes.AgentUpgrades, + new StartAgentUpgradeRequest([msi, portable], Version: V2), JsonDefaults.Options)).ReadAsync(); + Assert.Equal(2, batch.Upgrades.Count); + Assert.Equal(AgentPackageTypes.Msi, Assert.Single(await fixture.UpgradesOfAsync(msi)).PackageType); + Assert.Equal(AgentPackageTypes.WindowsZip, Assert.Single(await fixture.UpgradesOfAsync(portable)).PackageType); + + // V3 has no MSI: the MSI device is left out, never handed the zip. + var other = await fixture.SeedAgentAsync("MSI-2", V1, install: AgentInstallKinds.Msi); + var newest = await (await admin.PostAsJsonAsync(ApiRoutes.AgentUpgrades, + new StartAgentUpgradeRequest([other], Version: V3), JsonDefaults.Options)).ReadAsync(); + Assert.Empty(newest.Upgrades); + Assert.Equal(AgentUpgradeReasons.NoPackage, Assert.Single(newest.Skipped).Reason); + + // Without a version: the newest MSI (V2), not the newest zip (V3). + var latest = await (await admin.PostAsJsonAsync(ApiRoutes.AgentUpgrades, + new StartAgentUpgradeRequest([other]), JsonDefaults.Options)).ReadAsync(); + Assert.Equal(V2, Assert.Single(latest.Upgrades).TargetVersion); + } + + [Fact] + public async Task TheMsiCommandCarriesTheMsiOfTheRunningVersionToRollBackTo() + { + await fixture.ResetAsync(); + var current = await fixture.SeedPackageAsync(V1, AgentPackageTypes.Msi, content: "msi v1"); + var target = await fixture.SeedPackageAsync(V2, AgentPackageTypes.Msi); + await fixture.SeedPackageAsync(V2); + var msi = await fixture.SeedAgentAsync("MSI-RB", V1, install: AgentInstallKinds.Msi); + var portable = await fixture.SeedAgentAsync("ZIP-RB", V1, install: AgentInstallKinds.Portable); + + using (var admin = await fixture.SignedInAsync("msi-admin-1")) + { + await admin.PostAsJsonAsync(ApiRoutes.AgentUpgrades, new StartAgentUpgradeRequest([msi, portable], Version: V2), JsonDefaults.Options); + } + + var sender = new RecordingUpgradeSender(); + await fixture.Scheduler(sender).RunPassAsync(DateTimeOffset.UtcNow, CancellationToken.None); + + var command = sender.Sent.Single(s => s.ClientId == msi).Command; + Assert.Equal(AgentPackageTypes.Msi, command.PackageType); + Assert.Equal(target.Sha256, command.Sha256); + Assert.Equal(V1, command.RollbackVersion); + Assert.Equal(ApiRoutes.For.AgentPackageBySha(current.Sha256), command.RollbackDownloadUrl); + Assert.Equal(current.Sha256, command.RollbackSha256); + Assert.Equal(current.SizeBytes, command.RollbackSizeBytes); + + var zip = sender.Sent.Single(s => s.ClientId == portable).Command; + Assert.Equal(AgentPackageTypes.WindowsZip, zip.PackageType); + Assert.Null(zip.RollbackVersion); + Assert.Null(zip.RollbackDownloadUrl); + } + + [Fact] + public async Task AnMsiCommandForAVersionTheServerHasNoMsiOfCarriesNoRollback() + { + await fixture.ResetAsync(); + await fixture.SeedPackageAsync(V2, AgentPackageTypes.Msi); + var msi = await fixture.SeedAgentAsync("MSI-NORB", V1, install: AgentInstallKinds.Msi); + + using (var admin = await fixture.SignedInAsync("msi-admin-2")) + { + await admin.PostAsJsonAsync(ApiRoutes.AgentUpgrades, new StartAgentUpgradeRequest([msi], Version: V2), JsonDefaults.Options); + } + + var sender = new RecordingUpgradeSender(); + await fixture.Scheduler(sender).RunPassAsync(DateTimeOffset.UtcNow, CancellationToken.None); + + var command = Assert.Single(sender.Sent).Command; + Assert.Equal(AgentPackageTypes.Msi, command.PackageType); + Assert.Null(command.RollbackVersion); + Assert.Null(command.RollbackSha256); + } + + [Fact] + public async Task RollingBackAnMsiDeviceGoesThroughTheMsiOfThePreviousVersion() + { + await fixture.ResetAsync(); + var previous = await fixture.SeedPackageAsync(V1, AgentPackageTypes.Msi); + await fixture.SeedPackageAsync(V1); + await fixture.SeedPackageAsync(V2, AgentPackageTypes.Msi); + var device = await fixture.SeedAgentAsync("MSI-BACK", V2, install: AgentInstallKinds.Msi); + await fixture.SeedUpgradeAsync(device, V1, V2, AgentUpgradeStates.Succeeded); + + using var admin = await fixture.SignedInAsync("msi-rollback"); + var batch = await (await admin.PostAsJsonAsync(ApiRoutes.AgentUpgradesRollback, + new RollBackAgentRequest([device]), JsonDefaults.Options)).ReadAsync(); + + Assert.Equal(V1, Assert.Single(batch.Upgrades).TargetVersion); + var row = (await fixture.UpgradesOfAsync(device)).Single(u => u.Source == AgentUpgradeSources.Rollback); + Assert.Equal(AgentPackageTypes.Msi, row.PackageType); + Assert.Equal(previous.Id, row.PackageId); + + var sender = new RecordingUpgradeSender(); + await fixture.Scheduler(sender).RunPassAsync(DateTimeOffset.UtcNow, CancellationToken.None); + var command = Assert.Single(sender.Sent).Command; + Assert.True(command.Revert); + Assert.Equal(AgentPackageTypes.Msi, command.PackageType); + } + + [Fact] + public async Task TheDeviceSaysHowItsAgentWasInstalled() + { + await fixture.ResetAsync(); + var device = await fixture.SeedAgentAsync("MSI-DTO", V1, install: AgentInstallKinds.Msi); + + using var admin = await fixture.SignedInAsync("msi-dto"); + var detail = await (await admin.GetAsync($"{ApiRoutes.Devices}/{device}")).ReadAsync(); + + Assert.Equal(AgentInstallKinds.Msi, detail.Device.AgentInstall); + } +} diff --git a/tests/Backend.Tests/AgentUpgradeTestKit.cs b/tests/Backend.Tests/AgentUpgradeTestKit.cs index 1fce3bb..44df8a0 100644 --- a/tests/Backend.Tests/AgentUpgradeTestKit.cs +++ b/tests/Backend.Tests/AgentUpgradeTestKit.cs @@ -69,7 +69,7 @@ internal static class AgentUpgradeTestKit public static async Task SeedAgentAsync( this BackendTestFixture fixture, string hostname, string? version, string? runtime = "win-x64", - bool online = true, string? osCaption = null) + bool online = true, string? osCaption = null, string? install = null) { var clientId = await fixture.SeedDeviceAsync(hostname, online); await fixture.WithDbAsync(async db => @@ -78,6 +78,7 @@ internal static class AgentUpgradeTestKit device.AgentVersion = version; device.AgentRuntime = runtime; device.OsCaption = osCaption; + device.AgentInstall = install; await db.SaveChangesAsync(); }); return clientId; diff --git a/tests/Backend.Tests/AgentUpgradeTests.cs b/tests/Backend.Tests/AgentUpgradeTests.cs index 8453559..363b116 100644 --- a/tests/Backend.Tests/AgentUpgradeTests.cs +++ b/tests/Backend.Tests/AgentUpgradeTests.cs @@ -41,8 +41,15 @@ public class AgentCatalogTests(BackendTestFixture fixture) : IClassFixture(); Assert.Null(await catalog.ImportAsync(AgentPackageTypes.WindowsZip, source, "0.0.0.0", CancellationToken.None)); Assert.Null(await catalog.ImportAsync(AgentPackageTypes.WindowsZip, source, null, CancellationToken.None)); - Assert.Null(await catalog.ImportAsync(AgentPackageTypes.Msi, source, V2, CancellationToken.None)); Assert.Equal(1, await fixture.WithDbAsync(db => db.AgentPackages.CountAsync())); + + // The MSI is catalogued too: MSI installs upgrade through it. + var msi = await catalog.ImportAsync(AgentPackageTypes.Msi, source, V1, CancellationToken.None); + Assert.NotNull(msi); + Assert.Equal("Agent.msi", msi.FileName); + Assert.Equal($"{V1}/Agent.msi", msi.StoragePath); + Assert.True(File.Exists(CatalogFile(V1, "Agent.msi"))); + Assert.Equal(2, await fixture.WithDbAsync(db => db.AgentPackages.CountAsync())); } [Fact] -- 2.52.0 From 81b017275b0dec1f80c268634d7591af74a2b73ca0dc13db00b24318f29aa875 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:34:00 -0400 Subject: [PATCH 09/26] feat(console): show how an agent was installed and list the MSI as Windows (MSI) The device page's Agent card has an Install row (Installed by MSI / Portable, the upgrade path on hover), and the devices list's Agent version says it on hover. The newest version a device is offered counts only MSIs for an MSI install. Version chips name the MSI "Windows (MSI)"; the msi and installer-busy reasons get labels; the installing and rolled-back hovers no longer speak of swapping files only. Co-Authored-By: Claude Opus 5.5 --- src/WebUI/src/api/types.ts | 4 +++ src/WebUI/src/pages/devices/index.tsx | 9 ++++++- .../src/sections/devices/DeviceOverview.tsx | 13 ++++++++-- .../src/sections/upgrades/UpgradeChips.tsx | 26 ++++++++++++++----- .../src/sections/upgrades/agentVersions.ts | 10 +++---- .../src/sections/upgrades/upgradeLabels.ts | 22 +++++++++++++--- 6 files changed, 66 insertions(+), 18 deletions(-) diff --git a/src/WebUI/src/api/types.ts b/src/WebUI/src/api/types.ts index 701dafb..c265d50 100644 --- a/src/WebUI/src/api/types.ts +++ b/src/WebUI/src/api/types.ts @@ -27,8 +27,12 @@ export interface DeviceDto { isOrphaned?: boolean; /** Groups the device is directly in (absent when no groups exist). */ groupIds?: string[]; + /** How the agent was installed (from presence): msi upgrades through Windows Installer, portable by swapping files. */ + agentInstall?: AgentInstallKind; } +export type AgentInstallKind = 'msi' | 'portable'; + // ── Device grouping ─────────────────────────────────────────────────── /** Folders hold no devices of their own; every kind includes its nested groups' devices. */ diff --git a/src/WebUI/src/pages/devices/index.tsx b/src/WebUI/src/pages/devices/index.tsx index 2641ec9..dca19b5 100644 --- a/src/WebUI/src/pages/devices/index.tsx +++ b/src/WebUI/src/pages/devices/index.tsx @@ -289,7 +289,14 @@ export default function DevicesPage() { header: 'Agent', nowrap: true, sortValue: (d) => versionSortKey(d.agentVersion), - cell: (d) => + cell: (d) => ( + + ) }, { id: 'lastSeen', diff --git a/src/WebUI/src/sections/devices/DeviceOverview.tsx b/src/WebUI/src/sections/devices/DeviceOverview.tsx index 0907943..38178d8 100644 --- a/src/WebUI/src/sections/devices/DeviceOverview.tsx +++ b/src/WebUI/src/sections/devices/DeviceOverview.tsx @@ -22,7 +22,7 @@ import Properties from 'components/Properties'; import { deviceUpgradesKey } from 'sections/devices/DeviceUpgrades'; import { newestFor } from 'sections/upgrades/agentVersions'; import { AgentVersion, UpgradeStateChip } from 'sections/upgrades/UpgradeChips'; -import { isOpenUpgrade } from 'sections/upgrades/upgradeLabels'; +import { INSTALL_KINDS, isOpenUpgrade } from 'sections/upgrades/upgradeLabels'; import useApi from 'hooks/useApi'; import useLiveRefresh from 'hooks/useLiveRefresh'; import { api, errorMessage, keys } from 'api/client'; @@ -74,6 +74,7 @@ export default function DeviceOverview({ detail, canManage, onChanged }: Props) const byNewest = [...(upgrades ?? [])].sort((a, b) => b.createdUtc.localeCompare(a.createdUtc)); const open = byNewest.find((u) => isOpenUpgrade(u.state)); const last = byNewest.find((u) => !isOpenUpgrade(u.state) && u.finishedUtc); + const installKind = device.agentInstall ? INSTALL_KINDS[device.agentInstall] : undefined; return ( @@ -147,7 +148,15 @@ export default function DeviceOverview({ detail, canManage, onChanged }: Props) items={[ { label: 'Version', - value: + value: + }, + { + label: 'Install', + value: installKind ? ( + + + + ) : undefined }, ...(open ? [ diff --git a/src/WebUI/src/sections/upgrades/UpgradeChips.tsx b/src/WebUI/src/sections/upgrades/UpgradeChips.tsx index 1f5f865..bb62d3e 100644 --- a/src/WebUI/src/sections/upgrades/UpgradeChips.tsx +++ b/src/WebUI/src/sections/upgrades/UpgradeChips.tsx @@ -8,7 +8,7 @@ import Typography from '@mui/material/Typography'; // project imports import Dot from 'components/@extended/Dot'; import { upgradeAvailable } from './agentVersions'; -import { UPGRADE_REASONS, UPGRADE_STATES } from './upgradeLabels'; +import { INSTALL_KINDS, UPGRADE_REASONS, UPGRADE_STATES } from './upgradeLabels'; import type { AgentUpgradeDto, AgentUpgradeState } from 'api/types'; // assets @@ -47,13 +47,27 @@ export function UpgradeStateChip({ // ==============================|| AGENT VERSION (WITH UPGRADE MARKERS) ||============================== // -/** A device's agent version, marked when a newer one is available and while an upgrade is open. */ -export function AgentVersion({ version, newest, open }: { version?: string; newest?: string; open?: AgentUpgradeDto }) { +/** A device's agent version, marked when a newer one is available and while an upgrade is open; how it was installed on hover. */ +export function AgentVersion({ + version, + newest, + open, + install +}: { + version?: string; + newest?: string; + open?: AgentUpgradeDto; + install?: string; +}) { + const kind = install ? INSTALL_KINDS[install] : undefined; + const text = ( + + {version ?? '—'} + + ); return ( - - {version ?? '—'} - + {kind && version ? {text} : text} {!open && upgradeAvailable(version, newest) && ( String(n).padStart(10, '0')).join('')}` : `0${version}`; } -/** Package types an agent on this OS upgrades from. */ -function packagesFor(osCaption?: string | null): string[] { +/** Package types an agent on this OS upgrades from (the MSI when the MSI installed it). */ +function packagesFor(osCaption?: string | null, install?: string | null): string[] { switch (platformOf(osCaption)) { case 'windows': - return ['zip']; + return install === 'msi' ? ['msi'] : ['zip']; case 'linux': return ['linux-x64', 'linux-arm64']; case 'macos': @@ -46,8 +46,8 @@ function packagesFor(osCaption?: string | null): string[] { } /** The newest catalog version holding a package for the device's platform (by its OS; the server decides by architecture). */ -export function newestFor(versions: AgentVersionDto[] | undefined, osCaption?: string | null): string | undefined { - const types = packagesFor(osCaption); +export function newestFor(versions: AgentVersionDto[] | undefined, osCaption?: string | null, install?: string | null): string | undefined { + const types = packagesFor(osCaption, install); return (versions ?? []) .filter((v) => v.packages.some((p) => types.includes(p.packageType))) .map((v) => v.version) diff --git a/src/WebUI/src/sections/upgrades/upgradeLabels.ts b/src/WebUI/src/sections/upgrades/upgradeLabels.ts index 8eadab8..85f10c3 100644 --- a/src/WebUI/src/sections/upgrades/upgradeLabels.ts +++ b/src/WebUI/src/sections/upgrades/upgradeLabels.ts @@ -10,14 +10,14 @@ export const UPGRADE_STATES: Record = package: { label: 'Bad Package', help: 'The package could not be unpacked or has no agent in it.' }, watchdog: { label: 'Watchdog Unavailable', help: 'The watchdog is missing or did not pick the upgrade up in time.' }, swap: { label: "Files Couldn't Be Swapped", help: 'The files could not be swapped; the previous version was put back.' }, + msi: { label: 'Windows Installer Failed', help: 'Windows Installer did not install the new version; the previous one stays.' }, + 'installer-busy': { + label: 'Windows Installer Busy', + help: 'Another installation kept Windows Installer busy through every retry; the previous version stays.' + }, 'health-deadline': { label: 'Not Healthy in Time', help: 'The new version did not report healthy before the deadline, so it was rolled back.' @@ -66,13 +71,22 @@ export const UPGRADE_SOURCES: Record = /** Platform names for the package types a version holds. */ export const PACKAGE_TYPES: Record = { - zip: { label: 'Windows' }, - msi: { label: 'Windows MSI', help: 'For new installs; upgrades use the Windows zip.' }, + zip: { label: 'Windows', help: 'Upgrades portable Windows installs by swapping files.' }, + msi: { label: 'Windows (MSI)', help: 'New installs, and upgrades of agents the MSI installed, through Windows Installer.' }, 'linux-x64': { label: 'Linux x64' }, 'linux-arm64': { label: 'Linux Arm64' }, 'osx-x64': { label: 'macOS x64' }, 'osx-arm64': { label: 'macOS Arm64' } }; +/** How a device's agent was installed, which decides how it upgrades. */ +export const INSTALL_KINDS: Record = { + msi: { + label: 'Installed by MSI', + help: 'MSI installs upgrade through Windows Installer, so Programs and Features shows the real version.' + }, + portable: { label: 'Portable', help: 'Portable installs upgrade by swapping files in place.' } +}; + /** Display order of package types. */ export const PACKAGE_ORDER = ['zip', 'msi', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64']; -- 2.52.0 From 485ec77d8e86d594a167f17aeca7036324c33915aa45dcc804b77ec95aedc3ea Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:34:58 -0400 Subject: [PATCH 10/26] docs: MSI installs upgrade through Windows Installer, in process How an agent the MSI installed upgrades: no msiexec, the Windows Installer API from a detached runner, the verbose logs beside the agent's, 1618 retries, ALLOWDOWNGRADE rollbacks, kept packages, and the server's copy for the first upgrade of an install that has none kept; the catalog now holds the MSI. Co-Authored-By: Claude Opus 5.5 --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 26a4700..902bf8e 100644 --- a/README.md +++ b/README.md @@ -611,8 +611,9 @@ the package over. 1. The agent takes the `command.agent.upgrade` command. It answers at once, without downloading, when it cannot or need not upgrade: **unsupported** - (not running as the installed service, or the package is for another - platform), **busy** (another hand-over, swap or unreported outcome is + (not running as the installed service, the package is for another + platform, or a zip for an agent the MSI installed and the other way round), + **busy** (another hand-over, swap, MSI run or unreported outcome is pending), or **succeeded / already** (it runs that version). A redelivered command (same upgrade ID) is ignored. 2. It waits a random start jitter (0 to the seconds the server sends), then @@ -653,6 +654,59 @@ never moved. The watchdog replaces **its own binary last**, after the new agent is kept, and only when the package's watchdog is newer and runs (`version` exits 0 within 30 s); it then restarts onto it through the service manager. +### Agents the MSI installed + +A swap would leave Windows Installer, Programs and Features and every +detection tool that reads them showing the version the MSI installed, so an +agent the MSI installed upgrades (and rolls back) **through its MSI** instead. +The agent finds out at start: Windows Installer holds a product of the agent's +UpgradeCode (`MsiEnumRelatedProductsW`) installed in its own folder; no +product, another folder, or no Windows Installer at all (WinPE) is a portable +install. It reports `msi` or `portable` on presence, the device page shows it +(**Installed by MSI** / **Portable**), and the server sends an MSI install the +version's `Agent.msi` (a version the server holds no MSI of is skipped as +**no-package**; it never gets the zip). Nothing runs `msiexec.exe` or +PowerShell: the MSI is installed in process through the Windows Installer API. + +1. The agent downloads and checks the MSI (same jitter, size and SHA-256 as a + zip) into `upgrade/msi/ExecuteR-Agent-.msi` and confirms it is the + agent's MSI of that version (its UpgradeCode and `UNIFIEDVERSION`). For a + rollback it sets the MSI of the version it runs now beside it + (`upgrade/msi/rollback/`): its own kept copy, else the copy the server + sends with the command (downloaded, checked and kept). Without either the + upgrade still goes ahead, and the hand-over and the outcome say a new + version that is not healthy cannot be rolled back automatically. +2. The watchdog checks both MSIs again, writes `upgrade/msi.json`, copies its + own binary to `upgrade/msi/runner/` and starts the copy **detached** (its + own process group, out of the service's job, no console), because the MSI + stops both services. No file is swapped. +3. The runner calls Windows Installer with no UI and a verbose log + (`/l*v`) in `\Logs\agent-msi--.log`, with + `REBOOT=ReallySuppress`. 0, 3010 and 1641 mean installed; **1618** (another + installation under way) is tried again every 30 s for up to 10 minutes, + then the upgrade fails as **installer-busy**; any other code, or 30 minutes + without an answer, fails as **msi** with the code, the log path and its last + lines (Windows Installer's own transaction leaves the previous version in + place). +4. The MSI starts the new services; the runner keeps the version when its + beacon reports it, connected, within the health deadline. Otherwise it + installs the previous version's MSI again with `ALLOWDOWNGRADE=1` (its own + log, `agent-msi--.log`) and ends **rolled back** with the new + agent's last log lines; with no MSI to go back to, the new version stays + and the upgrade fails as **health-deadline**. A **Roll Back Agent** from the + console installs the older MSI with `ALLOWDOWNGRADE=1` from the start. +5. The runner leaves both services running, writes the outcome and exits. A + watchdog that starts meanwhile (the new version's, started by the MSI) + leaves a live runner alone; one that died is started again from + `msi.json`, at most three times, and the agent is never started by the + watchdog while the run is pending. + +MSIs are kept for later rollbacks in `%ProgramData%\ExecuteR\packages\\`: +the one the device was installed from (the installer keeps it) and every one an +upgrade brought, the newest three. The first upgrade of an MSI install that has +none kept yet rolls back with the server's copy of its version, when the server +still holds it. + ### What you see on disk | Path | Meaning | @@ -663,6 +717,10 @@ exits 0 within 30 s); it then restarts onto it through the service manager. | `upgrade/outcome.json` | how the last swap ended, until the agent has reported it | | `upgrade/downloads/`, `upgrade/staging/` | the newest package, zipped and unpacked | | `/.next`, `.previous`, `.failed` | exist only during a swap | +| `upgrade/msi.json`, `upgrade/msi.lock` | an MSI upgrade under way: its phase (`installing`, `verifying`, `rolling-back`), Windows Installer's last code and busy retries; the runner holds the lock while it lives | +| `upgrade/msi/` | the MSI being installed, the one to go back to (`rollback/`) and the runner's copy of the watchdog (`runner/`) | +| `\Logs\agent-msi--.log`, `ExecuteR-Watchdog-msi.log` | Windows Installer's verbose log of each MSI run, and the runner's own log | +| `%ProgramData%\ExecuteR\packages\\` | agent MSIs kept for rollback (the newest three) | If the watchdog itself stops part way (power loss, a kill), its next start finishes or undoes the run from the journal: `stopping` starts over (the agent @@ -1448,9 +1506,12 @@ How upgrades are started, paced and rolled back. What happens on the device is i **Versions arrive with each server release.** The agent packages that ship in the backend image (or are dropped into `AGENT_PACKAGE_PATH`, with their `VERSION` marker) are imported into the server's **version catalog** at -startup and every five minutes: the portable Windows zip and the Linux/macOS -builds (the MSI is for installs only — Windows upgrades swap files from the -zip). Each package is copied to `/agent-packages//`, so a +startup and every five minutes: the MSI (listed as **Windows (MSI)**), the +portable Windows zip and the Linux/macOS builds. Each device gets the package +of how its agent was installed: an agent the MSI installed upgrades through +the MSI, with the MSI of the version it runs now in the command for a +rollback when the catalog holds it; a portable one swaps files from the zip. +Each package is copied to `/agent-packages//`, so a device can still be rolled back after the image moves on. A development build (`0.0.0.0`) or a package without a version is not catalogued. -- 2.52.0 From da2631281f03f27887cd97cae409e0bcac12d9f0e7cb431e3eb3914e6724f162 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:44:31 -0400 Subject: [PATCH 11/26] feat(watchdog): hold the MSI read-only while Windows Installer installs it The runner opens the MSI (and the rollback MSI) sharing read only and checks its SHA-256 from that handle, holding it until Windows Installer answers, so what installs is what was checked: nothing can write, replace or rename it in between. Co-Authored-By: Claude Opus 5.5 --- src/Agent.Watchdog/Msi/MsiRunner.cs | 24 +++++++++---- src/Agent.Watchdog/Msi/MsiUpgrade.cs | 34 +++++++++++++++++++ tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs | 26 ++++++++++++++ 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/src/Agent.Watchdog/Msi/MsiRunner.cs b/src/Agent.Watchdog/Msi/MsiRunner.cs index 6424743..3676064 100644 --- a/src/Agent.Watchdog/Msi/MsiRunner.cs +++ b/src/Agent.Watchdog/Msi/MsiRunner.cs @@ -117,7 +117,8 @@ public sealed class MsiRunner( /// Installs the new version's MSI; the journal of the next phase, or null when the run ended. private async Task InstallAsync(WatchdogMsiJournal journal, CancellationToken cancellationToken) { - if (MsiUpgrade.Check(journal.Msi, options) is { } problem) + var (held, problem) = MsiUpgrade.Hold(journal.Msi, options); + if (held is null) { log.Error($"The MSI of {journal.Version} does not check out ({problem}); nothing was installed"); return await EndAsync(journal, AgentUpgradeStates.Failed, AgentUpgradeReasons.Hash, @@ -130,8 +131,12 @@ public sealed class MsiRunner( var logPath = options.MsiLogPath(journal.Version, journal.UpgradeId); var properties = journal.Revert ? DowngradeProperties : InstallProperties; log.Info($"Installing {journal.Version} through Windows Installer ({properties}); its log is {logPath}"); - var (result, code, updated) = await InstallWithRetriesAsync(journal, journal.Msi.Path, properties, logPath, cancellationToken); - journal = updated; + InstallResult result; + int code; + using (held) + { + (result, code, journal) = await InstallWithRetriesAsync(journal, journal.Msi.Path, properties, logPath, cancellationToken); + } switch (result) { @@ -199,8 +204,8 @@ public sealed class MsiRunner( var previous = journal.RollbackVersion ?? journal.FromVersion; var why = rollbackReason == AgentUpgradeReasons.Crashed ? "kept exiting" : "did not report healthy in time"; var rollback = journal.RollbackMsi; - var problem = rollback is null ? "it is not there" : MsiUpgrade.Check(rollback, options); - if (rollback is null || problem is not null) + var (held, problem) = rollback is null ? (null, "it is not there") : MsiUpgrade.Hold(rollback, options); + if (rollback is null || held is null) { log.Error($"The MSI of {previous} does not check out ({problem}); {journal.Version} stays"); return await EndAsync(journal, AgentUpgradeStates.Failed, rollbackReason, @@ -213,8 +218,13 @@ public sealed class MsiRunner( Write(journal); var logPath = options.MsiLogPath(previous, journal.UpgradeId); log.Info($"Installing {previous} again through Windows Installer ({DowngradeProperties}); its log is {logPath}"); - var (result, code, updated) = await InstallWithRetriesAsync(journal, rollback.Path, DowngradeProperties, logPath, cancellationToken); - journal = updated; + InstallResult result; + int code; + using (held) + { + (result, code, journal) = await InstallWithRetriesAsync(journal, rollback.Path, DowngradeProperties, logPath, cancellationToken); + } + if (result != InstallResult.Installed) { var what = result switch diff --git a/src/Agent.Watchdog/Msi/MsiUpgrade.cs b/src/Agent.Watchdog/Msi/MsiUpgrade.cs index 4789796..fdf92b7 100644 --- a/src/Agent.Watchdog/Msi/MsiUpgrade.cs +++ b/src/Agent.Watchdog/Msi/MsiUpgrade.cs @@ -217,6 +217,40 @@ public sealed class MsiUpgrade(WatchdogOptions options, IMsiRunnerLauncher? laun } } + /// + /// , then the file opened sharing read only and its + /// SHA-256 checked again from that handle: held while Windows Installer + /// installs it, nothing can write, replace or rename it meanwhile, so what + /// installs is what was checked. Null with the problem when it does not check out. + /// + public static (FileStream? Held, string? Problem) Hold(WatchdogFile file, WatchdogOptions options) + { + if (Check(file, options) is { } problem) + { + return (null, problem); + } + + FileStream? held = null; + try + { + held = new FileStream(file.Path, FileMode.Open, FileAccess.Read, FileShare.Read); + var sha = Convert.ToHexStringLower(System.Security.Cryptography.SHA256.HashData(held)); + held.Position = 0; + if (held.Length == file.Size && string.Equals(sha, file.Sha256, StringComparison.OrdinalIgnoreCase)) + { + return (held, null); + } + + held.Dispose(); + return (null, Mismatch); + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + held?.Dispose(); + return (null, $"it cannot be held open ({exception.Message})"); + } + } + /// A beacon of , connected, written at or after . public static bool IsHealthy(WatchdogOptions options, string version, DateTimeOffset since) => WatchdogFileStore.Read(options.HealthPath, WatchdogJsonContext.Default.WatchdogHealthBeacon) is { Connected: true } beacon diff --git a/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs b/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs index 86ce4cf..870594e 100644 --- a/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs +++ b/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs @@ -459,6 +459,32 @@ public sealed class MsiUpgradeTests : IDisposable Assert.False(MsiRunLock.IsHeld(Options.MsiRunnerLockPath)); } + [Fact] + public async Task TheMsiIsHeldReadOnlyWhileWindowsInstallerInstallsIt() + { + var journal = Journal(); + var writable = true; + installer.Answer = (_, _) => + { + try + { + using var write = new FileStream(journal.Msi.Path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite); + } + catch (IOException) + { + writable = false; + } + + return MsiExitCodes.Success; + }; + + await CreateRunner().RunAsync(journal.UpgradeId, CancellationToken.None); + + // Windows enforces the sharing mode (the only place an MSI runs). + Assert.True(!OperatingSystem.IsWindows() || !writable); + Assert.Equal(AgentUpgradeStates.Succeeded, fixture.Outcome!.Result); + } + // ---- recovery ---------------------------------------------------------- [Fact] -- 2.52.0 From 8205bbc34a2a00cd72384bc1a0669aca5c18c7f0e9ad3a0a4f0e358ff6aa4e70 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:47:56 -0400 Subject: [PATCH 12/26] test: the rolled-back MSI run reads the new agent's log, not an older one Two agent logs written in the same instant made the newest one a coin toss; the test now leaves only the new agent's. Co-Authored-By: Claude Opus 5.5 --- tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs b/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs index 870594e..7d9272a 100644 --- a/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs +++ b/tests/Agent.Watchdog.Tests/MsiUpgradeTests.cs @@ -367,6 +367,7 @@ public sealed class MsiUpgradeTests : IDisposable public async Task ANewVersionThatIsNotHealthyIsRolledBackByTheMsiOfThePreviousOne() { fixture.Agent.Behave = version => version == WatchdogFixture.ToVersion ? AgentBehavior.Unconnected : AgentBehavior.Healthy; + File.Delete(fixture.InstalledPath("Logs/ExecuteR-Agent-20261023.log")); fixture.WriteInstalled("Logs/ExecuteR-Agent-20261024.log", "new agent: could not connect\n"); var journal = Journal(); -- 2.52.0 From 2e00b8df83e225802a2a895ed3a86b94e3a5b6ec3b0caa7f48f2a2500e07bd34 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:15:35 -0400 Subject: [PATCH 13/26] build(version)!: semantic versions from release tags Releases are X.Y.Z from git tags vX.Y.Z; builds between releases are X.Y.Z.N, N commits after the last release (git describe, 1-3 digit majors only, so the calendar-era tags never count); with no release tag reachable a build is 0.0.0.. Every version is 3-4 numeric fields, refused when it does not fit an MSI ProductVersion or has a calendar-era major. scripts/Get-Version.ps1 computes it (Get-UnifiedVersion.ps1 stays as the old entry point). scripts/Get-NextRelease.ps1 runs semantic-release in dry-run mode (pinned in build/release, conventionalcommits preset, main only) for the version a release publishes, or for nothing when the commits since the last release call for none. Directory.Build.props stamps four-field assembly/file versions and InformationalVersion X.Y.Z[.N]+; a build not handed a version reads it from git (build/Version.targets), otherwise 0.0.0.0. BREAKING CHANGE: versions are no longer yyyy.MM.dd.HHmm. The first release after the seed tag v0.1.0 is 1.0.0, which every comparison orders after every calendar-era version. Co-Authored-By: Claude Opus 5.5 --- Directory.Build.props | 29 +- build/Version.targets | 75 + build/release/last-release-plugin.mjs | 9 + build/release/next-release.mjs | 56 + build/release/package-lock.json | 5553 +++++++++++++++++++++++++ build/release/package.json | 18 + build/release/release-config.mjs | 25 + scripts/Get-NextRelease.ps1 | 93 + scripts/Get-UnifiedVersion.ps1 | 27 +- scripts/Get-Version.ps1 | 125 + 10 files changed, 5977 insertions(+), 33 deletions(-) create mode 100644 build/Version.targets create mode 100644 build/release/last-release-plugin.mjs create mode 100644 build/release/next-release.mjs create mode 100644 build/release/package-lock.json create mode 100644 build/release/package.json create mode 100644 build/release/release-config.mjs create mode 100644 scripts/Get-NextRelease.ps1 create mode 100644 scripts/Get-Version.ps1 diff --git a/Directory.Build.props b/Directory.Build.props index e20fce1..d5a1bf1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,19 +1,26 @@ - $([System.DateTime]::get_UtcNow().ToString('yyyy.MM.dd.HHmm')) + true + 0.0.0.0 + + $(UnifiedVersion) + $(UnifiedVersion).0 $(UnifiedVersion) - $(UnifiedVersion) - $(UnifiedVersion) - - $(UnifiedVersion)-$(GitCommitShort) + $(UnifiedFileVersion) + $(UnifiedFileVersion) + + $(UnifiedVersion)+$(GitCommitShort) $(UnifiedVersion) false ExecuteR @@ -30,4 +37,6 @@ true + + diff --git a/build/Version.targets b/build/Version.targets new file mode 100644 index 0000000..ca78b79 --- /dev/null +++ b/build/Version.targets @@ -0,0 +1,75 @@ + + + + + + + <_VersionPattern>^(\d{1,9})\.(\d{1,9})\.(\d{1,9})(\.(\d{1,9}))?$ + <_VersionWellFormed>$([System.Text.RegularExpressions.Regex]::IsMatch('$(UnifiedVersion)', '$(_VersionPattern)')) + + + + <_VersionMajor>$([System.Text.RegularExpressions.Regex]::Replace('$(UnifiedVersion)', '$(_VersionPattern)', '$1')) + <_VersionMinor>$([System.Text.RegularExpressions.Regex]::Replace('$(UnifiedVersion)', '$(_VersionPattern)', '$2')) + <_VersionPatch>$([System.Text.RegularExpressions.Regex]::Replace('$(UnifiedVersion)', '$(_VersionPattern)', '$3')) + <_VersionBuild>$([System.Text.RegularExpressions.Regex]::Replace('$(UnifiedVersion)', '$(_VersionPattern)', '$5')) + <_VersionBuild Condition="'$(_VersionBuild)' == ''">0 + + + + + + + + + + + + + <_DescribePattern>^v(\d{1,3}\.\d{1,9}\.\d{1,9})-(\d+)-g([0-9a-f]+)$ + <_Described>$([System.Text.RegularExpressions.Regex]::IsMatch('$(_Describe)', '$(_DescribePattern)')) + + + + + + + + + <_Base>$([System.Text.RegularExpressions.Regex]::Replace('$(_Describe)', '$(_DescribePattern)', '$1')) + <_Since>$([System.Text.RegularExpressions.Regex]::Replace('$(_Describe)', '$(_DescribePattern)', '$2')) + <_Short>$([System.Text.RegularExpressions.Regex]::Replace('$(_Describe)', '$(_DescribePattern)', '$3')) + + + <_Base>0.0.0 + <_Since>$(_Count) + <_Short>$(_HeadShort) + + + + + + $(_Base) + $(_Base).$(_Since) + $(_Base).$(_Since) + $(_Short) + $(GitCommitShort).dirty + $(UnifiedVersion) + $(UnifiedFileVersion) + $(UnifiedFileVersion) + $(UnifiedVersion)+$(GitCommitShort) + + + diff --git a/build/release/last-release-plugin.mjs b/build/release/last-release-plugin.mjs new file mode 100644 index 0000000..2df115f --- /dev/null +++ b/build/release/last-release-plugin.mjs @@ -0,0 +1,9 @@ +// A semantic-release plugin that only looks: it records the last release semantic-release found, because a run with nothing to +// release returns no result at all. It hands it to next-release.mjs in the same process through a global (semantic-release copies +// plugin options). It never changes the bump (its commit type is none). +export const seenKey = Symbol.for('executer.release.lastRelease'); + +export function analyzeCommits(_pluginConfig, context) { + globalThis[seenKey] = context.lastRelease; + return null; +} diff --git a/build/release/next-release.mjs b/build/release/next-release.mjs new file mode 100644 index 0000000..51adde9 --- /dev/null +++ b/build/release/next-release.mjs @@ -0,0 +1,56 @@ +// The next release: semantic-release in dry-run mode on the repository, written as JSON to the file named by the first argument: +// { "version": "1.1.0", "gitTag": "v1.1.0", "lastVersion": "1.0.0", "type": "minor", "notes": "..." } +// or { "version": null, "lastVersion": "1.0.0" } when no commit since the last release calls for one (only docs, tests, chores...). +// Usage: node build/release/next-release.mjs [repository directory, default the repository this file is in] +import { writeFile } from 'node:fs/promises'; +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import semanticRelease from 'semantic-release'; +import { seenKey } from './last-release-plugin.mjs'; +import { calendarEraMajor, cleanNotes, releaseConfig } from './release-config.mjs'; + +export async function nextRelease(cwd, { env = process.env, log = process.stderr } = {}) { + const plugins = [...releaseConfig.plugins, fileURLToPath(new URL('./last-release-plugin.mjs', import.meta.url))]; + globalThis[seenKey] = undefined; + // semantic-release reports on stdout; this tool's output is the file, so its report goes to stderr. + const result = await semanticRelease({ ...releaseConfig, plugins, dryRun: true }, { cwd, env, stdout: log, stderr: log }); + const lastRelease = globalThis[seenKey]; + if (!lastRelease) { + throw new Error('semantic-release did not analyze this branch (not main, or behind its remote); see its report above.'); + } + + if (!lastRelease.version) { + // Never a "first release": history starts before semantic versions, at the seed tag (README, Versioning). + throw new Error('No release tag v.. is reachable from HEAD. Fetch the tags (full clone), or place the seed tag v0.1.0.'); + } + + const next = result ? result.nextRelease : null; + for (const version of [lastRelease.version, next?.version].filter(Boolean)) { + if (Number.parseInt(version, 10) >= calendarEraMajor) { + throw new Error(`${version} is a calendar-era version, not a semantic release.`); + } + } + + return next?.version + ? { version: next.version, gitTag: next.gitTag, lastVersion: lastRelease.version, type: next.type, notes: cleanNotes(next.notes) } + : { version: null, lastVersion: lastRelease.version }; +} + +if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + const out = resolve(process.argv[2] ?? 'next-release.json'); + const cwd = resolve(process.argv[3] ?? resolve(dirname(fileURLToPath(import.meta.url)), '../..')); + try { + const release = await nextRelease(cwd); + await writeFile(out, JSON.stringify(release, null, 2) + '\n', 'utf8'); + process.stderr.write( + release.version + ? `Next release: ${release.version} (${release.type}, after ${release.lastVersion})\n` + : `Nothing to release since ${release.lastVersion}\n`, + ); + } catch (error) { + // The reason goes into the file too, so the calling script can say it. + process.stderr.write(`${error.message}\n`); + await writeFile(out, JSON.stringify({ error: error.message }) + '\n', 'utf8').catch(() => {}); + process.exitCode = 1; + } +} diff --git a/build/release/package-lock.json b/build/release/package-lock.json new file mode 100644 index 0000000..0542627 --- /dev/null +++ b/build/release/package-lock.json @@ -0,0 +1,5553 @@ +{ + "name": "executer-release", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "executer-release", + "dependencies": { + "@semantic-release/commit-analyzer": "13.0.1", + "@semantic-release/release-notes-generator": "14.0.3", + "conventional-changelog-conventionalcommits": "8.0.0", + "semantic-release": "24.2.9" + }, + "engines": { + "node": ">=20.8.1" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@octokit/auth-token": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz", + "integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==", + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/core": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.8.tgz", + "integrity": "sha512-L7y8eYc+AwxGr2PWI4WFt1VG4TiJ66c26BD16mXpYIlXxG0SMigM1+m4aTSlYyBr5BlQsGAlz8uDCoZN4SEMcg==", + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^6.0.0", + "@octokit/graphql": "^9.0.5", + "@octokit/request": "^10.0.16", + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0", + "before-after-hook": "^4.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/endpoint": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.5.tgz", + "integrity": "sha512-iXa654H3yFafF/ieHkukfbgWo2rmXD2ceD0ZOtrPhw1bc3FDch1d9N/TNs0FQ1/cIbwb7kspUX8jzIs8nzb9DQ==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^18.0.0", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/graphql": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.5.tgz", + "integrity": "sha512-bt/hm03LeU6Vy7FwTrkkC9p3XGT/lBwClglMqxBSe5/q0E5CdJTXeAqEI0vlw89/LF/G6tryTIH8HirZ3prMVg==", + "license": "MIT", + "dependencies": { + "@octokit/request": "^10.0.16", + "@octokit/types": "^18.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-13.2.1.tgz", + "integrity": "sha512-Tj4PkZyIL6eBMYcG/76QGsedF0+dWVeLhYprTmuFVVxzDW7PQh23tM0TP0z+1MvSkxB29YFZwnUX+cXfTiSdyw==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^15.0.1" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-26.0.0.tgz", + "integrity": "sha512-7AtcfKtpo77j7Ts73b4OWhOZHTKo/gGY8bB3bNBQz4H+GRSWqx2yvj8TXRsbdTE0eRmYmXOEY66jM7mJ7LzfsA==", + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "15.0.2", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-15.0.2.tgz", + "integrity": "sha512-rR+5VRjhYSer7sC51krfCctQhVTmjyUMAaShfPB8mscVa8tSoLyon3coxQmXu0ahJoLVWl8dSGD/3OGZlFV44Q==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^26.0.0" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-8.1.1.tgz", + "integrity": "sha512-VCVvZ/R1+u3WuiBWpNavZ0mY4aaJNAsENrpBP9aLSR2QyOpQgd7DhM5j4AW7z4MQpnJYgwBPf0XqPQoNBRdQwg==", + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^7.1.1", + "@octokit/types": "^17.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=7" + } + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-28.0.0.tgz", + "integrity": "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ==", + "license": "MIT" + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-17.0.0.tgz", + "integrity": "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^28.0.0" + } + }, + "node_modules/@octokit/plugin-throttling": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-11.0.5.tgz", + "integrity": "sha512-LIdrkrUv+DWbKeg/49rGuFJ3SU0d3hUS+B4MhNZLepBoNUFXms8Ic9edJjrlx+zycqJHjrMRudVpVb/bAXM2Lw==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^17.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": "^7.0.0" + } + }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/openapi-types": { + "version": "28.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-28.0.0.tgz", + "integrity": "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ==", + "license": "MIT" + }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/types": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-17.0.0.tgz", + "integrity": "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^28.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "10.0.16", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.16.tgz", + "integrity": "sha512-A0zWGjHzISIb+9ccG8s0dq7LKO5zVpJLRICjgUb+sJxEWqn8RUHB1rD3AE51+PECvXHIxqZ1VVvs4fHTSD9nUQ==", + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^11.0.5", + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0", + "content-type": "^3.0.0", + "json-with-bigint": "^3.5.12", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/request-error": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.2.tgz", + "integrity": "sha512-XZRuT3xZ84D3gYErI1DZvhJ33dCWVV6uzBtWkaBB4TvA/L6eOeTZodxLFVB44bBEEo3vEx7y00UfX1tBLrtLRg==", + "license": "MIT", + "dependencies": { + "@octokit/types": "^18.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/types": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^29.0.1" + } + }, + "node_modules/@pnpm/config.env-replace": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz", + "integrity": "sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==", + "license": "MIT", + "engines": { + "node": ">=12.22.0" + } + }, + "node_modules/@pnpm/network.ca-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz", + "integrity": "sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA==", + "license": "MIT", + "dependencies": { + "graceful-fs": "4.2.10" + }, + "engines": { + "node": ">=12.22.0" + } + }, + "node_modules/@pnpm/network.ca-file/node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "license": "ISC" + }, + "node_modules/@pnpm/npm-conf": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-3.0.3.tgz", + "integrity": "sha512-//0sR/cow/s4ICQaYoAobOl4aU8cjU6x/V24V7XkKotb9+O+3zySIYp146vpaobYHnxa4pZX8NkV54Z5AwbDKA==", + "license": "MIT", + "dependencies": { + "@pnpm/config.env-replace": "^1.1.0", + "@pnpm/network.ca-file": "^1.0.1", + "config-chain": "^1.1.11" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sec-ant/readable-stream": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz", + "integrity": "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==", + "license": "MIT" + }, + "node_modules/@semantic-release/commit-analyzer": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-13.0.1.tgz", + "integrity": "sha512-wdnBPHKkr9HhNhXOhZD5a2LNl91+hs8CC2vsAVYxtZH3y0dV3wKn+uZSN61rdJQZ8EGxzWB3inWocBHV9+u/CQ==", + "license": "MIT", + "dependencies": { + "conventional-changelog-angular": "^8.0.0", + "conventional-changelog-writer": "^8.0.0", + "conventional-commits-filter": "^5.0.0", + "conventional-commits-parser": "^6.0.0", + "debug": "^4.0.0", + "import-from-esm": "^2.0.0", + "lodash-es": "^4.17.21", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=20.8.1" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@semantic-release/error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", + "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@semantic-release/github": { + "version": "11.0.6", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-11.0.6.tgz", + "integrity": "sha512-ctDzdSMrT3H+pwKBPdyCPty6Y47X8dSrjd3aPZ5KKIKKWTwZBE9De8GtsH3TyAlw3Uyo2stegMx6rJMXKpJwJA==", + "license": "MIT", + "dependencies": { + "@octokit/core": "^7.0.0", + "@octokit/plugin-paginate-rest": "^13.0.0", + "@octokit/plugin-retry": "^8.0.0", + "@octokit/plugin-throttling": "^11.0.0", + "@semantic-release/error": "^4.0.0", + "aggregate-error": "^5.0.0", + "debug": "^4.3.4", + "dir-glob": "^3.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "issue-parser": "^7.0.0", + "lodash-es": "^4.17.21", + "mime": "^4.0.0", + "p-filter": "^4.0.0", + "tinyglobby": "^0.2.14", + "url-join": "^5.0.0" + }, + "engines": { + "node": ">=20.8.1" + }, + "peerDependencies": { + "semantic-release": ">=24.1.0" + } + }, + "node_modules/@semantic-release/npm": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-12.0.2.tgz", + "integrity": "sha512-+M9/Lb35IgnlUO6OSJ40Ie+hUsZLuph2fqXC/qrKn0fMvUU/jiCjpoL6zEm69vzcmaZJ8yNKtMBEKHWN49WBbQ==", + "license": "MIT", + "dependencies": { + "@semantic-release/error": "^4.0.0", + "aggregate-error": "^5.0.0", + "execa": "^9.0.0", + "fs-extra": "^11.0.0", + "lodash-es": "^4.17.21", + "nerf-dart": "^1.0.0", + "normalize-url": "^8.0.0", + "npm": "^10.9.3", + "rc": "^1.2.8", + "read-pkg": "^9.0.0", + "registry-auth-token": "^5.0.0", + "semver": "^7.1.2", + "tempy": "^3.0.0" + }, + "engines": { + "node": ">=20.8.1" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@semantic-release/release-notes-generator": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-14.0.3.tgz", + "integrity": "sha512-XxAZRPWGwO5JwJtS83bRdoIhCiYIx8Vhr+u231pQAsdFIAbm19rSVJLdnBN+Avvk7CKvNQE/nJ4y7uqKH6WTiw==", + "license": "MIT", + "dependencies": { + "conventional-changelog-angular": "^8.0.0", + "conventional-changelog-writer": "^8.0.0", + "conventional-commits-filter": "^5.0.0", + "conventional-commits-parser": "^6.0.0", + "debug": "^4.0.0", + "get-stream": "^7.0.0", + "import-from-esm": "^2.0.0", + "into-stream": "^7.0.0", + "lodash-es": "^4.17.21", + "read-package-up": "^11.0.0" + }, + "engines": { + "node": ">=20.8.1" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@simple-libs/stream-utils": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@simple-libs/stream-utils/-/stream-utils-1.2.0.tgz", + "integrity": "sha512-KxXvfapcixpz6rVEB6HPjOUZT22yN6v0vI0urQSk1L8MlEWPDFCZkhw2xmkyoTGYeFw7tWTZd7e3lVzRZRN/EA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://ko-fi.com/dangreen" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@sindresorhus/merge-streams": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz", + "integrity": "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "license": "MIT" + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/aggregate-error": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.1.0.tgz", + "integrity": "sha512-1m4/ydbOGBbHTtBYa4/ISQcqfPdZAxQLzj71wM71T8lP4ktez8lcsVolvscrujQW4CJr/LJSzoZ6mcfnqzYQ3A==", + "license": "MIT", + "dependencies": { + "clean-stack": "^5.2.0", + "indent-string": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.3.0.tgz", + "integrity": "sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg==", + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.4.0.tgz", + "integrity": "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/argv-formatter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/argv-formatter/-/argv-formatter-1.0.0.tgz", + "integrity": "sha512-F2+Hkm9xFaRg+GkaNnbwXNDV5O6pnCFEmqyhvfC/Ic5LbgOWjJh3L+mN/s91rxVL3znE7DYVpW0GJFT+4YBgWw==", + "license": "MIT" + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "license": "MIT" + }, + "node_modules/before-after-hook": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz", + "integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==", + "license": "Apache-2.0" + }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "license": "MIT" + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/clean-stack": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.3.0.tgz", + "integrity": "sha512-9ngPTOhYGQqNVSfeJkYXHmF7AGWp4/nN5D/QqNQs3Dvxd1Kk/WpjHfNujKHYUQ/5CoGyOyFNoWSPk5afzP0QVg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "5.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-highlight": { + "version": "2.1.11", + "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.11.tgz", + "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==", + "license": "ISC", + "dependencies": { + "chalk": "^4.0.0", + "highlight.js": "^10.7.1", + "mz": "^2.4.0", + "parse5": "^5.1.1", + "parse5-htmlparser2-tree-adapter": "^6.0.0", + "yargs": "^16.0.0" + }, + "bin": { + "highlight": "bin/highlight" + }, + "engines": { + "node": ">=8.0.0", + "npm": ">=5.0.0" + } + }, + "node_modules/cli-highlight/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cli-highlight/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cli-highlight/node_modules/yargs": { + "version": "16.2.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.2.tgz", + "integrity": "sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w==", + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cli-highlight/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/cli-table3": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", + "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", + "license": "MIT", + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "license": "MIT", + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "license": "MIT", + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "node_modules/content-type": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-3.1.1.tgz", + "integrity": "sha512-GW4qUsfFo59d0HbUibDlWv5wPz+vAAcaTWbKIuKCf0JkC7wWkSyf8f13IpXn5JkeMlB2P8iTSSIjwXljorg2vA==", + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/conventional-changelog-angular": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-8.3.1.tgz", + "integrity": "sha512-6gfI3otXK5Ph5DfCOI1dblr+kN3FAm5a97hYoQkqNZxOaYa5WKfXH+AnpsmS+iUH2mgVC2Cg2Qw9m5OKcmNrIg==", + "license": "ISC", + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/conventional-changelog-conventionalcommits": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-8.0.0.tgz", + "integrity": "sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA==", + "license": "ISC", + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/conventional-changelog-writer": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-8.4.0.tgz", + "integrity": "sha512-HHBFkk1EECxxmCi4CTu091iuDpQv5/OavuCUAuZmrkWpmYfyD816nom1CvtfXJ/uYfAAjavgHvXHX291tSLK8g==", + "license": "MIT", + "dependencies": { + "@simple-libs/stream-utils": "^1.2.0", + "conventional-commits-filter": "^5.0.0", + "handlebars": "^4.7.7", + "meow": "^13.0.0", + "semver": "^7.5.2" + }, + "bin": { + "conventional-changelog-writer": "dist/cli/index.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/conventional-commits-filter": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-5.0.0.tgz", + "integrity": "sha512-tQMagCOC59EVgNZcC5zl7XqO30Wki9i9J3acbUvkaosCT6JX3EeFwJD7Qqp4MCikRnzS18WXV3BLIQ66ytu6+Q==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/conventional-commits-parser": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.4.0.tgz", + "integrity": "sha512-tvRg7FIBNlyPzjdG8wWRlPHQJJHI7DylhtRGeU9Lq+JuoPh5BKpPRX83ZdLrvXuOSu5Eo/e7SzOQhU4Hd2Miuw==", + "license": "MIT", + "dependencies": { + "@simple-libs/stream-utils": "^1.2.0", + "meow": "^13.0.0" + }, + "bin": { + "conventional-commits-parser": "dist/cli/index.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/convert-hrtime": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/convert-hrtime/-/convert-hrtime-5.0.0.tgz", + "integrity": "sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/cosmiconfig": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.2.tgz", + "integrity": "sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg==", + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cosmiconfig/node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-random-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", + "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", + "license": "MIT", + "dependencies": { + "type-fest": "^1.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/crypto-random-string/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "license": "MIT", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", + "license": "BSD-3-Clause", + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/emojilib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/emojilib/-/emojilib-2.4.0.tgz", + "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==", + "license": "MIT" + }, + "node_modules/env-ci": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-11.2.0.tgz", + "integrity": "sha512-D5kWfzkmaOQDioPmiviWAVtKmpPT4/iJmMVQxWxMPJTFyTkdc5JQUfc5iXEeWxcOdsYTKSAiA/Age4NUOqKsRA==", + "license": "MIT", + "dependencies": { + "execa": "^8.0.0", + "java-properties": "^1.0.2" + }, + "engines": { + "node": "^18.17 || >=20.6.1" + } + }, + "node_modules/env-ci/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/env-ci/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/env-ci/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-9.6.1.tgz", + "integrity": "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA==", + "license": "MIT", + "dependencies": { + "@sindresorhus/merge-streams": "^4.0.0", + "cross-spawn": "^7.0.6", + "figures": "^6.1.0", + "get-stream": "^9.0.0", + "human-signals": "^8.0.1", + "is-plain-obj": "^4.1.0", + "is-stream": "^4.0.1", + "npm-run-path": "^6.0.0", + "pretty-ms": "^9.2.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^4.0.0", + "yoctocolors": "^2.1.1" + }, + "engines": { + "node": "^18.19.0 || >=20.5.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/get-stream": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz", + "integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==", + "license": "MIT", + "dependencies": { + "@sec-ant/readable-stream": "^0.4.1", + "is-stream": "^4.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/figures": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-6.1.0.tgz", + "integrity": "sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==", + "license": "MIT", + "dependencies": { + "is-unicode-supported": "^2.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "license": "MIT", + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/find-up-simple": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.1.tgz", + "integrity": "sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-versions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-6.0.0.tgz", + "integrity": "sha512-2kCCtc+JvcZ86IGAz3Z2Y0A1baIz9fL31pH/0S1IqZr9Iwnjq8izfPtrCyQKO6TLMPELLsQMre7VDqeIKCsHkA==", + "license": "MIT", + "dependencies": { + "semver-regex": "^4.0.5", + "super-regex": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/fs-extra": { + "version": "11.4.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.4.1.tgz", + "integrity": "sha512-KYAb4c9BJQI6QqGKthV68OHe0badztdXJWKo0WtBA9IuCFPTKvE5ZdUBglP833aMjhaSPNO4A5j/EkzZtGlKjA==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/function-timeout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/function-timeout/-/function-timeout-1.0.2.tgz", + "integrity": "sha512-939eZS4gJ3htTHAldmyyuzlrD58P03fHG49v2JfFXbV6OhvZKRC9j2yAtdHw/zrp2zXHuv05zMIy40F0ge7spA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stream": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-7.0.1.tgz", + "integrity": "sha512-3M8C1EOFN6r8AMUhwUAACIoXZJEOufDU5+0gFFN5uNs6XYOralD2Pqkl7m046va6x77FwposWXbAhPPIOus7mQ==", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/git-log-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/git-log-parser/-/git-log-parser-1.2.1.tgz", + "integrity": "sha512-PI+sPDvHXNPl5WNOErAK05s3j0lgwUzMN6o8cyQrDaKfT3qd7TmNJKeXX+SknI5I0QhG5fVPAEwSY4tRGDtYoQ==", + "license": "MIT", + "dependencies": { + "argv-formatter": "~1.0.0", + "spawn-error-forwarder": "~1.0.0", + "split2": "~1.0.0", + "stream-combiner2": "~1.1.1", + "through2": "~2.0.0", + "traverse": "0.6.8" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/handlebars": { + "version": "4.7.10", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.10.tgz", + "integrity": "sha512-P5VJMVM7qgBn6vjXMw8WG9uVI+ncf2pi72j4de4yz5ZULLj2RGqLYaKOYGsgyrViQ0tePOVlN1tDCCXXtFqXKg==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.8", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/highlight.js": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/hook-std": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-4.0.0.tgz", + "integrity": "sha512-IHI4bEVOt3vRUDJ+bFA9VUJlo7SzvFARPNLw75pqSmAOP2HmTWfFJtPvLBrDrlgjEYXY9zs7SFdHPQaJShkSCQ==", + "license": "MIT", + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hosted-git-info": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", + "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", + "license": "ISC", + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/human-signals": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-8.0.1.tgz", + "integrity": "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/import-from-esm": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-from-esm/-/import-from-esm-2.0.0.tgz", + "integrity": "sha512-YVt14UZCgsX1vZQ3gKjkWVdBdHQ6eu3MPU1TBgL1H5orXe2+jWD006WCPPtOuwlQm10NuzOW5WawiF1Q9veW8g==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "import-meta-resolve": "^4.0.0" + }, + "engines": { + "node": ">=18.20" + } + }, + "node_modules/import-meta-resolve": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", + "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/index-to-position": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", + "integrity": "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/into-stream": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-7.0.0.tgz", + "integrity": "sha512-2dYz766i9HprMBasCMvHMuazJ7u4WzhJwo5kb3iPSiW/iRYV6uPari3zHoqZlnuaR7V1bEiNMxikhp37rdBXbw==", + "license": "MIT", + "dependencies": { + "from2": "^2.3.0", + "p-is-promise": "^3.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-stream": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz", + "integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", + "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/issue-parser": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-7.0.2.tgz", + "integrity": "sha512-7atWPjhGEIX3JEtMrOYd8TKzboYlq+5sNbdl9POiLYOI14G5HZiQbZP0Xj5EZdrufQVXfJlpTV0hys0CuxwxZw==", + "license": "MIT", + "dependencies": { + "lodash.capitalize": "^4.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.uniqby": "^4.7.0" + }, + "engines": { + "node": "^18.17 || >=20.6.1" + } + }, + "node_modules/java-properties": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", + "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, + "node_modules/json-with-bigint": { + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/json-with-bigint/-/json-with-bigint-3.5.12.tgz", + "integrity": "sha512-uwbF/wSSuOgC7qqlq27Xp5B6a2MHVug3t0idZdTqu0JnlFvgJuH7ju+KAk/J06C7GfhoYy2gnb9wz2INqcne7w==", + "license": "MIT" + }, + "node_modules/jsonfile": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", + "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT" + }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "license": "MIT", + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "license": "MIT", + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/lodash-es": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz", + "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==", + "license": "MIT" + }, + "node_modules/lodash.capitalize": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", + "integrity": "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==", + "license": "MIT" + }, + "node_modules/lodash.escaperegexp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", + "integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.uniqby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", + "integrity": "sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==", + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/make-asynchronous": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/make-asynchronous/-/make-asynchronous-1.1.0.tgz", + "integrity": "sha512-ayF7iT+44LXdxJLTrTd3TLQpFDDvPCBxXxbv+pMUSuHA5Q8zyAfwkRP6aHHwNVFBUFWtxAHqwNJxF8vMZLAbVg==", + "license": "MIT", + "dependencies": { + "p-event": "^6.0.0", + "type-fest": "^4.6.0", + "web-worker": "^1.5.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/marked": { + "version": "15.0.12", + "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.12.tgz", + "integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/marked-terminal": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-7.3.0.tgz", + "integrity": "sha512-t4rBvPsHc57uE/2nJOLmMbZCQ4tgAccAED3ngXQqW6g+TxA488JzJ+FK3lQkzBQOI1mRV/r/Kq+1ZlJ4D0owQw==", + "license": "MIT", + "dependencies": { + "ansi-escapes": "^7.0.0", + "ansi-regex": "^6.1.0", + "chalk": "^5.4.1", + "cli-highlight": "^2.1.11", + "cli-table3": "^0.6.5", + "node-emoji": "^2.2.0", + "supports-hyperlinks": "^3.1.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "marked": ">=1 <16" + } + }, + "node_modules/meow": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", + "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-4.1.1.tgz", + "integrity": "sha512-YAApRsTpM2+gnUFHhRNGfkX8NK0V5xj1nyQLufGlwEI+eX4xRsTcel2IXDuMEGSGjBvzykNW4VuoEACgwYe7BQ==", + "funding": [ + "https://github.com/sponsors/broofa" + ], + "license": "MIT", + "bin": { + "mime": "bin/cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "license": "MIT" + }, + "node_modules/nerf-dart": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/nerf-dart/-/nerf-dart-1.0.0.tgz", + "integrity": "sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==", + "license": "MIT" + }, + "node_modules/node-emoji": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.2.0.tgz", + "integrity": "sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==", + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^4.6.0", + "char-regex": "^1.0.2", + "emojilib": "^2.4.0", + "skin-tone": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/normalize-package-data": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", + "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^7.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/normalize-url": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.1.1.tgz", + "integrity": "sha512-JYc0DPlpGWB40kH5g07gGTrYuMqV653k3uBKY6uITPWds3M0ov3GaWGp9lbE3Bzngx8+XkfzgvASb9vk9JDFXQ==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm": { + "version": "10.9.9", + "resolved": "https://registry.npmjs.org/npm/-/npm-10.9.9.tgz", + "integrity": "sha512-1g+6jLQvaIuB4zwvHL7yrXuXcWZwDsCtBX8bbWDqbvJSSr9nPiDDWTHNgwXR27iIcTTW7v3A57hDW9RYv2W4Yg==", + "bundleDependencies": [ + "@isaacs/string-locale-compare", + "@npmcli/arborist", + "@npmcli/config", + "@npmcli/fs", + "@npmcli/map-workspaces", + "@npmcli/package-json", + "@npmcli/promise-spawn", + "@npmcli/redact", + "@npmcli/run-script", + "@sigstore/tuf", + "abbrev", + "archy", + "cacache", + "chalk", + "ci-info", + "cli-columns", + "fastest-levenshtein", + "fs-minipass", + "glob", + "graceful-fs", + "hosted-git-info", + "ini", + "init-package-json", + "is-cidr", + "json-parse-even-better-errors", + "libnpmaccess", + "libnpmdiff", + "libnpmexec", + "libnpmfund", + "libnpmhook", + "libnpmorg", + "libnpmpack", + "libnpmpublish", + "libnpmsearch", + "libnpmteam", + "libnpmversion", + "make-fetch-happen", + "minimatch", + "minipass", + "minipass-pipeline", + "ms", + "node-gyp", + "nopt", + "normalize-package-data", + "npm-audit-report", + "npm-install-checks", + "npm-package-arg", + "npm-pick-manifest", + "npm-profile", + "npm-registry-fetch", + "npm-user-validate", + "p-map", + "pacote", + "parse-conflict-json", + "proc-log", + "qrcode-terminal", + "read", + "semver", + "spdx-expression-parse", + "ssri", + "supports-color", + "tar", + "text-table", + "tiny-relative-date", + "treeverse", + "validate-npm-package-name", + "which", + "write-file-atomic" + ], + "license": "Artistic-2.0", + "workspaces": [ + "docs", + "smoke-tests", + "mock-globals", + "mock-registry", + "workspaces/*" + ], + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/arborist": "^8.0.5", + "@npmcli/config": "^9.0.0", + "@npmcli/fs": "^4.0.0", + "@npmcli/map-workspaces": "^4.0.2", + "@npmcli/package-json": "^6.2.0", + "@npmcli/promise-spawn": "^8.0.3", + "@npmcli/redact": "^3.2.2", + "@npmcli/run-script": "^9.1.0", + "@sigstore/tuf": "^3.1.1", + "abbrev": "^3.0.1", + "archy": "~1.0.0", + "cacache": "^19.0.1", + "chalk": "^5.6.2", + "ci-info": "^4.4.0", + "cli-columns": "^4.0.0", + "fastest-levenshtein": "^1.0.16", + "fs-minipass": "^3.0.3", + "glob": "^10.5.0", + "graceful-fs": "^4.2.11", + "hosted-git-info": "^8.1.0", + "ini": "^5.0.0", + "init-package-json": "^7.0.2", + "is-cidr": "^5.1.1", + "json-parse-even-better-errors": "^4.0.0", + "libnpmaccess": "^9.0.0", + "libnpmdiff": "^7.0.5", + "libnpmexec": "^9.0.5", + "libnpmfund": "^6.0.5", + "libnpmhook": "^11.0.0", + "libnpmorg": "^7.0.0", + "libnpmpack": "^8.0.5", + "libnpmpublish": "^10.0.2", + "libnpmsearch": "^8.0.0", + "libnpmteam": "^7.0.0", + "libnpmversion": "^7.0.0", + "make-fetch-happen": "^14.0.3", + "minimatch": "^9.0.9", + "minipass": "^7.1.3", + "minipass-pipeline": "^1.2.4", + "ms": "^2.1.2", + "node-gyp": "^11.5.0", + "nopt": "^8.1.0", + "normalize-package-data": "^7.0.1", + "npm-audit-report": "^6.0.0", + "npm-install-checks": "^7.1.2", + "npm-package-arg": "^12.0.2", + "npm-pick-manifest": "^10.0.0", + "npm-profile": "^11.0.1", + "npm-registry-fetch": "^18.0.2", + "npm-user-validate": "^3.0.0", + "p-map": "^7.0.4", + "pacote": "^19.0.1", + "parse-conflict-json": "^4.0.0", + "proc-log": "^5.0.0", + "qrcode-terminal": "^0.12.0", + "read": "^4.1.0", + "semver": "^7.7.4", + "spdx-expression-parse": "^4.0.0", + "ssri": "^12.0.0", + "supports-color": "^9.4.0", + "tar": "^7.5.22", + "text-table": "~0.2.0", + "tiny-relative-date": "^1.3.0", + "treeverse": "^3.0.0", + "validate-npm-package-name": "^6.0.2", + "which": "^5.0.0", + "write-file-atomic": "^6.0.0" + }, + "bin": { + "npm": "bin/npm-cli.js", + "npx": "bin/npx-cli.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm-run-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-6.0.0.tgz", + "integrity": "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==", + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0", + "unicorn-magic": "^0.3.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/unicorn-magic": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", + "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui": { + "version": "8.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.2.2", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.2.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/npm/node_modules/@isaacs/string-locale-compare": { + "version": "1.1.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/@npmcli/agent": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/arborist": { + "version": "8.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/fs": "^4.0.0", + "@npmcli/installed-package-contents": "^3.0.0", + "@npmcli/map-workspaces": "^4.0.1", + "@npmcli/metavuln-calculator": "^8.0.0", + "@npmcli/name-from-folder": "^3.0.0", + "@npmcli/node-gyp": "^4.0.0", + "@npmcli/package-json": "^6.0.1", + "@npmcli/query": "^4.0.0", + "@npmcli/redact": "^3.0.0", + "@npmcli/run-script": "^9.0.1", + "bin-links": "^5.0.0", + "cacache": "^19.0.1", + "common-ancestor-path": "^1.0.1", + "hosted-git-info": "^8.0.0", + "json-parse-even-better-errors": "^4.0.0", + "json-stringify-nice": "^1.1.4", + "lru-cache": "^10.2.2", + "minimatch": "^9.0.4", + "nopt": "^8.0.0", + "npm-install-checks": "^7.1.0", + "npm-package-arg": "^12.0.0", + "npm-pick-manifest": "^10.0.0", + "npm-registry-fetch": "^18.0.1", + "pacote": "^19.0.0", + "parse-conflict-json": "^4.0.0", + "proc-log": "^5.0.0", + "proggy": "^3.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^3.0.1", + "promise-retry": "^2.0.1", + "read-package-json-fast": "^4.0.0", + "semver": "^7.3.7", + "ssri": "^12.0.0", + "treeverse": "^3.0.0", + "walk-up-path": "^3.0.1" + }, + "bin": { + "arborist": "bin/index.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/config": { + "version": "9.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/map-workspaces": "^4.0.1", + "@npmcli/package-json": "^6.0.1", + "ci-info": "^4.0.0", + "ini": "^5.0.0", + "nopt": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "walk-up-path": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/fs": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/git": { + "version": "6.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/promise-spawn": "^8.0.0", + "ini": "^5.0.0", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^10.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/installed-package-contents": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-bundled": "^4.0.0", + "npm-normalize-package-bin": "^4.0.0" + }, + "bin": { + "installed-package-contents": "bin/index.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/map-workspaces": { + "version": "4.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/name-from-folder": "^3.0.0", + "@npmcli/package-json": "^6.0.0", + "glob": "^10.2.2", + "minimatch": "^9.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { + "version": "8.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "cacache": "^19.0.0", + "json-parse-even-better-errors": "^4.0.0", + "pacote": "^20.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote": { + "version": "20.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^6.0.0", + "@npmcli/installed-package-contents": "^3.0.0", + "@npmcli/package-json": "^6.0.0", + "@npmcli/promise-spawn": "^8.0.0", + "@npmcli/run-script": "^9.0.0", + "cacache": "^19.0.0", + "fs-minipass": "^3.0.0", + "minipass": "^7.0.2", + "npm-package-arg": "^12.0.0", + "npm-packlist": "^9.0.0", + "npm-pick-manifest": "^10.0.0", + "npm-registry-fetch": "^18.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "sigstore": "^3.0.0", + "ssri": "^12.0.0", + "tar": "^7.5.10" + }, + "bin": { + "pacote": "bin/index.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/name-from-folder": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/node-gyp": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/package-json": { + "version": "6.2.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^6.0.0", + "glob": "^10.2.2", + "hosted-git-info": "^8.0.0", + "json-parse-even-better-errors": "^4.0.0", + "proc-log": "^5.0.0", + "semver": "^7.5.3", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/promise-spawn": { + "version": "8.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "which": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/query": { + "version": "4.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "postcss-selector-parser": "^7.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/redact": { + "version": "3.2.2", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@npmcli/run-script": { + "version": "9.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/node-gyp": "^4.0.0", + "@npmcli/package-json": "^6.0.0", + "@npmcli/promise-spawn": "^8.0.0", + "node-gyp": "^11.0.0", + "proc-log": "^5.0.0", + "which": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "inBundle": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/npm/node_modules/@sigstore/bundle": { + "version": "3.1.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.4.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@sigstore/core": { + "version": "2.0.0", + "inBundle": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@sigstore/protobuf-specs": { + "version": "0.4.3", + "inBundle": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@sigstore/sign": { + "version": "3.1.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^3.1.0", + "@sigstore/core": "^2.0.0", + "@sigstore/protobuf-specs": "^0.4.0", + "make-fetch-happen": "^14.0.2", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@sigstore/tuf": { + "version": "3.1.1", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.4.1", + "tuf-js": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@sigstore/verify": { + "version": "2.1.1", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^3.1.0", + "@sigstore/core": "^2.0.0", + "@sigstore/protobuf-specs": "^0.4.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/@tufjs/canonical-json": { + "version": "2.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/abbrev": { + "version": "3.0.1", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/agent-base": { + "version": "7.1.4", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/npm/node_modules/ansi-regex": { + "version": "5.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/ansi-styles": { + "version": "6.2.3", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/npm/node_modules/aproba": { + "version": "2.1.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/archy": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/balanced-match": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/bin-links": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "cmd-shim": "^7.0.0", + "npm-normalize-package-bin": "^4.0.0", + "proc-log": "^5.0.0", + "read-cmd-shim": "^5.0.0", + "write-file-atomic": "^6.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/binary-extensions": { + "version": "2.3.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/brace-expansion": { + "version": "2.0.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/npm/node_modules/cacache": { + "version": "19.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^4.0.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^7.0.2", + "ssri": "^12.0.0", + "tar": "^7.4.3", + "unique-filename": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/chalk": { + "version": "5.6.2", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/npm/node_modules/chownr": { + "version": "3.0.0", + "inBundle": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/npm/node_modules/ci-info": { + "version": "4.4.0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/cidr-regex": { + "version": "4.1.3", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "ip-regex": "^5.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/npm/node_modules/cli-columns": { + "version": "4.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/cmd-shim": { + "version": "7.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/color-convert": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/npm/node_modules/color-name": { + "version": "1.1.4", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/common-ancestor-path": { + "version": "1.0.1", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/cross-spawn": { + "version": "7.0.6", + "inBundle": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/cssesc": { + "version": "3.0.0", + "inBundle": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm/node_modules/debug": { + "version": "4.4.3", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/npm/node_modules/diff": { + "version": "5.2.2", + "inBundle": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/npm/node_modules/eastasianwidth": { + "version": "0.2.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/emoji-regex": { + "version": "8.0.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/encoding": { + "version": "0.1.13", + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/npm/node_modules/env-paths": { + "version": "2.2.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/npm/node_modules/err-code": { + "version": "2.0.3", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/exponential-backoff": { + "version": "3.1.3", + "inBundle": true, + "license": "Apache-2.0" + }, + "node_modules/npm/node_modules/fastest-levenshtein": { + "version": "1.0.16", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/npm/node_modules/fdir": { + "version": "6.5.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/npm/node_modules/foreground-child": { + "version": "3.3.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/fs-minipass": { + "version": "3.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/glob": { + "version": "10.5.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/graceful-fs": { + "version": "4.2.11", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/hosted-git-info": { + "version": "8.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/http-cache-semantics": { + "version": "4.2.0", + "inBundle": true, + "license": "BSD-2-Clause" + }, + "node_modules/npm/node_modules/http-proxy-agent": { + "version": "7.0.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/npm/node_modules/https-proxy-agent": { + "version": "7.0.6", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/npm/node_modules/iconv-lite": { + "version": "0.6.3", + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm/node_modules/ignore-walk": { + "version": "7.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minimatch": "^9.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/imurmurhash": { + "version": "0.1.4", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/npm/node_modules/ini": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/init-package-json": { + "version": "7.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/package-json": "^6.0.0", + "npm-package-arg": "^12.0.0", + "promzard": "^2.0.0", + "read": "^4.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4", + "validate-npm-package-name": "^6.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/ip-address": { + "version": "10.1.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/npm/node_modules/ip-regex": { + "version": "5.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/is-cidr": { + "version": "5.1.1", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "cidr-regex": "^4.1.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/npm/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/isexe": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/jackspeak": { + "version": "3.4.3", + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/npm/node_modules/json-parse-even-better-errors": { + "version": "4.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/json-stringify-nice": { + "version": "1.1.4", + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/jsonparse": { + "version": "1.3.1", + "engines": [ + "node >= 0.2.0" + ], + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/just-diff": { + "version": "6.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/just-diff-apply": { + "version": "5.5.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/libnpmaccess": { + "version": "9.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-package-arg": "^12.0.0", + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmdiff": { + "version": "7.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^8.0.5", + "@npmcli/installed-package-contents": "^3.0.0", + "binary-extensions": "^2.3.0", + "diff": "^5.1.0", + "minimatch": "^9.0.4", + "npm-package-arg": "^12.0.0", + "pacote": "^19.0.0", + "tar": "^7.5.11" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmexec": { + "version": "9.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^8.0.5", + "@npmcli/run-script": "^9.0.1", + "ci-info": "^4.0.0", + "npm-package-arg": "^12.0.0", + "pacote": "^19.0.0", + "proc-log": "^5.0.0", + "read": "^4.0.0", + "read-package-json-fast": "^4.0.0", + "semver": "^7.3.7", + "walk-up-path": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmfund": { + "version": "6.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^8.0.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmhook": { + "version": "11.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmorg": { + "version": "7.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmpack": { + "version": "8.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^8.0.5", + "@npmcli/run-script": "^9.0.1", + "npm-package-arg": "^12.0.0", + "pacote": "^19.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmpublish": { + "version": "10.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "ci-info": "^4.0.0", + "normalize-package-data": "^7.0.0", + "npm-package-arg": "^12.0.0", + "npm-registry-fetch": "^18.0.1", + "proc-log": "^5.0.0", + "semver": "^7.3.7", + "sigstore": "^3.0.0", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmsearch": { + "version": "8.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmteam": { + "version": "7.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/libnpmversion": { + "version": "7.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^6.0.1", + "@npmcli/run-script": "^9.0.1", + "json-parse-even-better-errors": "^4.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/lru-cache": { + "version": "10.4.3", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/make-fetch-happen": { + "version": "14.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/agent": "^3.0.0", + "cacache": "^19.0.1", + "http-cache-semantics": "^4.1.1", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^1.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/minimatch": { + "version": "9.0.9", + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/minipass": { + "version": "7.1.3", + "inBundle": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/npm/node_modules/minipass-collect": { + "version": "2.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/npm/node_modules/minipass-fetch": { + "version": "4.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/npm/node_modules/minipass-flush": { + "version": "1.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-flush/node_modules/yallist": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/minipass-pipeline": { + "version": "1.2.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-pipeline/node_modules/yallist": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/minipass-sized": { + "version": "1.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-sized/node_modules/yallist": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/minizlib": { + "version": "3.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/npm/node_modules/ms": { + "version": "2.1.3", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/mute-stream": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/negotiator": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/npm/node_modules/node-gyp": { + "version": "11.5.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^14.0.3", + "nopt": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "tar": "^7.4.3", + "tinyglobby": "^0.2.12", + "which": "^5.0.0" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/nopt": { + "version": "8.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "abbrev": "^3.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/normalize-package-data": { + "version": "7.0.1", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^8.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-audit-report": { + "version": "6.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-bundled": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-normalize-package-bin": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-install-checks": { + "version": "7.1.2", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-normalize-package-bin": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-package-arg": { + "version": "12.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "hosted-git-info": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^6.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-packlist": { + "version": "9.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "ignore-walk": "^7.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-pick-manifest": { + "version": "10.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-install-checks": "^7.1.0", + "npm-normalize-package-bin": "^4.0.0", + "npm-package-arg": "^12.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-profile": { + "version": "11.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-registry-fetch": "^18.0.0", + "proc-log": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-registry-fetch": { + "version": "18.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/redact": "^3.0.0", + "jsonparse": "^1.3.1", + "make-fetch-happen": "^14.0.0", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minizlib": "^3.0.1", + "npm-package-arg": "^12.0.0", + "proc-log": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/npm-user-validate": { + "version": "3.0.0", + "inBundle": true, + "license": "BSD-2-Clause", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/p-map": { + "version": "7.0.4", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/package-json-from-dist": { + "version": "1.0.1", + "inBundle": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/npm/node_modules/pacote": { + "version": "19.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^6.0.0", + "@npmcli/installed-package-contents": "^3.0.0", + "@npmcli/package-json": "^6.0.0", + "@npmcli/promise-spawn": "^8.0.0", + "@npmcli/run-script": "^9.0.0", + "cacache": "^19.0.0", + "fs-minipass": "^3.0.0", + "minipass": "^7.0.2", + "npm-package-arg": "^12.0.0", + "npm-packlist": "^9.0.0", + "npm-pick-manifest": "^10.0.0", + "npm-registry-fetch": "^18.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "sigstore": "^3.0.0", + "ssri": "^12.0.0", + "tar": "^7.5.10" + }, + "bin": { + "pacote": "bin/index.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/parse-conflict-json": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^4.0.0", + "just-diff": "^6.0.0", + "just-diff-apply": "^5.2.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/path-key": { + "version": "3.1.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/path-scurry": { + "version": "1.11.1", + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/picomatch": { + "version": "4.0.3", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/npm/node_modules/postcss-selector-parser": { + "version": "7.1.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm/node_modules/proc-log": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/proggy": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/promise-all-reject-late": { + "version": "1.0.1", + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/promise-call-limit": { + "version": "3.0.2", + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/promise-retry": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/promzard": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "read": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/qrcode-terminal": { + "version": "0.12.0", + "inBundle": true, + "bin": { + "qrcode-terminal": "bin/qrcode-terminal.js" + } + }, + "node_modules/npm/node_modules/read": { + "version": "4.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "mute-stream": "^2.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/read-cmd-shim": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/read-package-json-fast": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^4.0.0", + "npm-normalize-package-bin": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/retry": { + "version": "0.12.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/npm/node_modules/safer-buffer": { + "version": "2.1.2", + "inBundle": true, + "license": "MIT", + "optional": true + }, + "node_modules/npm/node_modules/semver": { + "version": "7.7.4", + "inBundle": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/shebang-command": { + "version": "2.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/shebang-regex": { + "version": "3.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/signal-exit": { + "version": "4.1.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/sigstore": { + "version": "3.1.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^3.1.0", + "@sigstore/core": "^2.0.0", + "@sigstore/protobuf-specs": "^0.4.0", + "@sigstore/sign": "^3.1.0", + "@sigstore/tuf": "^3.1.0", + "@sigstore/verify": "^2.1.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/smart-buffer": { + "version": "4.2.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/npm/node_modules/socks": { + "version": "2.8.7", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ip-address": "^10.0.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/npm/node_modules/socks-proxy-agent": { + "version": "8.0.5", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/npm/node_modules/spdx-correct": { + "version": "3.2.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse": { + "version": "3.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/spdx-exceptions": { + "version": "2.5.0", + "inBundle": true, + "license": "CC-BY-3.0" + }, + "node_modules/npm/node_modules/spdx-expression-parse": { + "version": "4.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/spdx-license-ids": { + "version": "3.0.23", + "inBundle": true, + "license": "CC0-1.0" + }, + "node_modules/npm/node_modules/ssri": { + "version": "12.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/string-width": { + "version": "4.2.3", + "inBundle": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "inBundle": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/strip-ansi": { + "version": "6.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/supports-color": { + "version": "9.4.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/npm/node_modules/tar": { + "version": "7.5.22", + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/npm/node_modules/text-table": { + "version": "0.2.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/tiny-relative-date": { + "version": "1.3.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/tinyglobby": { + "version": "0.2.15", + "inBundle": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/npm/node_modules/treeverse": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/tuf-js": { + "version": "3.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tufjs/models": "3.0.1", + "debug": "^4.4.1", + "make-fetch-happen": "^14.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/tuf-js/node_modules/@tufjs/models": { + "version": "3.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tufjs/canonical-json": "2.0.0", + "minimatch": "^9.0.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/unique-filename": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/unique-slug": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/util-deprecate": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/validate-npm-package-license": { + "version": "3.0.4", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse": { + "version": "3.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/validate-npm-package-name": { + "version": "6.0.2", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/walk-up-path": { + "version": "3.0.1", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/which": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/which/node_modules/isexe": { + "version": "3.1.5", + "inBundle": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/npm/node_modules/wrap-ansi": { + "version": "8.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.2.2", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.2.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/write-file-atomic": { + "version": "6.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/npm/node_modules/yallist": { + "version": "5.0.0", + "inBundle": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-each-series": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-3.0.0.tgz", + "integrity": "sha512-lastgtAdoH9YaLyDa5i5z64q+kzOcQHsQ5SsZJD3q0VEyI8mq872S3geuNbRUQLVAE9siMfgKrpj7MloKFHruw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-event": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-6.0.1.tgz", + "integrity": "sha512-Q6Bekk5wpzW5qIyUP4gdMEujObYstZl6DMMOSenwBvV0BlE5LkDwkjs5yHbZmdCEq2o4RJx4tE1vwxFVf2FG1w==", + "license": "MIT", + "dependencies": { + "p-timeout": "^6.1.2" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-filter": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-4.1.0.tgz", + "integrity": "sha512-37/tPdZ3oJwHaS3gNJdenCDB3Tz26i9sjhnguBtvN0vYlRIiDNnvTWkuh+0hETV9rLPdJ3rlL3yVOYPIAnM8rw==", + "license": "MIT", + "dependencies": { + "p-map": "^7.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-is-promise": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", + "integrity": "sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "license": "MIT", + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "license": "MIT", + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-map": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.1.1.tgz", + "integrity": "sha512-6Lh3jQPLthYujSrlw6ccWXBGZTkoTCz27Hd92g79LH/kjAbgoEu0t442cCCNbegPSJsA0lwDX8z0bcKtkpA32g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-reduce": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", + "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", + "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", + "integrity": "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "index-to-position": "^1.1.0", + "type-fest": "^4.39.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-ms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-4.0.0.tgz", + "integrity": "sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse5": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", + "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", + "license": "MIT" + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "license": "MIT", + "dependencies": { + "parse5": "^6.0.1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", + "license": "MIT" + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", + "integrity": "sha512-C+VUP+8jis7EsQZIhDYmS5qlNtjv2yP4SNtjXK9AP1ZcTRlnSfuumaTnRfYZnYgUUYVIKqL0fRvmUGDV2fmp6g==", + "license": "MIT", + "dependencies": { + "find-up": "^2.0.0", + "load-json-file": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pretty-ms": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-9.3.1.tgz", + "integrity": "sha512-HzMy3Geq23nVALD/M2LliU+F+M+gVNsvkQWWqeBZ8HDiCgzo6YPJ/Omrmtq24EFrIsk0a3EkQGEd7bDOo+IhGA==", + "license": "MIT", + "dependencies": { + "parse-ms": "^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "license": "ISC" + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/read-package-up": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/read-package-up/-/read-package-up-11.0.0.tgz", + "integrity": "sha512-MbgfoNPANMdb4oRBNg5eqLbB2t2r+o5Ua1pNt8BqGp4I0FJZhuVSOj3PaBPni4azWuSzEdNn2evevzVmEk1ohQ==", + "license": "MIT", + "dependencies": { + "find-up-simple": "^1.0.0", + "read-pkg": "^9.0.0", + "type-fest": "^4.6.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", + "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", + "license": "MIT", + "dependencies": { + "@types/normalize-package-data": "^2.4.3", + "normalize-package-data": "^6.0.0", + "parse-json": "^8.0.0", + "type-fest": "^4.6.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/registry-auth-token": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.1.1.tgz", + "integrity": "sha512-P7B4+jq8DeD2nMsAcdfaqHbssgHtZ7Z5+++a5ask90fvmJ8p5je4mOa+wzu+DB4vQ5tdJV/xywY+UnVFeQLV5Q==", + "license": "MIT", + "dependencies": { + "@pnpm/npm-conf": "^3.0.2" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/semantic-release": { + "version": "24.2.9", + "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-24.2.9.tgz", + "integrity": "sha512-phCkJ6pjDi9ANdhuF5ElS10GGdAKY6R1Pvt9lT3SFhOwM4T7QZE7MLpBDbNruUx/Q3gFD92/UOFringGipRqZA==", + "license": "MIT", + "dependencies": { + "@semantic-release/commit-analyzer": "^13.0.0-beta.1", + "@semantic-release/error": "^4.0.0", + "@semantic-release/github": "^11.0.0", + "@semantic-release/npm": "^12.0.2", + "@semantic-release/release-notes-generator": "^14.0.0-beta.1", + "aggregate-error": "^5.0.0", + "cosmiconfig": "^9.0.0", + "debug": "^4.0.0", + "env-ci": "^11.0.0", + "execa": "^9.0.0", + "figures": "^6.0.0", + "find-versions": "^6.0.0", + "get-stream": "^6.0.0", + "git-log-parser": "^1.2.0", + "hook-std": "^4.0.0", + "hosted-git-info": "^8.0.0", + "import-from-esm": "^2.0.0", + "lodash-es": "^4.17.21", + "marked": "^15.0.0", + "marked-terminal": "^7.3.0", + "micromatch": "^4.0.2", + "p-each-series": "^3.0.0", + "p-reduce": "^3.0.0", + "read-package-up": "^11.0.0", + "resolve-from": "^5.0.0", + "semver": "^7.3.2", + "semver-diff": "^5.0.0", + "signale": "^1.2.1", + "yargs": "^17.5.1" + }, + "bin": { + "semantic-release": "bin/semantic-release.js" + }, + "engines": { + "node": ">=20.8.1" + } + }, + "node_modules/semantic-release/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/hosted-git-info": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.1.0.tgz", + "integrity": "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw==", + "license": "ISC", + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver-diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-5.0.0.tgz", + "integrity": "sha512-0HbGtOm+S7T6NGQ/pxJSJipJvc4DK3FcRVMRkhsIwJDJ4Jcz5DQC1cPPzB5GhzyHjwttW878HaWQq46CkL3cqg==", + "deprecated": "Deprecated as the semver package now supports this built-in.", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semver-regex": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", + "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/signale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", + "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", + "license": "MIT", + "dependencies": { + "chalk": "^2.3.2", + "figures": "^2.0.0", + "pkg-conf": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/signale/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/signale/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/signale/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/signale/node_modules/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/skin-tone": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz", + "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==", + "license": "MIT", + "dependencies": { + "unicode-emoji-modifier-base": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/spawn-error-forwarder": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spawn-error-forwarder/-/spawn-error-forwarder-1.0.0.tgz", + "integrity": "sha512-gRjMgK5uFjbCvdibeGJuy3I5OYz6VLoVdsOJdA6wV0WlfQVLFueoqMxwwYD9RODdgb6oUIvlRlsyFSiQkMKu0g==", + "license": "MIT" + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.24", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.24.tgz", + "integrity": "sha512-cLS9TtWkIQFyLkJ3/5aFQAOHOSKTlOs/7WDut/XPSdjom1fJhUdkepeJAKXa9Y05+FabHd0sti+Et559vDtkpQ==", + "license": "CC0-1.0" + }, + "node_modules/split2": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-1.0.0.tgz", + "integrity": "sha512-NKywug4u4pX/AZBB1FCPzZ6/7O+Xhz1qMVbzTvvKvikjO99oPN87SkK08mEY9P63/5lWjK+wgOOgApnTg5r6qg==", + "license": "ISC", + "dependencies": { + "through2": "~2.0.0" + } + }, + "node_modules/stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==", + "license": "MIT", + "dependencies": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-final-newline": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz", + "integrity": "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/super-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/super-regex/-/super-regex-1.1.0.tgz", + "integrity": "sha512-WHkws2ZflZe41zj6AolvvmaTrWds/VuyeYr9iPVv/oQeaIoVxMKaushfFWpOGDT+GuBrM/sVqF8KUCYQlSSTdQ==", + "license": "MIT", + "dependencies": { + "function-timeout": "^1.0.1", + "make-asynchronous": "^1.0.1", + "time-span": "^5.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz", + "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=14.18" + }, + "funding": { + "url": "https://github.com/chalk/supports-hyperlinks?sponsor=1" + } + }, + "node_modules/temp-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", + "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", + "license": "MIT", + "engines": { + "node": ">=14.16" + } + }, + "node_modules/tempy": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.2.0.tgz", + "integrity": "sha512-d79HhZya5Djd7am0q+W4RTsSU+D/aJzM+4Y4AGJGuGlgM2L6sx5ZvOYTmZjqPhrDrV6xJTtRSm1JCLj6V6LHLQ==", + "license": "MIT", + "dependencies": { + "is-stream": "^3.0.0", + "temp-dir": "^3.0.0", + "type-fest": "^2.12.2", + "unique-string": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/time-span": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/time-span/-/time-span-5.1.0.tgz", + "integrity": "sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==", + "license": "MIT", + "dependencies": { + "convert-hrtime": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/traverse": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.8.tgz", + "integrity": "sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/unicode-emoji-modifier-base": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz", + "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/unique-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", + "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", + "license": "MIT", + "dependencies": { + "crypto-random-string": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/universal-user-agent": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz", + "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==", + "license": "ISC" + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/url-join": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-5.1.1.tgz", + "integrity": "sha512-5+M4YX5pEFeXSdMyt3J5iXr949UC+j6yHRkZUEv6ljTusAfdCdS4pSTudnYGzYEbKkdK5xIE0E3i5xzIzoiFrQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/web-worker": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.5.0.tgz", + "integrity": "sha512-RiMReJrTAiA+mBjGONMnjVDP2u3p9R1vkcGz6gDIrOMT3oGuYwX2WRMYI9ipkphSuE5XKEhydbhNEJh4NY9mlw==", + "license": "Apache-2.0" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "license": "MIT" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yoctocolors": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.2.0.tgz", + "integrity": "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/build/release/package.json b/build/release/package.json new file mode 100644 index 0000000..af715d4 --- /dev/null +++ b/build/release/package.json @@ -0,0 +1,18 @@ +{ + "name": "executer-release", + "private": true, + "description": "Computes the next ExecuteR release version and its notes from the conventional commits since the last release tag (semantic-release, dry run only).", + "type": "module", + "engines": { + "node": ">=20.8.1" + }, + "scripts": { + "next": "node next-release.mjs" + }, + "dependencies": { + "@semantic-release/commit-analyzer": "13.0.1", + "@semantic-release/release-notes-generator": "14.0.3", + "conventional-changelog-conventionalcommits": "8.0.0", + "semantic-release": "24.2.9" + } +} diff --git a/build/release/release-config.mjs b/build/release/release-config.mjs new file mode 100644 index 0000000..8878ce1 --- /dev/null +++ b/build/release/release-config.mjs @@ -0,0 +1,25 @@ +// How the next ExecuteR release is numbered (README, Versioning). semantic-release reads the conventional commits since the newest +// release tag v.. and bumps once for all of them: fix/perf the patch, feat the minor, a "BREAKING CHANGE:" footer +// (or "!" after the type) the major. It only computes (dry run); scripts/Publish-Release.ps1 creates the tag and the Gitea release. + +// The releases before semantic versions were numbered by date (v2026.10.10.0140). Those tags are not semantic versions, so +// semantic-release passes over them; a version whose major is this or more is one of them and is refused, never read as 2026.0.0. +export const calendarEraMajor = 2000; + +export const releaseConfig = { + branches: ['main'], + tagFormat: 'v${version}', + plugins: [ + ['@semantic-release/commit-analyzer', { preset: 'conventionalcommits' }], + ['@semantic-release/release-notes-generator', { preset: 'conventionalcommits' }], + ], +}; + +/** Release notes as Gitea shows them: without the trailers (Co-Authored-By, Signed-off-by) a breaking-change note drags along. */ +export function cleanNotes(notes) { + return (notes ?? '') + .replace(/[ \t]*\[skip ci\]/gi, '') + .replace(/^[ \t]*(Co-Authored-By|Signed-off-by):.*$/gim, '') + .replace(/\n{3,}/g, '\n\n') + .trim(); +} diff --git a/scripts/Get-NextRelease.ps1 b/scripts/Get-NextRelease.ps1 new file mode 100644 index 0000000..07298e9 --- /dev/null +++ b/scripts/Get-NextRelease.ps1 @@ -0,0 +1,93 @@ +<# +.SYNOPSIS +The version a release run publishes: semantic-release's next version from the +conventional commits since the last release tag (a dry run, build/release), +or nothing when no release is due. + +.DESCRIPTION +fix/perf since the last release bump the patch, feat the minor, a +"BREAKING CHANGE:" footer (or "type!:") the major; only docs, tests, chores, +refactors... release nothing, and this returns nothing. A commit that is +already a release (a re-run after a failed upload) returns that release's +version again, with no notes: the release exists. + +Refuses when no release tag v.. is reachable (the seed tag +must be present: a full clone with tags), when the branch is not main, and for +calendar-era versions (major 2000 or more). + +Installs build/release's pinned packages with npm ci when they are missing. + +.PARAMETER NotesPath +Where the release notes (Markdown) are written; removed when there are none. + +.OUTPUTS +Nothing, or an object with Version (1.1.0), Tag (v1.1.0), LastVersion, Type +(major, minor, patch, or rerun) and Notes (the notes file, or $null). + +.EXAMPLE +$next = ./scripts/Get-NextRelease.ps1 -NotesPath artifacts/release-notes.md +if ($next) { ./scripts/Package-Agent.ps1 -Version $next.Version } +#> +[CmdletBinding()] +param( + [string]$NotesPath, + [string]$Root = (Split-Path -Parent $PSScriptRoot) +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 3.0 + +$tool = Join-Path (Split-Path -Parent $PSScriptRoot) 'build/release' +if (-not (Test-Path -LiteralPath (Join-Path $tool 'node_modules/semantic-release'))) { + # From inside the folder: npm ci needs the lockfile beside it. + Push-Location -LiteralPath $tool + try { + & npm ci --no-audit --no-fund | Out-Host + if ($LASTEXITCODE -ne 0) { throw "npm ci in build/release failed ($LASTEXITCODE)." } + } + finally { + Pop-Location + } +} + +$out = Join-Path ([System.IO.Path]::GetTempPath()) "executer-next-release-$([guid]::NewGuid().ToString('N')).json" +try { + # semantic-release's report goes to stderr (the console); the result is the file. + & node (Join-Path $tool 'next-release.mjs') $out $Root | Out-Host + $exit = $LASTEXITCODE + $next = if (Test-Path -LiteralPath $out) { Get-Content -Raw -LiteralPath $out | ConvertFrom-Json } else { $null } + if ($exit -ne 0 -or -not $next -or $next.PSObject.Properties['error']) { + $reason = if ($next -and $next.PSObject.Properties['error']) { $next.error } else { "exit code $exit; see above" } + throw "Computing the next release failed: $reason" + } +} +finally { + Remove-Item -LiteralPath $out -ErrorAction SilentlyContinue +} + +if ($NotesPath) { Remove-Item -LiteralPath $NotesPath -ErrorAction SilentlyContinue } + +if ($next.version) { + $notes = $null + if ($NotesPath) { + New-Item -ItemType Directory -Force -Path (Split-Path -Parent ([System.IO.Path]::GetFullPath($NotesPath))) | Out-Null + [System.IO.File]::WriteAllText($NotesPath, "$($next.notes)`n", [System.Text.UTF8Encoding]::new($false)) + $notes = $NotesPath + } + $result = [pscustomobject]@{ Version = $next.version; Tag = $next.gitTag; LastVersion = $next.lastVersion; Type = $next.type; Notes = $notes } +} +else { + $own = @(& git -C $Root tag --points-at HEAD | Where-Object { $_ -match '^v\d{1,3}\.\d+\.\d+$' }) + if ($own.Count -eq 0) { + Write-Host "Nothing to release: no fix, feat or breaking change since $($next.lastVersion)." + return + } + $version = $own[0].Substring(1) + $result = [pscustomobject]@{ Version = $version; Tag = $own[0]; LastVersion = $version; Type = 'rerun'; Notes = $null } +} + +# The same limits every build version meets (major/minor up to 255, the rest up to 65535, no calendar era). +$null = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $result.Version + +Write-Host "Release $($result.Version) ($($result.Type), after $($result.LastVersion))" +$result diff --git a/scripts/Get-UnifiedVersion.ps1 b/scripts/Get-UnifiedVersion.ps1 index 9565777..039af20 100644 --- a/scripts/Get-UnifiedVersion.ps1 +++ b/scripts/Get-UnifiedVersion.ps1 @@ -1,11 +1,8 @@ <# .SYNOPSIS -Computes the unified build version (yyyy.MM.dd.HHmm, UTC). -Honors an explicit -Version argument or the UNIFIED_VERSION environment variable -first. Otherwise it derives the version from the HEAD commit's committer time, so -every job and workflow building the same commit lands on the same version — no -drift between the binaries and the container images. Falls back to the current -time only when git is unavailable. +Kept for callers of the old name: the build version from scripts/Get-Version.ps1 +(X.Y.Z for a release, X.Y.Z.N for a build N commits after it). Honors -Version +and UNIFIED_VERSION the same way. #> [CmdletBinding()] param( @@ -13,20 +10,4 @@ param( ) $ErrorActionPreference = 'Stop' - -if (-not $Version) { $Version = $env:UNIFIED_VERSION } -if (-not $Version) { - $epoch = "$(git show -s --format=%ct HEAD 2>$null)".Trim() - if ($epoch -match '^\d+$') { - $Version = [DateTimeOffset]::FromUnixTimeSeconds([long]$epoch).UtcDateTime.ToString('yyyy.MM.dd.HHmm') - } - else { - $Version = [DateTime]::UtcNow.ToString('yyyy.MM.dd.HHmm') - } -} - -if ($Version -notmatch '^\d{4}\.\d{2}\.\d{2}\.\d{4}$') { - throw "Unified version '$Version' does not match yyyy.MM.dd.HHmm." -} - -$Version +& (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version -Format Version diff --git a/scripts/Get-Version.ps1 b/scripts/Get-Version.ps1 new file mode 100644 index 0000000..bb04b9b --- /dev/null +++ b/scripts/Get-Version.ps1 @@ -0,0 +1,125 @@ +<# +.SYNOPSIS +Computes the build version: a release's X.Y.Z, or X.Y.Z.N for a build N commits +after the last release (README, Versioning). + +.DESCRIPTION +Order of precedence: + 1. -Version (explicit), then the UNIFIED_VERSION environment variable: a + release run hands in the version semantic-release computed + (scripts/Get-NextRelease.ps1); CI hands one value to every step. + 2. git: the newest release tag vX.Y.Z reachable from HEAD and the commits + since it (git describe). 1.4.0.7 is seven commits after 1.4.0; a build of + the tagged commit itself is 1.4.0. + 3. No release tag reachable: 0.0.0.. No git: 0.0.0.0. + +Release tags have a 1-3 digit major, so the calendar-era tags +(v2026.10.10.0140) never match. Every version is 3 or 4 numeric fields (no +-prerelease labels) so assembly, file and MSI versions accept it, and is +refused when it does not fit an MSI ProductVersion (major and minor up to 255, +the rest up to 65535) or has a calendar-era major (2000 or more). + +.PARAMETER Format +Version (default): 1.4.0 or 1.4.0.7. +FileVersion: always four fields (1.4.0.0), for assembly/file/MSI versions. +Informational: 1.4.0.7+. +Short: the short commit hash (empty without git). +MSBuild: -p:UnifiedVersion=... and -p:GitCommitShort=... lines. +Env: UNIFIED_VERSION=... and GIT_COMMIT_SHORT=... lines (for $GITHUB_ENV). +Object: all of the above. + +.PARAMETER Describe +What `git describe --tags --long` would print (v1.4.0-7-g1a2b3c4), in place of +git; an empty string means no release tag (0.0.0.<-Commits>). For tests. + +.EXAMPLE +./scripts/Get-Version.ps1 # 0.0.0.253, 1.4.0, 1.4.0.7 +./scripts/Get-Version.ps1 -Format FileVersion # 1.4.0.0 +./scripts/Get-Version.ps1 -Version 1.5.0 # validated and echoed +#> +[CmdletBinding()] +param( + [string]$Version, + [ValidateSet('Version', 'FileVersion', 'Informational', 'Short', 'MSBuild', 'Env', 'Object')] + [string]$Format = 'Version', + [string]$Root = (Split-Path -Parent $PSScriptRoot), + [string]$Describe, + [int]$Commits = 0 +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 3.0 + +# Majors from here up are the calendar era (yyyy.MM.dd.HHmm), never a semantic version. +$calendarEraMajor = 2000 + +function Assert-Fields([long[]]$Fields, [string]$Text) { + if ($Fields[0] -ge $calendarEraMajor) { + throw "Version '$Text' is a calendar-era version (major $($Fields[0])), not a semantic one." + } + if ($Fields[0] -gt 255 -or $Fields[1] -gt 255 -or @($Fields | Select-Object -Skip 2 | Where-Object { $_ -gt 65535 }).Count -gt 0) { + throw "Version '$Text' does not fit an MSI ProductVersion (major and minor up to 255, the rest up to 65535)." + } +} + +$git = [bool](Get-Command git -ErrorAction SilentlyContinue) +$short = '' +if ($git) { + $short = "$(& git -C $Root rev-parse --short HEAD 2>$null)".Trim() + if ($LASTEXITCODE -ne 0) { $short = '' } +} + +if (-not $Version) { $Version = $env:UNIFIED_VERSION } + +if ($Version) { + if ($Version -notmatch '^(\d{1,9})\.(\d{1,9})\.(\d{1,9})(?:\.(\d{1,9}))?$') { + throw "Version '$Version' is not major.minor.patch or major.minor.patch.build (numbers only, no -label)." + } + $base = [long[]]@($Matches[1], $Matches[2], $Matches[3]) + $since = if ($Matches[4]) { [long]$Matches[4] } else { 0 } + if ($env:GIT_COMMIT_SHORT) { $short = $env:GIT_COMMIT_SHORT } +} +else { + if (-not $PSBoundParameters.ContainsKey('Describe')) { + $Describe = '' + if ($git -and $short) { + # One to three digits of major: v2026.10.10.0140 (calendar era) never matches. + $Describe = "$(& git -C $Root describe --tags --long --match 'v[0-9].[0-9]*.[0-9]*' --match 'v[0-9][0-9].[0-9]*.[0-9]*' --match 'v[0-9][0-9][0-9].[0-9]*.[0-9]*' 2>$null)".Trim() + if ($LASTEXITCODE -ne 0) { $Describe = '' } + $Commits = [int]"$(& git -C $Root rev-list --count HEAD 2>$null)".Trim() + } + } + + if ($Describe -match '^v(\d{1,3})\.(\d{1,9})\.(\d{1,9})-(\d+)-g[0-9a-f]+$') { + $base = [long[]]@($Matches[1], $Matches[2], $Matches[3]) + $since = [long]$Matches[4] + } + elseif ($Describe) { + throw "git describe returned '$Describe', which is not v..--g." + } + else { + $base = [long[]]@(0, 0, 0) + $since = [long]$Commits + } +} + +$semantic = $base -join '.' +$text = if ($since -gt 0) { "$semantic.$since" } else { $semantic } +Assert-Fields ($base + $since) $(if ($Version) { $Version } else { $text }) + +$result = [pscustomobject]@{ + Version = $text + FileVersion = "$semantic.$since" + Short = $short + Informational = if ($short) { "$text+$short" } else { $text } +} + +switch ($Format) { + 'Version' { $result.Version } + 'FileVersion' { $result.FileVersion } + 'Informational' { $result.Informational } + 'Short' { $result.Short } + 'MSBuild' { "-p:UnifiedVersion=$($result.Version)"; if ($result.Short) { "-p:GitCommitShort=$($result.Short)" } } + 'Env' { "UNIFIED_VERSION=$($result.Version)"; "GIT_COMMIT_SHORT=$($result.Short)" } + default { $result } +} -- 2.52.0 From 31869b17bacd5ddf6822239cfb523c239cf6102e9e2c6dcc434f2df5ce7ff433 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:18:31 -0400 Subject: [PATCH 14/26] build(version): packaging and release scripts use semantic versions Build, Test and the packaging scripts take the version from Get-Version.ps1 and the short commit from the same place. Both MSIs get the four-field version as ProductVersion (X.Y.Z.0 for a release, X.Y.Z.N between releases) instead of the calendar transform. Checksums and release assets take only their own version's files (1.4.0 no longer matches 1.4.0.7's). Publish-Release.ps1 creates the tag vX.Y.Z on the released commit and the release "ExecuteR X.Y.Z" with semantic-release's notes (-NotesFile, -Prerelease), reuses both on a re-run of the same commit, refuses a version already tagged on another commit and skips assets uploaded whole. deploy.sh builds from source with the git version (0.0.0.0 without git) and runs the images it built by that tag. Test.ps1 runs the watchdog tests too. Co-Authored-By: Claude Opus 5.5 --- scripts/Build.ps1 | 10 ++-- scripts/Package-Agent.ps1 | 28 +++++----- scripts/Package-Server.ps1 | 22 ++++---- scripts/Publish-Release.ps1 | 108 +++++++++++++++++++++++++++--------- scripts/Test.ps1 | 3 +- scripts/deploy.sh | 23 +++++++- 6 files changed, 136 insertions(+), 58 deletions(-) diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 index 5f31e61..202df36 100644 --- a/scripts/Build.ps1 +++ b/scripts/Build.ps1 @@ -1,6 +1,7 @@ <# .SYNOPSIS -Builds the full solution (and optionally the WebUI) with one unified version. +Builds the full solution (and optionally the WebUI) with one version +(scripts/Get-Version.ps1: X.Y.Z for a release, X.Y.Z.N between releases). .EXAMPLE ./scripts/Build.ps1 @@ -16,11 +17,12 @@ param( $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot -$Version = & (Join-Path $PSScriptRoot 'Get-UnifiedVersion.ps1') -Version $Version +$Version = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version +$short = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version -Format Short -Write-Host "Unified version: $Version" +Write-Host "Version: $Version" -dotnet build (Join-Path $repoRoot 'ExecuteR.slnx') -c $Configuration --nologo "-p:UnifiedVersion=$Version" +dotnet build (Join-Path $repoRoot 'ExecuteR.slnx') -c $Configuration --nologo "-p:UnifiedVersion=$Version" "-p:GitCommitShort=$short" if ($LASTEXITCODE -ne 0) { throw "dotnet build failed ($LASTEXITCODE)." } if ($IncludeWebUI) { diff --git a/scripts/Package-Agent.ps1 b/scripts/Package-Agent.ps1 index f69341e..0ba1324 100644 --- a/scripts/Package-Agent.ps1 +++ b/scripts/Package-Agent.ps1 @@ -10,7 +10,7 @@ systemd/launchd, no remote shell). .EXAMPLE ./scripts/Package-Agent.ps1 -./scripts/Package-Agent.ps1 -Version 2026.08.06.2151 -SkipMsi +./scripts/Package-Agent.ps1 -Version 1.4.0 -SkipMsi ./scripts/Package-Agent.ps1 -Runtimes win-x64,linux-x64,linux-arm64,osx-x64,osx-arm64 #> [CmdletBinding()] @@ -23,7 +23,10 @@ param( $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot -$Version = & (Join-Path $PSScriptRoot 'Get-UnifiedVersion.ps1') -Version $Version +$Version = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version +# The MSI ProductVersion takes four fields: a release X.Y.Z is X.Y.Z.0. +$fileVersion = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version -Format FileVersion +$short = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version -Format Short $artifacts = Join-Path $repoRoot 'artifacts' Write-Host "Packaging Agent $Version for: $($Runtimes -join ', ')" @@ -50,7 +53,7 @@ foreach ($rid in $Runtimes) { -p:EnableCompressionInSingleFile=true ` -p:DebugType=None ` "-p:UnifiedVersion=$Version" ` - "-p:GitCommitShort=$(git -C $repoRoot rev-parse --short HEAD 2>$null)" ` + "-p:GitCommitShort=$short" ` -o $ridPublishDir if ($LASTEXITCODE -ne 0) { throw "Agent publish for $rid failed ($LASTEXITCODE)." } @@ -72,7 +75,7 @@ foreach ($rid in $Runtimes) { -r $rid ` -p:DebugType=None ` "-p:UnifiedVersion=$Version" ` - "-p:GitCommitShort=$(git -C $repoRoot rev-parse --short HEAD 2>$null)" ` + "-p:GitCommitShort=$short" ` -o $watchdogPublishDir if ($LASTEXITCODE -ne 0) { throw "Watchdog publish for $rid failed ($LASTEXITCODE)." } if ($rid -like 'win-*') { @@ -95,17 +98,14 @@ $publishDir = Join-Path $artifacts "agent/$Version/win-x64" $wixProject = Join-Path $repoRoot 'src/Installer/Agent.Installer.wixproj' if (-not $SkipMsi -and (Test-Path $wixProject) -and (Test-Path $publishDir)) { - # Deterministic MSI ProductVersion transform (see BuildVersion.ToMsiProductVersion): - # yyyy.MM.dd.HHmm -> (yyyy-2000).(MM).((dd-1)*1440 + HH*60 + mm) - $parts = $Version.Split('.') - $hhmm = [int]$parts[3] - $msiVersion = '{0}.{1}.{2}' -f ([int]$parts[0] - 2000), [int]$parts[1], - ((([int]$parts[2] - 1) * 1440) + ([math]::Floor($hhmm / 100) * 60) + ($hhmm % 100)) - Write-Host "MSI ProductVersion: $msiVersion" + # ProductVersion is the four-field version (1.4.0.0, 1.4.0.7). Windows + # Installer compares only three fields, so the MSI removes every installed + # version and its FindNewerRelease custom action refuses a newer one. + Write-Host "MSI ProductVersion: $fileVersion" dotnet build $wixProject -c Release --nologo ` "-p:UnifiedVersion=$Version" ` - "-p:MsiProductVersion=$msiVersion" ` + "-p:MsiProductVersion=$fileVersion" ` "-p:AgentPublishDir=$publishDir" if ($LASTEXITCODE -ne 0) { throw "MSI build failed ($LASTEXITCODE)." } @@ -120,7 +120,9 @@ if (-not $SkipMsi -and (Test-Path $wixProject) -and (Test-Path $publishDir)) { # Checksums for release attachment. $checksums = Join-Path $artifacts "ExecuteR-Agent-$Version-checksums.txt" -Get-ChildItem $artifacts -File | Where-Object { $_.Name -like "ExecuteR-Agent-$Version*" -and $_.Extension -ne '.txt' } | ForEach-Object { +# This version's files only: 1.4.0's pattern must not take 1.4.0.7's. +$ownFile = '^ExecuteR-Agent-' + [regex]::Escape($Version) + '(-.+\.zip|\.msi)$' +Get-ChildItem $artifacts -File | Where-Object { $_.Name -match $ownFile } | ForEach-Object { "{0} {1}" -f (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant(), $_.Name } | Set-Content $checksums -Encoding utf8NoBOM Write-Host "Created $checksums" diff --git a/scripts/Package-Server.ps1 b/scripts/Package-Server.ps1 index 96dd3f5..0323e10 100644 --- a/scripts/Package-Server.ps1 +++ b/scripts/Package-Server.ps1 @@ -23,7 +23,10 @@ param( $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot -$Version = & (Join-Path $PSScriptRoot 'Get-UnifiedVersion.ps1') -Version $Version +$Version = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version +# The MSI ProductVersion takes four fields: a release X.Y.Z is X.Y.Z.0. +$fileVersion = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version -Format FileVersion +$short = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version -Format Short $artifacts = Join-Path $repoRoot 'artifacts' $natsVersion = '2.14.4' @@ -60,7 +63,7 @@ foreach ($rid in $Runtimes) { -p:PublishSingleFile=true ` -p:DebugType=None ` -p:UnifiedVersion=$Version ` - "-p:GitCommitShort=$(git -C $repoRoot rev-parse --short HEAD 2>$null)" ` + "-p:GitCommitShort=$short" ` -o $publishDir if ($LASTEXITCODE -ne 0) { throw "dotnet publish for $rid failed ($LASTEXITCODE)." } @@ -185,17 +188,12 @@ TRUSTED_HOSTS, TRUST_PROXY=0 to disable. $serverWix = Join-Path $repoRoot 'src/Installer.Server/Server.Installer.wixproj' $winPublish = Join-Path $artifacts "server/$Version/win-x64" if (-not $SkipMsi -and (Test-Path $serverWix) -and (Test-Path $winPublish)) { - # Deterministic MSI ProductVersion transform (same as the agent): - # yyyy.MM.dd.HHmm -> (yyyy-2000).(MM).((dd-1)*1440 + HH*60 + mm) - $parts = $Version.Split('.') - $hhmm = [int]$parts[3] - $msiVersion = '{0}.{1}.{2}' -f ([int]$parts[0] - 2000), [int]$parts[1], - ((([int]$parts[2] - 1) * 1440) + ([math]::Floor($hhmm / 100) * 60) + ($hhmm % 100)) - Write-Host "Server MSI ProductVersion: $msiVersion" + # ProductVersion is the four-field version, as for the agent MSI. + Write-Host "Server MSI ProductVersion: $fileVersion" dotnet build $serverWix -c Release --nologo ` "-p:UnifiedVersion=$Version" ` - "-p:MsiProductVersion=$msiVersion" ` + "-p:MsiProductVersion=$fileVersion" ` "-p:ServerPublishDir=$winPublish" if ($LASTEXITCODE -ne 0) { throw "Server MSI build failed ($LASTEXITCODE)." } @@ -210,7 +208,9 @@ if (-not $SkipMsi -and (Test-Path $serverWix) -and (Test-Path $winPublish)) { # Checksums for release attachment. $checksums = Join-Path $artifacts "ExecuteR-Server-$Version-checksums.txt" -Get-ChildItem $artifacts -File | Where-Object { $_.Name -like "ExecuteR-Server-$Version*" -and $_.Extension -ne '.txt' } | ForEach-Object { +# This version's files only: 1.4.0's pattern must not take 1.4.0.7's. +$ownFile = '^ExecuteR-Server-' + [regex]::Escape($Version) + '(-.+\.zip|\.msi)$' +Get-ChildItem $artifacts -File | Where-Object { $_.Name -match $ownFile } | ForEach-Object { "{0} {1}" -f (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant(), $_.Name } | Set-Content $checksums -Encoding utf8NoBOM Write-Host "Created $checksums" diff --git a/scripts/Publish-Release.ps1 b/scripts/Publish-Release.ps1 index 978920e..58495a4 100644 --- a/scripts/Publish-Release.ps1 +++ b/scripts/Publish-Release.ps1 @@ -1,22 +1,44 @@ <# .SYNOPSIS -Creates (or reuses) a Gitea release for the unified version and uploads the -agent artifacts from ./artifacts. No-ops with a clear message when GITEA_TOKEN -or GITEA_URL are absent (local runs). Never prints the token. +Publishes a release on Gitea: the tag vX.Y.Z on the commit, the release +"ExecuteR X.Y.Z" with the notes semantic-release wrote, and every agent and +server artifact of that version from ./artifacts attached. + +.DESCRIPTION +The version is a release version X.Y.Z (scripts/Get-NextRelease.ps1). Safe to +run again: an existing tag or release of the same commit is reused and files +already uploaded whole are skipped. A tag or release of that version on another +commit is refused: a version names one commit. + +No-ops with a clear message when GITEA_URL/TOKEN/OWNER/REPOSITORY are not all +set (local runs). Never prints the token. .NOTES -Uses the Gitea REST API: - POST /api/v1/repos/{owner}/{repo}/releases - POST /api/v1/repos/{owner}/{repo}/releases/{id}/assets +Gitea REST API: + GET/POST /api/v1/repos/{owner}/{repo}/tags + GET /api/v1/repos/{owner}/{repo}/releases/tags/{tag} + POST /api/v1/repos/{owner}/{repo}/releases + POST /api/v1/repos/{owner}/{repo}/releases/{id}/assets + +.EXAMPLE +./scripts/Publish-Release.ps1 -Version 1.1.0 -NotesFile artifacts/release-notes.md -Commit $env:GITHUB_SHA #> [CmdletBinding()] param( - [string]$Version + [Parameter(Mandatory)] + [ValidatePattern('^\d{1,3}\.\d+\.\d+$')] + [string]$Version, + # The release notes (Markdown) from semantic-release; none on a re-run. + [string]$NotesFile, + [string]$Commit = "$(git rev-parse HEAD 2>$null)".Trim(), + # Marks the Gitea release as a pre-release. + [switch]$Prerelease ) $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot -$Version = & (Join-Path $PSScriptRoot 'Get-UnifiedVersion.ps1') -Version $Version +# The same limits as every build version. +$null = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version $giteaUrl = $env:GITEA_URL $token = $env:GITEA_TOKEN @@ -27,41 +49,73 @@ if (-not $giteaUrl -or -not $token -or -not $owner -or -not $repo) { Write-Host 'GITEA_URL/TOKEN/OWNER/REPOSITORY not all set; skipping release publish.' return } +if (-not $Commit) { throw 'No commit to tag (-Commit, or run inside the repository).' } $headers = @{ Authorization = "token $token" } $apiBase = "$($giteaUrl.TrimEnd('/'))/api/v1/repos/$owner/$repo" $tag = "v$Version" -Write-Host "Creating release $tag on $owner/$repo" -$body = @{ - tag_name = $tag - target_commitish = 'main' - name = "ExecuteR $Version" - body = "Automated release for unified version $Version." - draft = $false - prerelease = $false -} | ConvertTo-Json +function Get-OrNull([string]$Uri) { + try { Invoke-RestMethod -Method Get -Uri $Uri -Headers $headers } + catch { + if ($_.Exception.Response -and [int]$_.Exception.Response.StatusCode -eq 404) { return $null } + throw + } +} -try { +# ── The tag on the commit ──────────────────────────────────────────────────── +$existingTag = Get-OrNull "$apiBase/tags/$tag" +if ($existingTag) { + if ($existingTag.commit.sha -ne $Commit) { + throw "Tag $tag already exists on commit $($existingTag.commit.sha), not $Commit; a version names one commit." + } + Write-Host "Tag $tag already on $Commit" +} +else { + Write-Host "Creating tag $tag on $Commit" + $tagBody = @{ tag_name = $tag; target = $Commit; message = "ExecuteR $Version" } | ConvertTo-Json + Invoke-RestMethod -Method Post -Uri "$apiBase/tags" -Headers $headers -ContentType 'application/json' -Body $tagBody | Out-Null +} + +# ── The release ────────────────────────────────────────────────────────────── +$release = Get-OrNull "$apiBase/releases/tags/$tag" +if (-not $release) { + $notes = if ($NotesFile -and (Test-Path -LiteralPath $NotesFile)) { (Get-Content -Raw -LiteralPath $NotesFile).Trim() } else { '' } + $short = $Commit.Substring(0, [Math]::Min(7, $Commit.Length)) + $body = (@($notes, "ExecuteR $Version (commit ``$short``)") | Where-Object { $_ }) -join "`n`n" + Write-Host "Creating release $tag on $owner/$repo" + $releaseBody = @{ + tag_name = $tag + target_commitish = $Commit + name = "ExecuteR $Version" + body = $body + draft = $false + prerelease = [bool]$Prerelease + } | ConvertTo-Json $release = Invoke-RestMethod -Method Post -Uri "$apiBase/releases" -Headers $headers ` - -ContentType 'application/json' -Body $body + -ContentType 'application/json' -Body $releaseBody } -catch { - # Release for this tag may already exist; fetch it. - $release = Invoke-RestMethod -Method Get -Uri "$apiBase/releases/tags/$tag" -Headers $headers +else { + Write-Host "Release $tag exists; adding missing assets" } +# ── Assets: this version's agent and server files only ─────────────────────── $artifacts = Join-Path $repoRoot 'artifacts' -$assets = Get-ChildItem $artifacts -File | - Where-Object { $_.Name -like "ExecuteR-Agent-$Version*" -or $_.Name -like "ExecuteR-Server-$Version*" } -if (-not $assets) { - throw "No artifacts matching ExecuteR-Agent-$Version* or ExecuteR-Server-$Version* under $artifacts." +$ownFile = '^ExecuteR-(Agent|Server)-' + [regex]::Escape($Version) + '(-.+\.(zip|txt)|\.msi)$' +$assets = @(Get-ChildItem $artifacts -File | Where-Object { $_.Name -match $ownFile }) +if ($assets.Count -eq 0) { + throw "No artifacts of $Version (ExecuteR-Agent-$Version-*, ExecuteR-Server-$Version-*, *.msi) under $artifacts." } +$uploaded = @($release.assets | Where-Object { $_ }) foreach ($asset in $assets) { + if ($uploaded | Where-Object { $_.name -eq $asset.Name -and $_.size -eq $asset.Length }) { + Write-Host "Already uploaded $($asset.Name)" + continue + } Write-Host "Uploading $($asset.Name)" $uri = "$apiBase/releases/$($release.id)/assets?name=$([uri]::EscapeDataString($asset.Name))" Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -InFile $asset.FullName -ContentType 'application/octet-stream' | Out-Null } -Write-Host "Release $tag published with $($assets.Count) asset(s)." +Write-Host "Release $tag published with $($assets.Count) asset(s): $($giteaUrl.TrimEnd('/'))/$owner/$repo/releases/tag/$tag" diff --git a/scripts/Test.ps1 b/scripts/Test.ps1 index f1f6e9b..dc94163 100644 --- a/scripts/Test.ps1 +++ b/scripts/Test.ps1 @@ -17,11 +17,12 @@ param( $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot -$Version = & (Join-Path $PSScriptRoot 'Get-UnifiedVersion.ps1') -Version $Version +$Version = & (Join-Path $PSScriptRoot 'Get-Version.ps1') -Version $Version $unitProjects = @( 'tests/Shared.Tests', 'tests/Agent.Tests', + 'tests/Agent.Watchdog.Tests', 'tests/Backend.Tests' ) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 474aeb2..99f6d9d 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -168,8 +168,27 @@ fi if [[ $BUILD_NEEDED -eq 1 ]]; then [[ -f src/Infra/backend/Dockerfile ]] \ || die "cannot build: source not present. Clone the repo, or make the registry reachable." - log "Building images from source" - UNIFIED_VERSION="${UNIFIED_VERSION:-$(date -u +%Y.%m.%d.%H%M)}" compose build + # The build version (README, Versioning; scripts/Get-Version.ps1): the + # release tag vX.Y.Z behind HEAD and the commits since it (1.4.0.7, or + # 1.4.0 on the tagged commit); 0.0.0. without a release tag; + # 0.0.0.0 without git. One to three digits of major: calendar-era tags + # (v2026.10.10.0140) never match. + if [[ -z "${UNIFIED_VERSION:-}" ]]; then + describe="$(git describe --tags --long --match 'v[0-9].[0-9]*.[0-9]*' \ + --match 'v[0-9][0-9].[0-9]*.[0-9]*' --match 'v[0-9][0-9][0-9].[0-9]*.[0-9]*' 2>/dev/null || true)" + if [[ $describe =~ ^v([0-9]{1,3}\.[0-9]+\.[0-9]+)-([0-9]+)-g[0-9a-f]+$ ]]; then + UNIFIED_VERSION="${BASH_REMATCH[1]}" + [[ ${BASH_REMATCH[2]} == 0 ]] || UNIFIED_VERSION="$UNIFIED_VERSION.${BASH_REMATCH[2]}" + elif commits="$(git rev-list --count HEAD 2>/dev/null)"; then + UNIFIED_VERSION="0.0.0.$commits" + else + UNIFIED_VERSION="0.0.0.0" + fi + fi + # Exported: the steps below run the images just built, by this tag. + export UNIFIED_VERSION + log "Building images from source ($UNIFIED_VERSION)" + compose build fi # ── NATS operator/account keys (generated by the backend image itself) ────── -- 2.52.0 From ccfdfd9cf0892123e888765ffe6cb24d8ca28ae0eac15240c5d128c73a7d8280 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:26:32 -0400 Subject: [PATCH 15/26] fix(versioning): report the version before +metadata, drop the calendar MSI transform The informational version is now X.Y.Z[.N]+, so the reported version (enrollment, presence, /health, CLI, the watchdog) is everything before '+'; nothing is cut at '-' any more. No version is still 0.0.0.0. ToMsiProductVersion (yyyy.MM.dd.HHmm to yy.MM.minutes) is gone: the MSIs take the four-field version. Co-Authored-By: Claude Opus 5.5 --- src/Agent.Watchdog/WatchdogVersion.cs | 15 ++-- .../Versioning/BuildVersion.cs | 72 +++++-------------- tests/Shared.Tests/BuildVersionTests.cs | 47 ++++++------ 3 files changed, 52 insertions(+), 82 deletions(-) diff --git a/src/Agent.Watchdog/WatchdogVersion.cs b/src/Agent.Watchdog/WatchdogVersion.cs index fb089f1..841ee93 100644 --- a/src/Agent.Watchdog/WatchdogVersion.cs +++ b/src/Agent.Watchdog/WatchdogVersion.cs @@ -3,25 +3,26 @@ using System.Reflection; namespace Agent.Watchdog; /// -/// The watchdog's unified version (yyyy.MM.dd.HHmm), read the way the -/// agent's BuildVersion reads its own: the informational version without the -/// short-commit suffix or build metadata. +/// The watchdog's version (X.Y.Z or X.Y.Z.N), read the way the +/// agent's BuildVersion reads its own: the informational version without its +/// +metadata (the commit). /// public static class WatchdogVersion { public static string Current { get; } = Resolve(typeof(WatchdogVersion).Assembly); public static string Resolve(Assembly assembly) + => FromInformational(assembly.GetCustomAttribute()?.InformationalVersion); + + public static string FromInformational(string? informational) { - var informational = assembly.GetCustomAttribute()?.InformationalVersion; if (string.IsNullOrWhiteSpace(informational)) { return "0.0.0.0"; } var plus = informational.IndexOf('+'); - var trimmed = plus >= 0 ? informational[..plus] : informational; - var dash = trimmed.IndexOf('-'); - return dash >= 0 ? trimmed[..dash] : trimmed; + var version = (plus >= 0 ? informational[..plus] : informational).Trim(); + return version.Length == 0 ? "0.0.0.0" : version; } } diff --git a/src/Shared.Infrastructure/Versioning/BuildVersion.cs b/src/Shared.Infrastructure/Versioning/BuildVersion.cs index abbe6c5..b68240e 100644 --- a/src/Shared.Infrastructure/Versioning/BuildVersion.cs +++ b/src/Shared.Infrastructure/Versioning/BuildVersion.cs @@ -1,74 +1,38 @@ -using System.Globalization; using System.Reflection; namespace Shared.Infrastructure.Versioning; /// -/// Unified build version (yyyy.MM.dd.HHmm, UTC) shared by every artifact. -/// The value is stamped at build time via the UnifiedVersion MSBuild property. +/// The build version shared by every artifact: a release's X.Y.Z, or +/// X.Y.Z.N for a build N commits after it (README, Versioning). It is +/// stamped at build time through the UnifiedVersion MSBuild property; versions +/// are compared with . /// public static class BuildVersion { - /// The unified version of the running application's entry assembly. + /// The development version of a binary built without one. + public const string Development = "0.0.0.0"; + + /// The version of the running application's entry assembly. public static string Current { get; } = Resolve(Assembly.GetEntryAssembly()); public static string Resolve(Assembly? assembly) - { - var informational = assembly? - .GetCustomAttribute()? - .InformationalVersion; - - if (string.IsNullOrWhiteSpace(informational)) - { - return "0.0.0.0"; - } - - // The binary keeps its full informational version (date-hash) for - // support; the REPORTED version (enrollment, presence, /health, CLI) - // is the clean unified yyyy.MM.dd.HHmm. Strip build metadata (+sha) - // and the short-commit suffix (-sha) — the date part has no '-'. - var trimmed = informational; - var plus = trimmed.IndexOf('+'); - if (plus >= 0) - { - trimmed = trimmed[..plus]; - } - - var dash = trimmed.IndexOf('-'); - if (dash >= 0) - { - trimmed = trimmed[..dash]; - } - - return trimmed; - } + => FromInformational(assembly?.GetCustomAttribute()?.InformationalVersion); /// - /// Deterministic MSI ProductVersion transform. MSI limits: major ≤ 255, - /// minor ≤ 255, build ≤ 65535. Mapping keeps ordering within a year: - /// yyyy.MM.dd.HHmm → (yyyy-2000).(MM).((dd-1)*1440 + HH*60 + mm). - /// The full unified version is retained in MSI display metadata. + /// The reported version (enrollment, presence, /health, CLI) from an + /// informational version: the binary keeps 1.4.0.7+1a2b3c4 for + /// support; the version is the part before the build metadata. /// - public static string ToMsiProductVersion(string unifiedVersion) + public static string FromInformational(string? informational) { - var parts = unifiedVersion.Split('.'); - if (parts.Length != 4 - || !int.TryParse(parts[0], NumberStyles.None, CultureInfo.InvariantCulture, out var year) - || !int.TryParse(parts[1], NumberStyles.None, CultureInfo.InvariantCulture, out var month) - || !int.TryParse(parts[2], NumberStyles.None, CultureInfo.InvariantCulture, out var day) - || !int.TryParse(parts[3], NumberStyles.None, CultureInfo.InvariantCulture, out var hhmm)) + if (string.IsNullOrWhiteSpace(informational)) { - throw new FormatException($"'{unifiedVersion}' is not a unified yyyy.MM.dd.HHmm version."); + return Development; } - var major = year - 2000; - var build = (day - 1) * 1440 + (hhmm / 100) * 60 + hhmm % 100; - - if (major is < 0 or > 255 || month is < 1 or > 12 || build is < 0 or > 65535) - { - throw new FormatException($"'{unifiedVersion}' cannot be mapped to an MSI ProductVersion."); - } - - return $"{major}.{month}.{build}"; + var plus = informational.IndexOf('+'); + var version = (plus >= 0 ? informational[..plus] : informational).Trim(); + return version.Length == 0 ? Development : version; } } diff --git a/tests/Shared.Tests/BuildVersionTests.cs b/tests/Shared.Tests/BuildVersionTests.cs index 940272e..533968e 100644 --- a/tests/Shared.Tests/BuildVersionTests.cs +++ b/tests/Shared.Tests/BuildVersionTests.cs @@ -1,3 +1,4 @@ +using System.Reflection; using Shared.Infrastructure.Versioning; using Xunit; @@ -6,31 +7,35 @@ namespace Shared.Tests; public class BuildVersionTests { [Theory] - [InlineData("2026.08.06.2151", "26.8.8511")] - [InlineData("2026.01.01.0000", "26.1.0")] - [InlineData("2026.12.31.2359", "26.12.44639")] - public void MsiProductVersionTransformIsDeterministic(string unified, string expected) + [InlineData("1.4.0+1a2b3c4", "1.4.0")] + [InlineData("1.4.0.7+1a2b3c4", "1.4.0.7")] + [InlineData("1.4.0.7+1a2b3c4.dirty", "1.4.0.7")] + [InlineData("1.4.0", "1.4.0")] + [InlineData("0.0.0.253+0ce444f", "0.0.0.253")] + // A calendar-era binary still reads (its version had no '+'). + [InlineData("2026.10.10.0140", "2026.10.10.0140")] + public void TheReportedVersionDropsOnlyTheBuildMetadata(string informational, string expected) { - Assert.Equal(expected, BuildVersion.ToMsiProductVersion(unified)); - } - - [Fact] - public void MsiProductVersionIsMonotonicWithinAMonth() - { - var earlier = BuildVersion.ToMsiProductVersion("2026.08.06.2151"); - var later = BuildVersion.ToMsiProductVersion("2026.08.07.0001"); - - var earlierBuild = int.Parse(earlier.Split('.')[2]); - var laterBuild = int.Parse(later.Split('.')[2]); - Assert.True(laterBuild > earlierBuild); + Assert.Equal(expected, BuildVersion.FromInformational(informational)); } [Theory] - [InlineData("not-a-version")] - [InlineData("2026.08.06")] - [InlineData("1.2.3.4.5")] - public void InvalidUnifiedVersionsAreRejected(string value) + [InlineData(null)] + [InlineData("")] + [InlineData(" ")] + [InlineData("+1a2b3c4")] + public void NoVersionIsTheDevelopmentVersion(string? informational) { - Assert.Throws(() => BuildVersion.ToMsiProductVersion(value)); + Assert.Equal(BuildVersion.Development, BuildVersion.FromInformational(informational)); + Assert.Equal("0.0.0.0", BuildVersion.Development); + } + + [Fact] + public void AnAssemblyWithoutAnInformationalVersionIsTheDevelopmentVersion() + { + Assert.Equal("0.0.0.0", BuildVersion.Resolve(null)); + var stamped = BuildVersion.Resolve(typeof(BuildVersion).Assembly); + var informational = typeof(BuildVersion).Assembly.GetCustomAttribute()!.InformationalVersion; + Assert.Equal(informational.Split('+')[0], stamped); } } -- 2.52.0 From a8a690fc820c5a9eea91582cfdb4cdebd7bdbad4d94eade801c07731251b375b Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:26:32 -0400 Subject: [PATCH 16/26] fix(upgrades): catalog every version AgentVersions understands IsCatalogVersion took only versions with a major above 0; semantic versions start at 0.x (0.1.0 is the seed release). It now takes what AgentVersions.IsValid takes (3 or 4 numeric fields, not 0.0.0.0), digits and dots only. Co-Authored-By: Claude Opus 5.5 --- src/Backend/Upgrades/AgentCatalog.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Backend/Upgrades/AgentCatalog.cs b/src/Backend/Upgrades/AgentCatalog.cs index 7b45129..1b9592c 100644 --- a/src/Backend/Upgrades/AgentCatalog.cs +++ b/src/Backend/Upgrades/AgentCatalog.cs @@ -42,13 +42,9 @@ public sealed class AgentCatalogService( S3SettingsService s3Settings, ILogger logger) { - /// A real release version (four numeric parts); a development 0.0.0.0 or a label is never catalogued. + /// A real version (3 or 4 numeric parts, 0.x included); a development 0.0.0.0, +metadata or a label is never catalogued. public static bool IsCatalogVersion(string? version) - => !string.IsNullOrWhiteSpace(version) - && version.Length <= 64 - && Version.TryParse(version, out var parsed) - && parsed.Major > 0 - && version.All(c => char.IsAsciiDigit(c) || c == '.'); + => AgentVersions.IsValid(version) && version!.All(c => char.IsAsciiDigit(c) || c == '.'); /// One pass: import what this node can see, offload to S3 when on, prune. public async Task SyncAsync(CancellationToken cancellationToken) -- 2.52.0 From 13213208388204de727ee2cbcdf8aaa096dbf8f00dd3631a0c5852ff2a529321 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:26:32 -0400 Subject: [PATCH 17/26] fix(grouping): order agentVersion rules by version >, >=, < and <= on agentVersion compared text ordinally (1.10.0 before 1.9.0, every calendar version after 1.x). They now use AgentVersions, the order upgrades use; a rule value of one or two numbers means its release line (1.4 is 1.4.0). Co-Authored-By: Claude Opus 5.5 --- .../Grouping/RuleEvaluator.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Shared.Infrastructure/Grouping/RuleEvaluator.cs b/src/Shared.Infrastructure/Grouping/RuleEvaluator.cs index 35cf29f..ebc4239 100644 --- a/src/Shared.Infrastructure/Grouping/RuleEvaluator.cs +++ b/src/Shared.Infrastructure/Grouping/RuleEvaluator.cs @@ -14,6 +14,9 @@ public static class RuleEvaluator { private static readonly TimeSpan RegexTimeout = TimeSpan.FromMilliseconds(250); + /// Ordered by version, not by number or text (). + private const string AgentVersionField = "agentVersion"; + /// Operators that are inherently negative and so must hold for ALL values. private static bool IsUniversal(RuleOperator op) => op is RuleOperator.NotEquals or RuleOperator.NotContains or RuleOperator.NotIn @@ -129,7 +132,9 @@ public static class RuleEvaluator case RuleOperator.GreaterOrEqual: case RuleOperator.LessThan: case RuleOperator.LessOrEqual: - return CompareNumeric(actual, expected, condition.Operator); + return string.Equals(condition.Field, AgentVersionField, StringComparison.OrdinalIgnoreCase) + ? CompareVersion(actual, expected, condition.Operator) + : CompareNumeric(actual, expected, condition.Operator); case RuleOperator.InCidr: return MatchesCidr(actual, expected); @@ -203,6 +208,32 @@ public static class RuleEvaluator return true; } + /// + /// The agent version orders the way upgrades do (): + /// 1.10.0 after 1.9.0, 1.4.0.7 after 1.4.0, every calendar-era version + /// before 1.0.0. A rule value of one or two numbers means its release line + /// (1.4 is 1.4.0). + /// + private static bool CompareVersion(string actual, string expected, RuleOperator op) + { + var bound = expected.Trim(); + var fields = bound.Split('.'); + if (fields.Length < 3 && fields.All(f => f.Length > 0 && f.All(char.IsAsciiDigit))) + { + bound += string.Concat(Enumerable.Repeat(".0", 3 - fields.Length)); + } + + var comparison = AgentVersions.Compare(actual, bound); + return op switch + { + RuleOperator.GreaterThan => comparison > 0, + RuleOperator.GreaterOrEqual => comparison >= 0, + RuleOperator.LessThan => comparison < 0, + RuleOperator.LessOrEqual => comparison <= 0, + _ => false, + }; + } + private static bool CompareNumeric(string actual, string expected, RuleOperator op) { if (!double.TryParse(actual, NumberStyles.Float, CultureInfo.InvariantCulture, out var left) -- 2.52.0 From a8be0ba26b28b0a22a374393d3e389814503b4c4524768eecf427db65c744ce3 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:26:32 -0400 Subject: [PATCH 18/26] fix(console): compare agent versions the way the server does compareVersions and versionSortKey mirror AgentVersions: semantic versions after the calendar era, a missing fourth field is 0, +metadata ignored, 0.0.0.0 and anything unparseable first, then ordinally. Co-Authored-By: Claude Opus 5.5 --- .../src/sections/upgrades/agentVersions.ts | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/WebUI/src/sections/upgrades/agentVersions.ts b/src/WebUI/src/sections/upgrades/agentVersions.ts index 3b4b449..50f91ed 100644 --- a/src/WebUI/src/sections/upgrades/agentVersions.ts +++ b/src/WebUI/src/sections/upgrades/agentVersions.ts @@ -6,29 +6,44 @@ import { platformOf } from 'components/OsIcon'; import { keys } from 'api/client'; import type { ActivityEventPayload, AgentVersionDto } from 'api/types'; -/** The four numbers of a yyyy.MM.dd.HHmm version, or null for anything else (a development 0.0.0.0, a custom label). */ +// The server's one version order (AgentVersions in Shared.Contracts), mirrored exactly: semantic major.minor.patch with a fourth +// field on builds between releases (1.4.0.7; missing = 0), +metadata ignored. The calendar era before it (yyyy.MM.dd.HHmm, major +// 2000 or more) sorts before every semantic version; anything that does not parse, and the development 0.0.0.0, before everything. +const calendarEraMajor = 2000; +// One field the way .NET's Version.TryParse reads it (an int, ASCII whitespace around it, a sign). +const field = /^[\t\n\v\f\r ]*[+-]?\d+[\t\n\v\f\r ]*$/; + +/** Era (0 calendar, 1 semantic) then the four numbers, or null for anything else (0.0.0.0, a label). */ function parse(version?: string | null): number[] | null { - const parts = (version ?? '').split('.'); - if (parts.length < 2 || parts.length > 4 || !parts.every((p) => /^\d+$/.test(p))) return null; - const numbers = [0, 1, 2, 3].map((i) => Number(parts[i] ?? 0)); - return numbers[0] > 0 ? numbers : null; + if (!version || !version.trim() || version.length > 64) return null; + const parts = version.split('+')[0].trim().split('.'); + if (parts.length < 3 || parts.length > 4 || !parts.every((p) => field.test(p))) return null; + // -0 reads as 0 (as in .NET); any other negative, or a number past Int32, does not parse. + const numbers = [0, 1, 2, 3].map((i) => Math.abs(Number(parts[i] ?? 0))); + if (parts.some((p) => Number(p) < 0) || numbers.some((n) => n > 2147483647)) return null; + if (numbers.every((n) => n === 0)) return null; + return [numbers[0] >= calendarEraMajor ? 0 : 1, ...numbers]; } -/** The server's one version order: real versions by their numbers; anything else before them, then by text. */ +/** The server's one version order: by era, then field by field; anything that does not parse before them, then ordinally. */ export function compareVersions(left?: string | null, right?: string | null): number { const a = parse(left); const b = parse(right); - if (a && b) return a.reduce((result, n, i) => result || n - b[i], 0); + if (a && b) return Math.sign(a.reduce((result, n, i) => result || n - b[i], 0)); if (a) return 1; if (b) return -1; - return (left ?? '').localeCompare(right ?? ''); + // string.CompareOrdinal: no value before any text, then UTF-16 code unit by code unit. + const l = left ?? null; + const r = right ?? null; + if (l === null || r === null) return l === r ? 0 : l === null ? -1 : 1; + return l < r ? -1 : l > r ? 1 : 0; } /** A text key that sorts like `compareVersions` (for table columns). */ export function versionSortKey(version?: string | null): string | undefined { if (!version) return undefined; const parts = parse(version); - return parts ? `1${parts.map((n) => String(n).padStart(10, '0')).join('')}` : `0${version}`; + return parts ? `1${parts[0]}${parts.slice(1).map((n) => String(n).padStart(10, '0')).join('')}` : `0${version}`; } /** Package types an agent on this OS upgrades from (the MSI when the MSI installed it). */ -- 2.52.0 From 31b80361540a5ce51abefc1726431ab7631f2ab9774e64c4950cd7fb062b9f5c Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:27:07 -0400 Subject: [PATCH 19/26] feat(installer): semantic MSI versions that upgrade over the calendar era Both MSIs take the four-field version as ProductVersion and remove every installed version (MajorUpgrade AllowDowngrades), so 1.0.0.0 replaces the calendar era's 26.x. Installer.CustomActions (DTF, WiX 5.0.2): - FindNewerRelease (immediate, after FindRelatedProducts, NOT Installed) reads each WIX_UPGRADE_DETECTED product's version, maps the calendar encoding (yy.MM.minute-of-month) back to 20yy.MM.dd.HHmm and compares it with UNIFIEDVERSION by a copy of AgentVersions; a newer one sets NEWER_RELEASE_INSTALLED and the launch condition refuses the install unless ALLOWDOWNGRADE=1 (an MSI upgrade's rollback). - KeepInstallerPackage (agent only; deferred, as SYSTEM, after InstallFiles on an install or upgrade) copies [OriginalDatabase] to %ProgramData%\ExecuteR\packages\\ in a folder only SYSTEM and Administrators may write, keeps the 3 most recently installed and never fails the install. REINSTALLMODE=amus on upgrades and repairs, so 1.x files replace files stamped 2026.x. PurgeCredentials and the server's service and data removal stay gated on NOT UPGRADINGPRODUCTCODE, which a downgrade through the major upgrade also sets. Co-Authored-By: Claude Opus 5.5 --- Directory.Packages.props | 3 + ExecuteR.slnx | 1 + .../CustomAction.config | 6 + .../InstalledRelease.cs | 112 +++++++++++++++++ .../Installer.CustomActions.csproj | 22 ++++ src/Installer.CustomActions/KeptPackages.cs | 117 ++++++++++++++++++ src/Installer.CustomActions/UpgradeActions.cs | 111 +++++++++++++++++ src/Installer.Server/Product.wxs | 34 ++++- src/Installer.Server/Server.Installer.wixproj | 11 +- src/Installer/Agent.Installer.wixproj | 14 ++- src/Installer/Product.wxs | 49 +++++++- 11 files changed, 467 insertions(+), 13 deletions(-) create mode 100644 src/Installer.CustomActions/CustomAction.config create mode 100644 src/Installer.CustomActions/InstalledRelease.cs create mode 100644 src/Installer.CustomActions/Installer.CustomActions.csproj create mode 100644 src/Installer.CustomActions/KeptPackages.cs create mode 100644 src/Installer.CustomActions/UpgradeActions.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index a6c56b9..3377581 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -57,6 +57,9 @@ + + + diff --git a/ExecuteR.slnx b/ExecuteR.slnx index a42c97b..e313e7e 100644 --- a/ExecuteR.slnx +++ b/ExecuteR.slnx @@ -3,6 +3,7 @@ + diff --git a/src/Installer.CustomActions/CustomAction.config b/src/Installer.CustomActions/CustomAction.config new file mode 100644 index 0000000..a913e0e --- /dev/null +++ b/src/Installer.CustomActions/CustomAction.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Installer.CustomActions/InstalledRelease.cs b/src/Installer.CustomActions/InstalledRelease.cs new file mode 100644 index 0000000..17eb162 --- /dev/null +++ b/src/Installer.CustomActions/InstalledRelease.cs @@ -0,0 +1,112 @@ +namespace ExecuteR.Installer.CustomActions; + +/// +/// Which installed release an MSI may replace (README, Versioning). Windows +/// Installer compares only the first three fields of a ProductVersion and knows +/// nothing of the calendar era, so each package removes every installed version +/// (MajorUpgrade AllowDowngrades) and this decides first whether one of them is +/// newer, by the product's one version order. is a copy of +/// Shared.Contracts' AgentVersions.Compare (this assembly runs on .NET +/// Framework); tests/Shared.Tests compiles this file and checks the two agree. +/// No usings: the file is also compiled into the tests. +/// +public static class InstalledRelease +{ + /// Majors from this value on are calendar-era versions (2026.10.23.1400). + public const int CalendarEraMajor = 2000; + + /// + /// The product version an installed MSI's version string stands for. From + /// semantic versions on it is the version itself (1.4.0.7). The calendar + /// era's MSIs carried three fields, yy.MM.minute-of-the-month + /// (26.10.13060 for 2026.10.10.0140), read back to that version. Null when + /// it does not read as a version. + /// + public static string? FromMsiVersion(string? text) + { + var trimmed = text?.Trim(); + if (!System.Version.TryParse(trimmed, out var version) || version.Build < 0) + { + return null; + } + + if (version.Revision < 0 && version.Major >= 26 && version.Major <= 99 + && version.Minor >= 1 && version.Minor <= 12 && version.Build < 31 * 1440) + { + var minute = version.Build; + return string.Format( + System.Globalization.CultureInfo.InvariantCulture, + "{0}.{1:00}.{2:00}.{3:00}{4:00}", + 2000 + version.Major, version.Minor, (minute / 1440) + 1, minute % 1440 / 60, minute % 60); + } + + return trimmed; + } + + /// + /// The first installed version (as reads it) + /// newer than , the package's own full version, + /// or null when none is. The same version again is a reinstall, not newer. + /// + public static string? Newer(string? incoming, System.Collections.Generic.IEnumerable installedMsiVersions) + { + foreach (var text in installedMsiVersions) + { + var installed = FromMsiVersion(text); + if (installed is not null && Compare(installed, incoming) > 0) + { + return installed; + } + } + + return null; + } + + /// + /// AgentVersions.Compare: semantic major.minor.patch[.build] (missing + /// fourth field = 0, +metadata ignored) after the calendar era (major + /// 2000 or more); anything that does not parse, and 0.0.0.0, before + /// everything, then ordinally. + /// + public static int Compare(string? left, string? right) + { + var a = Parse(left); + var b = Parse(right); + if (a is not null && b is not null) + { + var era = Era(a).CompareTo(Era(b)); + return era != 0 ? era : a.CompareTo(b); + } + + if (a is not null) + { + return 1; + } + + if (b is not null) + { + return -1; + } + + return string.CompareOrdinal(left, right); + } + + private static int Era(System.Version version) => version.Major >= CalendarEraMajor ? 0 : 1; + + private static System.Version? Parse(string? value) + { + if (string.IsNullOrWhiteSpace(value) || value!.Length > 64) + { + return null; + } + + var core = value.Split('+')[0].Trim(); + if (!System.Version.TryParse(core, out var version) || core.Split('.').Length < 3) + { + return null; + } + + var normalized = new System.Version(version.Major, version.Minor, version.Build, System.Math.Max(version.Revision, 0)); + return normalized == new System.Version(0, 0, 0, 0) ? null : normalized; + } +} diff --git a/src/Installer.CustomActions/Installer.CustomActions.csproj b/src/Installer.CustomActions/Installer.CustomActions.csproj new file mode 100644 index 0000000..5da1ddf --- /dev/null +++ b/src/Installer.CustomActions/Installer.CustomActions.csproj @@ -0,0 +1,22 @@ + + + + + net472 + disable + false + ExecuteR.Installer.CustomActions + + + + + + + + + + + + diff --git a/src/Installer.CustomActions/KeptPackages.cs b/src/Installer.CustomActions/KeptPackages.cs new file mode 100644 index 0000000..22c5b76 --- /dev/null +++ b/src/Installer.CustomActions/KeptPackages.cs @@ -0,0 +1,117 @@ +namespace ExecuteR.Installer.CustomActions; + +/// +/// The agent MSIs kept for rollback (Shared.Contracts' WatchdogFiles.KeptPackages): +/// %ProgramData%\ExecuteR\packages\<sha256>\<file name>.msi, the +/// newest by when each was last installed. An MSI upgrade's +/// rollback reinstalls the previous version from here. No usings: the file is +/// also compiled into tests/Shared.Tests. +/// +public static class KeptPackages +{ + /// WatchdogFiles.KeptPackagesMax. + public const int Max = 3; + + /// + /// Copies to <root>\<sha256>\<its file name> + /// (unless that copy is already there whole), marks its folder as the newest, + /// and removes the package folders beyond the newest . + /// Returns the kept file's path. Throws on failure; the caller decides what a + /// failure means (the installer logs it and goes on). + /// + public static string Keep(string source, string root, int max, System.Action log) + { + var sha256 = Sha256(source); + var folder = System.IO.Path.Combine(root, sha256); + var target = System.IO.Path.Combine(folder, System.IO.Path.GetFileName(source)); + System.IO.Directory.CreateDirectory(folder); + + if (System.IO.File.Exists(target) && Sha256(target) == sha256) + { + log($"{target} is already kept."); + } + else + { + // Copied under a temporary name and renamed, so a reader never sees half an MSI. + var partial = target + ".partial"; + System.IO.File.Copy(source, partial, overwrite: true); + if (System.IO.File.Exists(target)) + { + System.IO.File.Delete(target); + } + + System.IO.File.Move(partial, target); + log($"Kept {source} as {target}."); + } + + System.IO.Directory.SetLastWriteTimeUtc(folder, System.DateTime.UtcNow); + Prune(root, sha256, max, log); + return target; + } + + /// Removes the package folders (named by a SHA-256) beyond the newest ; always stays. + public static void Prune(string root, string keep, int max, System.Action log) + { + var folders = new System.Collections.Generic.List(); + foreach (var directory in new System.IO.DirectoryInfo(root).GetDirectories()) + { + if (IsSha256(directory.Name)) + { + folders.Add(directory); + } + } + + // The kept one first, then the most recently installed. + folders.Sort((a, b) => + { + var first = string.Equals(b.Name, keep, System.StringComparison.OrdinalIgnoreCase) + .CompareTo(string.Equals(a.Name, keep, System.StringComparison.OrdinalIgnoreCase)); + return first != 0 ? first : b.LastWriteTimeUtc.CompareTo(a.LastWriteTimeUtc); + }); + + for (var i = System.Math.Max(max, 1); i < folders.Count; i++) + { + try + { + folders[i].Delete(recursive: true); + log($"Removed the kept package {folders[i].FullName}."); + } + catch (System.Exception exception) when (exception is System.IO.IOException or System.UnauthorizedAccessException) + { + log($"Could not remove the kept package {folders[i].FullName}: {exception.Message}"); + } + } + } + + public static string Sha256(string path) + { + using var stream = System.IO.File.OpenRead(path); + using var sha = System.Security.Cryptography.SHA256.Create(); + var hash = sha.ComputeHash(stream); + var text = new System.Text.StringBuilder(hash.Length * 2); + foreach (var b in hash) + { + text.Append(b.ToString("x2", System.Globalization.CultureInfo.InvariantCulture)); + } + + return text.ToString(); + } + + private static bool IsSha256(string name) + { + if (name.Length != 64) + { + return false; + } + + foreach (var c in name) + { + if (!(c is >= '0' and <= '9' or >= 'a' and <= 'f' or >= 'A' and <= 'F')) + { + return false; + } + } + + return true; + } +} diff --git a/src/Installer.CustomActions/UpgradeActions.cs b/src/Installer.CustomActions/UpgradeActions.cs new file mode 100644 index 0000000..c3463ae --- /dev/null +++ b/src/Installer.CustomActions/UpgradeActions.cs @@ -0,0 +1,111 @@ +using System; +using System.IO; +using System.Linq; +using System.Security.AccessControl; +using System.Security.Principal; +using WixToolset.Dtf.WindowsInstaller; + +namespace ExecuteR.Installer.CustomActions; + +/// The installers' side of versioning and MSI upgrades (README, Versioning). +public static class UpgradeActions +{ + /// + /// Immediate, after FindRelatedProducts (both sequences, NOT Installed). + /// MajorUpgrade lists every installed version of the product in + /// WIX_UPGRADE_DETECTED; when one is newer than this package's own + /// version (UNIFIEDVERSION, all four fields and the calendar era + /// considered by ), NEWER_RELEASE_INSTALLED + /// is set to it and the launch condition refuses the install, unless + /// ALLOWDOWNGRADE=1 (an MSI upgrade's rollback). + /// + [CustomAction] + public static ActionResult FindNewerRelease(Session session) + { + var incoming = session["UNIFIEDVERSION"]; + if (string.IsNullOrEmpty(incoming)) + { + incoming = session["ProductVersion"]; + } + + var codes = (session["WIX_UPGRADE_DETECTED"] ?? string.Empty).Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + var installed = codes.Select(code => InstalledVersion(session, code)).ToList(); + var newer = InstalledRelease.Newer(incoming, installed); + session.Log($"FindNewerRelease: this package is {incoming}; installed: {(installed.Count == 0 ? "none" : string.Join(", ", installed))}; newer: {newer ?? "none"}."); + if (newer is not null) + { + session["NEWER_RELEASE_INSTALLED"] = newer; + } + + return ActionResult.Success; + } + + /// + /// Deferred, as SYSTEM, after InstallFiles on an install or upgrade (agent MSI + /// only). Copies the MSI being installed (Source = [OriginalDatabase]) + /// to Destination\<sha256>\<file name> and keeps the newest + /// , so an MSI upgrade can roll back to it. + /// Never fails the install: a copy that cannot be made is logged. + /// + [CustomAction] + public static ActionResult KeepInstallerPackage(Session session) + { + try + { + var data = session.CustomActionData; + var source = data["Source"]; + var destination = data["Destination"]; + if (string.IsNullOrEmpty(source) || !File.Exists(source)) + { + session.Log($"KeepInstallerPackage: the package '{source}' cannot be read; nothing kept."); + return ActionResult.Success; + } + + ProtectFolder(destination); + KeptPackages.Keep(source, destination, KeptPackages.Max, message => session.Log($"KeepInstallerPackage: {message}")); + } + catch (Exception exception) + { + // Whatever went wrong, the agent installs; only the rollback copy is missing. + session.Log($"KeepInstallerPackage: keeping the package failed, the install goes on: {exception}"); + } + + return ActionResult.Success; + } + + private static string? InstalledVersion(Session session, string productCode) + { + try + { + return new ProductInstallation(productCode)["VersionString"]; + } + catch (Exception exception) when (exception is InstallerException or ArgumentException) + { + session.Log($"FindNewerRelease: the version of {productCode} could not be read: {exception.Message}"); + return null; + } + } + + /// + /// The kept packages are what SYSTEM reinstalls on a rollback, so only SYSTEM + /// and Administrators may write there (as the agent protects its data folder), + /// nothing inherited from %ProgramData%, where every user may create files. + /// + private static void ProtectFolder(string path) + { + var directory = Directory.CreateDirectory(path); + var security = new DirectorySecurity(); + security.SetAccessRuleProtection(isProtected: true, preserveInheritance: false); + foreach (var sid in new[] { WellKnownSidType.LocalSystemSid, WellKnownSidType.BuiltinAdministratorsSid }) + { + security.AddAccessRule(new FileSystemAccessRule( + new SecurityIdentifier(sid, null), + FileSystemRights.FullControl, + InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, + PropagationFlags.None, + AccessControlType.Allow)); + } + + directory.SetAccessControl(security); + } +} diff --git a/src/Installer.Server/Product.wxs b/src/Installer.Server/Product.wxs index 41e6fe1..8739ba3 100644 --- a/src/Installer.Server/Product.wxs +++ b/src/Installer.Server/Product.wxs @@ -32,15 +32,38 @@ - + + + + + + + + + + + @@ -326,7 +349,12 @@ Condition="WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed" /> + + + + + diff --git a/src/Installer.Server/Server.Installer.wixproj b/src/Installer.Server/Server.Installer.wixproj index a18d991..62c251c 100644 --- a/src/Installer.Server/Server.Installer.wixproj +++ b/src/Installer.Server/Server.Installer.wixproj @@ -5,10 +5,12 @@ Server x64 - ICE61;ICE60 - 0.0.0 + + 0.0.0.0 $(MSBuildThisFileDirectory)..\..\artifacts\server\current\win-x64 @@ -21,4 +23,9 @@ + + + + + diff --git a/src/Installer/Agent.Installer.wixproj b/src/Installer/Agent.Installer.wixproj index 4aaec55..7d396bc 100644 --- a/src/Installer/Agent.Installer.wixproj +++ b/src/Installer/Agent.Installer.wixproj @@ -5,11 +5,12 @@ Agent x64 - + ICE61 - - 0.0.0 + + 0.0.0.0 $(MSBuildThisFileDirectory)..\Agent\bin\Release\net10.0-windows\win-x64\publish $(MSBuildThisFileDirectory)..\..\assets\icons\app.ico @@ -22,4 +23,9 @@ + + + + + diff --git a/src/Installer/Product.wxs b/src/Installer/Product.wxs index 84ed5e4..64db055 100644 --- a/src/Installer/Product.wxs +++ b/src/Installer/Product.wxs @@ -30,16 +30,49 @@ - + + - + + + + + + + + + + + + + @@ -279,7 +312,15 @@ Order="99" Condition="NOT Installed" /> + + + + + + -- 2.52.0 From 22bdce5599f7a8117ad6ba293968353131be09652ac44e9cb964bf42dc386af2 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:30:30 -0400 Subject: [PATCH 20/26] test: version script and release numbering checks scripts/tests/Test-Versioning.ps1 (plain asserts, no Pester): the version rules against canned git describe output and the limits, then a scratch SHA-256 repository with a bare origin walked through the seed: calendar tags ignored, no release tag refused, v0.1.0 plus a breaking change releases 1.0.0, a re-run of the tagged commit is 1.0.0 again, builds after it are 1.0.0.N, docs alone release nothing, a fix 1.0.1, a feat 1.1.0, a branch other than main is refused. Co-Authored-By: Claude Opus 5.5 --- scripts/tests/Test-Versioning.ps1 | 149 ++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 scripts/tests/Test-Versioning.ps1 diff --git a/scripts/tests/Test-Versioning.ps1 b/scripts/tests/Test-Versioning.ps1 new file mode 100644 index 0000000..4d2ccbd --- /dev/null +++ b/scripts/tests/Test-Versioning.ps1 @@ -0,0 +1,149 @@ +<# +.SYNOPSIS +Checks scripts/Get-Version.ps1 and scripts/Get-NextRelease.ps1 (README, +Versioning). Plain asserts, no Pester needed; exits 1 on the first failure. + +.DESCRIPTION +The version rules run against canned `git describe` output. Unless -SkipGit, +a throwaway repository (SHA-256, like this one) with a bare "origin" is built +in the temp folder and walked through the seed and the first releases: +calendar-era tags are ignored, no release tag is refused, v0.1.0 plus a +breaking change releases 1.0.0, a re-run of the tagged commit publishes 1.0.0 +again, builds after it are 1.0.0.N, a fix releases 1.0.1, docs alone release +nothing, a feat releases 1.1.0. Needs git and node (build/release is installed +with npm ci when missing). Never touches this repository's tags. + +.EXAMPLE +./scripts/tests/Test-Versioning.ps1 +./scripts/tests/Test-Versioning.ps1 -SkipGit +#> +[CmdletBinding()] +param( + [switch]$SkipGit +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 3.0 + +$scripts = Split-Path -Parent $PSScriptRoot +$getVersion = Join-Path $scripts 'Get-Version.ps1' +$getNext = Join-Path $scripts 'Get-NextRelease.ps1' +$failures = 0 +# The version overrides, and the CI variables semantic-release reads the branch from (in CI they name the +# pipeline's branch, not the scratch repository's), are cleared while the checks run. +$cleared = 'UNIFIED_VERSION', 'GIT_COMMIT_SHORT', 'CI', 'GITHUB_ACTIONS', 'GITEA_ACTIONS', 'GITHUB_REF', 'GITHUB_HEAD_REF', + 'GITHUB_BASE_REF', 'GITHUB_EVENT_NAME', 'GITHUB_EVENT_PATH', 'GITHUB_SHA', 'GITHUB_REPOSITORY' +$saved = @{} +foreach ($name in $cleared) { + $saved[$name] = [Environment]::GetEnvironmentVariable($name) + [Environment]::SetEnvironmentVariable($name, $null) +} + +function Assert-Equal($Expected, $Actual, [string]$What) { + if ("$Expected" -ceq "$Actual") { Write-Host " ok $What = $Actual" } + else { Write-Host " FAIL $What = '$Actual', expected '$Expected'" -ForegroundColor Red; $script:failures++ } +} + +function Assert-Throws([scriptblock]$Action, [string]$Pattern, [string]$What) { + try { & $Action | Out-Null; Write-Host " FAIL $What did not throw" -ForegroundColor Red; $script:failures++ } + catch { + if ("$_" -match $Pattern) { Write-Host " ok $What refused: $_" } + else { Write-Host " FAIL $What threw '$_', expected /$Pattern/" -ForegroundColor Red; $script:failures++ } + } +} + +try { + Write-Host 'Version rules' + Assert-Equal '1.4.0.7' (& $getVersion -Describe 'v1.4.0-7-g1a2b3c4') 'seven commits after v1.4.0' + Assert-Equal '1.4.0' (& $getVersion -Describe 'v1.4.0-0-g1a2b3c4') 'the tagged commit' + Assert-Equal '1.4.0.0' (& $getVersion -Describe 'v1.4.0-0-g1a2b3c4' -Format FileVersion) 'file version of a release' + Assert-Equal '1.4.0.7' (& $getVersion -Describe 'v1.4.0-7-g1a2b3c4' -Format FileVersion) 'file version of a build' + Assert-Equal '0.0.0.253' (& $getVersion -Describe '' -Commits 253) 'no release tag' + Assert-Equal '0.0.0' (& $getVersion -Describe '' -Commits 0) 'no git' + Assert-Equal '255.255.65535.65535' (& $getVersion -Version '255.255.65535.65535') 'the largest version' + Assert-Equal '1.5.0' (& $getVersion -Version '1.5.0') 'explicit release' + $env:UNIFIED_VERSION = '2.0.0.3' + Assert-Equal '2.0.0.3' (& $getVersion) 'UNIFIED_VERSION' + Assert-Equal '2.0.0.3' (& (Join-Path $scripts 'Get-UnifiedVersion.ps1')) 'the old entry point' + $env:GIT_COMMIT_SHORT = 'abc1234' + Assert-Equal '2.0.0.3+abc1234' (& $getVersion -Format Informational) 'informational version' + $env:UNIFIED_VERSION = $null + $env:GIT_COMMIT_SHORT = $null + Assert-Throws { & $getVersion -Version '2026.10.10.0140' } 'calendar-era' 'a calendar version' + Assert-Throws { & $getVersion -Version '256.0.0' } 'does not fit' 'major 256' + Assert-Throws { & $getVersion -Version '1.256.0' } 'does not fit' 'minor 256' + Assert-Throws { & $getVersion -Version '1.0.65536' } 'does not fit' 'patch 65536' + Assert-Throws { & $getVersion -Version '1.0.0.65536' } 'does not fit' 'build 65536' + Assert-Throws { & $getVersion -Version '1.0.0-rc.1' } 'no -label' 'a prerelease label' + Assert-Throws { & $getVersion -Version '1.0' } 'no -label' 'two fields' + Assert-Throws { & $getVersion -Describe 'v1.0.0-rc1-3-gabc' } 'not v' 'an odd describe' + + if (-not $SkipGit) { + Write-Host 'Releases in a scratch repository' + $temp = Join-Path ([System.IO.Path]::GetTempPath()) "executer-versioning-$([guid]::NewGuid().ToString('N'))" + $origin = Join-Path $temp 'origin.git' + $work = Join-Path $temp 'work' + New-Item -ItemType Directory -Force $temp | Out-Null + try { + function Invoke-Git { & git -C $work @args 2>&1 | Out-Null; if ($LASTEXITCODE -ne 0) { throw "git $args failed ($LASTEXITCODE)" } } + function Add-Commit([string]$Message) { + Add-Content -LiteralPath (Join-Path $work 'history.txt') -Value $Message + Invoke-Git add history.txt + Invoke-Git -c user.name=test -c user.email=test@example.invalid commit -q -m $Message + Invoke-Git push -q origin main + } + function Next { $r = & $getNext -Root $work 6>$null; if ($r) { "$($r.Version) $($r.Type)" } else { 'none' } } + + & git init -q --bare --object-format=sha256 --initial-branch=main $origin + & git init -q --object-format=sha256 --initial-branch=main $work + Invoke-Git remote add origin $origin + Invoke-Git config commit.gpgsign false + Invoke-Git config tag.gpgsign false + Add-Commit 'feat: the calendar era' + Invoke-Git tag v2026.10.10.0140 + Add-Commit 'fix: still calendar' + Invoke-Git push -q origin --tags + + Assert-Equal '0.0.0.2' (& $getVersion -Root $work) 'calendar tags only' + Assert-Throws { & $getNext -Root $work 6>$null } 'No release tag' 'a release without the seed tag' + + Invoke-Git tag v0.1.0 + Invoke-Git push -q origin v0.1.0 + Assert-Equal '0.1.0' (& $getVersion -Root $work) 'the seed commit' + Add-Commit "build(version)!: semantic versions`n`nBREAKING CHANGE: versions are X.Y.Z from release tags." + Assert-Equal '0.1.0.1' (& $getVersion -Root $work) 'a build after the seed' + Assert-Equal '1.0.0 major' (Next) 'the first release after the seed' + + Invoke-Git tag v1.0.0 + Invoke-Git push -q origin v1.0.0 + Assert-Equal '1.0.0' (& $getVersion -Root $work) 'the released commit' + Assert-Equal '1.0.0 rerun' (Next) 'a re-run of the released commit' + + Add-Commit 'docs: a note' + Assert-Equal '1.0.0.1' (& $getVersion -Root $work) 'docs after 1.0.0' + Assert-Equal 'none' (Next) 'docs alone' + Add-Commit 'fix: a bug' + Assert-Equal '1.0.0.2' (& $getVersion -Root $work) 'a fix after 1.0.0' + Assert-Equal '1.0.1 patch' (Next) 'a fix' + Add-Commit 'feat: a feature' + Assert-Equal '1.1.0 minor' (Next) 'a feat and a fix' + + Invoke-Git checkout -q -b topic + Assert-Throws { & $getNext -Root $work 6>$null } 'did not analyze' 'a branch other than main' + } + finally { + Remove-Item -LiteralPath $temp -Recurse -Force -ErrorAction SilentlyContinue + } + } +} +finally { + foreach ($name in $cleared) { [Environment]::SetEnvironmentVariable($name, $saved[$name]) } +} + +if ($failures -gt 0) { + Write-Host "$failures check(s) failed." -ForegroundColor Red + exit 1 +} +Write-Host 'All versioning checks passed.' +# The refusals above leave a non-zero $LASTEXITCODE behind; the result is this. +exit 0 -- 2.52.0 From eb1404407adb3ed81b0981086e8c89b47e0f6ee29db4c5ffc17899e993e2dba0 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:30:31 -0400 Subject: [PATCH 21/26] ci: semantic versions from full clones; release only when one is due Both workflows clone the branch's whole history with its tags (no --depth): the version is the last release tag and the commits since it. CI builds X.Y.Z.N. A push to main that releases builds as that release (semantic-release dry run, the same numbering release.yml uses), so both workflows agree on a release commit's version, and leaves its images to release.yml. Other pushes publish images as before, except that only main takes the bare tag: a branch counts its own commits since the same tag, so dev's 1.4.0.3 would overwrite main's. CI runs the versioning checks. release.yml numbers the release first and stops when none is due (only docs, tests, chores...). Otherwise it builds every binary as X.Y.Z, tags the commit vX.Y.Z and creates the Gitea release with semantic-release's notes (Publish-Release.ps1), then publishes the images as X.Y.Z and latest. Runs are serialized, so a second push numbers after the first. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/ci.yml | 59 +++++++++-- .gitea/workflows/release.yml | 192 +++++++++++++++++++++++++++++++---- 2 files changed, 224 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 83457c0..fab63ad 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -13,6 +13,7 @@ on: - 'tests/**' - 'scripts/**' - 'assets/**' + - 'build/**' - '.gitea/workflows/**' - 'ExecuteR.slnx' - 'Directory.Build.props' @@ -26,6 +27,7 @@ on: - 'tests/**' - 'scripts/**' - 'assets/**' + - 'build/**' - '.gitea/workflows/**' - 'ExecuteR.slnx' - 'Directory.Build.props' @@ -42,11 +44,15 @@ jobs: # instead of recomputing, so binaries and container images never drift. outputs: version: ${{ steps.ver.outputs.version }} + short: ${{ steps.ver.outputs.short }} + release: ${{ steps.ver.outputs.release }} steps: # This repository uses the SHA-256 object format. actions/checkout # cannot clone it (it inits a SHA-1 repo then fetches: "mismatched # algorithms"), so check out with plain git clone, which negotiates - # the object format correctly. + # the object format correctly. The version needs the branch's whole + # history and its tags (the last release tag and the commits since it), + # so no --depth. - name: Checkout shell: pwsh env: @@ -57,7 +63,7 @@ jobs: $ref = '${{ github.head_ref }}' if (-not $ref) { $ref = '${{ github.ref_name }}' } $url = '${{ github.server_url }}/${{ github.repository }}.git' -replace '^https://', "https://x-access-token:$env:CHECKOUT_TOKEN@" - git clone --depth 1 --branch $ref $url . + git clone --single-branch --branch $ref $url . git log -1 --format='%H %s' - name: Setup .NET 10 @@ -71,19 +77,43 @@ jobs: # @nats-io/* packages require Node >= 22. node-version: '22' - - name: Compute unified version + # README, Versioning. A build is X.Y.Z.N (N commits after the last + # release tag vX.Y.Z; 0.0.0.N before the first). A push to main that + # release.yml releases (a fix, feat or breaking change since the last + # release) builds as that release, X.Y.Z, the version release.yml + # computes the same way (semantic-release, dry run): the two workflows + # agree on a release commit's version, and its images come from + # release.yml (release=true skips them here). + - name: Version id: ver shell: pwsh run: | - $v = & ./scripts/Get-UnifiedVersion.ps1 + $ErrorActionPreference = 'Stop' + $v = $null + $release = 'false' + if ('${{ github.event_name }}' -eq 'push' -and '${{ github.ref_name }}' -eq 'main') { + try { + $next = ./scripts/Get-NextRelease.ps1 + if ($next) { $v = $next.Version; $release = 'true' } + } + catch { + Write-Host "::warning::The next release could not be computed ($_); building as a build between releases." + } + } + if (-not $v) { $v = ./scripts/Get-Version.ps1 } + $short = ./scripts/Get-Version.ps1 -Version $v -Format Short "version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append - Write-Host "Unified version: $v" + "short=$short" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + "release=$release" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + Write-Host "Version: $v ($short; release: $release)" + # A refused dry run above leaves its exit code behind; this step succeeded. + $global:LASTEXITCODE = 0 - name: Restore run: dotnet restore ExecuteR.slnx - name: Build - run: dotnet build ExecuteR.slnx -c Release --no-restore "-p:UnifiedVersion=${{ steps.ver.outputs.version }}" + run: dotnet build ExecuteR.slnx -c Release --no-restore "-p:UnifiedVersion=${{ steps.ver.outputs.version }}" "-p:GitCommitShort=${{ steps.ver.outputs.short }}" - name: Unit tests run: | @@ -92,6 +122,11 @@ jobs: dotnet test tests/Agent.Watchdog.Tests -c Release --no-build --nologo dotnet test tests/Backend.Tests -c Release --no-build --nologo + # The version scripts and the release numbering, in a scratch repository. + - name: Versioning checks + shell: pwsh + run: ./scripts/tests/Test-Versioning.ps1 + - name: Integration tests run: dotnet test tests/Integration.Tests -c Release --no-build --nologo @@ -164,8 +199,9 @@ jobs: # registry. Image names match what docker-compose.yml pulls: # //executer-backend: # //executer-webui: + # A release commit's images (X.Y.Z and latest) come from release.yml. needs: build-test - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && needs.build-test.outputs.release != 'true' }} # Needs Docker; label must match a registered Linux runner. runs-on: ubuntu-host env: @@ -249,12 +285,13 @@ jobs: - name: Build images env: VERSION: ${{ needs.build-test.outputs.version }} + GIT_COMMIT_SHORT: ${{ needs.build-test.outputs.short }} PREFIX: ${{ steps.ver.outputs.prefix }} SOURCE_URL: ${{ github.server_url }}/${{ github.repository }} run: | set -e GIT_COMMIT="$(git rev-parse HEAD)" - GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)" + [ -n "$GIT_COMMIT_SHORT" ] || GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)" BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" for svc in backend webui; do docker build -f "src/Infra/${svc}/Dockerfile" \ @@ -271,11 +308,15 @@ jobs: VERSION: ${{ needs.build-test.outputs.version }} PREFIX: ${{ steps.ver.outputs.prefix }} REF_NAME: ${{ github.ref_name }} + # main: (X.Y.Z.N) and latest. Other branches: dev and + # -dev only. A branch counts its own commits since the same + # release tag, so dev's 1.4.0.3 is not main's 1.4.0.3 and must not + # take main's version tag. run: | set -e for svc in backend webui; do - docker push "${PREFIX}-${svc}:$VERSION" if [ "$REF_NAME" = "main" ]; then + docker push "${PREFIX}-${svc}:$VERSION" docker tag "${PREFIX}-${svc}:$VERSION" "${PREFIX}-${svc}:latest" docker push "${PREFIX}-${svc}:latest" else diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index b8aeec5..83dee1e 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,7 +1,20 @@ name: Release -# Docs-only merges to main skip the release build the same way CI skips -# docs-only commits — a release only makes sense when shippable bits changed. +# README, Versioning. A push to main releases when the conventional commits +# since the last release tag vX.Y.Z call for one: semantic-release (dry run, +# scripts/Get-NextRelease.ps1) bumps the patch for fix/perf, the minor for +# feat and the major for a BREAKING CHANGE footer or "type!:". Only docs, +# tests, chores, refactors... release nothing: the run stops after numbering +# (no tag, no release, no images; CI's X.Y.Z.N build and images stand). +# +# A release builds every binary as X.Y.Z, then scripts/Publish-Release.ps1 +# creates the tag vX.Y.Z on the commit and the Gitea release with the notes, +# and the images job publishes the backend and webui images as X.Y.Z and +# latest (CI skips its images for a release commit and builds it as X.Y.Z +# too, so both workflows agree on its version). A re-run of a released commit +# publishes the same version again (missing assets only). +# +# Docs-only merges skip the run the same way CI skips docs-only commits. on: push: branches: [main] @@ -10,23 +23,35 @@ on: - 'tests/**' - 'scripts/**' - 'assets/**' + - 'build/**' - '.gitea/workflows/**' - 'ExecuteR.slnx' - 'Directory.Build.props' - 'Directory.Packages.props' - 'global.json' - 'dotnet-tools.json' + workflow_dispatch: + +# One release at a time: a second push waits for the first to tag its commit, +# so it numbers after it. +concurrency: + group: release + cancel-in-progress: false jobs: - agent-artifacts: - # Publishes the self-contained agent for every platform, the MSI, the - # combined standalone server (win/linux) and checksums, then attaches them - # to a Gitea release for the unified version. + release: + # Publishes the self-contained agent for every platform, the MSIs, the + # combined standalone server (win/linux) and checksums, then tags the + # commit and attaches them to the Gitea release. # Label must match a registered runner: windows-host. runs-on: windows-host + outputs: + version: ${{ steps.next.outputs.version }} + short: ${{ steps.next.outputs.short }} steps: # SHA-256 repo: plain git clone (actions/checkout inits SHA-1 and - # cannot fetch from a SHA-256 server). + # cannot fetch from a SHA-256 server). The whole history and its tags: + # semantic-release reads the commits since the last release tag. - name: Checkout shell: pwsh env: @@ -35,7 +60,7 @@ jobs: $ErrorActionPreference = 'Stop' Get-ChildItem -Force | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $url = '${{ github.server_url }}/${{ github.repository }}.git' -replace '^https://', "https://x-access-token:$env:CHECKOUT_TOKEN@" - git clone --depth 1 --branch '${{ github.ref_name }}' $url . + git clone --single-branch --branch '${{ github.ref_name }}' $url . git log -1 --format='%H %s' - name: Setup .NET 10 @@ -46,31 +71,62 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - # @nats-io/* packages require Node >= 22 (static WebUI build). + # semantic-release needs Node >= 20.8.1; @nats-io/* (WebUI) >= 22. node-version: '22' - - name: Compute unified version - id: ver + # Nothing to release leaves version empty and every later step skips. + - name: Next release + id: next shell: pwsh run: | - $v = & ./scripts/Get-UnifiedVersion.ps1 - "version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + $ErrorActionPreference = 'Stop' + $next = ./scripts/Get-NextRelease.ps1 -NotesPath artifacts/release-notes.md + if ($next) { + $short = ./scripts/Get-Version.ps1 -Version $next.Version -Format Short + "version=$($next.Version)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + "short=$short" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } + $global:LASTEXITCODE = 0 - name: Generate icon + if: ${{ steps.next.outputs.version != '' }} shell: pwsh run: ./scripts/Generate-Icons.ps1 - name: Package agent (all platforms + MSI + checksums) + if: ${{ steps.next.outputs.version != '' }} shell: pwsh run: | - ./scripts/Package-Agent.ps1 -Version ${{ steps.ver.outputs.version }} ` + ./scripts/Package-Agent.ps1 -Version ${{ steps.next.outputs.version }} ` -Runtimes win-x64,win-arm64,linux-x64,linux-arm64,osx-x64,osx-arm64 -SkipIcon + # The installers the backend image serves (see the images job). + $stage = 'artifacts/agent-package' + New-Item -ItemType Directory -Force $stage | Out-Null + $msi = "artifacts/ExecuteR-Agent-${{ steps.next.outputs.version }}.msi" + $zip = "artifacts/ExecuteR-Agent-${{ steps.next.outputs.version }}-win-x64.zip" + if (Test-Path $msi) { Copy-Item $msi "$stage/Agent.msi" } + if (Test-Path $zip) { Copy-Item $zip "$stage/Agent.zip" } + foreach ($rid in 'linux-x64','linux-arm64','osx-x64','osx-arm64') { + $unix = "artifacts/ExecuteR-Agent-${{ steps.next.outputs.version }}-$rid.zip" + if (Test-Path $unix) { Copy-Item $unix "$stage/Agent-$rid.zip" } + } + '${{ steps.next.outputs.version }}' | Set-Content "$stage/VERSION" -NoNewline - name: Package server (win-x64 + linux-x64) + if: ${{ steps.next.outputs.version != '' }} shell: pwsh - run: ./scripts/Package-Server.ps1 -Version ${{ steps.ver.outputs.version }} -SkipIcon + run: ./scripts/Package-Server.ps1 -Version ${{ steps.next.outputs.version }} -SkipIcon - - name: Create Gitea release and upload assets + - name: Upload agent package + if: ${{ steps.next.outputs.version != '' }} + uses: actions/upload-artifact@v3 + with: + name: agent-package + path: artifacts/agent-package/ + retention-days: 7 + + - name: Tag, create the Gitea release and upload assets + if: ${{ steps.next.outputs.version != '' }} shell: pwsh env: # GITEA_TOKEN is injected automatically by Gitea Actions; SERVER_URL @@ -80,5 +136,105 @@ jobs: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_OWNER: ${{ github.repository_owner }} GITEA_REPOSITORY: ${{ github.event.repository.name }} - VERSION: ${{ steps.ver.outputs.version }} - run: ./scripts/Publish-Release.ps1 -Version $env:VERSION + run: | + $notes = if (Test-Path artifacts/release-notes.md) { 'artifacts/release-notes.md' } else { '' } + ./scripts/Publish-Release.ps1 -Version ${{ steps.next.outputs.version }} -NotesFile $notes -Commit "$(git rev-parse HEAD)" + + images: + # The release's backend + webui images, tagged X.Y.Z and latest, in the + # Gitea container registry (the same names CI publishes and + # docker-compose.yml pulls). Only once the release is published. + needs: release + if: ${{ needs.release.outputs.version != '' }} + runs-on: ubuntu-host + env: + # Gitea's built-in registry by default; REGISTRY_* override it with an + # external one (see ci.yml). + REGISTRY_HOST: ${{ secrets.REGISTRY_HOST }} + REGISTRY_USER: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_PASS: ${{ secrets.REGISTRY_PASSWORD }} + SERVER_URL: ${{ github.server_url }} + ACTOR: ${{ github.actor }} + BUILTIN_TOKEN: ${{ secrets.GITEA_TOKEN }} + OWNER: ${{ github.repository_owner }} + steps: + # SHA-256 repo: plain git clone (see the release job). The image build + # takes its version from the release job, not from git. + - name: Checkout + shell: bash + env: + CHECKOUT_TOKEN: ${{ github.token }} + run: | + set -e + find . -mindepth 1 -maxdepth 1 -exec rm -rf {} + 2>/dev/null || true + URL="$(echo '${{ github.server_url }}/${{ github.repository }}.git' | sed "s#^https://#https://x-access-token:${CHECKOUT_TOKEN}@#")" + git clone --depth 1 --branch '${{ github.ref_name }}' "$URL" . + git log -1 --format='%H %s' + + - name: Resolve registry target + id: reg + shell: bash + run: | + set -e + if [ -n "$REGISTRY_HOST" ]; then + HOST="$REGISTRY_HOST"; USER="$REGISTRY_USER"; PASS="$REGISTRY_PASS" + echo "Using external registry $HOST" + else + HOST="$(echo "$SERVER_URL" | sed -E 's#^https?://##; s#/$##')" + USER="$ACTOR"; PASS="$BUILTIN_TOKEN" + echo "Using the built-in Gitea registry at $HOST" + fi + OWNER_LC="$(echo "$OWNER" | tr '[:upper:]' '[:lower:]')" + { + echo "host=$HOST" + echo "user=$USER" + echo "prefix=${HOST}/${OWNER_LC}/executer" + } >> "$GITHUB_OUTPUT" + echo "::add-mask::$PASS" + echo "REGISTRY_LOGIN_PASSWORD=$PASS" >> "$GITHUB_ENV" + + - name: Registry login + run: echo "$REGISTRY_LOGIN_PASSWORD" | docker login "${{ steps.reg.outputs.host }}" -u "${{ steps.reg.outputs.user }}" --password-stdin + + - name: Download agent package + uses: actions/download-artifact@v3 + continue-on-error: true + with: + name: agent-package + path: src/Infra/backend/agent-package + + - name: Build images + env: + VERSION: ${{ needs.release.outputs.version }} + GIT_COMMIT_SHORT: ${{ needs.release.outputs.short }} + PREFIX: ${{ steps.reg.outputs.prefix }} + SOURCE_URL: ${{ github.server_url }}/${{ github.repository }} + run: | + set -e + if ! ls src/Infra/backend/agent-package/Agent.* >/dev/null 2>&1; then + echo "::warning::No agent package staged - the backend image will ship without an installer." + fi + GIT_COMMIT="$(git rev-parse HEAD)" + BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" + for svc in backend webui; do + docker build -f "src/Infra/${svc}/Dockerfile" \ + --build-arg UNIFIED_VERSION="$VERSION" \ + --build-arg GIT_COMMIT="$GIT_COMMIT" \ + --build-arg GIT_COMMIT_SHORT="$GIT_COMMIT_SHORT" \ + --build-arg BUILD_DATE="$BUILD_DATE" \ + --build-arg SOURCE_URL="$SOURCE_URL" \ + -t "${PREFIX}-${svc}:$VERSION" . + done + + - name: Tag and push + env: + VERSION: ${{ needs.release.outputs.version }} + PREFIX: ${{ steps.reg.outputs.prefix }} + run: | + set -e + for svc in backend webui; do + docker push "${PREFIX}-${svc}:$VERSION" + docker tag "${PREFIX}-${svc}:$VERSION" "${PREFIX}-${svc}:latest" + docker push "${PREFIX}-${svc}:latest" + done + echo "Published ${PREFIX}-backend and ${PREFIX}-webui as $VERSION and latest" -- 2.52.0 From e969a57126ed15ea1352c8d3ba1353e631375978af16a6d2d5630b0d759764c6 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:35:24 -0400 Subject: [PATCH 22/26] test: one version order everywhere, the installer's included AgentVersions: the calendar era before 0.x and 1.x, 1.10 after 1.9, the fourth field (missing = 0), +metadata, 0.0.0.0 and garbage first. The installer's copy (compiled into Shared.Tests) answers exactly like it for every pair, reads the calendar MSIs' yy.MM.minutes back and finds a newer installed release by all four fields. KeepInstallerPackage keeps an MSI under its hash with its name, once, the newest three and the one just installed, and leaves other folders alone. agentVersion rules order by version; the watchdog's version and the catalog's accepted versions. Co-Authored-By: Claude Opus 5.5 --- .../WatchdogVersionTests.cs | 19 ++ .../Backend.Tests/AgentCatalogVersionTests.cs | 24 +++ tests/Shared.Tests/AgentVersionsTests.cs | 166 ++++++++++++++++++ tests/Shared.Tests/KeptPackagesTests.cs | 109 ++++++++++++ tests/Shared.Tests/RuleEvaluatorTests.cs | 20 +++ tests/Shared.Tests/Shared.Tests.csproj | 7 + 6 files changed, 345 insertions(+) create mode 100644 tests/Agent.Watchdog.Tests/WatchdogVersionTests.cs create mode 100644 tests/Backend.Tests/AgentCatalogVersionTests.cs create mode 100644 tests/Shared.Tests/AgentVersionsTests.cs create mode 100644 tests/Shared.Tests/KeptPackagesTests.cs diff --git a/tests/Agent.Watchdog.Tests/WatchdogVersionTests.cs b/tests/Agent.Watchdog.Tests/WatchdogVersionTests.cs new file mode 100644 index 0000000..10fa59d --- /dev/null +++ b/tests/Agent.Watchdog.Tests/WatchdogVersionTests.cs @@ -0,0 +1,19 @@ +using Xunit; + +namespace Agent.Watchdog.Tests; + +public sealed class WatchdogVersionTests +{ + [Theory] + [InlineData("1.4.0+1a2b3c4", "1.4.0")] + [InlineData("1.4.0.7+1a2b3c4.dirty", "1.4.0.7")] + [InlineData("1.4.0", "1.4.0")] + [InlineData("2026.10.10.0140", "2026.10.10.0140")] + [InlineData(null, "0.0.0.0")] + [InlineData("", "0.0.0.0")] + [InlineData("+1a2b3c4", "0.0.0.0")] + public void TheVersionIsTheInformationalVersionBeforeItsMetadata(string? informational, string expected) + { + Assert.Equal(expected, WatchdogVersion.FromInformational(informational)); + } +} diff --git a/tests/Backend.Tests/AgentCatalogVersionTests.cs b/tests/Backend.Tests/AgentCatalogVersionTests.cs new file mode 100644 index 0000000..845dac8 --- /dev/null +++ b/tests/Backend.Tests/AgentCatalogVersionTests.cs @@ -0,0 +1,24 @@ +using Backend.Upgrades; +using Xunit; + +namespace Backend.Tests; + +public sealed class AgentCatalogVersionTests +{ + [Theory] + [InlineData("0.1.0", true)] // semantic versions start at 0.x + [InlineData("0.0.0.253", true)] // a build before the first release tag + [InlineData("1.4.0", true)] + [InlineData("1.4.0.7", true)] + [InlineData("2026.10.10.0140", true)] // the calendar era still catalogues + [InlineData("0.0.0.0", false)] // the development version + [InlineData("1.4.0+1a2b3c4", false)] // metadata never names a catalog version + [InlineData("1.4", false)] + [InlineData("1.4.0-rc.1", false)] + [InlineData(" 1.4.0", false)] + [InlineData(null, false)] + public void CatalogVersions(string? version, bool catalogued) + { + Assert.Equal(catalogued, AgentCatalogService.IsCatalogVersion(version)); + } +} diff --git a/tests/Shared.Tests/AgentVersionsTests.cs b/tests/Shared.Tests/AgentVersionsTests.cs new file mode 100644 index 0000000..11e7b37 --- /dev/null +++ b/tests/Shared.Tests/AgentVersionsTests.cs @@ -0,0 +1,166 @@ +using ExecuteR.Installer.CustomActions; +using Shared.Contracts.Models; +using Xunit; + +namespace Shared.Tests; + +public class AgentVersionsTests +{ + /// Oldest first: every comparison anywhere must keep this order. + private static readonly string[] Ordered = + [ + "2026.08.06.2151", + "2026.08.11.1042", + "2026.10.10.0140", + "0.0.0.1", + "0.1.0", + "0.1.0.3", + "1.0.0", + "1.0.0.1", + "1.0.1", + "1.9.0", + "1.10.0", + "2.0.0", + "255.255.65535.65535", + ]; + + /// Versions that do not parse, and 0.0.0.0, before every version above. + private static readonly string?[] Unparsed = [null, "", " ", "0.0.0.0", "0.0.0", "1.4", "1", "1.4.0.7.1", "1.4.0-rc.1", "v1.4.0", "abc", "1.-1.0"]; + + public static TheoryData AdjacentPairs() + { + var data = new TheoryData(); + for (var i = 1; i < Ordered.Length; i++) + { + data.Add(Ordered[i - 1], Ordered[i]); + } + + return data; + } + + [Theory] + [MemberData(nameof(AdjacentPairs))] + public void VersionsOrderSemanticAfterTheCalendarEra(string older, string newer) + { + Assert.True(AgentVersions.Compare(older, newer) < 0); + Assert.True(AgentVersions.Compare(newer, older) > 0); + Assert.True(AgentVersions.IsNewer(newer, older)); + Assert.False(AgentVersions.IsNewer(older, newer)); + } + + [Fact] + public void SortingIsTheOneOrder() + { + var shuffled = Ordered.Reverse().Concat(Unparsed.Where(u => u is not null).Select(u => u!)).ToList(); + var sorted = shuffled.OrderBy(v => v, AgentVersions.Comparer).ToList(); + Assert.Equal(Ordered, sorted.Skip(sorted.Count - Ordered.Length)); + } + + [Theory] + [InlineData("1.4.0", "1.4.0.0")] + [InlineData("1.4.0+1a2b3c4", "1.4.0")] + [InlineData("1.4.0.7+1a2b3c4.dirty", "1.4.0.7")] + [InlineData(" 1.4.0 ", "1.4.0")] + public void AMissingFourthFieldAndMetadataDoNotCount(string left, string right) + { + Assert.Equal(0, AgentVersions.Compare(left, right)); + Assert.True(AgentVersions.AreSame(left, right)); + } + + [Theory] + [InlineData("0.1.0", true)] + [InlineData("0.0.0.1", true)] + [InlineData("1.4.0", true)] + [InlineData("1.4.0.7", true)] + [InlineData("1.4.0+1a2b3c4", true)] + [InlineData("2026.10.10.0140", true)] + [InlineData("0.0.0.0", false)] + [InlineData("0.0.0", false)] + [InlineData("1.4", false)] + [InlineData("1.4.0-rc.1", false)] + [InlineData("garbage", false)] + [InlineData(null, false)] + public void ValidVersions(string? version, bool valid) => Assert.Equal(valid, AgentVersions.IsValid(version)); + + [Theory] + [InlineData("2026.10.10.0140", true)] + [InlineData("2000.1.1.0", true)] + [InlineData("1999.1.1", false)] + [InlineData("1.4.0", false)] + public void CalendarEra(string version, bool calendar) => Assert.Equal(calendar, AgentVersions.IsCalendarEra(version)); + + [Fact] + public void UnparsedVersionsSortBeforeEveryVersionThenOrdinally() + { + foreach (var unparsed in Unparsed) + { + Assert.True(AgentVersions.Compare(unparsed, Ordered[0]) < 0, $"{unparsed} before {Ordered[0]}"); + Assert.True(AgentVersions.Compare(Ordered[0], unparsed) > 0); + } + + Assert.True(AgentVersions.Compare("abc", "abd") < 0); + Assert.Equal(0, AgentVersions.Compare("0.0.0.0", "0.0.0.0")); + Assert.False(AgentVersions.AreSame("0.0.0.0", "0.0.0.0")); + } + + /// The installer's copy (it runs on .NET Framework) must give exactly the same answers. + [Fact] + public void TheInstallerComparesExactlyLikeAgentVersions() + { + var all = Ordered.Concat(Unparsed).Concat(["1.4.0.0", "1.4.0+x", "1.10.0.3", "2026.10.10.140", "-1.0.0", "1.2.3 "]).ToList(); + foreach (var left in all) + { + foreach (var right in all) + { + Assert.True( + Math.Sign(AgentVersions.Compare(left, right)) == Math.Sign(InstalledRelease.Compare(left, right)), + $"'{left}' vs '{right}': AgentVersions {AgentVersions.Compare(left, right)}, installer {InstalledRelease.Compare(left, right)}"); + } + } + } + + [Theory] + // The calendar era's MSIs: yy.MM.((dd-1)*1440 + HH*60 + mm). + [InlineData("26.10.13060", "2026.10.10.0140")] + [InlineData("26.8.8511", "2026.08.06.2151")] + [InlineData("26.1.0", "2026.01.01.0000")] + [InlineData("26.12.44639", "2026.12.31.2359")] + // Semantic MSIs carry the version itself, in four fields. + [InlineData("1.0.0.0", "1.0.0.0")] + [InlineData("1.4.0.7", "1.4.0.7")] + // Three fields that cannot be a calendar version stay as they are. + [InlineData("26.13.5", "26.13.5")] + [InlineData("1.4.0", "1.4.0")] + [InlineData("26.10.44640", "26.10.44640")] + public void InstalledMsiVersionsReadBack(string msiVersion, string version) + { + Assert.Equal(version, InstalledRelease.FromMsiVersion(msiVersion)); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData("garbage")] + [InlineData("26")] + public void UnreadableMsiVersions(string? msiVersion) => Assert.Null(InstalledRelease.FromMsiVersion(msiVersion)); + + [Theory] + // 1.0.0 replaces any calendar-era install. + [InlineData("1.0.0", new[] { "26.10.13060" }, null)] + [InlineData("0.1.0.4", new[] { "26.10.13060", "26.8.8511" }, null)] + // The same version again reinstalls; an older build is refused, by all four fields. + [InlineData("1.4.0", new[] { "1.4.0.0" }, null)] + [InlineData("1.4.0.7", new[] { "1.4.0.3" }, null)] + [InlineData("1.4.0.3", new[] { "1.4.0.7" }, "1.4.0.7")] + [InlineData("1.4.0", new[] { "1.5.0.0" }, "1.5.0.0")] + [InlineData("1.10.0", new[] { "1.9.0.0" }, null)] + // A calendar-era package cannot go over a semantic install. + [InlineData("2026.10.10.0140", new[] { "1.0.0.0" }, "1.0.0.0")] + // Nothing installed, or nothing readable. + [InlineData("1.0.0", new string[0], null)] + [InlineData("1.0.0", new[] { "garbage" }, null)] + public void ANewerInstalledReleaseIsFound(string incoming, string[] installed, string? newer) + { + Assert.Equal(newer, InstalledRelease.Newer(incoming, installed)); + } +} diff --git a/tests/Shared.Tests/KeptPackagesTests.cs b/tests/Shared.Tests/KeptPackagesTests.cs new file mode 100644 index 0000000..9307050 --- /dev/null +++ b/tests/Shared.Tests/KeptPackagesTests.cs @@ -0,0 +1,109 @@ +using ExecuteR.Installer.CustomActions; +using Shared.Contracts.Models; +using Xunit; + +namespace Shared.Tests; + +/// The installer's KeepInstallerPackage: the MSIs an MSI upgrade rolls back to. +public sealed class KeptPackagesTests : IDisposable +{ + private readonly string temp = Path.Combine(Path.GetTempPath(), $"kept-packages-{Guid.NewGuid():N}"); + private readonly List log = []; + + public KeptPackagesTests() => Directory.CreateDirectory(temp); + + public void Dispose() => Directory.Delete(temp, recursive: true); + + private string Root => Path.Combine(temp, "packages"); + + private string Msi(string name, string content) + { + var folder = Path.Combine(temp, "downloads", Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(folder); + var path = Path.Combine(folder, name); + File.WriteAllText(path, content); + return path; + } + + [Fact] + public void TheLimitIsTheWatchdogs() + { + Assert.Equal(WatchdogFiles.KeptPackagesMax, KeptPackages.Max); + } + + [Fact] + public void AnMsiIsKeptUnderItsHashWithItsName() + { + var source = Msi("ExecuteR-Agent-1.4.0.msi", "1.4.0"); + + var kept = KeptPackages.Keep(source, Root, KeptPackages.Max, log.Add); + + var sha256 = KeptPackages.Sha256(source); + Assert.Equal(Path.Combine(Root, sha256, "ExecuteR-Agent-1.4.0.msi"), kept); + Assert.Equal("1.4.0", File.ReadAllText(kept)); + Assert.Matches("^[0-9a-f]{64}$", sha256); + Assert.Empty(Directory.GetFiles(Path.GetDirectoryName(kept)!, "*.partial")); + } + + [Fact] + public void KeepingTheSameMsiAgainCopiesNothing() + { + var source = Msi("Agent.msi", "1.4.0"); + var kept = KeptPackages.Keep(source, Root, KeptPackages.Max, log.Add); + var written = File.GetLastWriteTimeUtc(kept); + + KeptPackages.Keep(source, Root, KeptPackages.Max, log.Add); + + Assert.Equal(written, File.GetLastWriteTimeUtc(kept)); + Assert.Contains(log, line => line.Contains("already kept")); + Assert.Single(Directory.GetDirectories(Root)); + } + + [Fact] + public void OnlyTheNewestThreeAreKept() + { + var folders = new List(); + for (var i = 1; i <= 4; i++) + { + var kept = KeptPackages.Keep(Msi($"ExecuteR-Agent-1.{i}.0.msi", $"1.{i}.0"), Root, KeptPackages.Max, log.Add); + var folder = Path.GetDirectoryName(kept)!; + folders.Add(folder); + // Installed an hour apart, oldest first. + Directory.SetLastWriteTimeUtc(folder, DateTime.UtcNow.AddHours(i - 10)); + } + + Assert.False(Directory.Exists(folders[0])); + Assert.All(folders.Skip(1), folder => Assert.True(Directory.Exists(folder))); + } + + [Fact] + public void TheMsiJustInstalledStaysEvenWhenOthersLookNewer() + { + var others = new List(); + for (var i = 1; i <= 3; i++) + { + var folder = Path.GetDirectoryName(KeptPackages.Keep(Msi($"Agent-{i}.msi", $"{i}"), Root, KeptPackages.Max, log.Add))!; + Directory.SetLastWriteTimeUtc(folder, DateTime.UtcNow.AddDays(1)); // a clock that was ahead + others.Add(folder); + } + + var current = Path.GetDirectoryName(KeptPackages.Keep(Msi("Agent-0.msi", "0"), Root, KeptPackages.Max, log.Add))!; + + Assert.True(Directory.Exists(current)); + Assert.Equal(3, Directory.GetDirectories(Root).Length); + } + + [Fact] + public void FoldersThatAreNotPackagesAreLeftAlone() + { + var other = Directory.CreateDirectory(Path.Combine(Root, "notes")).FullName; + Directory.SetLastWriteTimeUtc(other, DateTime.UtcNow.AddYears(-1)); + for (var i = 1; i <= 4; i++) + { + KeptPackages.Keep(Msi($"Agent-{i}.msi", $"{i}"), Root, KeptPackages.Max, log.Add); + } + + Assert.True(Directory.Exists(other)); + Assert.Equal(4, Directory.GetDirectories(Root).Length); // three packages and the other folder + } +} diff --git a/tests/Shared.Tests/RuleEvaluatorTests.cs b/tests/Shared.Tests/RuleEvaluatorTests.cs index c4d6947..d5c74f2 100644 --- a/tests/Shared.Tests/RuleEvaluatorTests.cs +++ b/tests/Shared.Tests/RuleEvaluatorTests.cs @@ -68,6 +68,26 @@ public class RuleEvaluatorTests Assert.Equal(expected, RuleEvaluator.Matches(condition, Bag())); } + [Theory] + [InlineData("1.10.0", RuleOperator.GreaterThan, "1.9.0", true)] // not 1.10 < 1.9 as text + [InlineData("1.9.0", RuleOperator.GreaterThan, "1.10.0", false)] + [InlineData("1.4.0.7", RuleOperator.GreaterThan, "1.4.0", true)] // a build after the release + [InlineData("1.4.0", RuleOperator.GreaterOrEqual, "1.4.0.0", true)] // the missing fourth field is 0 + [InlineData("1.4.0", RuleOperator.LessOrEqual, "1.4.0.0", true)] + [InlineData("1.4.0+1a2b3c4", RuleOperator.GreaterOrEqual, "1.4.0", true)] // +metadata ignored + [InlineData("2026.10.10.0140", RuleOperator.LessThan, "1.0.0", true)] // the calendar era before semantic versions + [InlineData("2026.10.10.0140", RuleOperator.LessThan, "0.1.0", true)] + [InlineData("2026.10.10.0140", RuleOperator.GreaterThan, "2026.08.06.2151", true)] + [InlineData("0.0.0.0", RuleOperator.LessThan, "0.1.0", true)] // a development build is lowest + [InlineData("1.4.2", RuleOperator.GreaterOrEqual, "1.4", true)] // 1.4 is the 1.4.0 line + [InlineData("1.3.9", RuleOperator.GreaterOrEqual, "1.4", false)] + [InlineData("2.0.0", RuleOperator.GreaterThan, "1", true)] + public void AgentVersionOrdersByVersion(string agentVersion, RuleOperator op, string value, bool expected) + { + var bag = DeviceFieldBag.Build("c1", "PC-001", DeviceStatus.Online, agentVersion, null, null); + Assert.Equal(expected, RuleEvaluator.Matches(new RuleCondition("agentVersion", op, value), bag)); + } + [Fact] public void NegationInvertsAnyOperator() { diff --git a/tests/Shared.Tests/Shared.Tests.csproj b/tests/Shared.Tests/Shared.Tests.csproj index 8de24b6..b109f17 100644 --- a/tests/Shared.Tests/Shared.Tests.csproj +++ b/tests/Shared.Tests/Shared.Tests.csproj @@ -20,4 +20,11 @@ + + + + + + -- 2.52.0 From 34acc429f6dcd3d694aae9d8e1b338b652e8974d198cadcca1ad57e98f5640d8 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:38:43 -0400 Subject: [PATCH 23/26] style(console): versionSortKey in the formatter's shape Co-Authored-By: Claude Opus 5.5 --- src/WebUI/src/sections/upgrades/agentVersions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/WebUI/src/sections/upgrades/agentVersions.ts b/src/WebUI/src/sections/upgrades/agentVersions.ts index 50f91ed..23820cf 100644 --- a/src/WebUI/src/sections/upgrades/agentVersions.ts +++ b/src/WebUI/src/sections/upgrades/agentVersions.ts @@ -43,7 +43,9 @@ export function compareVersions(left?: string | null, right?: string | null): nu export function versionSortKey(version?: string | null): string | undefined { if (!version) return undefined; const parts = parse(version); - return parts ? `1${parts[0]}${parts.slice(1).map((n) => String(n).padStart(10, '0')).join('')}` : `0${version}`; + if (!parts) return `0${version}`; + const [era, ...numbers] = parts; + return `1${era}${numbers.map((n) => String(n).padStart(10, '0')).join('')}`; } /** Package types an agent on this OS upgrades from (the MSI when the MSI installed it). */ -- 2.52.0 From 413e80327498d4f3be117b943c8ba410c60b6ccb4faf02ffb1f570ab2034487a Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:40:47 -0400 Subject: [PATCH 24/26] build(version): the backend image checks its version and records the commit The build stage copies build/Version.targets, so a handed-in UNIFIED_VERSION is held to the same rules as every other build, and passes GIT_COMMIT_SHORT on, so the image's binary reports X.Y.Z[.N]+ like the packaged one. Without a version it stays 0.0.0.0. Co-Authored-By: Claude Opus 5.5 --- src/Infra/backend/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Infra/backend/Dockerfile b/src/Infra/backend/Dockerfile index 1c4fd60..9c57534 100644 --- a/src/Infra/backend/Dockerfile +++ b/src/Infra/backend/Dockerfile @@ -2,11 +2,15 @@ # Build context is the repository root. FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +# The version (README, Versioning): X.Y.Z for a release, X.Y.Z.N between +# releases; CI passes it. 0.0.0.0, the development version, otherwise (the +# image build has no git to read one from). ARG UNIFIED_VERSION=0.0.0.0 WORKDIR /source # Restore layer: copy only project/props files first for build caching. COPY global.json Directory.Build.props Directory.Packages.props ./ +COPY build/Version.targets build/ COPY src/Shared.Contracts/Shared.Contracts.csproj src/Shared.Contracts/ COPY src/Shared.Infrastructure/Shared.Infrastructure.csproj src/Shared.Infrastructure/ COPY src/Backend/Backend.csproj src/Backend/ @@ -15,8 +19,10 @@ RUN dotnet restore src/Backend/Backend.csproj COPY src/Shared.Contracts/ src/Shared.Contracts/ COPY src/Shared.Infrastructure/ src/Shared.Infrastructure/ COPY src/Backend/ src/Backend/ +# The short commit goes into the informational version (X.Y.Z+). +ARG GIT_COMMIT_SHORT="" RUN dotnet publish src/Backend/Backend.csproj -c Release -o /app --no-restore \ - -p:UnifiedVersion=${UNIFIED_VERSION} + -p:UnifiedVersion=${UNIFIED_VERSION} -p:GitCommitShort=${GIT_COMMIT_SHORT} FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime ARG UNIFIED_VERSION=0.0.0.0 -- 2.52.0 From d6cedf296f2afb450a31f028282567f3f338b4dfb9697eb5ca0851bd1c079eb0 Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:42:30 -0400 Subject: [PATCH 25/26] docs: semantic versioning, releases from conventional commits, seeding README's Versioning section is rewritten: X.Y.Z releases from vX.Y.Z tags, X.Y.Z.N builds, the limits, the one version order, how release.yml decides and publishes a release, how to seed v0.1.0 so the first release is 1.0.0, and how the MSIs upgrade over the calendar era and refuse a newer version (ALLOWDOWNGRADE). The CI section names the new image tags. The design specification's section 48 says semantic versions replace the calendar ones; .env.example and the compose/swarm/k8s comments name the version and tag shapes. Co-Authored-By: Claude Opus 5.5 --- .claude/DesignSpecification.MVP.md | 57 +++++++++++------- .env.example | 4 +- IaC/compose/docker-compose.yml | 2 + IaC/k8s/20-executer.yaml | 3 +- IaC/swarm/README.md | 2 +- README.md | 94 ++++++++++++++++++++++++++---- 6 files changed, 127 insertions(+), 35 deletions(-) diff --git a/.claude/DesignSpecification.MVP.md b/.claude/DesignSpecification.MVP.md index 9938d26..847647a 100644 --- a/.claude/DesignSpecification.MVP.md +++ b/.claude/DesignSpecification.MVP.md @@ -2147,35 +2147,50 @@ Never print token values. # 48. Unified Versioning -All build outputs use: +> Updated: semantic versions replace the calendar versions (`yyyy.MM.dd.HHmm`) +> this section first specified. The README's Versioning section is the +> operator-facing description. + +All build outputs of one build share one version, computed once +(`scripts/Get-Version.ps1`) and passed to every project as the +`UnifiedVersion` MSBuild property: ```text -yyyy.MM.dd.HHmm +X.Y.Z a release, from its git tag vX.Y.Z (1.4.0) +X.Y.Z.N any other build: N commits after release X.Y.Z (1.4.0.7) +0.0.0.N before the first release tag +0.0.0.0 no version handed in and no git (development) ``` -Example: +- Numbers only (no `-dev`/`-rc` labels): every version is a valid assembly, + file and MSI version. Builds fail when major or minor > 255, another field > + 65535, or major >= 2000 (the calendar era). +- Releases are numbered from conventional commits by semantic-release in + dry-run mode (`build/release`, `scripts/Get-NextRelease.ps1`): fix/perf the + patch, feat the minor, `BREAKING CHANGE:` / `type!:` the major; no release + when none of those landed. Our own script tags `vX.Y.Z` and creates the Gitea + release. Calendar-era tags never count (release tags have a 1-3 digit + major); history is seeded with `v0.1.0`, and the switch-over's breaking + change makes the first release 1.0.0. +- One version order everywhere (`AgentVersions`): field by field, missing + fourth field = 0, `+metadata` ignored, calendar era before every semantic + version, `0.0.0.0` and unparseable lowest. Mirrored in the console and the + MSIs' custom action. -```text -2026.08.06.2151 -``` +The same version is embedded into: -Use UTC for CI-generated versions. - -The same version must be embedded into: - -- Agent executable +- Agent and watchdog executables (informational version `X.Y.Z[.N]+`) - Backend assembly -- MSI ProductVersion-compatible mapped version -- Docker image labels -- Docker image tags where allowed +- MSI ProductVersion: the four-field version (`X.Y.Z.0` for a release); each + MSI removes every installed version and a custom action refuses a newer one + (Windows Installer compares only three fields and knows nothing of the + calendar era, whose MSIs carried `yy.MM.minutes`) +- Docker image labels and tags - frontend build metadata - release metadata -Because MSI ProductVersion has constraints, create a deterministic compatible numeric transform while retaining the full unified version in MSI display metadata. - -`Directory.Build.props` should centralize assembly version properties. - -Generate a build metadata source file or MSBuild property once per build, not independently per project. +`Directory.Build.props` centralizes the assembly version properties; a build +not handed a version reads it from git (`build/Version.targets`). --- @@ -2264,7 +2279,9 @@ Behavior: - push: - `` - `latest` -- create Gitea release/tag for unified version if token is available +- when the commits since the last release call for one (§48), release it + instead: build as `X.Y.Z`, create the tag `vX.Y.Z` and the Gitea release if + the token is available, push the images as `X.Y.Z` and `latest` - attach: - Agent executable ZIP - Agent MSI diff --git a/.env.example b/.env.example index 47cbb4c..4584d6e 100644 --- a/.env.example +++ b/.env.example @@ -178,7 +178,9 @@ LOG_MAX_BYTES=10485760 AGENT_PACKAGE_PATH=/data/agent # ── Build / version ──────────────────────────────────────────────────────── -# Set by CI; local builds derive it via scripts/Build.ps1. +# X.Y.Z (a release) or X.Y.Z.N (N commits after it), never yyyy.MM.dd.HHmm. +# Picks the image tag to pull (empty = latest) and stamps a local build; +# CI sets it, scripts/Get-Version.ps1 and deploy.sh derive it from git. UNIFIED_VERSION= # ── Device lifecycle ─────────────────────────────────────────────────────── diff --git a/IaC/compose/docker-compose.yml b/IaC/compose/docker-compose.yml index 7630104..329ae9e 100644 --- a/IaC/compose/docker-compose.yml +++ b/IaC/compose/docker-compose.yml @@ -72,6 +72,8 @@ services: # Published image by default; `build` is the fallback used when the image # is not present locally and cannot be pulled (pull_policy: missing). # scripts/deploy.sh pulls first and builds only if the pull fails. + # Tags: X.Y.Z (a release), latest (newest main), X.Y.Z.N (a main build + # between releases), dev and X.Y.Z.N-dev (other branches). image: '${REGISTRY:-git.example.com/owner}/${BACKEND_IMAGE:-executer-backend}:${BACKEND_VERSION:-${UNIFIED_VERSION:-latest}}' pull_policy: '${IMAGE_PULL_POLICY:-missing}' container_name: EXECUTER-API-00001 diff --git a/IaC/k8s/20-executer.yaml b/IaC/k8s/20-executer.yaml index 77ed1a9..929115c 100644 --- a/IaC/k8s/20-executer.yaml +++ b/IaC/k8s/20-executer.yaml @@ -1,6 +1,7 @@ #============================================================================= # ExecuteR - Kubernetes: backend (API) replicas, scheduler worker, WebUI -# Replace REGISTRY / VERSION before applying (or kustomize the image). +# Replace REGISTRY / VERSION before applying (or kustomize the image); +# VERSION is a release such as 1.4.0 (or latest). #============================================================================= apiVersion: apps/v1 kind: Deployment diff --git a/IaC/swarm/README.md b/IaC/swarm/README.md index 7f0bc87..a3bff1f 100644 --- a/IaC/swarm/README.md +++ b/IaC/swarm/README.md @@ -11,7 +11,7 @@ docker run --rm -v "$PWD/nats:/out" /executer-backend:latest \ nats-auth init --output /out # -> NATS_ACCOUNT_SIGNING_SEED = account-signing.nk, NATS_ACCOUNT_PUBLIC_KEY = account.pub -# 3. Deploy +# 3. Deploy (VERSION: a release such as 1.4.0, or latest) export REGISTRY=... VERSION=... POSTGRES_PASSWORD=... \ NATS_ACCOUNT_SIGNING_SEED=... NATS_ACCOUNT_PUBLIC_KEY=... \ PUBLIC_SERVER_URL=https://control.example.com diff --git a/README.md b/README.md index 902bf8e..22416dc 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,7 @@ Full script-execution, enrollment, and remote-shell sequence diagrams are in # One-time setup: restores packages, installs WebUI deps, generates secrets ./scripts/Initialize-Repository.ps1 -# Build everything with one unified version +# Build everything with one version (from git: 1.4.0.7, see Versioning) ./scripts/Build.ps1 -IncludeWebUI # Run tests @@ -1565,7 +1565,7 @@ version that already failed or rolled back on that device. | ExcludedGroupIds | none | existing groups; nested members are excluded too | | KeepVersions | 5 | 2–50 | -**Device History** shows `agent-upgraded` (`2026.10.20.1200 → 2026.10.23.1400`), +**Device History** shows `agent-upgraded` (`1.4.0 → 1.5.0`), `agent-rolled-back` (an operator's roll back, or the watchdog undoing an upgrade, with its reason) and `agent-upgrade-failed` (with the reason). @@ -1705,11 +1705,14 @@ Gitea Actions workflows live in `.gitea/workflows`: - **Push to `dev`** — build + test, agent binaries for every platform (win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64) + MSI, the standalone server (win-x64 + MSI, linux-x64), backend/webui images tagged - `dev` and `-dev`. All binaries upload as the `binaries` run - artifact. -- **Push to `main`** — the same set, images tagged `` and `latest`, - and a Gitea release with every agent ZIP, both MSIs, the Server ZIPs and - checksums. + `dev` and `-dev` (`X.Y.Z.N-dev`). All binaries upload as the + `binaries` run artifact. +- **Push to `main`** — the same set, images tagged `` (`X.Y.Z.N`) + and `latest`. When the commits since the last release call for one (a fix, + feat or breaking change), `release.yml` releases it instead: every binary as + `X.Y.Z`, the tag `vX.Y.Z`, a Gitea release with the notes, every agent ZIP, + both MSIs, the Server ZIPs and checksums, and the images tagged `X.Y.Z` and + `latest` (see [Versioning](#versioning)). Scripts discover context from optional environment variables and fall back gracefully when run locally: @@ -1726,11 +1729,78 @@ Token values are never printed. `dev` is not merged into `main` automatically. ## Versioning -All artifacts share one unified version, `yyyy.MM.dd.HHmm` (UTC), computed once -per build (`scripts/Get-UnifiedVersion.ps1`) and embedded into the agent, the -backend assembly, Docker image labels/tags, the MSI (via a deterministic -MSI-compatible numeric transform, with the full version retained in display -metadata), and the frontend build metadata. +Semantic versions from git tags. Every artifact of a build shares one version — +the agent, the watchdog, the server, both MSIs, the images and the console +footer — computed once (`scripts/Get-Version.ps1`) and handed to every step. + +| Build | Version | Example | +|---|---|---| +| A release | `X.Y.Z`, from its tag `vX.Y.Z` | `1.4.0` | +| Any other build | `X.Y.Z.N`: N commits after release `X.Y.Z` | `1.4.0.7` | +| Before the first release tag | `0.0.0.N` (commits in the history) | `0.0.0.253` | +| No version handed in and no git | `0.0.0.0`, the development version | | + +Numbers only, no `-dev` or `-rc` labels, so the same version is a valid +assembly, file and MSI version. A build stops when the major or minor is over +255, another field over 65535, or the major is 2000 or more (a calendar +version). Binaries carry `1.4.0.7+1a2b3c4` (the short commit, `.dirty` for a +local build with changes) as their informational version; the version they +report drops the `+…`. + +**One order everywhere.** `AgentVersions` (Shared.Contracts) compares field by +field, a missing fourth field is 0 and `+metadata` is ignored. The calendar-era +versions before 1.0.0 (`2026.10.10.0140`) are older than every semantic +version; `0.0.0.0` and anything unparseable are oldest. The server's catalog +and upgrades, the agent, the watchdog, the console, `agentVersion` group rules +(`>`, `<`; `1.4` means `1.4.0`) and the MSIs all use it. + +**Releases come from conventional commits.** On a push to `main`, +`release.yml` runs semantic-release in dry-run mode +(`scripts/Get-NextRelease.ps1`, pinned in `build/release`) over the commits +since the last release tag: `fix`/`perf` bump the patch, `feat` the minor, a +`BREAKING CHANGE:` footer or `type!:` the major. Only `docs`, `test`, `chore`, +`refactor`, `ci`, `build`… release nothing; CI's `X.Y.Z.N` build stands. When a +release is due, the run builds every binary as `X.Y.Z`, +`scripts/Publish-Release.ps1` tags the commit `vX.Y.Z` and creates the Gitea +release "ExecuteR X.Y.Z" with the generated notes and the artifacts, and the +images are pushed as `X.Y.Z` and `latest`. CI builds that commit as `X.Y.Z` +too (the same dry run) and leaves its images to the release. A re-run of a +released commit publishes the same version again; a version never names a +second commit. + +```powershell +./scripts/Get-Version.ps1 # this tree: 1.4.0.7 +./scripts/Get-Version.ps1 -Format FileVersion # four fields: 1.4.0.7, or 1.4.0.0 for 1.4.0 +./scripts/Get-NextRelease.ps1 # what main would release now (main, node) +./scripts/tests/Test-Versioning.ps1 # the rules and the numbering, in a scratch repository +``` + +**Seeding (once).** The calendar tags (`v2026.10.10.0140`) never count: release +tags have a 1–3 digit major. Before the first semantic release: + +1. Tag the last calendar-era release commit on `main` `v0.1.0` and push the + tag (`git tag v0.1.0 `, `git push origin v0.1.0`). +2. The switch-over commit (`build(version)!: semantic versions from release + tags`) carries `BREAKING CHANGE:`, so the first release after the seed is + **1.0.0** (semantic-release takes 0.x plus a breaking change to 1.0.0). If + the change is squash-merged, keep the footer in the squashed message. + +Until the seed tag exists, builds are `0.0.0.N`, release runs refuse ("No +release tag … is reachable") and CI warns. Seed before images built this way +reach a server: `0.0.0.N` already sorts after every calendar version. + +**MSIs.** The ProductVersion is the four-field version (`1.4.0.0` for 1.4.0, +`1.4.0.7` between releases); Programs and Features shows it, the comments show +`ExecuteR Agent 1.4.0`. Windows Installer compares only three fields and the +calendar-era MSIs carry `26.x`, so each MSI removes every installed version and +its `FindNewerRelease` custom action first refuses a newer one, all four fields +and the era considered: *A newer version of ExecuteR Agent, 1.5.0.0, is already +installed.* `ALLOWDOWNGRADE=1` installs an older version deliberately (an MSI +upgrade's rollback passes it); credentials and data stay either way. Upgrades +and repairs lay every file down (`REINSTALLMODE=amus`), because calendar-era +binaries carry file versions `2026.x`. The agent MSI keeps a copy of itself +under `%ProgramData%\ExecuteR\packages\\` (the 3 most recently +installed, writable only by SYSTEM and Administrators) for that rollback. --- -- 2.52.0 From 98f2a6f7a58dac77db14c9063fd82ecfb217d8fea248eaeb6e32c467213fe89d Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 23 Oct 2026 20:51:33 -0400 Subject: [PATCH 26/26] feat(installer): a kept MSI carries package.json, as the agent writes it KeepInstallerPackage now gets the package's full version ([UNIFIEDVERSION]) and writes package.json ({"version","sha256"}, camelCase) beside the copy, under a temporary name and renamed, so the agent finds a kept MSI's version without opening it. The copy keeps the original file name (ExecuteR-Agent-.msi). UNIFIEDVERSION stays the version the agent reports: the agent's MSI upgrades read it from the MSI. Co-Authored-By: Claude Opus 5.5 --- src/Installer.CustomActions/KeptPackages.cs | 59 +++++++++++++++++-- src/Installer.CustomActions/UpgradeActions.cs | 8 ++- src/Installer/Product.wxs | 10 +++- tests/Shared.Tests/KeptPackagesTests.cs | 43 +++++++++++--- 4 files changed, 103 insertions(+), 17 deletions(-) diff --git a/src/Installer.CustomActions/KeptPackages.cs b/src/Installer.CustomActions/KeptPackages.cs index 22c5b76..663ee3b 100644 --- a/src/Installer.CustomActions/KeptPackages.cs +++ b/src/Installer.CustomActions/KeptPackages.cs @@ -12,14 +12,19 @@ public static class KeptPackages /// WatchdogFiles.KeptPackagesMax. public const int Max = 3; + /// The description beside each kept MSI, as the agent writes it: { "version", "sha256" }. + public const string DescriptionFile = "package.json"; + /// /// Copies to <root>\<sha256>\<its file name> - /// (unless that copy is already there whole), marks its folder as the newest, - /// and removes the package folders beyond the newest . - /// Returns the kept file's path. Throws on failure; the caller decides what a - /// failure means (the installer logs it and goes on). + /// (unless that copy is already there whole), writes + /// beside it with (the package's full version) and + /// the hash, marks its folder as the newest, and removes the package folders + /// beyond the newest . Returns the kept file's path. + /// Throws on failure; the caller decides what a failure means (the installer + /// logs it and goes on). /// - public static string Keep(string source, string root, int max, System.Action log) + public static string Keep(string source, string? version, string root, int max, System.Action log) { var sha256 = Sha256(source); var folder = System.IO.Path.Combine(root, sha256); @@ -44,6 +49,20 @@ public static class KeptPackages log($"Kept {source} as {target}."); } + if (!string.IsNullOrWhiteSpace(version)) + { + // The same temporary-name-and-rename, so the agent never reads half a description. + var description = System.IO.Path.Combine(folder, DescriptionFile); + var partial = description + ".partial"; + System.IO.File.WriteAllText(partial, Description(version!.Trim(), sha256), new System.Text.UTF8Encoding(false)); + if (System.IO.File.Exists(description)) + { + System.IO.File.Delete(description); + } + + System.IO.File.Move(partial, description); + } + System.IO.Directory.SetLastWriteTimeUtc(folder, System.DateTime.UtcNow); Prune(root, sha256, max, log); return target; @@ -83,6 +102,36 @@ public static class KeptPackages } } + /// {"version":"1.4.0","sha256":"…"} (camelCase, as the agent reads it). + public static string Description(string version, string sha256) + => "{\"version\":" + JsonString(version) + ",\"sha256\":" + JsonString(sha256) + "}"; + + private static string JsonString(string value) + { + var text = new System.Text.StringBuilder(value.Length + 2).Append('"'); + foreach (var c in value) + { + switch (c) + { + case '"': text.Append("\\\""); break; + case '\\': text.Append("\\\\"); break; + default: + if (c < ' ') + { + text.Append("\\u").Append(((int)c).ToString("x4", System.Globalization.CultureInfo.InvariantCulture)); + } + else + { + text.Append(c); + } + + break; + } + } + + return text.Append('"').ToString(); + } + public static string Sha256(string path) { using var stream = System.IO.File.OpenRead(path); diff --git a/src/Installer.CustomActions/UpgradeActions.cs b/src/Installer.CustomActions/UpgradeActions.cs index c3463ae..e7f646a 100644 --- a/src/Installer.CustomActions/UpgradeActions.cs +++ b/src/Installer.CustomActions/UpgradeActions.cs @@ -43,7 +43,9 @@ public static class UpgradeActions /// /// Deferred, as SYSTEM, after InstallFiles on an install or upgrade (agent MSI /// only). Copies the MSI being installed (Source = [OriginalDatabase]) - /// to Destination\<sha256>\<file name> and keeps the newest + /// to Destination\<sha256>\<file name> (the original name, e.g. + /// ExecuteR-Agent-1.4.0.msi), writes package.json ({ version, sha256 }, + /// Version = [UNIFIEDVERSION]) beside it and keeps the newest /// , so an MSI upgrade can roll back to it. /// Never fails the install: a copy that cannot be made is logged. /// @@ -61,8 +63,10 @@ public static class UpgradeActions return ActionResult.Success; } + // The full version the agent reports (UNIFIEDVERSION), for package.json. + data.TryGetValue("Version", out var version); ProtectFolder(destination); - KeptPackages.Keep(source, destination, KeptPackages.Max, message => session.Log($"KeepInstallerPackage: {message}")); + KeptPackages.Keep(source, version, destination, KeptPackages.Max, message => session.Log($"KeepInstallerPackage: {message}")); } catch (Exception exception) { diff --git a/src/Installer/Product.wxs b/src/Installer/Product.wxs index 64db055..498974e 100644 --- a/src/Installer/Product.wxs +++ b/src/Installer/Product.wxs @@ -46,7 +46,10 @@ - + @@ -65,9 +68,10 @@ Condition="REINSTALL OR WIX_UPGRADE_DETECTED" /> + %ProgramData%\ExecuteR\packages\\ with a + package.json { version, sha256 } beside it (the newest 3). --> line.Contains("already kept")); @@ -65,7 +94,7 @@ public sealed class KeptPackagesTests : IDisposable var folders = new List(); for (var i = 1; i <= 4; i++) { - var kept = KeptPackages.Keep(Msi($"ExecuteR-Agent-1.{i}.0.msi", $"1.{i}.0"), Root, KeptPackages.Max, log.Add); + var kept = KeptPackages.Keep(Msi($"ExecuteR-Agent-1.{i}.0.msi", $"1.{i}.0"), "1.4.0", Root, KeptPackages.Max, log.Add); var folder = Path.GetDirectoryName(kept)!; folders.Add(folder); // Installed an hour apart, oldest first. @@ -82,12 +111,12 @@ public sealed class KeptPackagesTests : IDisposable var others = new List(); for (var i = 1; i <= 3; i++) { - var folder = Path.GetDirectoryName(KeptPackages.Keep(Msi($"Agent-{i}.msi", $"{i}"), Root, KeptPackages.Max, log.Add))!; + var folder = Path.GetDirectoryName(KeptPackages.Keep(Msi($"Agent-{i}.msi", $"{i}"), "1.4.0", Root, KeptPackages.Max, log.Add))!; Directory.SetLastWriteTimeUtc(folder, DateTime.UtcNow.AddDays(1)); // a clock that was ahead others.Add(folder); } - var current = Path.GetDirectoryName(KeptPackages.Keep(Msi("Agent-0.msi", "0"), Root, KeptPackages.Max, log.Add))!; + var current = Path.GetDirectoryName(KeptPackages.Keep(Msi("Agent-0.msi", "0"), "1.4.0", Root, KeptPackages.Max, log.Add))!; Assert.True(Directory.Exists(current)); Assert.Equal(3, Directory.GetDirectories(Root).Length); @@ -100,7 +129,7 @@ public sealed class KeptPackagesTests : IDisposable Directory.SetLastWriteTimeUtc(other, DateTime.UtcNow.AddYears(-1)); for (var i = 1; i <= 4; i++) { - KeptPackages.Keep(Msi($"Agent-{i}.msi", $"{i}"), Root, KeptPackages.Max, log.Add); + KeptPackages.Keep(Msi($"Agent-{i}.msi", $"{i}"), "1.4.0", Root, KeptPackages.Max, log.Add); } Assert.True(Directory.Exists(other)); -- 2.52.0