cc-viewer 1.4.6 → 1.4.8
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/cli.js +7 -5
- package/dist/assets/index-C9NseQNI.css +32 -0
- package/dist/assets/index-CxuBY4Hs.js +624 -0
- package/dist/index.html +2 -2
- package/interceptor.js +1 -0
- package/package.json +7 -3
- package/proxy-env.js +21 -0
- package/pty-manager.js +2 -2
- package/dist/assets/index-BBYFFVRD.js +0 -617
- package/dist/assets/index-BmzbjHDz.css +0 -32
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-CxuBY4Hs.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C9NseQNI.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/interceptor.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// LLM Request Interceptor
|
|
2
2
|
// 拦截并记录所有Claude API请求
|
|
3
|
+
import './proxy-env.js';
|
|
3
4
|
import { appendFileSync, mkdirSync, readdirSync, readFileSync, writeFileSync, statSync, renameSync, unlinkSync, existsSync } from 'node:fs';
|
|
4
5
|
import { homedir } from 'node:os';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-viewer",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"description": "Claude Code Logger visualization management tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "server.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dev": "vite",
|
|
19
19
|
"build": "node build.js",
|
|
20
20
|
"start": "node server.js",
|
|
21
|
+
"test": "node --test",
|
|
21
22
|
"prepublishOnly": "npm run build"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
},
|
|
39
40
|
"homepage": "https://github.com/weiesky/cc-viewer#readme",
|
|
40
41
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
42
|
+
"node": ">=20"
|
|
42
43
|
},
|
|
43
44
|
"files": [
|
|
44
45
|
"dist/",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"cli.js",
|
|
47
48
|
"proxy.js",
|
|
48
49
|
"interceptor.js",
|
|
50
|
+
"proxy-env.js",
|
|
49
51
|
"i18n.js",
|
|
50
52
|
"findcc.js",
|
|
51
53
|
"stats-worker.js",
|
|
@@ -59,16 +61,18 @@
|
|
|
59
61
|
"@xterm/addon-fit": "^0.11.0",
|
|
60
62
|
"@xterm/xterm": "^6.0.0",
|
|
61
63
|
"antd": "^5.29.2",
|
|
64
|
+
"diff": "^8.0.3",
|
|
62
65
|
"marked": "^17.0.2",
|
|
66
|
+
"qrcode.react": "^4.2.0",
|
|
63
67
|
"react": "^18.3.1",
|
|
64
68
|
"react-dom": "^18.3.1",
|
|
65
69
|
"react-json-view-lite": "^2.1.0",
|
|
66
|
-
"qrcode.react": "^4.2.0",
|
|
67
70
|
"vite": "^6.3.5"
|
|
68
71
|
},
|
|
69
72
|
"dependencies": {
|
|
70
73
|
"@xterm/addon-web-links": "^0.12.0",
|
|
71
74
|
"node-pty": "^1.1.0",
|
|
75
|
+
"undici": "^7.22.0",
|
|
72
76
|
"ws": "^8.19.0"
|
|
73
77
|
}
|
|
74
78
|
}
|
package/proxy-env.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EnvHttpProxyAgent, setGlobalDispatcher } from 'undici';
|
|
2
|
+
|
|
3
|
+
// 纯函数,从 env 中解析代理配置(可独立测试)
|
|
4
|
+
export function resolveProxyConfig(env = process.env) {
|
|
5
|
+
const allProxy = env.all_proxy || env.ALL_PROXY;
|
|
6
|
+
return {
|
|
7
|
+
httpProxy: env.http_proxy || env.HTTP_PROXY || allProxy || undefined,
|
|
8
|
+
httpsProxy: env.https_proxy || env.HTTPS_PROXY || allProxy || undefined,
|
|
9
|
+
noProxy: env.no_proxy || env.NO_PROXY || undefined,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function setupProxyEnv() {
|
|
14
|
+
const { httpProxy, httpsProxy, noProxy } = resolveProxyConfig();
|
|
15
|
+
if (!httpProxy && !httpsProxy) return;
|
|
16
|
+
|
|
17
|
+
setGlobalDispatcher(new EnvHttpProxyAgent({ httpProxy, httpsProxy, noProxy }));
|
|
18
|
+
console.error(`[CC Viewer] HTTP proxy: http=${httpProxy || '(none)'}, https=${httpsProxy || '(none)'}${noProxy ? `, no_proxy=${noProxy}` : ''}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setupProxyEnv();
|
package/pty-manager.js
CHANGED
|
@@ -24,7 +24,7 @@ function fixSpawnHelperPermissions() {
|
|
|
24
24
|
} catch {}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export async function spawnClaude(proxyPort, cwd) {
|
|
27
|
+
export async function spawnClaude(proxyPort, cwd, extraArgs = []) {
|
|
28
28
|
if (ptyProcess) {
|
|
29
29
|
throw new Error('PTY process already running');
|
|
30
30
|
}
|
|
@@ -47,7 +47,7 @@ export async function spawnClaude(proxyPort, cwd) {
|
|
|
47
47
|
env: { ANTHROPIC_BASE_URL: env.ANTHROPIC_BASE_URL }
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
const args = ['--settings', settingsJson];
|
|
50
|
+
const args = ['--settings', settingsJson, ...extraArgs];
|
|
51
51
|
|
|
52
52
|
lastExitCode = null;
|
|
53
53
|
outputBuffer = '';
|