coding-tool-x 3.4.2 → 3.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-tool-x",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
4
4
  "description": "Vibe Coding 增强工作助手 - 智能会话管理、动态渠道切换、全局搜索、实时监控",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -83,7 +83,7 @@ function shouldTreatPortOwnershipAsReady(ownsPort) {
83
83
  return ownsPort === true || ownsPort === null;
84
84
  }
85
85
 
86
- async function waitForServiceReady(port, timeoutMs = 6000, intervalMs = 300) {
86
+ async function waitForServiceReady(port, timeoutMs = 15000, intervalMs = 500) {
87
87
  const startAt = Date.now();
88
88
  let lastProcess = null;
89
89
  let stablePassCount = 0;
@@ -216,7 +216,11 @@ class BaseChannelService {
216
216
  normalized.enabled = !!normalized.enabled;
217
217
  }
218
218
  normalized.weight = normalizeNumber(normalized.weight, 1, 100);
219
- normalized.maxConcurrency = normalizeNumber(normalized.maxConcurrency, 0);
219
+ // maxConcurrency: null 表示不限制并发;只有用户显式设置正整数时才生效
220
+ const rawConcurrency = normalized.maxConcurrency;
221
+ normalized.maxConcurrency = (rawConcurrency !== null && rawConcurrency !== undefined && Number(rawConcurrency) > 0)
222
+ ? Number(rawConcurrency)
223
+ : null;
220
224
  normalized.gatewaySourceType = normalizeGatewaySourceType(
221
225
  normalized.gatewaySourceType,
222
226
  this.defaultGatewaySource
@@ -137,14 +137,24 @@ function findProcessByPort(port) {
137
137
  const isWindows = isWindowsLikeRuntime();
138
138
  if (isWindows) {
139
139
  try {
140
- // Windows: 直接解析 netstat 输出,避免依赖 findstr/lsof
141
- const result = execSync('netstat -ano', { encoding: 'utf-8', windowsHide: true });
140
+ // Windows: 优先使用 findstr 过滤,避免解析全量 netstat 输出(全量输出在连接数多时极慢)
141
+ const result = execSync(`netstat -ano | findstr ":${port} "`, { encoding: 'utf-8', windowsHide: true });
142
142
  return parsePidsFromNetstatOutput(result, port);
143
143
  } catch (e) {
144
- if (isMissingCommandError(e)) {
145
- rememberPortToolIssue(createPortToolIssue('netstat', 'lookup', true));
144
+ // findstr 未匹配到任何行时 exit code = 1,属于正常情况
145
+ if (e.status === 1) {
146
+ return [];
147
+ }
148
+ // findstr 不可用时回退到全量解析
149
+ try {
150
+ const result = execSync('netstat -ano', { encoding: 'utf-8', windowsHide: true });
151
+ return parsePidsFromNetstatOutput(result, port);
152
+ } catch (e2) {
153
+ if (isMissingCommandError(e2)) {
154
+ rememberPortToolIssue(createPortToolIssue('netstat', 'lookup', true));
155
+ }
156
+ return [];
146
157
  }
147
- return [];
148
158
  }
149
159
  }
150
160