新增: namespace淘汰治理与可恢复会话分组

- namespace 淘汰治理: pin 机制(关键产出 LRU 永不淘汰, 超池 50% 最旧降级) + EvictionLog 留档富提示(原工具名+内容摘要+重调指引) + owner 软隔离(无主最旧先淘); 子代理报告出口 pin 收编
- 错误路径广播 AiAgentFinished(status=error): 错误任务有终态, watcher/任务卡可收敛
- 桌面侧栏可恢复分组: parked 会话独立分组+点击恢复, 断点续跑读侧闭环
- 验收: cargo check 零 error + vue-tsc EXIT 0
This commit is contained in:
lxy
2026-10-06 23:48:45 +08:00
parent 1ce1360a0b
commit ece7cd3fa8
8 changed files with 369 additions and 17 deletions
+19 -1
View File
@@ -1835,7 +1835,10 @@ async fn prepare_round_inputs(
path = %path,
"[namespace] 引用已淘汰,替换为提示文案"
);
m.content = df_ai::namespace_store::EVICTED_PLACEHOLDER.to_string();
m.content = session
.namespace_store
.eviction_rich_notice(&path)
.unwrap_or_else(|| df_ai::namespace_store::EVICTED_PLACEHOLDER.to_string());
}
}
}
@@ -2704,6 +2707,21 @@ pub(crate) async fn emit_fatal_error(app_handle: &AppHandle, conv_id: &str, erro
error_type: Some(error_type),
conversation_id: Some(conv_id.to_string()),
});
// #23 修复:错误路径也广播 AiAgentFinished(status=error)——原只发 AiError,飞书
// completion_watcher 只消费 AiAgentFinished → 错误任务永不收敛(watcher 空等到二次
// 超时弃守,且无失败终态)。单一事实源在引擎层,订阅方(飞书 watcher/桌面任务卡)各自消费。
app_handle.state::<AppState>().ai_event_bus.publish_event(
AiChatEvent::AiAgentFinished {
agent_id: conv_id.to_string(),
conversation_id: Some(conv_id.to_string()),
summary: format!("任务失败: {}", error.chars().take(300).collect::<String>()),
status: "error".to_string(),
rounds: 0,
tokens: 0,
rejected_tools: None,
stop_kind: Some("error".to_string()),
},
);
// P1 bg 化:失败系统通知(条件发送,失败静默)。正文截断防长堆栈撑爆系统气泡。
let brief: String = error.chars().take(160).collect();
crate::commands::ai::notify::notify_session_event(