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(core): add native channel locale handling
Steven Enamakel4abbce0c958e
diff --git a/crates/openhuman-core/src/config/schema/types/resolvers.rs b/crates/openhuman-core/src/config/schema/types/resolvers.rsindex 2262e5b005..89fe39df26 100644--- a/crates/openhuman-core/src/config/schema/types/resolvers.rs+++ b/crates/openhuman-core/src/config/schema/types/resolvers.rs@@ -7,6 +7,30 @@ use super::output_language::output_language_directive;use crate::config::schema::Config;impl Config {+ /// Locale for host-generated native-channel messages. Unsupported and+ /// unset preferences fall back to English; model-output language and RPC+ /// metadata are not consulted.+ pub fn native_channel_locale(&self) -> &'static str {+ crate::inference::failure_copy::supported_channel_locale(self.channels_locale.as_deref())+ .unwrap_or("en")+ }++ /// Render a classified native-channel failure with this config's trusted+ /// locale preference and the shared product chat-error catalog.+ pub fn render_native_channel_failure(+ &self,+ fallback_message: &str,+ copy_key: Option<&str>,+ copy_params: Option<&serde_json::Value>,+ ) -> String {+ crate::inference::failure_copy::render_channel_failure(+ self.native_channel_locale(),+ fallback_message,+ copy_key,+ copy_params,+ )+ }+/// The folder agent deliverables are written to (#5505): the Settings/// override when set, else `~/OpenHuman/projects/Files`. Every producer/// and the boot migration read it through here.diff --git a/crates/openhuman-core/src/config/schema/types_model_pin_tests.rs b/crates/openhuman-core/src/config/schema/types_model_pin_tests.rsindex 1f94c0ca39..4190341bd9 100644--- a/crates/openhuman-core/src/config/schema/types_model_pin_tests.rs+++ b/crates/openhuman-core/src/config/schema/types_model_pin_tests.rs@@ -41,12 +41,14 @@ fn output_language_directive_strips_control_characters_and_blank_input() {fn channels_locale_round_trips_and_old_configs_default_to_unset() {let mut config = crate::config::schema::Config::default();assert_eq!(config.channels_locale, None);+ assert_eq!(config.native_channel_locale(), "en");config.channels_locale = Some("zh-CN".to_string());let serialized = toml::to_string(&config).expect("serialize config");let restored: crate::config::schema::Config =toml::from_str(&serialized).expect("deserialize config with channels locale");assert_eq!(restored.channels_locale.as_deref(), Some("zh-CN"));+ assert_eq!(restored.native_channel_locale(), "zh-CN");let legacy = serialized.lines()@@ -56,6 +58,10 @@ fn channels_locale_round_trips_and_old_configs_default_to_unset() {let restored_legacy: crate::config::schema::Config =toml::from_str(&legacy).expect("deserialize config without the new optional field");assert_eq!(restored_legacy.channels_locale, None);+ assert_eq!(restored_legacy.native_channel_locale(), "en");++ config.channels_locale = Some("not-a-locale".into());+ assert_eq!(config.native_channel_locale(), "en");}#[test]diff --git a/crates/openhuman-core/src/inference/failure_copy/chat_error_catalog.rs b/crates/openhuman-core/src/inference/failure_copy/chat_error_catalog.rsindex dbcecd8f63..eaffc31207 100644--- a/crates/openhuman-core/src/inference/failure_copy/chat_error_catalog.rs+++ b/crates/openhuman-core/src/inference/failure_copy/chat_error_catalog.rs@@ -1,20 +1,6 @@// Generated by scripts/generate-rust-chat-error-catalog.ts; do not edit.pub const SUPPORTED_LOCALES: &[&str] = &[- "en",- "zh-CN",- "hi",- "es",- "ar",- "fr",- "bn",- "pt",- "de",- "ru",- "id",- "it",- "ja",- "ko",- "pl",+ "en", "zh-CN", "hi", "es", "ar", "fr", "bn", "pt", "de", "ru", "id", "it", "ja", "ko", "pl","tr",];pub fn translation(locale: &str, key: &str) -> Option<&'static str> {diff --git a/crates/openhuman-core/src/inference/failure_copy/localized_tests.rs b/crates/openhuman-core/src/inference/failure_copy/localized_tests.rsindex 2720d8e212..a5a0bfc10b 100644--- a/crates/openhuman-core/src/inference/failure_copy/localized_tests.rs+++ b/crates/openhuman-core/src/inference/failure_copy/localized_tests.rs@@ -24,7 +24,7 @@ fn native_failure_copy_preserves_queued_prefix_and_sanitized_detail() {);assert!(rendered.starts_with("queued turn was not run: "));- assert!(rendered.contains("problème d’authentification"));+ assert!(rendered.contains("problème d'authentification"));assert!(rendered.ends_with("> sanitized provider detail"));assert!(!rendered.contains("authentication failed"));}@@ -41,7 +41,10 @@ fn unknown_locale_key_and_parameter_types_fall_back_safely() {Some("chat_error.rate_limited"),Some(&serde_json::json!({ "retry_after_secs": "not-a-number", "detail": 4 })),);- assert_eq!(english, chat_error_catalog::translation("en", "chat_error.rate_limited").unwrap());+ assert_eq!(+ english,+ chat_error_catalog::translation("en", "chat_error.rate_limited").unwrap()+ );assert!(!english.contains("not-a-number"));assert!(!english.contains('4'));diff --git a/crates/openhuman-core/src/inference/failure_copy/mod.rs b/crates/openhuman-core/src/inference/failure_copy/mod.rsindex d155963847..421eef2ee6 100644--- a/crates/openhuman-core/src/inference/failure_copy/mod.rs+++ b/crates/openhuman-core/src/inference/failure_copy/mod.rs@@ -10,8 +10,8 @@//! `tinyinference_providers::is_budget_message`) lives upstream in//! `tinyinference`; deciding *which class an error is* stays in the callers.-mod halt;mod chat_error_catalog;+mod halt;mod localized;mod table;