@anthropic-ai/claude-code 1.0.102 → 1.0.103
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 +729 -729
- package/package.json +1 -1
- package/sdk.d.ts +2 -0
- package/sdk.mjs +19 -21
- package/vendor/claude-code.vsix +0 -0
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
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: 1.0.
|
|
5
|
+
// Version: 1.0.103
|
|
6
6
|
|
|
7
7
|
// Want to see the unminified source? We're hiring!
|
|
8
8
|
// https://job-boards.greenhouse.io/anthropic/jobs/4816199008
|
|
@@ -6202,8 +6202,8 @@ var require_ajv = __commonJS((exports, module) => {
|
|
|
6202
6202
|
});
|
|
6203
6203
|
|
|
6204
6204
|
// src/entrypoints/sdk.ts
|
|
6205
|
-
import { join
|
|
6206
|
-
import { fileURLToPath
|
|
6205
|
+
import { join } from "path";
|
|
6206
|
+
import { fileURLToPath } from "url";
|
|
6207
6207
|
|
|
6208
6208
|
// src/utils/abortController.ts
|
|
6209
6209
|
import { setMaxListeners } from "events";
|
|
@@ -6216,8 +6216,6 @@ function createAbortController(maxListeners = DEFAULT_MAX_LISTENERS) {
|
|
|
6216
6216
|
|
|
6217
6217
|
// src/transport/ProcessTransport.ts
|
|
6218
6218
|
import { spawn } from "child_process";
|
|
6219
|
-
import { join } from "path";
|
|
6220
|
-
import { fileURLToPath } from "url";
|
|
6221
6219
|
import { createInterface } from "readline";
|
|
6222
6220
|
|
|
6223
6221
|
// src/utils/fsOperations.ts
|
|
@@ -6340,11 +6338,9 @@ class ProcessTransport {
|
|
|
6340
6338
|
exitListeners = [];
|
|
6341
6339
|
processExitHandler;
|
|
6342
6340
|
abortHandler;
|
|
6343
|
-
isStreaming;
|
|
6344
6341
|
constructor(options) {
|
|
6345
6342
|
this.options = options;
|
|
6346
6343
|
this.abortController = options.abortController || createAbortController();
|
|
6347
|
-
this.isStreaming = typeof options.prompt !== "string";
|
|
6348
6344
|
this.initialize();
|
|
6349
6345
|
}
|
|
6350
6346
|
initialize() {
|
|
@@ -6440,14 +6436,17 @@ class ProcessTransport {
|
|
|
6440
6436
|
if (!env.CLAUDE_CODE_ENTRYPOINT) {
|
|
6441
6437
|
env.CLAUDE_CODE_ENTRYPOINT = "sdk-ts";
|
|
6442
6438
|
}
|
|
6443
|
-
const claudeCodePath = pathToClaudeCodeExecutable || this.getDefaultExecutablePath();
|
|
6444
6439
|
const fs2 = getFsImplementation();
|
|
6445
|
-
if (!fs2.existsSync(
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6440
|
+
if (!fs2.existsSync(pathToClaudeCodeExecutable)) {
|
|
6441
|
+
const errorMessage = isNativeBinary(pathToClaudeCodeExecutable) ? `Claude Code native binary not found at ${pathToClaudeCodeExecutable}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.` : `Claude Code executable not found at ${pathToClaudeCodeExecutable}. Is options.pathToClaudeCodeExecutable set?`;
|
|
6442
|
+
throw new ReferenceError(errorMessage);
|
|
6443
|
+
}
|
|
6444
|
+
const isNative = isNativeBinary(pathToClaudeCodeExecutable);
|
|
6445
|
+
const spawnCommand = isNative ? pathToClaudeCodeExecutable : executable;
|
|
6446
|
+
const spawnArgs = isNative ? args : [...executableArgs, pathToClaudeCodeExecutable, ...args];
|
|
6447
|
+
this.logDebug(isNative ? `Spawning Claude Code native binary: ${pathToClaudeCodeExecutable} ${args.join(" ")}` : `Spawning Claude Code process: ${executable} ${[...executableArgs, pathToClaudeCodeExecutable, ...args].join(" ")}`);
|
|
6449
6448
|
const stderrMode = env.DEBUG || stderr ? "pipe" : "ignore";
|
|
6450
|
-
this.child = spawn(
|
|
6449
|
+
this.child = spawn(spawnCommand, spawnArgs, {
|
|
6451
6450
|
cwd,
|
|
6452
6451
|
stdio: ["pipe", "pipe", stderrMode],
|
|
6453
6452
|
signal: this.abortController.signal,
|
|
@@ -6511,11 +6510,6 @@ class ProcessTransport {
|
|
|
6511
6510
|
}
|
|
6512
6511
|
return;
|
|
6513
6512
|
}
|
|
6514
|
-
getDefaultExecutablePath() {
|
|
6515
|
-
const filename = fileURLToPath(import.meta.url);
|
|
6516
|
-
const dirname = join(filename, "..", "..");
|
|
6517
|
-
return join(dirname, "entrypoints", "cli.js");
|
|
6518
|
-
}
|
|
6519
6513
|
isRunningWithBun() {
|
|
6520
6514
|
return process.versions.bun !== undefined || process.env.BUN_INSTALL !== undefined;
|
|
6521
6515
|
}
|
|
@@ -6666,6 +6660,10 @@ class ProcessTransport {
|
|
|
6666
6660
|
});
|
|
6667
6661
|
}
|
|
6668
6662
|
}
|
|
6663
|
+
function isNativeBinary(executablePath) {
|
|
6664
|
+
const jsExtensions = [".js", ".mjs", ".tsx", ".ts", ".jsx"];
|
|
6665
|
+
return !jsExtensions.some((ext) => executablePath.endsWith(ext));
|
|
6666
|
+
}
|
|
6669
6667
|
|
|
6670
6668
|
// src/utils/stream.ts
|
|
6671
6669
|
class Stream {
|
|
@@ -13997,9 +13995,9 @@ function query({
|
|
|
13997
13995
|
env.CLAUDE_CODE_ENTRYPOINT = "sdk-ts";
|
|
13998
13996
|
}
|
|
13999
13997
|
if (pathToClaudeCodeExecutable === undefined) {
|
|
14000
|
-
const filename =
|
|
14001
|
-
const dirname =
|
|
14002
|
-
pathToClaudeCodeExecutable =
|
|
13998
|
+
const filename = fileURLToPath(import.meta.url);
|
|
13999
|
+
const dirname = join(filename, "..");
|
|
14000
|
+
pathToClaudeCodeExecutable = join(dirname, "cli.js");
|
|
14003
14001
|
}
|
|
14004
14002
|
const allMcpServers = {};
|
|
14005
14003
|
const sdkMcpServers = new Map;
|
package/vendor/claude-code.vsix
CHANGED
|
Binary file
|