优化: run_command 实时流式 + 审批浮窗修复 + 文档探索闭环(fetch_url+obscura引导+model_fetch兼容+prompt策略+厂商预设)

This commit is contained in:
lxy
2026-08-01 17:58:47 +08:00
parent 0e0c6862ba
commit d664bdc309
25 changed files with 1693 additions and 44 deletions
+15
View File
@@ -30,11 +30,13 @@ pub mod agentic;
pub mod augmentation;
pub mod audit;
pub mod code_intel;
pub mod command_stream;
pub mod commands;
pub mod compress;
pub mod conversation;
pub mod event_bus;
pub mod http;
pub mod fetch_url;
pub mod knowledge_inject;
pub mod prompt;
pub mod provider_pool;
@@ -119,6 +121,19 @@ pub enum AiChatEvent {
AiToolCallStarted { id: String, name: String, args: serde_json::Value, conversation_id: Option<String> },
/// 工具调用完成
AiToolCallCompleted { id: String, result: serde_json::Value, conversation_id: Option<String> },
/// run_command 实时流式输出(治执行中黑盒)。
///
/// execute_with_heartbeat / ai_approve 调用 run_command 前,经 task-local sink 注入
/// (AppHandle + tool_call_id + conv_id)。run_command handler 读 task-local,改走 shell
/// `execute_streaming`,每读一行 stdout/stderr 即 emit 本事件(双写 app.emit + ai_event_bus)。
/// 前端 listen 此事件可在工具卡 Started→Completed 间实时展示进度(编译/构建输出)。
///
/// 字段:
/// - `id`:tool_call_id(对齐 Started/Completed,前端按 id 路由到对应工具卡)
/// - `stream`:"stdout" | "stderr"(来源流,前端可差异化着色)
/// - `line`:单行内容(已去换行,行级粒度 emit)
/// - `conversation_id`:多对话路由
AiCommandOutput { id: String, stream: String, line: String, conversation_id: Option<String> },
/// 会话级信任自动放行(AE-2025-04 Session Trust):
/// 同会话已批准过同类操作(同工具+同目录),下次命中自动放行,前端显示轻量 toast。
/// 与 AiToolCallStarted/Completed 正交——这三个事件描述一次信任放行调用生命周期: