The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(memory): expose new capabilities and test imports
Steven Enamakel283faacd80d2
diff --git a/crates/openhuman-core/src/integrations/file_storage/tools/registry.rs b/crates/openhuman-core/src/integrations/file_storage/tools/registry.rsnew file mode 100644index 0000000000..0ae8a8e98f--- /dev/null+++ b/crates/openhuman-core/src/integrations/file_storage/tools/registry.rs@@ -0,0 +1,62 @@+//! Builds the full file-storage tool surface for a running config.++use std::path::Path;+use std::sync::Arc;++use crate::config::Config;+use crate::security::SecurityPolicy;+use crate::tools::traits::Tool;++use super::delete::StorageDeleteFileTool;+use super::download::StorageDownloadFileTool;+use super::link::StorageGetLinkTool;+use super::list::StorageListFilesTool;+use super::upload::StorageUploadFileTool;+use super::visibility::StorageSetVisibilityTool;++/// Build the file-storage tool surface. Returns empty when no integration+/// client is configured (no backend URL / not signed in), mirroring+/// `build_media_tools`.+pub fn build_file_storage_tools(root_config: &Config, action_dir: &Path) -> Vec<Box<dyn Tool>> {+ let Some(client) = crate::integrations::build_client(root_config) else {+ tracing::debug!("[file_storage] no integration client — file-storage tools skipped");+ return Vec::new();+ };++ let action_dir = action_dir.to_path_buf();+ let security = Arc::new(SecurityPolicy::from_config(+ &root_config.autonomy,+ &root_config.workspace_dir,+ &root_config.action_dir,+ ));+ let tools: Vec<Box<dyn Tool>> = vec![+ Box::new(StorageUploadFileTool::new_with_security(+ Arc::clone(&client),+ action_dir.clone(),+ Arc::clone(&security),+ )),+ Box::new(StorageDownloadFileTool::new_with_security(+ Arc::clone(&client),+ action_dir,+ Arc::clone(&security),+ )),+ Box::new(StorageListFilesTool::new(Arc::clone(&client))),+ Box::new(StorageGetLinkTool::new_with_security(+ Arc::clone(&client),+ Arc::clone(&security),+ )),+ Box::new(StorageSetVisibilityTool::new_with_security(+ Arc::clone(&client),+ Arc::clone(&security),+ )),+ Box::new(StorageDeleteFileTool::new_with_security(+ Arc::clone(&client),+ Arc::clone(&security),+ )),+ ];+ tracing::debug!(+ "[file_storage] registered {} file-storage tools",+ tools.len()+ );+ tools+}diff --git a/crates/openhuman-core/src/memory/sources/schemas/sync_schemas.rs b/crates/openhuman-core/src/memory/sources/schemas/sync_schemas.rsnew file mode 100644index 0000000000..7a05e8edeb--- /dev/null+++ b/crates/openhuman-core/src/memory/sources/schemas/sync_schemas.rs@@ -0,0 +1,84 @@+//! Schemas and handlers for the per-source sync and reconcile controllers.++use serde_json::{Map, Value};++use crate::core::all::ControllerFuture;+use crate::core::{ControllerSchema, FieldSchema, TypeSchema};+use crate::memory::sources::rpc;++use super::{parse_value, to_json, NAMESPACE};++pub(super) fn schema(function: &str) -> Option<ControllerSchema> {+ Some(match function {+ "sync" => ControllerSchema {+ namespace: NAMESPACE,+ function: "sync",+ description: "Trigger a sync for a memory source. Returns immediately; \+ progress is published as MemorySyncStageChanged events.",+ inputs: vec![FieldSchema {+ name: "source_id",+ ty: TypeSchema::String,+ comment: "Source id to sync.",+ required: true,+ }],+ outputs: vec![+ FieldSchema {+ name: "requested",+ ty: TypeSchema::Bool,+ comment: "True when the sync was queued.",+ required: true,+ },+ FieldSchema {+ name: "source_id",+ ty: TypeSchema::String,+ comment: "Echo of the requested source id.",+ required: true,+ },+ ],+ },+ "reconcile" => ControllerSchema {+ namespace: NAMESPACE,+ function: "reconcile",+ description: "Report raw-archive vs memory-tree coverage per source scope; \+ with execute=true, start a background incremental reconcile \+ (summarise + ingest) for every scope with pending files. The \+ same reconcile also runs automatically after each sync.",+ inputs: vec![+ FieldSchema {+ name: "source_id",+ ty: TypeSchema::String,+ comment: "Restrict to one source id; omit for all enabled sources.",+ required: false,+ },+ FieldSchema {+ name: "execute",+ ty: TypeSchema::Bool,+ comment: "Start background reconcile for scopes with pending files \+ (default false = report only).",+ required: false,+ },+ ],+ outputs: vec![FieldSchema {+ name: "scopes",+ ty: TypeSchema::Array(Box::new(TypeSchema::Ref("ReconcileScopeReport"))),+ comment: "Per-scope coverage: total raw files, covered, pending, started.",+ required: true,+ }],+ },+ _ => return None,+ })+}++pub(super) fn handle_sync(params: Map<String, Value>) -> ControllerFuture {+ Box::pin(async move {+ let req = parse_value::<rpc::SyncRequest>(Value::Object(params))?;+ to_json(rpc::sync_rpc(req).await?)+ })+}++pub(super) fn handle_reconcile(params: Map<String, Value>) -> ControllerFuture {+ Box::pin(async move {+ let req = parse_value::<rpc::ReconcileRequest>(Value::Object(params))?;+ to_json(rpc::reconcile_rpc(req).await?)+ })+}diff --git a/crates/openhuman-core/src/modules/memory.rs b/crates/openhuman-core/src/modules/memory.rsindex 89c68a4fe9..4ae45fece3 100644--- a/crates/openhuman-core/src/modules/memory.rs+++ b/crates/openhuman-core/src/modules/memory.rs@@ -64,7 +64,13 @@ mod people_chunks_retrieval;mod provider;mod sync_sessions_episodic;-pub(crate) use capabilities::ARTIFACT_CAPABILITIES;+pub(crate) use capabilities::{capabilities_for, ARTIFACT_CAPABILITIES, ARTIFACT_CAPABILITIES_PIN};pub use provider::{install_host_callbacks, publish_cli_boot_policy, set_modules_policy};pub(crate) use provider::policy;pub use provider::{ModuleMemoryProvider, MODULE_ID};+use provider::from_bus;+use sync_sessions_episodic::INGEST_BUS_GRACE;++#[cfg(test)]+#[allow(unused_imports)]+use {from_bus as _, INGEST_BUS_GRACE as _};diff --git a/crates/openhuman-core/src/security/credentials/ops/oauth.rs b/crates/openhuman-core/src/security/credentials/ops/oauth.rsnew file mode 100644index 0000000000..36d4a95690--- /dev/null+++ b/crates/openhuman-core/src/security/credentials/ops/oauth.rs@@ -0,0 +1,103 @@+//! Backend-brokered OAuth connect flow and integration token/key retrieval.++use serde_json::json;++use crate::api::config::effective_backend_api_url;+use crate::api::jwt::get_session_token;+use crate::api::rest::BackendOAuthClient;+use crate::config::Config;+use crate::rpc::RpcOutcome;++pub async fn oauth_connect(+ config: &Config,+ provider: &str,+ skill_id: Option<&str>,+ response_type: Option<&str>,+ encryption_mode: Option<&str>,+) -> Result<RpcOutcome<serde_json::Value>, String> {+ let api_url = effective_backend_api_url(&config.api_url);+ let token = get_session_token(config)?.ok_or_else(|| {+ "session JWT required; complete login and store_session first".to_string()+ })?;+ let client = BackendOAuthClient::new(&api_url).map_err(|e| e.to_string())?;+ let r = client+ .connect(provider, &token, skill_id, response_type, encryption_mode)+ .await+ .map_err(|e| e.to_string())?;+ Ok(RpcOutcome::single_log(+ serde_json::json!({ "oauthUrl": r.oauth_url, "state": r.state }),+ "oauth connect URL ready",+ ))+}++pub async fn oauth_list_integrations(+ config: &Config,+) -> Result<RpcOutcome<serde_json::Value>, String> {+ let api_url = effective_backend_api_url(&config.api_url);+ let token = get_session_token(config)?.ok_or_else(|| "session JWT required".to_string())?;+ let client = BackendOAuthClient::new(&api_url).map_err(|e| e.to_string())?;+ let list = client+ .list_integrations(&token)+ .await+ .map_err(|e| e.to_string())?;+ Ok(RpcOutcome::single_log(+ serde_json::to_value(&list).map_err(|e| e.to_string())?,+ "integrations listed",+ ))+}++pub async fn oauth_fetch_integration_tokens(+ config: &Config,+ integration_id: &str,+ encryption_key: &str,+) -> Result<RpcOutcome<serde_json::Value>, String> {+ let api_url = effective_backend_api_url(&config.api_url);+ let token = get_session_token(config)?.ok_or_else(|| "session JWT required".to_string())?;+ let client = BackendOAuthClient::new(&api_url).map_err(|e| e.to_string())?;+ let tokens = client+ .fetch_integration_tokens_handoff(integration_id, &token, encryption_key)+ .await+ .map_err(|e| e.to_string())?;+ Ok(RpcOutcome::single_log(+ serde_json::to_value(&tokens).map_err(|e| e.to_string())?,+ "integration tokens retrieved",+ ))+}++pub async fn oauth_fetch_client_key(+ config: &Config,+ integration_id: &str,+) -> Result<RpcOutcome<serde_json::Value>, String> {+ let api_url = effective_backend_api_url(&config.api_url);+ let token = get_session_token(config)?.ok_or_else(|| "session JWT required".to_string())?;+ let client = BackendOAuthClient::new(&api_url).map_err(|e| e.to_string())?;+ let client_key = client+ .fetch_client_key(integration_id, &token)+ .await+ .map_err(|e| e.to_string())?;+ log::debug!(+ "[credentials] client key retrieved for integration {}",+ integration_id+ );+ Ok(RpcOutcome::single_log(+ json!({ "clientKey": client_key, "integrationId": integration_id }),+ "client key retrieved (one-time handoff)",+ ))+}++pub async fn oauth_revoke_integration(+ config: &Config,+ integration_id: &str,+) -> Result<RpcOutcome<serde_json::Value>, String> {+ let api_url = effective_backend_api_url(&config.api_url);+ let token = get_session_token(config)?.ok_or_else(|| "session JWT required".to_string())?;+ let client = BackendOAuthClient::new(&api_url).map_err(|e| e.to_string())?;+ client+ .revoke_integration(integration_id, &token)+ .await+ .map_err(|e| e.to_string())?;+ Ok(RpcOutcome::single_log(+ serde_json::json!({ "revoked": true, "integrationId": integration_id }),+ "integration revoked",+ ))+}