Skip to content

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

feat(channels): prepare connections through released TinyBus module

Steven Enamakelc3fac02e5f87
diff --git a/Cargo.lock b/Cargo.lock
index 4726730272..3d29ab149f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6869,7 +6869,7 @@ dependencies = [
[[package]]
name = "tinychannels"
-version = "0.1.16"
+version = "0.1.17"
dependencies = [
"anyhow",
"async-imap",
@@ -6915,7 +6915,7 @@ dependencies = [
[[package]]
name = "tinychannels-bus"
-version = "0.1.16"
+version = "0.1.17"
dependencies = [
"base64 0.23.1",
"schemars",
@@ -6926,7 +6926,7 @@ dependencies = [
[[package]]
name = "tinychannels-runtime"
-version = "0.1.16"
+version = "0.1.17"
dependencies = [
"anyhow",
"async-trait",
diff --git a/crates/openhuman-app/Cargo.lock b/crates/openhuman-app/Cargo.lock
index cd1c237da3..9ea4e522ce 100644
--- a/crates/openhuman-app/Cargo.lock
+++ b/crates/openhuman-app/Cargo.lock
@@ -527,12 +527,6 @@ dependencies = [
"digest 0.10.7",
]
-[[package]]
-name = "block"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
-
[[package]]
name = "block-buffer"
version = "0.10.4"
@@ -867,21 +861,6 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"
-[[package]]
-name = "cocoa"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "667fdc068627a2816b9ff831201dd9864249d6ee8d190b9532357f1fc0f61ea7"
-dependencies = [
- "bitflags 1.3.2",
- "block",
- "core-foundation 0.9.4",
- "core-graphics 0.21.0",
- "foreign-types 0.3.2",
- "libc",
- "objc",
-]
-
[[package]]
name = "combine"
version = "4.6.8"
@@ -953,23 +932,13 @@ dependencies = [
"version_check",
]
-[[package]]
-name = "core-foundation"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
-dependencies = [
- "core-foundation-sys 0.7.0",
- "libc",
-]
-
[[package]]
name = "core-foundation"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"libc",
]
@@ -979,46 +948,16 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
dependencies = [
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"libc",
]
-[[package]]
-name = "core-foundation-sys"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
-
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
-[[package]]
-name = "core-graphics"
-version = "0.19.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation 0.7.0",
- "foreign-types 0.3.2",
- "libc",
-]
-
-[[package]]
-name = "core-graphics"
-version = "0.21.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52a67c4378cf203eace8fb6567847eb641fd6ff933c1145a115c6ee820ebb978"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation 0.9.4",
- "foreign-types 0.3.2",
- "libc",
-]
-
[[package]]
name = "core-graphics"
version = "0.25.0"
@@ -1479,7 +1418,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users 0.5.3",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1747,7 +1686,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -2709,12 +2648,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
dependencies = [
"android_system_properties",
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"log",
"wasm-bindgen",
- "windows-core 0.61.2",
+ "windows-core 0.57.0",
]
[[package]]
@@ -3470,15 +3409,6 @@ dependencies = [
"hashify",
]
-[[package]]
-name = "malloc_buf"
-version = "0.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "markup5ever"
version = "0.38.0"
@@ -3721,7 +3651,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -3841,15 +3771,6 @@ dependencies = [
"syn 2.0.119",
]
-[[package]]
-name = "objc"
-version = "0.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
-dependencies = [
- "malloc_buf",
-]
-
[[package]]
name = "objc2"
version = "0.6.4"
@@ -4300,7 +4221,7 @@ dependencies = [
"tinystoragedrivers",
"tinytools",
"tinytools-agent",
- "tinytools-std",
+ "tinytools-std 0.5.0",
"tinyvoice",
"tinyvoice-bus",
"tinywallet-bus",
@@ -5066,7 +4987,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -5187,22 +5108,6 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
-[[package]]
-name = "rdev"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00552ca2dc2f93b84cd7b5581de49549411e4e41d89e1c691bcb93dc4be360c3"
-dependencies = [
- "cocoa",
- "core-foundation 0.7.0",
- "core-foundation-sys 0.7.0",
- "core-graphics 0.19.2",
- "lazy_static",
- "libc",
- "winapi",
- "x11",
-]
-
[[package]]
name = "redox_syscall"
version = "0.5.18"
@@ -5495,7 +5400,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -5552,7 +5457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"
dependencies = [
"core-foundation 0.10.1",
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"jni 0.22.4",
"log",
"once_cell",
@@ -5563,7 +5468,7 @@ dependencies = [
"security-framework 3.7.0",
"security-framework-sys",
"webpki-root-certs",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -5697,7 +5602,7 @@ checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
"bitflags 2.13.2",
"core-foundation 0.9.4",
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"libc",
"security-framework-sys",
]
@@ -5710,7 +5615,7 @@ checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
"bitflags 2.13.2",
"core-foundation 0.10.1",
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"libc",
"security-framework-sys",
]
@@ -5721,7 +5626,7 @@ version = "2.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
dependencies = [
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"libc",
]
@@ -6485,7 +6390,7 @@ version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fc858248ea01b66f19d8e8a6d55f41deaf91e9d495246fd01368d99935c6c01"
dependencies = [
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"libc",
"memchr",
"ntapi",
@@ -6509,7 +6414,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
dependencies = [
- "core-foundation-sys 0.8.7",
+ "core-foundation-sys",
"libc",
]
@@ -6535,7 +6440,7 @@ dependencies = [
"bitflags 2.13.2",
"block2",
"core-foundation 0.10.1",
- "core-graphics 0.25.0",
+ "core-graphics",
"crossbeam-channel",
"dispatch2",
"dlopen2",
@@ -6967,7 +6872,7 @@ dependencies = [
"getrandom 0.4.3",
"once_cell",
"rustix",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -7127,7 +7032,7 @@ dependencies = [
"tinystoragedrivers-core",
"tinytools",
"tinytools-agent",
- "tinytools-std",
+ "tinytools-std 0.5.0",
"tokio",
"tracing",
"uuid",
@@ -7245,14 +7150,14 @@ dependencies = [
[[package]]
name = "tinybox-bus"
-version = "0.1.18"
+version = "0.1.19"
dependencies = [
"serde",
]
[[package]]
name = "tinybox-core"
-version = "0.1.18"
+version = "0.1.19"
dependencies = [
"async-trait",
"serde",
@@ -7262,7 +7167,7 @@ dependencies = [
[[package]]
name = "tinybox-docker"
-version = "0.1.18"
+version = "0.1.19"
dependencies = [
"async-trait",
"serde_json",
@@ -7273,7 +7178,7 @@ dependencies = [
[[package]]
name = "tinybox-jail"
-version = "0.1.18"
+version = "0.1.19"
dependencies = [
"landlock",
"log",
@@ -7315,7 +7220,7 @@ dependencies = [
[[package]]
name = "tinychannels"
-version = "0.1.16"
+version = "0.1.17"
dependencies = [
"anyhow",
"async-imap",
@@ -7357,7 +7262,7 @@ dependencies = [
[[package]]
name = "tinychannels-bus"
-version = "0.1.16"
+version = "0.1.17"
dependencies = [
"base64 0.23.1",
"schemars 1.2.2",
@@ -7368,7 +7273,7 @@ dependencies = [
[[package]]
name = "tinychannels-runtime"
-version = "0.1.16"
+version = "0.1.17"
dependencies = [
"anyhow",
"async-trait",
@@ -7705,7 +7610,7 @@ dependencies = [
[[package]]
name = "tinymcp"
-version = "0.6.0"
+version = "0.8.1"
dependencies = [
"anyhow",
"async-trait",
@@ -7713,6 +7618,7 @@ dependencies = [
"base64 0.23.1",
"dirs 7.0.0",
"futures-util",
+ "libc",
"parking_lot",
"reqwest 0.12.28",
"rusqlite",
@@ -7722,6 +7628,7 @@ dependencies = [
"thiserror 2.0.20",
"tinymcp-bus",
"tinytools",
+ "tinytools-std 0.5.0 (git+https://github.com/tinyhumansai/tinytools?rev=360721bc3c7a26221b61f6629f5f0415cfccb568)",
"tokio",
"tokio-stream",
"tracing",
@@ -7732,7 +7639,7 @@ dependencies = [
[[package]]
name = "tinymcp-bus"
-version = "0.6.0"
+version = "0.8.1"
dependencies = [
"schemars 1.2.2",
"serde",
@@ -7948,6 +7855,31 @@ dependencies = [
"walkdir",
]
+[[package]]
+name = "tinytools-std"
+version = "0.5.0"
+source = "git+https://github.com/tinyhumansai/tinytools?rev=360721bc3c7a26221b61f6629f5f0415cfccb568#360721bc3c7a26221b61f6629f5f0415cfccb568"
+dependencies = [
+ "anyhow",
+ "async-trait",
+ "base64 0.23.1",
+ "fs2",
+ "futures-util",
+ "glob",
+ "libc",
+ "log",
+ "parking_lot",
+ "regex",
+ "reqwest 0.12.28",
+ "rustix",
+ "serde_json",
+ "sha2 0.11.0",
+ "tinytools",
+ "tokio",
+ "tracing",
+ "walkdir",
+]
+
[[package]]
name = "tinyvec"
version = "1.13.3"
@@ -7956,13 +7888,11 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
[[package]]
name = "tinyvoice"
-version = "0.1.12"
+version = "0.1.14"
dependencies = [
"cpal",
"log",
"parking_lot",
- "rdev",
- "serde",
"thiserror 2.0.20",
"tinyvoice-bus",
"tokio",
@@ -9809,16 +9739,6 @@ dependencies = [
"windows-version",
]
-[[package]]
-name = "x11"
-version = "2.21.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"
-dependencies = [
- "libc",
- "pkg-config",
-]
-
[[package]]
name = "x11rb"
version = "0.13.2"
diff --git a/crates/openhuman-core/src/channels/controllers/README.md b/crates/openhuman-core/src/channels/controllers/README.md
index aaddcad538..2e66fdba0e 100644
--- a/crates/openhuman-core/src/channels/controllers/README.md
+++ b/crates/openhuman-core/src/channels/controllers/README.md
@@ -43,3 +43,12 @@ Owns the `channels.*` RPC namespace: provider metadata, connect/disconnect lifec
- [tinychannels](../../../../../vendor/tinychannels/README.md)
Credential testing (`test_channel`) delegates structural validation and IMAP verification through the released module’s confidential controller member. Config persistence and credential custody remain in OpenHuman.
+
+Connection preparation uses TinyChannels' confidential `ChannelController`
+`PrepareConnect` operation. The module validates credentials, prepares provider
+defaults and verifies native login before returning a typed configuration update.
+OpenHuman persists only the requested provider, retains encrypted credential
+custody, and removes email passwords and Yuanbao application secrets from TOML.
+An unavailable module fails both `connect` and `test`; neither operation executes
+provider validation locally. Host persistence tests use recorded contract
+results; provider verification/defaulting regressions live in TinyChannels.
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect.rs b/crates/openhuman-core/src/channels/controllers/ops/connect.rs
index e59e5e3ab8..4c1939c758 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect.rs
@@ -9,6 +9,8 @@ mod status;
mod test_channel;
pub use connect_channel::connect_channel;
+#[cfg(test)]
+pub(crate) use connect_channel::persist_prepared_connection;
pub use disconnect::disconnect_channel;
#[cfg(test)]
pub(crate) use email::persist_email_config;
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs
index 5ea37c001b..2c960f7a62 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs
@@ -1,323 +1,158 @@
-//! Initiating a channel connection (credential validation, persistence, and
-//! any live pre-verification).
-
-use serde_json::Value;
-use tinychannels_runtime::controllers::ChannelDefinitionExt as _;
-
-use crate::channels::email_channel::EmailConfig;
-use crate::channels::providers::yuanbao::YuanbaoConfig;
-use crate::config::{Config, DiscordConfig, IMessageConfig, TelegramConfig};
+//! Module-owned connection preparation, followed by host credential custody
+//! and configuration persistence.
+use super::super::types::ChannelConnectionResult;
+use super::shared::credential_provider;
+use crate::config::Config;
use crate::core::Outcome;
+use crate::modules::client::{ModuleCallError, ModuleClient};
use crate::security::credentials;
+use serde_json::Value;
+use tinychannels_bus::module_controller::{ChannelConfigUpdate, PreparedChannelConnection};
+use tinychannels_bus::{ChannelAuthMode, ChannelControllerRequest, HttpProxyPolicy};
-use super::super::super::definitions::{find_channel_definition, ChannelAuthMode};
-use super::super::types::ChannelConnectionResult;
-use super::email::persist_email_config;
-use super::shared::{credential_provider, parse_allowed_users, parse_optional_bool};
-use tinychannels::controllers::build_email_config;
-use tinychannels::providers::verify_email_credentials;
-use tinychannels::providers::yuanbao::connect::{
- build_effective_yuanbao_config, require_yuanbao_field, verify_yuanbao_credentials,
-};
-
-/// Initiate a channel connection.
-///
-/// For `BotToken`/`ApiKey` modes: validates fields and stores credentials.
-/// For `OAuth`/`ManagedDm` modes: returns the auth action the frontend should handle.
+/// Validate and verify through TinyChannels, then persist the approved provider
+/// update and credentials in OpenHuman's existing stores.
pub async fn connect_channel(
config: &Config,
channel_id: &str,
auth_mode: ChannelAuthMode,
credentials_value: Value,
) -> Result<Outcome<ChannelConnectionResult>, String> {
- let def = find_channel_definition(channel_id)
- .ok_or_else(|| format!("unknown channel: {channel_id}"))?;
-
- let spec = def.auth_mode_spec(auth_mode).ok_or_else(|| {
- format!(
- "channel '{}' does not support auth mode '{}'",
- channel_id, auth_mode
- )
- })?;
-
- // For OAuth/managed modes, return the auth action without storing credentials.
- if let Some(action) = spec.auth_action {
- return Ok(Outcome::new(
- ChannelConnectionResult {
- status: "pending_auth".to_string(),
- restart_required: false,
- auth_action: Some(action.to_string()),
- message: Some(format!("Initiate '{}' auth flow on the frontend. Ignore if you are already in the auth flow.", action)),
- },
- vec![],
- ));
- }
-
- // Credential-based modes: validate required fields.
- let creds_map = credentials_value
- .as_object()
- .ok_or("credentials must be a JSON object")?;
-
- def.validate_credentials(auth_mode, creds_map)?;
-
- // Yuanbao: build the effective config (with any client-supplied
- // endpoint overrides applied) once, verify against THAT cluster, and
- // reuse the same config for persistence below. This prevents the
- // verifier from validating against prod while the runtime then
- // reconnects to a pre-release cluster after restart.
- let mut prebuilt_yuanbao_config: Option<YuanbaoConfig> = None;
- if channel_id == "yuanbao" && auth_mode == ChannelAuthMode::ApiKey {
- let app_key = require_yuanbao_field(creds_map, "app_key")?;
- let app_secret = require_yuanbao_field(creds_map, "app_secret")?;
- let base = config.channels_config.yuanbao.clone().unwrap_or_default();
- let effective = build_effective_yuanbao_config(base, creds_map, app_key);
- verify_yuanbao_credentials(
- crate::config::build_runtime_proxy_client("channel.yuanbao"),
- &effective,
- &app_secret,
- )
- .await?;
- prebuilt_yuanbao_config = Some(effective);
- }
-
- // Email (IMAP/SMTP): build the effective config and live-verify the IMAP
- // login BEFORE storing anything, so bad server settings surface in the UI
- // rather than persisting and wedging the listener on the next restart.
- // Reused below for persistence so verify and runtime can never diverge.
- let mut prebuilt_email_config: Option<EmailConfig> = None;
- if channel_id == "email" && auth_mode == ChannelAuthMode::ApiKey {
- let email_cfg = build_email_config(creds_map, config.channels_config.email.as_ref())?;
- verify_email_credentials(&email_cfg).await?;
- prebuilt_email_config = Some(email_cfg);
- }
-
- // iMessage is local-only (no credentials): persist channels_config + return connected.
- if channel_id == "imessage" && auth_mode == ChannelAuthMode::ManagedDm {
- let allowed_contacts = parse_allowed_users(creds_map.get("allowed_contacts"));
- let allowed_contacts_count = allowed_contacts.len();
-
- let mut persisted = config.clone();
- persisted.channels_config.imessage = Some(IMessageConfig { allowed_contacts });
-
- persisted
- .save()
- .await
- .map_err(|e| format!("failed to persist imessage config.toml: {e}"))?;
-
- tracing::info!(
- target: "openhuman::channels",
- allowed_contacts_count,
- "[imessage] connect_channel: wrote channels_config.imessage; restart core for AppleScript bridge to load"
- );
-
- return Ok(Outcome::single_log(
- ChannelConnectionResult {
- status: "connected".to_string(),
- restart_required: true,
- auth_action: None,
- message: Some(
- "iMessage channel configured. Grant Full Disk Access and restart the service to activate.".to_string(),
- ),
- },
- "stored imessage channel config (local-only)".to_string(),
- ));
- }
-
- // Store credentials via the credentials domain.
- let provider_key = credential_provider(channel_id, auth_mode);
-
- // Extract the primary token field (bot_token or api_key) if present.
- let token = creds_map
- .get("bot_token")
- .or_else(|| creds_map.get("api_key"))
- .and_then(|v| v.as_str())
- .map(|s| s.to_string());
-
- // Store remaining fields as metadata.
- let fields = if creds_map.len() > 1 || (creds_map.len() == 1 && token.is_none()) {
- Some(Value::Object(creds_map.clone()))
+ let service = format!("channel.{channel_id}");
+ let proxy = if config.proxy.should_apply_to_service(&service) {
+ HttpProxyPolicy {
+ http_proxy: config.proxy.http_proxy.clone(),
+ https_proxy: config.proxy.https_proxy.clone(),
+ all_proxy: config.proxy.all_proxy.clone(),
+ no_proxy: config.proxy.normalized_no_proxy(),
+ service_selectors: vec![service],
+ }
} else {
- None
+ HttpProxyPolicy::default()
};
-
- credentials::ops::store_provider_credentials(
- config,
- &provider_key,
- None, // default profile
- token,
- fields,
- Some(true),
+ let prepared = crate::modules::channel_controller::prepare_connection(
+ &ModuleClient::new(config.clone()),
+ ChannelControllerRequest::PrepareConnect {
+ config: config.channels_config.clone(),
+ channel: channel_id.to_owned(),
+ auth_mode,
+ credentials: credentials_value.clone(),
+ proxy,
+ },
)
.await
- .map_err(|e| format!("failed to store credentials: {e}"))?;
-
- // Keep runtime channel config in sync so listeners can actually start
- // with the credentials just connected from the UI.
- if channel_id == "telegram" && auth_mode == ChannelAuthMode::BotToken {
- let bot_token = creds_map
- .get("bot_token")
- .and_then(|v| v.as_str())
- .map(str::trim)
- .filter(|s| !s.is_empty())
- .ok_or_else(|| "missing required bot_token".to_string())?
- .to_string();
- let allowed_users = parse_allowed_users(creds_map.get("allowed_users"));
- let allowed_users_count = allowed_users.len();
- // Default chat for recipient-less proactive sends (mirrors Discord's
- // `channel_id`). Read fresh from the form each connect: present ⇒ use it
- // (empty ⇒ cleared); absent ⇒ unset.
- let chat_id = creds_map
- .get("chat_id")
- .and_then(|v| v.as_str())
- .map(str::trim)
- .filter(|s| !s.is_empty())
- .map(str::to_string);
- let has_chat_id = chat_id.is_some();
-
- let mut persisted = config.clone();
- let (stream_mode, draft_update_interval_ms, silent_streaming, mention_only) =
- if let Some(existing) = persisted.channels_config.telegram.as_ref() {
- (
- existing.stream_mode,
- existing.draft_update_interval_ms,
- existing.silent_streaming,
- existing.mention_only,
- )
- } else {
- (crate::config::StreamMode::default(), 1000, true, false)
- };
-
- persisted.channels_config.telegram = Some(TelegramConfig {
- bot_token,
- chat_id,
- allowed_users,
- stream_mode,
- draft_update_interval_ms,
- silent_streaming,
- mention_only,
- });
-
- persisted
- .save()
- .await
- .map_err(|e| format!("failed to persist telegram config.toml: {e}"))?;
+ .map_err(|error| error.to_string())?;
+ persist_prepared_connection(config, channel_id, auth_mode, credentials_value, prepared).await
+}
- tracing::info!(
- target: "openhuman::channels",
- allowed_users_count,
- has_chat_id,
- mention_only,
- "[telegram] connect_channel: wrote channels_config.telegram; restart core for listener to load token"
- );
- } else if channel_id == "discord" && auth_mode == ChannelAuthMode::BotToken {
- let bot_token = creds_map
+pub(crate) async fn persist_prepared_connection(
+ config: &Config,
+ channel_id: &str,
+ auth_mode: ChannelAuthMode,
+ credentials_value: Value,
+ prepared: PreparedChannelConnection,
+) -> Result<Outcome<ChannelConnectionResult>, String> {
+ if prepared.result.status == "pending_auth"
+ && prepared.result.auth_action.is_some()
+ && prepared.config_update.is_none()
+ && !prepared.result.restart_required
+ {
+ return Ok(Outcome::new(prepared.result, vec![]));
+ }
+ if prepared.result.status != "connected"
+ || prepared.result.auth_action.is_some()
+ || !update_matches_scope(channel_id, auth_mode, prepared.config_update.as_ref())
+ {
+ return Err(malformed());
+ }
+ let creds_map = credentials_value.as_object().ok_or_else(malformed)?;
+ let local_only = channel_id == "imessage" && auth_mode == ChannelAuthMode::ManagedDm;
+ let provider_key = credential_provider(channel_id, auth_mode);
+ if !local_only {
+ // Credential storage policy remains host-owned. Provider validation has
+ // already succeeded in the module before any store is touched.
+ let token = creds_map
.get("bot_token")
- .and_then(|v| v.as_str())
- .map(str::trim)
- .filter(|s| !s.is_empty())
- .ok_or_else(|| "missing required bot_token".to_string())?
- .to_string();
-
- let guild_id = creds_map
- .get("guild_id")
- .and_then(|v| v.as_str())
- .map(str::trim)
- .filter(|s| !s.is_empty())
- .map(|s| s.to_string());
- let discord_channel_id = creds_map
- .get("channel_id")
- .and_then(|v| v.as_str())
- .map(str::trim)
- .filter(|s| !s.is_empty())
- .map(|s| s.to_string());
-
- let mut persisted = config.clone();
- let existing = persisted.channels_config.discord.as_ref();
- // Distinguish an *explicitly cleared* allowlist from an *omitted* one.
- // The field is advertised as "blank = everyone" (definitions.rs) and the
- // provider treats an empty list as allow-all, but the old logic reused
- // the saved list whenever the parsed value was empty — so a user who
- // cleared the allowlist on reconnect stayed restricted to the previous
- // users (#3794 review — Codex P2). The key is present in `creds_map`
- // (even as an empty string) only when the FE sends it; a cleared field
- // now submits an explicit empty value. So: present ⇒ honor literally
- // (empty ⇒ allow-all); absent ⇒ reuse the saved list (reconnect
- // convenience for callers that don't resend the field at all).
- let allowed_users = match creds_map.get("allowed_users") {
- Some(raw) => parse_allowed_users(Some(raw)),
- None => existing
- .map(|cfg| cfg.allowed_users.clone())
- .unwrap_or_default(),
+ .or_else(|| creds_map.get("api_key"))
+ .and_then(Value::as_str)
+ .map(str::to_owned);
+ let fields = if creds_map.len() > 1 || (creds_map.len() == 1 && token.is_none()) {
+ Some(Value::Object(creds_map.clone()))
+ } else {
+ None
};
- let allowed_users_count = allowed_users.len();
- let listen_to_bots = parse_optional_bool(creds_map.get("listen_to_bots"))
- .unwrap_or_else(|| existing.map(|cfg| cfg.listen_to_bots).unwrap_or(false));
- let mention_only = parse_optional_bool(creds_map.get("mention_only"))
- .unwrap_or_else(|| existing.map(|cfg| cfg.mention_only).unwrap_or(false));
-
- persisted.channels_config.discord = Some(DiscordConfig {
- bot_token,
- guild_id: guild_id.clone(),
- channel_id: discord_channel_id.clone(),
- allowed_users,
- listen_to_bots,
- mention_only,
- });
-
- persisted
- .save()
- .await
- .map_err(|e| format!("failed to persist discord config.toml: {e}"))?;
-
- tracing::info!(
- target: "openhuman::channels",
- has_guild_id = guild_id.is_some(),
- has_channel_id = discord_channel_id.is_some(),
- allowed_users_count,
- listen_to_bots,
- mention_only,
- "[discord] connect_channel: wrote channels_config.discord; restart core for listener to load token"
- );
- } else if channel_id == "yuanbao" && auth_mode == ChannelAuthMode::ApiKey {
- // Reuse the effective config built above (with `env` / `api_domain`
- // / `ws_domain` / `route_env` overrides already applied and
- // `app_secret` already cleared) so persistence and verification
- // can never diverge.
- let yb_config = prebuilt_yuanbao_config.take().ok_or_else(|| {
- "internal error: yuanbao config not built before persistence".to_string()
- })?;
-
- let mut persisted = config.clone();
- persisted.channels_config.yuanbao = Some(yb_config);
-
- persisted
- .save()
- .await
- .map_err(|e| format!("failed to persist yuanbao config.toml: {e}"))?;
+ credentials::ops::store_provider_credentials(
+ config,
+ &provider_key,
+ None,
+ token,
+ fields,
+ Some(true),
+ )
+ .await
+ .map_err(|error| format!("failed to store credentials: {error}"))?;
+ }
+ if let Some(update) = prepared.config_update {
+ if let ChannelConfigUpdate::Email(value) = update {
+ super::email::persist_email_config(config, value).await?;
+ } else {
+ let mut persisted = config.clone();
+ match update {
+ ChannelConfigUpdate::Telegram(value) => {
+ persisted.channels_config.telegram = Some(value)
+ }
+ ChannelConfigUpdate::Discord(value) => {
+ persisted.channels_config.discord = Some(value)
+ }
+ ChannelConfigUpdate::IMessage(value) => {
+ persisted.channels_config.imessage = Some(value)
+ }
+ ChannelConfigUpdate::Email(_) => unreachable!("email persistence handled above"),
+ ChannelConfigUpdate::Yuanbao(mut value) => {
+ value.app_secret.clear();
+ persisted.channels_config.yuanbao = Some(*value);
+ }
+ }
+ persisted
+ .save()
+ .await
+ .map_err(|error| format!("failed to persist {channel_id} config.toml: {error}"))?;
+ }
+ }
+ let log = if local_only {
+ "stored imessage channel config (local-only)".to_owned()
+ } else {
+ format!("stored credentials for {provider_key}")
+ };
+ Ok(Outcome::single_log(prepared.result, log))
+}
- tracing::info!(
- target: "openhuman::channels",
- "[yuanbao] connect_channel: wrote channels_config.yuanbao (secret stored in credentials); restart core for WS listener"
- );
- } else if channel_id == "email" && auth_mode == ChannelAuthMode::ApiKey {
- // Reuse the config already built + IMAP-verified above so persistence
- // and verification can never diverge.
- let email_cfg = prebuilt_email_config.take().ok_or_else(|| {
- "internal error: email config not built before persistence".to_string()
- })?;
- persist_email_config(config, email_cfg).await?;
+fn update_matches_scope(
+ channel: &str,
+ mode: ChannelAuthMode,
+ update: Option<&ChannelConfigUpdate>,
+) -> bool {
+ match (channel, mode, update) {
+ ("telegram", ChannelAuthMode::BotToken, Some(ChannelConfigUpdate::Telegram(_)))
+ | ("discord", ChannelAuthMode::BotToken, Some(ChannelConfigUpdate::Discord(_)))
+ | ("imessage", ChannelAuthMode::ManagedDm, Some(ChannelConfigUpdate::IMessage(_)))
+ | ("email", ChannelAuthMode::ApiKey, Some(ChannelConfigUpdate::Email(_)))
+ | ("yuanbao", ChannelAuthMode::ApiKey, Some(ChannelConfigUpdate::Yuanbao(_))) => true,
+ ("telegram", ChannelAuthMode::BotToken, _)
+ | ("discord", ChannelAuthMode::BotToken, _)
+ | ("imessage", ChannelAuthMode::ManagedDm, _)
+ | ("email", ChannelAuthMode::ApiKey, _)
+ | ("yuanbao", ChannelAuthMode::ApiKey, _) => false,
+ (_, _, None) => true,
+ _ => false,
}
+}
- Ok(Outcome::single_log(
- ChannelConnectionResult {
- status: "connected".to_string(),
- restart_required: true,
- auth_action: None,
- message: Some(format!(
- "Channel '{}' credentials stored. Restart the service to activate.",
- channel_id
- )),
- },
- format!("stored credentials for {}", provider_key),
- ))
+fn malformed() -> String {
+ ModuleClient::report_malformed_reply("tinychannels");
+ ModuleCallError::ModuleFault.to_string()
}
+
+#[cfg(test)]
+#[path = "connect_channel_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel_tests.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel_tests.rs
new file mode 100644
index 0000000000..1bafa1deb1
--- /dev/null
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel_tests.rs
@@ -0,0 +1,112 @@
+use super::*;
+
+fn isolated_config() -> (tempfile::TempDir, Config) {
+ let directory = tempfile::tempdir().unwrap();
+ let mut config = Config::default();
+ config.modules.enabled = false;
+ config.workspace_dir = directory.path().join("workspace");
+ config.config_path = directory.path().join("config.toml");
+ (directory, config)
+}
+
+fn connected(update: ChannelConfigUpdate) -> PreparedChannelConnection {
+ PreparedChannelConnection {
+ result: ChannelConnectionResult {
+ status: "connected".into(),
+ restart_required: true,
+ auth_action: None,
+ message: Some("fixture verified".into()),
+ },
+ config_update: Some(update),
+ }
+}
+
+#[tokio::test]
+async fn unavailable_module_cannot_store_valid_channel_credentials() {
+ let (_directory, config) = isolated_config();
+ let error = connect_channel(
+ &config,
+ "telegram",
+ ChannelAuthMode::BotToken,
+ serde_json::json!({"bot_token":"fixture-token"}),
+ )
+ .await
+ .unwrap_err();
+ assert!(error.contains("module unavailable"), "{error}");
+ assert!(!config.config_path.exists());
+ assert!(!config.workspace_dir.exists());
+}
+
+#[tokio::test]
+async fn prepared_update_cannot_write_another_provider_or_credentials() {
+ let (_directory, config) = isolated_config();
+ let error = persist_prepared_connection(
+ &config,
+ "telegram",
+ ChannelAuthMode::BotToken,
+ serde_json::json!({"bot_token":"fixture-token"}),
+ connected(ChannelConfigUpdate::IMessage(
+ tinychannels_bus::config::IMessageConfig {
+ allowed_contacts: vec!["different-provider".into()],
+ },
+ )),
+ )
+ .await
+ .unwrap_err();
+ assert!(error.contains("module execution failed"), "{error}");
+ assert!(!config.config_path.exists());
+ assert!(!config.workspace_dir.exists());
+}
+
+#[tokio::test]
+async fn pending_module_auth_action_does_not_touch_credentials_or_configuration() {
+ let (_directory, config) = isolated_config();
+ let result = persist_prepared_connection(
+ &config,
+ "discord",
+ ChannelAuthMode::OAuth,
+ Value::Null,
+ PreparedChannelConnection {
+ result: ChannelConnectionResult {
+ status: "pending_auth".into(),
+ restart_required: false,
+ auth_action: Some("discord_oauth".into()),
+ message: None,
+ },
+ config_update: None,
+ },
+ )
+ .await
+ .unwrap();
+ assert_eq!(result.value.auth_action.as_deref(), Some("discord_oauth"));
+ assert!(!config.config_path.exists());
+ assert!(!config.workspace_dir.exists());
+}
+
+#[tokio::test]
+async fn prepared_local_imessage_configuration_is_persisted_without_credentials() {
+ let (_directory, config) = isolated_config();
+ persist_prepared_connection(
+ &config,
+ "imessage",
+ ChannelAuthMode::ManagedDm,
+ serde_json::json!({}),
+ connected(ChannelConfigUpdate::IMessage(
+ tinychannels_bus::config::IMessageConfig {
+ allowed_contacts: vec!["alice".into()],
+ },
+ )),
+ )
+ .await
+ .unwrap();
+ let persisted: toml::Value = toml::from_str(
+ &tokio::fs::read_to_string(&config.config_path)
+ .await
+ .unwrap(),
+ )
+ .unwrap();
+ assert_eq!(
+ persisted["channels_config"]["imessage"]["allowed_contacts"][0].as_str(),
+ Some("alice")
+ );
+}
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs
index abff24b65a..f65f9bded7 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs
@@ -5,8 +5,8 @@
//! `providers::verify_email_credentials`); writing it to `config.toml` without
//! the secret is this host's policy.
-use crate::channels::email_channel::EmailConfig;
use crate::config::Config;
+use tinychannels_bus::config::EmailConfig;
/// Persist an already-built + verified [`EmailConfig`] into
/// `channels_config.email` so the supervised IMAP/SMTP listener picks it up on
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs
index 3cb2c5f5e3..efb9ee1e2e 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs
@@ -1,8 +1,6 @@
//! Small helpers shared across the connect/disconnect/status operations.
-pub(crate) use tinychannels::controllers::{
- channel_config_connected, parse_allowed_users, parse_optional_bool,
-};
+pub(crate) use tinychannels::controllers::channel_config_connected;
/// Merge a channel's live supervised-listener health into its credential/config
/// derived `connected` flag (issue #3712).
diff --git a/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rs b/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rs
index 0c967271a2..253f5dec47 100644
--- a/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops_connect_status_tests.rs
@@ -1,9 +1,9 @@
use super::*;
#[tokio::test]
-async fn connect_discord_bot_token_persists_runtime_config() {
+async fn persist_prepared_discord_configuration_and_encrypted_token() {
let (_tmp, config) = isolated_test_config();
- let result = connect_channel(
+ let result = persist_module_fixture(
&config,
"discord",
ChannelAuthMode::BotToken,
@@ -12,6 +12,14 @@ async fn connect_discord_bot_token_persists_runtime_config() {
"guild_id": "guild-1",
"channel_id": "channel-2"
}),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::Discord(DiscordConfig {
+ bot_token: "discord-token-123".into(),
+ guild_id: Some("guild-1".into()),
+ channel_id: Some("channel-2".into()),
+ allowed_users: vec![],
+ listen_to_bots: false,
+ mention_only: false,
+ }),
)
.await
.expect("discord connect should succeed");
@@ -46,9 +54,9 @@ async fn connect_discord_bot_token_persists_runtime_config() {
}
#[tokio::test]
-async fn connect_telegram_bot_token_persists_chat_id() {
+async fn persist_prepared_telegram_chat_target() {
let (_tmp, config) = isolated_test_config();
- let result = connect_channel(
+ let result = persist_module_fixture(
&config,
"telegram",
ChannelAuthMode::BotToken,
@@ -56,6 +64,17 @@ async fn connect_telegram_bot_token_persists_chat_id() {
"bot_token": "telegram-token-123",
"chat_id": " 987654 "
}),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::Telegram(
+ tinychannels_bus::config::TelegramConfig {
+ bot_token: "telegram-token-123".into(),
+ chat_id: Some("987654".into()),
+ allowed_users: vec![],
+ stream_mode: tinychannels_bus::config::StreamMode::Off,
+ draft_update_interval_ms: 1000,
+ silent_streaming: true,
+ mention_only: false,
+ },
+ ),
)
.await
.expect("telegram connect should succeed");
@@ -81,18 +100,26 @@ async fn connect_telegram_bot_token_persists_chat_id() {
}
#[tokio::test]
-async fn connect_discord_omitted_allowlist_reuses_existing() {
+async fn persist_prepared_discord_retained_allowlist() {
// Reconnecting without resending `allowed_users` keeps the saved list — the
// reconnect-convenience path (#3794 review — Codex P2).
let (_tmp, mut config) = isolated_test_config();
seed_discord_with_allowlist(&mut config);
config.save().await.expect("seed should persist");
- connect_channel(
+ persist_module_fixture(
&config,
"discord",
ChannelAuthMode::BotToken,
serde_json::json!({ "bot_token": "discord-token-abc" }),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::Discord(DiscordConfig {
+ bot_token: "discord-token-abc".into(),
+ guild_id: None,
+ channel_id: None,
+ allowed_users: vec!["111".into(), "222".into()],
+ listen_to_bots: false,
+ mention_only: false,
+ }),
)
.await
.expect("reconnect should succeed");
@@ -105,7 +132,7 @@ async fn connect_discord_omitted_allowlist_reuses_existing() {
}
#[tokio::test]
-async fn connect_discord_cleared_allowlist_allows_everyone() {
+async fn persist_prepared_discord_empty_allowlist() {
// Clearing the allowlist in the UI submits an explicit empty value; the
// backend must honor it (empty ⇒ allow-all) instead of reusing the old list
// (#3794 review — Codex P2).
@@ -113,11 +140,19 @@ async fn connect_discord_cleared_allowlist_allows_everyone() {
seed_discord_with_allowlist(&mut config);
config.save().await.expect("seed should persist");
- connect_channel(
+ persist_module_fixture(
&config,
"discord",
ChannelAuthMode::BotToken,
serde_json::json!({ "bot_token": "discord-token-abc", "allowed_users": "" }),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::Discord(DiscordConfig {
+ bot_token: "discord-token-abc".into(),
+ guild_id: None,
+ channel_id: None,
+ allowed_users: vec![],
+ listen_to_bots: false,
+ mention_only: false,
+ }),
)
.await
.expect("reconnect should succeed");
@@ -162,15 +197,18 @@ async fn disconnect_discord_bot_token_clears_runtime_config() {
// ── iMessage channel ───────────────────────────────────────────
#[tokio::test]
-async fn connect_imessage_persists_allowed_contacts() {
+async fn persist_prepared_imessage_allowed_contacts() {
let (_tmp, config) = isolated_test_config();
- let result = connect_channel(
+ let result = persist_module_fixture(
&config,
"imessage",
ChannelAuthMode::ManagedDm,
serde_json::json!({
"allowed_contacts": "+15551234567, [email protected]"
}),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::IMessage(IMessageConfig {
+ allowed_contacts: vec!["+15551234567".into(), "[email protected]".into()],
+ }),
)
.await
.expect("imessage connect should succeed");
@@ -198,13 +236,16 @@ async fn connect_imessage_persists_allowed_contacts() {
}
#[tokio::test]
-async fn connect_imessage_allows_empty_contacts() {
+async fn persist_prepared_imessage_empty_contacts() {
let (_tmp, config) = isolated_test_config();
- let result = connect_channel(
+ let result = persist_module_fixture(
&config,
"imessage",
ChannelAuthMode::ManagedDm,
serde_json::json!({}),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::IMessage(IMessageConfig {
+ allowed_contacts: vec![],
+ }),
)
.await
.expect("imessage connect with no contacts should succeed");
@@ -519,21 +560,9 @@ async fn connected_channel_slugs_empty_when_nothing_configured() {
}
#[tokio::test]
-async fn connect_yuanbao_rejects_invalid_credentials() {
- use wiremock::matchers::{method, path};
- use wiremock::{Mock, MockServer, ResponseTemplate};
-
- let server = MockServer::start().await;
- Mock::given(method("POST"))
- .and(path("/api/v5/robotLogic/sign-token"))
- .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({
- "code": 40001,
- "msg": "invalid signature",
- })))
- .mount(&server)
- .await;
-
- let (_tmp, config) = yuanbao_test_config(&server.uri());
+async fn unavailable_module_cannot_persist_yuanbao_credentials() {
+ let (_tmp, mut config) = isolated_test_config();
+ config.modules.enabled = false;
let err = connect_channel(
&config,
"yuanbao",
@@ -544,16 +573,15 @@ async fn connect_yuanbao_rejects_invalid_credentials() {
.expect_err("invalid yuanbao credentials should fail");
assert!(
- err.contains("yuanbao credential verification failed") && err.contains("invalid signature"),
- "expected upstream API msg in error, got: {err}"
+ err.contains("module unavailable"),
+ "expected explicit unavailable module error, got: {err}"
);
// Nothing should be persisted on failure: no TOML write, no credential row.
let raw = tokio::fs::read_to_string(&config.config_path).await.ok();
if let Some(text) = raw {
let parsed: toml::Value = toml::from_str(&text).expect("config parses");
- // The mock api_domain we pre-loaded is allowed to be present, but
- // app_key / app_secret must NOT have been written.
+ // No new credentials may be written when the module is unavailable.
if let Some(yb) = parsed
.get("channels_config")
.and_then(|v| v.get("yuanbao"))
diff --git a/crates/openhuman-core/src/channels/controllers/ops_tests.rs b/crates/openhuman-core/src/channels/controllers/ops_tests.rs
index e301b86e3c..19701c9a93 100644
--- a/crates/openhuman-core/src/channels/controllers/ops_tests.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops_tests.rs
@@ -1,12 +1,14 @@
+use super::types::ChannelConnectionResult;
use super::*;
-use crate::channels::email_channel::EmailConfig;
-use crate::channels::providers::yuanbao::YuanbaoConfig;
use crate::config::schema::{DiscordConfig, IMessageConfig};
+use crate::core::Outcome;
use tempfile::tempdir;
+use tinychannels_bus::config::{EmailConfig, YuanbaoConfig};
fn isolated_test_config() -> (tempfile::TempDir, Config) {
let tmp = tempdir().expect("failed to create temp dir");
let mut config = Config::default();
+ config.modules.allow_download = false;
config.workspace_dir = tmp.path().join("workspace");
config.config_path = tmp.path().join("config.toml");
std::fs::create_dir_all(&config.workspace_dir).expect("failed to create workspace dir");
@@ -44,24 +46,34 @@ fn seed_discord_with_allowlist(config: &mut Config) {
});
}
-// ── Yuanbao channel credential verification ────────────────────
-// Issue: connect_channel for yuanbao previously stored creds and returned
-// "connected" without ever calling the upstream sign-token endpoint, so
-// random input (e.g. app_key=12) showed as Connected in the UI. The fix
-// calls `/api/v5/robotLogic/sign-token` and propagates the API error.
-
-/// Build a Config pre-pointed at a mock `api_domain` so the verification
-/// step hits the wiremock server instead of the live prod URL.
-fn yuanbao_test_config(mock_uri: &str) -> (tempfile::TempDir, Config) {
- let (tmp, mut config) = isolated_test_config();
- config.channels_config.yuanbao = Some(YuanbaoConfig {
- api_domain: mock_uri.to_string(),
- ..Default::default()
- });
- (tmp, config)
-}
-
#[path = "ops_connect_status_tests.rs"]
mod connect_status_tests;
#[path = "ops_yuanbao_email_tests.rs"]
mod yuanbao_email_tests;
+
+/// A recorded module result fixture: host tests exercise custody/persistence,
+/// while native verification and provider defaults are tested in TinyChannels.
+async fn persist_module_fixture(
+ config: &Config,
+ channel: &str,
+ mode: ChannelAuthMode,
+ credentials: serde_json::Value,
+ update: tinychannels_bus::module_controller::ChannelConfigUpdate,
+) -> Result<Outcome<ChannelConnectionResult>, String> {
+ connect::persist_prepared_connection(
+ config,
+ channel,
+ mode,
+ credentials,
+ tinychannels_bus::module_controller::PreparedChannelConnection {
+ result: ChannelConnectionResult {
+ status: "connected".into(),
+ restart_required: true,
+ auth_action: None,
+ message: Some("verified by module fixture".into()),
+ },
+ config_update: Some(update),
+ },
+ )
+ .await
+}
diff --git a/crates/openhuman-core/src/channels/controllers/ops_yuanbao_email_tests.rs b/crates/openhuman-core/src/channels/controllers/ops_yuanbao_email_tests.rs
index 039a0ac007..14368007d7 100644
--- a/crates/openhuman-core/src/channels/controllers/ops_yuanbao_email_tests.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops_yuanbao_email_tests.rs
@@ -1,36 +1,24 @@
use super::*;
#[tokio::test]
-async fn connect_yuanbao_persists_when_credentials_valid() {
- use wiremock::matchers::{method, path};
- use wiremock::{Mock, MockServer, ResponseTemplate};
-
- let server = MockServer::start().await;
- Mock::given(method("POST"))
- .and(path("/api/v5/robotLogic/sign-token"))
- .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({
- "code": 0,
- "data": {
- "token": "tok-abc",
- "bot_id": "bot-123",
- "product": "yuanbao",
- "source": "openhuman",
- "duration": 3600,
- }
- })))
- .mount(&server)
- .await;
-
- let (_tmp, config) = yuanbao_test_config(&server.uri());
- let result = connect_channel(
+async fn persist_prepared_yuanbao_without_plaintext_secret() {
+ let (_tmp, config) = isolated_test_config();
+ let mock_uri = "https://module-verified.invalid".to_owned();
+ let update = YuanbaoConfig {
+ app_key: "real-key".into(),
+ app_secret: String::new(),
+ api_domain: mock_uri.clone(),
+ ..Default::default()
+ };
+ let result = persist_module_fixture(
&config,
"yuanbao",
ChannelAuthMode::ApiKey,
- serde_json::json!({ "app_key": "real-key", "app_secret": "real-secret" }),
+ serde_json::json!({"app_key":"real-key", "app_secret":"real-secret"}),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::Yuanbao(Box::new(update)),
)
.await
- .expect("valid yuanbao credentials should succeed");
-
+ .expect("verified module configuration should persist");
assert_eq!(result.value.status, "connected");
assert!(result.value.restart_required);
@@ -72,64 +60,31 @@ async fn connect_yuanbao_persists_when_credentials_valid() {
}
#[tokio::test]
-async fn connect_yuanbao_verifies_against_overridden_api_domain() {
- // Regression: previously, `verify_yuanbao_credentials` rebuilt the
- // YuanbaoConfig from `config.channels_config.yuanbao` alone and
- // ignored the `api_domain` / `env` / `route_env` overrides on the
- // connect-channel payload. A user submitting `env = "pre"` could
- // pass verification against PROD and then fail after restart when
- // the persisted override took effect.
- //
- // Here the base TOML's `api_domain` deliberately points at an
- // unreachable URL — verification only succeeds if the override
- // supplied in `creds_map` is what actually gets used.
- use wiremock::matchers::{header, method, path};
- use wiremock::{Mock, MockServer, ResponseTemplate};
-
- let server = MockServer::start().await;
- Mock::given(method("POST"))
- .and(path("/api/v5/robotLogic/sign-token"))
- .and(header("X-Route-Env", "canary"))
- .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({
- "code": 0,
- "data": {
- "token": "tok-override",
- "bot_id": "bot-1",
- "product": "yuanbao",
- "source": "openhuman",
- "duration": 3600,
- }
- })))
- .mount(&server)
- .await;
-
- let (_tmp, mut config) = isolated_test_config();
- // Base TOML points to a black hole so the test fails immediately if
- // the verifier ignores the override.
- config.channels_config.yuanbao = Some(YuanbaoConfig {
- api_domain: "http://127.0.0.1:1".to_string(),
+async fn persist_yuanbao_module_verified_api_override() {
+ // TinyChannels verifies the override before returning this fixture. The
+ // host must preserve the returned endpoint and route during persistence.
+ let (_tmp, config) = isolated_test_config();
+ let mock_uri = "https://module-verified.invalid".to_owned();
+ let update = YuanbaoConfig {
+ app_key: "k".into(),
+ app_secret: String::new(),
+ api_domain: mock_uri.clone(),
+ env: "prod".into(),
+ route_env: "canary".into(),
..Default::default()
- });
-
- let mock_uri = server.uri();
- let result = connect_channel(
+ };
+ let result = persist_module_fixture(
&config,
"yuanbao",
ChannelAuthMode::ApiKey,
- serde_json::json!({
- "app_key": "k",
- "app_secret": "s",
- "api_domain": mock_uri.clone(),
- "route_env": "canary",
- }),
+ serde_json::json!({"app_key":"k", "app_secret":"s"}),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::Yuanbao(Box::new(update)),
)
.await
- .expect("override should be applied before verify");
-
+ .expect("verified module configuration should persist");
assert_eq!(result.value.status, "connected");
+ assert!(result.value.restart_required);
- // The override should also have been persisted (single source of
- // truth between verify and persist).
let raw = tokio::fs::read_to_string(&config.config_path)
.await
.expect("config should be persisted");
@@ -150,40 +105,28 @@ async fn connect_yuanbao_verifies_against_overridden_api_domain() {
}
#[tokio::test]
-async fn connect_yuanbao_persists_env_override() {
- use wiremock::matchers::{method, path};
- use wiremock::{Mock, MockServer, ResponseTemplate};
-
- let server = MockServer::start().await;
- Mock::given(method("POST"))
- .and(path("/api/v5/robotLogic/sign-token"))
- .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({
- "code": 0,
- "data": {
- "token": "tok-pre",
- "bot_id": "bot-456",
- "product": "yuanbao",
- "source": "openhuman",
- "duration": 3600,
- }
- })))
- .mount(&server)
- .await;
-
- let (_tmp, config) = yuanbao_test_config(&server.uri());
- connect_channel(
+async fn persist_prepared_yuanbao_environment_override() {
+ let (_tmp, config) = isolated_test_config();
+ let mock_uri = "https://module-verified.invalid".to_owned();
+ let update = YuanbaoConfig {
+ app_key: "k".into(),
+ app_secret: String::new(),
+ api_domain: mock_uri.clone(),
+ env: "pre".into(),
+ route_env: "canary".into(),
+ ..Default::default()
+ };
+ let result = persist_module_fixture(
&config,
"yuanbao",
ChannelAuthMode::ApiKey,
- serde_json::json!({
- "app_key": "k",
- "app_secret": "s",
- "env": "pre",
- "route_env": "canary",
- }),
+ serde_json::json!({"app_key":"k", "app_secret":"s"}),
+ tinychannels_bus::module_controller::ChannelConfigUpdate::Yuanbao(Box::new(update)),
)
.await
- .expect("valid yuanbao credentials should succeed");
+ .expect("verified module configuration should persist");
+ assert_eq!(result.value.status, "connected");
+ assert!(result.value.restart_required);
let raw = tokio::fs::read_to_string(&config.config_path)
.await
@@ -280,10 +223,11 @@ async fn disconnect_email_clears_channels_config() {
}
#[tokio::test]
-async fn connect_email_rejects_invalid_port_before_network() {
- // All required fields present so validation passes; a non-numeric port makes
- // build_email_config fail in the pre-verify step, before any IMAP dial.
- let config = Config::default();
+async fn connect_email_requires_module_before_native_port_validation() {
+ // Native malformed-port coverage lives in TinyChannels. With no module,
+ // the host must not run a parser or dial a mailbox itself.
+ let mut config = Config::default();
+ config.modules.enabled = false;
let err = connect_channel(
&config,
"email",
@@ -298,7 +242,7 @@ async fn connect_email_rejects_invalid_port_before_network() {
)
.await
.expect_err("invalid port must be rejected");
- assert!(err.contains("imap_port"), "{err}");
+ assert!(err.contains("module unavailable"), "{err}");
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/channels/controllers/schemas.rs b/crates/openhuman-core/src/channels/controllers/schemas.rs
index e3349eda64..8aa4996805 100644
--- a/crates/openhuman-core/src/channels/controllers/schemas.rs
+++ b/crates/openhuman-core/src/channels/controllers/schemas.rs
@@ -243,22 +243,22 @@ fn handle_connect(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
let p = deserialize_params::<ConnectParams>(params)?;
- let channel = p.channel.trim();
- let mode: ChannelAuthMode = p
- .auth_mode
- .parse()
- .map_err(|e: String| format!("invalid authMode: {e}"))?;
- let creds = p.credentials.unwrap_or(Value::Object(Map::new()));
- let manager = openhuman_channel_manager(config);
- let result = manager
- .connect(channel, mode, creds)
- .await
- .map_err(|e| e.to_string())?;
- let logs = connect_logs(channel, mode, result.auth_action.is_some());
- to_json(Outcome::new(result, logs))
+ connect_with_config(&config, p).await
})
}
+async fn connect_with_config(config: &Config, p: ConnectParams) -> Result<Value, String> {
+ let channel = p.channel.trim();
+ let mode: ChannelAuthMode = p
+ .auth_mode
+ .parse()
+ .map_err(|error: String| format!("invalid authMode: {error}"))?;
+ let creds = p.credentials.unwrap_or(Value::Object(Map::new()));
+ let outcome = super::ops::connect_channel(config, channel, mode, creds).await?;
+ let logs = connect_logs(channel, mode, outcome.value.auth_action.is_some());
+ to_json(Outcome::new(outcome.value, logs))
+}
+
fn handle_disconnect(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
diff --git a/crates/openhuman-core/src/channels/controllers/schemas_tests.rs b/crates/openhuman-core/src/channels/controllers/schemas_tests.rs
index abbb972bd5..df73ceee11 100644
--- a/crates/openhuman-core/src/channels/controllers/schemas_tests.rs
+++ b/crates/openhuman-core/src/channels/controllers/schemas_tests.rs
@@ -152,3 +152,25 @@ fn hosted_link_functions_are_not_served_by_the_core() {
}
assert!(names.contains(&"send_message"));
}
+
+#[tokio::test]
+async fn channel_connect_handler_requires_module_before_provider_field_validation() {
+ let directory = tempfile::tempdir().unwrap();
+ let mut config = Config::default();
+ config.modules.enabled = false;
+ config.workspace_dir = directory.path().join("workspace");
+ config.config_path = directory.path().join("config.toml");
+ let error = connect_with_config(
+ &config,
+ ConnectParams {
+ channel: " telegram ".into(),
+ auth_mode: "bot_token".into(),
+ credentials: Some(Value::Null),
+ },
+ )
+ .await
+ .unwrap_err();
+ assert!(error.contains("module unavailable"), "{error}");
+ assert!(!config.config_path.exists());
+ assert!(!config.workspace_dir.exists());
+}
diff --git a/crates/openhuman-core/src/modules/channel_controller.rs b/crates/openhuman-core/src/modules/channel_controller.rs
index 2d1481da14..2908393d3d 100644
--- a/crates/openhuman-core/src/modules/channel_controller.rs
+++ b/crates/openhuman-core/src/modules/channel_controller.rs
@@ -42,6 +42,23 @@ fn decode_discord<R: DeserializeOwned>(
})
}
+/// Prepare a verified connection without running provider behavior in the host.
+pub(crate) async fn prepare_connection(
+ client: &ModuleClient,
+ request: ChannelControllerRequest,
+) -> Result<tinychannels_bus::module_controller::PreparedChannelConnection, ModuleCallError> {
+ let response = client
+ .call_confidential("tinychannels", methods::CHANNEL_CONTROLLER, (request,))
+ .await?;
+ match response {
+ ChannelControllerResult::PreparedConnect(prepared) => Ok(*prepared),
+ _ => {
+ ModuleClient::report_malformed_reply("tinychannels");
+ Err(ModuleCallError::ModuleFault)
+ }
+ }
+}
+
/// Resolve OpenHuman's proxy scope before transmitting provider configuration.
pub(crate) fn discord_proxy(config: &crate::config::Config) -> HttpProxyPolicy {
let proxy = &config.proxy;
diff --git a/crates/openhuman-core/src/modules/channel_controller_tests.rs b/crates/openhuman-core/src/modules/channel_controller_tests.rs
index 1d94b4c807..026d4a75c0 100644
--- a/crates/openhuman-core/src/modules/channel_controller_tests.rs
+++ b/crates/openhuman-core/src/modules/channel_controller_tests.rs
@@ -47,7 +47,7 @@ async fn discord_credentials_never_reach_an_unattested_bus() {
)
.unwrap();
let result = discord::<Vec<DiscordGuild>>(
- &ModuleClient::fixture(proxy),
+ &ModuleClient::fixture(proxy.clone()),
ChannelControllerRequest::DiscordListGuilds {
config: Default::default(),
bot_token: "fixture-token".into(),
@@ -57,6 +57,18 @@ async fn discord_credentials_never_reach_an_unattested_bus() {
)
.await;
assert_eq!(result.unwrap_err(), ModuleCallError::TransportFailed);
+ let prepared = prepare_connection(
+ &ModuleClient::fixture(proxy),
+ ChannelControllerRequest::PrepareConnect {
+ config: Default::default(),
+ channel: "discord".into(),
+ auth_mode: tinychannels_bus::ChannelAuthMode::BotToken,
+ credentials: json!({"bot_token":"fixture-token"}),
+ proxy: Default::default(),
+ },
+ )
+ .await;
+ assert!(matches!(prepared, Err(ModuleCallError::TransportFailed)));
assert_eq!(calls.load(std::sync::atomic::Ordering::SeqCst), 0);
}
diff --git a/crates/openhuman-core/src/modules/registry/records_extra.rs b/crates/openhuman-core/src/modules/registry/records_extra.rs
index 1047d545e9..17411dac28 100644
--- a/crates/openhuman-core/src/modules/registry/records_extra.rs
+++ b/crates/openhuman-core/src/modules/registry/records_extra.rs
@@ -76,63 +76,63 @@ pub(crate) const TINYCHANNELS: ModuleRecord = ModuleRecord {
description: "Channel provider lifecycle and message transport",
bus_name: "ai.tinyhumans.tinychannels.Channels",
object_path: "/ai/tinyhumans/tinychannels/Channels",
- version: "0.1.16",
- release_url: "https://github.com/tinyhumansai/tinychannels/releases/tag/v0.1.16",
+ version: "0.1.17",
+ release_url: "https://github.com/tinyhumansai/tinychannels/releases/tag/v0.1.17",
assets: &[
PlatformAsset {
host_key: "macos-15-arm64",
- archive: "tinychannels-module-0.1.16-macos-15-arm64.tar.gz",
- sha256: "2488b7960ed80393ff508d2b0d299b531fe4be4ccade15026be528399efe3612",
+ archive: "tinychannels-module-0.1.17-macos-15-arm64.tar.gz",
+ sha256: "79a0c1f14258d9a8230eb6a9bd962f243d84ca57381e48e0840e6696b3d86ce2",
},
PlatformAsset {
host_key: "macos-15-x86_64",
- archive: "tinychannels-module-0.1.16-macos-15-x86_64.tar.gz",
- sha256: "a7e35d80be826317105a245e6c9327f18edd25f6cbb86b36fdae91a32fc7c169",
+ archive: "tinychannels-module-0.1.17-macos-15-x86_64.tar.gz",
+ sha256: "9beeb0697a0eee6016aae0aeb27999ffa115945c20a7786742ade1c09dfb3d84",
},
PlatformAsset {
host_key: "macos-26-arm64",
- archive: "tinychannels-module-0.1.16-macos-26-arm64.tar.gz",
- sha256: "4e5e32b618d84002f3de6b70d161225f4ad7cb4aebce3779e888e3360767c0db",
+ archive: "tinychannels-module-0.1.17-macos-26-arm64.tar.gz",
+ sha256: "bc08c3d3d2ec1ba7f07593fd67e7e2b394757478e4de9e8e66dc6ba9a9cb2413",
},
PlatformAsset {
host_key: "macos-26-x86_64",
- archive: "tinychannels-module-0.1.16-macos-26-x86_64.tar.gz",
- sha256: "5b87511967bd585a91263b519006b3dd35eb56bcd1524319d75cc0440e313f29",
+ archive: "tinychannels-module-0.1.17-macos-26-x86_64.tar.gz",
+ sha256: "0eeb60e6f55f4d7f6ded815ea95d1722917285e13ebad6fa5c1e2211766c335b",
},
PlatformAsset {
host_key: "ubuntu-22.04-arm64",
- archive: "tinychannels-module-0.1.16-ubuntu-22.04-arm64.tar.gz",
- sha256: "9cfef098d829697c86b614bf32fe8c73b783e1cd0f6b4fd4a283209ed24a9a14",
+ archive: "tinychannels-module-0.1.17-ubuntu-22.04-arm64.tar.gz",
+ sha256: "fa5f5aeedeca8ab03cfd31a5865c1f69e0ee7a935a7461c3f87c7fc491f6765d",
},
PlatformAsset {
host_key: "ubuntu-22.04-x86_64",
- archive: "tinychannels-module-0.1.16-ubuntu-22.04-x86_64.tar.gz",
- sha256: "c3b7a3b05928a313ecba0b01de537b38f2f2a6a80b51d15c9137ca8f3b2a5ee3",
+ archive: "tinychannels-module-0.1.17-ubuntu-22.04-x86_64.tar.gz",
+ sha256: "ab6c61dc697637e9ef07067d17d369e99f4bc3284815320f68048ce456271355",
},
PlatformAsset {
host_key: "ubuntu-24.04-arm64",
- archive: "tinychannels-module-0.1.16-ubuntu-24.04-arm64.tar.gz",
- sha256: "889637ea1fa329990bcccc1ad16a0432554fe9439dcb782edda72f5050470fbd",
+ archive: "tinychannels-module-0.1.17-ubuntu-24.04-arm64.tar.gz",
+ sha256: "cae106ae240d9f7d5022e397a33df4f851c8114c205292c4b5d84d817a9aba1a",
},
PlatformAsset {
host_key: "ubuntu-24.04-x86_64",
- archive: "tinychannels-module-0.1.16-ubuntu-24.04-x86_64.tar.gz",
- sha256: "ce6ae3a46029b645c861a18d7ffcaa51792d4533cddcf0fc44de61b3d5193abf",
+ archive: "tinychannels-module-0.1.17-ubuntu-24.04-x86_64.tar.gz",
+ sha256: "896af998236d9a27df67da8d99badee8a17b971aca3a7158700679baea267c49",
},
PlatformAsset {
host_key: "windows-11-arm64",
- archive: "tinychannels-module-0.1.16-windows-11-arm64.zip",
- sha256: "2b1718cecc45c19860ff99ea0ed577d904c84f76fa08c677417efecb5e7b4c05",
+ archive: "tinychannels-module-0.1.17-windows-11-arm64.zip",
+ sha256: "534415e3d59bed642e0b4e9ca623e2706a4f53e544fb2331dbcc5d27d4fb1833",
},
PlatformAsset {
host_key: "windows-2022-x86_64",
- archive: "tinychannels-module-0.1.16-windows-2022-x86_64.zip",
- sha256: "da0f1d6a7481a1f3d9bac5023dcd3f641bfcf16a568fe9121b9a23f8931aa2d3",
+ archive: "tinychannels-module-0.1.17-windows-2022-x86_64.zip",
+ sha256: "5a1be7f484d67282612f98325a8a72503b70f5ea5c9b4fba01dc92077624f759",
},
PlatformAsset {
host_key: "windows-2025-x86_64",
- archive: "tinychannels-module-0.1.16-windows-2025-x86_64.zip",
- sha256: "713977d18ac820cfca18264ca984776cfba4d440d5dbd42f57e1bc905bf83c79",
+ archive: "tinychannels-module-0.1.17-windows-2025-x86_64.zip",
+ sha256: "9fb1d787045bd835c3422b555133db34b158bb5f0ec2a7033249ebf713a16c46",
},
],
load: LoadPolicy::Lazy,
diff --git a/crates/openhuman-core/src/modules/registry_tests.rs b/crates/openhuman-core/src/modules/registry_tests.rs
index 3bf49efe2b..ebd1a29c77 100644
--- a/crates/openhuman-core/src/modules/registry_tests.rs
+++ b/crates/openhuman-core/src/modules/registry_tests.rs
@@ -369,3 +369,77 @@ fn find_resolves_known_ids_only() {
assert!(find("tinydocs").is_some());
assert!(find("not-a-module").is_none());
}
+
+#[test]
+fn tinychannels_registry_matches_prepared_connection_release() {
+ let record = find("tinychannels").expect("compiled TinyChannels module");
+ assert_eq!(record.version, "0.1.17");
+ assert_eq!(tinychannels_bus::CONTRACT_VERSION, 7);
+ assert_eq!(
+ tinychannels_bus::module_relay::MODULE_OPERATION_VERSION,
+ (1, 8)
+ );
+ let expected = [
+ (
+ "macos-15-arm64",
+ "tinychannels-module-0.1.17-macos-15-arm64.tar.gz",
+ "79a0c1f14258d9a8230eb6a9bd962f243d84ca57381e48e0840e6696b3d86ce2",
+ ),
+ (
+ "macos-15-x86_64",
+ "tinychannels-module-0.1.17-macos-15-x86_64.tar.gz",
+ "9beeb0697a0eee6016aae0aeb27999ffa115945c20a7786742ade1c09dfb3d84",
+ ),
+ (
+ "macos-26-arm64",
+ "tinychannels-module-0.1.17-macos-26-arm64.tar.gz",
+ "bc08c3d3d2ec1ba7f07593fd67e7e2b394757478e4de9e8e66dc6ba9a9cb2413",
+ ),
+ (
+ "macos-26-x86_64",
+ "tinychannels-module-0.1.17-macos-26-x86_64.tar.gz",
+ "0eeb60e6f55f4d7f6ded815ea95d1722917285e13ebad6fa5c1e2211766c335b",
+ ),
+ (
+ "ubuntu-22.04-arm64",
+ "tinychannels-module-0.1.17-ubuntu-22.04-arm64.tar.gz",
+ "fa5f5aeedeca8ab03cfd31a5865c1f69e0ee7a935a7461c3f87c7fc491f6765d",
+ ),
+ (
+ "ubuntu-22.04-x86_64",
+ "tinychannels-module-0.1.17-ubuntu-22.04-x86_64.tar.gz",
+ "ab6c61dc697637e9ef07067d17d369e99f4bc3284815320f68048ce456271355",
+ ),
+ (
+ "ubuntu-24.04-arm64",
+ "tinychannels-module-0.1.17-ubuntu-24.04-arm64.tar.gz",
+ "cae106ae240d9f7d5022e397a33df4f851c8114c205292c4b5d84d817a9aba1a",
+ ),
+ (
+ "ubuntu-24.04-x86_64",
+ "tinychannels-module-0.1.17-ubuntu-24.04-x86_64.tar.gz",
+ "896af998236d9a27df67da8d99badee8a17b971aca3a7158700679baea267c49",
+ ),
+ (
+ "windows-11-arm64",
+ "tinychannels-module-0.1.17-windows-11-arm64.zip",
+ "534415e3d59bed642e0b4e9ca623e2706a4f53e544fb2331dbcc5d27d4fb1833",
+ ),
+ (
+ "windows-2022-x86_64",
+ "tinychannels-module-0.1.17-windows-2022-x86_64.zip",
+ "5a1be7f484d67282612f98325a8a72503b70f5ea5c9b4fba01dc92077624f759",
+ ),
+ (
+ "windows-2025-x86_64",
+ "tinychannels-module-0.1.17-windows-2025-x86_64.zip",
+ "9fb1d787045bd835c3422b555133db34b158bb5f0ec2a7033249ebf713a16c46",
+ ),
+ ];
+ assert_eq!(record.assets.len(), expected.len());
+ for (key, archive, sha256) in expected {
+ let asset = record.asset_for(key).expect("supported platform asset");
+ assert_eq!(asset.archive, archive);
+ assert_eq!(asset.sha256, sha256);
+ }
+}
diff --git a/docs/module-boundary-inventory.md b/docs/module-boundary-inventory.md
index cae379cb75..568f3e21e3 100644
--- a/docs/module-boundary-inventory.md
+++ b/docs/module-boundary-inventory.md
@@ -16,7 +16,7 @@ copying its implementation into a host, or accepting weaker isolation.
| tinyjuice | none (module loaded through TinyBus) | tinyjuice-bus | core tools, compression, CCR REPL | Complete: PR #59 provides module-owned compression, CCR queries, HTML extraction, schemas and declarations; the host retains turn-bound model callbacks and artifact authorization |
| tinyconnectors | tinyconnectors, tinyconnectors-sync | tinyconnectors-bus | core integrations, credentials and triggers | Argument preparation, calendar defaults, task windows, structured provider errors, trigger archives; preserve sign-in/out reconciliation |
| tinymcp | tinymcp | tinymcp-bus | core MCP registry, supervisor, CLI stdio/HTTP server | Supervisor notifications, server protocol operations and callbacks for approved host tools/resources/prompts |
-| tinychannels | tinychannels, tinychannels-runtime (remaining runtime callers) | tinychannels-bus | core channels and podcast email, TinyHumans host, CLI REPL | Contract is pure; v0.1.16 supplies complete Discord response vocabulary. Podcast SMTP, Discord discovery/permission checks, and credential tests use confidential module calls. Remaining runtime callers need bus cutover with inbound/status callbacks and shutdown draining |
+| tinychannels | tinychannels, tinychannels-runtime (remaining runtime callers) | tinychannels-bus | core channels and podcast email, TinyHumans host, CLI REPL | Contract is pure; v0.1.17 supplies complete Discord response vocabulary and provider connection preparation. Podcast SMTP, Discord discovery/permission checks, credential tests and connection validation/defaults use confidential module calls. Remaining runtime callers need bus cutover with inbound/status callbacks and shutdown draining |
| tinyhosts | tinyhosts | tinyhosts-bus | core hosting tools | Consume released Execute/Providers contract; keep workspace authorization, credentials, and approval policy in OpenHuman |
| tinywallet | tinywallet-crypto, tinywallet-web3, tinywallet-x402 via bus and direct imports | tinywallet-bus | core wallet/web3/x402 | Move behavioral re-exports out of bus; validation, transaction construction, quotes, swaps, payments, budgets, ledger; retain host custody/approval and confidential attestation |
| tinybox | tinybox-core, tinybox-jail, tinybox-docker, tinybox-host, tinybox-ssh | tinybox-bus | core sandbox and security, desktop gateways | Pre-core gateways use the released v0.1.18 bus client. Core sandbox execution and shell analysis still require cutover |
diff --git a/vendor/tinychannels b/vendor/tinychannels
index 6f0040c312..67bf9aa34f 160000
--- a/vendor/tinychannels
+++ b/vendor/tinychannels
@@ -1 +1 @@
-Subproject commit 6f0040c312808fc8cb3616f2b0c727f974e366b4
+Subproject commit 67bf9aa34fefda53bc3d6fb3cfa7dbb56670ae66