@anthropic-ai/claude-code 1.0.55 → 1.0.56
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 +848 -770
- package/package.json +1 -1
- package/sdk.d.ts +14 -6
- package/sdk.mjs +15 -7
- package/vendor/claude-code.vsix +0 -0
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -31,7 +31,10 @@ export type McpHttpServerConfig = {
|
|
|
31
31
|
headers?: Record<string, string>
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export type McpServerConfig =
|
|
34
|
+
export type McpServerConfig =
|
|
35
|
+
| McpStdioServerConfig
|
|
36
|
+
| McpSSEServerConfig
|
|
37
|
+
| McpHttpServerConfig
|
|
35
38
|
|
|
36
39
|
export type Options = {
|
|
37
40
|
abortController?: AbortController
|
|
@@ -52,6 +55,7 @@ export type Options = {
|
|
|
52
55
|
resume?: string
|
|
53
56
|
model?: string
|
|
54
57
|
fallbackModel?: string
|
|
58
|
+
stderr?: (data: string) => void
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
export type PermissionMode =
|
|
@@ -126,6 +130,14 @@ type Props = {
|
|
|
126
130
|
options?: Options
|
|
127
131
|
}
|
|
128
132
|
|
|
133
|
+
export interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
134
|
+
/**
|
|
135
|
+
* Interrupt the query.
|
|
136
|
+
* Only supported when streaming input is used.
|
|
137
|
+
*/
|
|
138
|
+
interrupt(): Promise<void>
|
|
139
|
+
}
|
|
140
|
+
|
|
129
141
|
/**
|
|
130
142
|
* Query Claude Code
|
|
131
143
|
*
|
|
@@ -141,10 +153,6 @@ type Props = {
|
|
|
141
153
|
* }
|
|
142
154
|
* ```
|
|
143
155
|
*/
|
|
144
|
-
export function query({
|
|
145
|
-
prompt,
|
|
146
|
-
abortController,
|
|
147
|
-
options,
|
|
148
|
-
}: Props): AsyncGenerator<SDKMessage>
|
|
156
|
+
export function query({ prompt, abortController, options }: Props): Query
|
|
149
157
|
|
|
150
158
|
export class AbortError extends Error {}
|
package/sdk.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (c) Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service (https://www.anthropic.com/legal/commercial-terms).
|
|
2
2
|
|
|
3
|
-
// Version: 1.0.
|
|
3
|
+
// Version: 1.0.56
|
|
4
4
|
|
|
5
5
|
// src/entrypoints/sdk.ts
|
|
6
6
|
import { spawn } from "child_process";
|
|
@@ -84,8 +84,6 @@ class Stream {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// src/entrypoints/sdk.ts
|
|
87
|
-
var __filename2 = fileURLToPath(import.meta.url);
|
|
88
|
-
var __dirname2 = join(__filename2, "..");
|
|
89
87
|
function query({
|
|
90
88
|
prompt,
|
|
91
89
|
options: {
|
|
@@ -99,7 +97,7 @@ function query({
|
|
|
99
97
|
executableArgs = [],
|
|
100
98
|
maxTurns,
|
|
101
99
|
mcpServers,
|
|
102
|
-
pathToClaudeCodeExecutable
|
|
100
|
+
pathToClaudeCodeExecutable,
|
|
103
101
|
permissionMode = "default",
|
|
104
102
|
permissionPromptToolName,
|
|
105
103
|
continue: continueConversation,
|
|
@@ -107,12 +105,17 @@ function query({
|
|
|
107
105
|
model,
|
|
108
106
|
fallbackModel,
|
|
109
107
|
strictMcpConfig,
|
|
110
|
-
|
|
108
|
+
stderr
|
|
111
109
|
} = {}
|
|
112
110
|
}) {
|
|
113
111
|
if (!process.env.CLAUDE_CODE_ENTRYPOINT) {
|
|
114
112
|
process.env.CLAUDE_CODE_ENTRYPOINT = "sdk-ts";
|
|
115
113
|
}
|
|
114
|
+
if (pathToClaudeCodeExecutable === undefined) {
|
|
115
|
+
const filename = fileURLToPath(import.meta.url);
|
|
116
|
+
const dirname = join(filename, "..");
|
|
117
|
+
pathToClaudeCodeExecutable = join(dirname, "cli.js");
|
|
118
|
+
}
|
|
116
119
|
const args = ["--output-format", "stream-json", "--verbose"];
|
|
117
120
|
if (customSystemPrompt)
|
|
118
121
|
args.push("--system-prompt", customSystemPrompt);
|
|
@@ -173,9 +176,14 @@ function query({
|
|
|
173
176
|
streamToStdin(prompt, child.stdin, abortController);
|
|
174
177
|
childStdin = child.stdin;
|
|
175
178
|
}
|
|
176
|
-
if (process.env.DEBUG ||
|
|
179
|
+
if (process.env.DEBUG || stderr) {
|
|
177
180
|
child.stderr.on("data", (data) => {
|
|
178
|
-
|
|
181
|
+
if (process.env.DEBUG) {
|
|
182
|
+
console.error("Claude Code stderr:", data.toString());
|
|
183
|
+
}
|
|
184
|
+
if (stderr) {
|
|
185
|
+
stderr(data.toString());
|
|
186
|
+
}
|
|
179
187
|
});
|
|
180
188
|
}
|
|
181
189
|
const cleanup = () => {
|
package/vendor/claude-code.vsix
CHANGED
|
Binary file
|