mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 12:40:19 -05:00
Bump claude-code again (#2413)
* Revert "Revert "Bump claude-code module (#2167)" (#2179)"
This reverts commit 18092fc6a3.
* Try this
This commit is contained in:
@@ -122,10 +122,10 @@ const sanityTestBundlePlugin: esbuild.Plugin = {
|
||||
};
|
||||
|
||||
const importMetaPlugin: esbuild.Plugin = {
|
||||
name: 'claudeCodeImportMetaPlugin',
|
||||
name: 'claudeAgentSdkImportMetaPlugin',
|
||||
setup(build) {
|
||||
// Handle import.meta.url in @anthropic-ai/claude-code package
|
||||
build.onLoad({ filter: /node_modules[\/\\]@anthropic-ai[\/\\]claude-code[\/\\].*\.mjs$/ }, async (args) => {
|
||||
// Handle import.meta.url in @anthropic-ai/claude-agent-sdk package
|
||||
build.onLoad({ filter: /node_modules[\/\\]@anthropic-ai[\/\\]claude-agent-sdk[\/\\].*\.mjs$/ }, async (args) => {
|
||||
const contents = await fs.promises.readFile(args.path, 'utf8');
|
||||
return {
|
||||
contents: contents.replace(
|
||||
|
||||
1
extensions/copilot/.vscode/settings.json
vendored
1
extensions/copilot/.vscode/settings.json
vendored
@@ -51,6 +51,7 @@
|
||||
"search.exclude": {
|
||||
"src/base/util/tokenizer_*.json": true,
|
||||
"src/base/util/*.bpe": true,
|
||||
"src/extension/chatSessions/vscode-node/test/fixtures/**": true,
|
||||
"src/extension/prompts/node/test/fixtures/**/*": true,
|
||||
"src/extension/test/node/fixtures/**/*": true,
|
||||
"src/platform/parser/test/node/fixtures/**/*": true,
|
||||
|
||||
104
extensions/copilot/package-lock.json
generated
104
extensions/copilot/package-lock.json
generated
@@ -10,7 +10,7 @@
|
||||
"hasInstallScript": true,
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/claude-code": "^1.0.120",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.1.55",
|
||||
"@anthropic-ai/sdk": "^0.68.0",
|
||||
"@github/copilot": "^0.0.366",
|
||||
"@google/genai": "^1.22.0",
|
||||
@@ -162,14 +162,11 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-code": {
|
||||
"version": "1.0.120",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-1.0.120.tgz",
|
||||
"integrity": "sha512-Ga+GbFg4A+woD2LHrPSiDalr6434v3B+m7AmgIaCDO1rg4dQmOJlPd3p0G7NbhD9t/RPqj6j1AZKmlx0CbOXyQ==",
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk": {
|
||||
"version": "0.1.55",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.1.55.tgz",
|
||||
"integrity": "sha512-nwlxPjn/gc7I+iOGYY7AGtM2xcjzJFCxF9Bnr0xH1JNaNx+QXLM3h/wmzSvuEOKeJgPymf1GMBs4DZ3jyd/Z7Q==",
|
||||
"license": "SEE LICENSE IN README.md",
|
||||
"bin": {
|
||||
"claude": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
@@ -179,7 +176,12 @@
|
||||
"@img/sharp-linux-arm": "^0.33.5",
|
||||
"@img/sharp-linux-arm64": "^0.33.5",
|
||||
"@img/sharp-linux-x64": "^0.33.5",
|
||||
"@img/sharp-linuxmusl-arm64": "^0.33.5",
|
||||
"@img/sharp-linuxmusl-x64": "^0.33.5",
|
||||
"@img/sharp-win32-x64": "^0.33.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"zod": "^3.24.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@anthropic-ai/sdk": {
|
||||
@@ -3342,6 +3344,38 @@
|
||||
"url": "https://opencollective.com/libvips"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-libvips-linuxmusl-arm64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz",
|
||||
"integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-libvips-linuxmusl-x64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz",
|
||||
"integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-linux-arm": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz",
|
||||
@@ -3408,6 +3442,50 @@
|
||||
"@img/sharp-libvips-linux-x64": "1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-linuxmusl-arm64": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz",
|
||||
"integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@img/sharp-libvips-linuxmusl-arm64": "1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-linuxmusl-x64": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz",
|
||||
"integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@img/sharp-libvips-linuxmusl-x64": "1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-win32-x64": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz",
|
||||
@@ -19269,6 +19347,16 @@
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "3.25.76",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4913,7 +4913,7 @@
|
||||
"inputPlaceholder": "Describe your task, type `#` for adding context",
|
||||
"order": 3,
|
||||
"description": "The Claude Code Agent works on your local machine",
|
||||
"when": "config.github.copilot.chat.advanced.claudeCode.enabled",
|
||||
"when": "config.github.copilot.chat.claudeCode.enabled",
|
||||
"canDelegate": false,
|
||||
"capabilities": {
|
||||
"supportsFileAttachments": true
|
||||
@@ -5176,7 +5176,7 @@
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anthropic-ai/claude-code": "^1.0.120",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.1.55",
|
||||
"@anthropic-ai/sdk": "^0.68.0",
|
||||
"@github/copilot": "^0.0.366",
|
||||
"@google/genai": "^1.22.0",
|
||||
|
||||
@@ -139,9 +139,7 @@ async function main() {
|
||||
}
|
||||
|
||||
await copyStaticAssets([
|
||||
`node_modules/@anthropic-ai/claude-code/cli.js`,
|
||||
`node_modules/@anthropic-ai/claude-code/yoga.wasm`,
|
||||
// `node_modules/@anthropic-ai/claude-code/vendor/ripgrep/${process.arch}-${process.platform}/ripgrep`,
|
||||
`node_modules/@anthropic-ai/claude-agent-sdk/cli.js`,
|
||||
], 'dist');
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { PreToolUseHookInput } from '@anthropic-ai/claude-code';
|
||||
import { PreToolUseHookInput } from '@anthropic-ai/claude-agent-sdk';
|
||||
import { URI } from '../../../../util/vs/base/common/uri';
|
||||
|
||||
export enum ClaudeToolNames {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { HookInput, HookJSONOutput, Options, PreToolUseHookInput, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
import { HookInput, HookJSONOutput, Options, PreToolUseHookInput, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
|
||||
import Anthropic from '@anthropic-ai/sdk';
|
||||
import type * as vscode from 'vscode';
|
||||
import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
|
||||
@@ -237,7 +237,6 @@ export class ClaudeCodeSession extends Disposable {
|
||||
*/
|
||||
private async _startSession(token: vscode.CancellationToken): Promise<void> {
|
||||
// Build options for the Claude Code SDK
|
||||
// process.env.DEBUG = '1'; // debug messages from sdk.mjs
|
||||
const isDebugEnabled = this.configService.getConfig(ConfigKey.Advanced.ClaudeCodeDebugEnabled);
|
||||
this.logService.trace(`appRoot: ${this.envService.appRoot}`);
|
||||
const pathSep = isWindows ? ';' : ':';
|
||||
@@ -247,7 +246,6 @@ export class ClaudeCodeSession extends Disposable {
|
||||
executable: process.execPath as 'node', // get it to fork the EH node process
|
||||
env: {
|
||||
...process.env,
|
||||
...(isDebugEnabled ? { DEBUG: '1' } : {}),
|
||||
ANTHROPIC_BASE_URL: `http://localhost:${this.serverConfig.port}`,
|
||||
ANTHROPIC_API_KEY: this.serverConfig.nonce,
|
||||
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',
|
||||
@@ -274,10 +272,20 @@ export class ClaudeCodeSession extends Disposable {
|
||||
this.canUseTool(name, input, this._currentRequest.toolInvocationToken) :
|
||||
{ behavior: 'deny', message: 'No active request' };
|
||||
},
|
||||
appendSystemPrompt: 'Your responses will be rendered as markdown, so please reply with properly formatted markdown when appropriate. When replying with code or the name of a symbol, wrap it in backticks.'
|
||||
systemPrompt: {
|
||||
type: 'preset',
|
||||
preset: 'claude_code',
|
||||
append: 'Your responses will be rendered as markdown, so please reply with properly formatted markdown when appropriate. When replying with code or the name of a symbol, wrap it in backticks.'
|
||||
},
|
||||
settingSources: ['user', 'project', 'local'],
|
||||
...(isDebugEnabled && {
|
||||
stderr: data => {
|
||||
this.logService.trace(`claude-agent-sdk stderr: ${data}`);
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
this.logService.trace(`Claude CLI SDK: Starting query with options: ${JSON.stringify(options)}`);
|
||||
this.logService.trace(`claude-agent-sdk: Starting query with options: ${JSON.stringify(options)}`);
|
||||
this._queryGenerator = await this.claudeCodeService.query({
|
||||
prompt: this._createPromptIterable(),
|
||||
options
|
||||
@@ -365,7 +373,7 @@ export class ClaudeCodeSession extends Disposable {
|
||||
throw new Error('Request was cancelled');
|
||||
}
|
||||
|
||||
this.logService.trace(`Claude CLI SDK Message: ${JSON.stringify(message, null, 2)}`);
|
||||
this.logService.trace(`claude-agent-sdk Message: ${JSON.stringify(message, null, 2)}`);
|
||||
if (message.session_id) {
|
||||
this.sessionId = message.session_id;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Options, Query, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
import { Options, Query, SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
|
||||
import { createServiceIdentifier } from '../../../../util/common/services';
|
||||
|
||||
export interface IClaudeCodeSdkService {
|
||||
@@ -32,7 +32,7 @@ export class ClaudeCodeSdkService implements IClaudeCodeSdkService {
|
||||
prompt: AsyncIterable<SDKUserMessage>;
|
||||
options: Options;
|
||||
}): Promise<Query> {
|
||||
const { query } = await import('@anthropic-ai/claude-code');
|
||||
const { query } = await import('@anthropic-ai/claude-agent-sdk');
|
||||
return query(options);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SDKMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
import { SDKMessage, SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
|
||||
import Anthropic from '@anthropic-ai/sdk';
|
||||
import type { CancellationToken } from 'vscode';
|
||||
import { INativeEnvService } from '../../../../platform/env/common/envService';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
|
||||
import { readFile } from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
@@ -19,7 +20,6 @@ import { URI } from '../../../../../util/vs/base/common/uri';
|
||||
import { IInstantiationService } from '../../../../../util/vs/platform/instantiation/common/instantiation';
|
||||
import { createExtensionUnitTestingServices } from '../../../../test/node/services';
|
||||
import { ClaudeCodeSessionService } from '../claudeCodeSessionService';
|
||||
import { SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
|
||||
function computeFolderSlug(folderUri: URI): string {
|
||||
return folderUri.path.replace(/\//g, '-');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Options, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
import { Options, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
|
||||
import { IClaudeCodeSdkService } from '../claudeCodeSdkService';
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SDKAssistantMessage, SDKMessage } from '@anthropic-ai/claude-code';
|
||||
import { SDKAssistantMessage, SDKMessage } from '@anthropic-ai/claude-agent-sdk';
|
||||
import Anthropic from '@anthropic-ai/sdk';
|
||||
import * as vscode from 'vscode';
|
||||
import { coalesce } from '../../../util/vs/base/common/arrays';
|
||||
|
||||
Reference in New Issue
Block a user