Skip to content

Commit 4cba715

Browse files
authored
Merge branch 'main' into lramos15/pleased-woodpecker
2 parents ecc5ee9 + 2e6888c commit 4cba715

File tree

145 files changed

+1625
-579
lines changed

Some content is hidden

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

145 files changed

+1625
-579
lines changed

chat-lib/test/getInlineCompletions.spec.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ResultType } from '../src/_internal/extension/completions-core/vscode-n
1616
import { createTextDocument } from '../src/_internal/extension/completions-core/vscode-node/lib/src/test/textDocument';
1717
import { TextDocumentIdentifier } from '../src/_internal/extension/completions-core/vscode-node/lib/src/textDocument';
1818
import { TextDocumentChangeEvent, TextDocumentCloseEvent, TextDocumentFocusedEvent, TextDocumentOpenEvent, WorkspaceFoldersChangeEvent } from '../src/_internal/extension/completions-core/vscode-node/lib/src/textDocumentManager';
19-
import { CopilotToken, TokenEnvelope } from '../src/_internal/platform/authentication/common/copilotToken';
19+
import { CopilotToken, createTestExtendedTokenInfo } from '../src/_internal/platform/authentication/common/copilotToken';
2020
import { ChatEndpointFamily, EmbeddingsEndpointFamily } from '../src/_internal/platform/endpoint/common/endpointProvider';
2121
import { MutableObservableWorkspace } from '../src/_internal/platform/inlineEdits/common/observableWorkspace';
2222
import { FetchOptions, IAbortController, IHeaders, PaginationOptions, Response } from '../src/_internal/platform/networking/common/fetcherService';
@@ -100,18 +100,10 @@ class TestFetcher implements IFetcher {
100100
}
101101
}
102102

