claude-opencode-viewer 2.6.57 → 2.6.58
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/index-pc.html +2 -3
- package/package.json +1 -1
- package/server.js +7 -31
package/index-pc.html
CHANGED
|
@@ -984,7 +984,6 @@
|
|
|
984
984
|
<option value="" disabled selected hidden>--</option>
|
|
985
985
|
<option value="opencode">OpenCode</option>
|
|
986
986
|
<option value="claude">Claude</option>
|
|
987
|
-
<option value="qoder">Qoder</option>
|
|
988
987
|
<option value="shell">Shell</option>
|
|
989
988
|
</select>
|
|
990
989
|
</div>
|
|
@@ -1705,7 +1704,7 @@
|
|
|
1705
1704
|
currentMode = mode;
|
|
1706
1705
|
modeSelect.value = mode;
|
|
1707
1706
|
document.getElementById('mode-label').textContent = '';
|
|
1708
|
-
var label = mode === 'claude' ? 'Claude' : mode === 'shell' ? 'Shell' :
|
|
1707
|
+
var label = mode === 'claude' ? 'Claude' : mode === 'shell' ? 'Shell' : 'OpenCode';
|
|
1709
1708
|
var initOv = document.getElementById('init-overlay');
|
|
1710
1709
|
initOv.textContent = '正在启动 ' + label + (sessionId ? '(恢复会话)' : '');
|
|
1711
1710
|
initOv.classList.add('visible');
|
|
@@ -1811,7 +1810,7 @@
|
|
|
1811
1810
|
document.getElementById('mode-label').textContent = '';
|
|
1812
1811
|
}
|
|
1813
1812
|
if (msg.running) {
|
|
1814
|
-
var mLabel = msg.mode === 'claude' ? 'Claude' : msg.mode === '
|
|
1813
|
+
var mLabel = msg.mode === 'claude' ? 'Claude' : msg.mode === 'shell' ? 'Shell' : 'OpenCode';
|
|
1815
1814
|
var initOv = document.getElementById('init-overlay');
|
|
1816
1815
|
initOv.textContent = '正在启动 ' + mLabel + '...';
|
|
1817
1816
|
initOv.classList.add('visible');
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -91,7 +91,6 @@ let ptyModule = null;
|
|
|
91
91
|
let claudeProcess = null;
|
|
92
92
|
let opencodeProcess = null;
|
|
93
93
|
let shellProcess = null;
|
|
94
|
-
let qoderProcess = null;
|
|
95
94
|
let currentProcess = null;
|
|
96
95
|
let outputBuffer = '';
|
|
97
96
|
const dataListeners = [];
|
|
@@ -249,10 +248,6 @@ async function spawnProcess(mode, sessionId = null) {
|
|
|
249
248
|
command = process.env.SHELL || (existsSync('/bin/zsh') ? '/bin/zsh' : '/bin/bash');
|
|
250
249
|
args = ['-l', '-i']; // 登录 + 交互模式,加载 PATH/alias 并确保 complete 等命令可用
|
|
251
250
|
LOG(`[shell] 启动 shell: ${command} ${args.join(' ')}`);
|
|
252
|
-
} else if (mode === 'qoder') {
|
|
253
|
-
command = findCommand('qodercli');
|
|
254
|
-
args = [];
|
|
255
|
-
LOG(`[qoder] 启动 qodercli: ${command}`);
|
|
256
251
|
} else {
|
|
257
252
|
const t2 = Date.now();
|
|
258
253
|
command = findCommand('opencode');
|
|
@@ -350,9 +345,6 @@ async function spawnProcess(mode, sessionId = null) {
|
|
|
350
345
|
if (shellProcess === proc) {
|
|
351
346
|
shellProcess = null;
|
|
352
347
|
}
|
|
353
|
-
if (qoderProcess === proc) {
|
|
354
|
-
qoderProcess = null;
|
|
355
|
-
}
|
|
356
348
|
// 已被替换的旧进程或切换中的进程,不通知前端
|
|
357
349
|
if (isSwitching || currentProcess !== null) return;
|
|
358
350
|
exitListeners.forEach(cb => cb(exitCode || 0));
|
|
@@ -375,14 +367,6 @@ async function spawnProcess(mode, sessionId = null) {
|
|
|
375
367
|
} catch {}
|
|
376
368
|
}
|
|
377
369
|
shellProcess = proc;
|
|
378
|
-
} else if (mode === 'qoder') {
|
|
379
|
-
if (qoderProcess && qoderProcess !== proc && qoderProcess.pid) {
|
|
380
|
-
try {
|
|
381
|
-
LOG(`[spawnProcess] 清理旧 qoder 进程 PID: ${qoderProcess.pid}`);
|
|
382
|
-
killProcessTree(qoderProcess);
|
|
383
|
-
} catch {}
|
|
384
|
-
}
|
|
385
|
-
qoderProcess = proc;
|
|
386
370
|
} else {
|
|
387
371
|
if (opencodeProcess && opencodeProcess !== proc && opencodeProcess.pid) {
|
|
388
372
|
try {
|
|
@@ -403,7 +387,7 @@ async function spawnProcess(mode, sessionId = null) {
|
|
|
403
387
|
}
|
|
404
388
|
|
|
405
389
|
currentProcess = proc;
|
|
406
|
-
const modeLabel = mode === 'claude' ? 'Claude Code' : mode === 'shell' ? 'Shell' :
|
|
390
|
+
const modeLabel = mode === 'claude' ? 'Claude Code' : mode === 'shell' ? 'Shell' : 'OpenCode';
|
|
407
391
|
LOG(`[claude-opencode-viewer] ${modeLabel} 已启动 (PID: ${proc.pid})`);
|
|
408
392
|
return proc;
|
|
409
393
|
}
|
|
@@ -443,14 +427,6 @@ async function switchMode(newMode) {
|
|
|
443
427
|
LOG('[switchMode] 杀死 shell 进程失败:', e.message);
|
|
444
428
|
}
|
|
445
429
|
shellProcess = null;
|
|
446
|
-
} else if (currentMode === 'qoder' && qoderProcess) {
|
|
447
|
-
try {
|
|
448
|
-
LOG(`[switchMode] 杀死 qoder 进程 PID: ${qoderProcess.pid}`);
|
|
449
|
-
killProcessTree(qoderProcess);
|
|
450
|
-
} catch (e) {
|
|
451
|
-
LOG('[switchMode] 杀死 qoder 进程失败:', e.message);
|
|
452
|
-
}
|
|
453
|
-
qoderProcess = null;
|
|
454
430
|
}
|
|
455
431
|
currentProcess = null;
|
|
456
432
|
|
|
@@ -489,7 +465,7 @@ function resizePty(cols, rows) {
|
|
|
489
465
|
lastPtyCols = cols;
|
|
490
466
|
lastPtyRows = rows;
|
|
491
467
|
if (sameSize) return;
|
|
492
|
-
[claudeProcess, opencodeProcess, shellProcess
|
|
468
|
+
[claudeProcess, opencodeProcess, shellProcess].forEach(proc => {
|
|
493
469
|
if (proc) {
|
|
494
470
|
try {
|
|
495
471
|
// 先设不同尺寸再设目标尺寸,保证即使进程已是该尺寸也能触发 SIGWINCH
|
|
@@ -1547,13 +1523,13 @@ function startServer() {
|
|
|
1547
1523
|
cleanupOrphanProcesses();
|
|
1548
1524
|
|
|
1549
1525
|
if (INIT_SHELL) {
|
|
1550
|
-
// PC端默认进入
|
|
1551
|
-
currentMode = '
|
|
1526
|
+
// PC端默认进入 Shell 模式
|
|
1527
|
+
currentMode = 'shell';
|
|
1552
1528
|
try {
|
|
1553
|
-
await spawnProcess('
|
|
1554
|
-
LOG('[startup]
|
|
1529
|
+
await spawnProcess('shell');
|
|
1530
|
+
LOG('[startup] Shell 已启动');
|
|
1555
1531
|
} catch (e) {
|
|
1556
|
-
LOG('[startup]
|
|
1532
|
+
LOG('[startup] Shell 启动失败:', e.message);
|
|
1557
1533
|
}
|
|
1558
1534
|
} else {
|
|
1559
1535
|
// 延迟启动:等待 PC 客户端发送 init 消息后再 spawn 进程
|