.NET: Python: [BREAKING] Renamed Github to GitHub (#3486)

* Renamed Github to GitHub

* Small fix

* Updated package versions
This commit is contained in:
Dmytro Struk
2026-01-28 19:58:31 +00:00
committed by GitHub
parent fa74f27030
commit 45a020be43
55 changed files with 251 additions and 234 deletions
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.GithubCopilot;
using Microsoft.Agents.AI.GitHub.Copilot;
using Microsoft.Extensions.AI;
using Microsoft.Shared.Diagnostics;
@@ -18,7 +18,7 @@ namespace GitHub.Copilot.SDK;
/// <para>
/// They allow developers to easily create AI agents that can interact
/// with GitHub Copilot by handling the conversion from Copilot clients to
/// <see cref="GithubCopilotAgent"/> instances that implement the <see cref="AIAgent"/> interface.
/// <see cref="GitHubCopilotAgent"/> instances that implement the <see cref="AIAgent"/> interface.
/// </para>
/// </remarks>
public static class CopilotClientExtensions
@@ -43,7 +43,7 @@ public static class CopilotClientExtensions
{
Throw.IfNull(client);
return new GithubCopilotAgent(client, sessionConfig, ownsClient, id, name, description);
return new GitHubCopilotAgent(client, sessionConfig, ownsClient, id, name, description);
}
/// <summary>
@@ -68,6 +68,6 @@ public static class CopilotClientExtensions
{
Throw.IfNull(client);
return new GithubCopilotAgent(client, ownsClient, id, name, description, tools, instructions);
return new GitHubCopilotAgent(client, ownsClient, id, name, description, tools, instructions);
}
}
@@ -13,12 +13,12 @@ using GitHub.Copilot.SDK;
using Microsoft.Extensions.AI;
using Microsoft.Shared.Diagnostics;
namespace Microsoft.Agents.AI.GithubCopilot;
namespace Microsoft.Agents.AI.GitHub.Copilot;
/// <summary>
/// Represents an <see cref="AIAgent"/> that uses the GitHub Copilot SDK to provide agentic capabilities.
/// </summary>
public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
public sealed class GitHubCopilotAgent : AIAgent, IAsyncDisposable
{
private const string DefaultName = "GitHub Copilot Agent";
private const string DefaultDescription = "An AI agent powered by GitHub Copilot";
@@ -31,7 +31,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
private readonly bool _ownsClient;
/// <summary>
/// Initializes a new instance of the <see cref="GithubCopilotAgent"/> class.
/// Initializes a new instance of the <see cref="GitHubCopilotAgent"/> class.
/// </summary>
/// <param name="copilotClient">The Copilot client to use for interacting with GitHub Copilot.</param>
/// <param name="sessionConfig">Optional session configuration for the agent.</param>
@@ -39,7 +39,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
/// <param name="id">The unique identifier for the agent.</param>
/// <param name="name">The name of the agent.</param>
/// <param name="description">The description of the agent.</param>
public GithubCopilotAgent(
public GitHubCopilotAgent(
CopilotClient copilotClient,
SessionConfig? sessionConfig = null,
bool ownsClient = false,
@@ -58,7 +58,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
}
/// <summary>
/// Initializes a new instance of the <see cref="GithubCopilotAgent"/> class.
/// Initializes a new instance of the <see cref="GitHubCopilotAgent"/> class.
/// </summary>
/// <param name="copilotClient">The Copilot client to use for interacting with GitHub Copilot.</param>
/// <param name="ownsClient">Whether the agent owns the client and should dispose it. Default is false.</param>
@@ -67,7 +67,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
/// <param name="description">The description of the agent.</param>
/// <param name="tools">The tools to make available to the agent.</param>
/// <param name="instructions">Optional instructions to append as a system message.</param>
public GithubCopilotAgent(
public GitHubCopilotAgent(
CopilotClient copilotClient,
bool ownsClient = false,
string? id = null,
@@ -87,7 +87,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
/// <inheritdoc/>
public sealed override ValueTask<AgentSession> GetNewSessionAsync(CancellationToken cancellationToken = default)
=> new(new GithubCopilotAgentSession());
=> new(new GitHubCopilotAgentSession());
/// <summary>
/// Get a new <see cref="AgentSession"/> instance using an existing session id, to continue that conversation.
@@ -95,14 +95,14 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
/// <param name="sessionId">The session id to continue.</param>
/// <returns>A new <see cref="AgentSession"/> instance.</returns>
public ValueTask<AgentSession> GetNewSessionAsync(string sessionId)
=> new(new GithubCopilotAgentSession() { SessionId = sessionId });
=> new(new GitHubCopilotAgentSession() { SessionId = sessionId });
/// <inheritdoc/>
public override ValueTask<AgentSession> DeserializeSessionAsync(
JsonElement serializedSession,
JsonSerializerOptions? jsonSerializerOptions = null,
CancellationToken cancellationToken = default)
=> new(new GithubCopilotAgentSession(serializedSession, jsonSerializerOptions));
=> new(new GitHubCopilotAgentSession(serializedSession, jsonSerializerOptions));
/// <inheritdoc/>
protected override Task<AgentResponse> RunCoreAsync(
@@ -123,7 +123,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
// Ensure we have a valid session
session ??= await this.GetNewSessionAsync(cancellationToken).ConfigureAwait(false);
if (session is not GithubCopilotAgentSession typedSession)
if (session is not GitHubCopilotAgentSession typedSession)
{
throw new InvalidOperationException(
$"The provided session type {session.GetType()} is not compatible with the agent. Only GitHub Copilot agent created sessions are supported.");
@@ -2,12 +2,12 @@
using System.Text.Json;
namespace Microsoft.Agents.AI.GithubCopilot;
namespace Microsoft.Agents.AI.GitHub.Copilot;
/// <summary>
/// Represents a session for a GitHub Copilot agent conversation.
/// </summary>
public sealed class GithubCopilotAgentSession : AgentSession
public sealed class GitHubCopilotAgentSession : AgentSession
{
/// <summary>
/// Gets or sets the session ID for the GitHub Copilot conversation.
@@ -15,18 +15,18 @@ public sealed class GithubCopilotAgentSession : AgentSession
public string? SessionId { get; internal set; }
/// <summary>
/// Initializes a new instance of the <see cref="GithubCopilotAgentSession"/> class.
/// Initializes a new instance of the <see cref="GitHubCopilotAgentSession"/> class.
/// </summary>
internal GithubCopilotAgentSession()
internal GitHubCopilotAgentSession()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GithubCopilotAgentSession"/> class from serialized data.
/// Initializes a new instance of the <see cref="GitHubCopilotAgentSession"/> class from serialized data.
/// </summary>
/// <param name="serializedThread">The serialized thread data.</param>
/// <param name="jsonSerializerOptions">Optional JSON serialization options.</param>
internal GithubCopilotAgentSession(JsonElement serializedThread, JsonSerializerOptions? jsonSerializerOptions = null)
internal GitHubCopilotAgentSession(JsonElement serializedThread, JsonSerializerOptions? jsonSerializerOptions = null)
{
// The JSON serialization uses camelCase
if (serializedThread.TryGetProperty("sessionId", out JsonElement sessionIdElement))
@@ -45,7 +45,7 @@ public sealed class GithubCopilotAgentSession : AgentSession
return JsonSerializer.SerializeToElement(
state,
GithubCopilotJsonUtilities.DefaultOptions.GetTypeInfo(typeof(State)));
GitHubCopilotJsonUtilities.DefaultOptions.GetTypeInfo(typeof(State)));
}
internal sealed class State
@@ -5,12 +5,12 @@ using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.Agents.AI.GithubCopilot;
namespace Microsoft.Agents.AI.GitHub.Copilot;
/// <summary>
/// Provides utility methods and configurations for JSON serialization operations within the GitHub Copilot agent implementation.
/// </summary>
internal static partial class GithubCopilotJsonUtilities
internal static partial class GitHubCopilotJsonUtilities
{
/// <summary>
/// Gets the default <see cref="JsonSerializerOptions"/> instance used for JSON serialization operations.
@@ -42,7 +42,7 @@ internal static partial class GithubCopilotJsonUtilities
UseStringEnumConverter = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
NumberHandling = JsonNumberHandling.AllowReadingFromString)]
[JsonSerializable(typeof(GithubCopilotAgentSession.State))]
[JsonSerializable(typeof(GitHubCopilotAgentSession.State))]
[ExcludeFromCodeCoverage]
private sealed partial class JsonContext : JsonSerializerContext;
}