Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(voice,web3): thread DispatchCtx through RPC handlers

Steven Enamakel982340e18baf
diff --git a/crates/openhuman-core/src/core/runtime/dispatch_ctx_tests.rs b/crates/openhuman-core/src/core/runtime/dispatch_ctx_tests.rs
new file mode 100644
index 0000000000..bea1be93bb
--- /dev/null
+++ b/crates/openhuman-core/src/core/runtime/dispatch_ctx_tests.rs
@@ -0,0 +1,39 @@
+use super::*;
+use crate::core::runtime::DomainSet;
+
+#[test]
+fn unbound_context_has_no_core() {
+ let ctx = DispatchCtx::unbound();
+ assert!(ctx.core().is_none());
+ assert!(ctx.into_core().is_none());
+}
+
+#[test]
+fn new_context_carries_exactly_the_given_core() {
+ let core = CoreContext::for_test(DomainSet::full(), None);
+ let ctx = DispatchCtx::new(Arc::clone(&core));
+ assert!(Arc::ptr_eq(ctx.core().expect("bound"), &core));
+ let cloned = ctx.clone();
+ assert!(Arc::ptr_eq(cloned.core().expect("bound"), &core));
+}
+
+#[test]
+fn from_arc_binds_the_context() {
+ let core = CoreContext::for_test(DomainSet::full(), None);
+ let ctx: DispatchCtx = Arc::clone(&core).into();
+ assert!(Arc::ptr_eq(ctx.core().expect("bound"), &core));
+}
+
+#[tokio::test]
+async fn ambient_reads_the_scoped_context_and_explicit_ignores_it() {
+ let scoped = CoreContext::for_test(DomainSet::full(), None);
+ let other = CoreContext::for_test(DomainSet::full(), None);
+ CoreContext::scope(Arc::clone(&scoped), async {
+ // An explicit context is the one handed in, whatever the task scope says.
+ let explicit = DispatchCtx::new(Arc::clone(&other));
+ assert!(Arc::ptr_eq(explicit.core().unwrap(), &other));
+ let ambient = DispatchCtx::ambient();
+ assert!(Arc::ptr_eq(ambient.core().unwrap(), &scoped));
+ })
+ .await;
+}
diff --git a/crates/openhuman-core/src/voice/live/schemas.rs b/crates/openhuman-core/src/voice/live/schemas.rs
index d6310c6b80..5492e66a83 100644
--- a/crates/openhuman-core/src/voice/live/schemas.rs
+++ b/crates/openhuman-core/src/voice/live/schemas.rs
@@ -3,6 +3,7 @@
//! The session itself is not an RPC — it runs over the `/ws/live-voice`
//! WebSocket (`ws.rs`).
+use crate::core::runtime::DispatchCtx;
use serde::Deserialize;
use serde_json::{Map, Value};
@@ -117,21 +118,21 @@ struct TestParams {
provider: String,
}
-fn handle_live_providers(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_live_providers(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
to_value(ops::live_providers(&config).value)
})
}
-fn handle_live_settings_get(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_live_settings_get(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
to_value(ops::live_settings_get(&config).value)
})
}
-fn handle_live_settings_set(params: Map<String, Value>) -> ControllerFuture {
+fn handle_live_settings_set(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let patch: LiveSettingsPatch = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -140,7 +141,7 @@ fn handle_live_settings_set(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_live_test_provider(params: Map<String, Value>) -> ControllerFuture {
+fn handle_live_test_provider(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let params: TestParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
diff --git a/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs b/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs
index 84e064a40c..2b72d67b1d 100644
--- a/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs
+++ b/crates/openhuman-core/src/voice/schemas/handlers/provider_server.rs
@@ -1,5 +1,6 @@
//! Handlers for provider settings, model listing, provider testing, and server lifecycle.
+use crate::core::runtime::DispatchCtx;
use serde_json::{Map, Value};
use crate::config::rpc as config_rpc;
@@ -18,7 +19,7 @@ use crate::voice::schemas::params::{
// Provider configuration handlers
// ---------------------------------------------------------------------------
-pub(crate) fn handle_voice_set_providers(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_set_providers(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<SetProvidersParams>(params)?;
let mut config = config_rpc::load_config_with_timeout().await?;
@@ -78,7 +79,7 @@ pub(crate) fn handle_voice_set_providers(params: Map<String, Value>) -> Controll
})
}
-pub(crate) fn handle_voice_update_provider_settings(
+pub(crate) fn handle_voice_update_provider_settings(_ctx: DispatchCtx,
params: Map<String, Value>,
) -> ControllerFuture {
Box::pin(async move {
@@ -232,7 +233,7 @@ pub(crate) fn handle_voice_update_provider_settings(
})
}
-pub(crate) fn handle_voice_list_models(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_list_models(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<VoiceListModelsParams>(params)?;
let config = config_rpc::load_config_with_timeout().await?;
@@ -297,7 +298,7 @@ pub(crate) fn handle_voice_list_models(params: Map<String, Value>) -> Controller
})
}
-pub(crate) fn handle_voice_test_provider(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_test_provider(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<VoiceTestProviderParams>(params)?;
let config = config_rpc::load_config_with_timeout().await?;
@@ -413,7 +414,7 @@ pub(crate) fn handle_voice_test_provider(params: Map<String, Value>) -> Controll
// Voice server lifecycle handlers
// ---------------------------------------------------------------------------
-pub(crate) fn handle_voice_server_start(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_server_start(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
use crate::voice::server::{global_server, VoiceServerConfig};
use tinyvoice_bus::hotkey::ActivationMode;
@@ -499,7 +500,7 @@ pub(crate) fn handle_voice_server_start(params: Map<String, Value>) -> Controlle
})
}
-pub(crate) fn handle_voice_server_stop(_params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_server_stop(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
if let Some(server) = crate::voice::server::try_global_server() {
server.stop().await;
@@ -520,7 +521,7 @@ pub(crate) fn handle_voice_server_stop(_params: Map<String, Value>) -> Controlle
})
}
-pub(crate) fn handle_voice_server_status(_params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_server_status(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
if let Some(server) = crate::voice::server::try_global_server() {
let status = server.status().await;
@@ -542,7 +543,7 @@ pub(crate) fn handle_voice_server_status(_params: Map<String, Value>) -> Control
// Overlay STT notify handler
// ---------------------------------------------------------------------------
-pub(crate) fn handle_overlay_stt_notify(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_overlay_stt_notify(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<OverlaySttNotifyParams>(params)?;
log::debug!(
diff --git a/crates/openhuman-core/src/voice/schemas/handlers/transcribe_tts.rs b/crates/openhuman-core/src/voice/schemas/handlers/transcribe_tts.rs
index f9e7778a16..2f0c4c6d96 100644
--- a/crates/openhuman-core/src/voice/schemas/handlers/transcribe_tts.rs
+++ b/crates/openhuman-core/src/voice/schemas/handlers/transcribe_tts.rs
@@ -1,5 +1,6 @@
//! Handlers for transcription, TTS synthesis, and factory-dispatch RPCs.
+use crate::core::runtime::DispatchCtx;
use serde_json::{Map, Value};
use crate::config::rpc as config_rpc;
@@ -13,7 +14,7 @@ use crate::voice::schemas::params::{
TranscribeParams, TtsDispatchParams, TtsParams,
};
-pub(crate) fn handle_voice_status(_params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_status(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
to_json(crate::voice::voice_status(&config).await?)
@@ -22,14 +23,14 @@ pub(crate) fn handle_voice_status(_params: Map<String, Value>) -> ControllerFutu
/// Mint a realtime voice-agent signed WebSocket URL (#5399). Takes no params —
/// the agent is server-configured; the desktop only asks for a fresh signed URL.
-pub(crate) fn handle_voice_agent_signed_url(_params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_agent_signed_url(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
to_json(crate::voice::realtime::mint_voice_agent_signed_url(&config).await?)
})
}
-pub(crate) fn handle_voice_transcribe(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_transcribe(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<TranscribeParams>(params)?;
@@ -45,7 +46,7 @@ pub(crate) fn handle_voice_transcribe(params: Map<String, Value>) -> ControllerF
})
}
-pub(crate) fn handle_voice_transcribe_bytes(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_transcribe_bytes(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<TranscribeBytesParams>(params)?;
@@ -62,7 +63,7 @@ pub(crate) fn handle_voice_transcribe_bytes(params: Map<String, Value>) -> Contr
})
}
-pub(crate) fn handle_voice_tts(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_tts(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<TtsParams>(params)?;
@@ -70,7 +71,7 @@ pub(crate) fn handle_voice_tts(params: Map<String, Value>) -> ControllerFuture {
})
}
-pub(crate) fn handle_voice_reply_synthesize(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_reply_synthesize(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<ReplySynthesizeParams>(params)?;
@@ -115,7 +116,7 @@ pub(crate) fn handle_voice_reply_synthesize(params: Map<String, Value>) -> Contr
})
}
-pub(crate) fn handle_voice_cloud_transcribe(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_cloud_transcribe(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<CloudTranscribeParams>(params)?;
@@ -132,7 +133,7 @@ pub(crate) fn handle_voice_cloud_transcribe(params: Map<String, Value>) -> Contr
})
}
-pub(crate) fn handle_voice_stt_dispatch(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_stt_dispatch(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<SttDispatchParams>(params)?;
@@ -173,7 +174,7 @@ pub(crate) fn handle_voice_stt_dispatch(params: Map<String, Value>) -> Controlle
})
}
-pub(crate) fn handle_voice_tts_dispatch(params: Map<String, Value>) -> ControllerFuture {
+pub(crate) fn handle_voice_tts_dispatch(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<TtsDispatchParams>(params)?;
diff --git a/crates/openhuman-core/src/web3/bridge/schemas.rs b/crates/openhuman-core/src/web3/bridge/schemas.rs
index 836714f164..374d0d0ec0 100644
--- a/crates/openhuman-core/src/web3/bridge/schemas.rs
+++ b/crates/openhuman-core/src/web3/bridge/schemas.rs
@@ -1,6 +1,7 @@
//! `web3_bridge` RPC controllers: prepare a cross-chain bridge quote and
//! execute it. Same-chain requests are rejected at the ops layer.
+use crate::core::runtime::DispatchCtx;
use serde_json::{Map, Value};
use crate::core::all::{ControllerFuture, RegisteredController};
@@ -91,7 +92,7 @@ pub fn schema(function: &str) -> ControllerSchema {
}
}
-fn handle_quote(params: Map<String, Value>) -> ControllerFuture {
+fn handle_quote(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let quote = web3_service::quote(&config, None, methods::WEB3_BRIDGE_QUOTE, Value::Object(params))
@@ -101,7 +102,7 @@ fn handle_quote(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_execute(params: Map<String, Value>) -> ControllerFuture {
+fn handle_execute(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: web3_service::ExecuteParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
diff --git a/crates/openhuman-core/src/web3/dapp/schemas.rs b/crates/openhuman-core/src/web3/dapp/schemas.rs
index 0ab785872e..8577c0f62a 100644
--- a/crates/openhuman-core/src/web3/dapp/schemas.rs
+++ b/crates/openhuman-core/src/web3/dapp/schemas.rs
@@ -1,6 +1,7 @@
//! `web3_dapp` RPC controllers: prepare a generic EVM contract call from
//! caller-supplied calldata and execute it. EVM-only.
+use crate::core::runtime::DispatchCtx;
use serde_json::{Map, Value};
use crate::core::all::{ControllerFuture, RegisteredController};
@@ -74,7 +75,7 @@ pub fn schema(function: &str) -> ControllerSchema {
}
}
-fn handle_call(params: Map<String, Value>) -> ControllerFuture {
+fn handle_call(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let quote = web3_service::quote(&config, None, methods::WEB3_DAPP_QUOTE, Value::Object(params))
@@ -84,7 +85,7 @@ fn handle_call(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_execute(params: Map<String, Value>) -> ControllerFuture {
+fn handle_execute(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: web3_service::ExecuteParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
diff --git a/crates/openhuman-core/src/web3/swap/schemas.rs b/crates/openhuman-core/src/web3/swap/schemas.rs
index da1ed011b4..408e9ec4ef 100644
--- a/crates/openhuman-core/src/web3/swap/schemas.rs
+++ b/crates/openhuman-core/src/web3/swap/schemas.rs
@@ -2,6 +2,7 @@
//! prepared quote, and list supported routes. Cross-chain swaps are rejected
//! at the ops layer with a pointer to `web3_bridge`.
+use crate::core::runtime::DispatchCtx;
use serde_json::{Map, Value};
use crate::core::all::{ControllerFuture, RegisteredController};
@@ -102,7 +103,7 @@ fn unknown_schema() -> ControllerSchema {
}
}
-fn handle_quote(params: Map<String, Value>) -> ControllerFuture {
+fn handle_quote(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let quote = web3_service::quote(&config, None, methods::WEB3_SWAP_QUOTE, Value::Object(params))
@@ -112,7 +113,7 @@ fn handle_quote(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_execute(params: Map<String, Value>) -> ControllerFuture {
+fn handle_execute(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: web3_service::ExecuteParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -125,7 +126,7 @@ fn handle_execute(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_routes(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_routes(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let routes = web3_service::routes(&config)
diff --git a/crates/openhuman-core/src/web3/wallet/schemas.rs b/crates/openhuman-core/src/web3/wallet/schemas.rs
index 7f428836a1..a84fd8e162 100644
--- a/crates/openhuman-core/src/web3/wallet/schemas.rs
+++ b/crates/openhuman-core/src/web3/wallet/schemas.rs
@@ -1,3 +1,4 @@
+use crate::core::runtime::DispatchCtx;
use serde::Deserialize;
use serde_json::{Map, Value};
@@ -427,7 +428,7 @@ pub fn wallet_schemas(function: &str) -> ControllerSchema {
}
}
-fn handle_status(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_status(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
crate::web3::wallet::status()
.await?
@@ -435,7 +436,7 @@ fn handle_status(_params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_setup(params: Map<String, Value>) -> ControllerFuture {
+fn handle_setup(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let payload: SetupWalletParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -452,19 +453,19 @@ fn handle_setup(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_balances(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_balances(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move { balances().await?.into_cli_compatible_json() })
}
-fn handle_network_defaults(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_network_defaults(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move { network_defaults().await?.into_cli_compatible_json() })
}
-fn handle_supported_assets(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_supported_assets(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move { supported_assets().await?.into_cli_compatible_json() })
}
-fn handle_encode_erc20_transfer(params: Map<String, Value>) -> ControllerFuture {
+fn handle_encode_erc20_transfer(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: EncodeErc20TransferParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -476,11 +477,11 @@ fn handle_encode_erc20_transfer(params: Map<String, Value>) -> ControllerFuture
})
}
-fn handle_chain_status(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_chain_status(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move { chain_status().await?.into_cli_compatible_json() })
}
-fn handle_prepare_transfer(params: Map<String, Value>) -> ControllerFuture {
+fn handle_prepare_transfer(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: PrepareTransferParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -488,7 +489,7 @@ fn handle_prepare_transfer(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_execute_prepared(params: Map<String, Value>) -> ControllerFuture {
+fn handle_execute_prepared(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: ExecutePreparedParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -496,7 +497,7 @@ fn handle_execute_prepared(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_tx_status(params: Map<String, Value>) -> ControllerFuture {
+fn handle_tx_status(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: TxQueryParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -506,7 +507,7 @@ fn handle_tx_status(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_tx_receipt(params: Map<String, Value>) -> ControllerFuture {
+fn handle_tx_receipt(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: TxQueryParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -516,7 +517,7 @@ fn handle_tx_receipt(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_lookup_tx(params: Map<String, Value>) -> ControllerFuture {
+fn handle_lookup_tx(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: TxQueryParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -526,7 +527,7 @@ fn handle_lookup_tx(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_reveal_recovery_phrase(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_reveal_recovery_phrase(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
crate::web3::wallet::reveal_recovery_phrase()
.await?
@@ -534,7 +535,7 @@ fn handle_reveal_recovery_phrase(_params: Map<String, Value>) -> ControllerFutur
})
}
-fn handle_generate_mnemonic(params: Map<String, Value>) -> ControllerFuture {
+fn handle_generate_mnemonic(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: GenerateMnemonicParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -544,7 +545,7 @@ fn handle_generate_mnemonic(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_validate_mnemonic(params: Map<String, Value>) -> ControllerFuture {
+fn handle_validate_mnemonic(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: RecoveryPhraseParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
@@ -554,7 +555,7 @@ fn handle_validate_mnemonic(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_derive_recovery_material(params: Map<String, Value>) -> ControllerFuture {
+fn handle_derive_recovery_material(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let parsed: RecoveryPhraseParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("invalid params: {e}"))?;
diff --git a/crates/openhuman-core/src/web3/x402/schemas.rs b/crates/openhuman-core/src/web3/x402/schemas.rs
index 521daa9b27..724a031546 100644
--- a/crates/openhuman-core/src/web3/x402/schemas.rs
+++ b/crates/openhuman-core/src/web3/x402/schemas.rs
@@ -3,6 +3,7 @@
//! Wires `x402_get_summary`, `x402_list_payments`, and `x402_update_budget`
//! into the global registry consumed by `crates/openhuman-core/src/core/all.rs`.
+use crate::core::runtime::DispatchCtx;
use serde::Deserialize;
use serde_json::{json, Map, Value};
@@ -108,7 +109,7 @@ pub fn schemas(function: &str) -> ControllerSchema {
}
}
-fn handle_get_summary(_params: Map<String, Value>) -> ControllerFuture {
+fn handle_get_summary(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = crate::config::rpc::load_config_with_timeout()
.await
@@ -127,7 +128,7 @@ struct ListPaymentsParams {
limit: Option<u64>,
}
-fn handle_list_payments(params: Map<String, Value>) -> ControllerFuture {
+fn handle_list_payments(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p: ListPaymentsParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("x402 list_payments params: {e}"))?;
@@ -158,7 +159,7 @@ struct UpdateBudgetParams {
monthly_max: Option<u64>,
}
-fn handle_update_budget(params: Map<String, Value>) -> ControllerFuture {
+fn handle_update_budget(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p: UpdateBudgetParams = serde_json::from_value(Value::Object(params))
.map_err(|e| format!("x402 update_budget params: {e}"))?;