feat: P0 KernelClient功能修复 + P1/P2/P3质量改进
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

P0 KernelClient 功能断裂修复:
- Skill CUD: registry.rs create/update/delete + serialize_skill_md + kernel proxy
- Workflow CUD: pipeline_commands.rs create/update/delete + serde_yaml依赖
- Agent更新: registry update方法 + AgentConfigUpdated事件 + agent_update命令
- Hand流式事件: HandStart/HandEnd变体替换ToolStart/ToolEnd
- 后端验证: hand_get/hand_run_status/hand_run_list确认实现完整
- Approval闭环: respond_to_approval后台spawn+5分钟超时轮询

P2/P3 质量改进:
- Browser WebDriver: TCP探测ChromeDriver/GeckoDriver/Edge端口替换硬编码true
- api-fallbacks: 移除假技能和16个捏造安全层,替换为真实能力映射
- dead_code清理: 移除5个模块级#![allow(dead_code)],删除3个真正死方法,
  删除未注册的compactor_compact_llm命令,warnings从8降到3
- 所有变更通过cargo check + tsc --noEmit验证
This commit is contained in:
iven
2026-03-30 10:55:08 +08:00
parent d345e60a6a
commit 813b49a986
19 changed files with 951 additions and 102 deletions

View File

@@ -14,7 +14,6 @@
// NOTE: #[tauri::command] functions are registered via invoke_handler! at runtime,
// which the Rust compiler does not track as "use". Module-level allow required
// for Tauri-commanded functions. Genuinely unused methods annotated individually.
#![allow(dead_code)]
use serde::{Deserialize, Serialize};
use regex::Regex;
@@ -99,6 +98,8 @@ pub struct CompactionCheck {
}
/// Configuration for LLM-based summary generation
/// NOTE: Reserved for future LLM compaction Tauri command
#[allow(dead_code)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LlmSummaryConfig {
pub provider: String,
@@ -250,6 +251,7 @@ impl ContextCompactor {
/// - `use_llm` is false
/// - LLM config is not provided
/// - LLM call fails and `llm_fallback_to_rules` is true
#[allow(dead_code)] // Reserved: Tauri command removed during refactor, will be re-registered
pub async fn compact_with_llm(
&self,
messages: &[CompactableMessage],
@@ -499,18 +501,6 @@ impl ContextCompactor {
conclusions.into_iter().take(3).collect()
}
/// Get current configuration
#[allow(dead_code)] // Reserved: no Tauri command yet
pub fn get_config(&self) -> &CompactionConfig {
&self.config
}
/// Update configuration
#[allow(dead_code)] // Reserved: no Tauri command yet
pub fn update_config(&mut self, updates: CompactionConfig) {
self.config = updates;
}
}
// === Tauri Commands ===
@@ -561,33 +551,6 @@ pub async fn compactor_compact(
result
}
/// Execute compaction with optional LLM-based summary
#[tauri::command]
pub async fn compactor_compact_llm(
messages: Vec<CompactableMessage>,
agent_id: String,
conversation_id: Option<String>,
compaction_config: Option<CompactionConfig>,
llm_config: Option<LlmSummaryConfig>,
) -> CompactionResult {
let memory_flush = compaction_config
.as_ref()
.map(|c| c.memory_flush_enabled)
.unwrap_or(false);
let flushed = if memory_flush {
flush_old_messages_to_memory(&messages, &agent_id, conversation_id.as_deref()).await
} else {
0
};
let compactor = ContextCompactor::new(compaction_config);
let mut result = compactor
.compact_with_llm(&messages, &agent_id, conversation_id.as_deref(), llm_config.as_ref())
.await;
result.flushed_memories = flushed;
result
}
/// Flush important messages from the old (pre-compaction) portion to VikingStorage.
///
/// Extracts user messages and key assistant responses as session memories