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
88 changes: 51 additions & 37 deletions extensions/copilot/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 extensions/copilot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6971,7 +6971,7 @@
"@anthropic-ai/claude-agent-sdk": "0.2.112",
"@anthropic-ai/sdk": "^0.82.0",
"@github/blackbird-external-ingest-utils": "^0.3.0",
"@github/copilot": "1.0.49",
"@github/copilot": "^1.0.57",
"@google/genai": "^1.22.0",
"@humanwhocodes/gitignore-to-minimatch": "1.0.2",
"@microsoft/tiktokenizer": "^1.0.10",
Expand Down
1 change: 1 addition & 0 deletions extensions/copilot/script/postinstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ async function copyCopilotCliPrebuildFiles() {
}
return src.endsWith('computer.node')
|| src.endsWith('runtime.node')
|| src.endsWith('cli-native.node')
// node-pty natives: pty.node (+ spawn-helper) on Unix,
// conpty.node and its companions on Windows. `endsWith('pty.node')`
// also matches `conpty.node`. The conpty native additionally needs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ export function buildChatHistoryFromEvents(sessionId: string, modelId: string |
}
});
((event.data.attachments || []))
.filter(attachment => attachment.type === 'selection' || attachment.type === 'github_reference' || attachment.type === 'blob' ? true : !isInstructionAttachmentPath(attachment.path))
.filter(attachment => attachment.type === 'selection' || attachment.type === 'github_reference' || attachment.type === 'blob' || attachment.type === 'extension_context' ? true : !isInstructionAttachmentPath(attachment.path))
.forEach(attachment => {
if (attachment.type === 'github_reference') {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import type { Uri } from 'vscode';
import { URI } from '../../../../util/vs/base/common/uri';
import type { internal } from '@github/copilot/sdk';

export type LocalSession = NonNullable<Awaited<ReturnType<internal.LocalSessionManager['getSession']>>>;
export type Session = LocalSession;

export namespace SessionIdForCLI {
export function getResource(sessionId: string): Uri {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,17 @@ export class CopilotCLISDK implements ICopilotCLISDK {
};
}

const { resolveAuthInfoFromToken } = await this.getPackage();
const copilotToken = await this.authentService.getGitHubSession('any', { silent: true });
return {
type: 'token',
token: copilotToken?.accessToken ?? '',
host: 'https://github.com'
};
const userInfo = copilotToken ? await resolveAuthInfoFromToken(copilotToken?.accessToken) : undefined;
if (!userInfo) {
return {
type: 'token',
token: copilotToken?.accessToken ?? '',
host: 'https://github.com'
};
}
return userInfo;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,51 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import type { Attachment, LocalSession, SendOptions, Session, SessionOptions, ToolExecutionCompleteEvent } from '@github/copilot/sdk';
import type { Attachment, SendOptions, SessionOptions, ToolExecutionCompleteEvent } from '@github/copilot/sdk';
import * as l10n from '@vscode/l10n';
import * as cp from 'child_process';
import * as crypto from 'crypto';
import type * as vscode from 'vscode';
import type { ChatParticipantToolToken } from 'vscode';
import { IAuthenticationService } from '../../../../platform/authentication/common/authentication';
import { IChatQuotaService } from '../../../../platform/chat/common/chatQuotaService';
import { getQuotaMessageForPlan } from '../../../../platform/chat/common/commonTypes';
import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
import { IGitService } from '../../../../platform/git/common/gitService';
import { PermissiveAuthRequiredError } from '../../../../platform/github/common/githubService';
import { ILogService } from '../../../../platform/log/common/logService';
import { GenAiMetrics } from '../../../../platform/otel/common/genAiMetrics';
import { CopilotChatAttr, GenAiAttr, GenAiOperationName, GenAiProviderName, IOTelService, ISpanHandle, SpanKind, SpanStatusCode, truncateForOTel, resolveWorkspaceOTelMetadata, workspaceMetadataToOTelAttributes } from '../../../../platform/otel/common/index';
import { CopilotChatAttr, GenAiAttr, GenAiOperationName, GenAiProviderName, IOTelService, ISpanHandle, resolveWorkspaceOTelMetadata, SpanKind, SpanStatusCode, truncateForOTel, workspaceMetadataToOTelAttributes } from '../../../../platform/otel/common/index';
import { CapturingToken } from '../../../../platform/requestLogger/common/capturingToken';
import { IRequestLogger, LoggedRequestKind } from '../../../../platform/requestLogger/common/requestLogger';
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry';
import { PromptTokenCategory, PromptTokenLabel } from '../../../../platform/tokenizer/node/promptTokenDetails';
import { IGitService } from '../../../../platform/git/common/gitService';
import { IWorkspaceService } from '../../../../platform/workspace/common/workspaceService';
import { raceCancellation } from '../../../../util/vs/base/common/async';
import { CancellationToken, CancellationTokenSource } from '../../../../util/vs/base/common/cancellation';
import { Codicon } from '../../../../util/vs/base/common/codicons';
import { Emitter } from '../../../../util/vs/base/common/event';
import { createSingleCallFunction } from '../../../../util/vs/base/common/functional';
import { DisposableStore, IDisposable, toDisposable } from '../../../../util/vs/base/common/lifecycle';
import { truncate } from '../../../../util/vs/base/common/strings';
import { ThemeIcon } from '../../../../util/vs/base/common/themables';
import { IInstantiationService } from '../../../../util/vs/platform/instantiation/common/instantiation';
import { ChatResponseMarkdownPart, ChatResponseThinkingProgressPart, ChatSessionStatus, ChatToolInvocationPart, EventEmitter, MarkdownString, Uri } from '../../../../vscodeTypes';
import { getQuotaMessageForPlan } from '../../../../platform/chat/common/commonTypes';
import { IToolsService } from '../../../tools/common/toolsService';
import { IChatSessionMetadataStore } from '../../common/chatSessionMetadataStore';
import { ExternalEditTracker } from '../../common/externalEditTracker';
import { getWorkingDirectory, isIsolationEnabled, IWorkspaceInfo } from '../../common/workspaceInfo';
import { clearTodoList, enrichToolInvocationWithSubagentMetadata, isCopilotCliEditToolCall, isCopilotCLIToolThatCouldRequirePermissions, isTodoRelatedSqlQuery, processToolExecutionComplete, processToolExecutionStart, stripReminders, ToolCall, updateTodoListFromSqlItems } from '../common/copilotCLITools';
import { clearPendingCopilotCLIRequestContext, setPendingCopilotCLIRequestContext } from '../common/pendingRequestContext';
import { LocalSession, Session, SessionIdForCLI } from '../common/utils';
import { getCopilotCLISessionDir } from './cliHelpers';
import { SessionIdForCLI } from '../common/utils';
import type { CopilotCliBridgeSpanProcessor } from './copilotCliBridgeSpanProcessor';
import { ICopilotCLIImageSupport } from './copilotCLIImageSupport';
import { handleExitPlanMode } from './exitPlanModeHandler';
import { type McCommand, type McEvent, type McSessionCreateResult, MissionControlApiClient } from './missionControlApiClient';
import { handleMcpPermission, handleReadPermission, handleShellPermission, handleWritePermission, type PermissionRequest, type PermissionRequestResult, showInteractivePermissionPrompt } from './permissionHelpers';
import { TodoSqlQuery } from './todoSqlQuery';
import { IQuestion, IQuestionAnswer, IUserQuestionHandler } from './userInputHelpers';
import { createSingleCallFunction } from '../../../../util/vs/base/common/functional';

/**
* Known commands that can be sent to a CopilotCLI session instead of a free-form prompt.
Expand Down Expand Up @@ -1686,7 +1686,7 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
return;
}
if (authInfo) {
this._sdkSession.setAuthInfo(authInfo);
this._sdkSession.updateOptions({ authInfo });
}
if (modelId) {
if (modelId !== currentModel) {
Expand Down Expand Up @@ -2571,6 +2571,8 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
lines.push(`- ${attachment.title}: (${attachment.number}, ${attachment.type}, ${attachment.referenceType})`);
} else if (attachment.type === 'blob') {
lines.push(`- ${attachment.displayName ?? 'blob'} (${attachment.type}, ${attachment.mimeType})`);
} else if (attachment.type === 'extension_context') {
lines.push(`- ${attachment.title ?? 'extension_context'} (${attachment.type}, ${attachment.extensionId})`);
} else {
lines.push(`- ${attachment.displayName} (${attachment.type}, ${attachment.type === 'selection' ? attachment.filePath : attachment.path})`);
}
Expand Down
Loading
Loading