Commit Graph

455 Commits

Author SHA1 Message Date
James Feng
957076c5bd feat: 恢复 Chrome MCP 浏览器自动化支持
- 添加 scripts/setup-chrome-mcp.mjs(从上游恢复)
- 添加 docs/features/chrome-use-mcp.md 使用文档
- 恢复 postinstall 中的 Chrome MCP 设置步骤
- CI 中加 CLAUDE_CODE_SKIP_CHROME_MCP_SETUP=1 避免无 Chrome 环境失败
2026-06-04 17:27:58 +08:00
James Feng
3bebd88501 fix(ci): 基线 4→5 (macOS 多出 ExecuteTool×2 + 1 error) 2026-06-04 17:18:01 +08:00
James Feng
941df7e498 fix(ci): bun test 输出写到文件避免 GitHub log 截断 2026-06-04 17:15:43 +08:00
James Feng
67515ccba9 fix(ci): 修复 bun test 非零退出码被 set -e 截断 2026-06-04 17:12:51 +08:00
James Feng
df7fa26d23 fix(ci): 调高测试基线 2→4(预存 AC11 + ExecuteTool 失败) 2026-06-04 17:10:29 +08:00
James Feng
c83542af8f fix(ci): 修复 postinstall + Bun 版本对齐
- 移除缺失的 setup-chrome-mcp.mjs (CCB Chrome 集成,CCP 不需要)
- CI Bun: 1.3.11 → 1.3.14 (对齐本地环境)
2026-06-04 17:08:12 +08:00
GhostDragon124
a2f098a746 docs: update contributors 2026-06-04 09:06:11 +00:00
James Feng
e08b9b6e86 chore: 重新生成 bun.lock 修复 CI lockfile frozen 错误 2026-06-04 17:05:47 +08:00
James Feng
e806327608 feat: npm 离线打包脚本 — scripts/pack-npm.sh
一键构建 + 打包为 ccp-<version>.tgz:
  bash scripts/pack-npm.sh

目标机器安装(需要 Bun):
  npm install -g ./ccp-2.6.5.tgz
  ccp --version

产物 5.5MB,包含 dist-nosplit/cli.js + bin wrapper
2026-06-04 16:13:29 +08:00
James Feng
452e2f01c8 docs: README 更新 — 测试数 3383、ACP stub 状态、上游同步章节
- 测试数: 3068 → 3383
- ACP: ⚠️ stub (fail-closed),默认关闭
- 新增「上游同步策略」章节,180 commit 审查统计
- 版本更新记录 (v1.8.0 → v2.2.0)
2026-06-04 16:06:44 +08:00
James Feng
b5bcbdbd23 fix: 修复斜杠命令自动补全 — 光标前文本参与解析,Tab 补全保留光标后内容 (from upstream ad09f38f)
来源: upstream ad09f38f

修复:
- 只取光标前的 commandInput 参与命令解析,不把光标后文本算入
- Tab 补全时 splice 到光标位置,保留光标后已有内容
- 新增 34 个回归测试

Build:  | Tests: 34/34 pass
2026-06-04 15:48:21 +08:00
James Feng
10dfcc6710 fix: Batch 1a — WebFetchTool header 安全加固 + 核心运行时修复 (from upstream c2ac9a74)
来源: upstream c2ac9a74 (dependency audit findings)

变更 (11 files):
- WebFetchTool: getResponseHeader() 防大小写不一致绕过安全校验 + 新测试
- langfuse: Windows USERPROFILE + homedir() 路径脱敏支持
- REPL.tsx: hideTimeout 清理、onInit/diagnosticTracker ref 闭包修复
- claude.ts: 移除冗余 = undefined 初始化
- query.ts: 移除 biome-ignore + 变量声明简化
- staticRender.tsx: 静态渲染完善
- ansiToPng.ts/bridgeMain.ts/SSETransport.ts/WebSocketTransport.ts: 代码质量
- useGlobalKeybindings/useVoiceIntegration: 质量修复
- 测试文件: sliceAnsi/stringUtils/envExpansion 防模板字面量转义

