@anthropic-ai/claude-code 2.0.2 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +2412 -2410
- package/package.json +1 -1
- package/sdk.d.ts +20 -4
- package/sdk.mjs +1 -8
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -293,7 +293,13 @@ export type SDKUserMessage = SDKUserMessageContent & {
|
|
|
293
293
|
uuid?: UUID;
|
|
294
294
|
session_id: string;
|
|
295
295
|
};
|
|
296
|
-
export type SDKUserMessageReplay = SDKMessageBase & SDKUserMessageContent
|
|
296
|
+
export type SDKUserMessageReplay = SDKMessageBase & SDKUserMessageContent & {
|
|
297
|
+
/**
|
|
298
|
+
* True if this is a replay/acknowledgment of a user message that was already
|
|
299
|
+
* added to the messages array. Used internally to prevent duplicate messages.
|
|
300
|
+
*/
|
|
301
|
+
isReplay: true;
|
|
302
|
+
};
|
|
297
303
|
export type SDKAssistantMessage = SDKMessageBase & {
|
|
298
304
|
type: 'assistant';
|
|
299
305
|
message: APIAssistantMessage;
|
|
@@ -376,9 +382,19 @@ export interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
376
382
|
mcpServerStatus(): Promise<McpServerStatus[]>;
|
|
377
383
|
}
|
|
378
384
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
385
|
+
* Query Claude Code
|
|
386
|
+
*
|
|
387
|
+
* Behavior:
|
|
388
|
+
* - Yields a message at a time
|
|
389
|
+
* - Uses the tools and commands you give it
|
|
390
|
+
*
|
|
391
|
+
* Usage:
|
|
392
|
+
* ```ts
|
|
393
|
+
* const response = query({ prompt: "Help me write a function", options: {} })
|
|
394
|
+
* for await (const message of response) {
|
|
395
|
+
* console.log(message)
|
|
396
|
+
* }
|
|
397
|
+
* ```
|
|
382
398
|
*/
|
|
383
399
|
export declare function query({ prompt, options, }: {
|
|
384
400
|
prompt: string | AsyncIterable<SDKUserMessage>;
|
package/sdk.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// (c) Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service (https://www.anthropic.com/legal/commercial-terms).
|
|
4
4
|
|
|
5
|
-
// Version: 2.0.
|
|
5
|
+
// Version: 2.0.5
|
|
6
6
|
|
|
7
7
|
// Want to see the unminified source? We're hiring!
|
|
8
8
|
// https://job-boards.greenhouse.io/anthropic/jobs/4816199008
|
|
@@ -6375,7 +6375,6 @@ class ProcessTransport {
|
|
|
6375
6375
|
stderr,
|
|
6376
6376
|
customSystemPrompt,
|
|
6377
6377
|
appendSystemPrompt,
|
|
6378
|
-
maxThinkingTokens,
|
|
6379
6378
|
maxTurns,
|
|
6380
6379
|
model,
|
|
6381
6380
|
fallbackModel,
|
|
@@ -6402,9 +6401,6 @@ class ProcessTransport {
|
|
|
6402
6401
|
args.push("--system-prompt", customSystemPrompt);
|
|
6403
6402
|
if (appendSystemPrompt)
|
|
6404
6403
|
args.push("--append-system-prompt", appendSystemPrompt);
|
|
6405
|
-
if (maxThinkingTokens !== undefined) {
|
|
6406
|
-
args.push("--max-thinking-tokens", maxThinkingTokens.toString());
|
|
6407
|
-
}
|
|
6408
6404
|
if (maxTurns)
|
|
6409
6405
|
args.push("--max-turns", maxTurns.toString());
|
|
6410
6406
|
if (model)
|
|
@@ -7171,7 +7167,6 @@ function createSharedQuery({
|
|
|
7171
7167
|
forkSession,
|
|
7172
7168
|
hooks,
|
|
7173
7169
|
includePartialMessages,
|
|
7174
|
-
maxThinkingTokens,
|
|
7175
7170
|
maxTurns,
|
|
7176
7171
|
mcpServers,
|
|
7177
7172
|
model,
|
|
@@ -7224,7 +7219,6 @@ function createSharedQuery({
|
|
|
7224
7219
|
stderr,
|
|
7225
7220
|
customSystemPrompt,
|
|
7226
7221
|
appendSystemPrompt,
|
|
7227
|
-
maxThinkingTokens,
|
|
7228
7222
|
maxTurns,
|
|
7229
7223
|
model,
|
|
7230
7224
|
fallbackModel,
|
|
@@ -14145,7 +14139,6 @@ function query({
|
|
|
14145
14139
|
prompt,
|
|
14146
14140
|
options
|
|
14147
14141
|
}) {
|
|
14148
|
-
console.warn("The Claude Code SDK is now the Claude Agent SDK! " + "Please install and use @anthropic-ai/claude-agent-sdk instead. " + "See https://docs.claude.com/en/docs/claude-code/sdk/migration-guide for migration instructions.");
|
|
14149
14142
|
let pathToClaudeCodeExecutable = options?.pathToClaudeCodeExecutable;
|
|
14150
14143
|
if (!pathToClaudeCodeExecutable) {
|
|
14151
14144
|
const filename = fileURLToPath(import.meta.url);
|