Skip to content

Commit 10f0706

Browse files
Address PR review comments from #1357
- Add missing RuntimeConnection imports to 26 test/scenarios TypeScript fixtures. The earlier batch rewrite added the .forStdio/.forUri call sites but missed the corresponding import statement, so each scenario failed to compile until now. - nodejs/test/e2e/harness/sdkTestContext.ts: strip the 'kind' property before spreading a user-supplied RuntimeConnection back through the forStdio/forTcp factory opts. The factory opt types don't accept 'kind' so the spread was producing excess-property type errors. - nodejs/src/client.ts: rewrite the 'Path to Copilot CLI is required' error message to point at the new connection options (RuntimeConnection.forStdio({ path }), forTcp({ path }), forUri(...), or the COPILOT_CLI_PATH environment variable). The old message referenced removed cliPath / cliUrl options. - nodejs/src/client.ts: change the default logLevel from 'debug' to 'info'. 'debug' was a TS-only outlier; Python and Rust default to 'info', and the README has always claimed 'info'. Go and .NET don't pass --log-level at all when omitted (CLI defaults to info anyway), so 'info' is consistent with every other SDK's effective default. - nodejs/src/types.ts: fix MCPServerConfigBase.tools doc comment to spell the all-tools sentinel as ['*'] (the actual type is string[], so a bare '*' string can't be passed). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bc0d2aa commit 10f0706

29 files changed

Lines changed: 42 additions & 34 deletions

File tree

nodejs/src/client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ export class CopilotClient {
375375

376376
this.options = {
377377
cwd: options.cwd ?? process.cwd(),
378-
logLevel: options.logLevel || "debug",
378+
logLevel: options.logLevel || "info",
379379
gitHubToken: options.gitHubToken,
380380
// Default useLoggedInUser to false when gitHubToken is provided, otherwise true.
381381
useLoggedInUser: options.useLoggedInUser ?? (options.gitHubToken ? false : true),
@@ -1550,7 +1550,11 @@ export class CopilotClient {
15501550

15511551
if (!this.resolvedCliPath) {
15521552
throw new Error(
1553-
"Path to Copilot CLI is required. Please provide it via the cliPath option, or use cliUrl to rely on a remote CLI."
1553+
"Path to Copilot CLI is required. Please supply it via " +
1554+
"`RuntimeConnection.forStdio({ path })` or " +
1555+
"`RuntimeConnection.forTcp({ path })`, set the COPILOT_CLI_PATH " +
1556+
"environment variable, or use `RuntimeConnection.forUri(...)` to " +
1557+
"connect to an already-running runtime."
15541558
);
15551559
}
15561560

nodejs/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ export interface SessionHooks {
12111211
interface MCPServerConfigBase {
12121212
/**
12131213
* List of tools to include from this server.
1214-
* `undefined` (the default) or `"*"` means include all tools.
1214+
* `undefined` (the default) or `["*"]` means include all tools.
12151215
* `[]` means include none.
12161216
*/
12171217
tools?: string[];

nodejs/test/e2e/harness/sdkTestContext.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,20 @@ export async function createSdkTestContext({
7070
let connection: RuntimeConnection;
7171
if (userConn) {
7272
// Caller supplied a RuntimeConnection — merge in the harness-managed
73-
// CLI path (and stay on TCP if the caller asked for that variant).
73+
// CLI path (and stay on the same transport variant). Strip `kind`
74+
// before forwarding to the factory opts since the factories don't
75+
// accept it in their argument shape.
7476
if (userConn.kind === "tcp") {
77+
const { kind: _k, ...tcp } = userConn;
7578
connection = RuntimeConnection.forTcp({
76-
...userConn,
77-
path: userConn.path ?? process.env.COPILOT_CLI_PATH,
79+
...tcp,
80+
path: tcp.path ?? process.env.COPILOT_CLI_PATH,
7881
});
7982
} else if (userConn.kind === "stdio") {
83+
const { kind: _k, ...stdio } = userConn;
8084
connection = RuntimeConnection.forStdio({
81-
...userConn,
82-
path: userConn.path ?? process.env.COPILOT_CLI_PATH,
85+
...stdio,
86+
path: stdio.path ?? process.env.COPILOT_CLI_PATH,
8387
});
8488
} else {
8589
connection = userConn;

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

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

33
async function main() {
44
const apiKey = process.env.ANTHROPIC_API_KEY;

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

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

33
async function main() {
44
const endpoint = process.env.AZURE_OPENAI_ENDPOINT;

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

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

33
const OLLAMA_BASE_URL = process.env.OLLAMA_BASE_URL ?? "http://localhost:11434/v1";
44
const OLLAMA_MODEL = process.env.OLLAMA_MODEL ?? "llama3.2:3b";

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

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

33
const OPENAI_BASE_URL = process.env.OPENAI_BASE_URL ?? "https://api.openai.com/v1";
44
const OPENAI_MODEL = process.env.OPENAI_MODEL ?? "claude-haiku-4.5";

test/scenarios/auth/gh-app/typescript/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CopilotClient } from "@github/copilot-sdk";
1+
import { CopilotClient , RuntimeConnection } from "@github/copilot-sdk";
22
import readline from "node:readline/promises";
33
import { stdin as input, stdout as output } from "node:process";
44

test/scenarios/bundling/fully-bundled/typescript/src/index.ts

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

33
async function main() {
44
const client = new CopilotClient({

test/scenarios/callbacks/hooks/typescript/src/index.ts

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

33
async function main() {
44
const hookLog: string[] = [];

0 commit comments

Comments
 (0)