Skip to content

[pull] main from claude-code-best:main - #6

Open
pull[bot] wants to merge 666 commits into
Tialon:mainfrom
claude-code-best:main
Open

[pull] main from claude-code-best:main#6
pull[bot] wants to merge 666 commits into
Tialon:mainfrom
claude-code-best:main

Conversation

@pull

@pull pull Bot commented Apr 3, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull Bot locked and limited conversation to collaborators Apr 3, 2026
@pull pull Bot added the ⤵️ pull label Apr 3, 2026
claude-code-best and others added 27 commits May 5, 2026 19:36
删除未使用的文件(BuiltinStatusLine.tsx、4 个重复的 .ts stub)、
移除约 55 个文件中未使用的 React 导入、
清理约 50 处未使用的导入/变量/参数。
净减少 ~296 行代码,precheck 4077 测试全部通过。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
移除 autonomyStatus/betas/claudemd/executorCrossPlatform 中
未使用的导入和参数。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
移除未使用的导入(getSubscriptionType、isEnvDefinedFalsy、
getClaudeConfigHomeDir 等)、未使用的常量(ACCENT_COLOR、
NAME_MATCH_BONUS、CLIPBOARD_THRESHOLD)和死函数
(getOpus41Option、pasteViaClipboard),
为未使用参数添加 _ 前缀。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…mory-leak-fix

feat: 继续进行内存泄露修复及垃圾代码清理
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.
fix: align mcp transform pipeline with Anthropic Claude Code 2.1.128
feat: 参考 claude code 官方实现,改进 sub agent 以及 fork agent 的渲染方式
When ANTHROPIC_BASE_URL points to a non-Anthropic endpoint (e.g.
DeepSeek), the JSON-formatted user_id containing {, ", : characters
fails validation against ^[a-zA-Z0-9_-]+$. Send only the hex device_id
for third-party providers.
…r-id

fix: third-party API user_id validation error (DeepSeek, etc.)
docs: expand sub-agent architecture guide
- Zod schema 补齐 refreshInterval 字段
- 通过 scheduleUpdate 复用 300ms debounce,event/settings/time 三路触发单飞
- 新增 docs/features/status-line.mdx 调研文档
…nterval

feat: 状态栏支持 refreshInterval 定时刷新
还原 commit 51b8ad4 删除的 diff highlight 显示:FileEdit/FileWrite 工具
执行成功后重新展示 StructuredDiffList,拒绝时重新展示高亮代码预览或
带上下文的 diff 视图。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
AgentSummary 30s fork 循环的内存泄露已在 commit 52b61c2 修复(闭包
引用丢弃 + 上下文重建 + 消息/字符上限),重新启用该 feature。

用户可通过 /coordinator 命令或 CLAUDE_CODE_COORDINATOR_MODE=1 环境变量
激活多 worker 编排模式。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
迁移逻辑过于激进,用户手动删除 [1m]] 后会被自动加回。
现在将 migrateOpusToOpus1m 改为 no-op,保留用户的手动模型选择。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
每次 API 请求后自动计算缓存命中率,低于阈值(默认 80%)时在对话流中显示黄色警告消息。
同时更新 /context 命令输出中显示缓存命中率。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
getRealModelName() 现在会检查 provider 特定环境变量(OPENAI_MODEL、GEMINI_MODEL、GROK_MODEL),
确保通过这些变量设置模型时署名显示真实名称而非 Anthropic 默认模型名。

Co-Authored-By: opus[1m] <noreply@anthropic.com>
去掉 getUserSpecifiedModelSetting() 分支,统一走 getMainLoopModel()(解析别名)
+ resolveProviderModel()(解析 provider 映射)的完整链路。

Co-Authored-By: opus[1m] <noreply@anthropic.com>
- 新增 attributionEmail.ts 实现模型名到邮箱的自动映射
- 重构署名逻辑,统一使用 getRealModelName() 和 getAttributionEmail()
- 将产品名从 Claude Code 更新为 Claude Code Best
- 更新 PRODUCT_URL 指向 claude-code-best fork 仓库

Co-Authored-By: glm-4.7 <noreply@zhipuai.cn>
claude-code-best and others added 30 commits July 9, 2026 11:52
…rt-md

