Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(rust): clean build warnings (#2362)
Hao Zhe1194866e8f20
diff --git a/Cargo.toml b/Cargo.tomlindex ce34f9e19..9aa6944d8 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -6,3 +6,6 @@ resolver = "2"opt-level = 3lto = truestrip = true++[profile.release.package.ragfs]+codegen-units = 1diff --git a/crates/ov_cli/src/base_client.rs b/crates/ov_cli/src/base_client.rsindex 42c33b9a9..f2bbef96c 100644--- a/crates/ov_cli/src/base_client.rs+++ b/crates/ov_cli/src/base_client.rs@@ -151,25 +151,6 @@ pub struct BaseClient {}impl BaseClient {- /// Create a new BaseClient with minimal configuration for health probing- pub fn new_simple(base_url: impl Into<String>, timeout_secs: f64) -> Self {- let http = ReqwestClient::builder()- .timeout(std::time::Duration::from_secs_f64(timeout_secs))- .build()- .expect("Failed to build HTTP client");-- Self {- http,- base_url: base_url.into().trim_end_matches('/').to_string(),- api_key: None,- account: None,- user: None,- agent_id: None,- profile_enabled: false,- extra_headers: None,- }- }-pub fn new(base_url: impl Into<String>,api_key: Option<String>,@@ -205,10 +186,6 @@ impl BaseClient {merged}- pub fn base_url(&self) -> &str {- &self.base_url- }-pub fn user_id(&self) -> Option<&str> {self.user.as_deref()}diff --git a/crates/ov_cli/src/client.rs b/crates/ov_cli/src/client.rsindex c792d15d3..1e427357d 100644--- a/crates/ov_cli/src/client.rs+++ b/crates/ov_cli/src/client.rs@@ -128,7 +128,7 @@ impl HttpClient {// ============ File Helper Methods ============- fn create_uploader(&self) -> FileUploader {+ fn create_uploader(&self) -> FileUploader<'_> {FileUploader::new(&self.base).with_upload_mode(self.upload_mode())}diff --git a/crates/ov_cli/src/commands/chat.rs b/crates/ov_cli/src/commands/chat.rsindex 2cab52c24..46ce212aa 100644--- a/crates/ov_cli/src/commands/chat.rs+++ b/crates/ov_cli/src/commands/chat.rs@@ -93,8 +93,6 @@ struct ChatResponse {session_id: String,message: String,#[serde(default)]- response_id: Option<String>,- #[serde(default)]events: Option<Vec<serde_json::Value>>,}@@ -103,7 +101,6 @@ struct ChatResponse {struct ChatStreamEvent {event: String, // "reasoning", "tool_call", "tool_result", "response"data: serde_json::Value,- timestamp: Option<String>,}struct ChatAuth {diff --git a/crates/ov_cli/src/error.rs b/crates/ov_cli/src/error.rsindex 671e8e8b6..02b29a256 100644--- a/crates/ov_cli/src/error.rs+++ b/crates/ov_cli/src/error.rs@@ -37,76 +37,3 @@ pub enum Error {}pub type Result<T> = std::result::Result<T, Error>;--/// CLI-specific error type for command handlers-#[derive(Error, Debug)]-#[error("{message}")]-pub struct CliError {- pub message: String,- pub code: String,- pub exit_code: i32,-}--impl CliError {- pub fn new(message: impl Into<String>) -> Self {- Self {- message: message.into(),- code: "CLI_ERROR".to_string(),- exit_code: 1,- }- }-- pub fn config(message: impl Into<String>) -> Self {- Self {- message: message.into(),- code: "CLI_CONFIG".to_string(),- exit_code: 2,- }- }-- pub fn network(message: impl Into<String>) -> Self {- Self {- message: message.into(),- code: "CONNECTION_ERROR".to_string(),- exit_code: 3,- }- }-}--impl From<Error> for CliError {- fn from(err: Error) -> Self {- match err {- Error::Config(msg) => CliError::config(msg),- Error::Network(msg) => CliError::network(msg),- Error::Api(msg) => CliError::new(msg),- Error::Client(msg) => CliError::new(format!("Client error: {}", msg)),- Error::Parse(msg) => CliError::new(format!("Parse error: {}", msg)),- Error::Output(msg) => CliError::new(format!("Output error: {}", msg)),- Error::InvalidPath(msg) => CliError::new(format!("Invalid path: {}", msg)),- Error::Io(e) => CliError::new(format!("IO error: {}", e)),- Error::Serialization(e) => CliError::new(format!("Serialization error: {}", e)),- Error::Zip(e) => CliError::new(format!("Zip error: {}", e)),- Error::AlreadyReported => CliError::new("already reported"),- }- }-}--impl From<reqwest::Error> for CliError {- fn from(err: reqwest::Error) -> Self {- if err.is_connect() || err.is_timeout() {- CliError::network(format!(- "Failed to connect to OpenViking server. \- Check the url in ovcli.conf and ensure the server is running. ({})",- err- ))- } else {- CliError::new(format!("HTTP error: {}", err))- }- }-}--impl From<serde_json::Error> for CliError {- fn from(err: serde_json::Error) -> Self {- CliError::new(format!("JSON error: {}", err))- }-}diff --git a/crates/ov_cli/src/tui/image_preview.rs b/crates/ov_cli/src/tui/image_preview.rsindex 266f65223..371b5f2fe 100644--- a/crates/ov_cli/src/tui/image_preview.rs+++ b/crates/ov_cli/src/tui/image_preview.rs@@ -54,16 +54,6 @@ impl ImagePreviewer {}}- /// Check if viuer is available (it always is, since it's a library)- pub fn is_available() -> bool {- true- }-- /// Get installation instructions (not needed for viuer)- pub fn installation_instructions() -> &'static str {- "Image preview is available (using viuer)"- }-/// Initialize the image previewer (nothing to do for viuer)pub fn init(&mut self) -> Result<(), String> {self.log("Initialized viuer image previewer");@@ -76,16 +66,6 @@ impl ImagePreviewer {*self.preview_area.lock().unwrap() = Some(area);}- /// Get the preview area- pub fn preview_area(&self) -> Option<PreviewArea> {- *self.preview_area.lock().unwrap()- }-- /// Check if an image is currently displayed- pub fn has_image_displayed(&self) -> bool {- self.current_image.lock().unwrap().is_some()- }-/// Display an image at the last known preview areapub fn display_image(&mut self, image_path: &str) -> Result<(), String> {let preview_area = *self.preview_area.lock().unwrap();diff --git a/crates/ov_cli/src/tui/ui.rs b/crates/ov_cli/src/tui/ui.rsindex 51afb5513..0851a114d 100644--- a/crates/ov_cli/src/tui/ui.rs+++ b/crates/ov_cli/src/tui/ui.rs@@ -8,10 +8,6 @@ use ratatui::{use super::app::{App, Panel};-pub fn render(frame: &mut Frame, app: &App) {- let _ = render_with_content_area(frame, app);-}-/// Render the UI and return the content area rect for image previewpub fn render_with_content_area(frame: &mut Frame, app: &App) -> (Rect, Rect) {let chunks = Layout::default()diff --git a/crates/ragfs/Cargo.toml b/crates/ragfs/Cargo.tomlindex ae30a2bd6..935589f95 100644--- a/crates/ragfs/Cargo.toml+++ b/crates/ragfs/Cargo.toml@@ -98,12 +98,3 @@ criterion = "0.5"default = []s3 = ["aws-sdk-s3", "aws-config", "aws-types"]full = ["s3"]--[profile.release]-opt-level = 3-lto = true-strip = true-codegen-units = 1--[profile.dev]-opt-level = 0\ No newline at end of filediff --git a/crates/ragfs/src/plugins/kvfs/mod.rs b/crates/ragfs/src/plugins/kvfs/mod.rsindex 3ced5969c..9f4d7b9b9 100644--- a/crates/ragfs/src/plugins/kvfs/mod.rs+++ b/crates/ragfs/src/plugins/kvfs/mod.rs@@ -65,20 +65,6 @@ impl KVFileSystem {}}- /// Get parent directory path- fn parent_key(key: &str) -> Option<String> {- if key == "/" || !key.contains('/') {- return Some("/".to_string());- }-- let parts: Vec<&str> = key.split('/').collect();- if parts.len() <= 1 {- return Some("/".to_string());- }-- Some(parts[..parts.len() - 1].join("/"))- }-/// List all keys with a given prefixfn list_keys_with_prefix(&self, store: &HashMap<String, KVEntry>, prefix: &str) -> Vec<String> {let search_prefix = if prefix == "/" {diff --git a/crates/ragfs/src/plugins/queuefs/backend.rs b/crates/ragfs/src/plugins/queuefs/backend.rsindex 8ee7302db..f22693016 100644--- a/crates/ragfs/src/plugins/queuefs/backend.rs+++ b/crates/ragfs/src/plugins/queuefs/backend.rs@@ -354,10 +354,6 @@ impl SQLiteQueueBackend {created_at INTEGER DEFAULT (strftime('%s', 'now')));- CREATE INDEX IF NOT EXISTS idx_queue_status- ON queue_messages(queue_name, status, id);- CREATE INDEX IF NOT EXISTS idx_queue_message_id- ON queue_messages(queue_name, message_id);"#,).map_err(|e| Error::internal(format!("sqlite schema init error: {}", e)))?;@@ -429,15 +425,6 @@ impl SQLiteQueueBackend {Ok(changed)}- fn ensure_queue_exists(conn: &Connection, queue_name: &str) -> Result<()> {- conn.execute(- "INSERT OR IGNORE INTO queue_metadata (queue_name) VALUES (?1)",- params![queue_name],- )- .map_err(|e| Error::internal(format!("sqlite ensure queue error: {}", e)))?;- Ok(())- }-fn queue_known(conn: &Connection, queue_name: &str) -> Result<bool> {let metadata_count: i64 = conn.query_row(@@ -984,6 +971,28 @@ mod tests {SQLiteQueueBackend::open(&db_path_str, SQLiteQueueOptions::default()).unwrap();assert!(backend.queue_exists("legacy/semantic"));assert_eq!(backend.list_queues("legacy"), vec!["legacy/semantic"]);+ drop(backend);++ let conn = Connection::open(&db_path_str).unwrap();+ let migrated_indexes = conn+ .prepare(+ "SELECT name FROM sqlite_master+ WHERE type = 'index'+ AND name IN ('idx_queue_message_id', 'idx_queue_status')+ ORDER BY name",+ )+ .unwrap()+ .query_map([], |row| row.get::<_, String>(0))+ .unwrap()+ .collect::<std::result::Result<Vec<_>, _>>()+ .unwrap();+ assert_eq!(+ migrated_indexes,+ vec![+ "idx_queue_message_id".to_string(),+ "idx_queue_status".to_string()+ ]+ );}#[test]