@wu529778790/open-im 1.10.9-beta.0 → 1.10.9-beta.2
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/cli.js +9 -2
- package/dist/config/file-io.js +34 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -97,21 +97,28 @@ async function cmdStop() {
|
|
|
97
97
|
}
|
|
98
98
|
async function cmdRestart() {
|
|
99
99
|
const status = getManagerStatus();
|
|
100
|
+
let restartedExistingInstance = false;
|
|
100
101
|
if (status.pid) {
|
|
101
102
|
await stopBackgroundService();
|
|
102
103
|
const stopped = await stopManagerProcess();
|
|
103
104
|
console.log("\nopen-im stopped.");
|
|
104
105
|
console.log(` pid: ${stopped.pid}`);
|
|
106
|
+
restartedExistingInstance = true;
|
|
105
107
|
}
|
|
106
108
|
else {
|
|
107
|
-
console.log("
|
|
109
|
+
console.log("\nopen-im is not running in the background.");
|
|
108
110
|
}
|
|
109
111
|
if (!(await ensureConfigured("start"))) {
|
|
110
112
|
process.exit(1);
|
|
111
113
|
}
|
|
112
114
|
await checkAndUpdate();
|
|
113
115
|
const child = await startManagerProcess(process.cwd());
|
|
114
|
-
|
|
116
|
+
if (restartedExistingInstance) {
|
|
117
|
+
console.log("\nopen-im restarted in the background.");
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
console.log("\nopen-im started in the background.");
|
|
121
|
+
}
|
|
115
122
|
console.log(` pid: ${child.pid}`);
|
|
116
123
|
logWebDashboardAndApi();
|
|
117
124
|
process.exit(0);
|
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,
|