| 1 | namespace CascadeIDE.Services; |
| 2 | |
| 3 | /// <summary>Каноническое представление брейкпоинта в IDE debug snapshot.</summary> |
| 4 | public readonly record struct DebugBreakpointSnapshot(string File, int Line, string? Condition); |
| 5 | |
| 6 | /// <summary>Корневые переменные одного DAP-scope (Locals, Closures, …), без рекурсивного раскрытия.</summary> |
| 7 | public readonly record struct DebugVariableRootScope(string ScopeName, IReadOnlyList<DebugVariableRow> Roots); |
| 8 | |
| 9 | /// <summary>Одна переменная в снимке; дети подгружаются по <see cref="VariablesReference"/> в UI.</summary> |
| 10 | public readonly record struct DebugVariableRow( |
| 11 | string Name, |
| 12 | string Value, |
| 13 | string? Type, |
| 14 | int VariablesReference = 0, |
| 15 | int? NamedVariables = null, |
| 16 | int? IndexedVariables = null); |
| 17 | |
| 18 | /// <summary> |
| 19 | /// Единый in-process снимок отладки (ADR 0002): DAP сессия обновляет его; UI, omni, MCP read tools читают одну модель. |
| 20 | /// </summary> |
| 21 | public readonly record struct DebugSessionSnapshot( |
| 22 | bool HasActiveSession, |
| 23 | bool IsExecutionStopped, |
| 24 | string? StoppedFile, |
| 25 | int StoppedLine, |
| 26 | string? ExceptionText, |
| 27 | IReadOnlyList<DebugBreakpointSnapshot> Breakpoints, |
| 28 | IReadOnlyList<(string Name, string? File, int Line)> StackFrames, |
| 29 | IReadOnlyList<DebugVariableRootScope> VariableRootScopes, |
| 30 | int VariablesFrameIndex) |
| 31 | { |
| 32 | public static DebugSessionSnapshot Empty { get; } = new( |
| 33 | HasActiveSession: false, |
| 34 | IsExecutionStopped: false, |
| 35 | StoppedFile: null, |
| 36 | StoppedLine: 0, |
| 37 | ExceptionText: null, |
| 38 | Breakpoints: Array.Empty<DebugBreakpointSnapshot>(), |
| 39 | StackFrames: Array.Empty<(string Name, string? File, int Line)>(), |
| 40 | VariableRootScopes: Array.Empty<DebugVariableRootScope>(), |
| 41 | VariablesFrameIndex: 0); |
| 42 | } |
| 43 | |