Skip to content

Commit c88ef30

Browse files
committed
Merge remote-tracking branch 'origin/main' into jmoseley-java-canvas-host-api
# Conflicts: # java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java # java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java
2 parents d18619f + 64dcd25 commit c88ef30

134 files changed

Lines changed: 11560 additions & 1054 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dotnet/src/Client.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,9 +980,11 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig config, Cance
980980
config.ReasoningSummary,
981981
config.ContextTier,
982982
config.Tools?.Select(ToolDefinition.FromAIFunction).ToList(),
983+
config.EnableCitations,
983984
wireSystemMessage,
984985
toolFilter.AvailableTools,
985986
toolFilter.ExcludedTools,
987+
config.ExcludedBuiltInAgents,
986988
config.Provider,
987989
config.Capi,
988990
config.EnableSessionTelemetry,
@@ -1013,6 +1015,7 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig config, Cance
10131015
config.SkillDirectories,
10141016
config.DisabledSkills,
10151017
config.InfiniteSessions,
1018+
config.SessionLimits,
10161019
Commands: config.Commands?.Select(c => new CommandWireDefinition(c.Name, c.Description)).ToList(),
10171020
RequestElicitation: config.OnElicitationRequest != null,
10181021
RequestMcpApps: config.EnableMcpApps ? true : null,
@@ -1189,9 +1192,11 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
11891192
config.ReasoningSummary,
11901193
config.ContextTier,
11911194
config.Tools?.Select(ToolDefinition.FromAIFunction).ToList(),
1195+
config.EnableCitations,
11921196
wireSystemMessage,
11931197
toolFilter.AvailableTools,
11941198
toolFilter.ExcludedTools,
1199+
config.ExcludedBuiltInAgents,
11951200
config.Provider,
11961201
config.Capi,
11971202
config.EnableSessionTelemetry,
@@ -1223,6 +1228,7 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
12231228
config.SkillDirectories,
12241229
config.DisabledSkills,
12251230
config.InfiniteSessions,
1231+
config.SessionLimits,
12261232
Commands: config.Commands?.Select(c => new CommandWireDefinition(c.Name, c.Description)).ToList(),
12271233
RequestElicitation: config.OnElicitationRequest != null,
12281234
RequestMcpApps: config.EnableMcpApps ? true : null,
@@ -2431,9 +2437,11 @@ internal record CreateSessionRequest(
24312437
ReasoningSummary? ReasoningSummary,
24322438
ContextTier? ContextTier,
24332439
IList<ToolDefinition>? Tools,
2440+
bool? EnableCitations,
24342441
SystemMessageConfig? SystemMessage,
24352442
IList<string>? AvailableTools,
24362443
IList<string>? ExcludedTools,
2444+
[property: JsonPropertyName("excludedBuiltinAgents")] IList<string>? ExcludedBuiltInAgents,
24372445
ProviderConfig? Provider,
24382446
CapiSessionOptions? Capi,
24392447
bool? EnableSessionTelemetry,
@@ -2464,6 +2472,7 @@ internal record CreateSessionRequest(
24642472
IList<string>? SkillDirectories,
24652473
IList<string>? DisabledSkills,
24662474
InfiniteSessionConfig? InfiniteSessions,
2475+
SessionLimitsConfig? SessionLimits,
24672476
IList<CommandWireDefinition>? Commands = null,
24682477
bool? RequestElicitation = null,
24692478
bool? RequestMcpApps = null,
@@ -2525,9 +2534,11 @@ internal record ResumeSessionRequest(
25252534
ReasoningSummary? ReasoningSummary,
25262535
ContextTier? ContextTier,
25272536
IList<ToolDefinition>? Tools,
2537+
bool? EnableCitations,
25282538
SystemMessageConfig? SystemMessage,
25292539
IList<string>? AvailableTools,
25302540
IList<string>? ExcludedTools,
2541+
[property: JsonPropertyName("excludedBuiltinAgents")] IList<string>? ExcludedBuiltInAgents,
25312542
ProviderConfig? Provider,
25322543
CapiSessionOptions? Capi,
25332544
bool? EnableSessionTelemetry,
@@ -2559,6 +2570,7 @@ internal record ResumeSessionRequest(
25592570
IList<string>? SkillDirectories,
25602571
IList<string>? DisabledSkills,
25612572
InfiniteSessionConfig? InfiniteSessions,
2573+
SessionLimitsConfig? SessionLimits,
25622574
IList<CommandWireDefinition>? Commands = null,
25632575
bool? RequestElicitation = null,
25642576
bool? RequestMcpApps = null,
@@ -2660,6 +2672,7 @@ internal record HooksInvokeResponse(
26602672
[JsonSerializable(typeof(CapiSessionOptions))]
26612673
[JsonSerializable(typeof(NamedProviderConfig))]
26622674
[JsonSerializable(typeof(ProviderModelConfig))]
2675+
[JsonSerializable(typeof(SessionLimitsConfig))]
26632676
[JsonSerializable(typeof(ResumeSessionRequest))]
26642677
[JsonSerializable(typeof(ResumeSessionResponse))]
26652678
[JsonSerializable(typeof(SessionCapabilities))]

dotnet/src/Generated/Rpc.cs

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

dotnet/src/Generated/SessionEvents.cs

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

dotnet/src/Types.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,6 +2758,7 @@ protected SessionConfigBase(SessionConfigBase? other)
27582758
DefaultAgent = other.DefaultAgent;
27592759
Agent = other.Agent;
27602760
DisabledSkills = other.DisabledSkills is not null ? [.. other.DisabledSkills] : null;
2761+
EnableCitations = other.EnableCitations;
27612762
EnableConfigDiscovery = other.EnableConfigDiscovery;
27622763
SkipEmbeddingRetrieval = other.SkipEmbeddingRetrieval;
27632764
EmbeddingCacheStorage = other.EmbeddingCacheStorage;
@@ -2768,6 +2769,7 @@ protected SessionConfigBase(SessionConfigBase? other)
27682769
EnableSessionStore = other.EnableSessionStore;
27692770
EnableSkills = other.EnableSkills;
27702771
EnableMcpApps = other.EnableMcpApps;
2772+
ExcludedBuiltInAgents = other.ExcludedBuiltInAgents is not null ? [.. other.ExcludedBuiltInAgents] : null;
27712773
ExcludedTools = other.ExcludedTools is not null ? [.. other.ExcludedTools] : null;
27722774
Hooks = other.Hooks;
27732775
InfiniteSessions = other.InfiniteSessions;
@@ -2815,6 +2817,7 @@ protected SessionConfigBase(SessionConfigBase? other)
28152817
SkillDirectories = other.SkillDirectories is not null ? [.. other.SkillDirectories] : null;
28162818
PluginDirectories = other.PluginDirectories is not null ? [.. other.PluginDirectories] : null;
28172819
InstructionDirectories = other.InstructionDirectories is not null ? [.. other.InstructionDirectories] : null;
2820+
SessionLimits = other.SessionLimits;
28182821
Streaming = other.Streaming;
28192822
IncludeSubAgentStreamingEvents = other.IncludeSubAgentStreamingEvents;
28202823
SystemMessage = other.SystemMessage;
@@ -2853,6 +2856,16 @@ protected SessionConfigBase(SessionConfigBase? other)
28532856
/// <summary>Per-property overrides for model capabilities, deep-merged over runtime defaults.</summary>
28542857
public ModelCapabilitiesOverride? ModelCapabilities { get; set; }
28552858

2859+
/// <summary>
2860+
/// Enables native model citations for models that support them.
2861+
/// </summary>
2862+
/// <remarks>
2863+
/// Citations are experimental, off by default, and currently available for Anthropic models.
2864+
/// This option may change or be removed while citation support is experimental.
2865+
/// </remarks>
2866+
[Experimental(Diagnostics.Experimental)]
2867+
public bool? EnableCitations { get; set; }
2868+
28562869
/// <summary>
28572870
/// Override the default configuration directory location.
28582871
/// When specified, the session will use this directory for storing config and state.
@@ -2945,6 +2958,16 @@ protected SessionConfigBase(SessionConfigBase? other)
29452958
/// <summary>List of tool names to exclude from the session.</summary>
29462959
public IList<string>? ExcludedTools { get; set; }
29472960

2961+
/// <summary>
2962+
/// Built-in subagent names to exclude from this session.
2963+
/// </summary>
2964+
/// <remarks>
2965+
/// Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a
2966+
/// custom agent with the same name is available.
2967+
/// </remarks>
2968+
[JsonPropertyName("excludedBuiltinAgents")]
2969+
public IList<string>? ExcludedBuiltInAgents { get; set; }
2970+
29482971
/// <summary>Custom model provider configuration for the session.</summary>
29492972
public ProviderConfig? Provider { get; set; }
29502973

@@ -3137,6 +3160,16 @@ protected SessionConfigBase(SessionConfigBase? other)
31373160
/// </summary>
31383161
public InfiniteSessionConfig? InfiniteSessions { get; set; }
31393162

3163+
/// <summary>
3164+
/// Optional limits for the session's current accounting window.
3165+
/// </summary>
3166+
/// <remarks>
3167+
/// These settings only model the caller's configured limits. Enforcement and
3168+
/// limit-exhaustion behavior are handled by the runtime.
3169+
/// </remarks>
3170+
[Experimental(Diagnostics.Experimental)]
3171+
public SessionLimitsConfig? SessionLimits { get; set; }
3172+
31403173
/// <summary>
31413174
/// Configuration for handling large tool outputs. When a tool produces
31423175
/// output exceeding the configured size, the output is written to a temp

dotnet/test/E2E/CopilotRequestE2EProvider.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,14 @@ internal sealed class RecordingRequestHandler : CopilotRequestHandler
4949
protected override async Task<HttpResponseMessage> SendRequestAsync(HttpRequestMessage request, CopilotRequestContext ctx)
5050
{
5151
var url = request.RequestUri!.ToString();
52-
_records.Enqueue(new InterceptedRequest(url, ctx.SessionId));
53-
5452
var bodyText = request.Content is null
5553
? string.Empty
5654
#if NET8_0_OR_GREATER
5755
: await request.Content.ReadAsStringAsync(ctx.CancellationToken).ConfigureAwait(false);
5856
#else
5957
: await request.Content.ReadAsStringAsync().ConfigureAwait(false);
6058
#endif
59+
_records.Enqueue(new InterceptedRequest(url, ctx.SessionId, bodyText));
6160

6261
return IsInferenceUrl(url)
6362
? BuildInferenceResponse(url, bodyText)
@@ -95,6 +94,11 @@ private static HttpResponseMessage BuildInferenceResponse(string url, string bod
9594
return Sse(string.Concat(ChatCompletionStreamEvents));
9695
}
9796

97+
if (u.EndsWith("/messages", StringComparison.Ordinal))
98+
{
99+
return Json(BufferedAnthropicMessageJson);
100+
}
101+
98102
// /chat/completions non-streaming (and any other inference url) — buffered JSON.
99103
return Json(BufferedChatCompletionJson);
100104
}
@@ -160,9 +164,12 @@ internal static HttpResponseMessage BuildNonInferenceResponse(string url)
160164
private static readonly string BufferedChatCompletionJson =
161165
"{\"id\":\"chatcmpl-stub-1\",\"object\":\"chat.completion\",\"created\":1,\"model\":\"claude-sonnet-4.5\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"" + SyntheticText + "\"},\"finish_reason\":\"stop\"}],\"usage\":{\"prompt_tokens\":5,\"completion_tokens\":7,\"total_tokens\":12}}";
162166

167+
private static readonly string BufferedAnthropicMessageJson =
168+
"{\"id\":\"msg_stub_1\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"claude-sonnet-4.5\",\"content\":[{\"type\":\"text\",\"text\":\"" + SyntheticText + "\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":5,\"output_tokens\":7}}";
169+
163170
private const string ModelCatalogJson =
164171
"{\"data\":[{\"id\":\"claude-sonnet-4.5\",\"name\":\"Claude Sonnet 4.5\",\"object\":\"model\",\"vendor\":\"Anthropic\",\"version\":\"1\",\"preview\":false,\"model_picker_enabled\":true,\"capabilities\":{\"type\":\"chat\",\"family\":\"claude-sonnet-4.5\",\"tokenizer\":\"o200k_base\",\"limits\":{\"max_context_window_tokens\":200000,\"max_output_tokens\":8192},\"supports\":{\"streaming\":true,\"tool_calls\":true,\"parallel_tool_calls\":true,\"vision\":true}}}]}";
165172
}
166173

167174
/// <summary>A single request the callback intercepted.</summary>
168-
internal sealed record InterceptedRequest(string Url, string? SessionId);
175+
internal sealed record InterceptedRequest(string Url, string? SessionId, string Body);

0 commit comments

Comments
 (0)