@wu529778790/open-im 1.3.2-beta.2 → 1.4.0
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/codex/cli-runner.js +20 -5
- package/dist/config.js +12 -3
- package/package.json +1 -1
package/dist/codex/cli-runner.js
CHANGED
|
@@ -10,6 +10,7 @@ import { dirname, join } from 'node:path';
|
|
|
10
10
|
import { createInterface } from 'node:readline';
|
|
11
11
|
import { createLogger } from '../logger.js';
|
|
12
12
|
const log = createLogger('CodexCli');
|
|
13
|
+
const windowsCodexLaunchCache = new Map();
|
|
13
14
|
function parseCodexEvent(line) {
|
|
14
15
|
const trimmed = line.trim();
|
|
15
16
|
if (!trimmed)
|
|
@@ -81,24 +82,38 @@ function extractCodexJsFromCmdShim(cmdPath) {
|
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
function resolveWindowsCodexLaunch(cliPath, args) {
|
|
85
|
+
if (windowsCodexLaunchCache.has(cliPath)) {
|
|
86
|
+
const cached = windowsCodexLaunchCache.get(cliPath);
|
|
87
|
+
return cached ? { command: cached.command, args: [...cached.args, ...args] } : null;
|
|
88
|
+
}
|
|
84
89
|
try {
|
|
85
|
-
const whereOutput = execFileSync('where', [cliPath], {
|
|
90
|
+
const whereOutput = execFileSync('where', [cliPath], {
|
|
91
|
+
stdio: 'pipe',
|
|
92
|
+
windowsHide: true,
|
|
93
|
+
})
|
|
86
94
|
.toString()
|
|
87
95
|
.split(/\r?\n/)
|
|
88
96
|
.map((line) => line.trim())
|
|
89
97
|
.filter(Boolean);
|
|
90
98
|
const cmdShimPath = whereOutput.find((line) => /\.cmd$/i.test(line)) ?? null;
|
|
91
|
-
if (!cmdShimPath)
|
|
99
|
+
if (!cmdShimPath) {
|
|
100
|
+
windowsCodexLaunchCache.set(cliPath, null);
|
|
92
101
|
return null;
|
|
102
|
+
}
|
|
93
103
|
const codexJsPath = extractCodexJsFromCmdShim(cmdShimPath);
|
|
94
|
-
if (!codexJsPath)
|
|
104
|
+
if (!codexJsPath) {
|
|
105
|
+
windowsCodexLaunchCache.set(cliPath, null);
|
|
95
106
|
return null;
|
|
96
|
-
|
|
107
|
+
}
|
|
108
|
+
const resolved = {
|
|
97
109
|
command: process.execPath,
|
|
98
|
-
args: [codexJsPath
|
|
110
|
+
args: [codexJsPath],
|
|
99
111
|
};
|
|
112
|
+
windowsCodexLaunchCache.set(cliPath, resolved);
|
|
113
|
+
return { command: resolved.command, args: [...resolved.args, ...args] };
|
|
100
114
|
}
|
|
101
115
|
catch {
|
|
116
|
+
windowsCodexLaunchCache.set(cliPath, null);
|
|
102
117
|
return null;
|
|
103
118
|
}
|
|
104
119
|
}
|
package/dist/config.js
CHANGED
|
@@ -390,7 +390,10 @@ export function loadConfig() {
|
|
|
390
390
|
else {
|
|
391
391
|
const checkCommand = process.platform === 'win32' ? 'where' : 'which';
|
|
392
392
|
try {
|
|
393
|
-
execFileSync(checkCommand, [codexCliPath], {
|
|
393
|
+
execFileSync(checkCommand, [codexCliPath], {
|
|
394
|
+
stdio: 'pipe',
|
|
395
|
+
windowsHide: process.platform === 'win32',
|
|
396
|
+
});
|
|
394
397
|
}
|
|
395
398
|
catch {
|
|
396
399
|
const installGuide = [
|
|
@@ -429,7 +432,10 @@ export function loadConfig() {
|
|
|
429
432
|
else {
|
|
430
433
|
const checkCommand = process.platform === 'win32' ? 'where' : 'which';
|
|
431
434
|
try {
|
|
432
|
-
execFileSync(checkCommand, [cursorCliPath], {
|
|
435
|
+
execFileSync(checkCommand, [cursorCliPath], {
|
|
436
|
+
stdio: 'pipe',
|
|
437
|
+
windowsHide: process.platform === 'win32',
|
|
438
|
+
});
|
|
433
439
|
}
|
|
434
440
|
catch {
|
|
435
441
|
const installGuide = [
|
|
@@ -469,7 +475,10 @@ export function loadConfig() {
|
|
|
469
475
|
// 检查命令是否存在(Windows 用 where,Unix 用 which)
|
|
470
476
|
const checkCommand = process.platform === 'win32' ? 'where' : 'which';
|
|
471
477
|
try {
|
|
472
|
-
execFileSync(checkCommand, [claudeCliPath], {
|
|
478
|
+
execFileSync(checkCommand, [claudeCliPath], {
|
|
479
|
+
stdio: 'pipe',
|
|
480
|
+
windowsHide: process.platform === 'win32',
|
|
481
|
+
});
|
|
473
482
|
}
|
|
474
483
|
catch {
|
|
475
484
|
const installGuide = [
|