mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 12:40:19 -05:00
This reverts commit a31cfe4bb1.
This commit is contained in:
@@ -112,10 +112,10 @@ const sanityTestBundlePlugin: esbuild.Plugin = {
|
||||
};
|
||||
|
||||
const importMetaPlugin: esbuild.Plugin = {
|
||||
name: 'claudeAgentSdkImportMetaPlugin',
|
||||
name: 'claudeCodeImportMetaPlugin',
|
||||
setup(build) {
|
||||
// Handle import.meta.url in @anthropic-ai/claude-agent-sdk package
|
||||
build.onLoad({ filter: /node_modules[\/\\]@anthropic-ai[\/\\]claude-agent-sdk[\/\\].*\.mjs$/ }, async (args) => {
|
||||
// Handle import.meta.url in @anthropic-ai/claude-code package
|
||||
build.onLoad({ filter: /node_modules[\/\\]@anthropic-ai[\/\\]claude-code[\/\\].*\.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,7 +51,6 @@
|
||||
"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,
|
||||
|
||||
13
extensions/copilot/package-lock.json
generated
13
extensions/copilot/package-lock.json
generated
@@ -10,7 +10,7 @@
|
||||
"hasInstallScript": true,
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/claude-agent-sdk": "^0.1.9",
|
||||
"@anthropic-ai/claude-code": "^1.0.120",
|
||||
"@anthropic-ai/sdk": "^0.63.0",
|
||||
"@humanwhocodes/gitignore-to-minimatch": "1.0.2",
|
||||
"@microsoft/tiktokenizer": "^1.0.10",
|
||||
@@ -158,11 +158,14 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@anthropic-ai/claude-agent-sdk": {
|
||||
"version": "0.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.1.9.tgz",
|
||||
"integrity": "sha512-vQ1pJWGvc9f7qmfkgRoq/RUeqtXCbBE5jnn8zqXcY/nArZzL7nlwYQbsLDse53U105Idx3tBl6AdjHgisSww/w==",
|
||||
"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==",
|
||||
"license": "SEE LICENSE IN README.md",
|
||||
"bin": {
|
||||
"claude": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
|
||||
@@ -4282,7 +4282,7 @@
|
||||
"shiki": "~1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anthropic-ai/claude-agent-sdk": "^0.1.9",
|
||||
"@anthropic-ai/claude-code": "^1.0.120",
|
||||
"@anthropic-ai/sdk": "^0.63.0",
|
||||
"@humanwhocodes/gitignore-to-minimatch": "1.0.2",
|
||||
"@microsoft/tiktokenizer": "^1.0.10",
|
||||
@@ -4310,4 +4310,4 @@
|
||||
"string_decoder": "npm:string_decoder@1.2.0",
|
||||
"node-gyp": "npm:node-gyp@10.3.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,8 +140,9 @@ async function main() {
|
||||
}
|
||||
|
||||
await copyStaticAssets([
|
||||
`node_modules/@anthropic-ai/claude-agent-sdk/cli.js`,
|
||||
`node_modules/@anthropic-ai/claude-agent-sdk/yoga.wasm`,
|
||||
`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`,
|
||||
], 'dist');
|
||||
}
|
||||
|
||||
|
||||
@@ -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-agent-sdk';
|
||||
import { Options, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
import Anthropic from '@anthropic-ai/sdk';
|
||||
import type * as vscode from 'vscode';
|
||||
import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
|
||||
@@ -234,6 +234,7 @@ export class ClaudeCodeSession extends Disposable {
|
||||
*/
|
||||
private async _startSession(): Promise<void> {
|
||||
// Build options for the Claude Code SDK
|
||||
// process.env.DEBUG = '1'; // debug messages from sdk.mjs
|
||||
const isDebugEnabled = this.configService.getConfig(ConfigKey.Internal.ClaudeCodeDebugEnabled);
|
||||
this.logService.trace(`appRoot: ${this.envService.appRoot}`);
|
||||
const pathSep = isWindows ? ';' : ':';
|
||||
@@ -243,6 +244,7 @@ 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',
|
||||
@@ -255,20 +257,10 @@ export class ClaudeCodeSession extends Disposable {
|
||||
this.canUseTool(name, input, this._currentRequest.toolInvocationToken) :
|
||||
{ behavior: 'deny', message: 'No active request' };
|
||||
},
|
||||
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}`);
|
||||
}
|
||||
})
|
||||
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.'
|
||||
};
|
||||
|
||||
this.logService.trace(`claude-agent-sdk: Starting query with options: ${JSON.stringify(options)}`);
|
||||
this.logService.trace(`Claude CLI SDK: Starting query with options: ${JSON.stringify(options)}`);
|
||||
this._queryGenerator = await this.claudeCodeService.query({
|
||||
prompt: this._createPromptIterable(),
|
||||
options
|
||||
@@ -331,7 +323,7 @@ export class ClaudeCodeSession extends Disposable {
|
||||
throw new Error('Request was cancelled');
|
||||
}
|
||||
|
||||
this.logService.trace(`claude-agent-sdk Message: ${JSON.stringify(message, null, 2)}`);
|
||||
this.logService.trace(`Claude CLI 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-agent-sdk';
|
||||
import { Options, Query, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
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-agent-sdk');
|
||||
const { query } = await import('@anthropic-ai/claude-code');
|
||||
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-agent-sdk';
|
||||
import { SDKMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
import Anthropic from '@anthropic-ai/sdk';
|
||||
import type { CancellationToken } from 'vscode';
|
||||
import { INativeEnvService } from '../../../../platform/env/common/envService';
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* 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';
|
||||
@@ -20,6 +19,7 @@ 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-agent-sdk';
|
||||
import { Options, Query, SDKAssistantMessage, SDKResultMessage, SDKUserMessage } from '@anthropic-ai/claude-code';
|
||||
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-agent-sdk';
|
||||
import { SDKAssistantMessage, SDKMessage } from '@anthropic-ai/claude-code';
|
||||
import Anthropic from '@anthropic-ai/sdk';
|
||||
import * as vscode from 'vscode';
|
||||
import { coalesce } from '../../../util/vs/base/common/arrays';
|
||||
|
||||
@@ -17,10 +17,10 @@ import { isPreRelease, packageJson } from '../../env/common/packagejson';
|
||||
import * as xtabPromptOptions from '../../inlineEdits/common/dataTypes/xtabPromptOptions';
|
||||
import { LANGUAGE_CONTEXT_ENABLED_LANGUAGES, LanguageContextLanguages } from '../../inlineEdits/common/dataTypes/xtabPromptOptions';
|
||||
import { ResponseProcessor } from '../../inlineEdits/common/responseProcessor';
|
||||
import { FetcherId } from '../../networking/common/fetcherService';
|
||||
import { AlternativeNotebookFormat } from '../../notebook/common/alternativeContentFormat';
|
||||
import { IExperimentationService } from '../../telemetry/common/nullExperimentationService';
|
||||
import { IValidator, vBoolean, vString } from './validator';
|
||||
import { FetcherId } from '../../networking/common/fetcherService';
|
||||
|
||||
export const CopilotConfigPrefix = 'github.copilot';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user