Skip to content

Commit 5828a2d

Browse files
Fix SDK generated-name regressions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f9458a7 commit 5828a2d

32 files changed

+320
-305
lines changed

dotnet/src/Client.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ private async Task VerifyProtocolVersionAsync(Connection connection, Cancellatio
12371237
stderrBuffer.AppendLine(line);
12381238
}
12391239

1240-
if (logger.IsEnabled(LogLevel.Debug))
1240+
if (logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
12411241
{
12421242
logger.LogDebug("[CLI] {Line}", line);
12431243
}
@@ -1759,7 +1759,7 @@ private sealed class LoggerTraceListener(ILogger logger) : TraceListener
17591759
{
17601760
public override void TraceEvent(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, string? message)
17611761
{
1762-
LogLevel level = MapLevel(eventType);
1762+
Microsoft.Extensions.Logging.LogLevel level = MapLevel(eventType);
17631763
if (logger.IsEnabled(level))
17641764
{
17651765
logger.Log(level, "[{Source}] {Message}", source, message);
@@ -1768,7 +1768,7 @@ public override void TraceEvent(TraceEventCache? eventCache, string source, Trac
17681768

17691769
public override void TraceEvent(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, string? format, params object?[]? args)
17701770
{
1771-
LogLevel level = MapLevel(eventType);
1771+
Microsoft.Extensions.Logging.LogLevel level = MapLevel(eventType);
17721772
if (logger.IsEnabled(level))
17731773
{
17741774
logger.Log(level, "[{Source}] {Message}", source, args is null || args.Length == 0 ? format : string.Format(CultureInfo.InvariantCulture, format ?? "", args));
@@ -1777,7 +1777,7 @@ public override void TraceEvent(TraceEventCache? eventCache, string source, Trac
17771777

17781778
public override void TraceData(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, object? data)
17791779
{
1780-
LogLevel level = MapLevel(eventType);
1780+
Microsoft.Extensions.Logging.LogLevel level = MapLevel(eventType);
17811781
if (logger.IsEnabled(level))
17821782
{
17831783
logger.Log(level, "[{Source}] {Data}", source, data);
@@ -1786,7 +1786,7 @@ public override void TraceData(TraceEventCache? eventCache, string source, Trace
17861786

17871787
public override void TraceData(TraceEventCache? eventCache, string source, TraceEventType eventType, int id, params object?[]? data)
17881788
{
1789-
LogLevel level = MapLevel(eventType);
1789+
Microsoft.Extensions.Logging.LogLevel level = MapLevel(eventType);
17901790
if (logger.IsEnabled(level))
17911791
{
17921792
logger.Log(level, "[{Source}] {Data}", source, data is null ? null : string.Join(", ", data));
@@ -1795,30 +1795,30 @@ public override void TraceData(TraceEventCache? eventCache, string source, Trace
17951795

17961796
public override void Write(string? message)
17971797
{
1798-
if (logger.IsEnabled(LogLevel.Trace))
1798+
if (logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Trace))
17991799
{
18001800
logger.LogTrace("{Message}", message);
18011801
}
18021802
}
18031803

18041804
public override void WriteLine(string? message)
18051805
{
1806-
if (logger.IsEnabled(LogLevel.Trace))
1806+
if (logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Trace))
18071807
{
18081808
logger.LogTrace("{Message}", message);
18091809
}
18101810
}
18111811

1812-
private static LogLevel MapLevel(TraceEventType eventType)
1812+
private static Microsoft.Extensions.Logging.LogLevel MapLevel(TraceEventType eventType)
18131813
{
18141814
return eventType switch
18151815
{
1816-
TraceEventType.Critical => LogLevel.Critical,
1817-
TraceEventType.Error => LogLevel.Error,
1818-
TraceEventType.Warning => LogLevel.Warning,
1819-
TraceEventType.Information => LogLevel.Information,
1820-
TraceEventType.Verbose => LogLevel.Debug,
1821-
_ => LogLevel.Trace
1816+
TraceEventType.Critical => Microsoft.Extensions.Logging.LogLevel.Critical,
1817+
TraceEventType.Error => Microsoft.Extensions.Logging.LogLevel.Error,
1818+
TraceEventType.Warning => Microsoft.Extensions.Logging.LogLevel.Warning,
1819+
TraceEventType.Information => Microsoft.Extensions.Logging.LogLevel.Information,
1820+
TraceEventType.Verbose => Microsoft.Extensions.Logging.LogLevel.Debug,
1821+
_ => Microsoft.Extensions.Logging.LogLevel.Trace
18221822
};
18231823
}
18241824
}

dotnet/src/Generated/Rpc.cs

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

dotnet/src/Session.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ private async Task HandleElicitationRequestAsync(ElicitationContext context, str
733733
try
734734
{
735735
var result = await handler(context);
736-
await Rpc.Ui.HandlePendingElicitationAsync(requestId, new SessionUiHandlePendingElicitationRequestResult
736+
await Rpc.Ui.HandlePendingElicitationAsync(requestId, new UiElicitationResponse
737737
{
738738
Action = result.Action,
739739
Content = result.Content
@@ -744,9 +744,9 @@ private async Task HandleElicitationRequestAsync(ElicitationContext context, str
744744
// User handler can throw any exception — attempt to cancel so the request doesn't hang.
745745
try
746746
{
747-
await Rpc.Ui.HandlePendingElicitationAsync(requestId, new SessionUiHandlePendingElicitationRequestResult
747+
await Rpc.Ui.HandlePendingElicitationAsync(requestId, new UiElicitationResponse
748748
{
749-
Action = SessionUiElicitationResultAction.Cancel
749+
Action = UiElicitationAction.Cancel
750750
});
751751
}
752752
catch (Exception innerEx) when (innerEx is IOException or ObjectDisposedException)
@@ -777,7 +777,7 @@ private sealed class SessionUiApiImpl(CopilotSession session) : ISessionUiApi
777777
public async Task<ElicitationResult> ElicitationAsync(ElicitationParams elicitationParams, CancellationToken cancellationToken)
778778
{
779779
session.AssertElicitation();
780-
var schema = new SessionUiElicitationRequestRequestedSchema
780+
var schema = new UiElicitationSchema
781781
{
782782
Type = elicitationParams.RequestedSchema.Type,
783783
Properties = elicitationParams.RequestedSchema.Properties,
@@ -790,7 +790,7 @@ public async Task<ElicitationResult> ElicitationAsync(ElicitationParams elicitat
790790
public async Task<bool> ConfirmAsync(string message, CancellationToken cancellationToken)
791791
{
792792
session.AssertElicitation();
793-
var schema = new SessionUiElicitationRequestRequestedSchema
793+
var schema = new UiElicitationSchema
794794
{
795795
Type = "object",
796796
Properties = new Dictionary<string, object>
@@ -800,7 +800,7 @@ public async Task<bool> ConfirmAsync(string message, CancellationToken cancellat
800800
Required = ["confirmed"]
801801
};
802802
var result = await session.Rpc.Ui.ElicitationAsync(message, schema, cancellationToken);
803-
if (result.Action == SessionUiElicitationResultAction.Accept
803+
if (result.Action == UiElicitationAction.Accept
804804
&& result.Content != null
805805
&& result.Content.TryGetValue("confirmed", out var val))
806806
{
@@ -818,7 +818,7 @@ public async Task<bool> ConfirmAsync(string message, CancellationToken cancellat
818818
public async Task<string?> SelectAsync(string message, string[] options, CancellationToken cancellationToken)
819819
{
820820
session.AssertElicitation();
821-
var schema = new SessionUiElicitationRequestRequestedSchema
821+
var schema = new UiElicitationSchema
822822
{
823823
Type = "object",
824824
Properties = new Dictionary<string, object>
@@ -828,7 +828,7 @@ public async Task<bool> ConfirmAsync(string message, CancellationToken cancellat
828828
Required = ["selection"]
829829
};
830830
var result = await session.Rpc.Ui.ElicitationAsync(message, schema, cancellationToken);
831-
if (result.Action == SessionUiElicitationResultAction.Accept
831+
if (result.Action == UiElicitationAction.Accept
832832
&& result.Content != null
833833
&& result.Content.TryGetValue("selection", out var val))
834834
{
@@ -853,14 +853,14 @@ public async Task<bool> ConfirmAsync(string message, CancellationToken cancellat
853853
if (options?.Format != null) field["format"] = options.Format;
854854
if (options?.Default != null) field["default"] = options.Default;
855855

856-
var schema = new SessionUiElicitationRequestRequestedSchema
856+
var schema = new UiElicitationSchema
857857
{
858858
Type = "object",
859859
Properties = new Dictionary<string, object> { ["value"] = field },
860860
Required = ["value"]
861861
};
862862
var result = await session.Rpc.Ui.ElicitationAsync(message, schema, cancellationToken);
863-
if (result.Action == SessionUiElicitationResultAction.Accept
863+
if (result.Action == UiElicitationAction.Accept
864864
&& result.Content != null
865865
&& result.Content.TryGetValue("value", out var val))
866866
{
@@ -1141,12 +1141,12 @@ public Task SetModelAsync(string model, CancellationToken cancellationToken = de
11411141
/// <example>
11421142
/// <code>
11431143
/// await session.LogAsync("Build completed successfully");
1144-
/// await session.LogAsync("Disk space low", level: SessionLogRequestLevel.Warning);
1145-
/// await session.LogAsync("Connection failed", level: SessionLogRequestLevel.Error);
1144+
/// await session.LogAsync("Disk space low", level: GitHub.Copilot.SDK.Rpc.LogLevel.Warning);
1145+
/// await session.LogAsync("Connection failed", level: GitHub.Copilot.SDK.Rpc.LogLevel.Error);
11461146
/// await session.LogAsync("Temporary status", ephemeral: true);
11471147
/// </code>
11481148
/// </example>
1149-
public async Task LogAsync(string message, SessionLogRequestLevel? level = null, bool? ephemeral = null, string? url = null, CancellationToken cancellationToken = default)
1149+
public async Task LogAsync(string message, GitHub.Copilot.SDK.Rpc.LogLevel? level = null, bool? ephemeral = null, string? url = null, CancellationToken cancellationToken = default)
11501150
{
11511151
await Rpc.LogAsync(message, level, ephemeral, url, cancellationToken);
11521152
}
@@ -1215,17 +1215,17 @@ await InvokeRpcAsync<object>(
12151215
_elicitationHandler = null;
12161216
}
12171217

1218-
[LoggerMessage(Level = LogLevel.Error, Message = "Unhandled exception in broadcast event handler")]
1218+
[LoggerMessage(Level = Microsoft.Extensions.Logging.LogLevel.Error, Message = "Unhandled exception in broadcast event handler")]
12191219
private partial void LogBroadcastHandlerError(Exception exception);
12201220

1221-
[LoggerMessage(Level = LogLevel.Error, Message = "Unhandled exception in session event handler")]
1221+
[LoggerMessage(Level = Microsoft.Extensions.Logging.LogLevel.Error, Message = "Unhandled exception in session event handler")]
12221222
private partial void LogEventHandlerError(Exception exception);
12231223

12241224
internal record SendMessageRequest
12251225
{
12261226
public string SessionId { get; init; } = string.Empty;
12271227
public string Prompt { get; init; } = string.Empty;
1228-
public List<UserMessageDataAttachmentsItem>? Attachments { get; init; }
1228+
public List<UserMessageAttachment>? Attachments { get; init; }
12291229
public string? Mode { get; init; }
12301230
public string? Traceparent { get; init; }
12311231
public string? Tracestate { get; init; }
@@ -1267,7 +1267,7 @@ internal record SessionDestroyRequest
12671267
[JsonSerializable(typeof(SendMessageResponse))]
12681268
[JsonSerializable(typeof(SessionAbortRequest))]
12691269
[JsonSerializable(typeof(SessionDestroyRequest))]
1270-
[JsonSerializable(typeof(UserMessageDataAttachmentsItem))]
1270+
[JsonSerializable(typeof(UserMessageAttachment))]
12711271
[JsonSerializable(typeof(PreToolUseHookInput))]
12721272
[JsonSerializable(typeof(PreToolUseHookOutput))]
12731273
[JsonSerializable(typeof(PostToolUseHookInput))]

dotnet/src/Types.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public sealed class SessionFsConfig
245245
/// <summary>
246246
/// Path conventions used by this filesystem provider.
247247
/// </summary>
248-
public required SessionFsSetProviderRequestConventions Conventions { get; init; }
248+
public required SessionFsSetProviderConventions Conventions { get; init; }
249249
}
250250

251251
/// <summary>
@@ -640,7 +640,7 @@ public class ElicitationResult
640640
/// <summary>
641641
/// User action: <c>"accept"</c> (submitted), <c>"decline"</c> (rejected), or <c>"cancel"</c> (dismissed).
642642
/// </summary>
643-
public SessionUiElicitationResultAction Action { get; set; }
643+
public UiElicitationAction Action { get; set; }
644644

645645
/// <summary>
646646
/// Form values submitted by the user (present when <see cref="Action"/> is <c>Accept</c>).
@@ -739,7 +739,7 @@ public class ElicitationContext
739739
public ElicitationSchema? RequestedSchema { get; set; }
740740

741741
/// <summary>Elicitation mode: <c>"form"</c> for structured input, <c>"url"</c> for browser redirect.</summary>
742-
public ElicitationRequestedDataMode? Mode { get; set; }
742+
public ElicitationRequestedMode? Mode { get; set; }
743743

744744
/// <summary>The source that initiated the request (e.g., MCP server name).</summary>
745745
public string? ElicitationSource { get; set; }
@@ -2032,7 +2032,7 @@ protected MessageOptions(MessageOptions? other)
20322032
/// <summary>
20332033
/// File or data attachments to include with the message.
20342034
/// </summary>
2035-
public List<UserMessageDataAttachmentsItem>? Attachments { get; set; }
2035+
public List<UserMessageAttachment>? Attachments { get; set; }
20362036
/// <summary>
20372037
/// Interaction mode for the message (e.g., "plan", "edit").
20382038
/// </summary>

dotnet/test/CloneTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public void MessageOptions_Clone_CopiesAllProperties()
203203
var original = new MessageOptions
204204
{
205205
Prompt = "Hello",
206-
Attachments = [new UserMessageDataAttachmentsItemFile { Path = "/test.txt", DisplayName = "test.txt" }],
206+
Attachments = [new UserMessageAttachmentFile { Path = "/test.txt", DisplayName = "test.txt" }],
207207
Mode = "chat",
208208
};
209209

@@ -219,12 +219,12 @@ public void MessageOptions_Clone_AttachmentsAreIndependent()
219219
{
220220
var original = new MessageOptions
221221
{
222-
Attachments = [new UserMessageDataAttachmentsItemFile { Path = "/test.txt", DisplayName = "test.txt" }],
222+
Attachments = [new UserMessageAttachmentFile { Path = "/test.txt", DisplayName = "test.txt" }],
223223
};
224224

225225
var clone = original.Clone();
226226

227-
clone.Attachments!.Add(new UserMessageDataAttachmentsItemFile { Path = "/other.txt", DisplayName = "other.txt" });
227+
clone.Attachments!.Add(new UserMessageAttachmentFile { Path = "/other.txt", DisplayName = "other.txt" });
228228

229229
Assert.Single(original.Attachments!);
230230
}

dotnet/test/ElicitationTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public async Task Sends_RequestElicitation_When_Handler_Provided()
8080
OnPermissionRequest = PermissionHandler.ApproveAll,
8181
OnElicitationRequest = _ => Task.FromResult(new ElicitationResult
8282
{
83-
Action = SessionUiElicitationResultAction.Accept,
83+
Action = UiElicitationAction.Accept,
8484
Content = new Dictionary<string, object>(),
8585
}),
8686
});
@@ -99,7 +99,7 @@ public async Task Session_With_ElicitationHandler_Reports_Elicitation_Capability
9999
OnPermissionRequest = PermissionHandler.ApproveAll,
100100
OnElicitationRequest = _ => Task.FromResult(new ElicitationResult
101101
{
102-
Action = SessionUiElicitationResultAction.Accept,
102+
Action = UiElicitationAction.Accept,
103103
Content = new Dictionary<string, object>(),
104104
}),
105105
});
@@ -194,17 +194,17 @@ public void ElicitationResult_Types_Are_Properly_Structured()
194194
{
195195
var result = new ElicitationResult
196196
{
197-
Action = SessionUiElicitationResultAction.Accept,
197+
Action = UiElicitationAction.Accept,
198198
Content = new Dictionary<string, object> { ["name"] = "Alice" },
199199
};
200200

201-
Assert.Equal(SessionUiElicitationResultAction.Accept, result.Action);
201+
Assert.Equal(UiElicitationAction.Accept, result.Action);
202202
Assert.NotNull(result.Content);
203203
Assert.Equal("Alice", result.Content!["name"]);
204204

205205
var declined = new ElicitationResult
206206
{
207-
Action = SessionUiElicitationResultAction.Decline,
207+
Action = UiElicitationAction.Decline,
208208
};
209209
Assert.Null(declined.Content);
210210
}
@@ -244,15 +244,15 @@ public void ElicitationContext_Has_All_Properties()
244244
["color"] = new Dictionary<string, object> { ["type"] = "string", ["enum"] = new[] { "red", "blue" } },
245245
},
246246
},
247-
Mode = ElicitationRequestedDataMode.Form,
247+
Mode = ElicitationRequestedMode.Form,
248248
ElicitationSource = "mcp-server",
249249
Url = null,
250250
};
251251

252252
Assert.Equal("session-42", context.SessionId);
253253
Assert.Equal("Pick a color", context.Message);
254254
Assert.NotNull(context.RequestedSchema);
255-
Assert.Equal(ElicitationRequestedDataMode.Form, context.Mode);
255+
Assert.Equal(ElicitationRequestedMode.Form, context.Mode);
256256
Assert.Equal("mcp-server", context.ElicitationSource);
257257
Assert.Null(context.Url);
258258
}
@@ -262,7 +262,7 @@ public async Task Session_Config_OnElicitationRequest_Is_Cloned()
262262
{
263263
ElicitationHandler handler = _ => Task.FromResult(new ElicitationResult
264264
{
265-
Action = SessionUiElicitationResultAction.Cancel,
265+
Action = UiElicitationAction.Cancel,
266266
});
267267

268268
var config = new SessionConfig
@@ -281,7 +281,7 @@ public void Resume_Config_OnElicitationRequest_Is_Cloned()
281281
{
282282
ElicitationHandler handler = _ => Task.FromResult(new ElicitationResult
283283
{
284-
Action = SessionUiElicitationResultAction.Cancel,
284+
Action = UiElicitationAction.Cancel,
285285
});
286286

287287
var config = new ResumeSessionConfig

0 commit comments

Comments
 (0)