diff --git a/extensions/copilot/package-lock.json b/extensions/copilot/package-lock.json index 85e1c499f5a..fb195fcc003 100644 --- a/extensions/copilot/package-lock.json +++ b/extensions/copilot/package-lock.json @@ -13,7 +13,7 @@ "@anthropic-ai/claude-agent-sdk": "^0.2.63", "@anthropic-ai/sdk": "^0.78.0", "@github/blackbird-external-ingest-utils": "^0.3.0", - "@github/copilot": "^1.0.2", + "@github/copilot": "^1.0.4", "@google/genai": "^1.22.0", "@humanwhocodes/gitignore-to-minimatch": "1.0.2", "@microsoft/tiktokenizer": "^1.0.10", @@ -3182,26 +3182,26 @@ "license": "MIT" }, "node_modules/@github/copilot": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.2.tgz", - "integrity": "sha512-716SIZMYftldVcJay2uZOzsa9ROGGb2Mh2HnxbDxoisFsWNNgZlQXlV7A+PYoGsnAo2Zk/8e1i5SPTscGf2oww==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.4.tgz", + "integrity": "sha512-IpPg+zYplLu4F4lmatEDdR/1Y/jJ9cGWt89m3K3H4YSfYrZ5Go4UlM28llulYCG7sVdQeIGauQN1/KiBI/Rocg==", "license": "SEE LICENSE IN LICENSE.md", "bin": { "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.2", - "@github/copilot-darwin-x64": "1.0.2", - "@github/copilot-linux-arm64": "1.0.2", - "@github/copilot-linux-x64": "1.0.2", - "@github/copilot-win32-arm64": "1.0.2", - "@github/copilot-win32-x64": "1.0.2" + "@github/copilot-darwin-arm64": "1.0.4", + "@github/copilot-darwin-x64": "1.0.4", + "@github/copilot-linux-arm64": "1.0.4", + "@github/copilot-linux-x64": "1.0.4", + "@github/copilot-win32-arm64": "1.0.4", + "@github/copilot-win32-x64": "1.0.4" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.2.tgz", - "integrity": "sha512-dYoeaTidsphRXyMjvAgpjEbBV41ipICnXURrLFEiATcjC4IY6x2BqPOocrExBYW/Tz2VZvDw51iIZaf6GXrTmw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-/YGGhv6cp0ItolsF0HsLq2KmesA4atn0IEYApBs770fzJ8OP2pkOEzrxo3gWU3wc7fHF2uDB1RrJEZ7QSFLdEQ==", "cpu": [ "arm64" ], @@ -3215,9 +3215,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.2.tgz", - "integrity": "sha512-8+Z9dYigEfXf0wHl9c2tgFn8Cr6v4RAY8xTgHMI9mZInjQyxVeBXCxbE2VgzUtDUD3a705Ka2d8ZOz05aYtGsg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.4.tgz", + "integrity": "sha512-gwn2QjZbc1SqPVSAtDMesU1NopyHZT8Qsn37xPfznpV9s94KVyX4TTiDZaUwfnI0wr8kVHBL46RPLNz6I8kR9A==", "cpu": [ "x64" ], @@ -3231,9 +3231,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.2.tgz", - "integrity": "sha512-ik0Y5aTXOFRPLFrNjZJdtfzkozYqYeJjVXGBAH3Pp1nFZRu/pxJnrnQ1HrqO/LEgQVbJzAjQmWEfMbXdQIxE4Q==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.4.tgz", + "integrity": "sha512-92vzHKxN55BpI76sP/5fXIXfat1gzAhsq4bNLqLENGfZyMP/25OiVihCZuQHnvxzXaHBITFGUvtxfdll2kbcng==", "cpu": [ "arm64" ], @@ -3247,9 +3247,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.2.tgz", - "integrity": "sha512-mHSPZjH4nU9rwbfwLxYJ7CQ90jK/Qu1v2CmvBCUPfmuGdVwrpGPHB5FrB+f+b0NEXjmemDWstk2zG53F7ppHfw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.4.tgz", + "integrity": "sha512-wQvpwf4/VMTnSmWyYzq07Xg18Vxg7aZ5NVkkXqlLTuXRASW0kvCCb5USEtXHHzR7E6rJztkhCjFRE1bZW8jAGw==", "cpu": [ "x64" ], @@ -3263,9 +3263,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.2.tgz", - "integrity": "sha512-tLW2CY/vg0fYLp8EuiFhWIHBVzbFCDDpohxT/F/XyMAdTVSZLnopCcxQHv2BOu0CVGrYjlf7YOIwPfAKYml1FA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.4.tgz", + "integrity": "sha512-zOvD/5GVxDf0ZdlTkK+m55Vs55xuHNmACX50ZO2N23ZGG2dmkdS4mkruL59XB5ISgrOfeqvnqrwTFHbmPZtLfw==", "cpu": [ "arm64" ], @@ -3279,9 +3279,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.2.tgz", - "integrity": "sha512-cFlc3xMkKKFRIYR00EEJ2XlYAemeh5EZHsGA8Ir2G0AH+DOevJbomdP1yyCC5gaK/7IyPkHX3sGie5sER2yPvQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.4.tgz", + "integrity": "sha512-yQenHMdkV0b77mF6aLM60TuwtNZ592TluptVDF+80Sj2zPfCpLyvrRh2FCIHRtuwTy4BfxETh2hCFHef8E6IOw==", "cpu": [ "x64" ], diff --git a/extensions/copilot/package.json b/extensions/copilot/package.json index 285d4b7a548..66220ead1ce 100644 --- a/extensions/copilot/package.json +++ b/extensions/copilot/package.json @@ -6144,7 +6144,7 @@ "@anthropic-ai/claude-agent-sdk": "^0.2.63", "@anthropic-ai/sdk": "^0.78.0", "@github/blackbird-external-ingest-utils": "^0.3.0", - "@github/copilot": "^1.0.2", + "@github/copilot": "^1.0.4", "@google/genai": "^1.22.0", "@humanwhocodes/gitignore-to-minimatch": "1.0.2", "@microsoft/tiktokenizer": "^1.0.10", diff --git a/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts b/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts index 90b2889e030..6a089cdd9bc 100644 --- a/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts +++ b/extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts @@ -15,7 +15,7 @@ import { ResourceMap } from '../../../../util/vs/base/common/map'; import { constObservable, IObservable } from '../../../../util/vs/base/common/observable'; import { isAbsolutePath, isEqual } from '../../../../util/vs/base/common/resources'; import { URI } from '../../../../util/vs/base/common/uri'; -import { ChatMcpToolInvocationData, ChatRequestTurn2, ChatResponseCodeblockUriPart, ChatResponseMarkdownPart, ChatResponsePullRequestPart, ChatResponseTextEditPart, ChatResponseThinkingProgressPart, ChatResponseTurn2, ChatToolInvocationPart, LanguageModelTextPart, Location, MarkdownString, McpToolInvocationContentData, Range, Uri } from '../../../../vscodeTypes'; +import { ChatMcpToolInvocationData, ChatReferenceBinaryData, ChatRequestTurn2, ChatResponseCodeblockUriPart, ChatResponseMarkdownPart, ChatResponsePullRequestPart, ChatResponseTextEditPart, ChatResponseThinkingProgressPart, ChatResponseTurn2, ChatToolInvocationPart, LanguageModelTextPart, Location, MarkdownString, McpToolInvocationContentData, Range, Uri } from '../../../../vscodeTypes'; import type { MCP } from '../../../common/modelContextProtocol'; import { ToolName } from '../../../tools/common/toolNames'; import { ICopilotTool } from '../../../tools/common/toolsRegistry'; @@ -537,7 +537,7 @@ export function buildChatHistoryFromEvents(sessionId: string, modelId: string | } }); ((event.data.attachments || [])) - .filter(attachment => attachment.type === 'selection' || attachment.type === 'github_reference' ? true : !isInstructionAttachmentPath(attachment.path)) + .filter(attachment => attachment.type === 'selection' || attachment.type === 'github_reference' || attachment.type === 'blob' ? true : !isInstructionAttachmentPath(attachment.path)) .forEach(attachment => { if (attachment.type === 'github_reference') { return; @@ -554,7 +554,7 @@ export function buildChatHistoryFromEvents(sessionId: string, modelId: string | value: new Location(uri, new Range(attachment.selection.start.line - 1, attachment.selection.start.character - 1, attachment.selection.end.line - 1, attachment.selection.end.character - 1)), range }); - } else { + } else if (attachment.type === 'file' || attachment.type === 'directory') { const range = attachment.displayName ? getRangeInPrompt(event.data.content || '', attachment.displayName) : undefined; const attachmentPath = attachment.type === 'directory' ? getFolderAttachmentPath(attachment.path) : @@ -569,6 +569,20 @@ export function buildChatHistoryFromEvents(sessionId: string, modelId: string | value: uri, range }); + } else if (attachment.type === 'blob') { + const binaryDataSupplier = async () => { + try { + return decodeBase64(attachment.data).buffer; + } catch (error) { + logger.error(error, `Failed to decode blob attachment ${attachment.displayName || ''}`); + throw error; + } + }; + references.push({ + id: `${attachment.displayName || ''}-${attachment.mimeType}-${attachment.type}`, + name: attachment.displayName || '', + value: new ChatReferenceBinaryData(attachment.mimeType, binaryDataSupplier), + }); } }); diff --git a/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts b/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts index e2f2438fb35..040f917ebd6 100644 --- a/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts +++ b/extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts @@ -886,6 +886,8 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes attachments.forEach(attachment => { if (attachment.type === 'github_reference') { result.push(`- ${attachment.title}: (${attachment.number}, ${attachment.type}, ${attachment.referenceType})`); + } else if (attachment.type === 'blob') { + result.push(`- ${attachment.displayName ?? 'blob'} (${attachment.type}, ${attachment.mimeType})`); } else { result.push(`- ${attachment.displayName} (${attachment.type}, ${attachment.type === 'selection' ? attachment.filePath : attachment.path})`); } @@ -985,6 +987,8 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes attachments.forEach(attachment => { if (attachment.type === 'github_reference') { result.push(`- ${attachment.title}: (${attachment.number}, ${attachment.type}, ${attachment.referenceType})`); + } else if (attachment.type === 'blob') { + result.push(`- ${attachment.displayName ?? 'blob'} (${attachment.type}, ${attachment.mimeType})`); } else { result.push(`- ${attachment.displayName} (${attachment.type}, ${attachment.type === 'selection' ? attachment.filePath : attachment.path})`); }