Add launcher coordinator IPC and startup reservation

Introduce a launcher coordinator to reserve startup ownership and prevent duplicate host launches. Adds a NamedPipe-based IPC server/client (LauncherCoordinatorIpcServer/Client), coordinator messages/models, and PublicShellStatus/activation types for richer shell reporting. Enhances StartupAttemptRecord and StartupAttemptRegistry to track coordinator pid/pipe, heartbeat, reserved-before-host-start, and public IPC status, plus new reservation/heartbeat APIs and takeover logic. Wire coordinator into App and LauncherFlowCoordinator to attach secondary launchers, publish coordinator status, probe existing hosts, and include more detailed launch result details. Also adds unit tests and docs describing coordinator and startup visuals behavior.
This commit is contained in:
lincube
2026-04-23 09:45:05 +08:00
parent 33591a0a63
commit 927dc8d1fd
19 changed files with 1637 additions and 23 deletions

View File

@@ -5,8 +5,16 @@ namespace LanMountainDesktop.Shared.IPC.Abstractions.Services;
[IpcPublic(IgnoresIpcException = true)]
public interface IPublicShellControlService
{
Task<PublicShellStatus> GetShellStatusAsync();
Task<bool> ActivateMainWindowAsync();
Task<PublicShellActivationResult> ActivateMainWindowWithStatusAsync();
Task<PublicTrayStatus> EnsureTrayReadyAsync();
Task<PublicTaskbarStatus> EnsureTaskbarEntryAsync();
Task<bool> OpenSettingsAsync(string? pageTag = null);
Task<bool> RestartAsync();

View File

@@ -0,0 +1,36 @@
namespace LanMountainDesktop.Shared.IPC.Abstractions.Services;
public sealed record PublicShellStatus(
int ProcessId,
DateTimeOffset StartedAtUtc,
string LaunchSource,
string ShellState,
bool MainWindowCreated,
bool MainWindowVisible,
bool MainWindowOpened,
bool DesktopVisible,
bool PublicIpcReady,
PublicTrayStatus Tray,
PublicTaskbarStatus Taskbar);
public sealed record PublicTrayStatus(
string State,
bool IsReady,
bool HasIcon,
bool HasMenu,
bool IsVisible,
int ConsecutiveRecoveryFailures);
public sealed record PublicTaskbarStatus(
bool RequestedBySettings,
bool MainWindowExists,
bool MainWindowShowInTaskbar,
bool MainWindowVisible,
bool MainWindowMinimized,
bool IsUsable);
public sealed record PublicShellActivationResult(
bool Accepted,
string Code,
string Message,
PublicShellStatus Status);