Forge
csharpdeeb25a2
1#nullable enable
2using CascadeIDE.Models.AgentChat;
3using CascadeIDE.Models.Intercom;
4
5namespace CascadeIDE.Features.Chat;
6
7/// <summary>Канонический input для chat surface pipeline: сообщения, active thread и текущее состояние уточнений.</summary>
8public sealed record ChatSurfaceIntent(
9 IReadOnlyList<ChatConversationMessage> Messages,
10 ClarificationBatch? ActiveClarificationBatch,
11 int SelectedMessageIndex,
12 Guid MainThreadId,
13 Guid ActiveThreadId,
14 string? ThreadBranchHint,
15 ChatProductSpine? ProductSpine = null,
16 IReadOnlyList<ChatSedmTimelineEntry>? SedmTimelineEntries = null,
17 IReadOnlyDictionary<Guid, string>? ThreadDisplayTitles = null,
18 IReadOnlyList<ChatThreadForkRecord>? ThreadForks = null,
19 TopicPickerPresentation TopicPicker = TopicPickerPresentation.None,
20 IReadOnlySet<int>? HighlightedMessageIndices = null);
21
22/// <summary>Плоское представление сообщения, отвязанное от UI-observable состояния.</summary>
23public sealed record ChatConversationMessage(
24 Guid MessageId,
25 string Role,
26 string Content,
27 Guid ThreadId,
28 Guid? ParentMessageId,
29 int MessageIndex,
30 string? SlashCommandPath = null,
31 string? SlashCommandArgs = null,
32 ChatSlashCommandStatus? SlashCommandStatus = null,
33 IReadOnlyList<AttachmentAnchor>? Attachments = null,
34 IntercomMessageAudience Audience = IntercomMessageAudience.Channel);
35
36public sealed record ChatThreadNode(
37 Guid ThreadId,
38 string NodeId,
39 string Title,
40 bool IsMainThread,
41 bool IsActive,
42 Guid? ParentThreadId,
43 Guid? ForkedFromMessageId,
44 int Depth,
45 int Order);
46
47public sealed record ChatMessageNode(
48 Guid MessageId,
49 string NodeId,
50 Guid ThreadId,
51 Guid? ParentMessageId,
52 int MessageIndex,
53 string Role,
54 string Content,
55 bool IsSelected,
56 bool StartsBranch,
57 string? SlashCommandPath = null,
58 string? SlashCommandArgs = null,
59 ChatSlashCommandStatus? SlashCommandStatus = null,
60 IReadOnlyList<AttachmentAnchor>? Attachments = null,
61 IntercomMessageAudience Audience = IntercomMessageAudience.Channel);
62
63public sealed record ChatConfirmationNode(
64 string NodeId,
65 Guid ThreadId,
66 Guid BatchId,
67 string Title,
68 string Body,
69 int ItemCount,
70 bool IsActive,
71 bool IsResolved);
72
73public sealed record ChatDecisionEdge(
74 string FromNodeId,
75 string ToNodeId,
76 string Kind);
77
78public enum ChatSurfaceEntryKind
79{
80 Message = 0,
81 Confirmation = 1,
82 SedmCard = 2,
83}
84
85public sealed record ChatSurfaceEntry(
86 ChatSurfaceEntryKind Kind,
87 string NodeId,
88 string Title,
89 string Body,
90 ChatMessageVisualRole VisualRole,
91 int Order,
92 int? MessageIndex = null,
93 bool IsSelected = false,
94 bool IsPending = false,
95 bool StartsBranch = false,
96 string? SlashCommandPath = null,
97 string? SlashCommandArgs = null,
98 ChatSlashCommandStatus? SlashCommandStatus = null,
99 IReadOnlyList<AttachmentAnchor>? Attachments = null,
100 IntercomMessageAudience Audience = IntercomMessageAudience.Channel);
101
102public sealed record ChatThreadOverviewItem(
103 Guid ThreadId,
104 string Title,
105 string Summary,
106 bool IsActive,
107 bool IsMainThread,
108 int Depth,
109 int ItemCount);
110
111public sealed record ChatSurfaceLane(
112 ChatThreadNode Thread,
113 IReadOnlyList<ChatSurfaceEntry> Entries);
114
115public sealed record ChatSurfaceLayout(
116 IReadOnlyList<ChatThreadOverviewItem> Overview,
117 IReadOnlyList<ChatSurfaceLane> Lanes);
118
119public sealed record ChatSurfaceState(
120 IReadOnlyList<ChatThreadNode> Threads,
121 IReadOnlyList<ChatMessageNode> Messages,
122 IReadOnlyList<ChatConfirmationNode> Confirmations,
123 IReadOnlyList<ChatDecisionEdge> Edges,
124 Guid ActiveThreadId,
125 string ActiveThreadLabel);
126
127public sealed record ChatSurfaceSnapshot(
128 ChatSurfaceState State,
129 ChatSurfaceLayout Layout,
130 ChatProductSpine ProductSpine,
131 ChatSedmScopeStrip SedmScopeStrip = default,
132 TopicPickerPresentation TopicPicker = TopicPickerPresentation.None,
133 IReadOnlySet<int>? HighlightedMessageIndices = null)
134{
135 public static ChatSurfaceSnapshot Empty { get; } = new(
136 new ChatSurfaceState([], [], [], [], Guid.Empty, "Chat"),
137 new ChatSurfaceLayout([], []),
138 ChatProductSpine.Empty,
139 ChatSedmScopeStrip.Empty);
140}
141
View only · write via MCP/CIDE