add patch for sdk to run cli in electron

This commit is contained in:
beyondkmp 2025-09-18 14:11:05 +08:00
parent f9b49ffde6
commit 352c23180a
3 changed files with 50 additions and 3 deletions

View File

@ -0,0 +1,18 @@
diff --git a/sdk.mjs b/sdk.mjs
index e2dbafb4e2faa1bf2b6b02f0009a2b9bbf57c757..3f07a1d5c2949a246fe5414e69ab45942fa605a2 100644
--- a/sdk.mjs
+++ b/sdk.mjs
@@ -6355,11 +6355,11 @@ class ProcessTransport {
prompt,
additionalDirectories = [],
cwd,
- executable = isRunningWithBun() ? "bun" : "node",
+ executable = process.execPath,
executableArgs = [],
extraArgs = {},
pathToClaudeCodeExecutable,
- env = { ...process.env },
+ env = { ...process.env, ELECTRON_RUN_AS_NODE: '1' },
stderr,
customSystemPrompt,
appendSystemPrompt,

View File

@ -79,7 +79,7 @@
"release:aicore": "yarn workspace @cherrystudio/ai-core version patch --immediate && yarn workspace @cherrystudio/ai-core npm publish --access public"
},
"dependencies": {
"@anthropic-ai/claude-code": "^1.0.113",
"@anthropic-ai/claude-code": "patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch",
"@libsql/client": "0.14.0",
"@libsql/win32-x64-msvc": "^0.4.7",
"@napi-rs/system-ocr": "patch:@napi-rs/system-ocr@npm%3A1.0.2#~/.yarn/patches/@napi-rs-system-ocr-npm-1.0.2-59e7a78e8b.patch",

View File

@ -385,7 +385,7 @@ __metadata:
languageName: node
linkType: hard
"@anthropic-ai/claude-code@npm:^1.0.113":
"@anthropic-ai/claude-code@npm:1.0.118":
version: 1.0.118
resolution: "@anthropic-ai/claude-code@npm:1.0.118"
dependencies:
@ -414,6 +414,35 @@ __metadata:
languageName: node
linkType: hard
"@anthropic-ai/claude-code@patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch":
version: 1.0.118
resolution: "@anthropic-ai/claude-code@patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch::version=1.0.118&hash=d3554c"
dependencies:
"@img/sharp-darwin-arm64": "npm:^0.33.5"
"@img/sharp-darwin-x64": "npm:^0.33.5"
"@img/sharp-linux-arm": "npm:^0.33.5"
"@img/sharp-linux-arm64": "npm:^0.33.5"
"@img/sharp-linux-x64": "npm:^0.33.5"
"@img/sharp-win32-x64": "npm:^0.33.5"
dependenciesMeta:
"@img/sharp-darwin-arm64":
optional: true
"@img/sharp-darwin-x64":
optional: true
"@img/sharp-linux-arm":
optional: true
"@img/sharp-linux-arm64":
optional: true
"@img/sharp-linux-x64":
optional: true
"@img/sharp-win32-x64":
optional: true
bin:
claude: cli.js
checksum: 10c0/3d230f6e785e5c4fdcca30dc134ecaab09d1de11f020183b04bbd6b2cbc97593d2d9224a87a47546718d1795bd159be395a9af3f35ff3652e4b87804741223a1
languageName: node
linkType: hard
"@anthropic-ai/sdk@npm:>=0.50.3 <1":
version: 0.56.0
resolution: "@anthropic-ai/sdk@npm:0.56.0"
@ -14162,7 +14191,7 @@ __metadata:
"@ai-sdk/mistral": "npm:^2.0.14"
"@ai-sdk/perplexity": "npm:^2.0.9"
"@ant-design/v5-patch-for-react-19": "npm:^1.0.3"
"@anthropic-ai/claude-code": "npm:^1.0.113"
"@anthropic-ai/claude-code": "patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch"
"@anthropic-ai/sdk": "npm:^0.41.0"
"@anthropic-ai/vertex-sdk": "patch:@anthropic-ai/vertex-sdk@npm%3A0.11.4#~/.yarn/patches/@anthropic-ai-vertex-sdk-npm-0.11.4-c19cb41edb.patch"
"@aws-sdk/client-bedrock": "npm:^3.840.0"