@wu529778790/open-im 1.10.9-beta.0 → 1.10.9-beta.1
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/dist/config/file-io.js +34 -5
- package/package.json +1 -1
package/dist/config/file-io.js
CHANGED
|
@@ -283,20 +283,49 @@ export function hasCodeBuddyAuthIndicators() {
|
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
export function getClaudeSdkRuntimeIssue() {
|
|
286
|
-
let
|
|
286
|
+
let executablePath;
|
|
287
|
+
let executableArgs;
|
|
287
288
|
try {
|
|
288
289
|
const sdkEntry = require.resolve('@anthropic-ai/claude-agent-sdk');
|
|
289
290
|
const sdkDir = dirname(sdkEntry);
|
|
290
|
-
|
|
291
|
-
if (
|
|
292
|
-
|
|
291
|
+
const legacyCliPath = join(sdkDir, 'cli.js');
|
|
292
|
+
if (existsSync(legacyCliPath)) {
|
|
293
|
+
executablePath = process.execPath;
|
|
294
|
+
executableArgs = [legacyCliPath, '--version'];
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
const binaryExt = process.platform === 'win32' ? '.exe' : '';
|
|
298
|
+
const packageNames = process.platform === 'linux'
|
|
299
|
+
? [
|
|
300
|
+
`@anthropic-ai/claude-agent-sdk-linux-${process.arch}-musl`,
|
|
301
|
+
`@anthropic-ai/claude-agent-sdk-linux-${process.arch}`,
|
|
302
|
+
]
|
|
303
|
+
: [`@anthropic-ai/claude-agent-sdk-${process.platform}-${process.arch}`];
|
|
304
|
+
let nativeBinaryPath = null;
|
|
305
|
+
for (const packageName of packageNames) {
|
|
306
|
+
try {
|
|
307
|
+
const candidate = require.resolve(`${packageName}/claude${binaryExt}`);
|
|
308
|
+
if (existsSync(candidate)) {
|
|
309
|
+
nativeBinaryPath = candidate;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
// Try the next package name.
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (!nativeBinaryPath) {
|
|
318
|
+
return `Claude SDK 安装不完整:未找到 ${legacyCliPath},也未找到适用于 ${process.platform}-${process.arch} 的原生 Claude CLI。请重新安装依赖后再启动。`;
|
|
319
|
+
}
|
|
320
|
+
executablePath = nativeBinaryPath;
|
|
321
|
+
executableArgs = ['--version'];
|
|
293
322
|
}
|
|
294
323
|
}
|
|
295
324
|
catch (error) {
|
|
296
325
|
return `未找到 @anthropic-ai/claude-agent-sdk:${error instanceof Error ? error.message : String(error)}`;
|
|
297
326
|
}
|
|
298
327
|
try {
|
|
299
|
-
execFileSync(
|
|
328
|
+
execFileSync(executablePath, executableArgs, {
|
|
300
329
|
stdio: 'pipe',
|
|
301
330
|
env: {
|
|
302
331
|
...process.env,
|