Skip to content
Draft
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
114 changes: 109 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5191,7 +5191,7 @@
"@anthropic-ai/claude-agent-sdk": "0.1.55",
"@anthropic-ai/sdk": "^0.68.0",
"@github/blackbird-external-ingest-utils": "^0.1.0",
"@github/copilot": "^0.0.366",
"@github/copilot": "^0.0.374",
"@google/genai": "^1.22.0",
"@humanwhocodes/gitignore-to-minimatch": "1.0.2",
"@microsoft/tiktokenizer": "^1.0.10",
Expand Down
2 changes: 1 addition & 1 deletion src/extension/agents/copilotcli/node/copilotCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class CopilotCLIModels implements ICopilotCLIModels {
const [{ getAvailableModels }, authInfo] = await Promise.all([this.copilotCLISDK.getPackage(), this.copilotCLISDK.getAuthInfo()]);
try {
const models = await getAvailableModels(authInfo);
return models.map(model => ({ id: model.model, name: model.label }));
return models.map(model => ({ id: model.id, name: model.name }));
} catch (ex) {
this.logService.error(`[CopilotCLISession] Failed to fetch models`, ex);
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('CopilotCLI permissionHelpers', () => {

describe('getConfirmationToolParams', () => {
it('maps shell requests to terminal confirmation tool', async () => {
const result = await getConfirmationToolParams(instaService, { kind: 'shell', fullCommandText: 'rm -rf /tmp/test', canOfferSessionApproval: true, commands: [], hasWriteFileRedirection: true, intention: '', possiblePaths: [] });
const result = await getConfirmationToolParams(instaService, { kind: 'shell', fullCommandText: 'rm -rf /tmp/test', canOfferSessionApproval: true, commands: [], hasWriteFileRedirection: true, intention: '', possiblePaths: [], possibleUrls: [] });
assert(!!result);
expect(result.tool).toBe(ToolName.CoreTerminalConfirmationTool);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,7 @@ describe('CopilotCLI SDK Upgrade', function () {
path.join('ripgrep', 'bin', 'linux-x64', 'rg'),
path.join('ripgrep', 'bin', 'linux-arm64', 'rg'),
// sharp related files
path.join('sharp', 'node_modules', '@img', 'sharp-libvips-linux-arm64', 'lib', 'libvips-cpp.so.8.17.3'),
path.join('sharp', 'node_modules', '@img', 'sharp-libvips-linux-x64', 'lib', 'libvips-cpp.so.8.17.3'),
path.join('sharp', 'node_modules', '@img', 'sharp-darwin-arm64', 'lib', 'sharp-darwin-arm64.node'),
path.join('sharp', 'node_modules', '@img', 'sharp-darwin-x64', 'lib', 'sharp-darwin-x64.node'),
path.join('sharp', 'node_modules', '@img', 'sharp-libvips-darwin-arm64', 'lib', 'libvips-cpp.8.17.3.dylib'),
path.join('sharp', 'node_modules', '@img', 'sharp-libvips-darwin-x64', 'lib', 'libvips-cpp.8.17.3.dylib'),
path.join('sharp', 'node_modules', '@img', 'sharp-linux-arm64', 'lib', 'sharp-linux-arm64.node'),
path.join('sharp', 'node_modules', '@img', 'sharp-linux-x64', 'lib', 'sharp-linux-x64.node'),
path.join('sharp', 'node_modules', '@img', 'sharp-win32-arm64', 'lib', 'libvips-42.dll'),
path.join('sharp', 'node_modules', '@img', 'sharp-win32-arm64', 'lib', 'libvips-cpp-8.17.3.dll'),
path.join('sharp', 'node_modules', '@img', 'sharp-win32-arm64', 'lib', 'sharp-win32-arm64.node'),
path.join('sharp', 'node_modules', '@img', 'sharp-win32-x64', 'lib', 'libvips-42.dll'),
path.join('sharp', 'node_modules', '@img', 'sharp-win32-x64', 'lib', 'libvips-cpp-8.17.3.dll'),
path.join('sharp', 'node_modules', '@img', 'sharp-win32-x64', 'lib', 'sharp-win32-x64.node'),
path.join('sharp', 'node_modules', '@img', 'sharp-wasm32', 'lib', 'sharp-wasm32.node.wasm'),
// parsing commands for shell.
'tree-sitter-bash.wasm',
'tree-sitter-powershell.wasm',
Expand Down Expand Up @@ -134,4 +121,4 @@ async function findAllBinaries(dir: string): Promise<string[]> {

await findFilesRecursively(dir);
return binaryFiles;
}
}
38 changes: 37 additions & 1 deletion test/e2e/cli.stest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { SessionOptions } from '@github/copilot/sdk';
import assert from 'assert';
import * as fs from 'fs/promises';
import * as http from 'http';
import { platform, tmpdir } from 'os';
import * as path from 'path';
import type { ChatPromptReference } from 'vscode';
Expand Down Expand Up @@ -102,7 +103,7 @@ function registerChatServices(testingServiceCollection: TestingServiceCollection
mutableOptions.copilotUrl = this.testOptions.copilotUrl ?? options.copilotUrl;
mutableOptions.enableStreaming = true;
mutableOptions.skipCustomInstructions = true;
mutableOptions.disableHttpLogging = true;
// mutableOptions.disableHttpLogging = true;
return options;
}
}
Expand Down Expand Up @@ -130,6 +131,41 @@ function registerChatServices(testingServiceCollection: TestingServiceCollection
this.adapterFactories.set('/chat/completions', oaiAdapterFactory);
requestHooks.forEach(requestHook => oaiAdapterFactory.addHooks(requestHook));
responseHooks.forEach(responseHook => oaiAdapterFactory.addHooks(undefined, responseHook));
this.requestHandlers.set('/graphql', { method: 'POST', handler: this.graphqlHandler.bind(this) });
this.requestHandlers.set('/models', { method: 'GET', handler: this.modelsHandler.bind(this) });
}

private async graphqlHandler(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
res.writeHead(200, { 'Content-Type': 'application/json' });
const data = {
viewer: {
login: '',
copilotEndpoints: {
api: `http://localhost:${this.config.port}`
}
}
};
res.end(JSON.stringify({ data }));
}
private async modelsHandler(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
res.writeHead(200, { 'Content-Type': 'application/json', 'x-github-request-id': 'TESTREQUESTID1234' });
const endpoints = await this.endpointProvider.getAllChatEndpoints();
const data = endpoints.map(e => {
return {
id: e.model,
name: e.model,
capabilities: {
supports: {
vision: e.supportsVision,
},
limits: {
max_prompt_tokens: e.modelMaxPromptTokens,
max_context_window_tokens: e.maxOutputTokens,
}
}
};
});
res.end(JSON.stringify({ data }));
}
}

Expand Down
Loading