Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/actions/setup-copilot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ runs:
shell: bash
- name: Set CLI path
id: cli-path
run: echo "path=$(pwd)/nodejs/node_modules/@github/copilot/index.js" >> $GITHUB_OUTPUT
run: |
# As of CLI 1.0.64-1 the @github/copilot package is a thin loader; the
# runnable index.js ships in the installed platform package
# (e.g. @github/copilot-linux-x64). Exactly one is installed.
cli_path=$(ls "$(pwd)"/nodejs/node_modules/@github/copilot-*/index.js 2>/dev/null | head -n1)
if [ -z "$cli_path" ]; then
echo "Could not find @github/copilot platform package (index.js) under nodejs/node_modules" >&2
exit 1
fi
echo "path=$cli_path" >> $GITHUB_OUTPUT
shell: bash
- name: Verify CLI works
run: node ${{ steps.cli-path.outputs.path }} --version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
run: mvn javadoc:javadoc -q

- name: Verify CLI works
run: node ../nodejs/node_modules/@github/copilot/index.js --version
run: node ../nodejs/node_modules/@github/copilot/npm-loader.js --version

- name: Run spotless check
if: matrix.test-jdk == '25'
Expand Down
4 changes: 2 additions & 2 deletions docs/features/image-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func main() {
Prompt: "Describe what you see in this image",
Attachments: []copilot.Attachment{
&copilot.AttachmentBlob{
Data: base64ImageData,
Data: &base64ImageData,
MIMEType: mimeType,
DisplayName: &displayName,
},
Expand All @@ -362,7 +362,7 @@ session.Send(ctx, copilot.MessageOptions{
Prompt: "Describe what you see in this image",
Attachments: []copilot.Attachment{
&copilot.AttachmentBlob{
Data: base64ImageData, // base64-encoded string
Data: &base64ImageData, // base64-encoded string
MIMEType: mimeType,
DisplayName: &displayName,
},
Expand Down
295 changes: 290 additions & 5 deletions dotnet/src/Generated/Rpc.cs

Large diffs are not rendered by default.

607 changes: 543 additions & 64 deletions dotnet/src/Generated/SessionEvents.cs

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions dotnet/test/Harness/E2ETestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,21 @@ private static string GetCliPath(string repoRoot)
var envPath = Environment.GetEnvironmentVariable("COPILOT_CLI_PATH");
if (!string.IsNullOrEmpty(envPath)) return envPath;

var path = Path.Combine(repoRoot, "nodejs/node_modules/@github/copilot/index.js");
if (!File.Exists(path))
throw new InvalidOperationException($"CLI not found at {path}. Run 'npm install' in the nodejs directory first.");
// As of CLI 1.0.64-1 the @github/copilot package is a thin loader; the
// runnable index.js ships in the installed platform package
// (e.g. @github/copilot-linux-x64). Exactly one is installed.
var githubModules = Path.Join(repoRoot, "nodejs", "node_modules", "@github");
if (Directory.Exists(githubModules))
{
var candidate = Directory.EnumerateDirectories(githubModules, "copilot-*")
.Select(dir => Path.Join(dir, "index.js"))
.FirstOrDefault(File.Exists);
if (candidate != null)
return candidate;
}

return path;
throw new InvalidOperationException(
$"CLI not found under {githubModules}. Run 'npm install' in the nodejs directory first.");
}

public async Task ConfigureForTestAsync(string testFile, [CallerMemberName] string? testName = null)
Expand Down Expand Up @@ -173,6 +183,11 @@ public Dictionary<string, string> GetEnvironment()
.ToDictionary(e => (string)e.Key, e => e.Value?.ToString());

env["COPILOT_API_URL"] = ProxyUrl;
// Route GitHub API calls (e.g. the MCP registry policy check) to the
// replay proxy so MCP enablement stays hermetic. Without this the CLI
// reaches the real api.github.com, which is slow/unreachable on macOS
// CI runners and makes MCP servers time out before reaching connected.
env["COPILOT_DEBUG_GITHUB_API_URL"] = ProxyUrl;
env["COPILOT_HOME"] = HomeDir;
env["GH_CONFIG_DIR"] = HomeDir;
env["XDG_CONFIG_HOME"] = HomeDir;
Expand Down
28 changes: 13 additions & 15 deletions go/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,18 +420,16 @@ func TestClient_SessionIdleTimeoutSeconds(t *testing.T) {
}

func findCLIPathForTest() string {
abs, _ := filepath.Abs("../nodejs/node_modules/@github/copilot/index.js")
if fileExistsForTest(abs) {
return abs
base, err := filepath.Abs("../nodejs/node_modules/@github")
if err == nil {
matches, _ := filepath.Glob(filepath.Join(base, "copilot-*", "index.js"))
if len(matches) > 0 {
return matches[0]
}
}
return ""
}

func fileExistsForTest(path string) bool {
_, err := os.Stat(path)
return err == nil
}

func TestCreateSessionRequest_ClientName(t *testing.T) {
t.Run("includes clientName in JSON when set", func(t *testing.T) {
req := createSessionRequest{ClientName: "my-app"}
Expand Down Expand Up @@ -1098,7 +1096,7 @@ func TestModelBillingTokenPricesJSON(t *testing.T) {
"inputPrice": 4.0,
"outputPrice": 16.0,
"cachePrice": 1.0,
"contextMax": 1000000
"maxPromptTokens": 1000000
}
}
}`
Expand All @@ -1109,10 +1107,10 @@ func TestModelBillingTokenPricesJSON(t *testing.T) {
BatchSize: int64Ptr(1000000),
ContextMax: int64Ptr(128000),
LongContext: &rpc.ModelBillingTokenPricesLongContext{
InputPrice: Float64(4.0),
OutputPrice: Float64(16.0),
CachePrice: Float64(1.0),
ContextMax: int64Ptr(1000000),
InputPrice: Float64(4.0),
OutputPrice: Float64(16.0),
CachePrice: Float64(1.0),
MaxPromptTokens: int64Ptr(1000000),
},
}

Expand All @@ -1135,8 +1133,8 @@ func TestModelBillingTokenPricesJSON(t *testing.T) {
if lc.InputPrice == nil || *lc.InputPrice != 4.0 {
t.Errorf("unexpected LongContext.InputPrice: %v", lc.InputPrice)
}
if lc.ContextMax == nil || *lc.ContextMax != 1000000 {
t.Errorf("unexpected LongContext.ContextMax: %v", lc.ContextMax)
if lc.MaxPromptTokens == nil || *lc.MaxPromptTokens != 1000000 {
t.Errorf("unexpected LongContext.MaxPromptTokens: %v", lc.MaxPromptTokens)
}

// Round-trip back to JSON and ensure the nested structure survives.
Expand Down
2 changes: 1 addition & 1 deletion go/internal/e2e/session_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ func TestSessionBlobAttachmentE2E(t *testing.T) {
Prompt: "Describe this image",
Attachments: []copilot.Attachment{
&copilot.AttachmentBlob{
Data: data,
Data: &data,
MIMEType: mimeType,
DisplayName: &displayName,
},
Expand Down
21 changes: 16 additions & 5 deletions go/internal/e2e/testharness/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ func CLIPath() string {
return
}

// Look for CLI in sibling nodejs directory's node_modules
abs, err := filepath.Abs("../../../nodejs/node_modules/@github/copilot/index.js")
if err == nil && fileExists(abs) {
cliPath = abs
return
// Look for CLI in sibling nodejs directory's node_modules. As of CLI
// 1.0.64-1 the @github/copilot package is a thin loader; the runnable
// index.js ships in the installed platform package
// (e.g. @github/copilot-linux-x64).
base, err := filepath.Abs("../../../nodejs/node_modules/@github")
if err == nil {
matches, _ := filepath.Glob(filepath.Join(base, "copilot-*", "index.js"))
if len(matches) > 0 {
cliPath = matches[0]
return
}
}
})
return cliPath
Expand Down Expand Up @@ -207,6 +213,11 @@ func (c *TestContext) Env() []string {
env = append(env, c.proxy.ProxyEnv()...)
env = append(env,
"COPILOT_API_URL="+c.ProxyURL,
// Route GitHub API calls (e.g. the MCP registry policy check) to the
// replay proxy so MCP enablement stays hermetic. Without this the CLI
// reaches the real api.github.com, which is slow/unreachable on macOS
// CI runners and makes MCP servers time out before reaching connected.
"COPILOT_DEBUG_GITHUB_API_URL="+c.ProxyURL,
"COPILOT_HOME="+c.HomeDir,
"COPILOT_SDK_AUTH_TOKEN="+defaultGitHubToken,
"GH_CONFIG_DIR="+c.HomeDir,
Expand Down
Loading
Loading