Build:  565 files | Tests: 65/65 pass (0 new failures)
2026-06-04 15:45:01 +08:00
claude-code-best
9df9e03765 fix: 修复模型的问题 2026-06-04 15:27:40 +08:00
claude-code-best
4ceeedee3f fix: 禁用 opus[1m] 自动迁移,尊重用户手动删除 [1m] 后缀的选择
迁移逻辑过于激进,用户手动删除 [1m]] 后会被自动加回。
现在将 migrateOpusToOpus1m 改为 no-op,保留用户的手动模型选择。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-04 15:27:40 +08:00
claude-code-best
995d3a473c fix: 修复 anthropic 煞笔的四个 bug (#352)
* fix: 移除文件编辑前必须先读取的限制

移除 FileEditTool 和 FileWriteTool 中的 "read before edit" 校验,
允许直接编辑未读取过的文件。保留文件修改过期检测。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* docs: 更新 teach-me 自动写 note 笔记的功能

* fix: 修复 DeepSeek V4 reasoning_content 回传导致的 400 错误

- 扩大模型名称检测范围,匹配所有 deepseek 模型(V4、R1 等)
- 始终保留 thinking blocks 为 reasoning_content 回传给 API
- 移除有 bug 的 turn boundary 剥离逻辑

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix: Opus 4.6/4.7 默认推理 effort 从 medium 改为 high

Pro 和 Max/Team 订阅者的 Opus 默认 effort 之前被降级为 medium,
导致用户感知模型「变笨」。恢复为 high。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix: 移除 thinkingClearLatched sticky-on 机制

空闲超过 1 小时后 thinkingClearLatched 会被触发且永不重置,
导致每轮 API 调用都清除 thinking 历史。完整移除该 latch 机制,
clearAllThinking 硬编码为 false。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix: 移除 numeric_length_anchors 系统指令

删除「工具调用间文字 ≤25 词、最终回复 ≤100 词」的硬性限制。
ablation 测试显示该约束使整体智能下降 3%。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix: 修复测试中 reasoning_content 类型断言

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 14:59:49 +08:00
claude-code-best
fe9da6e5b9 fix: 代码审查修复 — 安全、性能和正确性
- triggersApi: 添加 assertSubscriptionBaseUrl 防止 OAuth token 泄露
- claude.ts: 修复流式响应 O(n^2) 字符串拼接,改用数组累积
- claude.ts: 移除未使用的 import,动态 import 改为静态 import
- StatusLine: BuiltinStatusLine 仅在 statusLineEnabled 时显示,修复双行问题
- local-vault: 修复 --reveal 标志位置解析 bug
- share: 修复 sk-proj-* OpenAI 密钥未脱敏问题
- store.ts: 临时文件改用同目录创建,避免跨文件系统 rename 失败
- store.ts: 添加空字符串 key 校验
- permissionValidation: 端口正则限制为有效 TCP 范围 0-65535
- 测试 mock 补全: schedule/vault/skill-store 测试文件
- 移除过期的 biome-ignore 注释

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
2026-06-04 14:59:14 +08:00
James Feng
8485589ca7 fix: add typeof TungstenPill guard (partial cherry-pick a02a9fc)
8645d37 (Auth header) and a889ed8 (Gates reference) already present in CCP.
2026-06-04 14:58:21 +08:00
Alan
d0278e89c0 fix: support CRLF SSE frame parsing (#223) 2026-06-04 14:55:21 +08:00
claude-code-best
6362f1af99 fix: 修复 n 快捷键导致关闭的问题 2026-06-04 14:51:33 +08:00
claude-code-best
2074f6463f fix: 修复 linux 端的安装问题 2026-06-04 14:51:33 +08:00
claude-code-best
5ed0fa572c fix: 修复 cliHighlight 类型不兼容问题
loadedGetLanguage 返回类型中 name 字段改为可选,匹配 highlight.js
Language 类型中 name 为 string | undefined 的定义。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 14:51:33 +08:00
claude-code-best
6a025582cd fix: 修复 ACP 模式下 messageSelector require 失败导致 submitMessage 崩溃
ACP 模式不加载完整的 React/Ink UI 组件,导致 require('src/components/MessageSelector.js')
返回 undefined。添加 try-catch 和 optional chaining fallback。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 14:51:33 +08:00
claude-code-best
3cc9545d3b fix: 修复 DeepSeek V4 reasoning_content 回传导致的 400 错误
- 扩大模型名称检测范围,匹配所有 deepseek 模型(V4、R1 等)
- 始终保留 thinking blocks 为 reasoning_content 回传给 API
- 移除有 bug 的 turn boundary 剥离逻辑

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 14:51:32 +08:00
claude-code-best
9d49306bfb fix: 尝试请求参数克隆以解除闭包引用 2026-06-04 14:51:32 +08:00
claude-code-best
5886421ad2 fix: 调小 snapshots 的范围 2026-06-04 14:51:32 +08:00
shaleloop
5ebd546664 fix: align mcp transform pipeline with Anthropic Claude Code 2.1.128
Add ImageLimits type and plumb optional limits through the chain:
callMCPTool/callMCPToolWithUrlElicitationRetry -> processMCPResult ->
transformMCPResult -> transformResultContent -> maybeResizeAndDownsampleImageBuffer.
When provided, limits override the module-level defaults
(IMAGE_TARGET_RAW_SIZE, IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
API_IMAGE_MAX_BASE64_SIZE) inside maybeResizeAndDownsampleImageBuffer.
When undefined, behavior is unchanged for current callers.

Add _meta preservation in the text-block case of transformResultContent
(only when the caller opts in via includeMeta=true). transformMCPResult
passes includeMeta=true on the tool-result path; the prompt-handler call
site keeps the default false, preserving prior behavior.

Add skipLargeOutput early-return in processMCPResult after the IDE check:
when the caller passes skipLargeOutput=true and the content has no images,
the function returns content directly without large-output handling.

Add unwrap-to-text in processMCPResult for the persisted-content path:
when the large-string format gate is enabled
(MCP_TRUNCATION_PROMPT_OVERRIDE env var, or
tengu_mcp_subagent_prompt Statsig gate), and the content is a single
bare text block (no annotations, no _meta), unwrap to raw text and
switch the format description to 'Plain text'. Default-off; gate-off
behavior is unchanged.

Verified structurally against the 2.1.128 binary: function signatures,
the IDE check, gate logic, _meta-unwrap pattern, and imageLimits
plumbing match this implementation.
2026-06-04 14:51:32 +08:00
unraid
6a63706bd9 feat: 添加 compact 缓存与上下文压缩增强
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-04 14:08:09 +08:00
claude-code-best
1dfe909301 fix: 修复 voice provider 的问题 2026-06-04 14:07:37 +08:00
James Feng
be76720400 fix: RemoteTriggerTool 测试补充 log/debug/bun:bundle mock,对齐上游 a2cfaf9
CCP 此前已合并该 commit 的大部分改动(growthbook/policyLimits/auditRecords),
仅 log/debug/bun:bundle 三个 mock 遗漏。补齐后测试在 mock 层面与上游一致。

注意: getOauthConfig 错误是上游预存在的 Bun mock.module 问题(切 upstream/main 也复现),
不影响本次提交的正确性。
2026-06-04 14:01:40 +08:00
James Feng
44bfc189e0 fix: 创建 agent 后刷新 loadMarkdownFilesForSubdir 缓存
新建 agent 后 clearAgentDefinitionsCache 漏清底层
loadMarkdownFilesForSubdir 的 memoize 缓存,导致新
agent 不会立即出现在列表中,需要重启才能生效。

Upstream: eb833da3
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 13:54:47 +08:00
cepvor
cbe32ea58a fix: showSpinnerTree 模式下保留 local-agent token 显示
PR #1226 的 CodeRabbit 审查指出:当 spinner-tree 模式开启时,
local-agent(后台代理)的 token 消耗完全不可见,因为它们没有
在树中有独立行,但被 showSpinnerTree 的 guard 排除了。

修复:将 guard 从循环外移到循环内,仅对 in_process_teammate
任务在 tree 模式下跳过(它们有独立树行),local-agent 任务
始终计入 teammateTokens。

Closes: review comment from PR #1226 (originally belongs to PR #1225)

Co-Authored-By: deepseek-v4-pro[1m] <deepseek-ai@claude-code-best.win>
2026-06-04 13:39:53 +08:00
cepvor
4e050df994 fix: 修复子代理 token 消耗在主 spinner 中始终显示为 0
Spinner.tsx 的 token 聚合循环仅统计 in_process_teammate 类型任务,
漏掉了 local_agent(后台代理/verification agent)类型。当后台代理
运行时,主界面 spinner 一直显示 "↓ 0 tokens",因为 background agent
的 token 消耗未被纳入 teammateTokens 聚合。

同时在 inProcessRunner.ts 中,进程内队友完成时计算并设置 result
(含 totalTokens/totalToolUseCount/content/usage),使详情弹窗可以
正确展示累计 token 消耗,不再仅依赖 progress.tokenCount 间歇更新。

Co-Authored-By: deepseek-v4-pro[1m] <deepseek-ai@claude-code-best.win>
2026-06-04 13:39:44 +08:00
claude-code-best
1d3951d44d fix: 添加 React Error Boundary 防止生产环境渲染崩溃
增强 SentryErrorBoundary 组件,捕获渲染错误时输出诊断信息
(错误消息 + component stack)到 stderr 和终端,而非静默返回
null。在 replLauncher 根节点和 Messages 组件层级包裹 Error
Boundary,防止 Ink 内部的 Error Boundary 直接终止进程。

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
2026-06-04 13:38:32 +08:00
claude-code-best
35927b20ad fix: 提升 CLAUDE.md 指令权重 — 独立 project-instructions + deferred tools 位置调整
- prependUserContext: 将 claudeMd 从通用 <system-reminder> 提取为独立的
  <project-instructions> 用户消息,不带免责声明,置于消息列表最前面
- queryModel: deferred tools 消息从 prepend 改为 append,避免抢占
  project-instructions 的最高权重位置;标签规范化为 <system-reminder>

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
2026-06-04 13:37:41 +08:00
James Feng
a308aa8fcc fix: add missing FILE_WRITE_TOOL_NAME import + poorMode stub (regressions from P2 cherry-picks) 2026-06-04 13:16:05 +08:00
claude-code-best
eaa6199f22 fix: 修复 Tool Search 缓存失效 — deferred 工具不再动态注入 tools 数组
移除 deferred 工具的 "discover then include" 逻辑,让 tools 数组在整个会话中
保持稳定(只有 core tools + ToolSearch + ExecuteExtraTool),避免每次发现新
工具时 tools JSON 变化导致 prompt cache 失效。

同时强化工具优先级引导:core tools 优先直接调用,ToolSearch/ExecuteExtraTool
仅作为发现和调用 deferred 工具的最后手段。当模型搜索已加载的 core tool 时,
ToolSearch 返回明确的拒绝提示。

Co-Authored-By: glm-5.1[1m] <zai-org@claude-code-best.win>
2026-06-04 13:04:45 +08:00
claude-code-best
e1e2378795 feat: fork-agent-redesign — 新增 AgentTool fork 参数与 spec 设计文档
为 AgentTool 引入 fork 布尔参数,支持子代理从父对话上下文中 fork 出独立分支,
继承完整历史、系统提示和模型配置。重构 inputSchema 条件逻辑以适配 fork 模式。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 13:01:20 +08:00
claude-code-best
3922ce074a fix: 将 ExecuteExtraTool 加入 ASYNC_AGENT_ALLOWED_TOOLS 允许子代理执行延迟工具 2026-06-04 12:58:11 +08:00
James Feng
379335e3b2 feat: add provider-aware model name resolution for attribution (cherry-pick 771e3db + f7f69b7)
- Add attributionModel.ts: getRealModelName() resolves model names for
  OpenAI/Gemini providers, so Git commit sign-off shows correct model
  name (DeepSeek/GPT/Gemini) instead of Anthropic default.
- Wire into attribution.ts: replace multi-branch fallback logic with
  simple getRealModelName() call.
- CCP's APIProvider doesn't include 'grok' — skipped that case.
2026-06-04 12:46:51 +08:00
James Feng
2ea37816a6 fix: restore CCP version 2.6.5 (overwritten by upstream cherry-pick) 2026-06-04 12:38:23 +08:00
claude-code-best
aa72a8ed6c fix: 修复 model alias 导致无限递归栈溢出 (cherry-pick cee62bc) 2026-06-04 12:38:02 +08:00
claude-code-best
f484c9fa7c fix: 修复 openai 的 cost 计算问题 2026-06-04 12:37:33 +08:00
HitMargin
ef80d21dbe fix: make modelType take precedence over all env vars in getAPIProvider 2026-06-04 12:37:29 +08:00
claude-code-best
72b13ee215 fix: 尝试修复第三方 api 不兼容部分参数问题 2026-06-04 12:37:26 +08:00
claude-code-best
90406a10be fix: 移除 auto mode 的 provider 和模型白名单限制
移除 firstParty provider 限制和 claude-(opus|sonnet)-4-[67] 模型白名单,
使所有模型和 provider 在 TRANSCRIPT_CLASSIFIER feature 启用时均可使用 auto mode。

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
2026-06-04 12:37:25 +08:00
claude-code-best
d35f0db17d fix: highlight 缓存改用 LRUCache 降低内存开销
- Fallback.tsx: 手动 Map LRU 替换为 lru-cache 的 LRUCache
- Markdown.tsx: tokenCache 同样替换为 LRUCache
- color-diff-napi: 新增行级 hljs AST 缓存,避免终端 resize 时重复高亮

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 12:37:11 +08:00
claude-code-best
b4629aa5bb perf: 表格渲染效率升级 2026-06-04 12:37:07 +08:00
claude-code-best
b7bbbeb039 fix: 优化内存峰值与 CPU 性能,降低 100-300MB 内存占用
- claude.ts: 流式字符串拼接从 O(n²) += 改为数组累积 join,消除 4 处热点
- Messages.tsx: 合并 3 组独立遍历为单次 pass(thinking/bash 查找、3-filter 链、divider/selectedIdx)
- HighlightedCode.tsx: ColorFile 实例添加模块级 LRU 缓存(50 条),避免重复创建
- screen.ts: StylePool 衍生缓存添加 1000 条上限淘汰,防止无界增长
- CompanionSprite.tsx: TICK_MS 从 500ms 提升至 1000ms,减少 setState 频率
- connection.ts: MCP stderr 缓冲从 64MB 降至 8MB
- stringUtils.ts: MAX_STRING_LENGTH 从 32MB 降至 2MB
- sessionStorage.ts: Transcript 写入队列添加 1000 条上限
- query.ts: spread 改 concat 减少一次数组拷贝
- PromptInputFooterLeftSide.tsx: 显示进程 pid 便于调试

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 12:36:59 +08:00
claude-code-best
aff7b0e853 fix: 内存优化 — 预测性 compact 阈值、增量 lookups orphaned 修复、deferred slice 引用优化
- P0: REPL.tsx 用 useMemo 包裹 deferred messages slice,避免每次渲染创建新数组引用导致不必要的后台重渲染
- P1: 预测性 compact 阈值改用 effectiveContextWindow - growth,消除与 autocompact buffer 的双重预留;TOOL_RESULT_GROWTH_ESTIMATE 从 20K 降至 15K
- P2: 增量 lookups 增加 lastAssistantMsgId 一致性检查和 orphaned server_tool_use/mcp_tool_use 扫描,防止 UI 永久 loading
- P3: reactiveCompact 类型断言改为直接使用 'compact' 字面量
- docs: CLAUDE.md 统一使用 precheck 替代分散的 typecheck/lint/test 命令

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 12:36:34 +08:00
James Feng
23ea5a67d3 fix: restore poor mode stubs (CCP-specific, prevents build failure) 2026-06-04 12:36:19 +08:00