@anthropic-ai/claude-code 1.0.61 → 1.0.63
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 +1054 -998
- package/package.json +1 -1
- package/sdk.mjs +23 -2
- package/vendor/claude-code.vsix +0 -0
package/package.json
CHANGED
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.63
|
|
4
4
|
|
|
5
5
|
// src/entrypoints/sdk.ts
|
|
6
6
|
import { spawn } from "child_process";
|
|
@@ -177,7 +177,8 @@ function query({
|
|
|
177
177
|
args.push("--fallback-model", fallbackModel);
|
|
178
178
|
}
|
|
179
179
|
if (typeof prompt === "string") {
|
|
180
|
-
args.push("--print"
|
|
180
|
+
args.push("--print");
|
|
181
|
+
args.push("--", prompt.trim());
|
|
181
182
|
} else {
|
|
182
183
|
args.push("--input-format", "stream-json");
|
|
183
184
|
}
|
|
@@ -250,6 +251,7 @@ class Query {
|
|
|
250
251
|
pendingControlResponses = new Map;
|
|
251
252
|
sdkMessages;
|
|
252
253
|
inputStream = new Stream;
|
|
254
|
+
intialization;
|
|
253
255
|
constructor(childStdin, childStdout, processExitPromise, canUseTool) {
|
|
254
256
|
this.childStdin = childStdin;
|
|
255
257
|
this.childStdout = childStdout;
|
|
@@ -257,6 +259,9 @@ class Query {
|
|
|
257
259
|
this.canUseTool = canUseTool;
|
|
258
260
|
this.readMessages();
|
|
259
261
|
this.sdkMessages = this.readSdkMessages();
|
|
262
|
+
if (this.childStdin) {
|
|
263
|
+
this.intialization = this.initialize();
|
|
264
|
+
}
|
|
260
265
|
}
|
|
261
266
|
setError(error) {
|
|
262
267
|
this.inputStream.error(error);
|
|
@@ -343,6 +348,16 @@ class Query {
|
|
|
343
348
|
yield message;
|
|
344
349
|
}
|
|
345
350
|
}
|
|
351
|
+
async initialize() {
|
|
352
|
+
if (!this.childStdin) {
|
|
353
|
+
throw new Error("Cannot initialize without child stdin");
|
|
354
|
+
}
|
|
355
|
+
const initRequest = {
|
|
356
|
+
subtype: "initialize"
|
|
357
|
+
};
|
|
358
|
+
const response = await this.request(initRequest, this.childStdin);
|
|
359
|
+
return response.response;
|
|
360
|
+
}
|
|
346
361
|
async interrupt() {
|
|
347
362
|
if (!this.childStdin) {
|
|
348
363
|
throw new Error("Interrupt requires --input-format stream-json");
|
|
@@ -370,6 +385,12 @@ class Query {
|
|
|
370
385
|
`);
|
|
371
386
|
});
|
|
372
387
|
}
|
|
388
|
+
async supportedCommands() {
|
|
389
|
+
if (!this.intialization) {
|
|
390
|
+
throw new Error("Interrupt requires --input-format stream-json");
|
|
391
|
+
}
|
|
392
|
+
return (await this.intialization).commands;
|
|
393
|
+
}
|
|
373
394
|
}
|
|
374
395
|
async function streamToStdin(stream, stdin, abortController) {
|
|
375
396
|
for await (const message of stream) {
|
package/vendor/claude-code.vsix
CHANGED
|
Binary file
|