refactor(server): 消除与 Core 的重复类型定义

- 删除 Server 中 60+ 个与 Core 重复的类型定义
- 将动态导入 (await import) 改为静态类型导入 (import type)
- 保留必要的运行时静态导入
- 修复测试文件中的 mock 初始化问题
- 净删除约 960 行重复代码

重构文件:
- routes/checkpoints.ts: 删除 155 行重复类型
- routes/agents.ts: 删除 93 行重复类型
- routes/commands.ts: 删除 83 行重复类型
- routes/mcp.ts: 修复类型窄化
- routes/hooks.ts: 已使用静态导入
- routes/providers.ts: 删除 63 行重复类型
- session/manager.ts: 删除 41 行重复类型
- routes/sessions.ts: 添加类型导入
- permission/handler.ts: 添加类型导入
This commit is contained in:
2025-12-16 20:19:24 +08:00
parent 026429cb2f
commit 1b7d55848d
14 changed files with 283 additions and 1240 deletions
+1 -18
View File
@@ -11,24 +11,7 @@ import type {
PermissionRequestContext,
ServerMessage,
} from '../types.js';
/**
* 权限决策结果
*/
export interface PermissionDecision {
allow: boolean;
remember?: boolean;
}
/**
* 权限上下文(来自 core 模块)
*/
export interface PermissionContext {
command: string;
workdir: string;
patterns?: string[];
externalPaths?: string[];
}
import type { PermissionDecision, PermissionContext } from '@ai-assistant/core';
// 等待中的权限请求
interface PendingRequest {