csharpdeeb25a2 | 1 | using CascadeIDE.Cockpit.DataBus; |
| 2 | |
| 3 | namespace CascadeIDE.Features.Agent.Environment; |
| 4 | |
| 5 | /// <summary>AEE ↔ solution warm-up (ADR 0148 W5): отмена verify при смене scope.</summary> |
| 6 | public sealed class AgentEnvironmentWarmupBridge : IDisposable |
| 7 | { |
| 8 | private readonly IAgentEnvironmentService _environment; |
| 9 | private readonly IDisposable _subscription; |
| 10 | |
| 11 | public AgentEnvironmentWarmupBridge(IDataBus dataBus, IAgentEnvironmentService environment) |
| 12 | { |
| 13 | _environment = environment; |
| 14 | _subscription = dataBus.Subscribe<SolutionWarmupStateChanged>(OnWarmupChanged); |
| 15 | } |
| 16 | |
| 17 | private void OnWarmupChanged(SolutionWarmupStateChanged evt) |
| 18 | { |
| 19 | if (evt.Lifecycle == SolutionWarmupLifecycle.Cancelled) |
| 20 | { |
| 21 | _environment.CancelActive(); |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | var status = _environment.GetStatus(); |
| 26 | if (!status.IsActive || string.IsNullOrWhiteSpace(evt.SolutionPath)) |
| 27 | return; |
| 28 | |
| 29 | if (status.SolutionPath is not null |
| 30 | && !string.Equals(status.SolutionPath, evt.SolutionPath, StringComparison.OrdinalIgnoreCase)) |
| 31 | _environment.CancelActive(); |
| 32 | } |
| 33 | |
| 34 | public void Dispose() => _subscription.Dispose(); |
| 35 | } |
| 36 | |
View only · write via MCP/CIDE