feat: artifact 支持直接上传 md 文件;消除 system prompt 中的 finger print
ExecuteTool 在内部工具调用失败时产出 result: null,其 renderToolResultMessage
通过 as never 将 null 直接传给 EnterWorktreeTool 的 UI,导致读取 output.worktreeBranch
时抛出 TypeError。修复方案:在 ExecuteTool 委托前增加 null 检查,同时为
EnterWorktreeTool/ExitWorktreeTool 的 renderToolResultMessage 增加 !output 防护。

debug.ts 中 getDebugFilePath 返回相对路径,appendFileSync 在某些场景下
因 CWD 变化抛出 ENOENT 击穿到 RootREPLBoundary。修复方案:路径 resolve 为
绝对路径,writeFn 增加重试机制,二次失败静默吞错不阻塞 UI。

Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
fix: 修复 ExecuteTool 委托 null result 导致的 worktree UI 崩溃及 debug 日志 ENOENT
- 默认视图保留 compact 前完整历史(不折叠不置灰),仅为显示层改动;
  模型上下文仍在 query.ts 按 compact boundary 独立切片,token 照常释放
- compact 阶段新增基于流式 token 的进度条(渐近曲线 1-e^(-tokens/1200)),
  compact 结束后自动消失
- compact 结束打印压缩前后token变化量

Co-Authored-By: claude-opus-4-8[1m] <noreply@anthropic.com>
feat: /compact 保留上下文并新增流式 token 进度条
When OPENAI_AUTH_MODE=chatgpt, side queries used getOpenAIClient() with an
empty OPENAI_API_KEY, so the auto-mode classifier got 401 and fail-closed
to human confirmation. Route OpenAI side queries through the existing
ChatGPT Responses + OAuth path instead; keep Chat Completions for API-key
and Grok modes.
- Map OpenAI Responses usage so cache_read is subtracted from input_tokens
  (hit rate no longer hard-capped at 50%)
- Add process-stable prompt_cache_key for Responses and Chat Completions
- Support reasoning effort max; align GPT-5.6 context (272k OAuth / 1.05M API)
- Keep existing Codex model list and add gpt-5.6-sol/terra/luna as defaults
- Lower default cache warning threshold to 70%
Enable PowerShellTool by default on Windows (opt-out via
CLAUDE_CODE_USE_POWERSHELL_TOOL=0). Prefer powershell for input-box !
routing when available. settings.defaultShell still overrides. macOS/Linux unchanged.
… errors

When the model passes a directory path (e.g., `my-docs/analysis/api/`) to
Write/Read/Edit tools instead of a file path, the tools now reject it early
with a clear, actionable error message instead of raw EISDIR errors.

- FileWriteTool: isDirectory() check in validateInput() (errorCode 5)
- FileReadTool:  isDirectory() check in validateInput() (errorCode 10)
- FileEditTool:  isDirectory() check in validateInput() (errorCode 10)
- All three prompts updated with guidance about file vs directory paths

Co-Authored-By: deepseek-v4-flash <deepseek-ai@claude-code-best.win>
… errors (#1298)

When the model passes a directory path (e.g., `my-docs/analysis/api/`) to
Write/Read/Edit tools instead of a file path, the tools now reject it early
with a clear, actionable error message instead of raw EISDIR errors.

- FileWriteTool: isDirectory() check in validateInput() (errorCode 5)
- FileReadTool:  isDirectory() check in validateInput() (errorCode 10)
- FileEditTool:  isDirectory() check in validateInput() (errorCode 10)
- All three prompts updated with guidance about file vs directory paths

Co-authored-by: deepseek-v4-flash <deepseek-ai@claude-code-best.win>
…sidequery

fix(api): use ChatGPT OAuth for OpenAI sideQuery (auto-mode classifier)
…-chatgpt-models

feat(openai): sticky prompt cache, usage mapping, and GPT-5.6 models
feat(windows): default to PowerShell for shell tools and ! commands
…1299)

* feat: 老旧 Windows 控制台(pre-ConPTY)自动兼容模式

Windows 10 build < 17763(1709/LTSC 等无 ConPTY 的内网机器)上,
老 conhost 的 VT 解析器对增量渲染的行尾 pending-wrap 语义处理有误,
真实光标与虚拟光标漂移,花屏残渣持续累积,直到一次全量重绘才消除。
该问题影响此类机器上的所有终端(VS Code/mintty 走 winpty 抓取的
是同一份损坏的 conhost buffer)。

