Commit Graph

561 Commits

Author SHA1 Message Date
James Feng
4f280b43fe chore: remove spec scaffolding and community links doc
- Delete spec/feature_20260502_F001_fork-agent-redesign/ (3 files)
  Feature merged via ba74e09→e1e23787, recorded in docs/upstream-sync.md
- Delete Friends.md (community blog collection, non-code)
2026-06-07 17:54:36 +08:00
James Feng
09fd58c307 docs: merge upstream sync records and 180-commit audit into upstream-sync.md
Absorb content from:
- 上游同步记录.md (8 chapters of cherry-pick history)
- 上游commit审查清单.md (187 candidate commits reviewed)

Additions to upstream-sync.md (386→958 lines):
- Detailed merge history grouped by category (ACP, cherry-picks, auto-merge, infra)
- Commit-by-commit evaluation (P0/P1/P2/P3/REVIEW, 59 merged + 34 existing + 93 skipped)
- Skip reasons catalog (13 categories)
- Suggested merge order for future cherry-picks
- All merged commits annotated with upstream→CCP hash mapping
- Source attribution header noting absorbed documents
2026-06-07 17:54:36 +08:00
James Feng
d310b78063 docs: add upstream-sync.md, update community-code-issues.md counts
- New docs/upstream-sync.md: comprehensive upstream merge history, version
  alignment, cherry-pick strategy, CCP divergence catalog
- Update community-code-issues.md: tsc 21→20, as any 49→50, add
  client.ts googleAuth as community code
- Revert client.ts googleAuth fix — it's community-introduced
  (google-auth-library version conflict with Anthropic Vertex)
2026-06-07 17:54:36 +08:00
James Feng
a75b83492b fix: eliminate 11 of 12 remaining Anthropic-core as any
MCP schema (6): Add : () => AnyObjectSchema type annotations to
ChannelMessageNotificationSchema, ChannelPermissionNotificationSchema,
AtMentionedSchema, LogEventNotificationSchema. Remove as any at
call sites in print.ts, useManageMCPConnections.ts, useIdeAtMentioned.ts,
vscodeSdkMcp.ts.

Core API (5): Replace as any with specific type assertions in
claude.ts (supportedModels/CachedMCEditsBlock/pinCacheEdits),
filesApi.ts (error property), client.ts (vertexArgs cast).
client.ts:297 retains as any — google-auth-library version conflict
(10.x vs 9.x) with #private nominal typing makes this unavoidable.

Docs: add community-code-issues.md cataloging all 20 community tsc
errors and 49 community as any casts.
2026-06-07 17:54:36 +08:00
James Feng
a93e2bb7ba fix: eliminate all 8 NEEDS_UPSTREAM as any via type annotations and type guards
Group A (4 as any): Add : () => AnyObjectSchema type annotations to
MCP notification schema constants, removing as any at call sites.

Group B (2 as any): Add isStructuredOutputAttachmentMessage type
guard for structured output attachment payloads.

Group C (3 as any): Add isMessageDeltaStreamEvent type guard for
message_delta stream event usage extraction.

tsc: 20 errors (no regression). Build: passes.
2026-06-07 17:54:36 +08:00
James F
fefd375381
Merge pull request #5 from GhostDragon124/acp
87 个 FIXABLE as any,plus:

**FIXABLE 的典型修复模式:**

| 类型 | 修法 | 涉及 |
|:---|------|:--:|
| 判别联合收窄 | `if (!result.success)` → TS 自动 narrow | 7 个 |
| 扩展接口/类型 | 给 settings/config 类型加缺失字段 | 15 个 |
| `globalThis`/MACRO | 全局类型声明 | 5 个 |
| 组件 prop 类型 | `React.ComponentType<Props>` | 4 个 |
| 原生模块接口 | 声明 optional capability 接口 | 8 个 |
| SDKMessage 收窄 | guard 后访问子属性 | 12 个 |
| 其他(Token/block/函数签名) | 各自适配 | 36 个 |

