Files
zclaw_openfang/desktop/src-tauri/src/intelligence/mod.rs
iven 13507682f7
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
feat(growth,skills,saas,desktop): C线差异化全量实现 — C1日报+C2飞轮+C3引导
C3 零配置引导 (P0):
- use-cold-start.ts: 4阶段→6阶段对话驱动状态机 (idle→greeting→industry→identity→task→completed)
- cold-start-mapper.ts: 关键词行业检测 + 肯定/否定/名字提取
- cold_start_prompt.rs: Rust侧6阶段system prompt生成 + 7个测试
- FirstConversationPrompt.tsx: 动态行业卡片 + 行业任务引导 + 通用快捷操作

C1 管家日报 (P0):
- kernel注册DailyReportHand (第8个Hand)
- DailyReportPanel.tsx已存在,事件监听+持久化完整

C2 行业知识飞轮 (P1):
- heartbeat.rs: 经验缓存(EXPERIENCE_CACHE) + check_unresolved_pains增强经验感知
- heartbeat_update_experiences Tauri命令 + VikingStorage持久化
- semantic_router.rs: 经验权重boost(0.05*ln(count+1), 上限0.15) + update_experience_boosts方法
- service.rs: auto_optimize_config() 基于使用频率自动优化行业skill_priorities

验证: tsc 0 errors, cargo check 0 warnings, 7 cold_start + 5 daily_report + 1 experience_boost tests PASS
2026-04-21 18:28:45 +08:00

68 lines
2.3 KiB
Rust

//! Intelligence Layer - Migrated from frontend lib/
//!
//! This module contains the intelligence components that were previously
//! implemented in TypeScript/JavaScript in the frontend.
//!
//! ## Modules
//!
//! - `heartbeat` - Periodic proactive checks with quiet hours support
//! - `compactor` - Context compaction for infinite-length conversations
//! - `reflection` - Agent self-improvement through conversation analysis
//! - `identity` - Agent identity file management (SOUL.md, AGENTS.md, USER.md)
//!
//! ## Migration Status
//!
//! | Component | Status | Notes |
//! |-----------|--------|-------|
//! | Heartbeat Engine | ✅ Active | Integrated via intelligence_hooks |
//! | Context Compactor | ✅ Active | Integrated in kernel AgentLoop |
//! | Reflection Engine | ✅ Active | Integrated via intelligence_hooks |
//! | Agent Identity | ✅ Active | Integrated via intelligence_hooks |
//!
//! Removed (dead code, never called from frontend):
//! - `pattern_detector` - 2026-03-26
//! - `recommender` - 2026-03-26 (was only used by mesh)
//! - `mesh` - 2026-03-26
//! - `trigger_evaluator` - 2026-03-26
//! - `persona_evolver` - 2026-03-26
// Hermes 管线子模块:部分函数由 Tauri 命令或中间件 hooks 按需调用,
// 编译期无法检测到跨 crate 引用,统一抑制 dead_code 警告。
#![allow(dead_code)]
pub mod heartbeat;
pub mod compactor;
pub mod reflection;
pub mod identity;
pub mod validation;
pub mod extraction_adapter;
pub mod pain_aggregator;
pub mod solution_generator;
pub mod personality_detector;
pub mod pain_storage;
pub mod experience;
pub mod triggers;
pub mod user_profiler;
pub mod trajectory_compressor;
pub mod health_snapshot;
pub mod cold_start_prompt;
// Re-export main types for convenience
pub use heartbeat::HeartbeatEngineState;
pub use reflection::{
ReflectionEngine, ReflectionEngineState,
};
pub use identity::{
AgentIdentityManager, IdentityManagerState,
};
// Suppress dead-code warnings for extraction adapter accessors — they are
// consumed externally via full path (crate::intelligence::extraction_adapter::*).
#[allow(unused_imports)]
use extraction_adapter::{
configure_extraction_driver as _,
is_extraction_driver_configured as _,
get_extraction_driver as _,
TauriExtractionDriver as _,
};