Skip to content

Commit f6a669d

Browse files
Drop redundant RuntimeConnection + COPILOT_CLI_PATH from scenarios
Most scenarios explicitly set up a stdio connection from COPILOT_CLI_PATH: - .NET: Connection = RuntimeConnection.ForStdio(path: Environment.GetEnvironmentVariable("COPILOT_CLI_PATH")) - TS: connection: RuntimeConnection.forStdio({ path: process.env.COPILOT_CLI_PATH }) This is redundant boilerplate: - The default `RuntimeConnection` is already stdio across every SDK. - When no `path` is given, the SDKs already fall back to the `COPILOT_CLI_PATH` env var (and then the bundled binary), so the explicit pass-through adds nothing. - No real consumer of the SDK would write this — the docs reasonably expect `new CopilotClient()` (or the language-equivalent) to Just Work. Drop the connection setup entirely in every scenario *except* those whose whole purpose is to demonstrate transport / bundling configuration: - `transport/stdio` — explicit stdio path is the point. - `transport/tcp` / `transport/reconnect` — TCP transport is the point. - `bundling/*` — bundled-binary lookup is the point. Also clean up the resulting cruft: - Empty `new CopilotClientOptions {}` / `new CopilotClient({})` literals collapsed to parameter-less constructors. - Unused `RuntimeConnection` imports stripped from TS scenarios. - Go scenarios that previously passed `&copilot.ClientOptions{}` now pass `nil` (idiomatic when no fields are set). - The `cliPath` local var in `tools/custom-agents` (.NET) deleted. Rust scenarios keep `ClientOptions::default()` because the API requires the argument — that's idiomatic Rust, not redundant boilerplate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2a77f12 commit f6a669d

80 files changed

Lines changed: 192 additions & 262 deletions

File tree

Some content is hidden

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

test/scenarios/auth/byok-anthropic/csharp/Program.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
return 1;
1111
}
1212

13-
using var client = new CopilotClient(new CopilotClientOptions
14-
{
15-
Connection = RuntimeConnection.ForStdio(path: Environment.GetEnvironmentVariable("COPILOT_CLI_PATH")),
16-
});
13+
using var client = new CopilotClient();
1714

1815
await client.StartAsync();
1916

test/scenarios/auth/byok-anthropic/go/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525
model = "claude-sonnet-4-20250514"
2626
}
2727

28-
client := copilot.NewClient(&copilot.ClientOptions{})
28+
client := copilot.NewClient(nil)
2929

3030
ctx := context.Background()
3131
if err := client.Start(ctx); err != nil {

test/scenarios/auth/byok-anthropic/typescript/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CopilotClient , RuntimeConnection } from "@github/copilot-sdk";
1+
import { CopilotClient } from "@github/copilot-sdk";
22

33
async function main() {
44
const apiKey = process.env.ANTHROPIC_API_KEY;
@@ -9,9 +9,7 @@ async function main() {
99
process.exit(1);
1010
}
1111

12-
const client = new CopilotClient({
13-
connection: RuntimeConnection.forStdio({ path: process.env.COPILOT_CLI_PATH }),
14-
});
12+
const client = new CopilotClient();
1513

1614
try {
1715
const session = await client.createSession({

test/scenarios/auth/byok-azure/csharp/Program.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
return 1;
1212
}
1313

14-
using var client = new CopilotClient(new CopilotClientOptions
15-
{
16-
Connection = RuntimeConnection.ForStdio(path: Environment.GetEnvironmentVariable("COPILOT_CLI_PATH")),
17-
});
14+
using var client = new CopilotClient();
1815

1916
await client.StartAsync();
2017

test/scenarios/auth/byok-azure/go/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func main() {
2626
apiVersion = "2024-10-21"
2727
}
2828

29-
client := copilot.NewClient(&copilot.ClientOptions{})
29+
client := copilot.NewClient(nil)
3030

3131
ctx := context.Background()
3232
if err := client.Start(ctx); err != nil {

test/scenarios/auth/byok-azure/typescript/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CopilotClient , RuntimeConnection } from "@github/copilot-sdk";
1+
import { CopilotClient } from "@github/copilot-sdk";
22

33
async function main() {
44
const endpoint = process.env.AZURE_OPENAI_ENDPOINT;
@@ -10,9 +10,7 @@ async function main() {
1010
process.exit(1);
1111
}
1212

13-
const client = new CopilotClient({
14-
connection: RuntimeConnection.forStdio({ path: process.env.COPILOT_CLI_PATH }),
15-
});
13+
const client = new CopilotClient();
1614

1715
try {
1816
const session = await client.createSession({

test/scenarios/auth/byok-ollama/csharp/Program.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
var compactSystemPrompt =
77
"You are a compact local assistant. Keep answers short, concrete, and under 80 words.";
88

9-
using var client = new CopilotClient(new CopilotClientOptions
10-
{
11-
Connection = RuntimeConnection.ForStdio(path: Environment.GetEnvironmentVariable("COPILOT_CLI_PATH")),
12-
});
9+
using var client = new CopilotClient();
1310

1411
await client.StartAsync();
1512

test/scenarios/auth/byok-ollama/go/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func main() {
2222
model = "llama3.2:3b"
2323
}
2424

25-
client := copilot.NewClient(&copilot.ClientOptions{})
25+
client := copilot.NewClient(nil)
2626

2727
ctx := context.Background()
2828
if err := client.Start(ctx); err != nil {

test/scenarios/auth/byok-ollama/typescript/src/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { CopilotClient , RuntimeConnection } from "@github/copilot-sdk";
1+
import { CopilotClient } from "@github/copilot-sdk";
22

3-
const OLLAMA_BASE_URL = process.env.OLLAMA_BASE_URL ?? "http://localhost:11434/v1";
3+
const OLLAMA_BASE_URL =
4+
process.env.OLLAMA_BASE_URL ?? "http://localhost:11434/v1";
45
const OLLAMA_MODEL = process.env.OLLAMA_MODEL ?? "llama3.2:3b";
56

67
const COMPACT_SYSTEM_PROMPT =
78
"You are a compact local assistant. Keep answers short, concrete, and under 80 words.";
89

910
async function main() {
10-
const client = new CopilotClient({
11-
connection: RuntimeConnection.forStdio({ path: process.env.COPILOT_CLI_PATH }),
12-
});
11+
const client = new CopilotClient();
1312

1413
try {
1514
const session = await client.createSession({

test/scenarios/auth/byok-openai/csharp/Program.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
return 1;
1111
}
1212

13-
using var client = new CopilotClient(new CopilotClientOptions
14-
{
15-
Connection = RuntimeConnection.ForStdio(path: Environment.GetEnvironmentVariable("COPILOT_CLI_PATH")),
16-
});
13+
using var client = new CopilotClient();
1714

1815
await client.StartAsync();
1916

0 commit comments

Comments
 (0)