mirror of
https://github.com/github/awesome-copilot.git
synced 2026-09-22 14:20:47 +00:00
chore: publish from main
This commit is contained in:
@@ -26,6 +26,7 @@ dotnet run <filename>.cs
|
||||
| Persisting Sessions | `dotnet run persisting-sessions.cs` | Save and resume sessions across restarts |
|
||||
| Accessibility Report ℹ️ | `dotnet run accessibility-report.cs` | Analyzes web page accessibility |
|
||||
| Ralph Loop ⚠️ | `dotnet run ralph-loop.cs` | Autonomous development loop |
|
||||
| In-Process Runtime | `dotnet run in-process-runtime.cs` | Runs the Copilot runtime in-process |
|
||||
|
||||
### Examples with Arguments
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Console.WriteLine("Please wait...\n");
|
||||
// Create a session with Playwright MCP server
|
||||
await using var session = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "claude-opus-4.6",
|
||||
Model = "auto",
|
||||
Streaming = true,
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll,
|
||||
McpServers = new Dictionary<string, McpServerConfig>()
|
||||
@@ -49,7 +49,7 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
|
||||
// Wait for response using session.idle event
|
||||
var done = new TaskCompletionSource();
|
||||
|
||||
session.On(evt =>
|
||||
session.On<SessionEvent>(evt =>
|
||||
{
|
||||
switch (evt)
|
||||
{
|
||||
|
||||
@@ -11,12 +11,12 @@ try
|
||||
await client.StartAsync();
|
||||
var session = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "gpt-5",
|
||||
Model = "auto",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll
|
||||
});
|
||||
|
||||
var done = new TaskCompletionSource<string>();
|
||||
session.On(evt =>
|
||||
session.On<SessionEvent>(evt =>
|
||||
{
|
||||
if (evt is AssistantMessageEvent msg)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#:package GitHub.Copilot.SDK@*
|
||||
#:property PublishAot=false
|
||||
|
||||
// The GitHub.Copilot.SDK package exposes the GitHub.Copilot namespace.
|
||||
using GitHub.Copilot;
|
||||
|
||||
// RuntimeConnection.ForInProcess() is an experimental API (diagnostic GHCP001):
|
||||
// it loads the native Copilot runtime directly into this process instead of
|
||||
// launching a separate Copilot CLI process.
|
||||
#pragma warning disable GHCP001
|
||||
|
||||
var client = new CopilotClient(new CopilotClientOptions
|
||||
{
|
||||
Connection = RuntimeConnection.ForInProcess()
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
await client.StartAsync();
|
||||
|
||||
var session = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "auto",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll
|
||||
});
|
||||
|
||||
var response = await session.SendAndWaitAsync(
|
||||
new MessageOptions { Prompt = "Hello from the in-process runtime!" });
|
||||
Console.WriteLine(response?.Data.Content);
|
||||
|
||||
await session.DisposeAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Gracefully stop; the native runtime library itself stays loaded for the
|
||||
// lifetime of the process (see the "Lifecycle behavior" notes in the docs).
|
||||
await client.StopAsync();
|
||||
}
|
||||
@@ -11,14 +11,14 @@ await client.StartAsync();
|
||||
// Define tools for file operations
|
||||
var session = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "gpt-5",
|
||||
Model = "auto",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll
|
||||
});
|
||||
|
||||
// Wait for completion
|
||||
var done = new TaskCompletionSource();
|
||||
|
||||
session.On(evt =>
|
||||
session.On<SessionEvent>(evt =>
|
||||
{
|
||||
switch (evt)
|
||||
{
|
||||
|
||||
@@ -7,20 +7,22 @@ using GitHub.Copilot;
|
||||
await using var client = new CopilotClient();
|
||||
await client.StartAsync();
|
||||
|
||||
// Create multiple independent sessions
|
||||
// Create multiple independent sessions. Most sessions should let Copilot pick the
|
||||
// best model automatically; pin an explicit model only when you have a deliberate
|
||||
// reason to (e.g. an A/B comparison, as with session3 here).
|
||||
var session1 = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "gpt-5",
|
||||
Model = "auto",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll
|
||||
});
|
||||
var session2 = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "gpt-5",
|
||||
Model = "auto",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll
|
||||
});
|
||||
var session3 = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "claude-sonnet-4.5",
|
||||
Model = "claude-sonnet-5",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ await client.StartAsync();
|
||||
var session = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
SessionId = "user-123-conversation",
|
||||
Model = "gpt-5",
|
||||
Model = "auto",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll
|
||||
});
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ await client.StartAsync();
|
||||
|
||||
var session = await client.CreateSessionAsync(new SessionConfig
|
||||
{
|
||||
Model = "gpt-5",
|
||||
Model = "auto",
|
||||
OnPermissionRequest = PermissionHandler.ApproveAll,
|
||||
SystemMessage = new SystemMessageConfig
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ try
|
||||
var session = await client.CreateSessionAsync(
|
||||
new SessionConfig
|
||||
{
|
||||
Model = "gpt-5.1-codex-mini",
|
||||
Model = "gpt-5.3-codex",
|
||||
// Pin the agent to the project directory
|
||||
WorkingDirectory = Environment.CurrentDirectory,
|
||||
// Auto-approve tool calls for unattended operation
|
||||
@@ -55,7 +55,7 @@ try
|
||||
try
|
||||
{
|
||||
var done = new TaskCompletionSource<string>();
|
||||
session.On(evt =>
|
||||
session.On<SessionEvent>(evt =>
|
||||
{
|
||||
// Log tool usage for visibility
|
||||
if (evt is ToolExecutionStartEvent toolStart)
|
||||
|
||||
Reference in New Issue
Block a user