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: apply rustfmt formatting across wallet and x402 modules
Steven Enamakelf66bf1766862
diff --git a/crates/openhuman-core/src/modules/wallet.rs b/crates/openhuman-core/src/modules/wallet.rsindex 3e33cdeead..26b0ba792c 100644--- a/crates/openhuman-core/src/modules/wallet.rs+++ b/crates/openhuman-core/src/modules/wallet.rs@@ -70,8 +70,8 @@ use serde::de::DeserializeOwned;use serde::Serialize;use tinywallet_bus::names::methods;use tinywallet_bus::wire::{- DeriveMnemonicSeedRequest, DeriveMnemonicSeedResponse, DerivedAccount, ExportRequest,- EncodeErc20TransferRequest, EncodeErc20TransferResponse, ExportedKey,+ DeriveMnemonicSeedRequest, DeriveMnemonicSeedResponse, DerivedAccount,+ EncodeErc20TransferRequest, EncodeErc20TransferResponse, ExportRequest, ExportedKey,GenerateMnemonicRequest, GenerateMnemonicResponse, Scheme, SecretMaterial, SignMessageRequest,SignRequest, Signature, SignedTransaction, TransactionSpec,};diff --git a/crates/openhuman-core/src/modules/wallet_host.rs b/crates/openhuman-core/src/modules/wallet_host.rsindex 31953af671..b9880ec455 100644--- a/crates/openhuman-core/src/modules/wallet_host.rs+++ b/crates/openhuman-core/src/modules/wallet_host.rs@@ -94,8 +94,9 @@ pub(crate) fn bind_endpoint_references(let mut resolved = HashMap::new();for endpoint in references {- let url = crate::web3::wallet::endpoints::override_for_endpoint(endpoint.key)- .ok_or_else(|| "wallet module referenced an endpoint without a host override".to_string())?;+ let url = crate::web3::wallet::endpoints::override_for_endpoint(endpoint.key).ok_or_else(+ || "wallet module referenced an endpoint without a host override".to_string(),+ )?;if endpoint.reference.trim().is_empty()|| resolved.insert(diff --git a/crates/openhuman-core/src/modules/wallet_service.rs b/crates/openhuman-core/src/modules/wallet_service.rsindex d9a88a7137..71aaf880ae 100644--- a/crates/openhuman-core/src/modules/wallet_service.rs+++ b/crates/openhuman-core/src/modules/wallet_service.rs@@ -352,7 +352,11 @@ pub(super) fn native_wallet_config_request() -> NativeWalletConfigRequest {overridden_endpoints.push(RpcEndpointKey::Evm { network });}}- for key in [RpcEndpointKey::Btc, RpcEndpointKey::Solana, RpcEndpointKey::Tron] {+ for key in [+ RpcEndpointKey::Btc,+ RpcEndpointKey::Solana,+ RpcEndpointKey::Tron,+ ] {if crate::web3::wallet::endpoints::override_for_endpoint(key).is_some() {overridden_endpoints.push(key);}diff --git a/crates/openhuman-core/src/modules/web3_service.rs b/crates/openhuman-core/src/modules/web3_service.rsindex 3ba27aaf6d..52ff8c922c 100644--- a/crates/openhuman-core/src/modules/web3_service.rs+++ b/crates/openhuman-core/src/modules/web3_service.rs@@ -137,7 +137,9 @@ fn register_shutdown_hook() {};let config = crate::config::rpc::load_config_with_timeout().await;let Ok(config) = config else {- tracing::warn!("[modules:web3] could not load configuration to close service at shutdown");+ tracing::warn!(+ "[modules:web3] could not load configuration to close service at shutdown"+ );return;};match wallet::call::<_, ()>(@@ -153,7 +155,9 @@ fn register_shutdown_hook() {wallet_host::clear_endpoint_references(¤t.response.service.handle);*active = None;}- Err(error) => tracing::warn!(%error, "[modules:web3] failed to close service at shutdown"),+ Err(error) => {+ tracing::warn!(%error, "[modules:web3] failed to close service at shutdown")+ }}});}diff --git a/crates/openhuman-core/src/modules/x402_service.rs b/crates/openhuman-core/src/modules/x402_service.rsindex 1209e11ca3..0d950875c6 100644--- a/crates/openhuman-core/src/modules/x402_service.rs+++ b/crates/openhuman-core/src/modules/x402_service.rs@@ -116,16 +116,13 @@ async fn ensure_service(.map_err(WalletCallError::Failed)?;let budget = budget_from(|name| std::env::var(name).ok());- if active- .as_ref()- .is_some_and(|current| {- current.workspace != workspace- || current.accounts != accounts- || current.config.per_request_max_atomic != budget.0- || current.config.daily_max_atomic != budget.1- || current.config.monthly_max_atomic != budget.2- })- {+ if active.as_ref().is_some_and(|current| {+ current.workspace != workspace+ || current.accounts != accounts+ || current.config.per_request_max_atomic != budget.0+ || current.config.daily_max_atomic != budget.1+ || current.config.monthly_max_atomic != budget.2+ }) {if let Some(current) = active.as_ref() {wallet::call::<_, ()>(config,@@ -197,7 +194,9 @@ fn register_shutdown_hook() {return;};let Ok(config) = crate::config::rpc::load_config_with_timeout().await else {- tracing::warn!("[modules:x402] could not load configuration to close service at shutdown");+ tracing::warn!(+ "[modules:x402] could not load configuration to close service at shutdown"+ );return;};match wallet::call::<_, ()>(@@ -210,7 +209,9 @@ fn register_shutdown_hook() {.await{Ok(()) => *active = None,- Err(error) => tracing::warn!(%error, "[modules:x402] failed to close service at shutdown"),+ Err(error) => {+ tracing::warn!(%error, "[modules:x402] failed to close service at shutdown")+ }}});}diff --git a/crates/openhuman-core/src/tools/impl/network/host.rs b/crates/openhuman-core/src/tools/impl/network/host.rsindex 329229c027..f0d8aec892 100644--- a/crates/openhuman-core/src/tools/impl/network/host.rs+++ b/crates/openhuman-core/src/tools/impl/network/host.rs@@ -7,10 +7,10 @@use std::sync::Arc;+use tinytools::{PermissionLevel, Tool, ToolResult};use tinytools_std::network::{AsyncHtmlExtractor, HttpLimits, HttpRequestTool, NetGate, WebFetchTool,};-use tinytools::{PermissionLevel, Tool, ToolResult};use crate::config::HttpRequestConfig;use crate::inference::tokenjuice::focus::{summary_focus_property, SUMMARY_FOCUS_ARG};@@ -162,7 +162,9 @@ mod x402 {.get("PAYMENT-REQUIRED").or_else(|| response_headers.get("X-PAYMENT-REQUIRED")).and_then(|value| value.to_str().ok())- .ok_or_else(|| "402 response is missing a valid PAYMENT-REQUIRED header".to_string())?;+ .ok_or_else(|| {+ "402 response is missing a valid PAYMENT-REQUIRED header".to_string()+ })?;let config = crate::config::rpc::load_config_with_timeout().await.map_err(|error| format!("x402 payment failed: {error}"))?;@@ -172,14 +174,10 @@ mod x402 {client_id: context.client_id.clone(),}).ok();- let (service, payment) = x402_service::prepare_payment(- &config,- url.to_owned(),- challenge.to_owned(),- owner,- )- .await- .map_err(|error| format!("x402 payment failed: {error}"))?;+ let (service, payment) =+ x402_service::prepare_payment(&config, url.to_owned(), challenge.to_owned(), owner)+ .await+ .map_err(|error| format!("x402 payment failed: {error}"))?;log::debug!("[tool.http_request] retrying with x402 payment header amount={} asset={}",@@ -203,11 +201,15 @@ mod x402 {).await{- log::warn!("[tool.http_request] x402 settlement recording failed: {error}");+ log::warn!(+ "[tool.http_request] x402 settlement recording failed: {error}"+ );}});} else {- log::warn!("[tool.http_request] x402 settlement not recorded: runtime unavailable");+ log::warn!(+ "[tool.http_request] x402 settlement not recorded: runtime unavailable"+ );}}),})diff --git a/crates/openhuman-core/src/tools/impl/network/mod.rs b/crates/openhuman-core/src/tools/impl/network/mod.rsindex 2162d9d328..37effcd22c 100644--- a/crates/openhuman-core/src/tools/impl/network/mod.rs+++ b/crates/openhuman-core/src/tools/impl/network/mod.rs@@ -22,9 +22,9 @@ mod mcp_server_tools;pub use gitbooks::{GitbooksGetPageTool, GitbooksSearchTool};pub use gmail_unsubscribe::GmailUnsubscribeTool;-pub use host::{http_request_tool, web_fetch_tool};#[cfg(feature = "web3")]pub(crate) use host::x402_request_tool;+pub use host::{http_request_tool, web_fetch_tool};#[cfg(feature = "mcp")]pub use mcp::{mcp_call_tool, McpListServersTool, McpListToolsTool};#[cfg(feature = "mcp")]diff --git a/crates/openhuman-core/src/web3/wallet/endpoints_tests.rs b/crates/openhuman-core/src/web3/wallet/endpoints_tests.rsindex edfa841d56..f897ccbf75 100644--- a/crates/openhuman-core/src/web3/wallet/endpoints_tests.rs+++ b/crates/openhuman-core/src/web3/wallet/endpoints_tests.rs@@ -43,8 +43,14 @@ fn solana_cluster_keeps_the_host_environment_compatibility() {fn only_explicit_nonblank_endpoint_overrides_are_exposed_to_transport() {with_env(&[- ("OPENHUMAN_WALLET_RPC_BTC", Some(" https://btc.example/rpc ")),- ("OPENHUMAN_WALLET_RPC_BASE", Some("https://base.example/rpc")),+ (+ "OPENHUMAN_WALLET_RPC_BTC",+ Some(" https://btc.example/rpc "),+ ),+ (+ "OPENHUMAN_WALLET_RPC_BASE",+ Some("https://base.example/rpc"),+ ),("OPENHUMAN_WALLET_RPC_TRON", Some(" ")),],|| {diff --git a/crates/openhuman-core/src/web3/wallet/mod.rs b/crates/openhuman-core/src/web3/wallet/mod.rsindex 4115b1e7c4..3ed66332f2 100644--- a/crates/openhuman-core/src/web3/wallet/mod.rs+++ b/crates/openhuman-core/src/web3/wallet/mod.rs@@ -45,11 +45,11 @@ pub(crate) mod rpc;#[cfg(feature = "web3")]mod schemas;+#[cfg(all(test, feature = "web3"))]+pub(crate) mod test_support;/// Wallet agent tool adapters over the declarations in `tinywallet-bus`.#[cfg(feature = "web3")]pub mod tools;-#[cfg(all(test, feature = "web3"))]-pub(crate) mod test_support;#[cfg(feature = "web3")]pub use endpoints::solana_cluster;diff --git a/crates/openhuman-core/src/web3/wallet/ops/types.rs b/crates/openhuman-core/src/web3/wallet/ops/types.rsindex 976c1a7b5c..aeba7f7822 100644--- a/crates/openhuman-core/src/web3/wallet/ops/types.rs+++ b/crates/openhuman-core/src/web3/wallet/ops/types.rs@@ -6,8 +6,7 @@ use serde::{Deserialize, Serialize};pub use tinywallet_bus::wire::WalletChain;/// Error returned when no local wallet has been configured.-pub const WALLET_NOT_CONFIGURED_MESSAGE: &str =- "wallet is not configured; run wallet setup first";+pub const WALLET_NOT_CONFIGURED_MESSAGE: &str = "wallet is not configured; run wallet setup first";/// How the host's local wallet state was created.#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]diff --git a/crates/openhuman-core/src/web3/wallet/schemas.rs b/crates/openhuman-core/src/web3/wallet/schemas.rsindex acc63d4c23..54df8c6ddb 100644--- a/crates/openhuman-core/src/web3/wallet/schemas.rs+++ b/crates/openhuman-core/src/web3/wallet/schemas.rs@@ -5,9 +5,9 @@ use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::{ControllerSchema, FieldSchema, TypeSchema};use super::execution::{- balances, chain_status, encode_erc20_transfer, execute_prepared, lookup_tx,- network_defaults, prepare_transfer, supported_assets, tx_receipt, tx_status,- ExecutePreparedParams, PrepareTransferParams,+ balances, chain_status, encode_erc20_transfer, execute_prepared, lookup_tx, network_defaults,+ prepare_transfer, supported_assets, tx_receipt, tx_status, ExecutePreparedParams,+ PrepareTransferParams,};use super::ops::{WalletAccount, WalletSetupParams, WalletSetupSource};use super::{EvmNetwork, WalletChain};@@ -472,7 +472,7 @@ fn handle_encode_erc20_transfer(params: Map<String, Value>) -> ControllerFuturereturn Err("encode_erc20_transfer only supports the evm chain".to_string());}serde_json::to_value(encode_erc20_transfer(&parsed.to_address, &parsed.amount_raw).await?)- .map_err(|e| format!("failed to encode ERC20 transfer output: {e}"))+ .map_err(|e| format!("failed to encode ERC20 transfer output: {e}"))})}diff --git a/crates/openhuman-core/src/web3/wallet/tools.rs b/crates/openhuman-core/src/web3/wallet/tools.rsindex 4aa45cbf9a..17323bc610 100644--- a/crates/openhuman-core/src/web3/wallet/tools.rs+++ b/crates/openhuman-core/src/web3/wallet/tools.rs@@ -62,42 +62,40 @@ impl Tool for WalletModuleTool {"wallet_prepare_transfer" => {let params = match serde_json::from_value(args) {Ok(params) => params,- Err(error) => return Ok(ToolResult::error(format!("invalid arguments: {error}"))),+ Err(error) => {+ return Ok(ToolResult::error(format!("invalid arguments: {error}")))+ }};outcome_value(crate::web3::wallet::prepare_transfer(params).await)}"wallet_tx_status" | "wallet_tx_receipt" | "wallet_lookup_tx" => {let query: TxQuery = match serde_json::from_value(args) {Ok(query) => query,- Err(error) => return Ok(ToolResult::error(format!("invalid arguments: {error}"))),+ Err(error) => {+ return Ok(ToolResult::error(format!("invalid arguments: {error}")))+ }};let result = match self.name() {- "wallet_tx_status" => crate::web3::wallet::tx_status(- query.chain,- query.evm_network,- &query.hash,- )- .await- .map(|outcome| outcome.value),- "wallet_tx_receipt" => crate::web3::wallet::tx_receipt(- query.chain,- query.evm_network,- &query.hash,- )- .await- .map(|outcome| outcome.value),- _ => crate::web3::wallet::lookup_tx(- query.chain,- query.evm_network,- &query.hash,- )- .await- .map(|outcome| outcome.value),+ "wallet_tx_status" => {+ crate::web3::wallet::tx_status(query.chain, query.evm_network, &query.hash)+ .await+ .map(|outcome| outcome.value)+ }+ "wallet_tx_receipt" => {+ crate::web3::wallet::tx_receipt(query.chain, query.evm_network, &query.hash)+ .await+ .map(|outcome| outcome.value)+ }+ _ => {+ crate::web3::wallet::lookup_tx(query.chain, query.evm_network, &query.hash)+ .await+ .map(|outcome| outcome.value)+ }};result.and_then(|value| {- serde_json::to_value(value)- .map_err(|error| format!("failed to serialize wallet result: {error}"))- })+ serde_json::to_value(value)+ .map_err(|error| format!("failed to serialize wallet result: {error}"))+ })}_ => return Ok(ToolResult::error("unknown wallet tool")),};diff --git a/crates/openhuman-core/src/web3/x402/mod.rs b/crates/openhuman-core/src/web3/x402/mod.rsindex cdd74d6f39..6de8be2b52 100644--- a/crates/openhuman-core/src/web3/x402/mod.rs+++ b/crates/openhuman-core/src/web3/x402/mod.rs@@ -13,7 +13,9 @@ pub use schemas::all_controller_schemas as all_x402_controller_schemas;#[cfg(feature = "web3")]pub use schemas::all_registered_controllers as all_x402_registered_controllers;#[cfg(feature = "web3")]-pub use tinywallet_bus::wire::{X402PaymentRecord as PaymentRecord, X402PaymentStatus as PaymentStatus};+pub use tinywallet_bus::wire::{+ X402PaymentRecord as PaymentRecord, X402PaymentStatus as PaymentStatus,+};/// Kept as a compatibility no-op. The module-owned ledger opens lazily when/// the first x402 service operation is requested, scoped to the active workspace.diff --git a/crates/openhuman-core/src/web3/x402/schemas.rs b/crates/openhuman-core/src/web3/x402/schemas.rsindex 8c6939870b..521daa9b27 100644--- a/crates/openhuman-core/src/web3/x402/schemas.rs+++ b/crates/openhuman-core/src/web3/x402/schemas.rs@@ -201,7 +201,11 @@ fn summary_value(summary: tinywallet_bus::wire::X402DetailedSpendingSummary) ->})}-fn budget_value(per_request_max_atomic: u64, daily_max_atomic: u64, monthly_max_atomic: u64) -> Value {+fn budget_value(+ per_request_max_atomic: u64,+ daily_max_atomic: u64,+ monthly_max_atomic: u64,+) -> Value {json!({"budget": {"perRequestMaxAtomic": per_request_max_atomic,