Skip to content

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

fix(controllers): remove unused schema import

Steven Enamakel511f9d689bea
diff --git a/crates/openhuman-core/src/channels/controllers/schemas.rs b/crates/openhuman-core/src/channels/controllers/schemas.rs
index 8a58170f7c..55e3a67ebf 100644
--- a/crates/openhuman-core/src/channels/controllers/schemas.rs
+++ b/crates/openhuman-core/src/channels/controllers/schemas.rs
@@ -7,7 +7,7 @@ use serde_json::{Map, Value};
use crate::config::rpc as config_rpc;
use crate::config::Config;
use crate::core::all::{ControllerFuture, RegisteredController};
-use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
+use crate::core::ControllerSchema;
use crate::rpc::RpcOutcome;
use super::backend::OpenHumanChannelBackend;
@@ -67,18 +67,6 @@ struct TestParams {
credentials: serde_json::Value,
}
-#[derive(Debug, Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct TelegramLoginCheckParams {
- link_token: String,
-}
-
-#[derive(Debug, Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct DiscordLinkCheckParams {
- link_token: String,
-}
-
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct DiscordListChannelsParams {
@@ -133,9 +121,21 @@ struct ListThreadsParams {
// Public registry exports
// ---------------------------------------------------------------------------
+/// Contract functions the core does NOT serve: linking the managed TinyHumans
+/// bots needs a TinyHumans account, so `openhuman-tinyhumans`
+/// (`hosted::channel_link`) registers them through the controller extension.
+/// Same wire names; the namespace is shared.
+pub const HOSTED_CHANNEL_FUNCTIONS: &[&str] = &[
+ "telegram_login_start",
+ "telegram_login_check",
+ "discord_link_start",
+ "discord_link_check",
+];
+
pub fn all_controller_schemas() -> Vec<ControllerSchema> {
all_channel_controller_schemas()
.into_iter()
+ .filter(|s| !HOSTED_CHANNEL_FUNCTIONS.contains(&s.function))
.map(from_channel_controller_schema)
.collect()
}
@@ -174,22 +174,6 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {
schema: schemas("test"),
handler: handle_test,
},
- RegisteredController {
- schema: schemas("telegram_login_start"),
- handler: handle_telegram_login_start,
- },
- RegisteredController {
- schema: schemas("telegram_login_check"),
- handler: handle_telegram_login_check,
- },
- RegisteredController {
- schema: schemas("discord_link_start"),
- handler: handle_discord_link_start,
- },
- RegisteredController {
- schema: schemas("discord_link_check"),
- handler: handle_discord_link_check,
- },
RegisteredController {
schema: schemas("discord_list_guilds"),
handler: handle_discord_list_guilds,
@@ -370,56 +354,6 @@ fn handle_test(params: Map<String, Value>) -> ControllerFuture {
})
}
-fn handle_telegram_login_start(_params: Map<String, Value>) -> ControllerFuture {
- Box::pin(async move {
- let config = config_rpc::load_config_with_timeout().await?;
- let manager = openhuman_channel_manager(config);
- let result = manager
- .telegram_login_start()
- .await
- .map_err(|e| e.to_string())?;
- to_json(RpcOutcome::new(result, vec![]))
- })
-}
-
-fn handle_telegram_login_check(params: Map<String, Value>) -> ControllerFuture {
- Box::pin(async move {
- let config = config_rpc::load_config_with_timeout().await?;
- let p = deserialize_params::<TelegramLoginCheckParams>(params)?;
- let manager = openhuman_channel_manager(config);
- let result = manager
- .telegram_login_check(p.link_token.trim())
- .await
- .map_err(|e| e.to_string())?;
- to_json(RpcOutcome::new(result, vec![]))
- })
-}
-
-fn handle_discord_link_start(_params: Map<String, Value>) -> ControllerFuture {
- Box::pin(async move {
- let config = config_rpc::load_config_with_timeout().await?;
- let manager = openhuman_channel_manager(config);
- let result = manager
- .discord_link_start()
- .await
- .map_err(|e| e.to_string())?;
- to_json(RpcOutcome::new(result, vec![]))
- })
-}
-
-fn handle_discord_link_check(params: Map<String, Value>) -> ControllerFuture {
- Box::pin(async move {
- let config = config_rpc::load_config_with_timeout().await?;
- let p = deserialize_params::<DiscordLinkCheckParams>(params)?;
- let manager = openhuman_channel_manager(config);
- let result = manager
- .discord_link_check(p.link_token.trim())
- .await
- .map_err(|e| e.to_string())?;
- to_json(RpcOutcome::new(result, vec![]))
- })
-}
-
fn handle_discord_list_guilds(_params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;