Skip to content

Commit de0ff25

Browse files
authored
Bump claude-code again (#2413)
* Revert "Revert "Bump claude-code module (#2167)" (#2179)" This reverts commit ef797b1. * Try this
1 parent a254e8b commit de0ff25

File tree

12 files changed

+124
-29
lines changed

12 files changed

+124
-29
lines changed

.esbuild.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ const sanityTestBundlePlugin: esbuild.Plugin = {
122122
};
123123

124124
const importMetaPlugin: esbuild.Plugin = {
125-
name: 'claudeCodeImportMetaPlugin',
125+
name: 'claudeAgentSdkImportMetaPlugin',
126126
setup(build) {
127-
// Handle import.meta.url in @anthropic-ai/claude-code package
128-
build.onLoad({ filter: /node_modules[\/\\]@anthropic-ai[\/\\]claude-code[\/\\].*\.mjs$/ }, async (args) => {
127+
// Handle import.meta.url in @anthropic-ai/claude-agent-sdk package
128+
build.onLoad({ filter: /node_modules[\/\\]@anthropic-ai[\/\\]claude-agent-sdk[\/\\].*\.mjs$/ }, async (args) => {
129129
const contents = await fs.promises.readFile(args.path, 'utf8');
130130
return {
131131
contents: contents.replace(

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"search.exclude": {
5252
"src/base/util/tokenizer_*.json": true,
5353
"src/base/util/*.bpe": true,
54+
"src/extension/chatSessions/vscode-node/test/fixtures/**": true,
5455
"src/extension/prompts/node/test/fixtures/**/*": true,
5556
"src/extension/test/node/fixtures/**/*": true,
5657
"src/platform/parser/test/node/fixtures/**/*": true,

package-lock.json

Lines changed: 96 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4913,7 +4913,7 @@
49134913
"inputPlaceholder": "Describe your task, type `#` for adding context",
49144914
"order": 3,
49154915
"description": "The Claude Code Agent works on your local machine",
4916-
"when": "config.github.copilot.chat.advanced.claudeCode.enabled",
4916+
"when": "config.github.copilot.chat.claudeCode.enabled",
49174917
"canDelegate": false,
49184918
"capabilities": {
49194919
"supportsFileAttachments": true
@@ -5176,7 +5176,7 @@
51765176
"yargs": "^17.7.2"
51775177
},
51785178
"dependencies": {
5179-
"@anthropic-ai/claude-code": "^1.0.120",
5179+
"@anthropic-ai/claude-agent-sdk": "0.1.55",
51805180
"@anthropic-ai/sdk": "^0.68.0",
51815181
"@github/copilot": "^0.0.366",
51825182
"@google/genai": "^1.22.0",

script/postinstall.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ async function main() {
139139
}
140140

141141
await copyStaticAssets([
142-
`node_modules/@anthropic-ai/claude-code/cli.js`,
143-
`node_modules/@anthropic-ai/claude-code/yoga.wasm`,
144-
// `node_modules/@anthropic-ai/claude-code/vendor/ripgrep/${process.arch}-${process.platform}/ripgrep`,
142+
`node_modules/@anthropic-ai/claude-agent-sdk/cli.js`,
145143
], 'dist');
146144
}
147145

src/extension/agents/claude/common/claudeTools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { PreToolUseHookInput } from '@anthropic-ai/claude-code';
6+
import { PreToolUseHookInput } from '@anthropic-ai/claude-agent-sdk';
77
import { URI } from '../../../../util/vs/base/common/uri';
88

99
export enum ClaudeToolNames {

src/extension/agents/claude/node/claudeCodeAgent.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { HookInput, HookJSONOutput, Options, PreToolUseHookInput, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
6+
import { HookInput, HookJSONOutput, Options, PreToolUseHookInput, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
77
import Anthropic from '@anthropic-ai/sdk';
88
import type * as vscode from 'vscode';
99
import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
@@ -237,7 +237,6 @@ export class ClaudeCodeSession extends Disposable {
237237
*/
238238
private async _startSession(token: vscode.CancellationToken): Promise<void> {
239239
// Build options for the Claude Code SDK
240-
// process.env.DEBUG = '1'; // debug messages from sdk.mjs
241240
const isDebugEnabled = this.configService.getConfig(ConfigKey.Advanced.ClaudeCodeDebugEnabled);
242241
this.logService.trace(`appRoot: ${this.envService.appRoot}`);
243242
const pathSep = isWindows ? ';' : ':';
@@ -247,7 +246,6 @@ export class ClaudeCodeSession extends Disposable {
247246
executable: process.execPath as 'node', // get it to fork the EH node process
248247
env: {
249248
...process.env,
250-
...(isDebugEnabled ? { DEBUG: '1' } : {}),
251249
ANTHROPIC_BASE_URL: `http://localhost:${this.serverConfig.port}`,
252250
ANTHROPIC_API_KEY: this.serverConfig.nonce,
253251
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',
@@ -274,10 +272,20 @@ export class ClaudeCodeSession extends Disposable {
274272
this.canUseTool(name, input, this._currentRequest.toolInvocationToken) :
275273
{ behavior: 'deny', message: 'No active request' };
276274
},
277-
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.'
275+
systemPrompt: {
276+
type: 'preset',
277+
preset: 'claude_code',
278+
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.'
279+
},
280+
settingSources: ['user', 'project', 'local'],
281+
...(isDebugEnabled && {
282+
stderr: data => {
283+
this.logService.trace(`claude-agent-sdk stderr: ${data}`);
284+
}
285+
})
278286
};
279287

280-
this.logService.trace(`Claude CLI SDK: Starting query with options: ${JSON.stringify(options)}`);
288+
this.logService.trace(`claude-agent-sdk: Starting query with options: ${JSON.stringify(options)}`);
281289
this._queryGenerator = await this.claudeCodeService.query({
282290
prompt: this._createPromptIterable(),
283291
options
@@ -365,7 +373,7 @@ export class ClaudeCodeSession extends Disposable {
365373
throw new Error('Request was cancelled');
366374
}
367375

368-
this.logService.trace(`Claude CLI SDK Message: ${JSON.stringify(message, null, 2)}`);
376+
this.logService.trace(`claude-agent-sdk Message: ${JSON.stringify(message, null, 2)}`);
369377
if (message.session_id) {
370378
this.sessionId = message.session_id;
371379
}

src/extension/agents/claude/node/claudeCodeSdkService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Options, Query, SDKUserMessage } from '@anthropic-ai/claude-code';
6+
import { Options, Query, SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
77
import { createServiceIdentifier } from '../../../../util/common/services';
88

99
export interface IClaudeCodeSdkService {
@@ -32,7 +32,7 @@ export class ClaudeCodeSdkService implements IClaudeCodeSdkService {
3232
prompt: AsyncIterable<SDKUserMessage>;
3333
options: Options;
3434
}): Promise<Query> {
35-
const { query } = await import('@anthropic-ai/claude-code');
35+
const { query } = await import('@anthropic-ai/claude-agent-sdk');
3636
return query(options);
3737
}
3838
}

src/extension/agents/claude/node/claudeCodeSessionService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { SDKMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
6+
import { SDKMessage, SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
77
import Anthropic from '@anthropic-ai/sdk';
88
import type { CancellationToken } from 'vscode';
99
import { INativeEnvService } from '../../../../platform/env/common/envService';

src/extension/agents/claude/node/test/claudeCodeSessionService.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { SDKUserMessage } from '@anthropic-ai/claude-agent-sdk';
67
import { readFile } from 'fs/promises';
78
import * as path from 'path';
89
import { beforeEach, describe, expect, it } from 'vitest';
@@ -19,7 +20,6 @@ import { URI } from '../../../../../util/vs/base/common/uri';
1920
import { IInstantiationService } from '../../../../../util/vs/platform/instantiation/common/instantiation';
2021
import { createExtensionUnitTestingServices } from '../../../../test/node/services';
2122
import { ClaudeCodeSessionService } from '../claudeCodeSessionService';
22-
import { SDKUserMessage } from '@anthropic-ai/claude-code';
2323

2424
function computeFolderSlug(folderUri: URI): string {
2525
return folderUri.path.replace(/\//g, '-');

0 commit comments

Comments
 (0)