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 的职责划分
This commit is contained in:
@@ -51,13 +51,26 @@ export type {
|
||||
ToolState,
|
||||
TodoItem,
|
||||
TodoList,
|
||||
// API 格式类型
|
||||
ApiPart,
|
||||
ApiTextPart,
|
||||
ApiToolPart,
|
||||
ApiReasoningPart,
|
||||
} from './session/index.js';
|
||||
|
||||
// API 格式转换函数
|
||||
export {
|
||||
partsToApiFormat,
|
||||
partToApiFormat,
|
||||
getToolInput,
|
||||
getToolDuration,
|
||||
} from './session/index.js';
|
||||
|
||||
// Types
|
||||
export type { UserInput, ChatResult } from './types/index.js';
|
||||
|
||||
// Permission
|
||||
export { getPermissionManager } from './permission/index.js';
|
||||
export { getPermissionManager, inferPermissionType } from './permission/index.js';
|
||||
export type {
|
||||
PermissionType,
|
||||
PermissionContext,
|
||||
|
||||
Reference in New Issue
Block a user