claude-opencode-viewer 2.6.28 → 2.6.29

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-opencode-viewer",
3
- "version": "2.6.28",
3
+ "version": "2.6.29",
4
4
  "description": "A unified terminal viewer for Claude Code and OpenCode with seamless switching",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -770,7 +770,7 @@ let hasEverConnected = false;
770
770
  function startNoClientTimer() {
771
771
  if (noClientTimer) return;
772
772
  if (wss && wss.clients.size > 0) return;
773
- const timeout = hasEverConnected ? 30000 : 180000;
773
+ const timeout = hasEverConnected ? 10000 : 180000;
774
774
  noClientTimer = setTimeout(() => {
775
775
  if (!wss || wss.clients.size === 0) {
776
776
  LOG(`[auto-exit] ${timeout / 1000}秒无客户端连接,自动退出`);
@@ -1089,6 +1089,18 @@ function startServer() {
1089
1089
  LOG('\n按 Ctrl+C 停止服务\n');
1090
1090
  }
1091
1091
 
1092
+ // 清理上次 cov 崩溃残留的孤儿进程(PPID=1 的 opencode/claude)
1093
+ try {
1094
+ const orphans = execSync(
1095
+ "ps -eo pid,ppid,comm 2>/dev/null | awk '$2==1 && (/opencode/||/claude/) {print $1}'",
1096
+ { encoding: 'utf-8', timeout: 5000 }
1097
+ ).trim().split(/\s+/).filter(Boolean).map(Number);
1098
+ for (const pid of orphans) {
1099
+ try { process.kill(pid, 'SIGTERM'); } catch {}
1100
+ }
1101
+ if (orphans.length > 0) LOG(`[startup] 清理孤儿进程: ${orphans.join(', ')}`);
1102
+ } catch {}
1103
+
1092
1104
  // 尝试恢复最近的会话,如果没有则新建
1093
1105
  let lastSessionId = null;
1094
1106
  try {