openclawsetup 2.8.7 → 2.8.9
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/bin/cli.mjs +14 -10
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -83,7 +83,7 @@ const log = {
|
|
|
83
83
|
|
|
84
84
|
const DEFAULT_GATEWAY_PORT = 18789;
|
|
85
85
|
const STRONG_FIX_MAX_PASSES = 3;
|
|
86
|
-
const STATUS_CMD_TIMEOUT_MS = platform() === 'win32' ?
|
|
86
|
+
const STATUS_CMD_TIMEOUT_MS = platform() === 'win32' ? 15000 : 10000;
|
|
87
87
|
const PORT_CHECK_TIMEOUT_MS = platform() === 'win32' ? 6000 : 4000;
|
|
88
88
|
const MODEL_CHAT_TIMEOUT_MS = platform() === 'win32' ? 25000 : 18000;
|
|
89
89
|
const STRONG_PORT_CANDIDATES = [
|
|
@@ -2233,11 +2233,6 @@ async function runHealthCheck(cliName, autoFix = false, strongMode = false) {
|
|
|
2233
2233
|
const canUsePortFallback = statusState === 'unknown' || statusProbe.timedOut;
|
|
2234
2234
|
if (statusState === 'running' || (canUsePortFallback && statusPortListening)) {
|
|
2235
2235
|
log.success('Gateway 进程正在运行');
|
|
2236
|
-
if (statusProbe.timedOut) {
|
|
2237
|
-
log.hint('状态命令超时,已按端口监听判定为运行中');
|
|
2238
|
-
} else if (canUsePortFallback && statusPortListening) {
|
|
2239
|
-
log.hint('状态命令返回非运行,但端口可访问(兼容判定)');
|
|
2240
|
-
}
|
|
2241
2236
|
} else {
|
|
2242
2237
|
const issue = summarizeIssue(
|
|
2243
2238
|
'error',
|
|
@@ -2549,7 +2544,16 @@ function testModelChat(cliName, timeoutMs = MODEL_CHAT_TIMEOUT_MS) {
|
|
|
2549
2544
|
const message = parsed?.result?.payloads?.[0]?.text || '';
|
|
2550
2545
|
const provider = parsed?.result?.meta?.agentMeta?.provider || '';
|
|
2551
2546
|
const modelId = parsed?.result?.meta?.agentMeta?.model || '';
|
|
2552
|
-
|
|
2547
|
+
|
|
2548
|
+
// 检查回复内容是否实际上是错误信息
|
|
2549
|
+
const msgLower = message.toLowerCase();
|
|
2550
|
+
if (msgLower.includes('401') && (msgLower.includes('invalid api key') || msgLower.includes('unauthorized'))) {
|
|
2551
|
+
resolve({ success: false, error: 'API Key 无效 (401)' });
|
|
2552
|
+
} else if (msgLower.includes('403') && (msgLower.includes('forbidden') || msgLower.includes('access denied'))) {
|
|
2553
|
+
resolve({ success: false, error: 'API 访问被拒绝 (403)' });
|
|
2554
|
+
} else if (/^http\s+\d{3}:/i.test(message.trim())) {
|
|
2555
|
+
resolve({ success: false, error: message.substring(0, 200) });
|
|
2556
|
+
} else if (message || (provider && modelId)) {
|
|
2553
2557
|
resolve({ success: true, message, provider, model: modelId });
|
|
2554
2558
|
} else {
|
|
2555
2559
|
resolve({ success: false, error: '模型未返回内容' });
|
|
@@ -2602,7 +2606,7 @@ async function showStatusInfo(cliName) {
|
|
|
2602
2606
|
const portResult = getPortCheckOutput(port, PORT_CHECK_TIMEOUT_MS);
|
|
2603
2607
|
const portListening = Boolean(portResult.ok && portResult.output);
|
|
2604
2608
|
|
|
2605
|
-
if (statusTimedOut) {
|
|
2609
|
+
if (statusTimedOut && !portListening) {
|
|
2606
2610
|
console.log(colors.yellow(' ⚠ 状态命令超时,已自动切换端口探测模式'));
|
|
2607
2611
|
}
|
|
2608
2612
|
if (portResolved.source === 'runtime' && Number(config?.port) !== Number(port)) {
|
|
@@ -2612,8 +2616,8 @@ async function showStatusInfo(cliName) {
|
|
|
2612
2616
|
if (statusState === 'running') {
|
|
2613
2617
|
console.log(colors.green(' ✓ Gateway 服务正在运行'));
|
|
2614
2618
|
} else if (portListening) {
|
|
2615
|
-
|
|
2616
|
-
console.log(colors.
|
|
2619
|
+
// 端口在监听 = Gateway 在运行,状态命令超时/不准确不影响判断
|
|
2620
|
+
console.log(colors.green(' ✓ Gateway 服务正在运行'));
|
|
2617
2621
|
} else {
|
|
2618
2622
|
console.log(colors.red(' ✗ Gateway 服务未运行'));
|
|
2619
2623
|
if (statusOutput) {
|