From 45bbb4f4da0893a63ae0fbe8faf68dfeeb28087c Mon Sep 17 00:00:00 2001 From: Alex Ross <38270282+alexr00@users.noreply.github.com> Date: Fri, 20 Feb 2026 15:06:58 +0100 Subject: [PATCH] The reckoning: Update all the vscode.proposed.*.d.ts files (#3895) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * The reckoning: Update all the vscode.proposed.*.d.ts files and run the update on post install * Improve proposed update and check - Pin it to a commit - Require that update be run manually, not as post install - Add PR check --------- Co-authored-by: João Moreno --- extensions/copilot/.github/workflows/pr.yml | 3 + extensions/copilot/package.json | 9 +- extensions/copilot/script/applyLocalDts.sh | 3 +- .../copilot/script/build/moveProposedDts.js | 11 ++ .../copilot/script/build/vscodeDtsCheck.js | 63 +++++++++++ .../copilot/script/build/vscodeDtsUpdate.js | 60 ++++++++++ .../test/toolInvocationFormatter.spec.ts | 38 +++---- .../claude/common/toolInvocationFormatter.ts | 2 +- .../copilotcli/common/copilotCLITools.ts | 4 +- .../vscode-node/chatParticipants.ts | 3 +- .../vscode-node/inlineChatCommands.ts | 2 +- .../test/vscode-node/inlineEditModel.spec.ts | 3 +- .../vscode-node/chatReplaySessionProvider.ts | 2 +- .../tools/node/test/editNotebookTool.spec.tsx | 1 + ...scode.proposed.agentSessionsWorkspace.d.ts | 7 +- .../vscode.proposed.aiRelatedInformation.d.ts | 2 +- .../vscode.proposed.aiSettingsSearch.d.ts | 4 +- .../vscode.proposed.authLearnMore.d.ts | 2 +- .../extension/vscode.proposed.chatHooks.d.ts | 2 +- ...ode.proposed.chatParticipantAdditions.d.ts | 66 +++++------ ...scode.proposed.chatParticipantPrivate.d.ts | 4 - .../vscode.proposed.chatProvider.d.ts | 12 -- ...code.proposed.chatReferenceBinaryData.d.ts | 38 +++++++ .../vscode.proposed.chatSessionsProvider.d.ts | 107 ++++++++++++------ .../vscode.proposed.chatStatusItem.d.ts | 2 +- .../vscode.proposed.commentReveal.d.ts | 31 +++-- ...sed.contribChatEditorInlineGutterMenu.d.ts | 6 + ...posed.contribDebugCreateConfiguration.d.ts | 6 + ...ode.proposed.contribEditorContentMenu.d.ts | 6 + ...proposed.contribLanguageModelToolSets.d.ts | 6 + .../vscode.proposed.dataChannels.d.ts | 2 +- ...scode.proposed.defaultChatParticipant.d.ts | 10 -- .../vscode.proposed.extensionsAny.d.ts | 1 + .../extension/vscode.proposed.findFiles2.d.ts | 8 +- ...de.proposed.languageModelThinkingPart.d.ts | 1 - ...oposed.languageModelToolSupportsModel.d.ts | 2 + .../vscode.proposed.mappedEditsProvider.d.ts | 2 +- .../extension/vscode.proposed.resolvers.d.ts | 8 +- ...vscode.proposed.taskExecutionTerminal.d.ts | 15 +++ ...ode.proposed.terminalQuickFixProvider.d.ts | 4 +- ...ode.proposed.textDocumentChangeReason.d.ts | 2 +- .../vscode.proposed.textSearchProvider2.d.ts | 20 ++-- .../vscode.proposed.workspaceTrust.d.ts | 11 ++ .../src/util/common/test/shims/chatTypes.ts | 7 +- 44 files changed, 420 insertions(+), 178 deletions(-) create mode 100644 extensions/copilot/script/build/moveProposedDts.js create mode 100644 extensions/copilot/script/build/vscodeDtsCheck.js create mode 100644 extensions/copilot/script/build/vscodeDtsUpdate.js create mode 100644 extensions/copilot/src/extension/vscode.proposed.chatReferenceBinaryData.d.ts create mode 100644 extensions/copilot/src/extension/vscode.proposed.contribChatEditorInlineGutterMenu.d.ts create mode 100644 extensions/copilot/src/extension/vscode.proposed.contribDebugCreateConfiguration.d.ts create mode 100644 extensions/copilot/src/extension/vscode.proposed.contribEditorContentMenu.d.ts create mode 100644 extensions/copilot/src/extension/vscode.proposed.contribLanguageModelToolSets.d.ts create mode 100644 extensions/copilot/src/extension/vscode.proposed.taskExecutionTerminal.d.ts diff --git a/extensions/copilot/.github/workflows/pr.yml b/extensions/copilot/.github/workflows/pr.yml index 4878f6c0401..9ca819d842c 100644 --- a/extensions/copilot/.github/workflows/pr.yml +++ b/extensions/copilot/.github/workflows/pr.yml @@ -121,6 +121,9 @@ jobs: mkdir -p .build/build_cache tar -czf .build/build_cache/cache.tgz --files-from .build/build_cache_list.txt + - name: Ensure proposed API types are up to date + run: npm run vscode-dts:check + - name: TypeScript type checking run: npm run typecheck diff --git a/extensions/copilot/package.json b/extensions/copilot/package.json index 26dd731ac76..383ddd79610 100644 --- a/extensions/copilot/package.json +++ b/extensions/copilot/package.json @@ -5785,8 +5785,10 @@ "scripts": { "postinstall": "tsx ./script/postinstall.ts", "prepare": "husky", - "vscode-dts:dev": "node node_modules/@vscode/dts/index.js dev && mv vscode.proposed.*.ts src/extension", - "vscode-dts:main": "node node_modules/@vscode/dts/index.js main && mv vscode.d.ts src/extension", + "vscode-dts:update": "node script/build/vscodeDtsUpdate.js", + "vscode-dts:check": "node script/build/vscodeDtsCheck.js", + "vscode-dts:dev": "node node_modules/@vscode/dts/index.js dev && node script/build/moveProposedDts.js", + "vscode-dts:main": "node node_modules/@vscode/dts/index.js main && node script/build/moveProposedDts.js", "build": "node .esbuild.ts --sourcemaps", "compile": "node .esbuild.ts --dev", "watch": "npm-run-all -p watch:*", @@ -5959,5 +5961,6 @@ "string_decoder": "npm:string_decoder@1.2.0", "node-gyp": "npm:node-gyp@10.3.1", "zod": "3.25.76" - } + }, + "vscodeCommit": "7a0b83f270038305afab4f7e2a23493152c834df" } diff --git a/extensions/copilot/script/applyLocalDts.sh b/extensions/copilot/script/applyLocalDts.sh index f4236a290eb..51d3304161d 100755 --- a/extensions/copilot/script/applyLocalDts.sh +++ b/extensions/copilot/script/applyLocalDts.sh @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. #--------------------------------------------------------------------------------------------- -DIR="$(dirname "$0")" -cp "$DIR"/../../vscode/src/vscode-dts/vscode.proposed.*chat* "$DIR/../src/extension/" \ No newline at end of file +echo "Push your proposal changes and run \`npm run vscode-dts:dev\` instead." \ No newline at end of file diff --git a/extensions/copilot/script/build/moveProposedDts.js b/extensions/copilot/script/build/moveProposedDts.js new file mode 100644 index 00000000000..c71ad563e45 --- /dev/null +++ b/extensions/copilot/script/build/moveProposedDts.js @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const fs = require('fs'); +const path = require('path'); +const files = fs.readdirSync('.').filter(f => f.startsWith('vscode.') && f.endsWith('.ts')); +for (const f of files) { + fs.renameSync(f, path.join('src', 'extension', f)); +} diff --git a/extensions/copilot/script/build/vscodeDtsCheck.js b/extensions/copilot/script/build/vscodeDtsCheck.js new file mode 100644 index 00000000000..97472ed5083 --- /dev/null +++ b/extensions/copilot/script/build/vscodeDtsCheck.js @@ -0,0 +1,63 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// Usage: node script/build/vscodeDtsCheck.js +// Reads vscodeCommit from package.json, re-downloads proposed d.ts files +// at that commit, checks if any differ from what's committed, then restores +// the originals. Exits with code 1 if files are out of date. + +const { execSync } = require('child_process'); +const fs = require('fs'); +const path = require('path'); + +const targetDir = path.resolve('src', 'extension'); + +function main() { + const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')); + const sha = pkg.vscodeCommit; + if (!sha) { + console.error('No vscodeCommit found in package.json. Run "npm run vscode-dts:update" first.'); + process.exit(1); + } + + console.log(`Checking proposed d.ts files against vscodeCommit: ${sha}`); + + // Download proposed d.ts files using the commit SHA + execSync(`node node_modules/@vscode/dts/index.js dev ${sha}`, { stdio: 'inherit' }); + + // Compare downloaded files with committed ones + const downloaded = fs.readdirSync('.').filter(f => f.startsWith('vscode.') && f.endsWith('.ts')); + const mismatched = []; + + for (const f of downloaded) { + const committedPath = path.join(targetDir, f); + const newContent = fs.readFileSync(f, 'utf-8'); + + if (!fs.existsSync(committedPath)) { + mismatched.push(f + ' (missing)'); + } else { + const oldContent = fs.readFileSync(committedPath, 'utf-8'); + if (oldContent !== newContent) { + mismatched.push(f); + } + } + + // Clean up the downloaded file + fs.unlinkSync(f); + } + + if (mismatched.length > 0) { + console.error('The following proposed API type definitions are out of date:'); + for (const f of mismatched) { + console.error(` - ${f}`); + } + console.error('Run "npm run vscode-dts:update" and commit the changes.'); + process.exit(1); + } + + console.log('All proposed API type definitions are up to date.'); +} + +main(); diff --git a/extensions/copilot/script/build/vscodeDtsUpdate.js b/extensions/copilot/script/build/vscodeDtsUpdate.js new file mode 100644 index 00000000000..7748412430e --- /dev/null +++ b/extensions/copilot/script/build/vscodeDtsUpdate.js @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// Usage: node script/build/vscodeDtsUpdate.js [branch] +// Downloads proposed API d.ts files from the given branch (default: main) +// of microsoft/vscode and writes the resolved commit SHA to package.json. + +const { execSync } = require('child_process'); +const fs = require('fs'); +const path = require('path'); +const https = require('https'); + +const branch = process.argv[2] || 'main'; + +function resolveCommitSha(branch) { + return new Promise((resolve, reject) => { + const options = { + hostname: 'api.github.com', + path: `/repos/microsoft/vscode/commits/${encodeURIComponent(branch)}`, + headers: { 'User-Agent': 'vscode-copilot-chat', 'Accept': 'application/vnd.github.sha' } + }; + https.get(options, res => { + if (res.statusCode !== 200) { + reject(new Error(`Failed to resolve commit for branch "${branch}": HTTP ${res.statusCode}`)); + return; + } + let data = ''; + res.on('data', chunk => data += chunk); + res.on('end', () => resolve(data.trim())); + }).on('error', reject); + }); +} + +async function main() { + const sha = await resolveCommitSha(branch); + console.log(`Resolved branch "${branch}" to commit ${sha}`); + + // Download proposed d.ts files using the commit SHA + execSync(`node node_modules/@vscode/dts/index.js dev ${sha}`, { stdio: 'inherit' }); + + // Move downloaded files to src/extension/ + const files = fs.readdirSync('.').filter(f => f.startsWith('vscode.') && f.endsWith('.ts')); + for (const f of files) { + fs.renameSync(f, path.join('src', 'extension', f)); + } + + // Write the commit SHA to package.json + const pkgPath = path.resolve('package.json'); + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')); + pkg.vscodeCommit = sha; + fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, '\t') + '\n'); + console.log(`Wrote vscodeCommit: ${sha} to package.json`); +} + +main().catch(err => { + console.error(err); + process.exit(1); +}); diff --git a/extensions/copilot/src/extension/agents/claude/common/test/toolInvocationFormatter.spec.ts b/extensions/copilot/src/extension/agents/claude/common/test/toolInvocationFormatter.spec.ts index e826949a484..3cc1784e713 100644 --- a/extensions/copilot/src/extension/agents/claude/common/test/toolInvocationFormatter.spec.ts +++ b/extensions/copilot/src/extension/agents/claude/common/test/toolInvocationFormatter.spec.ts @@ -303,7 +303,7 @@ describe('completeToolInvocation', () => { it('populates terminal output data', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Bash, { command: 'npm install' }); const toolResult = createToolResultBlock('test-tool-id-123', 'added 150 packages\nDone in 5.2s'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -318,7 +318,7 @@ describe('completeToolInvocation', () => { it('parses exit code from output', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Bash, { command: 'npm test' }); const toolResult = createToolResultBlock('test-tool-id-123', 'Tests failed\nexit code: 1'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -330,7 +330,7 @@ describe('completeToolInvocation', () => { it('parses "exited with" format exit code', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Bash, { command: 'false' }); const toolResult = createToolResultBlock('test-tool-id-123', 'Command failed\nexited with 127'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -341,7 +341,7 @@ describe('completeToolInvocation', () => { it('handles empty output', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Bash, { command: 'true' }); const toolResult = createToolResultBlock('test-tool-id-123', ''); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -352,7 +352,7 @@ describe('completeToolInvocation', () => { it('converts newlines to CRLF for terminal display', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Bash, { command: 'ls' }); const toolResult = createToolResultBlock('test-tool-id-123', 'file1.ts\nfile2.ts\nfile3.ts'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -366,7 +366,7 @@ describe('completeToolInvocation', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Read, { file_path: '/path/to/file.ts' }); const fileContent = 'export function hello() {\n return "world";\n}'; const toolResult = createToolResultBlock('test-tool-id-123', fileContent); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -379,7 +379,7 @@ describe('completeToolInvocation', () => { it('does not populate data when content is empty', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Read, { file_path: '/path/to/empty.ts' }); const toolResult = createToolResultBlock('test-tool-id-123', ''); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -392,7 +392,7 @@ describe('completeToolInvocation', () => { const toolUse = createToolUseBlock(ClaudeToolNames.LS, { path: '/project/src' }); const listing = 'index.ts\nutils/\ncomponents/'; const toolResult = createToolResultBlock('test-tool-id-123', listing); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -408,7 +408,7 @@ describe('completeToolInvocation', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Glob, { pattern: '**/*.spec.ts' }); const results = '/src/a.spec.ts\n/src/b.spec.ts\n/test/c.spec.ts'; const toolResult = createToolResultBlock('test-tool-id-123', results); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -424,7 +424,7 @@ describe('completeToolInvocation', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Grep, { pattern: 'TODO' }); const results = '/src/file.ts:10: // TODO: fix this\n/src/other.ts:25: // TODO: refactor'; const toolResult = createToolResultBlock('test-tool-id-123', results); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -439,7 +439,7 @@ describe('completeToolInvocation', () => { it('does not populate data for Edit tool (has separate UI)', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Edit, { file_path: '/path/to/file.ts' }); const toolResult = createToolResultBlock('test-tool-id-123', 'File edited successfully'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -449,7 +449,7 @@ describe('completeToolInvocation', () => { it('does not populate data for Write tool (has separate UI)', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Write, { file_path: '/path/to/new.ts' }); const toolResult = createToolResultBlock('test-tool-id-123', 'File created'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -459,7 +459,7 @@ describe('completeToolInvocation', () => { it('does not populate data for TodoWrite tool (has separate UI)', () => { const toolUse = createToolUseBlock(ClaudeToolNames.TodoWrite, { todos: [] }); const toolResult = createToolResultBlock('test-tool-id-123', 'Todos updated'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -511,7 +511,7 @@ describe('completeToolInvocation', () => { it('populates JSON input and string output', () => { const toolUse = createToolUseBlock('CustomTool', { arg1: 'value1', arg2: 42 }); const toolResult = createToolResultBlock('test-tool-id-123', 'Custom tool completed successfully'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -524,7 +524,7 @@ describe('completeToolInvocation', () => { it('does not populate data when output is empty', () => { const toolUse = createToolUseBlock('CustomTool', { arg: 'value' }); const toolResult = createToolResultBlock('test-tool-id-123', ''); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -536,7 +536,7 @@ describe('completeToolInvocation', () => { it('handles string content directly', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Read, { file_path: '/file.ts' }); const toolResult = createToolResultBlock('test-tool-id-123', 'plain string content'); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -550,7 +550,7 @@ describe('completeToolInvocation', () => { { type: 'text' as const, text: 'first block' }, { type: 'text' as const, text: 'second block' } ]); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -564,7 +564,7 @@ describe('completeToolInvocation', () => { { type: 'text' as const, text: 'text content' }, { type: 'image' as const, source: { type: 'base64' as const, media_type: 'image/png' as const, data: 'abc' } } ]); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); @@ -575,7 +575,7 @@ describe('completeToolInvocation', () => { it('handles undefined content', () => { const toolUse = createToolUseBlock(ClaudeToolNames.Read, { file_path: '/file.ts' }); const toolResult = createToolResultBlock('test-tool-id-123', undefined); - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); completeToolInvocation(toolUse, toolResult, invocation); diff --git a/extensions/copilot/src/extension/agents/claude/common/toolInvocationFormatter.ts b/extensions/copilot/src/extension/agents/claude/common/toolInvocationFormatter.ts index d43de7a2a8b..d933da86641 100644 --- a/extensions/copilot/src/extension/agents/claude/common/toolInvocationFormatter.ts +++ b/extensions/copilot/src/extension/agents/claude/common/toolInvocationFormatter.ts @@ -197,7 +197,7 @@ export function createFormattedToolInvocation( toolUse: Anthropic.ToolUseBlock, complete?: boolean ): ChatToolInvocationPart | undefined { - const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false); + const invocation = new ChatToolInvocationPart(toolUse.name, toolUse.id, false as unknown as string); if (complete !== undefined) { invocation.isConfirmed = complete; invocation.isComplete = complete; diff --git a/extensions/copilot/src/extension/agents/copilotcli/common/copilotCLITools.ts b/extensions/copilot/src/extension/agents/copilotcli/common/copilotCLITools.ts index f4d43b82519..857f64a127a 100644 --- a/extensions/copilot/src/extension/agents/copilotcli/common/copilotCLITools.ts +++ b/extensions/copilot/src/extension/agents/copilotcli/common/copilotCLITools.ts @@ -631,7 +631,7 @@ export function createCopilotCLIToolInvocation(data: { if (!Object.hasOwn(ToolFriendlyNameAndHandlers, data.toolName)) { const mcpServer = l10n.t('MCP Server'); const toolName = data.mcpServerName && data.mcpToolName ? `${data.mcpServerName}, ${data.mcpToolName} (${mcpServer})` : data.toolName; - const invocation = new ChatToolInvocationPart(toolName ?? 'unknown', data.toolCallId ?? '', false); + const invocation = new ChatToolInvocationPart(toolName ?? 'unknown', data.toolCallId ?? '', false as unknown as string); invocation.isConfirmed = false; invocation.isComplete = false; invocation.invocationMessage = l10n.t("Using tool: {0}", toolName ?? 'unknown'); @@ -653,7 +653,7 @@ export function createCopilotCLIToolInvocation(data: { } const [friendlyToolName, formatter] = ToolFriendlyNameAndHandlers[toolCall.toolName]; - const invocation = new ChatToolInvocationPart(friendlyToolName ?? toolCall.toolName ?? 'unknown', toolCall.toolCallId ?? '', false); + const invocation = new ChatToolInvocationPart(friendlyToolName ?? toolCall.toolName ?? 'unknown', toolCall.toolCallId ?? '', false as unknown as string); invocation.isConfirmed = false; invocation.isComplete = false; diff --git a/extensions/copilot/src/extension/conversation/vscode-node/chatParticipants.ts b/extensions/copilot/src/extension/conversation/vscode-node/chatParticipants.ts index b4554505387..a3beed619c2 100644 --- a/extensions/copilot/src/extension/conversation/vscode-node/chatParticipants.ts +++ b/extensions/copilot/src/extension/conversation/vscode-node/chatParticipants.ts @@ -132,7 +132,8 @@ class ChatAgents implements IDisposable { if (!user) { return false; } - defaultAgent.requester = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (defaultAgent as any).requester = { name: user.login, icon: URI.parse(user?.avatar_url ?? `https://avatars.githubusercontent.com/${user.login}`) }; diff --git a/extensions/copilot/src/extension/inlineChat/vscode-node/inlineChatCommands.ts b/extensions/copilot/src/extension/inlineChat/vscode-node/inlineChatCommands.ts index db154d77a12..7d285b063fb 100644 --- a/extensions/copilot/src/extension/inlineChat/vscode-node/inlineChatCommands.ts +++ b/extensions/copilot/src/extension/inlineChat/vscode-node/inlineChatCommands.ts @@ -233,7 +233,7 @@ ${message}`, return; } if (direction !== 0) { - newThread.reveal(); + (newThread as unknown as vscode.CommentThread2).reveal(); } instaService.invokeFunction(fetchSuggestion, newThread); }; diff --git a/extensions/copilot/src/extension/inlineEdits/test/vscode-node/inlineEditModel.spec.ts b/extensions/copilot/src/extension/inlineEdits/test/vscode-node/inlineEditModel.spec.ts index 225e5a70099..a3113fcbfb4 100644 --- a/extensions/copilot/src/extension/inlineEdits/test/vscode-node/inlineEditModel.spec.ts +++ b/extensions/copilot/src/extension/inlineEdits/test/vscode-node/inlineEditModel.spec.ts @@ -85,7 +85,8 @@ suite('InlineEditModel', () => { workspaceService.didChangeTextDocumentEmitter.fire({ document, contentChanges: [], - reason + reason, + detailedReason: undefined }); } diff --git a/extensions/copilot/src/extension/replay/vscode-node/chatReplaySessionProvider.ts b/extensions/copilot/src/extension/replay/vscode-node/chatReplaySessionProvider.ts index e564e79121c..33de9f42b91 100644 --- a/extensions/copilot/src/extension/replay/vscode-node/chatReplaySessionProvider.ts +++ b/extensions/copilot/src/extension/replay/vscode-node/chatReplaySessionProvider.ts @@ -50,7 +50,7 @@ export class ChatReplaySessionProvider extends Disposable implements ChatSession new ChatResponseTurn2([new ChatResponseMarkdownPart(step.result)], {}, 'copilot') ); } else if (step.kind === 'toolCall') { - const toolCall = new ChatToolInvocationPart(step.toolName, '', false); + const toolCall = new ChatToolInvocationPart(step.toolName, '', false as unknown as string); toolCall.isComplete = true; toolCall.isConfirmed = true; history.push( diff --git a/extensions/copilot/src/extension/tools/node/test/editNotebookTool.spec.tsx b/extensions/copilot/src/extension/tools/node/test/editNotebookTool.spec.tsx index 92f3e2117ef..ce4cc4ea952 100644 --- a/extensions/copilot/src/extension/tools/node/test/editNotebookTool.spec.tsx +++ b/extensions/copilot/src/extension/tools/node/test/editNotebookTool.spec.tsx @@ -724,6 +724,7 @@ describe('Edit Notebook Tool', () => { } ], reason: undefined, + detailedReason: undefined, }); workspaceService.didChangeNotebookDocumentEmitter.fire({ cellChanges: [ diff --git a/extensions/copilot/src/extension/vscode.proposed.agentSessionsWorkspace.d.ts b/extensions/copilot/src/extension/vscode.proposed.agentSessionsWorkspace.d.ts index bc894b2c262..278e4ccb7ac 100644 --- a/extensions/copilot/src/extension/vscode.proposed.agentSessionsWorkspace.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.agentSessionsWorkspace.d.ts @@ -6,13 +6,12 @@ declare module 'vscode' { export namespace workspace { + /** * Indicates whether the current workspace is an agent sessions workspace. * - * When this is `true`, session providers should return all sessions - * irrespective of the currently opened workspace folders. This is used - * for dedicated agent sessions views that want to show all available - * sessions across all workspaces. + * Agent sessions workspace is a special workspace used for AI agent interactions + * where the window is dedicated to agent session management. */ export const isAgentSessionsWorkspace: boolean; } diff --git a/extensions/copilot/src/extension/vscode.proposed.aiRelatedInformation.d.ts b/extensions/copilot/src/extension/vscode.proposed.aiRelatedInformation.d.ts index e5e28653cec..344a1fd9a84 100644 --- a/extensions/copilot/src/extension/vscode.proposed.aiRelatedInformation.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.aiRelatedInformation.d.ts @@ -14,7 +14,7 @@ declare module 'vscode' { SettingInformation = 4 } - interface RelatedInformationBaseResult { + export interface RelatedInformationBaseResult { type: RelatedInformationType; weight: number; } diff --git a/extensions/copilot/src/extension/vscode.proposed.aiSettingsSearch.d.ts b/extensions/copilot/src/extension/vscode.proposed.aiSettingsSearch.d.ts index 1d114613e31..3d3e85910ba 100644 --- a/extensions/copilot/src/extension/vscode.proposed.aiSettingsSearch.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.aiSettingsSearch.d.ts @@ -22,10 +22,10 @@ declare module 'vscode' { } export interface SettingsSearchProvider { - provideSettingsSearchResults(query: string, options: SettingsSearchProviderOptions, progress: Progress, token: CancellationToken): Thenable; + provideSettingsSearchResults(query: string, option: SettingsSearchProviderOptions, progress: Progress, token: CancellationToken): Thenable; } export namespace ai { export function registerSettingsSearchProvider(provider: SettingsSearchProvider): Disposable; } -} \ No newline at end of file +} diff --git a/extensions/copilot/src/extension/vscode.proposed.authLearnMore.d.ts b/extensions/copilot/src/extension/vscode.proposed.authLearnMore.d.ts index e0df5fbeafa..8ef8c7266d7 100644 --- a/extensions/copilot/src/extension/vscode.proposed.authLearnMore.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.authLearnMore.d.ts @@ -13,4 +13,4 @@ declare module 'vscode' { */ learnMore?: Uri; } -} \ No newline at end of file +} diff --git a/extensions/copilot/src/extension/vscode.proposed.chatHooks.d.ts b/extensions/copilot/src/extension/vscode.proposed.chatHooks.d.ts index f5c9eeff271..eec28002b77 100644 --- a/extensions/copilot/src/extension/vscode.proposed.chatHooks.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.chatHooks.d.ts @@ -123,4 +123,4 @@ declare module 'vscode' { */ hookProgress(hookType: ChatHookType, stopReason?: string, systemMessage?: string): void; } -} \ No newline at end of file +} diff --git a/extensions/copilot/src/extension/vscode.proposed.chatParticipantAdditions.d.ts b/extensions/copilot/src/extension/vscode.proposed.chatParticipantAdditions.d.ts index ec672f0a318..f122a55550a 100644 --- a/extensions/copilot/src/extension/vscode.proposed.chatParticipantAdditions.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.chatParticipantAdditions.d.ts @@ -351,11 +351,10 @@ declare module 'vscode' { /** * If this flag is set, this will be treated as an update to any previous tool call with the same id. - * TODO@roblourens remove this and make it the default */ enablePartialUpdate?: boolean; - constructor(toolName: string, toolCallId: string, isError?: boolean); + constructor(toolName: string, toolCallId: string, errorMessage?: string); } /** @@ -424,7 +423,31 @@ declare module 'vscode' { constructor(uris: Uri[], callback: () => Thenable); } - export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseWorkspaceEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart | ChatResponseQuestionCarouselPart | ChatResponseHookPart; + /** + * Internal type that lists all the proposed chat response parts. This is used to generate `ExtendedChatResponsePart` + * which is the actual type used in this API. This is done so that other proposals can easily add their own response parts + * without having to modify this file. + */ + export interface ExtendedChatResponseParts { + ChatResponsePart: ChatResponsePart; + ChatResponseTextEditPart: ChatResponseTextEditPart; + ChatResponseNotebookEditPart: ChatResponseNotebookEditPart; + ChatResponseWorkspaceEditPart: ChatResponseWorkspaceEditPart; + ChatResponseConfirmationPart: ChatResponseConfirmationPart; + ChatResponseCodeCitationPart: ChatResponseCodeCitationPart; + ChatResponseReferencePart2: ChatResponseReferencePart2; + ChatResponseMovePart: ChatResponseMovePart; + ChatResponseExtensionsPart: ChatResponseExtensionsPart; + ChatResponsePullRequestPart: ChatResponsePullRequestPart; + ChatToolInvocationPart: ChatToolInvocationPart; + ChatResponseMultiDiffPart: ChatResponseMultiDiffPart; + ChatResponseThinkingProgressPart: ChatResponseThinkingProgressPart; + ChatResponseExternalEditPart: ChatResponseExternalEditPart; + ChatResponseQuestionCarouselPart: ChatResponseQuestionCarouselPart; + } + + export type ExtendedChatResponsePart = ExtendedChatResponseParts[keyof ExtendedChatResponseParts]; + export class ChatResponseWarningPart { value: MarkdownString; constructor(value: string | MarkdownString); @@ -453,31 +476,6 @@ declare module 'vscode' { constructor(value: string | string[], id?: string, metadata?: { readonly [key: string]: any }, task?: (progress: Progress) => Thenable); } - /** - * A progress part representing the execution result of a hook. - * Hooks are user-configured scripts that run at specific points during chat processing. - * If {@link stopReason} is set, the hook blocked/denied the operation. - */ - export class ChatResponseHookPart { - /** The type of hook that was executed */ - hookType: ChatHookType; - /** If set, the hook blocked processing. This message is shown to the user. */ - stopReason?: string; - /** Warning/system message from the hook, shown to the user */ - systemMessage?: string; - /** Optional metadata associated with the hook execution */ - metadata?: { readonly [key: string]: unknown }; - - /** - * Creates a new hook progress part. - * @param hookType The type of hook that was executed - * @param stopReason Message shown when processing was stopped - * @param systemMessage Warning/system message from the hook - * @param metadata Optional metadata - */ - constructor(hookType: ChatHookType, stopReason?: string, systemMessage?: string, metadata?: { readonly [key: string]: unknown }); - } - export class ChatResponseReferencePart2 { /** * The reference target. @@ -562,7 +560,7 @@ declare module 'vscode' { readonly title: string; readonly description: string; readonly author: string; - constructor(uri: Uri | Command, title: string, description: string, author: string, linkTag: string); + constructor(uriOrCommand: Uri | Command, title: string, description: string, author: string, linkTag: string); } export interface ChatResponseStream { @@ -579,14 +577,6 @@ declare module 'vscode' { thinkingProgress(thinkingDelta: ThinkingDelta): void; - /** - * Push a hook execution result to this stream. - * @param hookType The type of hook that was executed - * @param stopReason If set, the hook blocked processing. This message is shown to the user. - * @param systemMessage Warning/system message from the hook - */ - hookProgress(hookType: ChatHookType, stopReason?: string, systemMessage?: string): void; - textEdit(target: Uri, edits: TextEdit | TextEdit[]): void; textEdit(target: Uri, isDone: true): void; @@ -1040,8 +1030,6 @@ declare module 'vscode' { readonly rawInput?: unknown; readonly chatRequestId?: string; - /** @deprecated Use {@link chatSessionResource} instead */ - readonly chatSessionId?: string; readonly chatSessionResource?: Uri; readonly chatInteractionId?: string; } diff --git a/extensions/copilot/src/extension/vscode.proposed.chatParticipantPrivate.d.ts b/extensions/copilot/src/extension/vscode.proposed.chatParticipantPrivate.d.ts index 92adaf47235..16c8ff488a0 100644 --- a/extensions/copilot/src/extension/vscode.proposed.chatParticipantPrivate.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.chatParticipantPrivate.d.ts @@ -267,8 +267,6 @@ declare module 'vscode' { export interface LanguageModelToolInvocationOptions { chatRequestId?: string; - /** @deprecated Use {@link chatSessionResource} instead */ - chatSessionId?: string; chatSessionResource?: Uri; chatInteractionId?: string; terminalCommand?: string; @@ -294,8 +292,6 @@ declare module 'vscode' { */ input: T; chatRequestId?: string; - /** @deprecated Use {@link chatSessionResource} instead */ - chatSessionId?: string; chatSessionResource?: Uri; chatInteractionId?: string; /** diff --git a/extensions/copilot/src/extension/vscode.proposed.chatProvider.d.ts b/extensions/copilot/src/extension/vscode.proposed.chatProvider.d.ts index 5469e4ca03b..1ded6ac9ba7 100644 --- a/extensions/copilot/src/extension/vscode.proposed.chatProvider.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.chatProvider.d.ts @@ -100,18 +100,6 @@ declare module 'vscode' { export interface LanguageModelChatProvider { provideLanguageModelChatInformation(options: PrepareLanguageModelChatModelOptions, token: CancellationToken): ProviderResult; provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: ProvideLanguageModelChatResponseOptions, progress: Progress, token: CancellationToken): Thenable; - provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: ProvideLanguageModelChatResponseOptions, progress: Progress, token: CancellationToken): Thenable; - } - - /** - * The list of options passed into {@linkcode LanguageModelChatProvider.provideLanguageModelChatInformation} - */ - export interface PrepareLanguageModelChatModelOptions { - /** - * Configuration for the model. This is only present if the provider has declared that it requires configuration via the `configuration` property. - * The object adheres to the schema that the extension provided during declaration. - */ - readonly configuration?: unknown; } /** diff --git a/extensions/copilot/src/extension/vscode.proposed.chatReferenceBinaryData.d.ts b/extensions/copilot/src/extension/vscode.proposed.chatReferenceBinaryData.d.ts new file mode 100644 index 00000000000..081c24ad8c3 --- /dev/null +++ b/extensions/copilot/src/extension/vscode.proposed.chatReferenceBinaryData.d.ts @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare module 'vscode' { + + export interface ChatPromptReference { + /** + * The value of this reference. The `string | Uri | Location` types are used today, but this could expand in the future. + */ + readonly value: string | Uri | Location | ChatReferenceBinaryData | unknown; + } + + export class ChatReferenceBinaryData { + /** + * The MIME type of the binary data. + */ + readonly mimeType: string; + + /** + * Retrieves the binary data of the reference. This is primarily used to receive image attachments from the chat. + * @returns A promise that resolves to the binary data as a Uint8Array. + */ + data(): Thenable; + + /** + * Retrieves a URI reference to the binary data, if available. + */ + readonly reference?: Uri; + + /** + * @param mimeType The MIME type of the binary data. + * @param data The binary data of the reference. + */ + constructor(mimeType: string, data: () => Thenable); + } +} diff --git a/extensions/copilot/src/extension/vscode.proposed.chatSessionsProvider.d.ts b/extensions/copilot/src/extension/vscode.proposed.chatSessionsProvider.d.ts index efc8243a405..5f93a7fe909 100644 --- a/extensions/copilot/src/extension/vscode.proposed.chatSessionsProvider.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.chatSessionsProvider.d.ts @@ -23,13 +23,20 @@ declare module 'vscode' { /** * The chat session is currently in progress. */ - InProgress = 2 + InProgress = 2, + + /** + * The chat session needs user input (e.g. an unresolved confirmation). + */ + NeedsInput = 3 } export namespace chat { /** * Registers a new {@link ChatSessionItemProvider chat session item provider}. * + * @deprecated Use {@linkcode createChatSessionItemController} instead. + * * To use this, also make sure to also add `chatSessions` contribution in the `package.json`. * * @param chatSessionType The type of chat session the provider is for. @@ -41,12 +48,21 @@ declare module 'vscode' { /** * Creates a new {@link ChatSessionItemController chat session item controller} with the given unique identifier. + * + * To use this, also make sure to also add `chatSessions` contribution in the `package.json`. + * + * @param chatSessionType The type of chat session the provider is for. + * @param refreshHandler The controller's {@link ChatSessionItemController.refreshHandler refresh handler}. + * + * @returns A new controller instance that can be used to manage chat session items for the given chat session type. */ - export function createChatSessionItemController(id: string, refreshHandler: () => Thenable): ChatSessionItemController; + export function createChatSessionItemController(chatSessionType: string, refreshHandler: ChatSessionItemControllerRefreshHandler): ChatSessionItemController; } /** * Provides a list of information about chat sessions. + * + * @deprecated Use {@linkcode ChatSessionItemController} instead. */ export interface ChatSessionItemProvider { /** @@ -72,7 +88,21 @@ declare module 'vscode' { } /** - * Provides a list of information about chat sessions. + * Extension callback invoked to refresh the collection of chat session items for a {@linkcode ChatSessionItemController}. + */ + export type ChatSessionItemControllerRefreshHandler = (token: CancellationToken) => Thenable; + + export interface ChatSessionItemControllerNewItemHandlerContext { + readonly request: ChatRequest; + } + + /** + * Extension callback invoked when a new chat session is started. + */ + export type ChatSessionItemControllerNewItemHandler = (context: ChatSessionItemControllerNewItemHandlerContext, token: CancellationToken) => Thenable; + + /** + * Manages chat sessions for a specific chat session type */ export interface ChatSessionItemController { readonly id: string; @@ -88,7 +118,7 @@ declare module 'vscode' { readonly items: ChatSessionItemCollection; /** - * Creates a new managed chat session item that be added to the collection. + * Creates a new managed chat session item that can be added to the collection. */ createChatSessionItem(resource: Uri, label: string): ChatSessionItem; @@ -97,14 +127,21 @@ declare module 'vscode' { * * This is also called on first load to get the initial set of items. */ - refreshHandler: () => Thenable; + readonly refreshHandler: ChatSessionItemControllerRefreshHandler; /** - * Fired when an item is archived by the editor + * Invoked when a new chat session is started. * - * TODO: expose archive state on the item too? + * This allows the controller to initialize the chat session item with information from the initial request. + * + * The returned chat session is added to the collection and shown in the UI. */ - readonly onDidArchiveChatSessionItem: Event; + newChatSessionItemHandler?: ChatSessionItemControllerNewItemHandler; + + /** + * Fired when an item's archived state changes. + */ + readonly onDidChangeChatSessionItemState: Event; } /** @@ -118,7 +155,8 @@ declare module 'vscode' { /** * Replaces the items stored by the collection. - * @param items Items to store. + * + * @param items Items to store. If two items have the same resource URI, the last one will be used. */ replace(items: readonly ChatSessionItem[]): void; @@ -133,31 +171,42 @@ declare module 'vscode' { /** * Adds the chat session item to the collection. If an item with the same resource URI already * exists, it'll be replaced. + * * @param item Item to add. */ add(item: ChatSessionItem): void; /** * Removes a single chat session item from the collection. + * * @param resource Item resource to delete. */ delete(resource: Uri): void; /** * Efficiently gets a chat session item by resource, if it exists, in the collection. + * * @param resource Item resource to get. + * * @returns The found item or undefined if it does not exist. */ get(resource: Uri): ChatSessionItem | undefined; } + /** + * A chat session show in the UI. + * + * This should be created by calling a {@link ChatSessionItemController.createChatSessionItem createChatSessionItem} + * method on the controller. The item can then be added to the controller's {@link ChatSessionItemController.items items collection} + * to show it in the UI. + */ export interface ChatSessionItem { /** * The resource associated with the chat session. * * This is uniquely identifies the chat session and is used to open the chat session. */ - resource: Uri; + readonly resource: Uri; /** * Human readable name of the session shown in the UI @@ -201,33 +250,33 @@ declare module 'vscode' { /** * Timestamp when the session was created in milliseconds elapsed since January 1, 1970 00:00:00 UTC. */ - created: number; + readonly created: number; /** * Timestamp when the most recent request started in milliseconds elapsed since January 1, 1970 00:00:00 UTC. * * Should be undefined if no requests have been made yet. */ - lastRequestStarted?: number; + readonly lastRequestStarted?: number; /** * Timestamp when the most recent request completed in milliseconds elapsed since January 1, 1970 00:00:00 UTC. * * Should be undefined if the most recent request is still in progress or if no requests have been made yet. */ - lastRequestEnded?: number; + readonly lastRequestEnded?: number; /** * Session start timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC. * @deprecated Use `created` and `lastRequestStarted` instead. */ - startTime?: number; + readonly startTime?: number; /** * Session end timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC. * @deprecated Use `lastRequestEnded` instead. */ - endTime?: number; + readonly endTime?: number; }; /** @@ -241,22 +290,6 @@ declare module 'vscode' { * To update the metadata you must re-set this property. */ metadata?: { readonly [key: string]: any }; - - /** - * Optional repository information for the chat session. - * Used to identify which repository the session is associated with. - */ - repository?: { - /** - * The owner of the repository (e.g., organization or username). - */ - owner: string; - - /** - * The name of the repository. - */ - name: string; - }; } export class ChatSessionChangedFile { @@ -348,6 +381,7 @@ declare module 'vscode' { */ // TODO: Should we introduce our own type for `ChatRequestHandler` since not all field apply to chat sessions? // TODO: Revisit this to align with code. + // TODO: pass in options? readonly requestHandler: ChatRequestHandler | undefined; } @@ -449,7 +483,11 @@ declare module 'vscode' { export interface ChatSessionContext { readonly chatSessionItem: ChatSessionItem; // Maps to URI of chat session editor (could be 'untitled-1', etc..) readonly isUntitled: boolean; - readonly initialSessionOptions?: ReadonlyArray<{ optionId: string; value: string | { id: string; name: string } }>; + /** + * The initial option selections for the session, provided with the first request. + * Contains the options the user selected (or defaults) before the session was created. + */ + readonly initialSessionOptions?: ReadonlyArray<{ optionId: string; value: string | ChatSessionProviderOptionItem }>; } export interface ChatSessionCapabilities { @@ -553,8 +591,9 @@ declare module 'vscode' { readonly onSearch?: (query: string, token: CancellationToken) => Thenable; /** - * Commands to display as actions in the option group dropdown. - * These commands are shown as clickable options in the picker UI. + * Optional commands. + * + * These commands will be displayed at the bottom of the group. */ readonly commands?: Command[]; } diff --git a/extensions/copilot/src/extension/vscode.proposed.chatStatusItem.d.ts b/extensions/copilot/src/extension/vscode.proposed.chatStatusItem.d.ts index 6d93db64ab2..b03afe16ca1 100644 --- a/extensions/copilot/src/extension/vscode.proposed.chatStatusItem.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.chatStatusItem.d.ts @@ -58,4 +58,4 @@ declare module 'vscode' { */ export function createChatStatusItem(id: string): ChatStatusItem; } -} \ No newline at end of file +} diff --git a/extensions/copilot/src/extension/vscode.proposed.commentReveal.d.ts b/extensions/copilot/src/extension/vscode.proposed.commentReveal.d.ts index 168c4691de5..3aa005d0a99 100644 --- a/extensions/copilot/src/extension/vscode.proposed.commentReveal.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.commentReveal.d.ts @@ -7,26 +7,39 @@ declare module 'vscode' { // @alexr00 https://github.com/microsoft/vscode/issues/167253 + export enum CommentThreadFocus { + /** + * Focus the comment editor if the thread supports replying. + */ + Reply = 1, + /** + * Focus the revealed comment. + */ + Comment = 2 + } + /** * Options to reveal a comment thread in an editor. */ export interface CommentThreadRevealOptions { - /** - * By default, the comment thread will be focused. Set `preserveFocus` to `true` to maintain the original focus. - */ - preserveFocus?: boolean; /** - * Focus the comment thread reply editor, if the thread supports replying. + * Where to move the focus to when revealing the comment thread. + * If undefined, the focus will not be changed. */ - focusReply?: boolean; + focus?: CommentThreadFocus; } - export interface CommentThread { + export interface CommentThread2 { /** - * Reveal the comment thread in an editor. + * Reveal the comment thread in an editor. If no comment is provided, the first comment in the thread will be revealed. */ - reveal(options?: CommentThreadRevealOptions): Thenable; + reveal(comment?: Comment, options?: CommentThreadRevealOptions): Thenable; + + /** + * Collapse the comment thread in an editor. + */ + hide(): Thenable; } } diff --git a/extensions/copilot/src/extension/vscode.proposed.contribChatEditorInlineGutterMenu.d.ts b/extensions/copilot/src/extension/vscode.proposed.contribChatEditorInlineGutterMenu.d.ts new file mode 100644 index 00000000000..a06788a2dd0 --- /dev/null +++ b/extensions/copilot/src/extension/vscode.proposed.contribChatEditorInlineGutterMenu.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// empty placeholder declaration for the `chat/editor/inlineGutter` menu diff --git a/extensions/copilot/src/extension/vscode.proposed.contribDebugCreateConfiguration.d.ts b/extensions/copilot/src/extension/vscode.proposed.contribDebugCreateConfiguration.d.ts new file mode 100644 index 00000000000..c28b6b4cc42 --- /dev/null +++ b/extensions/copilot/src/extension/vscode.proposed.contribDebugCreateConfiguration.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// empty placeholder declaration for the `debugCreateConfiguration` menu diff --git a/extensions/copilot/src/extension/vscode.proposed.contribEditorContentMenu.d.ts b/extensions/copilot/src/extension/vscode.proposed.contribEditorContentMenu.d.ts new file mode 100644 index 00000000000..6b45f3468bd --- /dev/null +++ b/extensions/copilot/src/extension/vscode.proposed.contribEditorContentMenu.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// empty placeholder declaration for the `editor/content` menu diff --git a/extensions/copilot/src/extension/vscode.proposed.contribLanguageModelToolSets.d.ts b/extensions/copilot/src/extension/vscode.proposed.contribLanguageModelToolSets.d.ts new file mode 100644 index 00000000000..9059142ad93 --- /dev/null +++ b/extensions/copilot/src/extension/vscode.proposed.contribLanguageModelToolSets.d.ts @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// empty placeholder declaration for the `languageModelToolSets` contribution point diff --git a/extensions/copilot/src/extension/vscode.proposed.dataChannels.d.ts b/extensions/copilot/src/extension/vscode.proposed.dataChannels.d.ts index 593c2de5955..edadd6373f0 100644 --- a/extensions/copilot/src/extension/vscode.proposed.dataChannels.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.dataChannels.d.ts @@ -10,7 +10,7 @@ declare module 'vscode' { } export interface DataChannel { - onDidReceiveData: Event>; + readonly onDidReceiveData: Event>; } export interface DataChannelEvent { diff --git a/extensions/copilot/src/extension/vscode.proposed.defaultChatParticipant.d.ts b/extensions/copilot/src/extension/vscode.proposed.defaultChatParticipant.d.ts index bdc36d07b19..a4f907a116c 100644 --- a/extensions/copilot/src/extension/vscode.proposed.defaultChatParticipant.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.defaultChatParticipant.d.ts @@ -13,15 +13,6 @@ declare module 'vscode' { message: MarkdownString; } - export interface ChatRequesterInformation { - name: string; - - /** - * A full URI for the icon of the request. - */ - icon?: Uri; - } - export interface ChatTitleProvider { /** * TODO@API Should this take a ChatResult like the followup provider, or just take a new ChatContext that includes the current message as history? @@ -47,6 +38,5 @@ declare module 'vscode' { additionalWelcomeMessage?: string | MarkdownString; titleProvider?: ChatTitleProvider; summarizer?: ChatSummarizer; - requester?: ChatRequesterInformation; } } diff --git a/extensions/copilot/src/extension/vscode.proposed.extensionsAny.d.ts b/extensions/copilot/src/extension/vscode.proposed.extensionsAny.d.ts index c53cd6d89f8..468ffe7b78c 100644 --- a/extensions/copilot/src/extension/vscode.proposed.extensionsAny.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.extensionsAny.d.ts @@ -28,6 +28,7 @@ declare module 'vscode' { * @return An extension or `undefined`. */ export function getExtension(extensionId: string, includeDifferentExtensionHosts: boolean): Extension | undefined; + export function getExtension(extensionId: string, includeDifferentExtensionHosts: true): Extension | undefined; /** * All extensions across all extension hosts. diff --git a/extensions/copilot/src/extension/vscode.proposed.findFiles2.d.ts b/extensions/copilot/src/extension/vscode.proposed.findFiles2.d.ts index 579ba732ac9..8e7c11874b4 100644 --- a/extensions/copilot/src/extension/vscode.proposed.findFiles2.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.findFiles2.d.ts @@ -9,8 +9,8 @@ declare module 'vscode' { export interface FindFiles2Options { /** - * An array of {@link GlobPattern GlobPattern} that defines files to exclude. - * The glob patterns will be matched against the file paths of files relative to their workspace or {@link RelativePattern.baseUri} if applicable. + * An array of {@link GlobPattern} that defines files to exclude. + * The glob patterns will be matched against the file paths of files relative to their workspace or {@link RelativePattern}'s `baseUri` if applicable. * * If more than one value is used, the values are combined with a logical AND. * For example, consider the following code: @@ -26,7 +26,7 @@ declare module 'vscode' { exclude?: GlobPattern[]; /** - * Which settings to follow when searching for files. Defaults to {@link ExcludeSettingOptions.searchAndFilesExclude}. + * Which settings to follow when searching for files. Defaults to `ExcludeSettingOptions.searchAndFilesExclude`. */ useExcludeSettings?: ExcludeSettingOptions; @@ -93,8 +93,6 @@ declare module 'vscode' { export namespace workspace { /** - * WARNING: VERY EXPERIMENTAL. - * * Find files across all {@link workspace.workspaceFolders workspace folders} in the workspace. * * @example diff --git a/extensions/copilot/src/extension/vscode.proposed.languageModelThinkingPart.d.ts b/extensions/copilot/src/extension/vscode.proposed.languageModelThinkingPart.d.ts index 743ab233443..7c5da1aa622 100644 --- a/extensions/copilot/src/extension/vscode.proposed.languageModelThinkingPart.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.languageModelThinkingPart.d.ts @@ -47,7 +47,6 @@ declare module 'vscode' { stream: AsyncIterable; } - export interface LanguageModelChat { sendRequest(messages: Array, options?: LanguageModelChatRequestOptions, token?: CancellationToken): Thenable; countTokens(text: string | LanguageModelChatMessage | LanguageModelChatMessage2, token?: CancellationToken): Thenable; diff --git a/extensions/copilot/src/extension/vscode.proposed.languageModelToolSupportsModel.d.ts b/extensions/copilot/src/extension/vscode.proposed.languageModelToolSupportsModel.d.ts index 5d4b8d70f31..ab481a3d9d8 100644 --- a/extensions/copilot/src/extension/vscode.proposed.languageModelToolSupportsModel.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.languageModelToolSupportsModel.d.ts @@ -3,6 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +// version: 1 + declare module 'vscode' { export interface LanguageModelToolDefinition extends LanguageModelToolInformation { diff --git a/extensions/copilot/src/extension/vscode.proposed.mappedEditsProvider.d.ts b/extensions/copilot/src/extension/vscode.proposed.mappedEditsProvider.d.ts index 0368927591b..ae22bc707b2 100644 --- a/extensions/copilot/src/extension/vscode.proposed.mappedEditsProvider.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.mappedEditsProvider.d.ts @@ -75,8 +75,8 @@ declare module 'vscode' { readonly codeBlocks: { code: string; resource: Uri; markdownBeforeBlock?: string }[]; readonly location?: string; readonly chatRequestId?: string; - readonly chatSessionId?: string; readonly chatRequestModel?: string; + readonly chatSessionId?: string; } export interface MappedEditsResponseStream { diff --git a/extensions/copilot/src/extension/vscode.proposed.resolvers.d.ts b/extensions/copilot/src/extension/vscode.proposed.resolvers.d.ts index 5df4f6fc1c5..5135427c680 100644 --- a/extensions/copilot/src/extension/vscode.proposed.resolvers.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.resolvers.d.ts @@ -34,9 +34,9 @@ declare module 'vscode' { } export interface ManagedMessagePassing { - onDidReceiveMessage: Event; - onDidClose: Event; - onDidEnd: Event; + readonly onDidReceiveMessage: Event; + readonly onDidClose: Event; + readonly onDidEnd: Event; send: (data: Uint8Array) => void; end: () => void; @@ -102,7 +102,7 @@ declare module 'vscode' { export interface Tunnel extends TunnelDescription { // Implementers of Tunnel should fire onDidDispose when dispose is called. - onDidDispose: Event; + readonly onDidDispose: Event; dispose(): void | Thenable; } diff --git a/extensions/copilot/src/extension/vscode.proposed.taskExecutionTerminal.d.ts b/extensions/copilot/src/extension/vscode.proposed.taskExecutionTerminal.d.ts new file mode 100644 index 00000000000..24912b369fb --- /dev/null +++ b/extensions/copilot/src/extension/vscode.proposed.taskExecutionTerminal.d.ts @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// #234440 +declare module 'vscode' { + + export interface TaskExecution { + /** + * The terminal associated with this task execution, if any. + */ + terminal?: Terminal; + } +} diff --git a/extensions/copilot/src/extension/vscode.proposed.terminalQuickFixProvider.d.ts b/extensions/copilot/src/extension/vscode.proposed.terminalQuickFixProvider.d.ts index ab06faacd7f..b186d5bbe4f 100644 --- a/extensions/copilot/src/extension/vscode.proposed.terminalQuickFixProvider.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.terminalQuickFixProvider.d.ts @@ -59,7 +59,7 @@ declare module 'vscode' { /** * A matcher that runs on a sub-section of a terminal command's output */ - interface TerminalOutputMatcher { + export interface TerminalOutputMatcher { /** * A string or regex to match against the unwrapped line. If this is a regex with the multiline * flag, it will scan an amount of lines equal to `\n` instances in the regex + 1. @@ -80,7 +80,7 @@ declare module 'vscode' { length: number; } - enum TerminalOutputAnchor { + export enum TerminalOutputAnchor { Top = 0, Bottom = 1 } diff --git a/extensions/copilot/src/extension/vscode.proposed.textDocumentChangeReason.d.ts b/extensions/copilot/src/extension/vscode.proposed.textDocumentChangeReason.d.ts index 3b892fe4db8..f656c304da2 100644 --- a/extensions/copilot/src/extension/vscode.proposed.textDocumentChangeReason.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.textDocumentChangeReason.d.ts @@ -25,6 +25,6 @@ declare module 'vscode' { * The precise reason for the document change. * Only available to extensions that have enabled the `textDocumentChangeReason` proposed API. */ - readonly detailedReason?: TextDocumentDetailedChangeReason | undefined; + readonly detailedReason: TextDocumentDetailedChangeReason | undefined; } } diff --git a/extensions/copilot/src/extension/vscode.proposed.textSearchProvider2.d.ts b/extensions/copilot/src/extension/vscode.proposed.textSearchProvider2.d.ts index 00976c06ca0..2db6fe26435 100644 --- a/extensions/copilot/src/extension/vscode.proposed.textSearchProvider2.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.textSearchProvider2.d.ts @@ -14,16 +14,16 @@ declare module 'vscode' { /** * The text pattern to search for. * - * If explicitly contains a newline character (`\n`), the default search behavior + * If pattern contains a newline character (`\n`), the default search behavior * will automatically enable {@link isMultiline}. */ pattern: string; /** - * Whether or not `pattern` should match multiple lines of text. + * Whether or not {@link pattern} should match multiple lines of text. * * If using the default search provider, this will be interpreted as `true` if - * `pattern` contains a newline character (`\n`). + * {@link pattern} contains a newline character (`\n`). */ isMultiline?: boolean; @@ -89,11 +89,11 @@ declare module 'vscode' { */ local: boolean; /** - * Use ignore files at the parent directory. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`. - */ + * Use ignore files at the parent directory. If set, `local` in {@link TextSearchProviderFolderOptions.useIgnoreFiles} should also be `true`. + */ parent: boolean; /** - * Use global ignore files. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`. + * Use global ignore files. If set, `local` in {@link TextSearchProviderFolderOptions.useIgnoreFiles} should also be `true`. */ global: boolean; }; @@ -145,7 +145,7 @@ declare module 'vscode' { export interface TextSearchComplete2 { /** * Whether the search hit the limit on the maximum number of search results. - * `maxResults` on {@linkcode TextSearchProviderOptions} specifies the max number of results. + * `maxResults` on {@link TextSearchProviderOptions} specifies the max number of results. * - If exactly that number of matches exist, this should be false. * - If `maxResults` matches are returned and more exist, this should be true. * - If search hits an internal limit which is less than `maxResults`, this should be true. @@ -270,8 +270,6 @@ declare module 'vscode' { */ export interface TextSearchProvider2 { /** - * WARNING: VERY EXPERIMENTAL. - * * Provide results that match the given text pattern. * @param query The parameters for this query. * @param options A set of options to consider while searching. @@ -279,7 +277,7 @@ declare module 'vscode' { * These results can be direct matches, or context that surrounds matches. * @param token A cancellation token. */ - provideTextSearchResults(query: TextSearchQuery2, options: TextSearchProviderOptions, progress: Progress, token: CancellationToken): ProviderResult; + provideTextSearchResults(query: TextSearchQuery2, options: TextSearchProviderOptions, progress: Progress, token: CancellationToken): ProviderResult; } export namespace workspace { @@ -292,6 +290,6 @@ declare module 'vscode' { * @param provider The provider. * @return A {@link Disposable} that unregisters this provider when being disposed. */ - export function registertextSearchProvider2(scheme: string, provider: TextSearchProvider2): Disposable; + export function registerTextSearchProvider2(scheme: string, provider: TextSearchProvider2): Disposable; } } diff --git a/extensions/copilot/src/extension/vscode.proposed.workspaceTrust.d.ts b/extensions/copilot/src/extension/vscode.proposed.workspaceTrust.d.ts index 2c8edbd9d18..aad6987c2b5 100644 --- a/extensions/copilot/src/extension/vscode.proposed.workspaceTrust.d.ts +++ b/extensions/copilot/src/extension/vscode.proposed.workspaceTrust.d.ts @@ -34,6 +34,17 @@ declare module 'vscode' { } export namespace workspace { + /** + * Event fired when the list of workspace trusted folders changes. + */ + export const onDidChangeWorkspaceTrustedFolders: Event; + + /** + * Check whether the given resource is trusted + * @param resource + */ + export function isResourceTrusted(resource: Uri): Thenable; + /** * Prompt the user to chose whether to trust the specified resource (ex: folder) * @param options Object describing the properties of the resource trust request. diff --git a/extensions/copilot/src/util/common/test/shims/chatTypes.ts b/extensions/copilot/src/util/common/test/shims/chatTypes.ts index 56b339b14f3..e235212246b 100644 --- a/extensions/copilot/src/util/common/test/shims/chatTypes.ts +++ b/extensions/copilot/src/util/common/test/shims/chatTypes.ts @@ -580,10 +580,10 @@ export class ChatToolInvocationPart { constructor(toolName: string, toolCallId: string, - isError?: boolean) { + isError?: boolean | string) { this.toolName = toolName; this.toolCallId = toolCallId; - this.isError = isError; + this.isError = typeof isError === 'string' ? true : isError; } } @@ -613,7 +613,8 @@ export class ChatResponseTurn2 implements vscode.ChatResponseTurn2 { export enum ChatSessionStatus { Failed = 0, Completed = 1, - InProgress = 2 + InProgress = 2, + NeedsInput = 3 } export class LanguageModelError extends Error {