cc-viewer 1.6.41 → 1.6.43
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/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<title>Claude Code Viewer</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico?v=1">
|
|
8
8
|
<link rel="shortcut icon" href="/favicon.ico?v=1">
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-iuImTeQ4.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CzvD_Iz7.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/interceptor.js
CHANGED
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -590,7 +590,11 @@ async function handleRequest(req, res) {
|
|
|
590
590
|
'Connection': 'keep-alive',
|
|
591
591
|
});
|
|
592
592
|
|
|
593
|
-
clients.push(res)
|
|
593
|
+
// 注意:不要在此处 clients.push(res)!
|
|
594
|
+
// 必须等 load_end + kv_cache + context_window 全部发送完毕后再加入广播列表,
|
|
595
|
+
// 否则 streamRawEntriesAsync 的 setImmediate yield 间隙会让 watcher 的
|
|
596
|
+
// sendToClients 向该客户端推送 live entry,而 load_end 的 setState 会覆盖这些
|
|
597
|
+
// 已处理的 live entry,导致 对话条目"显示→消失→重现"闪烁。
|
|
594
598
|
|
|
595
599
|
// SSE 心跳保活:每 30s 发送 ping 事件,防止连接被 OS/代理/浏览器静默断开
|
|
596
600
|
const pingTimer = setInterval(() => {
|
|
@@ -665,6 +669,10 @@ async function handleRequest(req, res) {
|
|
|
665
669
|
} catch { }
|
|
666
670
|
}
|
|
667
671
|
|
|
672
|
+
// 历史数据 + KV-Cache + context_window 全部发送完毕后,才将客户端加入广播列表。
|
|
673
|
+
// 这样 watcher 的 sendToClients 不会在 load 阶段向该客户端推送 live entry。
|
|
674
|
+
clients.push(res);
|
|
675
|
+
|
|
668
676
|
req.on('close', () => {
|
|
669
677
|
clearInterval(pingTimer);
|
|
670
678
|
const idx = clients.indexOf(res);
|
|
@@ -941,7 +949,16 @@ async function handleRequest(req, res) {
|
|
|
941
949
|
if (url === '/api/open-log-dir' && method === 'POST') {
|
|
942
950
|
const dir = LOG_FILE ? dirname(LOG_FILE) : LOG_DIR;
|
|
943
951
|
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'explorer' : 'xdg-open';
|
|
944
|
-
|
|
952
|
+
execFile(cmd, [dir], () => {});
|
|
953
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
954
|
+
res.end(JSON.stringify({ ok: true, dir }));
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
if (url === '/api/open-project-dir' && method === 'POST') {
|
|
959
|
+
const dir = process.env.CCV_PROJECT_DIR || process.cwd();
|
|
960
|
+
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'explorer' : 'xdg-open';
|
|
961
|
+
execFile(cmd, [dir], () => {});
|
|
945
962
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
946
963
|
res.end(JSON.stringify({ ok: true, dir }));
|
|
947
964
|
return;
|