Skip to content

Commit f902b76

Browse files
authored
chore: Update generated events to match schemas. (#208)
* Improve csharp handling of schemas * Update generated session events. * fix: remove unused variable in C# generator loop
1 parent 19a1d09 commit f902b76

File tree

6 files changed

+491
-51
lines changed

6 files changed

+491
-51
lines changed

dotnet/src/Generated/SessionEvents.cs

Lines changed: 116 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// Generated from: @github/copilot/session-events.schema.json
88
// Generated by: scripts/generate-session-types.ts
9-
// Generated at: 2026-01-22T14:30:57.371Z
9+
// Generated at: 2026-01-26T18:08:34.014Z
1010
//
1111
// To update these types:
1212
// 1. Update the schema in copilot-agent-runtime
@@ -43,6 +43,7 @@ namespace GitHub.Copilot.SDK;
4343
[JsonDerivedType(typeof(SessionInfoEvent), "session.info")]
4444
[JsonDerivedType(typeof(SessionModelChangeEvent), "session.model_change")]
4545
[JsonDerivedType(typeof(SessionResumeEvent), "session.resume")]
46+
[JsonDerivedType(typeof(SessionSnapshotRewindEvent), "session.snapshot_rewind")]
4647
[JsonDerivedType(typeof(SessionStartEvent), "session.start")]
4748
[JsonDerivedType(typeof(SessionTruncationEvent), "session.truncation")]
4849
[JsonDerivedType(typeof(SessionUsageInfoEvent), "session.usage_info")]
@@ -181,6 +182,18 @@ public partial class SessionTruncationEvent : SessionEvent
181182
public required SessionTruncationData Data { get; set; }
182183
}
183184

185+
/// <summary>
186+
/// Event: session.snapshot_rewind
187+
/// </summary>
188+
public partial class SessionSnapshotRewindEvent : SessionEvent
189+
{
190+
[JsonIgnore]
191+
public override string Type => "session.snapshot_rewind";
192+
193+
[JsonPropertyName("data")]
194+
public required SessionSnapshotRewindData Data { get; set; }
195+
}
196+
184197
/// <summary>
185198
/// Event: session.usage_info
186199
/// </summary>
@@ -620,6 +633,15 @@ public partial class SessionTruncationData
620633
public required string PerformedBy { get; set; }
621634
}
622635

636+
public partial class SessionSnapshotRewindData
637+
{
638+
[JsonPropertyName("upToEventId")]
639+
public required string UpToEventId { get; set; }
640+
641+
[JsonPropertyName("eventsRemoved")]
642+
public required double EventsRemoved { get; set; }
643+
}
644+
623645
public partial class SessionUsageInfoData
624646
{
625647
[JsonPropertyName("tokenLimit")]
@@ -844,6 +866,14 @@ public partial class ToolExecutionStartData
844866
[JsonPropertyName("arguments")]
845867
public object? Arguments { get; set; }
846868

869+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
870+
[JsonPropertyName("mcpServerName")]
871+
public string? McpServerName { get; set; }
872+
873+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
874+
[JsonPropertyName("mcpToolName")]
875+
public string? McpToolName { get; set; }
876+
847877
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
848878
[JsonPropertyName("parentToolCallId")]
849879
public string? ParentToolCallId { get; set; }
@@ -1055,10 +1085,22 @@ public partial class SessionCompactionCompleteDataCompactionTokensUsed
10551085
public required double CachedInput { get; set; }
10561086
}
10571087

1058-
public partial class UserMessageDataAttachmentsItem
1088+
public partial class UserMessageDataAttachmentsItemFile : UserMessageDataAttachmentsItem
10591089
{
1060-
[JsonPropertyName("type")]
1061-
public required UserMessageDataAttachmentsItemType Type { get; set; }
1090+
[JsonIgnore]
1091+
public override string Type => "file";
1092+
1093+
[JsonPropertyName("path")]
1094+
public required string Path { get; set; }
1095+
1096+
[JsonPropertyName("displayName")]
1097+
public required string DisplayName { get; set; }
1098+
}
1099+
1100+
public partial class UserMessageDataAttachmentsItemDirectory : UserMessageDataAttachmentsItem
1101+
{
1102+
[JsonIgnore]
1103+
public override string Type => "directory";
10621104

10631105
[JsonPropertyName("path")]
10641106
public required string Path { get; set; }
@@ -1067,6 +1109,64 @@ public partial class UserMessageDataAttachmentsItem
10671109
public required string DisplayName { get; set; }
10681110
}
10691111