**NEEDS_UPSTREAM 的 14 个:** MCP schema factory 返回类型(4)+ subagent stream_event 消息类型(5)+ structured_output attachment 类型(2)+ 社区 stream event(3)


| 组 | CCB 能直接用吗 | 价值 |
|---|---|---|
| **A** `: () => AnyObjectSchema` |  同文件同位置 | 消除 4 个 as any,零副作用 |
| **B** `isStructuredOutputAttachmentMessage` |  同文件同位置 | 消除 2 个 as any,附加运行时安全检查 |
| **C** `isMessageDeltaStreamEvent` |  同文件同位置 | 消除 3 个 as any,附加运行时安全检查 |
2026-06-07 16:34:15 +08:00
James Feng
abde5e813a fix: remove final planned as-any casts 2026-06-07 15:48:33 +08:00
James Feng
ac807aeb08 fix: remove runtime helper as-any casts 2026-06-07 15:45:11 +08:00
James Feng
ba36ca454d fix: remove queued content as-any casts 2026-06-07 15:40:32 +08:00
James Feng
c130eaad4b fix: remove mid-plan as-any casts 2026-06-07 15:33:40 +08:00
James Feng
33a6217702 fix(type): eliminate 26 as any casts (partial batch, Codex interrupted) 2026-06-07 15:27:21 +08:00
James Feng
509b728212 chore: remove 4 dead stub files (ink-elements, ink-jsx, internal-modules, react-compiler-runtime) 2026-06-07 14:48:15 +08:00
James Feng
7019fb8c97 chore: remove dead sdk-stubs.d.ts — all types already in coreTypes.generated.ts 2026-06-07 14:44:33 +08:00
James Feng
3013b05191 fix: add resetAbortController/getAbortSignal to QueryEngine (from upstream CCB) 2026-06-07 14:24:34 +08:00
James F
498e2bcf3c
Merge pull request #4 from GhostDragon124/acp
Acp
2026-06-07 13:26:48 +08:00
James Feng
4a99c68408 docs: update README — v2.6.11, tsc 22 (community), tests 3919 2026-06-07 13:17:59 +08:00
James Feng
7763e93cf0 fix(tsc): Phase 3e (final) — all fixable errors cleared (44→22, only community code remains)
- contextCollapse stubs: fix return types and signatures
- query.ts: add type casts for Message[], Number()
- main.tsx: fix typo selectedBgAgentIndex→selectedIPAgentIndex
- betas.ts: stub getToolSearchBetaHeader
- PromptInput, Message, Messages: add @ts-expect-error / type casts
- prefetch.runner, skillSearch/prefetch, searchExtraTools: as any casts
- processUserInput, commandSuggestions, thinking.test: type narrowing
- effort.ts: xhigh_effort as any
2026-06-07 11:28:54 +08:00
James Feng
2c5010129f fix(tsc): Phase 3d — fix 40 type errors across 15 files (87→47)
- contextCollapse stub: add 5 method stubs
- which.ts: utf-8 → utf8
- convertTools.test.ts, WebSearchTool, SkillTool, AttachmentMessage
- UserTextMessage dynamic require → React.createElement
- openai: AgentId cast, fetchOverride, streaming params
- constants: remove duplicate SYNTHETIC_OUTPUT_TOOL_NAME
2026-06-07 11:19:48 +08:00
James Feng
38dde66af1 fix(tsc): Phase 3c — fix 33 type errors in contextCollapse + UI stubs (120→87) 2026-06-07 11:13:19 +08:00
James Feng
76965c5e8c fix(tsc): Phase 3b — fix 21 type errors in PowerShell/Bash/MCP UI (141→120) 2026-06-07 11:08:03 +08:00
James Feng
2c0a35d04b fix(tsc): Phase 3a — fix 34 type errors in AgentTool/UI.tsx (175→141)
- Add local type assertions (AgentProgressMessage, AgentToolProgressData)
- No as any used — all specific type narrowing
- AgentTool tests: 40 pass, 0 fail
2026-06-07 11:03:08 +08:00
James Feng
a648196c3c fix(tsc): Phase 2 — eliminate all Cannot find name errors (204→175)
- Fix 19 Cannot find name + 1 no exported member
- Variable name typos: filePath→_filePath, PermissionMode→PermissionName, etc.
- Missing imports: feature, readFileSync, ALL_MODEL_CONFIGS, etc.
- Stub definitions: suppressNextDiscovery, WORKFLOW_TOOL_NAME_VALUE
- 0 remaining Cannot find module/name/export errors
2026-06-07 10:49:56 +08:00
James Feng
315b0bd80e fix(tsc): Phase 1 — add 25 stub files, eliminate all Cannot find module errors (270→204)
- 25 stub files: types/tools, types/utils, contextCollapse, mcpSkills, etc.
- 11 reused from chore/bridge-green, 14 created from scratch
- All stubs documented in docs/devlog/02-tsc-stubs.md
- Build passes, tests not regressed
2026-06-07 10:41:02 +08:00
James Feng
00a0c86cc0 docs: add devlog for upstream sync 2.6.5→2.6.11 2026-06-07 03:57:00 +08:00
James Feng
3e29504ca3 fix: replace mockModulePreservingExports with mock.module for tsc compat 2026-06-07 03:43:13 +08:00
James Feng
e0382ce2d4 chore: bump version to 2.6.11 2026-06-07 03:37:46 +08:00
claude-code-best
f2393903ec fix: ACP prompt 未切换全局 sessionId 导致 transcript 写入错误会话文件
prompt() 在调用 submitMessage 前没有 switchSession,recordTranscript
依赖全局 getSessionId() 确定写入路径,多会话场景下新会话内容会覆盖旧会话。
2026-06-07 03:35:45 +08:00
claude-code-best
1ce561ca6c fix: ACP loadSession 历史记录恢复失败 — 用 resolveSessionFilePath 替代 getProjectDir 定位 session 文件
- params.cwd 可能与 session 文件实际存储的项目目录不一致(子目录、
  hash 算法差异等),导致 getProjectDir 推算出的路径找不到文件
