@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-code",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "main": "sdk.mjs",
5
5
  "types": "sdk.d.ts",
6
6
  "bin": {
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.61
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", prompt.trim());
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) {
Binary file