1112+
public partial class UserMessageDataAttachmentsItemSelectionSelectionStart
1113+
{
1114+
[JsonPropertyName("line")]
1115+
public required double Line { get; set; }
1116+
1117+
[JsonPropertyName("character")]
1118+
public required double Character { get; set; }
1119+
}
1120+
1121+
public partial class UserMessageDataAttachmentsItemSelectionSelectionEnd
1122+
{
1123+
[JsonPropertyName("line")]
1124+
public required double Line { get; set; }
1125+
1126+
[JsonPropertyName("character")]
1127+
public required double Character { get; set; }
1128+
}
1129+
1130+
public partial class UserMessageDataAttachmentsItemSelectionSelection
1131+
{
1132+
[JsonPropertyName("start")]
1133+
public required UserMessageDataAttachmentsItemSelectionSelectionStart Start { get; set; }
1134+
1135+
[JsonPropertyName("end")]
1136+
public required UserMessageDataAttachmentsItemSelectionSelectionEnd End { get; set; }
1137+
}
1138+
1139+
public partial class UserMessageDataAttachmentsItemSelection : UserMessageDataAttachmentsItem
1140+
{
1141+
[JsonIgnore]
1142+
public override string Type => "selection";
1143+
1144+
[JsonPropertyName("filePath")]
1145+
public required string FilePath { get; set; }
1146+
1147+
[JsonPropertyName("displayName")]
1148+
public required string DisplayName { get; set; }
1149+
1150+
[JsonPropertyName("text")]
1151+
public required string Text { get; set; }
1152+
1153+
[JsonPropertyName("selection")]
1154+
public required UserMessageDataAttachmentsItemSelectionSelection Selection { get; set; }
1155+
}
1156+
1157+
[JsonPolymorphic(
1158+
TypeDiscriminatorPropertyName = "type",
1159+
UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)]
1160+
[JsonDerivedType(typeof(UserMessageDataAttachmentsItemFile), "file")]
1161+
[JsonDerivedType(typeof(UserMessageDataAttachmentsItemDirectory), "directory")]
1162+
[JsonDerivedType(typeof(UserMessageDataAttachmentsItemSelection), "selection")]
1163+
public partial class UserMessageDataAttachmentsItem
1164+
{
1165+
[JsonPropertyName("type")]
1166+
public virtual string Type { get; set; } = string.Empty;
1167+
}
1168+
1169+
10701170
public partial class AssistantMessageDataToolRequestsItem
10711171
{
10721172
[JsonPropertyName("toolCallId")]
@@ -1088,6 +1188,10 @@ public partial class ToolExecutionCompleteDataResult
10881188
{
10891189
[JsonPropertyName("content")]
10901190
public required string Content { get; set; }
1191+
1192+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
1193+
[JsonPropertyName("detailedContent")]
1194+
public string? DetailedContent { get; set; }
10911195
}
10921196

10931197
public partial class ToolExecutionCompleteDataError
@@ -1130,15 +1234,6 @@ public enum SessionHandoffDataSourceType
11301234
Local,
11311235
}
11321236

1133-
[JsonConverter(typeof(JsonStringEnumConverter<UserMessageDataAttachmentsItemType>))]
1134-
public enum UserMessageDataAttachmentsItemType
1135-
{
1136-
[JsonStringEnumMemberName("file")]
1137-
File,
1138-
[JsonStringEnumMemberName("directory")]
1139-
Directory,
1140-
}
1141-
11421237
[JsonConverter(typeof(JsonStringEnumConverter<AssistantMessageDataToolRequestsItemType>))]
11431238
public enum AssistantMessageDataToolRequestsItemType
11441239
{
@@ -1208,6 +1303,8 @@ public enum SystemMessageDataRole
12081303
[JsonSerializable(typeof(SessionResumeData))]
12091304
[JsonSerializable(typeof(SessionResumeDataContext))]
12101305
[JsonSerializable(typeof(SessionResumeEvent))]
1306+
[JsonSerializable(typeof(SessionSnapshotRewindData))]
1307+
[JsonSerializable(typeof(SessionSnapshotRewindEvent))]
12111308
[JsonSerializable(typeof(SessionStartData))]
12121309
[JsonSerializable(typeof(SessionStartDataContext))]
12131310
[JsonSerializable(typeof(SessionStartEvent))]
@@ -1240,5 +1337,11 @@ public enum SystemMessageDataRole
12401337
[JsonSerializable(typeof(ToolUserRequestedEvent))]
12411338
[JsonSerializable(typeof(UserMessageData))]
12421339
[JsonSerializable(typeof(UserMessageDataAttachmentsItem))]
1340+
[JsonSerializable(typeof(UserMessageDataAttachmentsItemDirectory))]
1341+
[JsonSerializable(typeof(UserMessageDataAttachmentsItemFile))]
1342+
[JsonSerializable(typeof(UserMessageDataAttachmentsItemSelection))]
1343+
[JsonSerializable(typeof(UserMessageDataAttachmentsItemSelectionSelection))]
1344+
[JsonSerializable(typeof(UserMessageDataAttachmentsItemSelectionSelectionEnd))]
1345+
[JsonSerializable(typeof(UserMessageDataAttachmentsItemSelectionSelectionStart))]
12431346
[JsonSerializable(typeof(UserMessageEvent))]
12441347
internal partial class SessionEventsJsonContext : JsonSerializerContext;

go/generated_session_events.go

Lines changed: 30 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)