feat(audit): 审计修复第四轮 — 跨会话搜索、LLM压缩集成、Presentation渲染器
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

- S9: MessageSearch 新增 Session/Global 双模式,Global 调用 VikingStorage memory_search
- M4b: LLM 压缩器集成到 kernel AgentLoop,支持 use_llm 配置切换
- M4c: 压缩时自动提取记忆到 VikingStorage (runtime + tauri 双路径)
- H6: 新增 ChartRenderer(recharts)、Document/Slideshow 完整渲染
- 累计修复 23 项,整体完成度 ~72%,真实可用率 ~80%
This commit is contained in:
iven
2026-03-27 11:44:14 +08:00
parent 7ae6990c97
commit 30b2515f07
16 changed files with 2121 additions and 245 deletions

View File

@@ -12,7 +12,7 @@ use crate::tool::{ToolRegistry, ToolContext, SkillExecutor};
use crate::tool::builtin::PathValidator;
use crate::loop_guard::{LoopGuard, LoopGuardResult};
use crate::growth::GrowthIntegration;
use crate::compaction;
use crate::compaction::{self, CompactionConfig};
use zclaw_memory::MemoryStore;
/// Agent loop runner
@@ -32,6 +32,8 @@ pub struct AgentLoop {
growth: Option<GrowthIntegration>,
/// Compaction threshold in tokens (0 = disabled)
compaction_threshold: usize,
/// Compaction behavior configuration
compaction_config: CompactionConfig,
}
impl AgentLoop {
@@ -55,6 +57,7 @@ impl AgentLoop {
path_validator: None,
growth: None,
compaction_threshold: 0,
compaction_config: CompactionConfig::default(),
}
}
@@ -115,6 +118,12 @@ impl AgentLoop {
self
}
/// Set compaction configuration (LLM mode, memory flushing, etc.)
pub fn with_compaction_config(mut self, config: CompactionConfig) -> Self {
self.compaction_config = config;
self
}
/// Get growth integration reference
pub fn growth(&self) -> Option<&GrowthIntegration> {
self.growth.as_ref()
@@ -150,7 +159,23 @@ impl AgentLoop {
// Apply compaction if threshold is configured
if self.compaction_threshold > 0 {
messages = compaction::maybe_compact(messages, self.compaction_threshold);
let needs_async =
self.compaction_config.use_llm || self.compaction_config.memory_flush_enabled;
if needs_async {
let outcome = compaction::maybe_compact_with_config(
messages,
self.compaction_threshold,
&self.compaction_config,
&self.agent_id,
&session_id,
Some(&self.driver),
self.growth.as_ref(),
)
.await;
messages = outcome.messages;
} else {
messages = compaction::maybe_compact(messages, self.compaction_threshold);
}
}
// Enhance system prompt with growth memories
@@ -316,7 +341,23 @@ impl AgentLoop {
// Apply compaction if threshold is configured
if self.compaction_threshold > 0 {
messages = compaction::maybe_compact(messages, self.compaction_threshold);
let needs_async =
self.compaction_config.use_llm || self.compaction_config.memory_flush_enabled;
if needs_async {
let outcome = compaction::maybe_compact_with_config(
messages,
self.compaction_threshold,
&self.compaction_config,
&self.agent_id,
&session_id,
Some(&self.driver),
self.growth.as_ref(),
)
.await;
messages = outcome.messages;
} else {
messages = compaction::maybe_compact(messages, self.compaction_threshold);
}
}
// Enhance system prompt with growth memories