diff --git a/dotnet/src/Client.cs b/dotnet/src/Client.cs index c1dc311d..912ab93e 100644 --- a/dotnet/src/Client.cs +++ b/dotnet/src/Client.cs @@ -1052,16 +1052,16 @@ private sealed class LoggerTraceListener(ILogger logger) : TraceListener public override void TraceEvent(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, string? message) => logger.Log(MapLevel(eventType), "[{Source}] {Message}", source, message); - public override void TraceEvent(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, string? format, params object?[]? args) => + public override void TraceEvent(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, string? format, params object?[]? args) => logger.Log(MapLevel(eventType), "[{Source}] {Message}", source, args is null || args.Length == 0 ? format : string.Format(format ?? "", args)); - public override void TraceData(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, object? data) => + public override void TraceData(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, object? data) => logger.Log(MapLevel(eventType), "[{Source}] {Data}", source, data); - public override void TraceData(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, params object?[]? data) => + public override void TraceData(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, params object?[]? data) => logger.Log(MapLevel(eventType), "[{Source}] {Data}", source, data is null ? null : string.Join(", ", data)); - public override void Write(string? message) => + public override void Write(string? message) => logger.LogTrace("{Message}", message); public override void WriteLine(string? message) => diff --git a/dotnet/src/Generated/SessionEvents.cs b/dotnet/src/Generated/SessionEvents.cs index 487ff684..ea9b3e2d 100644 --- a/dotnet/src/Generated/SessionEvents.cs +++ b/dotnet/src/Generated/SessionEvents.cs @@ -6,7 +6,7 @@ // // Generated from: @github/copilot/session-events.schema.json // Generated by: scripts/generate-session-types.ts -// Generated at: 2026-01-22T13:45:56.468Z +// Generated at: 2026-01-22T14:30:57.371Z // // To update these types: // 1. Update the schema in copilot-agent-runtime @@ -21,7 +21,7 @@ namespace GitHub.Copilot.SDK; /// Base class for all session events with polymorphic JSON serialization. /// [JsonPolymorphic( - TypeDiscriminatorPropertyName = "type", + TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization)] [JsonDerivedType(typeof(AbortEvent), "abort")] [JsonDerivedType(typeof(AssistantIntentEvent), "assistant.intent")] @@ -53,6 +53,7 @@ namespace GitHub.Copilot.SDK; [JsonDerivedType(typeof(SystemMessageEvent), "system.message")] [JsonDerivedType(typeof(ToolExecutionCompleteEvent), "tool.execution_complete")] [JsonDerivedType(typeof(ToolExecutionPartialResultEvent), "tool.execution_partial_result")] +[JsonDerivedType(typeof(ToolExecutionProgressEvent), "tool.execution_progress")] [JsonDerivedType(typeof(ToolExecutionStartEvent), "tool.execution_start")] [JsonDerivedType(typeof(ToolUserRequestedEvent), "tool.user_requested")] [JsonDerivedType(typeof(UserMessageEvent), "user.message")] @@ -384,6 +385,18 @@ public partial class ToolExecutionPartialResultEvent : SessionEvent public required ToolExecutionPartialResultData Data { get; set; } } +/// +/// Event: tool.execution_progress +/// +public partial class ToolExecutionProgressEvent : SessionEvent +{ + [JsonIgnore] + public override string Type => "tool.execution_progress"; + + [JsonPropertyName("data")] + public required ToolExecutionProgressData Data { get; set; } +} + /// /// Event: tool.execution_complete /// @@ -845,6 +858,15 @@ public partial class ToolExecutionPartialResultData public required string PartialOutput { get; set; } } +public partial class ToolExecutionProgressData +{ + [JsonPropertyName("toolCallId")] + public required string ToolCallId { get; set; } + + [JsonPropertyName("progressMessage")] + public required string ProgressMessage { get; set; } +} + public partial class ToolExecutionCompleteData { [JsonPropertyName("toolCallId")] @@ -1099,41 +1121,41 @@ public partial class SystemMessageDataMetadata public Dictionary? Variables { get; set; } } - [JsonConverter(typeof(JsonStringEnumConverter))] - public enum SessionHandoffDataSourceType - { - [JsonStringEnumMemberName("remote")] - Remote, - [JsonStringEnumMemberName("local")] - Local, - } - - [JsonConverter(typeof(JsonStringEnumConverter))] - public enum UserMessageDataAttachmentsItemType - { - [JsonStringEnumMemberName("file")] - File, - [JsonStringEnumMemberName("directory")] - Directory, - } - - [JsonConverter(typeof(JsonStringEnumConverter))] - public enum AssistantMessageDataToolRequestsItemType - { - [JsonStringEnumMemberName("function")] - Function, - [JsonStringEnumMemberName("custom")] - Custom, - } - - [JsonConverter(typeof(JsonStringEnumConverter))] - public enum SystemMessageDataRole - { - [JsonStringEnumMemberName("system")] - System, - [JsonStringEnumMemberName("developer")] - Developer, - } +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum SessionHandoffDataSourceType +{ + [JsonStringEnumMemberName("remote")] + Remote, + [JsonStringEnumMemberName("local")] + Local, +} + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum UserMessageDataAttachmentsItemType +{ + [JsonStringEnumMemberName("file")] + File, + [JsonStringEnumMemberName("directory")] + Directory, +} + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum AssistantMessageDataToolRequestsItemType +{ + [JsonStringEnumMemberName("function")] + Function, + [JsonStringEnumMemberName("custom")] + Custom, +} + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum SystemMessageDataRole +{ + [JsonStringEnumMemberName("system")] + System, + [JsonStringEnumMemberName("developer")] + Developer, +} [JsonSourceGenerationOptions( JsonSerializerDefaults.Web, @@ -1210,6 +1232,8 @@ public enum SystemMessageDataRole [JsonSerializable(typeof(ToolExecutionCompleteEvent))] [JsonSerializable(typeof(ToolExecutionPartialResultData))] [JsonSerializable(typeof(ToolExecutionPartialResultEvent))] +[JsonSerializable(typeof(ToolExecutionProgressData))] +[JsonSerializable(typeof(ToolExecutionProgressEvent))] [JsonSerializable(typeof(ToolExecutionStartData))] [JsonSerializable(typeof(ToolExecutionStartEvent))] [JsonSerializable(typeof(ToolUserRequestedData))] diff --git a/nodejs/scripts/generate-csharp-session-types.ts b/nodejs/scripts/generate-csharp-session-types.ts index dc2e82b9..722737b6 100644 --- a/nodejs/scripts/generate-csharp-session-types.ts +++ b/nodejs/scripts/generate-csharp-session-types.ts @@ -169,15 +169,15 @@ function getOrCreateEnum( // Generate the enum code with JsonConverter and JsonStringEnumMemberName attributes const lines: string[] = []; - lines.push(` [JsonConverter(typeof(JsonStringEnumConverter<${enumName}>))]`); - lines.push(` public enum ${enumName}`); - lines.push(` {`); + lines.push(`[JsonConverter(typeof(JsonStringEnumConverter<${enumName}>))]`); + lines.push(`public enum ${enumName}`); + lines.push(`{`); for (const value of values) { const memberName = toPascalCaseEnumMember(value); - lines.push(` [JsonStringEnumMemberName("${value}")]`); - lines.push(` ${memberName},`); + lines.push(` [JsonStringEnumMemberName("${value}")]`); + lines.push(` ${memberName},`); } - lines.push(` }`); + lines.push(`}`); lines.push(""); enumOutput.push(lines.join("\n")); @@ -501,7 +501,7 @@ namespace GitHub.Copilot.SDK; ); lines.push(`/// `); lines.push(`[JsonPolymorphic(`); - lines.push(` TypeDiscriminatorPropertyName = "type", `); + lines.push(` TypeDiscriminatorPropertyName = "type",`); lines.push( ` UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization)]` );