Commit Graph

2 Commits

Author SHA1 Message Date
kurihada e53035ffc0 refactor(core,server): 统一模块职责并消除类型重复
Core 模块职责:
- 添加 inferPermissionType() 权限类型推断函数
- 添加 partToApiFormat()/partsToApiFormat() API 格式转换函数
- 添加 ApiPart/ApiTextPart/ApiToolPart/ApiReasoningPart 类型
- 统一导出 toolRegistry 供 Server 使用

Server 模块职责:
- 重命名 PermissionRequestContext 为 PermissionDisplayContext
- 移除本地 toolRegistry,直接使用 Core 的注册表
- 使用 Core 的 inferPermissionType 替代本地实现
- 使用 Core 的 partsToApiFormat 替代手动转换

文档更新:
- 在 gui-server-client.md 添加第11章「模块职责边界」
- 明确 Core 和 Server 的职责划分
2025-12-16 21:28:19 +08:00
kurihada c44527a890 test(server): 添加 routes 模块单元测试
- agents.test.ts: Agent presets CRUD API (18 tests)
- tools.test.ts: Tool registration & execution (10 tests)
- files.test.ts: File browser API with path security (24 tests)
- commands.test.ts: Slash commands CRUD & execution (20 tests)
- hooks.test.ts: Hooks configuration management (20 tests)

覆盖率从 29.59% 提升到 60.35%,共 287 个测试
2025-12-15 00:14:27 +08:00