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
style(app): rustfmt the session module
Steven Enamakeldb41a44c3cdd
diff --git a/crates/openhuman-app/src/session/commands.rs b/crates/openhuman-app/src/session/commands.rsindex ef943b8d1f..7f53dcf306 100644--- a/crates/openhuman-app/src/session/commands.rs+++ b/crates/openhuman-app/src/session/commands.rs@@ -30,20 +30,30 @@ pub(crate) async fn auth_store_session(token: String,user: Option<serde_json::Value>,) -> Result<SessionState, String> {- log::info!("[session][cmd] auth_store_session has_user={}", user.is_some());- host.manager.store_session_token(&token, user).await.map_err(err)+ log::info!(+ "[session][cmd] auth_store_session has_user={}",+ user.is_some()+ );+ host.manager+ .store_session_token(&token, user)+ .await+ .map_err(err)}/// Sign out: clear the session credential in the core.#[tauri::command]-pub(crate) async fn auth_logout(host: tauri::State<'_, SessionHost>) -> Result<SessionState, String> {+pub(crate) async fn auth_logout(+ host: tauri::State<'_, SessionHost>,+) -> Result<SessionState, String> {log::info!("[session][cmd] auth_logout");host.manager.logout().await.map_err(err)}/// The core's credential state plus the cached current user.#[tauri::command]-pub(crate) async fn auth_state(host: tauri::State<'_, SessionHost>) -> Result<SessionState, String> {+pub(crate) async fn auth_state(+ host: tauri::State<'_, SessionHost>,+) -> Result<SessionState, String> {host.manager.state().await.map_err(err)}diff --git a/crates/openhuman-app/src/session/link.rs b/crates/openhuman-app/src/session/link.rsindex e8934fcfa9..6765a0aeb3 100644--- a/crates/openhuman-app/src/session/link.rs+++ b/crates/openhuman-app/src/session/link.rs@@ -23,9 +23,8 @@ impl HttpCoreLink {/// Decode a JSON-RPC 2.0 response body into its `result`, or the error/// message.pub(crate) fn decode_rpc_response(status: u16, body: &str) -> Result<Value, String> {- let parsed: Value = serde_json::from_str(body).map_err(|e| {- format!("core rpc returned a non-JSON body (http {status}): {e}")- })?;+ let parsed: Value = serde_json::from_str(body)+ .map_err(|e| format!("core rpc returned a non-JSON body (http {status}): {e}"))?;if let Some(error) = parsed.get("error").filter(|e| !e.is_null()) {let message = error.get("message")@@ -51,7 +50,10 @@ impl CoreLink for HttpCoreLink {"params": params,}).to_string();- log::debug!("[session][link] {method} -> {}", openhuman_rpc::redact_url_for_log(&url));+ log::debug!(+ "[session][link] {method} -> {}",+ openhuman_rpc::redact_url_for_log(&url)+ );let token = (!token.is_empty()).then_some(token);let response = crate::core_rpc::post_json_rpc(&url, token.as_deref(), body).await?;decode_rpc_response(response.status, &response.body)diff --git a/crates/openhuman-app/src/session/link_tests.rs b/crates/openhuman-app/src/session/link_tests.rsindex 2d01d989db..3933a3c59f 100644--- a/crates/openhuman-app/src/session/link_tests.rs+++ b/crates/openhuman-app/src/session/link_tests.rs@@ -3,7 +3,11 @@ use serde_json::json;#[test]fn decodes_result_and_error_envelopes() {- let ok = decode_rpc_response(200, r#"{"jsonrpc":"2.0","id":1,"result":{"isAuthenticated":true}}"#).unwrap();+ let ok = decode_rpc_response(+ 200,+ r#"{"jsonrpc":"2.0","id":1,"result":{"isAuthenticated":true}}"#,+ )+ .unwrap();assert_eq!(ok, json!({ "isAuthenticated": true }));let err = decode_rpc_response(diff --git a/crates/openhuman-app/src/session/mod.rs b/crates/openhuman-app/src/session/mod.rsindex ea84eda803..9ce0cb8ce2 100644--- a/crates/openhuman-app/src/session/mod.rs+++ b/crates/openhuman-app/src/session/mod.rs@@ -69,8 +69,12 @@ pub fn install(app: &AppHandle<AppRuntime>, desktop: CoreProcessHandle) {}}Ok(SessionEvent::Expired { source }) => {- log::warn!("[session] backend rejected the stored credential (source={source})");- if let Err(e) = handle.emit(AUTH_EXPIRED_EVENT, serde_json::json!({ "source": source })) {+ log::warn!(+ "[session] backend rejected the stored credential (source={source})"+ );+ if let Err(e) =+ handle.emit(AUTH_EXPIRED_EVENT, serde_json::json!({ "source": source }))+ {log::debug!("[session] failed to emit {AUTH_EXPIRED_EVENT}: {e}");}}