mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-22 16:19:52 +01:00
The reckoning: Update all the vscode.proposed.*.d.ts files (#3895)
* 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 <joaomoreno@users.noreply.github.com>
This commit is contained in:
+3
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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/"
|
||||
echo "Push your proposal changes and run \`npm run vscode-dts:dev\` instead."
|
||||
@@ -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));
|
||||
}
|
||||
@@ -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();
|
||||
@@ -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);
|
||||
});
|
||||
+19
-19
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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}`)
|
||||
};
|
||||
|
||||
@@ -233,7 +233,7 @@ ${message}`,
|
||||
return;
|
||||
}
|
||||
if (direction !== 0) {
|
||||
newThread.reveal();
|
||||
(newThread as unknown as vscode.CommentThread2).reveal();
|
||||
}
|
||||
instaService.invokeFunction(fetchSuggestion, newThread);
|
||||
};
|
||||
|
||||
+2
-1
@@ -85,7 +85,8 @@ suite('InlineEditModel', () => {
|
||||
workspaceService.didChangeTextDocumentEmitter.fire({
|
||||
document,
|
||||
contentChanges: [],
|
||||
reason
|
||||
reason,
|
||||
detailedReason: undefined
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -724,6 +724,7 @@ describe('Edit Notebook Tool', () => {
|
||||
}
|
||||
],
|
||||
reason: undefined,
|
||||
detailedReason: undefined,
|
||||
});
|
||||
workspaceService.didChangeNotebookDocumentEmitter.fire({
|
||||
cellChanges: [
|
||||
|
||||
+3
-4
@@ -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;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ declare module 'vscode' {
|
||||
SettingInformation = 4
|
||||
}
|
||||
|
||||
interface RelatedInformationBaseResult {
|
||||
export interface RelatedInformationBaseResult {
|
||||
type: RelatedInformationType;
|
||||
weight: number;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ declare module 'vscode' {
|
||||
}
|
||||
|
||||
export interface SettingsSearchProvider {
|
||||
provideSettingsSearchResults(query: string, options: SettingsSearchProviderOptions, progress: Progress<SettingsSearchResult>, token: CancellationToken): Thenable<void>;
|
||||
provideSettingsSearchResults(query: string, option: SettingsSearchProviderOptions, progress: Progress<SettingsSearchResult>, token: CancellationToken): Thenable<void>;
|
||||
}
|
||||
|
||||
export namespace ai {
|
||||
export function registerSettingsSearchProvider(provider: SettingsSearchProvider): Disposable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ declare module 'vscode' {
|
||||
*/
|
||||
learnMore?: Uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,4 +123,4 @@ declare module 'vscode' {
|
||||
*/
|
||||
hookProgress(hookType: ChatHookType, stopReason?: string, systemMessage?: string): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
-39
@@ -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<unknown>);
|
||||
}
|
||||
|
||||
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<LanguageModelThinkingPart>) => Thenable<string | void>);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -267,8 +267,6 @@ declare module 'vscode' {
|
||||
|
||||
export interface LanguageModelToolInvocationOptions<T> {
|
||||
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;
|
||||
/**
|
||||
|
||||
@@ -100,18 +100,6 @@ declare module 'vscode' {
|
||||
export interface LanguageModelChatProvider<T extends LanguageModelChatInformation = LanguageModelChatInformation> {
|
||||
provideLanguageModelChatInformation(options: PrepareLanguageModelChatModelOptions, token: CancellationToken): ProviderResult<T[]>;
|
||||
provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: ProvideLanguageModelChatResponseOptions, progress: Progress<LanguageModelResponsePart2>, token: CancellationToken): Thenable<void>;
|
||||
provideLanguageModelChatResponse(model: T, messages: readonly LanguageModelChatRequestMessage[], options: ProvideLanguageModelChatResponseOptions, progress: Progress<LanguageModelResponsePart2>, token: CancellationToken): Thenable<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+38
@@ -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<Uint8Array>;
|
||||
|
||||
/**
|
||||
* 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<Uint8Array>);
|
||||
}
|
||||
}
|
||||
+73
-34
@@ -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<void>): 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<void>;
|
||||
|
||||
export interface ChatSessionItemControllerNewItemHandlerContext {
|
||||
readonly request: ChatRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension callback invoked when a new chat session is started.
|
||||
*/
|
||||
export type ChatSessionItemControllerNewItemHandler = (context: ChatSessionItemControllerNewItemHandlerContext, token: CancellationToken) => Thenable<ChatSessionItem>;
|
||||
|
||||
/**
|
||||
* 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<void>;
|
||||
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<ChatSessionItem>;
|
||||
newChatSessionItemHandler?: ChatSessionItemControllerNewItemHandler;
|
||||
|
||||
/**
|
||||
* Fired when an item's archived state changes.
|
||||
*/
|
||||
readonly onDidChangeChatSessionItemState: Event<ChatSessionItem>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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<ChatSessionProviderOptionItem[]>;
|
||||
|
||||
/**
|
||||
* 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[];
|
||||
}
|
||||
|
||||
@@ -58,4 +58,4 @@ declare module 'vscode' {
|
||||
*/
|
||||
export function createChatStatusItem(id: string): ChatStatusItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<void>;
|
||||
reveal(comment?: Comment, options?: CommentThreadRevealOptions): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Collapse the comment thread in an editor.
|
||||
*/
|
||||
hide(): Thenable<void>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -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
|
||||
+6
@@ -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
|
||||
+6
@@ -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
|
||||
+6
@@ -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
|
||||
@@ -10,7 +10,7 @@ declare module 'vscode' {
|
||||
}
|
||||
|
||||
export interface DataChannel<T = unknown> {
|
||||
onDidReceiveData: Event<DataChannelEvent<T>>;
|
||||
readonly onDidReceiveData: Event<DataChannelEvent<T>>;
|
||||
}
|
||||
|
||||
export interface DataChannelEvent<T> {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ declare module 'vscode' {
|
||||
* @return An extension or `undefined`.
|
||||
*/
|
||||
export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: boolean): Extension<T> | undefined;
|
||||
export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: true): Extension<T | undefined> | undefined;
|
||||
|
||||
/**
|
||||
* All extensions across all extension hosts.
|
||||
|
||||
@@ -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
|
||||
|
||||
-1
@@ -47,7 +47,6 @@ declare module 'vscode' {
|
||||
stream: AsyncIterable<LanguageModelTextPart | LanguageModelThinkingPart | LanguageModelToolCallPart | unknown>;
|
||||
}
|
||||
|
||||
|
||||
export interface LanguageModelChat {
|
||||
sendRequest(messages: Array<LanguageModelChatMessage | LanguageModelChatMessage2>, options?: LanguageModelChatRequestOptions, token?: CancellationToken): Thenable<LanguageModelChatResponse>;
|
||||
countTokens(text: string | LanguageModelChatMessage | LanguageModelChatMessage2, token?: CancellationToken): Thenable<number>;
|
||||
|
||||
+2
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -34,9 +34,9 @@ declare module 'vscode' {
|
||||
}
|
||||
|
||||
export interface ManagedMessagePassing {
|
||||
onDidReceiveMessage: Event<Uint8Array>;
|
||||
onDidClose: Event<Error | undefined>;
|
||||
onDidEnd: Event<void>;
|
||||
readonly onDidReceiveMessage: Event<Uint8Array>;
|
||||
readonly onDidClose: Event<Error | undefined>;
|
||||
readonly onDidEnd: Event<void>;
|
||||
|
||||
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<void>;
|
||||
readonly onDidDispose: Event<void>;
|
||||
dispose(): void | Thenable<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<TextSearchResult2>, token: CancellationToken): ProviderResult<TextSearchComplete2>;
|
||||
provideTextSearchResults(query: TextSearchQuery2, options: TextSearchProviderOptions, progress: Progress<AISearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete2>;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,17 @@ declare module 'vscode' {
|
||||
}
|
||||
|
||||
export namespace workspace {
|
||||
/**
|
||||
* Event fired when the list of workspace trusted folders changes.
|
||||
*/
|
||||
export const onDidChangeWorkspaceTrustedFolders: Event<void>;
|
||||
|
||||
/**
|
||||
* Check whether the given resource is trusted
|
||||
* @param resource
|
||||
*/
|
||||
export function isResourceTrusted(resource: Uri): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Prompt the user to chose whether to trust the specified resource (ex: folder)
|
||||
* @param options Object describing the properties of the resource trust request.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user