新增: Phase2 阶段收尾(Sprint 1-20)

重构:删 5 零引用 crate(df-evolve/plugin/stages/task/traceability)+ 清死模块、ai.rs 拆 11 子 module、ai.ts 拆 6 composable、i18n 拆目录
功能:知识库全栈(df-project/scan + CRUD + 时间线 + 前端)、Settings 拆分、appSettings KV 迁移、模型池、LLM 并发 Semaphore
修复:审批持久化根治、ConditionEngine 默认拒绝、NodeRegistry unimplemented 清除、promote 补偿删除、工具结果截断 50KB、路径校验防 symlink 逃逸
文档:B-03 人工审批设计、决策记录三分档、规格契约自检、经验记录、todo 看板、PROGRESS 更新

详见 PROGRESS.md。src-tauri/儿童每日打卡应用/ 与本项目无关,已排除。
This commit is contained in:
2026-06-14 14:08:20 +08:00
parent 98393b4908
commit cf017f81e2
167 changed files with 19549 additions and 6886 deletions

View File

@@ -36,6 +36,10 @@ pub struct ProjectRecord {
pub description: String,
pub status: String,
pub idea_id: Option<String>,
/// 绑定的本地代码目录(绝对路径,可空=未绑定,第二步导入历史项目时复用)
pub path: Option<String>,
/// 技术栈 JSON 数组字符串(如 ["rust","vue","tauri"],由探测填充,可空)
pub stack: Option<String>,
pub created_at: String,
pub updated_at: String,
}
@@ -149,6 +153,10 @@ pub struct AiConversationRecord {
pub messages: String, // JSON array of ChatMessage
pub provider_id: Option<String>,
pub model: Option<String>,
pub models: Option<String>, // 用过的所有 model(JSON 数组字符串,去重)
pub archived: bool, // 是否归档(侧栏折叠展示)
pub prompt_tokens: Option<i64>, // 输入 token 累计(流式 usage 落库)
pub completion_tokens: Option<i64>, // 输出 token 累计(流式 usage 落库)
pub created_at: String,
pub updated_at: String,
}
@@ -168,3 +176,37 @@ pub struct AiToolExecutionRecord {
pub executed_at: Option<String>,
pub decided_by: Option<String>, // human/auto
}
// ============================================================
// 知识库模型 (V7)
// ============================================================
/// 知识条目记录(经验沉淀基本单元,共享记忆层)
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct KnowledgeRecord {
pub id: String,
pub kind: String, // KnowledgeKind snake_case(7 种)
pub title: String,
pub content: String,
pub tags: Option<String>, // JSON 数组字符串
pub status: String, // candidate|pending_review|published|archived
pub confidence: Option<String>, // high|medium|low(AI 提炼自评,可空)
pub reuse_count: i32, // 唯一客观排序信号
pub verified: bool, // 发布审核时一次性人工标
pub source_project: Option<String>, // 来源项目(仅溯源不过滤)
pub source_ref: Option<String>, // 来源实体引用(如 conv:{id})
pub reasoning: Option<String>, // AI 提炼判断依据("为何值得沉淀"),手动录入为 None
pub created_at: String,
pub updated_at: String,
}
/// 知识生命线事件记录(追加型审计:产生/审核/引用/归档)
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct KnowledgeEventRecord {
pub id: String,
pub knowledge_id: String,
pub event_type: String, // created | extracted | status_changed | referenced | archived
pub source_ref: Option<String>, // 触发来源: conv:{id} / manual / system
pub context_json: Option<String>, // JSON: 因 event_type 而异
pub timestamp: String,
}