namespace Launcher.Next.Core; public enum LauncherMode { Legacy, DryRun, NextPilot, NextPreferred } public enum PluginExecutionMode { Smoke, DryRun, Apply } public sealed record ProductInstallation(string ExecutablePath, string ProductVersion, string Architecture, IReadOnlyList Profiles); public sealed record PackageFile(string Path, long Length, string Sha256, bool Optional = false); public sealed record StartupDefinition(string Type, string Command); public sealed record PackageManifest( int SchemaVersion, string PackageId, string Version, string Product, int ProductYear, string Architecture, string EntryAssembly, IReadOnlyList Files, StartupDefinition Startup, string? MinimumLauncherVersion = null, IReadOnlyList? CompatibleAutoCadSeries = null, string? RequiredRuntime = null, IReadOnlyList? Dependencies = null, IReadOnlyList? OptionalResources = null, string? RolloutChannel = null, bool Disabled = false, bool RollbackSafe = false, string? ReleaseNotesReference = null); public sealed record ValidationIssue(string Code, string Message); public sealed record ValidationResult(IReadOnlyList Issues) { public bool IsValid => Issues.Count == 0; public static ValidationResult Success { get; } = new([]); } public sealed record PackageProgress(string Stage, int Completed, int Total); public sealed record ActivationResult(string CurrentVersion, string? PreviousVersion); public sealed record PackagePayloadBinding(string RelativePath,long Length,string Sha256); public sealed record PackageActivationReceipt(string OperationId, string PackageId, string Version, string? PreviousVersion, DateTimeOffset ActivatedUtc, long PointerGeneration = 0, string? ActiveRootIdentity = null, int SchemaVersion = 2, string? ManifestSha256 = null, string? PayloadSetSha256 = null, string? RosterIdentity = null, IReadOnlyList? PayloadFiles = null, long PointerGenerationBefore = 0, string? EvidenceCorrelationId = null); public sealed record PackageActivationResult(string Outcome, PackageActivationReceipt? Receipt); public sealed record PackageRollbackResult(string Outcome, string? CurrentVersion); public sealed record ImmutableLocalPackage(string PackageId, string Version, string LocalPackageRoot); public sealed record PackageStagingOwnership(string OperationId, string PackageId, string Version, string StagingDirectory, DateTimeOffset CreatedUtc, string MarkerIdentity); public sealed record PackageStagingCleanupResult(string Outcome, string OperationId); public enum PackageLifecycleFaultPoint { AfterStagingAllocated, DuringPayloadCopy, AfterPayloadCopyBeforeValidation, BeforeImmutableCommit, AfterImmutableCommitBeforeReturn, BeforePointerTempWrite, BeforePointerReplace, BeforePointerReadback, BeforeRollbackReplace, BeforeRollbackReadback, DuringOwnedStagingCleanup } public interface IPackageLifecycleFaultInjector { void ThrowIfRequested(PackageLifecycleFaultPoint point); } public sealed class NoOpPackageLifecycleFaultInjector : IPackageLifecycleFaultInjector { public void ThrowIfRequested(PackageLifecycleFaultPoint point) { } } public interface IPackageMaterializer { Task MaterializeAsync(PackageManifest manifest, string sourceRoot, CancellationToken cancellationToken, IProgress? progress = null); } public sealed record PackageRequirement(string PackageId, string Product, int ProductYear, string Architecture, string Channel, string RequiredVersion, string RosterIdentity, bool AllowOfflineFallback); public sealed record CatalogPackage(PackageManifest Manifest, string SourceRoot); public sealed record PackageResolutionEvidence(string Code, string Detail); public sealed record PackageResolutionResult(CachedPackageResolution? Selected, bool Online, IReadOnlyList Evidence) { public bool IsResolved => Selected is not null; } public sealed record LaunchRequest(ProductInstallation Product, string Profile, string StartupScriptPath, bool DryRun); public sealed record PreparedLaunch(string Executable, IReadOnlyList Arguments, string WorkingDirectory, bool WouldStart); public interface IProductDiscovery { ProductInstallation? DiscoverPlant3D(int year); } public interface IPackageCatalogClient { Task GetManifestAsync(string packageId, CancellationToken cancellationToken); } public interface IPackageCatalogPackageAcquirer { Task AcquireAsync(PackageRequirement requirement, CancellationToken cancellationToken); } public interface IPackageManifestValidator { ValidationResult Validate(PackageManifest manifest, int productYear, string architecture); } public interface IPackageSynchronizer { Task SynchronizeAsync(PackageManifest manifest, string sourceRoot, CancellationToken cancellationToken, IProgress? progress = null); } public interface ILocalPackageStore { Task GetCurrentVersionAsync(string packageId, CancellationToken cancellationToken); Task GetPreviousVersionAsync(string packageId, CancellationToken cancellationToken); } public interface IPackageActivator { Task ActivateAsync(string packageId, string version, CancellationToken cancellationToken); } public interface IRollbackManager { Task RollbackAsync(string packageId, CancellationToken cancellationToken); } public sealed record CachedPackageResolution(string PackageId, string Version, string LocalPackageRoot, bool IsOfflineFallback, string Reason); public interface ILastKnownGoodPackageResolver { Task ResolveAsync(PackageRequirement requirement, CancellationToken cancellationToken); } public interface IPackageRequirementCacheBinder { Task BindAsync(PackageRequirement requirement, string version, CancellationToken cancellationToken); } public interface IAutodeskProcessLauncher { PreparedLaunch Prepare(LaunchRequest request); } public sealed record ResolvedAutomationScriptPaths(string ValidatedPackageRoot, string EntryAssembly, string FixtureOrthoDwg, string FixtureModelDwg, string AutomationScriptPath, bool Diagnostic, bool Apply); public interface IStartupScriptBuilder { string BuildNetloadScript(string validatedPackageRoot, string entryAssembly); string BuildAutomationScript(ResolvedAutomationScriptPaths paths); } public interface ILauncherConfigurationProvider { LauncherMode GetMode(); } public interface ILauncherTelemetry { void Write(string eventType, IReadOnlyDictionary? fields = null); } public interface IClock { DateTimeOffset UtcNow { get; } } public interface IFileHasher { Task Sha256Async(string path, CancellationToken cancellationToken); }