Registers and configures the GitHub Copilot orchestrator in CrestApps.Core 2.0, covering authentication modes (GitHub OAuth, BYOK ApiKey, NotConfigured), credential stores, token refresh, and SDK limits. Use when integrating Copilot subscriptions or OpenAI-compatible BYOK endpoints.
Ships in crestapps-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
CrestApps.Core.AI.Copilot adds CopilotOrchestrator, an IOrchestrator named "copilot" (title Copilot), which runs a turn through the GitHub Copilot SDK and its CLI instead of the default pipeline.
ApiKey (BYOK) for one shared OpenAI-compatible, Azure or Anthropic endpoint.NotConfigured as intentionally disabled; editors should show a warning instead of Copilot fields while it is selected.CopilotOptions yourself; the package reads no configuration section.ICopilotCredentialStore. BYOK does not.using CrestApps.Core.AI.Copilot;
using CrestApps.Core.AI.Copilot.Models;
builder.Services.AddCrestAppsCore(crestApps => crestApps
.AddAISuite(ai => ai
.AddCopilotOrchestrator()
)
);
builder.Services.Configure<CopilotOptions>(builder.Configuration.GetSection("Copilot"));
Raw form: builder.Services.AddCoreAICopilotOrchestrator(); after AddCoreAIServices() and AddCoreAIOrchestration(). It registers a named HttpClient with the standard resilience handler, the orchestrator, GitHubOAuthService, CopilotChatInteractionSettingsHandler, CopilotOrchestrationContextHandler and CopilotOptionsValidator.
Referencing the package downloads the Copilot CLI during build into runtimes/<rid>/native/. It caches the CLI machine-wide under the NuGet packages folder and resolves the npm registry from NPM_CONFIG_REGISTRY or npm config get registry. Override only when needed with the MSBuild properties CopilotUseSharedCliCache, CopilotCliCacheDir, CopilotResolveNpmRegistry and CopilotNpmRegistryUrl; the SDK's CopilotCliBinaryPath and CopilotSkipCliDownload still win.
CopilotAuthenticationType | Required for the orchestrator to run |
|---|---|
NotConfigured | Never runs |
GitHubOAuth | ClientId, ClientSecret (Scopes default user:email, read:org) and a signed-in user with a stored credential |
ApiKey | ProviderType, BaseUrl, DefaultModel; for azure also ApiKey and AzureApiVersion |
CopilotOptionsValidator fails when ClientId or ClientSecret is missing in OAuth mode, or ApiKey is missing in BYOK mode. When the runtime check fails, a turn answers "Copilot is not configured and cannot be used until it has been configured."
{
"Copilot": {
"AuthenticationType": "ApiKey",
"ProviderType": "openai",
"BaseUrl": "https://api.openai.com/v1",
"ApiKey": "sk-...",
"DefaultModel": "gpt-4o",
"WireApi": "completions"
}
}
{
"Copilot": {
"AuthenticationType": "GitHubOAuth",
"ClientId": "Iv1.abc123",
"ClientSecret": "your-client-secret",
"Scopes": [ "user:email", "read:org" ]
}
}
public interface ICopilotCredentialStore
{
Task<CopilotProtectedCredential> GetProtectedCredentialAsync(string userId, CancellationToken cancellationToken = default);
Task SaveProtectedCredentialAsync(string userId, CopilotProtectedCredential credential, CancellationToken cancellationToken = default);
Task ClearCredentialAsync(string userId, CancellationToken cancellationToken = default);
}
CopilotProtectedCredential carries GitHubUsername, ProtectedAccessToken, ProtectedRefreshToken, ExpiresAt and UpdatedUtc; the tokens arrive already protected. Scope storage by user (and tenant). For development, the shipped JsonFileCopilotCredentialStore writes one file per user under App_Data/CopilotCredentials:
builder.Services.AddScoped<ICopilotCredentialStore, JsonFileCopilotCredentialStore>();
Use a database-backed store in production.
using System.Security.Claims;
using CrestApps.Core.AI.Copilot.Services;
using Microsoft.AspNetCore.Mvc;
[Route("copilot")]
public sealed class CopilotAuthController : Controller
{
private readonly GitHubOAuthService _oauthService;
public CopilotAuthController(GitHubOAuthService oauthService)
{
_oauthService = oauthService;
}
[HttpGet("connect")]
public IActionResult Connect(string returnUrl = "/")
{
var callbackUrl = Url.Action(nameof(Callback), null, null, Request.Scheme);
return Redirect(_oauthService.GetAuthorizationUrl(callbackUrl, returnUrl));
}
[HttpGet("callback")]
public async Task<IActionResult> Callback(string code, string state, CancellationToken cancellationToken)
{
if (!_oauthService.TryValidateCallbackState(state, out var returnUrl))
{
return BadRequest();
}
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
await _oauthService.ExchangeCodeForTokenAsync(code, userId, cancellationToken);
return LocalRedirect(returnUrl);
}
}
GetAuthorizationUrl writes a protected, ten-minute state cookie (named __Host-crestapps-gh-oauth-state over HTTPS, so a sibling subdomain cannot plant it) and sends a RandomNumberGenerator nonce as state. The state records the signed-in user, and TryValidateCallbackState succeeds only for that same user, deletes the cookie after it validates (one round trip cannot be replayed), and returns only a local return URL (or __popup__). Both need an HttpContext: GetAuthorizationUrl throws InvalidOperationException without one, and validation fails. Other members: GetCredentialAsync, GetProtectedCredentialsAsync, GetValidAccessTokenAsync (refreshes when expired), IsAuthenticatedAsync, ListModelsAsync and DisconnectAsync, all keyed by user id.
CopilotSessionMetadata on a profile or chat interaction overrides CopilotModel, IsAllowAll (approve all SDK permission requests, default true), and ReasoningEffort (CopilotReasoningEffort.None, Low, Medium, High), and records GitHubUsername plus protected tokens in OAuth mode.
profile.OrchestratorName = "copilot";
profile.Put(new CopilotSessionMetadata { CopilotModel = "gpt-4o", ReasoningEffort = CopilotReasoningEffort.Low });
IToolRegistry (system, profile, agent and tool instance tools); MCP tools are excluded from it.CopilotModel or DefaultModel), the tools and the system message.WireApi and Azure API version; OAuth uses GitHubOAuthService.GetValidAccessTokenAsync.[Available MCP Servers]. The current SDK SessionConfig has no MCP server support, and MCP tools are excluded from the tool list, so the model cannot call MCP tools through this orchestrator. Use the default orchestrator for profiles that depend on MCP tools.Tool access follows the profile's configuration, the same boundary as the default orchestrator. The Copilot orchestrator creates tools straight from the registry entries rather than through IToolMaterializer, but applies the same approval rule: it cannot pause for an approval, so a tool that requires one is replaced with a stand-in that does not run it and tells the model why, unless the profile's AIToolApprovalSettings lets that kind run without asking (then each call is logged and counted).
The Copilot CLI makes its own model requests. Register a CopilotRequestHandler (an experimental Copilot SDK API, GHCP001) to send them through an HttpClient you choose; the orchestrator passes it as CopilotClientOptions.RequestHandler. WebSocket connections reach the handler too, but it opens them with its own ClientWebSocket.
#pragma warning disable GHCP001 // The request handler API of the Copilot SDK is experimental.
builder.Services.AddHttpClient("CopilotModelRequests", client => client.Timeout = Timeout.InfiniteTimeSpan);
builder.Services.AddSingleton(services => new CopilotRequestHandler(
services.GetRequiredService<IHttpClientFactory>().CreateClient("CopilotModelRequests")));
#pragma warning restore GHCP001
CopilotOptions.CopilotNpmRegistryUrl or NPM_CONFIG_REGISTRY, or point CopilotCliCacheDir at a pre-seeded cache.GitHubOAuthService binds the OAuth state to the user who started the flow, deletes the state cookie once it validates, and throws from GetAuthorizationUrl without an HttpContext.ICopilotCredentialStore signatures, which take a CancellationToken; stores written against older samples without it no longer compile.state with TryValidateCallbackState; it is a nonce backed by a protected cookie, not the return URL that older samples redirected to.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
copilot-orchestrator, github-copilot-sdk, oauth, byok, credential-store
/crestapps-core:crestapps-core-copilot-orchestratorfrom crestapps-core
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-core51 skills in this plugin
/crestapps-core-a2aSkill for Agent-to-Agent (A2A) protocol support in CrestApps.Core on the A2A 1.0 SDK. Covers AddA2AClient and AddCoreAIA2AClient with Entity Framework Core or YesSql connection stores, A2AConnection and A2AConnectionMetadata authentication, AIProfileA2AMetadata, the agent card cache and A2AToolRegistryProvider, the listAvailableAgents, findAgentForTask and findToolsForTask tools, building an A2A host with IAgentHandler, A2AServer, ITaskStore and MapA2A, A2A 1.0 agent cards with supportedInterfaces published at /.well-known/agent-card.json, A2AHostOptions authentication and ExposeAgentsAsSkill, system agents exposed through the host, and upgrading from the 0.3 SDK./crestapps-core-ag-uiSkill for running the CrestApps.Core 2.0 AI chat as an AG-UI agent. Covers the CrestApps.Core.AI.AGUI package (AGUIRunEventWriter, AGUIRunRequest, AGUIJson), AIChatHubCore.RunAgent over SignalR and MapAGUIChat with Server-Sent Events, the RunAgentInput members and streamed events, tool approvals with RequireApproval or an approval tool kind, ApprovalRequiredAIFunction, interrupts and resume, approvals inside agents, page context with crestAppsAGUI.registerContextProvider, shared state with registerStateProvider and update_shared_state, frontend tools, stored tool calls (ChatTurnToolActivity), runs that continue on the next page, AGUIChatOptions.DisconnectedRunTimeout, the protocol and sendPageContext chat options, and the AICompletionContextKeys and ChatResponseHandlerContext members. Use it when showing tool calls in the chat, asking a person before a tool runs, sharing page state with the agent, connecting CopilotKit or another AG-UI client, or troubleshooting approvals and continued runs.Other plugins' skills for the same job