namespace NucleicBroker; /// /// The facade used when Microsoft.WSL.Containers isn't compiled in (any non-Windows build, /// or a build without -p:UseWslc=true): every operation fails with a structured /// `wslc_unavailable` error so hostd sees a clean capability gap, never a crash. The `hello` /// exchange reports `wslcVersion: null`, which is the real capability signal. /// public sealed class UnavailableWslc : IWslc { public string? WslcVersion => null; /// Nothing bound, so nothing is capable — the empty list IS the capability report. public IReadOnlyList Capabilities => []; public void SetEvents(IBrokerEvents events) { } private static WslcError Unavailable() => new(WslcError.Unavailable, "Microsoft.WSL.Containers is not available in this broker build"); public Task> MissingComponentsAsync(CancellationToken ct) => Task.FromException>(Unavailable()); public Task InstallComponentsAsync(CancellationToken ct) => Task.FromException(Unavailable()); public Task EnsureSessionAsync(SessionSpec spec, CancellationToken ct) => Task.FromException(Unavailable()); public Task TerminateSessionAsync(CancellationToken ct) => Task.FromException(Unavailable()); public Task PullImageAsync(string reference, RegistryAuth? auth, CancellationToken ct) => Task.FromException(Unavailable()); public Task> ListImagesAsync(CancellationToken ct) => Task.FromException>(Unavailable()); public Task DeleteImageAsync(string reference, CancellationToken ct) => Task.FromException(Unavailable()); public Task InspectImageAsync(string reference, CancellationToken ct) => Task.FromException(Unavailable()); public Task CreateContainerAsync(ContainerCreateSpec spec, CancellationToken ct) => Task.FromException(Unavailable()); public Task StartContainerAsync(string name, CancellationToken ct) => Task.FromException(Unavailable()); public Task StopContainerAsync(string name, int signal, int graceMs, CancellationToken ct) => Task.FromException(Unavailable()); public Task DeleteContainerAsync(string name, bool force, CancellationToken ct) => Task.FromException(Unavailable()); public Task> ListContainersAsync(CancellationToken ct) => Task.FromException>(Unavailable()); public Task ContainerStateAsync(string name, CancellationToken ct) => Task.FromException(Unavailable()); public Task ContainerStatsAsync(string name, CancellationToken ct) => Task.FromException(Unavailable()); public Task ExecAsync(long procId, ProcSpec spec, CancellationToken ct) => Task.FromException(Unavailable()); }