refactor(core,server): 统一模块职责并消除类型重复

- 统一 ToolStatus 类型(Core 导出,Server 引用)
- 重命名 Server SessionManager 为 SessionMetadataManager
- 扩展 Core PermissionContext 添加结构化字段
- 统一 Part 类型导出(Core 定义存储格式,Server 定义展示格式)
- 简化 Message 格式(移除 MergedMessage,统一使用 Message)
- 添加向后兼容的类型别名和 @deprecated 注释
This commit is contained in:
2025-12-16 21:06:41 +08:00
parent 1b7d55848d
commit 0a26c3ab72
15 changed files with 177 additions and 95 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ import { getSessionManager } from '../session/manager.js';
import {
CreateSessionInputSchema,
type ToolCallInfo,
type MergedMessage,
type Message,
type MessagePart,
} from '../types.js';
import type { MessageInfo, Part, ToolPart } from '@ai-assistant/core';
@@ -131,7 +131,7 @@ sessionsRouter.get('/:id/messages', async (c) => {
const messageInfos = await MessageStorage.listBySession(id);
// 转换为前端格式
const messages: MergedMessage[] = [];
const messages: Message[] = [];
for (const msgInfo of messageInfos) {
const parts = await PartStorage.getByIds(msgInfo.id, msgInfo.partIds);