- 改用 resolveSessionFilePath(sessionId, cwd) 按 sessionId 跨项目
  搜索,先精确匹配再 fallback 全项目扫描
- 切换回已缓存的 session 时也回放历史消息给客户端
- createSession 内部 switchSession 保留 sessionProjectDir 不被覆盖为 null
2026-06-07 03:35:27 +08:00
claude-code-best
3a261f7444 feat: 添加 cacheWarningEnabled 配置项,支持在 /config 面板关闭缓存率警告 2026-06-07 03:33:21 +08:00
claude-code-best
ddf5e26806 fix: ACP 模式加载 agent 定义并透传 subagent 层级信息
- agent.ts: session 创建时调用 getAgentDefinitionsWithOverrides 加载内置
  subagent(Explore/Plan/General-Purpose 等),注入 appState 和 engineConfig
- bridge.ts: assistantMessageToAcpNotifications 调用时补上 parentToolUseId,
  使 subagent 内部工具调用的 _meta 中携带父级标记
2026-06-07 03:32:25 +08:00
claude-code-best
060bd6fed7 perf: Vite 构建启用 code splitting,Bun RSS 从 966MB 降至 35MB
Bun/JSC 全量解析单文件大 JS 的 bytecode 和 JIT,17MB 产物导致
RSS 暴涨至 ~1GB(Node/V8 懒解析仅需 ~220MB)。启用代码分割后
Bun 按需加载 chunk,--version RSS 35MB,完整加载 ~500MB。

改动:
- vite.config.ts: 移除 codeSplitting:false,添加 chunkFileNames
- post-build.ts: 遍历 dist/ + dist/chunks/ 所有文件做 Bun patch
- 新建 distRoot.ts 共享工具函数,统一路径定位逻辑
- ripgrep.ts/computerUse/setup.ts/claudeInChrome/setup.ts/updateCCB.ts:
  用 distRoot 替换内联 import.meta.url 路径推算
