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
56 changes: 28 additions & 28 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 @@ -5775,7 +5775,7 @@
"@anthropic-ai/claude-agent-sdk": "0.2.5",
"@anthropic-ai/sdk": "^0.71.2",
"@github/blackbird-external-ingest-utils": "^0.1.0",
"@github/copilot": "^0.0.406",
"@github/copilot": "^0.0.414",
"@google/genai": "^1.22.0",
"@humanwhocodes/gitignore-to-minimatch": "1.0.2",
"@microsoft/tiktokenizer": "^1.0.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,14 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
this.monitorSessionFiles();
this._sessionManager = new Lazy<Promise<internal.LocalSessionManager>>(async () => {
const { internal } = await this.copilotCLISDK.getPackage();
return new internal.LocalSessionManager({});
try {
const telemetryService = new internal.NoopTelemetryService();
return new internal.LocalSessionManager({ telemetryService, flushDebounceMs: undefined, settings: undefined, version: undefined });
}
catch (error) {
this.logService.error(`Failed to initialize Copilot CLI Session Manager: ${error}`);
throw error;
}
});
this._sessionTracker = this.instantiationService.createInstance(CopilotCLISessionWorkspaceTracker);
}
Expand Down
9 changes: 7 additions & 2 deletions src/extension/agents/copilotcli/node/ripgrepShim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ export async function ensureRipgrepShim(extensionPath: string, vscodeAppRoot: st
}

async function _ensureRipgrepShim(extensionPath: string, vscodeAppRoot: string, logService: ILogService): Promise<void> {
const ripgrepDir = path.join(extensionPath, 'node_modules', '@github', 'copilot', 'sdk', 'ripgrep', 'bin', process.platform + '-' + process.arch);
const vscodeRipgrepPath = path.join(vscodeAppRoot, 'node_modules', '@vscode', 'ripgrep', 'bin');

await copyRipgrepShim(extensionPath, vscodeRipgrepPath, logService);
}

export async function copyRipgrepShim(extensionPath: string, vscodeRipgrepPath: string, logService: ILogService): Promise<void> {
const ripgrepDir = path.join(extensionPath, 'node_modules', '@github', 'copilot', 'sdk', 'ripgrep', 'bin', process.platform + '-' + process.arch);

logService.info(`Creating ripgrep shim: source=${vscodeRipgrepPath}, dest=${ripgrepDir}`);
try {
await fs.mkdir(ripgrepDir, { recursive: true });
Expand Down Expand Up @@ -136,4 +141,4 @@ async function isShimMaterialized(destDir: string, primaryBinary: string | undef
}

return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('CopilotCLISessionService', () => {
beforeEach(async () => {
vi.useRealTimers();
const sdk = {
getPackage: vi.fn(async () => ({ internal: { LocalSessionManager: MockCliSdkSessionManager } }))
getPackage: vi.fn(async () => ({ internal: { LocalSessionManager: MockCliSdkSessionManager, NoopTelemetryService: class { } } }))
} as unknown as ICopilotCLISDK;

const services = disposables.add(createExtensionUnitTestingServices());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('CopilotCLIChatSessionParticipant.handleRequest', () => {
beforeEach(async () => {
cliSessions.length = 0;
const sdk = {
getPackage: vi.fn(async () => ({ internal: { LocalSessionManager: MockCliSdkSessionManager } }))
getPackage: vi.fn(async () => ({ internal: { LocalSessionManager: MockCliSdkSessionManager, NoopTelemetryService: class { } } })),
} as unknown as ICopilotCLISDK;
const services = disposables.add(createExtensionUnitTestingServices());
const accessor = services.createTestingAccessor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
import { promises as fs } from 'fs';
import { isBinaryFile } from 'isbinaryfile';
import * as path from 'path';
import { describe, it } from 'vitest';
import { beforeAll, describe, it } from 'vitest';
import { TestLogService } from '../../../../platform/testing/common/testLogService';
import { copyNodePtyFiles } from '../../../agents/copilotcli/node/nodePtyShim';
import { copyRipgrepShim } from '../../../agents/copilotcli/node/ripgrepShim';

describe('CopilotCLI SDK Upgrade', function () {
const extensionPath = path.join(__dirname, '..', '..', '..', '..', '..');
const copilotSDKPath = path.join(extensionPath, 'node_modules', '@github', 'copilot');
beforeAll(async function () {
await copyBinaries(extensionPath);
});
it('should be able to load the SDK without errors', async function () {
await import('@github/copilot/sdk');
});

it('should not contain new native binaries nor removed native binaries', async function () {
// This is a very basic check to ensure that when the Copilot CLI SDK is upgraded,
// we are aware of any changes to the native binaries it contains.
Expand All @@ -30,24 +38,12 @@ describe('CopilotCLI SDK Upgrade', function () {
path.join('prebuilds', 'win32-arm64', 'conpty.pdb'),
path.join('prebuilds', 'win32-arm64', 'conpty_console_list.node'),
path.join('prebuilds', 'win32-arm64', 'conpty_console_list.pdb'),
path.join('prebuilds', 'win32-arm64', 'pty.node'),
path.join('prebuilds', 'win32-arm64', 'pty.pdb'),
path.join('prebuilds', 'win32-arm64', 'winpty-agent.exe'),
path.join('prebuilds', 'win32-arm64', 'winpty-agent.pdb'),
path.join('prebuilds', 'win32-arm64', 'winpty.dll'),
path.join('prebuilds', 'win32-arm64', 'winpty.pdb'),
path.join('prebuilds', 'win32-x64', 'conpty', 'OpenConsole.exe'),
path.join('prebuilds', 'win32-x64', 'conpty', 'conpty.dll'),
path.join('prebuilds', 'win32-x64', 'conpty.node'),
path.join('prebuilds', 'win32-x64', 'conpty.pdb'),
path.join('prebuilds', 'win32-x64', 'conpty_console_list.node'),
path.join('prebuilds', 'win32-x64', 'conpty_console_list.pdb'),
path.join('prebuilds', 'win32-x64', 'pty.node'),
path.join('prebuilds', 'win32-x64', 'pty.pdb'),
path.join('prebuilds', 'win32-x64', 'winpty-agent.exe'),
path.join('prebuilds', 'win32-x64', 'winpty-agent.pdb'),
path.join('prebuilds', 'win32-x64', 'winpty.dll'),
path.join('prebuilds', 'win32-x64', 'winpty.pdb'),
// ripgrep
path.join('ripgrep', 'bin', 'win32-arm64', 'rg.exe'),
path.join('ripgrep', 'bin', 'win32-x64', 'rg.exe'),
Expand Down Expand Up @@ -111,6 +107,12 @@ describe('CopilotCLI SDK Upgrade', function () {
});
});

async function copyBinaries(extensionPath: string) {
const nodePtyPrebuilds = path.join(extensionPath, 'node_modules', '@github', 'copilot', 'prebuilds', process.platform + '-' + process.arch);
const vscodeRipgrepPath = path.join(extensionPath, 'node_modules', '@github', 'copilot', 'ripgrep', 'bin', process.platform + '-' + process.arch);
await copyNodePtyFiles(extensionPath, nodePtyPrebuilds, new TestLogService());
await copyRipgrepShim(extensionPath, vscodeRipgrepPath, new TestLogService());
}
async function findAllBinaries(dir: string): Promise<string[]> {
const binaryFiles: string[] = [];
const filesToIgnore = ['.DS_Store'];
Expand Down