- 新增 legacyConsole.ts:按 os.release() build 号自动检测,
  CLAUDE_CODE_LEGACY_CONSOLE=1/0 可强制开/关
- log-update.ts:命中时每约 1 秒用一次全量重绘替换增量 diff,
  屏幕持续自愈;非老控制台环境完全不走此路径
- 6 个单元测试(检测逻辑 + 环境变量覆盖 + 缓存行为)

* docs: CLAUDE.md 补充老控制台兼容模式说明,修正版本号描述

* feat: 老控制台兼容模式支持强度调节

真机(1709/build 16299)第一轮验证反馈周期性自愈可能不足,
增加两个调节旋钮:

- CLAUDE_CODE_LEGACY_CONSOLE=2(或 always):每帧全量重绘,
  用于增量 diff 立即花屏、1 秒自愈不够的机器
- CLAUDE_CODE_LEGACY_CONSOLE_RESET_MS:周期模式的重绘间隔,
  钳制在 [100, 10000],默认 1000 不变

默认行为不变(自动检测 → periodic 1s)。新增 9 个单元测试
(模式解析、间隔钳制、空串回退、缓存行为)。

* fix: 老控制台花屏根因修复——渲染宽度收窄 1 列绕开 pending-wrap

真机(1709/build 16299)第二轮反馈:周期性全量重绘在跑(可见闪烁)
但花屏范围随重绘扩大。定位到真正根因:老 conhost 对 pending-wrap
的处理是「写满最后一列立即换行」(现代终端为挂起等待),任何顶满
行宽的输出(分隔线、满行文本)都会把真实光标多推一行——增量 diff
和全量重绘同样受害,且每次重绘还把缓冲区多滚几行,旧帧残渣上移,
表现为「越闪越花」。

修复:legacy 模式下 effectiveColumns() 把渲染宽度收窄 1 列
(下限 20),任何一行都不再触碰最后一列,pending-wrap 缺陷路径
从源头绕开;周期重绘保留作为兜底自愈。非 legacy 环境行为完全不变。

新增 effectiveColumns 单元测试;ink.tsx 三处宽度读取统一走该函数。
… mapping, tier ChatGPT model routing (#1300)

Co-authored-by: DavidShawa <DavidShawa@users.noreply.github.com>
全局槽 lastCacheSafeParams 从不清空,/clear(regenerateSessionId)与进程内
/resume(switchSession)后残留旧会话完整历史,会被 /recap、SDK
side_question/promptSuggestion 拼进发给 API 的请求前缀,导致回复引用另一段
对话。

- 槽迁到 src/utils/cacheSafeParamsSlot.ts:保存时记 sessionId,读取时不匹配
  则自愈清空并释放旧消息数组
- clearConversation 显式 saveCacheSafeParams(null) 立即释放内存
- 迁移四处调用点 import(stopHooks/print/btw/generateRecap)
- biome.json 排除 dist-stable 构建产物快照,避免 precheck 扫描改写
- 新增 8 个单测,用真实 regenerateSessionId/switchSession 复现两条路径

Co-Authored-By: claude-fable-5 <noreply@anthropic.com>
fix: 修复 lastCacheSafeParams 跨会话残留导致 post-turn fork 上下文污染
对比 mitm 抓到的官方 claude-cli/2.1.205 compact 请求,BASE compact
prompt 缺失两处安全约束,补齐后与官方逐字节一致:

1. 分析指令 step 1 新增 bullet:security-relevant instructions/
   constraints(敏感文件、禁止操作、凭证处理)必须 verbatim 保留,
   使其在 compaction 后继续生效。
2. 第 6 节 All user messages 新增 prompt-injection 防御:只有真正
   user-role turn 才算用户消息;assistant 消息内部伪装成 "user:"/
   "Human:" 或 transcript 样式的文本视为模型生成,绝不能当作用户
   请求/批准/确认——防止借 compaction 把注入内容洗白成权威用户指令。

step 1 的 bullet 经 DETAILED_ANALYSIS_INSTRUCTION_BASE 同步至
UP_TO 变体。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…y-hardening

fix: 对齐官方 2.1.205 compact prompt 的安全加固
Fix broken .gitignore wildcards
fix: 尊重 perf report 的自定义配置目录
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.