diff --git a/docs/auth/authenticate.md b/docs/auth/authenticate.md
index 740e5f3c1..d2fb11603 100644
--- a/docs/auth/authenticate.md
+++ b/docs/auth/authenticate.md
@@ -77,7 +77,7 @@ client := copilot.NewClient(nil)
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
// Default: uses logged-in user credentials
await using var client = new CopilotClient();
@@ -179,23 +179,23 @@ client := copilot.NewClient(&copilot.ClientOptions{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
var userAccessToken = "token";
await using var client = new CopilotClient(new CopilotClientOptions
{
- GithubToken = userAccessToken,
+ GitHubToken = userAccessToken,
UseLoggedInUser = false,
});
```
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient(new CopilotClientOptions
{
- GithubToken = userAccessToken, // Token from OAuth flow
+ GitHubToken = userAccessToken, // Token from OAuth flow
UseLoggedInUser = false, // Don't use stored CLI credentials
});
```
diff --git a/docs/auth/byok.md b/docs/auth/byok.md
index 95b4a1c74..cb2f8cb90 100644
--- a/docs/auth/byok.md
+++ b/docs/auth/byok.md
@@ -142,7 +142,7 @@ func main() {
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -424,7 +424,7 @@ func main() {
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
var client = new CopilotClient(new CopilotClientOptions
{
diff --git a/docs/features/custom-agents.md b/docs/features/custom-agents.md
index 71fd9b4b1..3d93f7589 100644
--- a/docs/features/custom-agents.md
+++ b/docs/features/custom-agents.md
@@ -173,7 +173,7 @@ session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -585,13 +585,13 @@ _, err := session.SendAndWait(ctx, copilot.MessageOptions{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class SubAgentEventsExample
{
public static async Task Example(CopilotSession session)
{
- using var subscription = session.On(evt =>
+ using var subscription = session.On(evt =>
{
switch (evt)
{
@@ -622,7 +622,7 @@ public static class SubAgentEventsExample
```csharp
-using var subscription = session.On(evt =>
+using var subscription = session.On(evt =>
{
switch (evt)
{
diff --git a/docs/features/hooks.md b/docs/features/hooks.md
index db9ad72ec..c88c6e605 100644
--- a/docs/features/hooks.md
+++ b/docs/features/hooks.md
@@ -146,7 +146,7 @@ session, err := client.CreateSession(ctx, &copilot.SessionConfig{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class HooksExample
{
@@ -348,7 +348,7 @@ session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class PermissionControlExample
{
diff --git a/docs/features/image-input.md b/docs/features/image-input.md
index 286414c91..4aa564558 100644
--- a/docs/features/image-input.md
+++ b/docs/features/image-input.md
@@ -161,7 +161,7 @@ session.Send(ctx, copilot.MessageOptions{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class ImageInputExample
{
@@ -193,7 +193,7 @@ public static class ImageInputExample
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -376,7 +376,7 @@ session.Send(ctx, copilot.MessageOptions{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class BlobAttachmentExample
{
diff --git a/docs/features/mcp.md b/docs/features/mcp.md
index f6c5a7d7e..6f715bd2e 100644
--- a/docs/features/mcp.md
+++ b/docs/features/mcp.md
@@ -136,7 +136,7 @@ func main() {
### .NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
diff --git a/docs/features/session-persistence.md b/docs/features/session-persistence.md
index 374497711..5a1987227 100644
--- a/docs/features/session-persistence.md
+++ b/docs/features/session-persistence.md
@@ -109,7 +109,7 @@ session.SendAndWait(ctx, copilot.MessageOptions{Prompt: "Analyze my codebase"})
### C# (.NET)
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
var client = new CopilotClient();
@@ -201,7 +201,7 @@ session.SendAndWait(ctx, copilot.MessageOptions{Prompt: "What did we discuss ear
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class ResumeSessionExample
{
diff --git a/docs/features/skills.md b/docs/features/skills.md
index 6db0d60f3..516c11762 100644
--- a/docs/features/skills.md
+++ b/docs/features/skills.md
@@ -116,7 +116,7 @@ func main() {
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -244,7 +244,7 @@ session, _ := client.CreateSession(context.Background(), &copilot.SessionConfig{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class SkillsExample
{
diff --git a/docs/features/steering-and-queueing.md b/docs/features/steering-and-queueing.md
index 7858a7d3f..ce4f4fba2 100644
--- a/docs/features/steering-and-queueing.md
+++ b/docs/features/steering-and-queueing.md
@@ -152,7 +152,7 @@ func main() {
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -361,7 +361,7 @@ session.Send(ctx, copilot.MessageOptions{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class QueueingExample
{
diff --git a/docs/features/streaming-events.md b/docs/features/streaming-events.md
index a12440ee5..6bc560a48 100644
--- a/docs/features/streaming-events.md
+++ b/docs/features/streaming-events.md
@@ -161,13 +161,13 @@ session.On(func(event copilot.SessionEvent) {
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class StreamingEventsExample
{
public static async Task Example(CopilotSession session)
{
- session.On(evt =>
+ session.On(evt =>
{
if (evt is AssistantMessageDeltaEvent delta)
{
@@ -180,7 +180,7 @@ public static class StreamingEventsExample
```csharp
-session.On(evt =>
+session.On(evt =>
{
if (evt is AssistantMessageDeltaEvent delta)
{
diff --git a/docs/getting-started.md b/docs/getting-started.md
index 0836f2567..3a43fad7c 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -299,7 +299,7 @@ cargo run
Create a new console project and add this to `Program.cs`:
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -557,7 +557,7 @@ async fn main() -> Result<(), Box> {
Update `Program.cs`:
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -568,7 +568,7 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
});
// Listen for response chunks
-session.On(ev =>
+session.On(ev =>
{
if (ev is AssistantMessageDeltaEvent deltaEvent)
{
@@ -800,17 +800,17 @@ tokio::spawn(async move {
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class EventSubscriptionExample
{
public static void Example(CopilotSession session)
{
// Subscribe to all events
- var unsubscribe = session.On(ev => Console.WriteLine($"Event: {ev.Type}"));
+ var unsubscribe = session.On(ev => Console.WriteLine($"Event: {ev.Type}"));
// Filter by event type using pattern matching
- session.On(ev =>
+ session.On(ev =>
{
switch (ev)
{
@@ -832,10 +832,10 @@ public static class EventSubscriptionExample
```csharp
// Subscribe to all events
-var unsubscribe = session.On(ev => Console.WriteLine($"Event: {ev.Type}"));
+var unsubscribe = session.On(ev => Console.WriteLine($"Event: {ev.Type}"));
// Filter by event type using pattern matching
-session.On(ev =>
+session.On(ev =>
{
switch (ev)
{
@@ -1159,7 +1159,7 @@ async fn main() -> Result<(), Box> {
Update `Program.cs`:
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Extensions.AI;
using System.ComponentModel;
@@ -1190,7 +1190,7 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
Tools = [getWeather],
});
-session.On(ev =>
+session.On(ev =>
{
if (ev is AssistantMessageDeltaEvent deltaEvent)
{
@@ -1647,7 +1647,7 @@ cargo run
Create a new console project and update `Program.cs`:
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Extensions.AI;
using System.ComponentModel;
@@ -1676,7 +1676,7 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
});
// Listen for response chunks
-session.On(ev =>
+session.On(ev =>
{
if (ev is AssistantMessageDeltaEvent deltaEvent)
{
@@ -2067,12 +2067,11 @@ let session = client
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using var client = new CopilotClient(new CopilotClientOptions
{
- CliUrl = "localhost:4321",
- UseStdio = false
+ Connection = RuntimeConnection.ForUri("localhost:4321"),
});
// Use the client normally
diff --git a/docs/hooks/error-handling.md b/docs/hooks/error-handling.md
index 803032432..f36573f31 100644
--- a/docs/hooks/error-handling.md
+++ b/docs/hooks/error-handling.md
@@ -84,7 +84,7 @@ type ErrorOccurredHandler func(
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public delegate Task ErrorOccurredHandler(
ErrorOccurredHookInput input,
@@ -226,7 +226,7 @@ session, _ := client.CreateSession(context.Background(), &copilot.SessionConfig{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class ErrorHandlingExample
{
diff --git a/docs/hooks/hooks-overview.md b/docs/hooks/hooks-overview.md
index a5f5981f4..460813c26 100644
--- a/docs/hooks/hooks-overview.md
+++ b/docs/hooks/hooks-overview.md
@@ -124,7 +124,7 @@ func main() {
.NET
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
var client = new CopilotClient();
diff --git a/docs/hooks/post-tool-use.md b/docs/hooks/post-tool-use.md
index 47262415f..f3c6f6799 100644
--- a/docs/hooks/post-tool-use.md
+++ b/docs/hooks/post-tool-use.md
@@ -84,7 +84,7 @@ type PostToolUseHandler func(
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public delegate Task PostToolUseHandler(
PostToolUseHookInput input,
@@ -219,7 +219,7 @@ session, _ := client.CreateSession(context.Background(), &copilot.SessionConfig{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class PostToolUseExample
{
diff --git a/docs/hooks/pre-tool-use.md b/docs/hooks/pre-tool-use.md
index e3509dd0a..6e568d8a2 100644
--- a/docs/hooks/pre-tool-use.md
+++ b/docs/hooks/pre-tool-use.md
@@ -84,7 +84,7 @@ type PreToolUseHandler func(
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public delegate Task PreToolUseHandler(
PreToolUseHookInput input,
@@ -228,7 +228,7 @@ session, _ := client.CreateSession(context.Background(), &copilot.SessionConfig{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class PreToolUseExample
{
diff --git a/docs/hooks/session-lifecycle.md b/docs/hooks/session-lifecycle.md
index b4ff502d5..83b75a32f 100644
--- a/docs/hooks/session-lifecycle.md
+++ b/docs/hooks/session-lifecycle.md
@@ -88,7 +88,7 @@ type SessionStartHandler func(
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public delegate Task SessionStartHandler(
SessionStartHookInput input,
diff --git a/docs/hooks/user-prompt-submitted.md b/docs/hooks/user-prompt-submitted.md
index d5965f4a1..79e34249d 100644
--- a/docs/hooks/user-prompt-submitted.md
+++ b/docs/hooks/user-prompt-submitted.md
@@ -84,7 +84,7 @@ type UserPromptSubmittedHandler func(
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public delegate Task UserPromptSubmittedHandler(
UserPromptSubmittedHookInput input,
@@ -209,7 +209,7 @@ session, _ := client.CreateSession(context.Background(), &copilot.SessionConfig{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class UserPromptSubmittedExample
{
diff --git a/docs/integrations/microsoft-agent-framework.md b/docs/integrations/microsoft-agent-framework.md
index 4da47104c..1802ddd4b 100644
--- a/docs/integrations/microsoft-agent-framework.md
+++ b/docs/integrations/microsoft-agent-framework.md
@@ -74,7 +74,7 @@ Wrap the Copilot SDK client as a MAF agent with a single method call. The result
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Agents.AI;
await using var copilotClient = new CopilotClient();
@@ -146,7 +146,7 @@ Extend your Copilot agent with custom function tools. Tools defined through the
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Extensions.AI;
using Microsoft.Agents.AI;
@@ -282,7 +282,7 @@ Run agents one after another, passing output from one to the next:
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Orchestration;
@@ -395,7 +395,7 @@ Run multiple agents in parallel and aggregate their results:
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Orchestration;
@@ -472,7 +472,7 @@ When building interactive applications, stream agent responses to show real-time
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Agents.AI;
await using var copilotClient = new CopilotClient();
diff --git a/docs/setup/backend-services.md b/docs/setup/backend-services.md
index 655453667..d9dd508e5 100644
--- a/docs/setup/backend-services.md
+++ b/docs/setup/backend-services.md
@@ -215,15 +215,14 @@ response, _ := session.SendAndWait(ctx, copilot.MessageOptions{Prompt: message})
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
var userId = "user1";
var message = "Hello";
var client = new CopilotClient(new CopilotClientOptions
{
- CliUrl = "localhost:4321",
- UseStdio = false,
+ Connection = RuntimeConnection.ForUri("localhost:4321"),
});
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -240,8 +239,7 @@ var response = await session.SendAndWaitAsync(
```csharp
var client = new CopilotClient(new CopilotClientOptions
{
- CliUrl = "localhost:4321",
- UseStdio = false,
+ Connection = RuntimeConnection.ForUri("localhost:4321"),
});
await using var session = await client.CreateSessionAsync(new SessionConfig
diff --git a/docs/setup/github-oauth.md b/docs/setup/github-oauth.md
index 31a3b9001..6cba4a5b7 100644
--- a/docs/setup/github-oauth.md
+++ b/docs/setup/github-oauth.md
@@ -230,12 +230,12 @@ response, _ := session.SendAndWait(ctx, copilot.MessageOptions{Prompt: "Hello!"}
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
CopilotClient CreateClientForUser(string userToken) =>
new CopilotClient(new CopilotClientOptions
{
- GithubToken = userToken,
+ GitHubToken = userToken,
UseLoggedInUser = false,
});
@@ -257,7 +257,7 @@ var response = await session.SendAndWaitAsync(
CopilotClient CreateClientForUser(string userToken) =>
new CopilotClient(new CopilotClientOptions
{
- GithubToken = userToken,
+ GitHubToken = userToken,
UseLoggedInUser = false,
});
diff --git a/docs/setup/local-cli.md b/docs/setup/local-cli.md
index 28bef7b20..e7da4d937 100644
--- a/docs/setup/local-cli.md
+++ b/docs/setup/local-cli.md
@@ -139,7 +139,7 @@ if response != nil {
```csharp
var client = new CopilotClient(new CopilotClientOptions
{
- CliPath = "/usr/local/bin/copilot",
+ Connection = RuntimeConnection.ForStdio(path: "/usr/local/bin/copilot"),
});
await using var session = await client.CreateSessionAsync(
diff --git a/docs/troubleshooting/debugging.md b/docs/troubleshooting/debugging.md
index 7092899fd..f01beafc7 100644
--- a/docs/troubleshooting/debugging.md
+++ b/docs/troubleshooting/debugging.md
@@ -73,7 +73,7 @@ client := copilot.NewClient(&copilot.ClientOptions{
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
using Microsoft.Extensions.Logging;
// Using ILogger
@@ -164,7 +164,7 @@ func main() {
```csharp
var client = new CopilotClient(new CopilotClientOptions
{
- CliArgs = new[] { "--log-dir", "/path/to/logs" }
+ Connection = RuntimeConnection.ForStdio(args: new[] { "--log-dir", "/path/to/logs" })
});
```
diff --git a/docs/troubleshooting/mcp-debugging.md b/docs/troubleshooting/mcp-debugging.md
index eb98eb1bd..664826c6e 100644
--- a/docs/troubleshooting/mcp-debugging.md
+++ b/docs/troubleshooting/mcp-debugging.md
@@ -236,7 +236,7 @@ cd /expected/working/dir
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class McpDotnetConfigExample
{
@@ -248,14 +248,14 @@ public static class McpDotnetConfigExample
{
Command = @"C:\Tools\MyServer\MyServer.exe",
Args = new List(),
- Cwd = @"C:\Tools\MyServer",
+ WorkingDirectory = @"C:\Tools\MyServer",
Tools = new List { "*" },
},
["my-dotnet-tool"] = new McpStdioServerConfig
{
Command = "dotnet",
Args = new List { @"C:\Tools\MyTool\MyTool.dll" },
- Cwd = @"C:\Tools\MyTool",
+ WorkingDirectory = @"C:\Tools\MyTool",
Tools = new List { "*" },
}
};
@@ -269,7 +269,7 @@ public static class McpDotnetConfigExample
{
Command = @"C:\Tools\MyServer\MyServer.exe", // Full path with .exe
Args = new List(),
- Cwd = @"C:\Tools\MyServer", // Set working directory
+ WorkingDirectory = @"C:\Tools\MyServer", // Set working directory
Tools = new List { "*" },
}
@@ -278,7 +278,7 @@ public static class McpDotnetConfigExample
{
Command = "dotnet",
Args = new List { @"C:\Tools\MyTool\MyTool.dll" },
- Cwd = @"C:\Tools\MyTool",
+ WorkingDirectory = @"C:\Tools\MyTool",
Tools = new List { "*" },
}
```
@@ -287,7 +287,7 @@ public static class McpDotnetConfigExample
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
public static class McpNpxConfigExample
{
diff --git a/dotnet/README.md b/dotnet/README.md
index 012c51c17..f01d87474 100644
--- a/dotnet/README.md
+++ b/dotnet/README.md
@@ -1,4 +1,4 @@
-# Copilot SDK
+# Copilot SDK
SDK for programmatic control of GitHub Copilot CLI.
@@ -7,7 +7,7 @@ SDK for programmatic control of GitHub Copilot CLI.
## Installation
```bash
-dotnet add package GitHub.Copilot.SDK
+dotnet add package GitHub.Copilot
```
## Run the Samples
@@ -27,7 +27,7 @@ dotnet run --file dotnet/samples/ManualToolResume.cs
## Quick Start
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
// Create and start client
await using var client = new CopilotClient();
@@ -43,7 +43,7 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
// Wait for the response using the session.idle event
var done = new TaskCompletionSource();
-session.On(evt =>
+session.On(evt =>
{
if (evt is AssistantMessageEvent msg)
{
@@ -72,20 +72,24 @@ new CopilotClient(CopilotClientOptions? options = null)
**Options:**
-- `CliPath` - Path to CLI executable (default: `COPILOT_CLI_PATH` env var, or bundled CLI)
-- `CliArgs` - Extra arguments prepended before SDK-managed flags
-- `CliUrl` - URL of existing CLI server to connect to (e.g., `"localhost:8080"`). When provided, the client will not spawn a CLI process.
-- `Port` - Server port (default: 0 for random)
-- `UseStdio` - Use stdio transport instead of TCP (default: true)
-- `LogLevel` - Log level (default: "info")
-- `AutoStart` - Auto-start server (default: true)
-- `Cwd` - Working directory for the CLI process
-- `CopilotHome` - Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned CLI process. When not set, the CLI defaults to `~/.copilot`. Useful in restricted environments where only specific directories are writable. Ignored when using `CliUrl`.
-- `Environment` - Environment variables to pass to the CLI process
-- `Logger` - `ILogger` instance for SDK logging
+- `Connection` - How to connect to the Copilot runtime. Defaults to `null` (equivalent to `RuntimeConnection.ForStdio()` with the bundled runtime). See "RuntimeConnection" below.
+- `LogLevel` - Runtime log level. Accepts well-known values `CopilotLogLevel.None`, `Error`, `Warning`, `Info`, `Debug`, `All`. Defaults to null (the runtime's own default).
+- `WorkingDirectory` - Working directory for the runtime process.
+- `BaseDirectory` - Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime process. When not set, the runtime defaults to `~/.copilot`. Useful in restricted environments where only specific directories are writable. Ignored when connecting via `RuntimeConnection.ForUri(...)`.
+- `EnableRemoteSessions` - Enables remote-session features.
+- `Environment` - Environment variables to pass to the runtime process.
+- `Logger` - `ILogger` instance for SDK logging.
- `GitHubToken` - GitHub token for authentication. When provided, takes priority over other auth methods.
-- `UseLoggedInUser` - Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `CliUrl`.
-- `Telemetry` - OpenTelemetry configuration for the CLI process. Providing this enables telemetry — no separate flag needed. See [Telemetry](#telemetry) below.
+- `UseLoggedInUser` - Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `RuntimeConnection.ForUri(...)`.
+- `Telemetry` - OpenTelemetry configuration for the runtime process. Providing this enables telemetry — no separate flag needed. See [Telemetry](#telemetry) below.
+
+#### RuntimeConnection
+
+`CopilotClientOptions.Connection` describes how the SDK reaches a Copilot runtime. There are three flavors, all constructed via static factories:
+
+- `RuntimeConnection.ForStdio(path?, args?)` — spawns the runtime as a child process and communicates over stdio. This is the default when `Connection` is null.
+- `RuntimeConnection.ForTcp(port = 0, connectionToken?, path?, args?)` — spawns the runtime as a child process listening on a TCP port. `port = 0` auto-allocates; if a non-zero port is already in use, startup fails (no fallback). Use `CopilotClient.RuntimePort` after `StartAsync` to read the assigned port. `connectionToken` is required if other clients will connect via `RuntimeConnection.ForUri(...)`.
+- `RuntimeConnection.ForUri(url, connectionToken?)` — connects to an already-running runtime at `url` (e.g., `"localhost:8080"`). Does not spawn a process.
#### Methods
@@ -153,23 +157,19 @@ Get the ID of the session currently displayed in the TUI. Only available when co
Request the TUI to switch to displaying the specified session. Only available in TUI+server mode.
-##### `On(Action handler): IDisposable`
+##### `OnLifecycle(Action handler): IDisposable where T : SessionLifecycleEvent`
-Subscribe to all session lifecycle events. Returns an `IDisposable` that unsubscribes when disposed.
+Subscribe to session lifecycle events. Pass a derived type to filter by kind, or `SessionLifecycleEvent` to receive every lifecycle event. Returns an `IDisposable` that unsubscribes when disposed.
```csharp
-using var subscription = client.On(evt =>
+// Receive every lifecycle event:
+using var subscription = client.OnLifecycle(evt =>
{
Console.WriteLine($"Session {evt.SessionId}: {evt.Type}");
});
-```
-##### `On(string eventType, Action handler): IDisposable`
-
-Subscribe to a specific lifecycle event type. Use `SessionLifecycleEventTypes` constants.
-
-```csharp
-using var subscription = client.On(SessionLifecycleEventTypes.Foreground, evt =>
+// Only receive foreground events:
+using var foreground = client.OnLifecycle(evt =>
{
Console.WriteLine($"Session {evt.SessionId} is now in foreground");
});
@@ -177,11 +177,11 @@ using var subscription = client.On(SessionLifecycleEventTypes.Foreground, evt =>
**Lifecycle Event Types:**
-- `SessionLifecycleEventTypes.Created` - A new session was created
-- `SessionLifecycleEventTypes.Deleted` - A session was deleted
-- `SessionLifecycleEventTypes.Updated` - A session was updated
-- `SessionLifecycleEventTypes.Foreground` - A session became the foreground session in TUI
-- `SessionLifecycleEventTypes.Background` - A session is no longer the foreground session
+- `SessionCreatedEvent` — A new session was created
+- `SessionDeletedEvent` — A session was deleted
+- `SessionUpdatedEvent` — A session was updated
+- `SessionForegroundEvent` — A session became the foreground session in TUI
+- `SessionBackgroundEvent` — A session is no longer the foreground session
---
@@ -208,12 +208,12 @@ Send a message to the session.
Returns the message ID.
-##### `On(SessionEventHandler handler): IDisposable`
+##### `On(Action handler): IDisposable`
Subscribe to session events. Returns a disposable to unsubscribe.
```csharp
-var subscription = session.On(evt =>
+var subscription = session.On(evt =>
{
Console.WriteLine($"Event: {evt.Type}");
});
@@ -226,7 +226,7 @@ subscription.Dispose();
Abort the currently processing message in this session.
-##### `GetMessagesAsync(): Task>`
+##### `GetEventsAsync(): Task>`
Get all events/messages from this session.
@@ -262,7 +262,7 @@ Sessions emit various events during processing. Each event type is a class that
Use pattern matching to handle specific event types:
```csharp
-session.On(evt =>
+session.On(evt =>
{
switch (evt)
{
@@ -330,7 +330,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
// Use TaskCompletionSource to wait for completion
var done = new TaskCompletionSource();
-session.On(evt =>
+session.On(evt =>
{
switch (evt)
{
@@ -558,7 +558,7 @@ if (session.Capabilities.Ui?.Elicitation == true)
["production", "staging", "dev"]);
// Text input — returns string or null
- string? name = await session.Ui.InputAsync("Project name:", new InputOptions
+ string? name = await session.Ui.InputAsync("Project name:", new UiInputOptions
{
Title = "Name",
MinLength = 1,
@@ -566,7 +566,7 @@ if (session.Capabilities.Ui?.Elicitation == true)
});
// Generic elicitation with full schema control
- ElicitationResult result = await session.Ui.ElicitationAsync(new ElicitationParams
+ ElicitationResult result = await session.Ui.ElicitAsync(new ElicitationParams
{
Message = "Configure deployment",
RequestedSchema = new ElicitationSchema
@@ -738,7 +738,7 @@ An `OnPermissionRequest` handler is optional when you create or resume a session
Use the built-in `PermissionHandler.ApproveAll` helper to allow every tool call without any checks:
```csharp
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
var session = await client.CreateSessionAsync(new SessionConfig
{
@@ -749,7 +749,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
### Custom Permission Handler
-Provide your own `PermissionRequestHandler` delegate to inspect each request and apply custom logic:
+Provide your own permission handler (`Func>`) to inspect each request and apply custom logic:
```csharp
var session = await client.CreateSessionAsync(new SessionConfig
@@ -987,7 +987,7 @@ catch (Exception ex)
## Requirements
- .NET 8.0 or later
-- GitHub Copilot CLI installed and in PATH (or provide custom `CliPath`)
+- GitHub Copilot CLI installed and in PATH (or provide custom `Connection = RuntimeConnection.ForStdio(path: ...)`)
## License
diff --git a/dotnet/samples/Chat.cs b/dotnet/samples/Chat.cs
index 6345dd05c..f748a4005 100644
--- a/dotnet/samples/Chat.cs
+++ b/dotnet/samples/Chat.cs
@@ -1,6 +1,6 @@
#:project ../src/GitHub.Copilot.SDK.csproj
-using GitHub.Copilot.SDK;
+using GitHub.Copilot;
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
@@ -8,7 +8,7 @@
OnPermissionRequest = PermissionHandler.ApproveAll
});
-using var _ = session.On(evt =>
+using var _ = session.On(evt =>
{
Console.ForegroundColor = ConsoleColor.Blue;
switch (evt)
diff --git a/dotnet/samples/ManualToolResume.cs b/dotnet/samples/ManualToolResume.cs
index 7658dde11..becda7444 100644
--- a/dotnet/samples/ManualToolResume.cs
+++ b/dotnet/samples/ManualToolResume.cs
@@ -1,8 +1,8 @@
#:project ../src/GitHub.Copilot.SDK.csproj
using System.ComponentModel;
-using GitHub.Copilot.SDK;
-using GitHub.Copilot.SDK.Rpc;
+using GitHub.Copilot;
+using GitHub.Copilot.Rpc;
using Microsoft.Extensions.AI;
var tool = ManualToolDeclaration();
@@ -80,7 +80,7 @@ static async Task WaitForEventAsync(CopilotSession session, Func?
{
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
IDisposable? subscription = null;
- subscription = session.On(evt =>
+ subscription = session.On(evt =>
{
if (evt is T typed && (predicate?.Invoke(typed) ?? true))
{
diff --git a/dotnet/src/ActionDisposable.cs b/dotnet/src/ActionDisposable.cs
index 815904c12..86230651e 100644
--- a/dotnet/src/ActionDisposable.cs
+++ b/dotnet/src/ActionDisposable.cs
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
///
/// A disposable that invokes an action when disposed.
diff --git a/dotnet/src/Client.cs b/dotnet/src/Client.cs
index f314a519b..11f8c90c9 100644
--- a/dotnet/src/Client.cs
+++ b/dotnet/src/Client.cs
@@ -1,8 +1,8 @@
-/*---------------------------------------------------------------------------------------------
+/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
-using GitHub.Copilot.SDK.Rpc;
+using GitHub.Copilot.Rpc;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
@@ -17,7 +17,7 @@
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
///
/// Provides a client for interacting with the Copilot CLI server.
@@ -41,7 +41,7 @@ namespace GitHub.Copilot.SDK;
/// await using var session = await client.CreateSessionAsync(new() { OnPermissionRequest = PermissionHandler.ApproveAll, Model = "gpt-4" });
///
/// // Handle events
-/// using var subscription = session.On(evt =>
+/// using var subscription = session.On<SessionEvent>(evt =>
/// {
/// if (evt is AssistantMessageEvent assistantMessage)
/// Console.WriteLine(assistantMessage.Data?.Content);
@@ -71,28 +71,28 @@ public sealed partial class CopilotClient : IDisposable, IAsyncDisposable
internal readonly ConcurrentDictionary _sessions = new();
private readonly CopilotClientOptions _options;
+ private readonly RuntimeConnection _connection;
private readonly ILogger _logger;
private Task? _connectionTask;
- private volatile bool _disconnected;
private bool _disposed;
private readonly int? _optionsPort;
private readonly string? _optionsHost;
- private readonly string? _effectiveConnectionToken;
private int? _actualPort;
private int? _negotiatedProtocolVersion;
private List? _modelsCache;
private readonly SemaphoreSlim _modelsCacheLock = new(1, 1);
private readonly Func>>? _onListModels;
- private readonly List> _lifecycleHandlers = [];
- private readonly Dictionary>> _typedLifecycleHandlers = [];
+ private readonly List _lifecycleHandlers = [];
private readonly object _lifecycleHandlersLock = new();
private ServerRpc? _serverRpc;
+ private sealed record LifecycleSubscription(Type EventType, Action Handler);
+
///
/// Gets the typed RPC client for server-scoped methods (no session required).
///
///
- /// The client must be started before accessing this property. Use or set to true.
+ /// The client must be started before accessing this property. Call before use.
///
/// Thrown if the client has been disposed.
/// Thrown if the client is not started.
@@ -101,91 +101,77 @@ public sealed partial class CopilotClient : IDisposable, IAsyncDisposable
: _serverRpc ?? throw new InvalidOperationException("Client is not started. Call StartAsync first.");
///
- /// Gets the actual TCP port the CLI server is listening on, if using TCP transport.
+ /// Gets the actual TCP port the runtime is listening on, if using TCP transport.
///
- public int? ActualPort => _actualPort;
+ public int? RuntimePort => _actualPort;
///
/// Creates a new instance of .
///
/// Options for creating the client. If null, default options are used.
- /// Thrown when mutually exclusive options are provided (e.g., CliUrl with UseStdio or CliPath).
///
///
- /// // Default options - spawns CLI server using stdio
+ /// // Default options - spawns the bundled runtime using stdio
/// var client = new CopilotClient();
///
- /// // Connect to an existing server
- /// var client = new CopilotClient(new CopilotClientOptions { CliUrl = "localhost:3000", UseStdio = false });
+ /// // Connect to an existing runtime
+ /// var client = new CopilotClient(new CopilotClientOptions { Connection = RuntimeConnection.ForUri("localhost:3000") });
///
- /// // Custom CLI path with specific log level
+ /// // Custom runtime path with specific log level
/// var client = new CopilotClient(new CopilotClientOptions
/// {
- /// CliPath = "/usr/local/bin/copilot",
- /// LogLevel = "debug"
+ /// Connection = RuntimeConnection.ForStdio(path: "/usr/local/bin/copilot"),
+ /// LogLevel = CopilotLogLevel.Debug
/// });
///
///
public CopilotClient(CopilotClientOptions? options = null)
{
_options = options ?? new();
+ _connection = _options.Connection ?? RuntimeConnection.ForStdio();
- // Validate mutually exclusive options
- if (!string.IsNullOrEmpty(_options.CliUrl) && (_options.UseStdio == true || _options.CliPath != null))
+ switch (_connection)
{
- throw new ArgumentException("CliUrl is mutually exclusive with UseStdio and CliPath");
- }
+ case StdioRuntimeConnection:
+ break;
- // When CliUrl is provided, force TCP mode (we connect to an external server, not spawn one)
- if (!string.IsNullOrEmpty(_options.CliUrl))
- {
- _options.UseStdio = false;
- }
- else
- {
- _options.UseStdio ??= true;
- }
+ case TcpRuntimeConnection tcp:
+ if (tcp.ConnectionToken is { Length: 0 })
+ {
+ throw new ArgumentException("ConnectionToken must be a non-empty string or null.", nameof(options));
+ }
+ // Auto-generate a connection token when the SDK spawns the runtime over TCP
+ // so the loopback listener is safe by default.
+ tcp.ConnectionToken ??= Guid.NewGuid().ToString();
+ break;
- // Validate auth options with external server
- if (!string.IsNullOrEmpty(_options.CliUrl) && (!string.IsNullOrEmpty(_options.GitHubToken) || _options.UseLoggedInUser != null))
- {
- throw new ArgumentException("GitHubToken and UseLoggedInUser cannot be used with CliUrl (external server manages its own auth)");
- }
+ case UriRuntimeConnection uri:
+ if (string.IsNullOrEmpty(uri.Url))
+ {
+ throw new ArgumentException("UriRuntimeConnection.Url must be a non-empty string.", nameof(options));
+ }
+ if (!string.IsNullOrEmpty(_options.GitHubToken) || _options.UseLoggedInUser != null)
+ {
+ throw new ArgumentException("GitHubToken and UseLoggedInUser cannot be combined with RuntimeConnection.ForUri (the existing runtime manages its own auth).", nameof(options));
+ }
+ var parsed = ParseRuntimeUrl(uri.Url);
+ _optionsHost = parsed.Host;
+ _optionsPort = parsed.Port;
+ break;
- if (_options.TcpConnectionToken is not null)
- {
- if (_options.TcpConnectionToken.Length == 0)
- {
- throw new ArgumentException("TcpConnectionToken must be a non-empty string");
- }
- if (_options.UseStdio == true)
- {
- throw new ArgumentException("TcpConnectionToken cannot be used with UseStdio = true");
- }
+ default:
+ throw new ArgumentException($"Unsupported RuntimeConnection type: {_connection.GetType().Name}", nameof(options));
}
- var sdkSpawnsCli = _options.UseStdio == false && string.IsNullOrEmpty(_options.CliUrl);
- _effectiveConnectionToken = _options.TcpConnectionToken
- ?? (sdkSpawnsCli ? Guid.NewGuid().ToString() : null);
-
_logger = _options.Logger ?? NullLogger.Instance;
_onListModels = _options.OnListModels;
-
- // Parse CliUrl if provided
- if (!string.IsNullOrEmpty(_options.CliUrl))
- {
- var uri = ParseCliUrl(_options.CliUrl!);
- _optionsHost = uri.Host;
- _optionsPort = uri.Port;
- }
}
///
- /// Parses a CLI URL into a URI with host and port.
+ /// Parses a runtime URL into a URI with host and port.
///
/// The URL to parse. Supports formats: "port", "host:port", "http://host:port".
- /// A containing the parsed host and port.
- private static Uri ParseCliUrl(string url)
+ private static Uri ParseRuntimeUrl(string url)
{
// If it's just a port number, treat as localhost
if (int.TryParse(url, out var port))
@@ -209,17 +195,12 @@ private static Uri ParseCliUrl(string url)
/// A that can be used to cancel the operation.
/// A representing the asynchronous operation.
///
- ///
/// If the server is not already running and the client is configured to spawn one (default), it will be started.
- /// If connecting to an external server (via CliUrl), only establishes the connection.
- ///
- ///
- /// This method is called automatically when creating a session if is true (default).
- ///
+ /// If connecting to an external runtime (via RuntimeConnection.ForUri), only establishes the connection.
///
///
///
- /// var client = new CopilotClient(new CopilotClientOptions { AutoStart = false });
+ /// var client = new CopilotClient();
/// await client.StartAsync();
/// // Now ready to create sessions
///
@@ -231,7 +212,6 @@ public Task StartAsync(CancellationToken cancellationToken = default)
async Task StartCoreAsync(CancellationToken ct)
{
_logger.LogDebug("Starting Copilot client");
- _disconnected = false;
var startTimestamp = Stopwatch.GetTimestamp();
Connection? connection = null;
@@ -239,16 +219,16 @@ async Task StartCoreAsync(CancellationToken ct)
try
{
- if (_optionsHost is not null && _optionsPort is not null)
+ if (_connection is UriRuntimeConnection)
{
- // External server (TCP)
+ // External runtime
_actualPort = _optionsPort;
connection = await ConnectToServerAsync(null, _optionsHost, _optionsPort, null, ct);
}
else
{
// Child process (stdio or TCP)
- var (startedProcess, portOrNull, stderrBuffer) = await StartCliServerAsync(_options, _effectiveConnectionToken, _logger, ct);
+ var (startedProcess, portOrNull, stderrBuffer) = await StartCliServerAsync(ct);
cliProcess = startedProcess;
_actualPort = portOrNull;
connection = await ConnectToServerAsync(cliProcess, portOrNull is null ? null : "localhost", portOrNull, stderrBuffer, ct);
@@ -522,7 +502,7 @@ private static (SystemMessageConfig? wireConfig, DictionaryA task that resolves to provide the .
///
/// Sessions maintain conversation state, handle events, and manage tool execution.
- /// If the client is not connected and is enabled (default),
+ /// If the client is not connected,
/// this will automatically start the connection.
///
///
@@ -570,8 +550,8 @@ public async Task CreateSessionAsync(SessionConfig config, Cance
session.RegisterPermissionHandler(config.OnPermissionRequest);
session.RegisterCommands(config.Commands);
session.RegisterElicitationHandler(config.OnElicitationRequest);
- session.RegisterExitPlanModeHandler(config.OnExitPlanMode);
- session.RegisterAutoModeSwitchHandler(config.OnAutoModeSwitch);
+ session.RegisterExitPlanModeHandler(config.OnExitPlanModeRequest);
+ session.RegisterAutoModeSwitchHandler(config.OnAutoModeSwitchRequest);
if (config.OnUserInputRequest != null)
{
session.RegisterUserInputHandler(config.OnUserInputRequest);
@@ -586,9 +566,9 @@ public async Task CreateSessionAsync(SessionConfig config, Cance
}
if (config.OnEvent != null)
{
- session.On(config.OnEvent);
+ session.On(config.OnEvent);
}
- ConfigureSessionFsHandlers(session, config.CreateSessionFsHandler);
+ ConfigureSessionFsHandlers(session, config.CreateSessionFsProvider);
RegisterSession(session);
session.StartProcessingEvents();
LoggingHelpers.LogTiming(_logger, LogLevel.Debug, null,
@@ -616,8 +596,8 @@ public async Task CreateSessionAsync(SessionConfig config, Cance
config.EnableSessionTelemetry,
(bool?)true,
config.OnUserInputRequest != null ? true : null,
- config.OnExitPlanMode != null ? true : null,
- config.OnAutoModeSwitch != null ? true : null,
+ config.OnExitPlanModeRequest != null ? true : null,
+ config.OnAutoModeSwitchRequest != null ? true : null,
hasHooks ? true : null,
config.WorkingDirectory,
config.Streaming is true ? true : null,
@@ -728,8 +708,8 @@ public async Task ResumeSessionAsync(string sessionId, ResumeSes
session.RegisterPermissionHandler(config.OnPermissionRequest);
session.RegisterCommands(config.Commands);
session.RegisterElicitationHandler(config.OnElicitationRequest);
- session.RegisterExitPlanModeHandler(config.OnExitPlanMode);
- session.RegisterAutoModeSwitchHandler(config.OnAutoModeSwitch);
+ session.RegisterExitPlanModeHandler(config.OnExitPlanModeRequest);
+ session.RegisterAutoModeSwitchHandler(config.OnAutoModeSwitchRequest);
if (config.OnUserInputRequest != null)
{
session.RegisterUserInputHandler(config.OnUserInputRequest);
@@ -744,9 +724,9 @@ public async Task ResumeSessionAsync(string sessionId, ResumeSes
}
if (config.OnEvent != null)
{
- session.On(config.OnEvent);
+ session.On(config.OnEvent);
}
- ConfigureSessionFsHandlers(session, config.CreateSessionFsHandler);
+ ConfigureSessionFsHandlers(session, config.CreateSessionFsProvider);
RegisterSession(session);
session.StartProcessingEvents();
LoggingHelpers.LogTiming(_logger, LogLevel.Debug, null,
@@ -774,13 +754,13 @@ public async Task ResumeSessionAsync(string sessionId, ResumeSes
config.EnableSessionTelemetry,
(bool?)true,
config.OnUserInputRequest != null ? true : null,
- config.OnExitPlanMode != null ? true : null,
- config.OnAutoModeSwitch != null ? true : null,
+ config.OnExitPlanModeRequest != null ? true : null,
+ config.OnAutoModeSwitchRequest != null ? true : null,
hasHooks ? true : null,
config.WorkingDirectory,
config.ConfigDir,
config.EnableConfigDiscovery,
- config.DisableResume is true ? true : null,
+ config.SuppressResumeEvent is true ? true : null,
config.Streaming is true ? true : null,
config.IncludeSubAgentStreamingEvents,
config.McpServers,
@@ -832,32 +812,6 @@ public async Task ResumeSessionAsync(string sessionId, ResumeSes
return session;
}
- ///
- /// Gets the current connection state of the client.
- ///
- ///
- /// The current : Disconnected, Connecting, Connected, or Error.
- ///
- ///
- ///
- /// if (client.State == ConnectionState.Connected)
- /// {
- /// var session = await client.CreateSessionAsync(new() { OnPermissionRequest = PermissionHandler.ApproveAll });
- /// }
- ///
- ///
- public ConnectionState State
- {
- get
- {
- if (_connectionTask == null) return ConnectionState.Disconnected;
- if (_connectionTask.IsFaulted) return ConnectionState.Error;
- if (!_connectionTask.IsCompleted) return ConnectionState.Connecting;
- if (_disconnected) return ConnectionState.Disconnected;
- return ConnectionState.Connected;
- }
- }
-
///
/// Validates the health of the connection by sending a ping request.
///
@@ -1130,103 +1084,59 @@ public async Task SetForegroundSessionIdAsync(string sessionId, CancellationToke
}
///
- /// Subscribes to all session lifecycle events.
- ///
- ///
- /// Lifecycle events are emitted when sessions are created, deleted, updated,
- /// or change foreground/background state (in TUI+server mode).
- ///
- /// A callback function that receives lifecycle events.
- /// An IDisposable that, when disposed, unsubscribes the handler.
- ///
- ///
- /// using var subscription = client.On(evt =>
- /// {
- /// Console.WriteLine($"Session {evt.SessionId}: {evt.Type}");
- /// });
- ///
- ///
- public IDisposable On(Action handler)
- {
- ArgumentNullException.ThrowIfNull(handler);
-
- lock (_lifecycleHandlersLock)
- {
- _lifecycleHandlers.Add(handler);
- }
-
- return new ActionDisposable(() =>
- {
- lock (_lifecycleHandlersLock)
- {
- _lifecycleHandlers.Remove(handler);
- }
- });
- }
-
- ///
- /// Subscribes to a specific session lifecycle event type.
+ /// Subscribes to session lifecycle events of a specific kind.
///
- /// The event type to listen for (use SessionLifecycleEventTypes constants).
- /// A callback function that receives events of the specified type.
- /// An IDisposable that, when disposed, unsubscribes the handler.
+ ///
+ /// The lifecycle event type to listen for. Pass a derived type such as
+ /// to filter by kind, or
+ /// to receive every lifecycle event.
+ ///
+ /// A callback invoked when a matching lifecycle event arrives.
+ /// An that, when disposed, unsubscribes the handler.
///
///
- /// using var subscription = client.On(SessionLifecycleEventTypes.Foreground, evt =>
+ /// using var sub = client.OnLifecycle<SessionForegroundEvent>(evt =>
/// {
/// Console.WriteLine($"Session {evt.SessionId} is now in foreground");
/// });
///
///
- public IDisposable On(string eventType, Action handler)
+ public IDisposable OnLifecycle(Action handler) where T : SessionLifecycleEvent
{
- ArgumentNullException.ThrowIfNull(eventType);
ArgumentNullException.ThrowIfNull(handler);
+ var subscription = new LifecycleSubscription(typeof(T), evt => handler((T)evt));
+
lock (_lifecycleHandlersLock)
{
- if (!_typedLifecycleHandlers.TryGetValue(eventType, out var handlers))
- {
- handlers = [];
- _typedLifecycleHandlers[eventType] = handlers;
- }
-
- handlers.Add(handler);
+ _lifecycleHandlers.Add(subscription);
}
return new ActionDisposable(() =>
{
lock (_lifecycleHandlersLock)
{
- if (_typedLifecycleHandlers.TryGetValue(eventType, out var handlers))
- {
- handlers.Remove(handler);
- }
+ _lifecycleHandlers.Remove(subscription);
}
});
}
private void DispatchLifecycleEvent(SessionLifecycleEvent evt)
{
- List> typedHandlers;
- List> wildcardHandlers;
-
+ List snapshot;
lock (_lifecycleHandlersLock)
{
- typedHandlers = _typedLifecycleHandlers.TryGetValue(evt.Type, out var handlers)
- ? [.. handlers]
- : [];
- wildcardHandlers = [.. _lifecycleHandlers];
- }
-
- foreach (var handler in typedHandlers)
- {
- try { handler(evt); } catch { /* Ignore handler errors */ }
+ snapshot = [.. _lifecycleHandlers];
}
- foreach (var handler in wildcardHandlers)
+ var eventType = evt.GetType();
+ foreach (var subscription in snapshot)
{
- try { handler(evt); } catch { /* Ignore handler errors */ }
+ if (!subscription.EventType.IsAssignableFrom(eventType))
+ {
+ continue;
+ }
+ try { subscription.Handler(evt); } catch { /* Ignore handler errors */ }
}
}
@@ -1309,11 +1219,6 @@ private static IOException CreateCliExitedException(string message, StringBuilde
private Task EnsureConnectedAsync(CancellationToken cancellationToken)
{
- if (_connectionTask is null && !_options.AutoStart)
- {
- throw new InvalidOperationException($"Client not connected. Call {nameof(StartAsync)}() first.");
- }
-
// If already started or starting, this will return the existing task
return (Task)StartAsync(cancellationToken);
}
@@ -1343,11 +1248,11 @@ private void ConfigureSessionFsHandlers(CopilotSession session, Func tcp.ConnectionToken,
+ UriRuntimeConnection uri => uri.ConnectionToken,
+ _ => null,
+ };
var connectResponse = await InvokeRpcAsync(
- connection.Rpc, "connect", [new ConnectRequest { Token = _effectiveConnectionToken }], connection.StderrBuffer, cancellationToken);
+ connection.Rpc, "connect", [new ConnectRequest { Token = token }], connection.StderrBuffer, cancellationToken);
serverVersion = (int)connectResponse.ProtocolVersion;
}
catch (IOException ex) when (ex.InnerException is RemoteRpcException remoteEx && IsUnsupportedConnectMethod(remoteEx))
@@ -1410,32 +1321,42 @@ private static bool IsUnsupportedConnectMethod(RemoteRpcException ex)
|| string.Equals(ex.Message, "Unhandled method connect", StringComparison.Ordinal);
}
- private static async Task<(Process Process, int? DetectedLocalhostTcpPort, StringBuilder StderrBuffer)> StartCliServerAsync(CopilotClientOptions options, string? connectionToken, ILogger logger, CancellationToken cancellationToken)
+ private async Task<(Process Process, int? DetectedLocalhostTcpPort, StringBuilder StderrBuffer)> StartCliServerAsync(CancellationToken cancellationToken)
{
- // Use explicit path, COPILOT_CLI_PATH env var (from options.Environment or process env), or bundled CLI - no PATH fallback
+ var options = _options;
+ var logger = _logger;
+ var childProcessConnection = (ChildProcessRuntimeConnection)_connection;
+ var tcpConnection = _connection as TcpRuntimeConnection;
+ var useStdio = _connection is StdioRuntimeConnection;
+
+ // Use explicit path, COPILOT_CLI_PATH env var (from options.Environment or process env), or bundled runtime - no PATH fallback
var envCliPath = options.Environment is not null && options.Environment.TryGetValue("COPILOT_CLI_PATH", out var envValue) ? envValue
: System.Environment.GetEnvironmentVariable("COPILOT_CLI_PATH");
- var cliPath = options.CliPath
+ var cliPath = childProcessConnection.Path
?? envCliPath
?? GetBundledCliPath(out var searchedPath)
- ?? throw new InvalidOperationException($"Copilot CLI not found at '{searchedPath}'. Ensure the SDK NuGet package was restored correctly or provide an explicit CliPath.");
- var cliPathSource = options.CliPath is not null ? "Options" : envCliPath is not null ? "Environment" : "Bundled";
+ ?? throw new InvalidOperationException($"Copilot runtime not found at '{searchedPath}'. Ensure the SDK NuGet package was restored correctly or provide an explicit RuntimeConnection.ForStdio(path: ...) / RuntimeConnection.ForTcp(path: ...).");
+ var cliPathSource = childProcessConnection.Path is not null ? "Options" : envCliPath is not null ? "Environment" : "Bundled";
var args = new List();
- if (options.CliArgs != null)
+ if (childProcessConnection.Args != null)
{
- args.AddRange(options.CliArgs);
+ args.AddRange(childProcessConnection.Args);
}
- args.AddRange(["--headless", "--no-auto-update", "--log-level", options.LogLevel]);
+ args.AddRange(["--headless", "--no-auto-update"]);
+ if (options.LogLevel is { } logLevel && !string.IsNullOrEmpty(logLevel.Value))
+ {
+ args.AddRange(["--log-level", logLevel.Value]);
+ }
- if (options.UseStdio == true)
+ if (useStdio)
{
args.Add("--stdio");
}
- else if (options.Port > 0)
+ else if (tcpConnection is { Port: > 0 } tcp)
{
- args.AddRange(["--port", options.Port.ToString(CultureInfo.InvariantCulture)]);
+ args.AddRange(["--port", tcp.Port.ToString(CultureInfo.InvariantCulture)]);
}
// Add auth-related flags
@@ -1456,24 +1377,24 @@ private static bool IsUnsupportedConnectMethod(RemoteRpcException ex)
args.AddRange(["--session-idle-timeout", options.SessionIdleTimeoutSeconds.Value.ToString(CultureInfo.InvariantCulture)]);
}
- if (options.Remote)
+ if (options.EnableRemoteSessions)
{
args.Add("--remote");
}
var (fileName, processArgs) = ResolveCliCommand(cliPath, args);
- var configuredPort = options.UseStdio == true ? (int?)null : options.Port;
- LogStartingCopilotCli(logger, cliPath, fileName, cliPathSource, options.UseStdio == true, configuredPort);
+ var configuredPort = useStdio ? (int?)null : tcpConnection?.Port;
+ LogStartingCopilotCli(logger, cliPath, fileName, cliPathSource, useStdio, configuredPort);
var startInfo = new ProcessStartInfo
{
FileName = fileName,
Arguments = string.Join(" ", processArgs.Select(ProcessArgumentEscaper.Escape)),
UseShellExecute = false,
- RedirectStandardInput = options.UseStdio == true,
+ RedirectStandardInput = useStdio,
RedirectStandardOutput = true,
RedirectStandardError = true,
- WorkingDirectory = options.Cwd,
+ WorkingDirectory = options.WorkingDirectory,
CreateNoWindow = true
};
@@ -1494,14 +1415,14 @@ private static bool IsUnsupportedConnectMethod(RemoteRpcException ex)
startInfo.Environment["COPILOT_SDK_AUTH_TOKEN"] = options.GitHubToken;
}
- if (!string.IsNullOrEmpty(connectionToken))
+ if (tcpConnection?.ConnectionToken is { Length: > 0 } token)
{
- startInfo.Environment["COPILOT_CONNECTION_TOKEN"] = connectionToken;
+ startInfo.Environment["COPILOT_CONNECTION_TOKEN"] = token;
}
- if (!string.IsNullOrEmpty(options.CopilotHome))
+ if (!string.IsNullOrEmpty(options.BaseDirectory))
{
- startInfo.Environment["COPILOT_HOME"] = options.CopilotHome;
+ startInfo.Environment["COPILOT_HOME"] = options.BaseDirectory;
}
// Set telemetry environment variables if configured
@@ -1547,7 +1468,7 @@ private static bool IsUnsupportedConnectMethod(RemoteRpcException ex)
}, cancellationToken);
var detectedLocalhostTcpPort = (int?)null;
- if (options.UseStdio != true)
+ if (!useStdio)
{
// Wait for port announcement
var portWaitTimestamp = Stopwatch.GetTimestamp();
@@ -1560,7 +1481,7 @@ private static bool IsUnsupportedConnectMethod(RemoteRpcException ex)
if (line is null)
{
await stderrReader;
- throw CreateCliExitedException("CLI process exited unexpectedly", stderrBuffer);
+ throw CreateCliExitedException("Runtime process exited unexpectedly", stderrBuffer);
}
if (logger.IsEnabled(LogLevel.Debug))
@@ -1640,11 +1561,11 @@ private async Task ConnectToServerAsync(Process? cliProcess, string?
Stream inputStream, outputStream;
NetworkStream? networkStream = null;
- if (_options.UseStdio == true)
+ if (_connection is StdioRuntimeConnection)
{
if (cliProcess == null)
{
- throw new InvalidOperationException("CLI process not started");
+ throw new InvalidOperationException("Runtime process not started");
}
inputStream = cliProcess.StandardOutput.BaseStream;
@@ -1708,9 +1629,6 @@ private async Task ConnectToServerAsync(Process? cliProcess, string?
"CopilotClient.ConnectToServerAsync transport setup complete. Elapsed={Elapsed}",
setupTimestamp);
- // Transition state to Disconnected if the JSON-RPC connection drops
- _ = rpc.Completion.ContinueWith(_ => _disconnected = true, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
-
_serverRpc = new ServerRpc(rpc);
return new Connection(rpc, cliProcess, networkStream, stderrBuffer);
@@ -1730,7 +1648,7 @@ private static JsonSerializerOptions CreateSerializerOptions()
options.TypeInfoResolverChain.Add(TypesJsonContext.Default);
options.TypeInfoResolverChain.Add(CopilotSession.SessionJsonContext.Default);
options.TypeInfoResolverChain.Add(SessionEventsJsonContext.Default);
- options.TypeInfoResolverChain.Add(SDK.Rpc.RpcJsonContext.Default);
+ options.TypeInfoResolverChain.Add(GitHub.Copilot.Rpc.RpcJsonContext.Default);
options.MakeReadOnly();
@@ -1798,13 +1716,19 @@ public void OnSessionEvent(string sessionId, JsonElement? @event)
public void OnSessionLifecycle(string type, string sessionId, JsonElement? metadata)
{
- var evt = new SessionLifecycleEvent
+ SessionLifecycleEvent evt = type switch
{
- Type = type,
- SessionId = sessionId
+ "session.created" => new SessionCreatedEvent(),
+ "session.deleted" => new SessionDeletedEvent(),
+ "session.updated" => new SessionUpdatedEvent(),
+ "session.foreground" => new SessionForegroundEvent(),
+ "session.background" => new SessionBackgroundEvent(),
+ _ => new SessionLifecycleEvent()
};
- if (metadata != null)
+ evt.Type = type;
+ evt.SessionId = sessionId;
+ if (metadata is not null)
{
evt.Metadata = JsonSerializer.Deserialize(
metadata.Value.GetRawText(),
@@ -2083,7 +2007,7 @@ internal record ResumeSessionRequest(
string? WorkingDirectory,
string? ConfigDir,
bool? EnableConfigDiscovery,
- bool? DisableResume,
+ bool? SuppressResumeEvent,
bool? Streaming,
bool? IncludeSubAgentStreamingEvents,
IDictionary? McpServers,
@@ -2214,7 +2138,7 @@ internal partial class ClientJsonContext : JsonSerializerContext;
/// back through Microsoft.Extensions.AI without JSON serialization.
///
/// The tool result to wrap.
-public class ToolResultAIContent(ToolResultObject toolResult) : AIContent
+public sealed class ToolResultAIContent(ToolResultObject toolResult) : AIContent
{
///
/// Gets the underlying .
diff --git a/dotnet/src/CopilotTool.cs b/dotnet/src/CopilotTool.cs
index 6adcee093..feed5be76 100644
--- a/dotnet/src/CopilotTool.cs
+++ b/dotnet/src/CopilotTool.cs
@@ -4,7 +4,7 @@
using Microsoft.Extensions.AI;
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
///
/// Provides helpers for defining Copilot tools.
@@ -23,7 +23,7 @@ public static class CopilotTool
/// The delegate to invoke when the tool is called.
/// The Microsoft.Extensions.AI options used to create the function.
/// Copilot-specific tool options.
- /// An that can be added to or .
+ /// An that can be added to .
///
/// This is a helper on top of that applies additional configuration to support
/// Copilot tools, such as binding a parameter and adding Copilot-specific metadata properties based on the provided
diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs
index 2bd4910a2..db7ce9d4c 100644
--- a/dotnet/src/Generated/Rpc.cs
+++ b/dotnet/src/Generated/Rpc.cs
@@ -16,7 +16,7 @@
using System.Text.Json.Serialization;
using System.Threading;
-namespace GitHub.Copilot.SDK.Rpc;
+namespace GitHub.Copilot.Rpc;
/// Server liveness response, including the echoed message, current server timestamp, and protocol version.
public sealed class PingResult
@@ -7204,13 +7204,13 @@ public sealed class Converter : JsonConverter
///
public override ModelPickerCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ModelPickerCategory value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerCategory));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerCategory));
}
}
}
@@ -7272,13 +7272,13 @@ public sealed class Converter : JsonConverter
///
public override ModelPickerPriceCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ModelPickerPriceCategory value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerPriceCategory));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerPriceCategory));
}
}
}
@@ -7337,13 +7337,13 @@ public sealed class Converter : JsonConverter
///
public override ModelPolicyState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ModelPolicyState value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPolicyState));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPolicyState));
}
}
}
@@ -7405,13 +7405,13 @@ public sealed class Converter : JsonConverter
///
public override DiscoveredMcpServerType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, DiscoveredMcpServerType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DiscoveredMcpServerType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DiscoveredMcpServerType));
}
}
}
@@ -7467,13 +7467,13 @@ public sealed class Converter : JsonConverter
///
public override SessionFsSetProviderConventions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionFsSetProviderConventions value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsSetProviderConventions));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsSetProviderConventions));
}
}
}
@@ -7530,13 +7530,13 @@ public sealed class Converter : JsonConverter
public override ConnectedRemoteSessionMetadataKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ConnectedRemoteSessionMetadataKind value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ConnectedRemoteSessionMetadataKind));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ConnectedRemoteSessionMetadataKind));
}
}
}
@@ -7593,13 +7593,13 @@ public sealed class Converter : JsonConverter
///
public override SessionContextHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionContextHostType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionContextHostType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionContextHostType));
}
}
}
@@ -7662,13 +7662,13 @@ public sealed class Converter : JsonConverter
///
public override SendAgentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SendAgentMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendAgentMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendAgentMode));
}
}
}
@@ -7728,13 +7728,13 @@ public sealed class Converter : JsonConverter
///
public override SendAttachmentGithubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SendAttachmentGithubReferenceType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendAttachmentGithubReferenceType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendAttachmentGithubReferenceType));
}
}
}
@@ -7791,13 +7791,13 @@ public sealed class Converter : JsonConverter
///
public override SendMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SendMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendMode));
}
}
}
@@ -7857,13 +7857,13 @@ public sealed class Converter : JsonConverter
///
public override SessionLogLevel Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionLogLevel value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionLogLevel));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionLogLevel));
}
}
}
@@ -7935,13 +7935,13 @@ public sealed class Converter : JsonConverter
///
public override AuthInfoType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, AuthInfoType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AuthInfoType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AuthInfoType));
}
}
}
@@ -7998,13 +7998,13 @@ public sealed class Converter : JsonConverter
public override WorkspacesWorkspaceDetailsHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, WorkspacesWorkspaceDetailsHostType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspacesWorkspaceDetailsHostType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspacesWorkspaceDetailsHostType));
}
}
}
@@ -8067,13 +8067,13 @@ public sealed class Converter : JsonConverter
///
public override InstructionsSourcesLocation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, InstructionsSourcesLocation value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionsSourcesLocation));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionsSourcesLocation));
}
}
}
@@ -8145,13 +8145,13 @@ public sealed class Converter : JsonConverter
///
public override InstructionsSourcesType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, InstructionsSourcesType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionsSourcesType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionsSourcesType));
}
}
}
@@ -8220,13 +8220,13 @@ public sealed class Converter : JsonConverter
///
public override AgentInfoSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, AgentInfoSource value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentInfoSource));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentInfoSource));
}
}
}
@@ -8283,13 +8283,13 @@ public sealed class Converter : JsonConverter
///
public override TaskExecutionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, TaskExecutionMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskExecutionMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskExecutionMode));
}
}
}
@@ -8355,13 +8355,13 @@ public sealed class Converter : JsonConverter
///
public override TaskStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, TaskStatus value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskStatus));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskStatus));
}
}
}
@@ -8418,13 +8418,13 @@ public sealed class Converter : JsonConverter
///
public override TaskShellInfoAttachmentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, TaskShellInfoAttachmentMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskShellInfoAttachmentMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskShellInfoAttachmentMode));
}
}
}
@@ -8484,13 +8484,13 @@ public sealed class Converter : JsonConverter
///
public override McpSamplingExecutionAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, McpSamplingExecutionAction value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpSamplingExecutionAction));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpSamplingExecutionAction));
}
}
}
@@ -8547,13 +8547,13 @@ public sealed class Converter : JsonConverter
///
public override McpSetEnvValueModeDetails Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, McpSetEnvValueModeDetails value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpSetEnvValueModeDetails));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpSetEnvValueModeDetails));
}
}
}
@@ -8610,13 +8610,13 @@ public sealed class Converter : JsonConverter
///
public override OptionsUpdateEnvValueMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, OptionsUpdateEnvValueMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(OptionsUpdateEnvValueMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(OptionsUpdateEnvValueMode));
}
}
}
@@ -8673,13 +8673,13 @@ public sealed class Converter : JsonConverter
///
public override ExtensionSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ExtensionSource value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionSource));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionSource));
}
}
}
@@ -8742,13 +8742,13 @@ public sealed class Converter : JsonConverter
///
public override ExtensionStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ExtensionStatus value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionStatus));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionStatus));
}
}
}
@@ -8802,13 +8802,13 @@ public sealed class Converter : JsonConverter
///
public override SlashCommandInputCompletion Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SlashCommandInputCompletion value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SlashCommandInputCompletion));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SlashCommandInputCompletion));
}
}
}
@@ -8868,13 +8868,13 @@ public sealed class Converter : JsonConverter
///
public override SlashCommandKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SlashCommandKind value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SlashCommandKind));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SlashCommandKind));
}
}
}
@@ -8934,13 +8934,13 @@ public sealed class Converter : JsonConverter
///
public override UIElicitationResponseAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, UIElicitationResponseAction value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIElicitationResponseAction));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIElicitationResponseAction));
}
}
}
@@ -9000,13 +9000,13 @@ public sealed class Converter : JsonConverter
///
public override UIAutoModeSwitchResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, UIAutoModeSwitchResponse value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIAutoModeSwitchResponse));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIAutoModeSwitchResponse));
}
}
}
@@ -9069,13 +9069,13 @@ public sealed class Converter : JsonConverter
///
public override UIExitPlanModeAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, UIExitPlanModeAction value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIExitPlanModeAction));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIExitPlanModeAction));
}
}
}
@@ -9132,13 +9132,13 @@ public sealed class Converter : JsonConverter
public override PermissionsConfigureAdditionalContentExclusionPolicyScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PermissionsConfigureAdditionalContentExclusionPolicyScope value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsConfigureAdditionalContentExclusionPolicyScope));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsConfigureAdditionalContentExclusionPolicyScope));
}
}
}
@@ -9201,13 +9201,13 @@ public sealed class Converter : JsonConverter
///
public override PermissionsSetApproveAllSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PermissionsSetApproveAllSource value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsSetApproveAllSource));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsSetApproveAllSource));
}
}
}
@@ -9264,13 +9264,13 @@ public sealed class Converter : JsonConverter
///
public override PermissionsModifyRulesScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PermissionsModifyRulesScope value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsModifyRulesScope));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsModifyRulesScope));
}
}
}
@@ -9327,13 +9327,13 @@ public sealed class Converter : JsonConverter
///
public override PermissionLocationType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PermissionLocationType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionLocationType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionLocationType));
}
}
}
@@ -9393,13 +9393,13 @@ public sealed class Converter : JsonConverter
///
public override MetadataSnapshotCurrentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, MetadataSnapshotCurrentMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(MetadataSnapshotCurrentMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(MetadataSnapshotCurrentMode));
}
}
}
@@ -9456,13 +9456,13 @@ public sealed class Converter : JsonConverter
public override MetadataSnapshotRemoteMetadataTaskType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, MetadataSnapshotRemoteMetadataTaskType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(MetadataSnapshotRemoteMetadataTaskType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(MetadataSnapshotRemoteMetadataTaskType));
}
}
}
@@ -9519,13 +9519,13 @@ public sealed class Converter : JsonConverter
///
public override WorkspaceSummaryHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, WorkspaceSummaryHostType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspaceSummaryHostType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspaceSummaryHostType));
}
}
}
@@ -9582,13 +9582,13 @@ public sealed class Converter : JsonConverter
public override SessionWorkingDirectoryContextHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionWorkingDirectoryContextHostType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionWorkingDirectoryContextHostType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionWorkingDirectoryContextHostType));
}
}
}
@@ -9648,13 +9648,13 @@ public sealed class Converter : JsonConverter
///
public override ShellKillSignal Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ShellKillSignal value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ShellKillSignal));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ShellKillSignal));
}
}
}
@@ -9711,13 +9711,13 @@ public sealed class Converter : JsonConverter
///
public override QueuePendingItemsKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, QueuePendingItemsKind value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(QueuePendingItemsKind));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(QueuePendingItemsKind));
}
}
}
@@ -9774,13 +9774,13 @@ public sealed class Converter : JsonConverter
///
public override EventsCursorStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, EventsCursorStatus value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(EventsCursorStatus));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(EventsCursorStatus));
}
}
}
@@ -9837,13 +9837,13 @@ public sealed class Converter : JsonConverter
///
public override EventsAgentScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, EventsAgentScope value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(EventsAgentScope));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(EventsAgentScope));
}
}
}
@@ -9903,13 +9903,13 @@ public sealed class Converter : JsonConverter
///
public override RemoteSessionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, RemoteSessionMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(RemoteSessionMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(RemoteSessionMode));
}
}
}
@@ -9965,13 +9965,13 @@ public sealed class Converter : JsonConverter
///
public override SessionFsErrorCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionFsErrorCode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsErrorCode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsErrorCode));
}
}
}
@@ -10027,13 +10027,13 @@ public sealed class Converter : JsonConverter
public override SessionFsReaddirWithTypesEntryType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionFsReaddirWithTypesEntryType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsReaddirWithTypesEntryType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsReaddirWithTypesEntryType));
}
}
}
@@ -10092,13 +10092,13 @@ public sealed class Converter : JsonConverter
///
public override SessionFsSqliteQueryType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionFsSqliteQueryType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsSqliteQueryType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsSqliteQueryType));
}
}
}
@@ -13087,225 +13087,225 @@ public static void RegisterClientSessionApiHandlers(JsonRpc rpc, Func
/// Provides the base class from which all session events derive.
@@ -5345,13 +5345,13 @@ public sealed class Converter : JsonConverter
///
public override WorkingDirectoryContextHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, WorkingDirectoryContextHostType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkingDirectoryContextHostType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkingDirectoryContextHostType));
}
}
}
@@ -5409,13 +5409,13 @@ public sealed class Converter : JsonConverter
///
public override ReasoningSummary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ReasoningSummary value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ReasoningSummary));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ReasoningSummary));
}
}
}
@@ -5473,13 +5473,13 @@ public sealed class Converter : JsonConverter
///
public override SessionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SessionMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionMode));
}
}
}
@@ -5537,13 +5537,13 @@ public sealed class Converter : JsonConverter
///
public override PlanChangedOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PlanChangedOperation value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PlanChangedOperation));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PlanChangedOperation));
}
}
}
@@ -5598,13 +5598,13 @@ public sealed class Converter : JsonConverter
///
public override WorkspaceFileChangedOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, WorkspaceFileChangedOperation value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspaceFileChangedOperation));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspaceFileChangedOperation));
}
}
}
@@ -5659,13 +5659,13 @@ public sealed class Converter : JsonConverter
///
public override HandoffSourceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, HandoffSourceType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HandoffSourceType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HandoffSourceType));
}
}
}
@@ -5720,13 +5720,13 @@ public sealed class Converter : JsonConverter
///
public override ShutdownType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ShutdownType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ShutdownType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ShutdownType));
}
}
}
@@ -5787,13 +5787,13 @@ public sealed class Converter : JsonConverter
///
public override UserMessageAgentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, UserMessageAgentMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UserMessageAgentMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UserMessageAgentMode));
}
}
}
@@ -5851,13 +5851,13 @@ public sealed class Converter : JsonConverter
public override UserMessageAttachmentGithubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, UserMessageAttachmentGithubReferenceType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UserMessageAttachmentGithubReferenceType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UserMessageAttachmentGithubReferenceType));
}
}
}
@@ -5912,13 +5912,13 @@ public sealed class Converter : JsonConverter
///
public override AssistantMessageToolRequestType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, AssistantMessageToolRequestType value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AssistantMessageToolRequestType));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AssistantMessageToolRequestType));
}
}
}
@@ -5979,13 +5979,13 @@ public sealed class Converter : JsonConverter
///
public override AssistantUsageApiEndpoint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, AssistantUsageApiEndpoint value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AssistantUsageApiEndpoint));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AssistantUsageApiEndpoint));
}
}
}
@@ -6043,13 +6043,13 @@ public sealed class Converter : JsonConverter
///
public override ModelCallFailureSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ModelCallFailureSource value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelCallFailureSource));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelCallFailureSource));
}
}
}
@@ -6107,13 +6107,13 @@ public sealed class Converter : JsonConverter
///
public override AbortReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, AbortReason value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AbortReason));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AbortReason));
}
}
}
@@ -6168,13 +6168,13 @@ public sealed class Converter : JsonConverter
public override ToolExecutionCompleteContentResourceLinkIconTheme Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ToolExecutionCompleteContentResourceLinkIconTheme value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ToolExecutionCompleteContentResourceLinkIconTheme));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ToolExecutionCompleteContentResourceLinkIconTheme));
}
}
}
@@ -6229,13 +6229,13 @@ public sealed class Converter : JsonConverter
///
public override SystemMessageRole Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SystemMessageRole value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SystemMessageRole));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SystemMessageRole));
}
}
}
@@ -6290,13 +6290,13 @@ public sealed class Converter : JsonConverter
public override SystemNotificationAgentCompletedStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SystemNotificationAgentCompletedStatus value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SystemNotificationAgentCompletedStatus));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SystemNotificationAgentCompletedStatus));
}
}
}
@@ -6351,13 +6351,13 @@ public sealed class Converter : JsonConverter
///
public override PermissionRequestMemoryAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PermissionRequestMemoryAction value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionRequestMemoryAction));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionRequestMemoryAction));
}
}
}
@@ -6412,13 +6412,13 @@ public sealed class Converter : JsonConverter
///
public override PermissionRequestMemoryDirection Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PermissionRequestMemoryDirection value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionRequestMemoryDirection));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionRequestMemoryDirection));
}
}
}
@@ -6476,13 +6476,13 @@ public sealed class Converter : JsonConverter
public override PermissionPromptRequestPathAccessKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, PermissionPromptRequestPathAccessKind value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionPromptRequestPathAccessKind));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionPromptRequestPathAccessKind));
}
}
}
@@ -6537,13 +6537,13 @@ public sealed class Converter : JsonConverter
///
public override ElicitationRequestedMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ElicitationRequestedMode value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ElicitationRequestedMode));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ElicitationRequestedMode));
}
}
}
@@ -6601,13 +6601,13 @@ public sealed class Converter : JsonConverter
///
public override ElicitationCompletedAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ElicitationCompletedAction value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ElicitationCompletedAction));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ElicitationCompletedAction));
}
}
}
@@ -6665,13 +6665,13 @@ public sealed class Converter : JsonConverter
///
public override AutoModeSwitchResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, AutoModeSwitchResponse value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AutoModeSwitchResponse));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AutoModeSwitchResponse));
}
}
}
@@ -6732,13 +6732,13 @@ public sealed class Converter : JsonConverter
///
public override ExitPlanModeAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ExitPlanModeAction value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExitPlanModeAction));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExitPlanModeAction));
}
}
}
@@ -6808,13 +6808,13 @@ public sealed class Converter : JsonConverter
///
public override SkillSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, SkillSource value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SkillSource));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SkillSource));
}
}
}
@@ -6875,13 +6875,13 @@ public sealed class Converter : JsonConverter
///
public override McpServerSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, McpServerSource value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpServerSource));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpServerSource));
}
}
}
@@ -6948,13 +6948,13 @@ public sealed class Converter : JsonConverter
///
public override McpServerStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, McpServerStatus value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpServerStatus));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpServerStatus));
}
}
}
@@ -7009,13 +7009,13 @@ public sealed class Converter : JsonConverter
///
public override ExtensionsLoadedExtensionSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ExtensionsLoadedExtensionSource value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionsLoadedExtensionSource));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionsLoadedExtensionSource));
}
}
}
@@ -7076,13 +7076,13 @@ public sealed class Converter : JsonConverter
///
public override ExtensionsLoadedExtensionStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return new(GitHub.Copilot.SDK.GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
+ return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert));
}
///
public override void Write(Utf8JsonWriter writer, ExtensionsLoadedExtensionStatus value, JsonSerializerOptions options)
{
- GitHub.Copilot.SDK.GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionsLoadedExtensionStatus));
+ GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionsLoadedExtensionStatus));
}
}
}
diff --git a/dotnet/src/GitHub.Copilot.SDK.csproj b/dotnet/src/GitHub.Copilot.SDK.csproj
index 933b51de2..2b69cbb6f 100644
--- a/dotnet/src/GitHub.Copilot.SDK.csproj
+++ b/dotnet/src/GitHub.Copilot.SDK.csproj
@@ -2,8 +2,9 @@
net8.0;net10.0;netstandard2.0
+ GitHub.Copilot
true
- 0.1.0
+ 0.0.0-dev
SDK for programmatic control of GitHub Copilot CLI
GitHub
GitHub
diff --git a/dotnet/src/JsonRpc.cs b/dotnet/src/JsonRpc.cs
index a97d0baed..866bb868f 100644
--- a/dotnet/src/JsonRpc.cs
+++ b/dotnet/src/JsonRpc.cs
@@ -14,7 +14,7 @@
using System.Text.Json.Serialization.Metadata;
using System.Text.Unicode;
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
///
/// A lightweight JSON-RPC 2.0 implementation covering only the features used
diff --git a/dotnet/src/LoggingHelpers.cs b/dotnet/src/LoggingHelpers.cs
index ca14ea3b9..a4f51cb65 100644
--- a/dotnet/src/LoggingHelpers.cs
+++ b/dotnet/src/LoggingHelpers.cs
@@ -5,7 +5,7 @@
using Microsoft.Extensions.Logging;
using System.Diagnostics;
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
internal static class LoggingHelpers
{
diff --git a/dotnet/src/MillisecondsTimeSpanConverter.cs b/dotnet/src/MillisecondsTimeSpanConverter.cs
index 696d053dd..738d68648 100644
--- a/dotnet/src/MillisecondsTimeSpanConverter.cs
+++ b/dotnet/src/MillisecondsTimeSpanConverter.cs
@@ -6,7 +6,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
/// Converts between JSON numeric milliseconds and .
[EditorBrowsable(EditorBrowsableState.Never)]
diff --git a/dotnet/src/PermissionHandlers.cs b/dotnet/src/PermissionHandlers.cs
index 3a40e7244..0e4af7eac 100644
--- a/dotnet/src/PermissionHandlers.cs
+++ b/dotnet/src/PermissionHandlers.cs
@@ -2,12 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
-/// Provides pre-built implementations.
+/// Provides pre-built permission request handlers.
public static class PermissionHandler
{
- /// A that approves all permission requests.
- public static PermissionRequestHandler ApproveAll { get; } =
+ /// A permission handler that approves all permission requests.
+ public static Func> ApproveAll { get; } =
(_, _) => Task.FromResult(new PermissionRequestResult { Kind = PermissionRequestResultKind.Approved });
}
diff --git a/dotnet/src/SdkProtocolVersion.cs b/dotnet/src/SdkProtocolVersion.cs
index 889af460b..659387b79 100644
--- a/dotnet/src/SdkProtocolVersion.cs
+++ b/dotnet/src/SdkProtocolVersion.cs
@@ -1,6 +1,6 @@
// Code generated by update-protocol-version.ts. DO NOT EDIT.
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
///
/// Provides the SDK protocol version.
diff --git a/dotnet/src/Session.cs b/dotnet/src/Session.cs
index 1ca9eb621..fc7d82675 100644
--- a/dotnet/src/Session.cs
+++ b/dotnet/src/Session.cs
@@ -1,8 +1,8 @@
-/*---------------------------------------------------------------------------------------------
+/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
-using GitHub.Copilot.SDK.Rpc;
+using GitHub.Copilot.Rpc;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Logging;
using System.Collections.Immutable;
@@ -12,7 +12,7 @@
using System.Text.Json.Serialization;
using System.Threading.Channels;
-namespace GitHub.Copilot.SDK;
+namespace GitHub.Copilot;
///
/// Represents a single conversation session with the Copilot CLI.
@@ -41,7 +41,7 @@ namespace GitHub.Copilot.SDK;
/// await using var session = await client.CreateSessionAsync(new() { OnPermissionRequest = PermissionHandler.ApproveAll, Model = "gpt-4" });
///
/// // Subscribe to events
-/// using var subscription = session.On(evt =>
+/// using var subscription = session.On<SessionEvent>(evt =>
/// {
/// if (evt is AssistantMessageEvent assistantMessage)
/// {
@@ -56,16 +56,18 @@ namespace GitHub.Copilot.SDK;
public sealed partial class CopilotSession : IAsyncDisposable
{
private readonly Dictionary _toolHandlers = [];
- private readonly Dictionary _commandHandlers = [];
+ private readonly Dictionary> _commandHandlers = [];
private readonly ILogger _logger;
private readonly CopilotClient _parentClient;
- private volatile PermissionRequestHandler? _permissionHandler;
- private volatile UserInputHandler? _userInputHandler;
- private volatile ElicitationHandler? _elicitationHandler;
- private volatile ExitPlanModeHandler? _exitPlanModeHandler;
- private volatile AutoModeSwitchHandler? _autoModeSwitchHandler;
- private ImmutableArray _eventHandlers = ImmutableArray.Empty;
+ private volatile Func>? _permissionHandler;
+ private volatile Func>? _userInputHandler;
+ private volatile Func>? _elicitationHandler;
+ private volatile Func>? _exitPlanModeHandler;
+ private volatile Func>? _autoModeSwitchHandler;
+ private ImmutableArray _eventHandlers = ImmutableArray.Empty;
+
+ private sealed record EventSubscription(Type EventType, Action Handler);
private SessionHooks? _hooks;
private readonly SemaphoreSlim _hooksLock = new(1, 1);
@@ -189,7 +191,34 @@ private Task InvokeRpcAsync(string method, object?[]? args, CancellationTo
}
///
- /// Sends a message to the Copilot session and waits for the response.
+ /// Sends a plain-text user message and returns the message ID without waiting for
+ /// the assistant to reply. Convenience overload for .
+ ///
+ /// The user message text.
+ /// A that can be used to cancel the operation.
+ /// A task that resolves with the message ID.
+ public Task SendAsync(string prompt, CancellationToken cancellationToken = default)
+ {
+ ArgumentNullException.ThrowIfNull(prompt);
+ return SendAsync(new MessageOptions { Prompt = prompt }, cancellationToken);
+ }
+
+ ///
+ /// Sends a plain-text user message and waits until the session becomes idle.
+ /// Convenience overload for .
+ ///
+ /// The user message text.
+ /// Timeout duration (default: 60 seconds).
+ /// A that can be used to cancel the operation.
+ /// A task that resolves with the final assistant message event, or null if none was received.
+ public Task SendAndWaitAsync(string prompt, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
+ {
+ ArgumentNullException.ThrowIfNull(prompt);
+ return SendAndWaitAsync(new MessageOptions { Prompt = prompt }, timeout, cancellationToken);
+ }
+
+ ///
+ /// Sends a message to the Copilot session.
///
/// Options for the message to be sent, including the prompt and optional attachments.
/// A that can be used to cancel the operation.
@@ -197,11 +226,11 @@ private Task InvokeRpcAsync(string method, object?[]? args, CancellationTo
/// Thrown if the session has been disposed.
///
///
- /// This method returns immediately after the message is queued. Use
+ /// This method returns immediately after the message is queued. Use
/// if you need to wait for the assistant to finish processing.
///
///
- /// Subscribe to events via to receive streaming responses and other session events.
+ /// Subscribe to events via to receive streaming responses and other session events.
///
///
///
@@ -258,12 +287,12 @@ public async Task SendAsync(MessageOptions options, CancellationToken ca
/// Thrown if the session has been disposed.
///
///
- /// This is a convenience method that combines with waiting for
+ /// This is a convenience method that combines with waiting for
/// the session.idle event. Use this when you want to block until the assistant
/// has finished processing the message.
///
///
- /// Events are still delivered to handlers registered via while waiting.
+ /// Events are still delivered to handlers registered via while waiting.
///
///
///
@@ -318,7 +347,7 @@ void Handler(SessionEvent evt)
}
}
- using var subscription = On(Handler);
+ using var subscription = On(Handler);
await SendAsync(options, cancellationToken);
@@ -381,7 +410,7 @@ void Handler(SessionEvent evt)
///
///
///
- /// using var subscription = session.On(evt =>
+ /// using var subscription = session.On<SessionEvent>(evt =>
/// {
/// switch (evt)
/// {
@@ -394,16 +423,21 @@ void Handler(SessionEvent evt)
/// }
/// });
///
+ /// // Or filter to a specific event kind at compile time:
+ /// using var sub2 = session.On<AssistantMessageEvent>(evt =>
+ /// Console.WriteLine(evt.Data?.Content));
+ ///
/// // The handler is automatically unsubscribed when the subscription is disposed.
///
///
- public IDisposable On(SessionEventHandler handler)
+ public IDisposable On(Action handler) where T : SessionEvent
{
ArgumentNullException.ThrowIfNull(handler);
ThrowIfDisposed();
- ImmutableInterlocked.Update(ref _eventHandlers, array => array.Add(handler));
- return new ActionDisposable(() => ImmutableInterlocked.Update(ref _eventHandlers, array => array.Remove(handler)));
+ var subscription = new EventSubscription(typeof(T), evt => handler((T)evt));
+ ImmutableInterlocked.Update(ref _eventHandlers, array => array.Add(subscription));
+ return new ActionDisposable(() => ImmutableInterlocked.Update(ref _eventHandlers, array => array.Remove(subscription)));
}
///
@@ -438,11 +472,16 @@ private async Task ProcessEventsAsync()
await foreach (var sessionEvent in _eventChannel.Reader.ReadAllAsync())
{
var dispatchTimestamp = Stopwatch.GetTimestamp();
- foreach (var handler in _eventHandlers)
+ var eventType = sessionEvent.GetType();
+ foreach (var subscription in _eventHandlers)
{
+ if (!subscription.EventType.IsAssignableFrom(eventType))
+ {
+ continue;
+ }
try
{
- handler(sessionEvent);
+ subscription.Handler(sessionEvent);
}
catch (Exception ex)
{
@@ -496,7 +535,7 @@ internal void RegisterTools(ICollection tools)
/// When the assistant needs permission to perform certain actions (e.g., file operations),
/// this handler is called to approve or deny the request.
///
- internal void RegisterPermissionHandler(PermissionRequestHandler? handler)
+ internal void RegisterPermissionHandler(Func>? handler)
{
_permissionHandler = handler;
}
@@ -726,7 +765,7 @@ private async Task ExecuteToolAndRespondAsync(string requestId, string toolName,
///
/// Executes a permission handler and sends the result back via the HandlePendingPermissionRequest RPC.
///
- private async Task ExecutePermissionAndRespondAsync(string requestId, PermissionRequest permissionRequest, PermissionRequestHandler handler)
+ private async Task ExecutePermissionAndRespondAsync(string requestId, PermissionRequest permissionRequest, Func> handler)
{
try
{
@@ -747,7 +786,10 @@ private async Task ExecutePermissionAndRespondAsync(string requestId, Permission
return;
}
var responseRpcTimestamp = Stopwatch.GetTimestamp();
- await Rpc.Permissions.HandlePendingPermissionRequestAsync(requestId, new PermissionDecision { Kind = result.Kind.Value });
+ PermissionDecision decision = result.Kind == PermissionRequestResultKind.Rejected
+ ? new PermissionDecisionReject { Feedback = result.Feedback }
+ : new PermissionDecision { Kind = result.Kind.Value };
+ await Rpc.Permissions.HandlePendingPermissionRequestAsync(requestId, decision);
LoggingHelpers.LogTiming(_logger, LogLevel.Debug, null,
"CopilotSession.ExecutePermissionAndRespondAsync response sent successfully. Elapsed={Elapsed}, SessionId={SessionId}, RequestId={RequestId}",
responseRpcTimestamp,
@@ -778,7 +820,7 @@ private async Task ExecutePermissionAndRespondAsync(string requestId, Permission
/// Registers a handler for user input requests from the agent.
///
/// The handler to invoke when user input is requested.
- internal void RegisterUserInputHandler(UserInputHandler handler)
+ internal void RegisterUserInputHandler(Func> handler)
{
_userInputHandler = handler;
}
@@ -801,7 +843,7 @@ internal void RegisterCommands(IEnumerable? commands)
/// Registers an elicitation handler for this session.
///
/// The handler to invoke when an elicitation request is received.
- internal void RegisterElicitationHandler(ElicitationHandler? handler)
+ internal void RegisterElicitationHandler(Func>? handler)
{
_elicitationHandler = handler;
}
@@ -810,7 +852,7 @@ internal void RegisterElicitationHandler(ElicitationHandler? handler)
/// Registers an exit-plan-mode handler for this session.
///
/// The handler to invoke when an exit-plan-mode request is received.
- internal void RegisterExitPlanModeHandler(ExitPlanModeHandler? handler)
+ internal void RegisterExitPlanModeHandler(Func>? handler)
{
_exitPlanModeHandler = handler;
}
@@ -819,7 +861,7 @@ internal void RegisterExitPlanModeHandler(ExitPlanModeHandler? handler)
/// Registers an auto-mode-switch handler for this session.
///
/// The handler to invoke when an auto-mode-switch request is received.
- internal void RegisterAutoModeSwitchHandler(AutoModeSwitchHandler? handler)
+ internal void RegisterAutoModeSwitchHandler(Func>? handler)
{
_autoModeSwitchHandler = handler;
}
@@ -958,7 +1000,7 @@ private void AssertElicitation()
///
private sealed class SessionUiApiImpl(CopilotSession session) : ISessionUiApi
{
- public async Task ElicitationAsync(ElicitationParams elicitationParams, CancellationToken cancellationToken)
+ public async Task ElicitAsync(ElicitationParams elicitationParams, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(elicitationParams);
session.ThrowIfDisposed();
@@ -1041,7 +1083,7 @@ public async Task ConfirmAsync(string message, CancellationToken cancellat
return null;
}
- public async Task InputAsync(string message, InputOptions? options, CancellationToken cancellationToken)
+ public async Task InputAsync(string message, UiInputOptions? options, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(message);
session.ThrowIfDisposed();
@@ -1319,7 +1361,7 @@ internal async Task HandleSystemMessageTransf
///
///
///
- /// var events = await session.GetMessagesAsync();
+ /// var events = await session.GetEventsAsync();
/// foreach (var evt in events)
/// {
/// if (evt is AssistantMessageEvent)
@@ -1329,7 +1371,7 @@ internal async Task HandleSystemMessageTransf
/// }
///
///
- public async Task> GetMessagesAsync(CancellationToken cancellationToken = default)
+ public async Task> GetEventsAsync(CancellationToken cancellationToken = default)
{
ThrowIfDisposed();
@@ -1437,7 +1479,7 @@ public async Task LogAsync(string message, SessionLogLevel? level = null, bool?
/// A task representing the dispose operation.
///
///
- /// The caller should ensure the session is idle (e.g.,
+ /// The caller should ensure the session is idle (e.g.,
/// has returned) before disposing. If the session is not idle, in-flight event handlers
/// or tool handlers may observe failures.
///
@@ -1491,7 +1533,7 @@ await InvokeRpcAsync
- public virtual CopilotClientOptions Clone()
- {
- return new(this);
- }
+ public CopilotClientOptions Clone() => new(this);
}
///
@@ -335,7 +420,7 @@ public sealed class SessionFsConfig
///
/// Represents a binary result returned by a tool invocation.
///
-public class ToolBinaryResult
+public sealed class ToolBinaryResult
{
///
/// Base64-encoded binary data.
@@ -350,10 +435,11 @@ public class ToolBinaryResult
public string MimeType { get; set; } = string.Empty;
///
- /// Type identifier for the binary result.
+ /// Type identifier for the binary result. Use the well-known values on
+ /// ("image", "resource").
///
[JsonPropertyName("type")]
- public string Type { get; set; } = string.Empty;
+ public ToolBinaryResultType Type { get; set; }
///
/// Optional human-readable description of the binary result.
@@ -362,10 +448,76 @@ public class ToolBinaryResult
public string? Description { get; set; }
}
+/// Describes the kind of a .
+[JsonConverter(typeof(ToolBinaryResultType.Converter))]
+[DebuggerDisplay("{Value,nq}")]
+public readonly struct ToolBinaryResultType : IEquatable
+{
+ /// Gets the kind indicating an inline image result.
+ public static ToolBinaryResultType Image { get; } = new("image");
+
+ /// Gets the kind indicating an MCP resource result.
+ public static ToolBinaryResultType Resource { get; } = new("resource");
+
+ /// Gets the underlying string value of this .
+ public string Value => _value ?? string.Empty;
+
+ private readonly string? _value;
+
+ /// Initializes a new instance of the struct.
+ /// The string value for this type.
+ [JsonConstructor]
+ public ToolBinaryResultType(string value) => _value = value;
+
+ ///
+ public static bool operator ==(ToolBinaryResultType left, ToolBinaryResultType right) => left.Equals(right);
+
+ ///
+ public static bool operator !=(ToolBinaryResultType left, ToolBinaryResultType right) => !left.Equals(right);
+
+ ///
+ public override bool Equals([NotNullWhen(true)] object? obj) => obj is ToolBinaryResultType other && Equals(other);
+
+ ///
+ public bool Equals(ToolBinaryResultType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase);
+
+ ///
+ public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value);
+
+ ///
+ public override string ToString() => Value;
+
+ /// Provides a for serializing instances.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class Converter : JsonConverter
+ {
+ ///
+ public override ToolBinaryResultType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ {
+ if (reader.TokenType != JsonTokenType.String)
+ {
+ throw new JsonException("Expected string for ToolBinaryResultType.");
+ }
+
+ var value = reader.GetString();
+ if (value is null)
+ {
+ throw new JsonException("ToolBinaryResultType value cannot be null.");
+ }
+
+ return new ToolBinaryResultType(value);
+ }
+
+ ///
+ public override void Write(Utf8JsonWriter writer, ToolBinaryResultType value, JsonSerializerOptions options) =>
+ writer.WriteStringValue(value.Value);
+ }
+}
+
///
/// Represents the structured result of a tool execution.
///
-public class ToolResultObject
+public sealed class ToolResultObject
{
///
/// Text result to be consumed by the language model.
@@ -477,7 +629,7 @@ private static ToolResultObject ConvertAIContents(IEnumerable content
{
Data = dataContent.Base64Data.ToString(),
MimeType = dataContent.MediaType ?? "application/octet-stream",
- Type = dataContent.HasTopLevelMediaType("image") ? "image" : "resource",
+ Type = dataContent.HasTopLevelMediaType("image") ? ToolBinaryResultType.Image : ToolBinaryResultType.Resource,
});
break;
@@ -502,7 +654,7 @@ private static string SerializeAIContent(AIContent content) =>
///
/// Contains context for a tool invocation callback.
///
-public class ToolInvocation
+public sealed class ToolInvocation
{
///
/// Identifier of the session that triggered the tool call.
@@ -522,11 +674,6 @@ public class ToolInvocation
public object? Arguments { get; set; }
}
-///
-/// Delegate for handling tool invocations and returning a result.
-///
-public delegate Task
[JsonPropertyName("rules")]
public IList