2026-06-07 03:28:02 +08:00
James Feng
930aececce chore: align acp with upstream 2026-06-07 02:36:21 +08:00
James Feng
e3908ab430 chore: align remote control web ui with upstream 2026-06-07 02:35:51 +08:00
James Feng
987578b52a chore: remove poor mode 2026-06-07 02:34:25 +08:00
James Feng
e2aafbb5b5 chore: restore chrome and computer use mcp packages 2026-06-07 02:32:44 +08:00
James Feng
83abbbc2fe chore: restore local telemetry infrastructure 2026-06-07 02:32:06 +08:00
claude-code-best
af7af8cc9d docs: effort 级别描述去掉模型名限制 2026-06-07 01:53:10 +08:00
claude-code-best
9ae258f917 feat: sideQuery 支持第三方 provider 路由 (OpenAI/Grok/Gemini)
- 新增 getProviderPrimaryModel() 从环境变量解析 provider 主模型
- getDefaultOpus/Sonnet/HaikuModel 在第三方 provider 下回退到用户配置的主模型
- sideQuery 根据 provider 类型分发到对应的 API 适配器
- 新增 sideQueryViaOpenAICompatible (OpenAI + Grok) 和 sideQueryViaGemini 适配函数
- 避免 sideQuery 后台任务在配置第三方端点时仍请求 Anthropic API
2026-06-07 01:52:34 +08:00
claude-code-best
b9fcd991cc fix: 防止 MCP 工具调用失败后的 SearchExtraTools/ExecuteExtraTool 死循环 2026-06-07 01:49:38 +08:00
claude-code-best
8f01d5cc59 fix: 明确告知 agent SearchExtraTools/ExecuteExtraTool 是核心工具,已在工具列表中
- prompts.ts: 核心工具列表显式加入 SearchExtraTools, ExecuteExtraTool
- claude.ts: 非 delta 路径提示强调这两个工具可直接调用
- messages.ts: delta 路径渲染强调这两个工具已在工具列表中
- SearchExtraToolsTool/prompt.ts: 加入完整两步工作流示例
- ExecuteTool/prompt.ts: 加入完整两步工作流示例
2026-06-07 01:48:54 +08:00
claude-code-best
6ee204417e fix: 将 ExecuteExtraTool 加入 ASYNC_AGENT_ALLOWED_TOOLS 允许子代理执行延迟工具 2026-06-07 01:48:14 +08:00
claude-code-best
620e3f133d fix: 修复 BriefTool 循环依赖导致 isBriefEnabled 未定义
将模块顶层 require() 改为懒加载函数 getBriefToolModule(),
延迟到实际调用时才加载模块,避免循环依赖时模块尚未完成初始化。
2026-06-07 01:47:44 +08:00
claude-code-best
fd80bb2887 fix: prevent crash when DiscoverSkills receives undefined query via ExecuteExtraTool
searchSkills() called .trim() on query without null-guard. When
DiscoverSkills is invoked through ExecuteExtraTool with missing
description, query is undefined, causing 'Cannot read properties of
undefined (reading trim)'.

Fixed with optional chaining: !query.trim() → !query?.trim()