103-
function createTestCopilotToken(envelope?: Partial<Omit<TokenEnvelope, 'expires_at'>>): CopilotToken {
104-
const REFRESH_BUFFER_SECONDS = 60;
105-
const expires_at = Date.now() + ((envelope?.refresh_in ?? 0) + REFRESH_BUFFER_SECONDS) * 1000;
106-
return new CopilotToken({
103+
function createTestCopilotToken(): CopilotToken {
104+
return new CopilotToken(createTestExtendedTokenInfo({
107105
token: `test token ${Math.ceil(Math.random() * 100)}`,
108-
refresh_in: 0,
109-
expires_at,
110-
username: 'testuser',
111-
isVscodeTeamMember: false,
112-
copilot_plan: 'testsku',
113-
...envelope
114-
});
106+
}));
115107
}
116108

117109
class TestAuthService extends Disposable implements IAuthenticationService {

chat-lib/test/nesProvider.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { outdent } from 'outdent';
1212
import * as path from 'path';
1313
import * as stream from 'stream';
1414
import { assert, describe, expect, it } from 'vitest';
15-
import { CopilotToken } from '../src/_internal/platform/authentication/common/copilotToken';
15+
import { CopilotToken, createTestExtendedTokenInfo } from '../src/_internal/platform/authentication/common/copilotToken';
1616
import { ICopilotTokenManager } from '../src/_internal/platform/authentication/common/copilotTokenManager';
1717
import { DocumentId } from '../src/_internal/platform/inlineEdits/common/dataTypes/documentId';
1818
import { MutableObservableWorkspace } from '../src/_internal/platform/inlineEdits/common/observableWorkspace';
@@ -97,7 +97,7 @@ class TestCopilotTokenManager implements ICopilotTokenManager {
9797
onDidCopilotTokenRefresh = new Emitter<void>().event;
9898

9999
async getCopilotToken(force?: boolean): Promise<CopilotToken> {
100-
return new CopilotToken({ token: 'fixedToken', expires_at: 0, refresh_in: 0, username: 'fixedTokenManager', isVscodeTeamMember: false, copilot_plan: 'unknown' });
100+
return new CopilotToken(createTestExtendedTokenInfo({ token: 'fixedToken' }));
101101
}
102102

103103
resetCopilotToken(httpError?: number): void {

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,12 @@
21142114
"category": "Chat",
21152115
"enablement": "github.copilot-chat.activated"
21162116
},
2117+
{
2118+
"command": "github.copilot.deleteExternalIngestWorkspaceIndex",
2119+
"title": "%github.copilot.command.deleteExternalIngestWorkspaceIndex%",
2120+
"category": "Developer",
2121+
"enablement": "github.copilot-chat.activated"
2122+
},
21172123
{
21182124
"command": "github.copilot.report",
21192125
"title": "Report Issue",
@@ -3910,7 +3916,7 @@
39103916
"github.copilot.chat.CCAPartnerAgents.enabled": {
39113917
"type": "boolean",
39123918
"default": false,
3913-
"markdownDescription": "Enable partner agents for Copilot Coding Agent (CCA) sessions.",
3919+
"markdownDescription": "Enable partner agents for Copilot Coding Agent (CCA) sessions. Reload VS Code to apply.",
39143920
"tags": [
39153921
"advanced",
39163922
"experimental"

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"github.copilot.command.sendChatFeedback": "Send Chat Feedback",
3333
"github.copilot.command.buildLocalWorkspaceIndex": "Build Local Workspace Index",
3434
"github.copilot.command.buildRemoteWorkspaceIndex": "Build Remote Workspace Index",
35+
"github.copilot.command.deleteExternalIngestWorkspaceIndex": "Delete External Ingest Workspace Index",
3536
"github.copilot.viewsWelcome.individual.expired": "Your Copilot subscription has expired.\n\n[Review Copilot Settings](https://github.com/settings/copilot?editor=vscode)",
3637
"github.copilot.viewsWelcome.enterprise": "Contact your GitHub organization administrator to enable Copilot.",
3738
"github.copilot.viewsWelcome.offline": {

src/extension/agents/vscode-node/test/organizationAndEnterpriseAgentProvider.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class MockOctoKitService implements IOctoKitService {
4444
getUserOrganizations = async () => this.userOrganizations;
4545
getOrganizationRepositories = async (org: string) => [org === 'testorg' ? 'testrepo' : 'repo'];
4646
getCopilotAgentModels = async () => [];
47+
getAssignableActors = async () => [];
4748

4849
async getCustomAgents(owner: string, repo: string, options: CustomAgentListOptions, authOptions: { createIfNone?: boolean }): Promise<CustomAgentListItem[]> {
4950
if (!(await this.getCurrentAuthedUser())) {

src/extension/byok/common/geminiMessageConverter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function apiContentToGeminiContent(content: (LanguageModelTextPart | LanguageMod
7777
// Handle case with text content (may also have images)
7878
try {
7979
responsePayload = JSON.parse(textContent);
80-
if (typeof responsePayload !== 'object' || responsePayload === null) {
80+
if (typeof responsePayload !== 'object' || responsePayload === null || Array.isArray(responsePayload)) {
8181
responsePayload = { result: responsePayload };
8282
}
8383
} catch {

src/extension/byok/common/test/geminiMessageConverter.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@ describe('GeminiMessageConverter', () => {
102102
expect(fr.functionResponse.response).toEqual({ foo: 'bar' });
103103
});
104104

105+
it('should wrap array responses in an object', () => {
106+
const toolResult = new LanguageModelToolResultPart('listRepos_12345', [new LanguageModelTextPart('["repo1", "repo2"]')]);
107+
const messages: LanguageModelChatMessage[] = [
108+
{
109+
role: LanguageModelChatMessageRole.Assistant,
110+
content: [toolResult],
111+
name: undefined
112+
}
113+
];
114+
115+
const result = apiMessageToGeminiMessage(messages);
116+
117+
expect(result.contents).toHaveLength(1);
118+
expect(result.contents[0].role).toBe('user');
119+
const fr: any = result.contents[0].parts![0];
120+
expect(fr.functionResponse.response).toEqual({ result: ['repo1', 'repo2'] });
121+
});
122+
105123
it('should be idempotent when called multiple times (no duplication)', () => {
106124
const toolResult = new LanguageModelToolResultPart('doThing_12345', [new LMText('{"value":42}')]);
107125
const messages: LanguageModelChatMessage[] = [

src/extension/byok/vscode-node/anthropicProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export class AnthropicLMProvider implements BYOKModelProvider<LanguageModelChatI
299299
type: 'enabled',
300300
budget_tokens: thinkingBudget
301301
} : undefined,
302-
context_management: contextManagement as any,
302+
context_management: contextManagement as Anthropic.Beta.Messages.BetaContextManagementConfig | undefined,
303303
};
304304

305305
const wrappedProgress = new RecordedProgress(progress);
@@ -592,6 +592,7 @@ export class AnthropicLMProvider implements BYOKModelProvider<LanguageModelChatI
592592
completion_tokens: -1,
593593
prompt_tokens: chunk.message.usage.input_tokens + (chunk.message.usage.cache_creation_input_tokens ?? 0) + (chunk.message.usage.cache_read_input_tokens ?? 0),
594594
total_tokens: -1,
595+
// Cast needed: Anthropic returns cache_creation_input_tokens which APIUsage.prompt_tokens_details doesn't define
595596
prompt_tokens_details: {
596597
cached_tokens: chunk.message.usage.cache_read_input_tokens ?? 0,
597598
cache_creation_input_tokens: chunk.message.usage.cache_creation_input_tokens

src/extension/chatSessions/common/chatSessionWorktreeService.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export interface IChatSessionWorktreeService {
3434
setWorktreeProperties(sessionId: string, properties: string | ChatSessionWorktreeProperties): Promise<void>;
3535

3636
getWorktreePath(sessionId: string): vscode.Uri | undefined;
37-
getWorktreeRelativePath(sessionId: string): string | undefined;
3837

3938
applyWorktreeChanges(sessionId: string): Promise<void>;
4039
getWorktreeChanges(sessionId: string): Promise<vscode.ChatSessionChangedFile[] | undefined>;

src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
8484
const repository = this.gitService.activeRepository.get();
8585
if (!repository) {
8686
progress?.report(new vscode.ChatResponseWarningPart(vscode.l10n.t('Failed to create worktree for isolation, using default workspace directory')));
87+
this.logService.error('[ChatSessionWorktreeService][_createWorktree] No active repository found to create worktree for isolation.');
8788
return undefined;
8889
}
8990

@@ -103,6 +104,7 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
103104
} satisfies ChatSessionWorktreeProperties;
104105
}
105106
progress?.report(new vscode.ChatResponseWarningPart(vscode.l10n.t('Failed to create worktree for isolation, using default workspace directory')));
107+
this.logService.error('[ChatSessionWorktreeService][_createWorktree] Failed to create worktree for isolation.');
106108
return undefined;
107109
} catch (error) {
108110
progress?.report(new vscode.ChatResponseWarningPart(vscode.l10n.t('Error creating worktree for isolation: {0}', error instanceof Error ? error.message : String(error))));
@@ -137,17 +139,6 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
137139
}
138140
}
139141

140-
getWorktreeRelativePath(sessionId: string): string | undefined {
141-
const worktreePath = this.getWorktreePath(sessionId);
142-
if (!worktreePath) {
143-
return undefined;
144-
}
145-
146-
// TODO@rebornix, @osortega: read the workingtree name from git extension
147-
const lastIndex = worktreePath.fsPath.lastIndexOf('/');
148-
return worktreePath.fsPath.substring(lastIndex + 1);
149-
}
150-
151142
async applyWorktreeChanges(sessionId: string): Promise<void> {
152143
const worktreeProperties = this.getWorktreeProperties(sessionId);
153144

0 commit comments

Comments
 (0)