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(hosted): make channel_link controllers always compiled
Steven Enamakel04543cb8f029
diff --git a/crates/openhuman-tinyhumans/Cargo.toml b/crates/openhuman-tinyhumans/Cargo.tomlindex ba81bcd91f..c25c016e0f 100644--- a/crates/openhuman-tinyhumans/Cargo.toml+++ b/crates/openhuman-tinyhumans/Cargo.toml@@ -32,7 +32,7 @@ flows = ["openhuman-embed/flows"]skills = ["openhuman-embed/skills"]mcp = ["openhuman-embed/mcp"]crash-reporting = ["openhuman-embed/crash-reporting"]-channels = ["openhuman-embed/channels", "dep:tinychannels-bus"]+channels = ["openhuman-embed/channels"]sandbox-landlock = ["openhuman-embed/sandbox-landlock"]sandbox-bubblewrap = ["openhuman-embed/sandbox-bubblewrap"]whatsapp-web = ["openhuman-embed/whatsapp-web"]@@ -61,7 +61,7 @@ tinyjevclient = { git = "https://github.com/tinyhumansai/tinyjevclient", rev = "# The channel controller contract (result types, credential-provider keys)# for the managed Telegram/Discord link flows in `hosted::channel_link`. Same# vendored path as the core's, so the types unify. Sync and I/O-free.-tinychannels-bus = { path = "../../vendor/tinychannels/crates/tinychannels-bus", optional = true }+tinychannels-bus = { path = "../../vendor/tinychannels/crates/tinychannels-bus" }anyhow = "1"async-trait = "0.1"chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }diff --git a/crates/openhuman-tinyhumans/src/hosted/channel_link/README.md b/crates/openhuman-tinyhumans/src/hosted/channel_link/README.mdindex a8c5ad3299..55eb87d2d6 100644--- a/crates/openhuman-tinyhumans/src/hosted/channel_link/README.md+++ b/crates/openhuman-tinyhumans/src/hosted/channel_link/README.md@@ -12,8 +12,7 @@ TinyHumans account, on the SDK's typed `auth()` client.| `channels_discord_link_check` (`linkToken`) | `GET /auth/me`, looks for `discordId`; stores `channel:discord:managed_dm` |The `channels_*` schemas come from the `tinychannels-bus` contract, converted-by the core (`channels::controllers::controller_schema`), and exist only with-the `channels` feature. They share the `channels` / `auth` namespaces with the+by the core's always-compiled `channels::contract_schema`. They share the `channels` / `auth` namespaces with thecore, which keeps the rest of the channel controllers (connect, status, bot-tokenDiscord discovery, messaging) and the credential controllers. The core's`OpenHumanChannelBackend` still implements the four contract methods, but onlydiff --git a/crates/openhuman-tinyhumans/src/hosted/channel_link/mod.rs b/crates/openhuman-tinyhumans/src/hosted/channel_link/mod.rsindex d372946a97..d394e4e5f7 100644--- a/crates/openhuman-tinyhumans/src/hosted/channel_link/mod.rs+++ b/crates/openhuman-tinyhumans/src/hosted/channel_link/mod.rs@@ -8,15 +8,14 @@//! All five need a TinyHumans account (the link binds a bot conversation to//! it), which is why they live here rather than in the core. Their RPC names//! are unchanged wire contracts and share the `auth` / `channels` namespaces-//! with core controllers. The two `channels.*` pairs only exist when the-//! `channels` feature is on, exactly as before the move.+//! with core controllers. The `channels.*` schemas come from the+//! `tinychannels-bus` contract through the core's always-compiled+//! `channels::contract_schema`.-#[cfg(feature = "channels")]mod managed;mod ops;mod schemas;-#[cfg(feature = "channels")]pub use managed::*;pub use ops::*;pub use schemas::{diff --git a/crates/openhuman-tinyhumans/src/hosted/channel_link/ops_tests.rs b/crates/openhuman-tinyhumans/src/hosted/channel_link/ops_tests.rsindex b0911b940e..e3beec99fb 100644--- a/crates/openhuman-tinyhumans/src/hosted/channel_link/ops_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted/channel_link/ops_tests.rs@@ -58,3 +58,28 @@ async fn link_token_round_trip_and_401_classification() {.unwrap_err();assert!(is_session_expired_message(&err), "{err}");}++/// Duplicate-account collision: the channel is already linked to a different+/// user, so the backend answers 409. That must NOT be classified as session+/// expiry — the JSON-RPC layer signs the user out on `SESSION_EXPIRED`, so+/// discovering someone else linked your Telegram would log you out and hide+/// the real reason (matrix 1.2.3).+#[tokio::test]+async fn link_token_409_is_not_session_expiry_and_keeps_its_reason() {+ let server = MockServer::start().await;+ Mock::given(method("POST"))+ .and(path("/auth/channels/telegram/link-token"))+ .respond_with(+ ResponseTemplate::new(409)+ .set_body_string("Telegram account already linked to another user"),+ )+ .mount(&server)+ .await;+ let tmp = TempDir::new().unwrap();+ let config = test_support::signed_in(&tmp, &server.uri());+ let err = auth_create_channel_link_token(&config, "telegram")+ .await+ .unwrap_err();+ assert!(!is_session_expired_message(&err), "{err}");+ assert!(err.contains("already linked"), "{err}");+}diff --git a/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas.rs b/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas.rsindex 8b455cb77b..5d3ff0e152 100644--- a/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas.rs+++ b/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas.rs@@ -13,7 +13,6 @@ struct AuthCreateChannelLinkTokenParams {channel: String,}-#[cfg(feature = "channels")]#[derive(Debug, Deserialize)]#[serde(rename_all = "camelCase")]struct LinkCheckParams {@@ -22,8 +21,7 @@ struct LinkCheckParams {/// The `channels.*` functions served here. Their schemas stay defined by the/// `tinychannels-bus` contract; the core converts them-/// (`channels::controllers::controller_schema`) exactly as for its own.-#[cfg(feature = "channels")]+/// (`channels::contract_schema`) exactly as for its own.pub const CHANNEL_FUNCTIONS: &[&str] = &["telegram_login_start","telegram_login_check",@@ -39,13 +37,11 @@ pub fn all_channel_link_controller_schemas() -> Vec<ControllerSchema> {}pub fn all_channel_link_registered_controllers() -> Vec<RegisteredController> {- #[allow(unused_mut)]let mut controllers = vec![RegisteredController {schema: channel_link_schemas("auth_create_channel_link_token"),handler: handle_auth_create_channel_link_token,}];- #[cfg(feature = "channels")]- controllers.extend([+ controllers.extend([RegisteredController {schema: channel_link_schemas("telegram_login_start"),handler: handle_telegram_login_start,@@ -86,9 +82,8 @@ pub fn channel_link_schemas(function: &str) -> ControllerSchema {required: true,}],},- #[cfg(feature = "channels")]- f if CHANNEL_FUNCTIONS.contains(&f) => {- openhuman_core::channels::controllers::controller_schema(f)+ f if CHANNEL_FUNCTIONS.contains(&f) => {+ openhuman_core::channels::contract_schema::contract_controller_schema(f)}_ => ControllerSchema {namespace: "auth",@@ -119,7 +114,6 @@ fn handle_auth_create_channel_link_token(params: Map<String, Value>) -> Controll})}-#[cfg(feature = "channels")]fn handle_telegram_login_start(_params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let config = config_rpc::load_config_with_timeout().await?;@@ -127,7 +121,6 @@ fn handle_telegram_login_start(_params: Map<String, Value>) -> ControllerFuture})}-#[cfg(feature = "channels")]fn handle_telegram_login_check(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let config = config_rpc::load_config_with_timeout().await?;@@ -138,7 +131,6 @@ fn handle_telegram_login_check(params: Map<String, Value>) -> ControllerFuture {})}-#[cfg(feature = "channels")]fn handle_discord_link_start(_params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let config = config_rpc::load_config_with_timeout().await?;@@ -146,7 +138,6 @@ fn handle_discord_link_start(_params: Map<String, Value>) -> ControllerFuture {})}-#[cfg(feature = "channels")]fn handle_discord_link_check(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let config = config_rpc::load_config_with_timeout().await?;diff --git a/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas_tests.rs b/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas_tests.rsindex 127527754e..f9ec7ecfd3 100644--- a/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted/channel_link/schemas_tests.rs@@ -7,7 +7,6 @@ fn catalog_keeps_the_wire_names() {.map(|s| format!("{}.{}", s.namespace, s.function)).collect();assert_eq!(names[0], "auth.create_channel_link_token");- #[cfg(feature = "channels")]assert_eq!(names[1..],[