upgrade claude-agent-sdk to 0.2.133, drop bundled binary

Bumps @anthropic-ai/claude-agent-sdk from ^0.2.71 to ^0.2.133. The new SDK
hardens handleControlRequest against post-close transport writes (v0.2.94+),
which fixes the unhandledRejection that crashed the daemon when the SDK fired
a fire-and-forget control_request after we'd torn down the transport.

The SDK now ships per-platform Claude Code binaries via optionalDependencies
(~210 MB each). Paseo requires user-installed `claude` on PATH instead — same
posture as Codex/OpenCode:

- after-pack now prunes @anthropic-ai/claude-agent-sdk-* from the Electron
  bundle, matching the existing per-platform pruning for onnxruntime, sharp,
  and node-pty.
- claude-agent.ts gains resolveClaudeBinary() (mirrors resolveCodexBinary):
  throws with install instructions when `claude` is missing, instead of
  silently falling back to the bundled binary.
- isAvailable() now checks isCommandAvailable("claude") instead of always
  returning true.
This commit is contained in:
Mohamed Boudra
2026-05-08 15:07:40 +07:00
parent c97c000d9c
commit fb0fbb79f6
4 changed files with 345 additions and 785 deletions

1087
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -53,10 +53,22 @@ function pruneOnnxRuntime(nodeModules, platform, arch) {
function pruneClaudeAgentSdk(nodeModules, platform, arch) {
const vendorRoot = path.join(nodeModules, "@anthropic-ai", "claude-agent-sdk", "vendor");
const keepName = RIPGREP_PLATFORM_DIR[platform]?.[arch];
if (!keepName) return;
if (keepName) {
pruneChildrenExcept(path.join(vendorRoot, "ripgrep"), new Set(["COPYING", keepName]));
pruneChildrenExcept(path.join(vendorRoot, "tree-sitter-bash"), new Set([keepName]));
}
pruneChildrenExcept(path.join(vendorRoot, "ripgrep"), new Set(["COPYING", keepName]));
pruneChildrenExcept(path.join(vendorRoot, "tree-sitter-bash"), new Set([keepName]));
// SDK ≥0.2.113 ships per-platform Claude Code binaries via optionalDependencies
// (~210 MB each). Paseo requires user-installed `claude` on PATH, matching how
// Codex/OpenCode are integrated, so drop every bundled copy.
const anthropicDir = path.join(nodeModules, "@anthropic-ai");
if (fs.existsSync(anthropicDir)) {
for (const entry of fs.readdirSync(anthropicDir)) {
if (entry.startsWith("claude-agent-sdk-")) {
rmSafe(path.join(anthropicDir, entry));
}
}
}
}
function pruneNodePty(nodeModules, platform, arch) {

View File

@@ -57,7 +57,7 @@
},
"dependencies": {
"@agentclientprotocol/sdk": "^0.17.1",
"@anthropic-ai/claude-agent-sdk": "^0.2.11",
"@anthropic-ai/claude-agent-sdk": "^0.2.133",
"@getpaseo/highlight": "0.1.70-beta.1",
"@getpaseo/relay": "0.1.70-beta.1",
"@isaacs/ttlcache": "^2.1.4",

View File

@@ -1329,9 +1329,7 @@ export class ClaudeAgentClient implements AgentClient {
if (command?.mode === "replace") {
return await isCommandAvailable(command.argv[0]);
}
// Default mode uses @anthropic-ai/claude-agent-sdk's bundled cli.js run
// via process.execPath. No external `claude` binary is required.
return true;
return await isCommandAvailable("claude");
}
async getDiagnostic(): Promise<{ diagnostic: string }> {
@@ -1383,6 +1381,16 @@ export class ClaudeAgentClient implements AgentClient {
}
}
async function resolveClaudeBinary(): Promise<string> {
const found = await findExecutable("claude");
if (found) {
return found;
}
throw new Error(
"Claude binary not found. Install Claude Code (https://github.com/anthropics/claude-code) and ensure it is available in your shell PATH.",
);
}
async function resolveClaudeVersion(
runtimeSettings?: ProviderRuntimeSettings,
): Promise<string | null> {
@@ -2256,11 +2264,6 @@ class ClaudeAgentSession implements AgentSession {
? this.config.thinkingOptionId
: undefined;
if (thinkingOptionId && isClaudeThinkingEffort(thinkingOptionId)) {
if (thinkingOptionId === "xhigh") {
// "xhigh" is accepted by Claude Opus 4.7 but not yet in the SDK type definitions
// @ts-expect-error -- SDK 0.2.71 effort type doesn't include "xhigh" yet
return { thinking: { type: "adaptive" }, effort: thinkingOptionId };
}
return { thinking: { type: "adaptive" }, effort: thinkingOptionId };
}
return { thinking: undefined, effort: undefined };
@@ -2290,7 +2293,7 @@ class ClaudeAgentSession implements AgentSession {
],
});
const claudeBinary = await findExecutable("claude");
const claudeBinary = await resolveClaudeBinary();
this.logger.debug(
{
claudeBinary,
@@ -2311,7 +2314,7 @@ class ClaudeAgentSession implements AgentSession {
allowDangerouslySkipPermissions: true,
agents: this.defaults?.agents,
canUseTool: this.handlePermissionRequest,
...(claudeBinary ? { pathToClaudeCodeExecutable: claudeBinary } : {}),
pathToClaudeCodeExecutable: claudeBinary,
// Use Claude Code preset system prompt and load CLAUDE.md files
// Append provider-agnostic system prompt and orchestrator instructions for agents.
systemPrompt: {