Co-Authored-By: deepseek-v4-pro <deepseek-ai@claude-code-best.win>
2026-06-07 01:47:44 +08:00
18243133
5232696017 Fix/plan paste fixes (#1238)
* fix: 降低 paste 检测阈值,修复非 bracketed-paste 终端粘贴文本损坏

非 bracketed-paste 终端下,短粘贴(<800 chars)的 stdin chunk 作为独立
keystroke 走 useTextInput.onInput 路径,闭包中 cursor 未刷新导致多次插入
竞态。现将 ≥3 字符的非特殊键输入纳入 paste 累积模式,绕过逐 chunk 处理。

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

* @
fix: Plan模式三处缺陷修复 — ExploreAgent可用性 + 弹窗一致性 + 方案文件保护

1. areExplorePlanAgentsEnabled()移除GrowthBook A/B实验依赖(tengu_amber_stoat),
   始终返回true,确保Explore/Plan agent在BUILTIN_EXPLORE_PLAN_AGENTS开启时始终可用

2. ExitPlanMode clear-context路径补setNeedsPlanModeExitAttachment(true),
   确保清除上下文退出Plan模式后生成plan_mode_exit附件

3. Plan mode full/sparse指令强化Plan文件读取要求:
   "can read" -> "MUST use FileRead to read first before any changes",
   新增"do NOT overwrite"禁止覆盖,Phase 1指令强化并行Explore Agent引导

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

---------

Co-authored-by: psj88520 <qq18243133@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-07 01:47:21 +08:00
claude-code-best
22424f39f2 fix: normalizeMessagesForAPI 不再跨 tool_result 边界合并同 ID assistant 消息 (CC-1215)
ACP 模式下 extended thinking + tool_use 同一 turn 时,StreamingToolExecutor
在两个同 message.id 的 AssistantMessage 之间插入 tool_result,导致向后遍历
合并跨越边界,产生重复 tool_use ID → 孤立 tool_result → 连续 user 消息 → 400。

修改向后遍历停止条件:遇到非 assistant 消息(含 tool_result)即停止,不再跳过。
2026-06-07 01:46:55 +08:00
James F
8a301dcf74 security: close telemetry leak in preconnectAnthropicApi startup path (#1253)
🔒 Security Discovery: Un-gated outbound connection bypasses privacy controls

Summary
-------
preconnectAnthropicApi() unconditionally sends a TCP+TLS handshake to
api.anthropic.com on every ccb startup — even when the user has explicitly
disabled all non-essential traffic via CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
or DISABLE_TELEMETRY=1.

This is the LAST un-gated outbound connection in the entire startup path.
Every other telemetry sink (Sentry, Langfuse, OpenTelemetry, GrowthBook,
1P Event Logger, Datadog, BigQuery, etc.) already respects the
privacyLevel module's isEssentialTrafficOnly() gate. This one did not.

Impact
------
While the preconnect is a HEAD request with no payload, the connection
itself leaks the client's IP address and session timing to Anthropic's
infrastructure. For privacy-conscious users and enterprise deployments
that have disabled telemetry, this constitutes an unexpected data leak.

Fix
---
Add isEssentialTrafficOnly() check at the function entry, consistent
with every other privacy-gated code path in the codebase. The
privacyLevel module is already imported by init.ts and 12+ other
modules — no new dependencies.

Verification
------------
Reproduced and verified via strace on Linux (aarch64):

  # Before fix
  $ strace -f -e connect ccb -p <<< 'hello'
  connect(16, sin_addr=inet_addr("160.79.104.10"), sin_port=htons(443)) = 0
  # ↑ connector to api.anthropic.com despite CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

  # After fix
  $ strace -f -e connect ccb -p <<< 'hello'
  # ↑ zero remote TCP connections — all traffic to localhost only

Changes: 1 file, +5 lines (import + gate)
2026-06-07 01:46:17 +08:00
James Feng
b21ed0506b chore: sync providers.ts (Grok), Config.tsx, poorMode.ts from upstream 2026-06-07 01:19:47 +08:00
claude-code-best
1201d88c37 docs: 添加 ToolSearch 设计指南 + 禁用 turn-zero 工具推荐弹窗
- 新增 docs/design/tool-search-design-guide.md,涵盖架构、搜索算法、执行管道、演进历史
- 禁用 getTurnZeroSearchExtraToolsPrefetch,消除用户输入时的频繁弹窗
- inter-turn 发现机制保持不变

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
2026-06-07 00:56:16 +08:00
James Feng
75fa212759 chore: remove skillLearning subsystem — unused, incompatible with CCP telemetry approach 2026-06-06 22:27:08 +08:00
James Feng
d04846f5b8 chore: checkpoint — restore 40+ upstream files, fix 21 syntax errors, build passes 2026-06-06 22:17:14 +08:00