Skip to content

Commit 91f77ea

Browse files
feat: 完成一大波类型修复, 虽然 any 很多
1 parent dd9cd78 commit 91f77ea

55 files changed

Lines changed: 156 additions & 81 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,71 @@ claude-code/
328328

329329
项目采用 Bun workspaces 管理内部包。原先手工放在 `node_modules/` 下的 stub 已统一迁入 `packages/`,通过 `workspace:*` 解析。
330330

331+
## Feature Flags 详解
332+
333+
原版 Claude Code 通过 `bun:bundle``feature()` 在构建时注入 feature flag,由 GrowthBook 等 A/B 实验平台控制灰度发布。本项目中 `feature()` 被 polyfill 为始终返回 `false`,因此以下 30 个 flag 全部关闭。
334+
335+
### 自主 Agent
336+
337+
| Flag | 用途 |
338+
|------|------|
339+
| `KAIROS` | Assistant 模式 — 长期运行的自主 Agent(含 brief、push 通知、文件发送) |
340+
| `KAIROS_BRIEF` | Kairos Brief — 向用户发送简报摘要 |
341+
| `KAIROS_CHANNELS` | Kairos 频道 — 多频道通信 |
342+
| `KAIROS_GITHUB_WEBHOOKS` | GitHub Webhook 订阅 — PR 事件实时推送给 Agent |
343+
| `PROACTIVE` | 主动模式 — Agent 主动执行任务,含 SleepTool 定时唤醒 |
344+
| `COORDINATOR_MODE` | 协调器模式 — 多 Agent 编排调度 |
345+
| `BUDDY` | Buddy 配对编程功能 |
346+
| `FORK_SUBAGENT` | Fork 子代理 — 从当前会话分叉出独立子代理 |
347+
348+
### 远程 / 分布式
349+
350+
| Flag | 用途 |
351+
|------|------|
352+
| `BRIDGE_MODE` | 远程控制桥接 — 允许外部客户端远程操控 Claude Code |
353+
| `DAEMON` | 守护进程 — 后台常驻服务,支持 worker 和 supervisor |
354+
| `BG_SESSIONS` | 后台会话 — `ps`/`logs`/`attach`/`kill`/`--bg` 等后台进程管理 |
355+
| `SSH_REMOTE` | SSH 远程 — `claude ssh <host>` 连接远程主机 |
356+
| `DIRECT_CONNECT` | 直连模式 — `cc://` URL 协议、server 命令、`open` 命令 |
357+
| `CCR_REMOTE_SETUP` | 网页端远程配置 — 通过浏览器配置 Claude Code |
358+
| `CCR_MIRROR` | Claude Code Runtime 镜像 — 会话状态同步/复制 |
359+
360+
### 通信
361+
362+
| Flag | 用途 |
363+
|------|------|
364+
| `UDS_INBOX` | Unix Domain Socket 收件箱 — Agent 间本地通信(`/peers`|
365+
366+
### 增强工具
367+
368+
| Flag | 用途 |
369+
|------|------|
370+
| `CHICAGO_MCP` | Computer Use MCP — 计算机操作(屏幕截图、鼠标键盘控制) |
371+
| `WEB_BROWSER_TOOL` | 网页浏览器工具 — 在终端内嵌浏览器交互 |
372+
| `VOICE_MODE` | 语音模式 — 语音输入输出,麦克风 push-to-talk |
373+
| `WORKFLOW_SCRIPTS` | 工作流脚本 — 用户自定义自动化工作流 |
374+
| `MCP_SKILLS` | 基于 MCP 的 Skill 加载机制 |
375+
376+
### 对话管理
377+
378+
| Flag | 用途 |
379+
|------|------|
380+
| `HISTORY_SNIP` | 历史裁剪 — 手动裁剪对话历史中的片段(`/force-snip`|
381+
| `ULTRAPLAN` | 超级计划 — 远程 Agent 协作的大规模规划功能 |
382+
| `AGENT_MEMORY_SNAPSHOT` | Agent 运行时的记忆快照功能 |
383+
384+
### 基础设施 / 实验
385+
386+
| Flag | 用途 |
387+
|------|------|
388+
| `ABLATION_BASELINE` | 科学实验 — 基线消融测试,用于 A/B 实验对照组 |
389+
| `HARD_FAIL` | 硬失败模式 — 遇错直接中断而非降级 |
390+
| `TRANSCRIPT_CLASSIFIER` | 对话分类器 — `auto-mode` 命令,自动分析和分类对话记录 |
391+
| `UPLOAD_USER_SETTINGS` | 设置同步上传 — 将本地配置同步到云端 |
392+
| `LODESTONE` | 深度链接协议处理器 — 从外部应用跳转到 Claude Code 指定位置 |
393+
| `EXPERIMENTAL_SKILL_SEARCH` | 实验性 Skill 搜索索引 |
394+
| `TORCH` | Torch 功能(具体用途未知,可能是某种高亮/追踪机制) |
395+
331396
## 许可证
332397

333398
本项目仅供学习研究用途。Claude Code 的所有权利归 [Anthropic](https://www.anthropic.com/) 所有。
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
// Auto-generated type stub — replace with real implementation
22
export type CodeSession = any;
3-
export type CodeSession = any;
43
export type fetchCodeSessionsFromSessionsAPI = any;

src/components/tasks/src/tasks/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
export type BackgroundTaskState = any;
33
export type isBackgroundTask = any;
44
export type TaskState = any;
5-
export type BackgroundTaskState = any;

src/constants/outputStyles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ export async function getOutputStyleConfig(): Promise<OutputStyleConfig | null>
185185
const forcedStyles = Object.values(allStyles).filter(
186186
(style): style is OutputStyleConfig =>
187187
style !== null &&
188-
style.source === 'plugin' &&
189-
style.forceForPlugin === true,
188+
(style as any).source === 'plugin' &&
189+
(style as any).forceForPlugin === true,
190190
)
191191

192192
const firstForcedStyle = forcedStyles[0]

src/entrypoints/mcp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export async function startMCPServer(
144144
)
145145
if (validationResult && !validationResult.result) {
146146
throw new Error(
147-
`Tool ${name} input is invalid: ${validationResult.message}`,
147+
`Tool ${name} input is invalid: ${(validationResult as any).message}`,
148148
)
149149
}
150150
const finalResult = await tool.call(

src/hooks/notifs/useStartupNotification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from '../../context/notifications.js'
77
import { logError } from '../../utils/log.js'
88

9-
type Result = Notification | Notification[] | null
9+
type Result = Notification | Notification[] | null | any
1010

1111
/**
1212
* Fires notification(s) once on mount. Encapsulates the remote-mode gate and

src/hooks/toolPermission/PermissionContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function createPermissionContext(
225225
input,
226226
toolUseContext,
227227
permissionMode,
228-
suggestions,
228+
suggestions as any,
229229
toolUseContext.abortController.signal,
230230
)) {
231231
if (hookResult.permissionRequestResult) {

src/hooks/useClaudeCodeHintRecommendation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function useClaudeCodeHintRecommendation() {
9090
trigger: "hint"
9191
});
9292
if (!result.success) {
93-
throw new Error(result.error);
93+
throw new Error((result as any).error);
9494
}
9595
});
9696
break bb15;

src/hooks/useManagePlugins.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export function useManagePlugins({
190190
sum +
191191
Object.values(p.hooksConfig).reduce(
192192
(s, matchers) =>
193-
s + (matchers?.reduce((h, m) => h + m.hooks.length, 0) ?? 0),
193+
s + ((matchers as any)?.reduce((h: number, m: any) => h + m.hooks.length, 0) ?? 0),
194194
0,
195195
)
196196
)
@@ -199,8 +199,8 @@ export function useManagePlugins({
199199
return {
200200
enabled_count: enabled.length,
201201
disabled_count: disabled.length,
202-
inline_count: count(enabled, p => p.source.endsWith('@inline')),
203-
marketplace_count: count(enabled, p => !p.source.endsWith('@inline')),
202+
inline_count: count(enabled, (p: any) => p.source.endsWith('@inline')),
203+
marketplace_count: count(enabled, (p: any) => !p.source.endsWith('@inline')),
204204
error_count: errors.length,
205205
skill_count: commands.length,
206206
agent_count: agents.length,

src/hooks/useTurnDiffs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export function useTurnDiffs(messages: Message[]): TurnDiff[] {
138138
c.currentTurn = {
139139
turnIndex: c.lastTurnIndex,
140140
userPromptPreview: getUserPromptPreview(message),
141-
timestamp: message.timestamp,
141+
timestamp: message.timestamp as string,
142142
files: new Map(),
143143
stats: { filesChanged: 0, linesAdded: 0, linesRemoved: 0 },
144144
}

0 commit comments

Comments
 (0)