cc-viewer 1.6.326 → 1.6.327
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/assets/{App-DgnBYI0A.js → App-DkRFGCYS.js} +1 -1
- package/dist/assets/{MdxEditorPanel-DvtYTYBR.js → MdxEditorPanel-BV07xvRx.js} +1 -1
- package/dist/assets/{Mobile-OJJ-w638.js → Mobile-BOO1P7Gs.js} +1 -1
- package/dist/assets/{index-CqCAViSO.js → index-BzkiNZxR.js} +2 -2
- package/dist/assets/{seqResourceLoaders-C2KXQgrD.js → seqResourceLoaders-BYpuRR7f.js} +2 -2
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/server/lib/interceptor-core.js +9 -0
- package/server/lib/terminal-env.js +19 -0
- package/server/pty-manager.js +8 -1
- package/server/scratch-pty-manager.js +4 -1
package/dist/index.html
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// 整体显示大小已弃用 CSS zoom:Electron 改用 webFrame.setZoomFactor(首屏抢占见
|
|
22
22
|
// electron/tab-content-preload.js),纯浏览器交由用户用浏览器自带快捷键缩放,故此处不再设 zoom。
|
|
23
23
|
</script>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-BzkiNZxR.js"></script>
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/vendor-antd-x2KtHa4R.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-z6VSi4ab.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/vendor-mdxeditor-Zi3mchEB.js">
|
package/package.json
CHANGED
|
@@ -8,6 +8,13 @@ const SUBAGENT_SYSTEM_RE = /(?:command execution|file search|planning) specialis
|
|
|
8
8
|
// 这类子代理继承完整 "You are Claude Code" prompt + Edit/Bash/Agent 工具,会误中轻量 MainAgent 启发式,故须显式排除。
|
|
9
9
|
// 结尾 \b 锚定:仅匹配 `=true`(其后为 `;` / 空白 / 串尾),避免 `=truex` 之类误匹配。
|
|
10
10
|
const SUBAGENT_BILLING_RE = /cc_is_subagent=true\b/;
|
|
11
|
+
// 同进程 Agent/Task 队友(teammate):system prompt 注入团队协作标记,但继承完整 "You are Claude Code"
|
|
12
|
+
// prompt + Edit/Bash/Task 工具,且不带 --agent-name 进程参数(_isTeammate 认不出),会误中下方 MainAgent
|
|
13
|
+
// 启发式 → 流式期间被当 mainAgent 开 live-stream,其 thinking 污染主「最新回复」overlay。须显式排除。
|
|
14
|
+
// KEEP IN SYNC: server/lib/kv-cache-analyzer.js + src/utils/contentFilter.js(三处判据必须一致)。
|
|
15
|
+
// 两处服务端实现(本文件 + kv-cache-analyzer)由 test/interceptor-core-mainagent.test.js 互校防漂移;
|
|
16
|
+
// 前端 contentFilter 那份由 test/content-filter-unit.test.js 单测覆盖。
|
|
17
|
+
const TEAMMATE_SYSTEM_RE = /running as an agent in a team|Agent Teammate Communication/i;
|
|
11
18
|
|
|
12
19
|
export function getSystemText(body) {
|
|
13
20
|
const system = body?.system;
|
|
@@ -22,6 +29,8 @@ export function isMainAgentRequest(body) {
|
|
|
22
29
|
if (!body?.system || !Array.isArray(body?.tools)) return false;
|
|
23
30
|
|
|
24
31
|
const sysText = getSystemText(body);
|
|
32
|
+
// 同进程队友 ⇒ 非 MainAgent(与最终重建 isMainAgentEntry 判据对齐,修流式期 teammate thinking 污染主 overlay)。
|
|
33
|
+
if (TEAMMATE_SYSTEM_RE.test(sysText)) return false;
|
|
25
34
|
// cc_is_subagent=true ⇒ 子代理,绝非 MainAgent(cc_version 2.1.181+)。从源头让新日志的 mainAgent 字段为 false。
|
|
26
35
|
if (SUBAGENT_BILLING_RE.test(sysText)) return false;
|
|
27
36
|
if (!sysText.includes('You are Claude Code')) return false;
|
|
@@ -16,6 +16,25 @@ export function stripClaudeNoFlickerUnlessOptedIn(env, sourceEnv = process.env)
|
|
|
16
16
|
return env;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// 新版 Claude Code(v2.1.89+)默认全屏渲染(整屏原地重绘)→ 嵌入式 xterm 攒不出 scrollback、
|
|
20
|
+
// 终端只剩一屏、上滚不到历史(claude 自身行为,cc-viewer 剥离 NO_FLICKER 也无济于事)。
|
|
21
|
+
// cc-viewer 默认向 claude 注入官方开关 CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1,使其回到经典
|
|
22
|
+
// 流式渲染、终端恢复可滚历史(与默认剥离 NO_FLICKER 同款取舍:保 scrollback)。想保留全屏无闪烁
|
|
23
|
+
// 渲染的用户 opt-out:设 CCV_KEEP_CLAUDE_FULLSCREEN=1;亦尊重用户显式 export 的
|
|
24
|
+
// CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN(含显式 '0' 主动开全屏)。
|
|
25
|
+
export const KEEP_CLAUDE_FULLSCREEN_ENV = 'CCV_KEEP_CLAUDE_FULLSCREEN';
|
|
26
|
+
|
|
27
|
+
export function applyClaudeAltScreenPref(env, sourceEnv = process.env) {
|
|
28
|
+
if (!env) return env;
|
|
29
|
+
const keepFullscreen = env[KEEP_CLAUDE_FULLSCREEN_ENV] === '1' || sourceEnv?.[KEEP_CLAUDE_FULLSCREEN_ENV] === '1';
|
|
30
|
+
if (!keepFullscreen && env.CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN == null) {
|
|
31
|
+
env.CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN = '1';
|
|
32
|
+
}
|
|
33
|
+
// 不把 cc-viewer 内部开关泄漏给子进程(对齐 _spawnClaudeImpl 对 CCV_ 短路开关的剥离)。
|
|
34
|
+
delete env[KEEP_CLAUDE_FULLSCREEN_ENV];
|
|
35
|
+
return env;
|
|
36
|
+
}
|
|
37
|
+
|
|
19
38
|
function ensureWrapperFile(dir, fileName, content) {
|
|
20
39
|
mkdirSync(dir, { recursive: true });
|
|
21
40
|
const file = join(dir, fileName);
|
package/server/pty-manager.js
CHANGED
|
@@ -4,7 +4,7 @@ import { join, dirname } from 'node:path';
|
|
|
4
4
|
import { chmodSync, statSync } from 'node:fs';
|
|
5
5
|
import { platform, arch, homedir } from 'node:os';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
|
-
import { prepareEmbeddedShellSpawn, stripClaudeNoFlickerUnlessOptedIn } from './lib/terminal-env.js';
|
|
7
|
+
import { prepareEmbeddedShellSpawn, stripClaudeNoFlickerUnlessOptedIn, applyClaudeAltScreenPref } from './lib/terminal-env.js';
|
|
8
8
|
import { killPtyTree } from './lib/term-signals.js';
|
|
9
9
|
import { findSafeSliceStart, splitTrailingIncomplete } from './lib/ansi-safe-slice.js';
|
|
10
10
|
|
|
@@ -172,6 +172,10 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
|
|
|
172
172
|
// Claude Code NO_FLICKER 会让嵌入式 xterm 走 alt-screen 并丢失 scrollback。
|
|
173
173
|
// cc-viewer 默认剥离继承值;确实需要时可显式设 CCV_KEEP_CLAUDE_CODE_NO_FLICKER=1。
|
|
174
174
|
stripClaudeNoFlickerUnlessOptedIn(env);
|
|
175
|
+
// 新版 Claude Code 默认全屏渲染(整屏原地重绘)→ 终端只剩一屏、上滚不到历史。
|
|
176
|
+
// cc-viewer 默认注入 CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 让 claude 回经典流式渲染、终端可滚历史;
|
|
177
|
+
// 想保留全屏无闪烁渲染的用户设 CCV_KEEP_CLAUDE_FULLSCREEN=1 opt-out。
|
|
178
|
+
applyClaudeAltScreenPref(env);
|
|
175
179
|
|
|
176
180
|
// Resolve real Node.js path (Electron's process.execPath is the Electron binary)
|
|
177
181
|
let nodePath = process.execPath;
|
|
@@ -435,6 +439,9 @@ async function _spawnShellImpl() {
|
|
|
435
439
|
delete shellEnv.CCVIEWER_INTERNAL_TOKEN;
|
|
436
440
|
// 交互 shell 里手动敲 claude 时也禁鼠标,理由同 spawnClaude。
|
|
437
441
|
shellEnv.CLAUDE_CODE_DISABLE_MOUSE ??= '1';
|
|
442
|
+
// 默认让 shell 内手敲的 claude 也回到经典流式渲染(终端可滚历史),理由同 spawnClaude;
|
|
443
|
+
// CCV_KEEP_CLAUDE_FULLSCREEN=1 可 opt-out。
|
|
444
|
+
applyClaudeAltScreenPref(shellEnv);
|
|
438
445
|
const shellSpawn = prepareEmbeddedShellSpawn(shell, shellEnv);
|
|
439
446
|
|
|
440
447
|
ptyProcess = pty.spawn(shellSpawn.command, shellSpawn.args, {
|
|
@@ -3,7 +3,7 @@ import { dirname, join, basename } from 'node:path';
|
|
|
3
3
|
import { chmodSync, statSync } from 'node:fs';
|
|
4
4
|
import { platform, arch, homedir } from 'node:os';
|
|
5
5
|
import { createRequire } from 'node:module';
|
|
6
|
-
import { prepareEmbeddedShellSpawn } from './lib/terminal-env.js';
|
|
6
|
+
import { prepareEmbeddedShellSpawn, applyClaudeAltScreenPref } from './lib/terminal-env.js';
|
|
7
7
|
import { killPtyTree } from './lib/term-signals.js';
|
|
8
8
|
import { findSafeSliceStart, splitTrailingIncomplete } from './lib/ansi-safe-slice.js';
|
|
9
9
|
|
|
@@ -137,6 +137,9 @@ export async function spawnScratch(id) {
|
|
|
137
137
|
}
|
|
138
138
|
delete env.ANTHROPIC_BASE_URL;
|
|
139
139
|
env.CLAUDE_CODE_DISABLE_MOUSE ??= '1';
|
|
140
|
+
// 默认让 scratch 里手敲的 claude 也回到经典流式渲染、终端可滚历史;想保留全屏设
|
|
141
|
+
// CCV_KEEP_CLAUDE_FULLSCREEN=1 opt-out。CCV_* 已被上方剥离,opt-out 靠 sourceEnv(父进程 env)检测。
|
|
142
|
+
applyClaudeAltScreenPref(env);
|
|
140
143
|
const shellSpawn = prepareEmbeddedShellSpawn(shell, env);
|
|
141
144
|
|
|
142
145
|
s.lastExitCode = null;
|