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:
Generated
+316
-771
File diff suppressed because it is too large
Load Diff
@@ -53,10 +53,22 @@ function pruneOnnxRuntime(nodeModules, platform, arch) {
|
|||||||
function pruneClaudeAgentSdk(nodeModules, platform, arch) {
|
function pruneClaudeAgentSdk(nodeModules, platform, arch) {
|
||||||
const vendorRoot = path.join(nodeModules, "@anthropic-ai", "claude-agent-sdk", "vendor");
|
const vendorRoot = path.join(nodeModules, "@anthropic-ai", "claude-agent-sdk", "vendor");
|
||||||
const keepName = RIPGREP_PLATFORM_DIR[platform]?.[arch];
|
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]));
|
// SDK ≥0.2.113 ships per-platform Claude Code binaries via optionalDependencies
|
||||||
pruneChildrenExcept(path.join(vendorRoot, "tree-sitter-bash"), new Set([keepName]));
|
// (~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) {
|
function pruneNodePty(nodeModules, platform, arch) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@agentclientprotocol/sdk": "^0.17.1",
|
"@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/highlight": "0.1.70-beta.1",
|
||||||
"@getpaseo/relay": "0.1.70-beta.1",
|
"@getpaseo/relay": "0.1.70-beta.1",
|
||||||
"@isaacs/ttlcache": "^2.1.4",
|
"@isaacs/ttlcache": "^2.1.4",
|
||||||
|
|||||||
@@ -1329,9 +1329,7 @@ export class ClaudeAgentClient implements AgentClient {
|
|||||||
if (command?.mode === "replace") {
|
if (command?.mode === "replace") {
|
||||||
return await isCommandAvailable(command.argv[0]);
|
return await isCommandAvailable(command.argv[0]);
|
||||||
}
|
}
|
||||||
// Default mode uses @anthropic-ai/claude-agent-sdk's bundled cli.js run
|
return await isCommandAvailable("claude");
|
||||||
// via process.execPath. No external `claude` binary is required.
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDiagnostic(): Promise<{ diagnostic: string }> {
|
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(
|
async function resolveClaudeVersion(
|
||||||
runtimeSettings?: ProviderRuntimeSettings,
|
runtimeSettings?: ProviderRuntimeSettings,
|
||||||
): Promise<string | null> {
|
): Promise<string | null> {
|
||||||
@@ -2256,11 +2264,6 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
? this.config.thinkingOptionId
|
? this.config.thinkingOptionId
|
||||||
: undefined;
|
: undefined;
|
||||||
if (thinkingOptionId && isClaudeThinkingEffort(thinkingOptionId)) {
|
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: { type: "adaptive" }, effort: thinkingOptionId };
|
||||||
}
|
}
|
||||||
return { thinking: undefined, effort: undefined };
|
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(
|
this.logger.debug(
|
||||||
{
|
{
|
||||||
claudeBinary,
|
claudeBinary,
|
||||||
@@ -2311,7 +2314,7 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
allowDangerouslySkipPermissions: true,
|
allowDangerouslySkipPermissions: true,
|
||||||
agents: this.defaults?.agents,
|
agents: this.defaults?.agents,
|
||||||
canUseTool: this.handlePermissionRequest,
|
canUseTool: this.handlePermissionRequest,
|
||||||
...(claudeBinary ? { pathToClaudeCodeExecutable: claudeBinary } : {}),
|
pathToClaudeCodeExecutable: claudeBinary,
|
||||||
// Use Claude Code preset system prompt and load CLAUDE.md files
|
// Use Claude Code preset system prompt and load CLAUDE.md files
|
||||||
// Append provider-agnostic system prompt and orchestrator instructions for agents.
|
// Append provider-agnostic system prompt and orchestrator instructions for agents.
|
||||||
systemPrompt: {
|
systemPrompt: {
|
||||||
|
|||||||
Reference in New Issue
Block a user