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
Merge upstream/main into saas-profile-host
Steven Enamakel3ab77386868d
diff --cc crates/openhuman-core/src/core/runtime/saas_tests.rsindex 7c3fe4c6ea,1370f7e236..c13392124d--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs@@@ -144,72 -144,10 +144,80 @@@ fn boot_refuses_a_registry_with_workspaassert!(err.contains("built-ins only"), "{err}");}+#[test]+fn cluster_settings_default_and_resolve() {+ let mut config = SaasConfig::new("/srv/oh");+ assert_eq!(config.lease_ttl_secs, 30);+ assert_eq!(config.lease_ttl(), std::time::Duration::from_secs(30));+ assert_eq!(config.operator_dir(), PathBuf::from("/srv/oh/operator"));+ assert!(!config.is_clustered());+ assert_eq!(config.storage_url_with(None), None);++ config.storage_url = Some("sqlite:/srv/oh/a.db".into());+ assert_eq!(+ config.storage_url_with(None).as_deref(),+ Some("sqlite:/srv/oh/a.db")+ );+ assert_eq!(+ config.storage_url_with(Some("sqlite:/env.db")).as_deref(),+ Some("sqlite:/env.db"),+ "OPENHUMAN_STORAGE_URL wins"+ );+ assert_eq!(+ config.storage_url_with(Some(" ")).as_deref(),+ Some("sqlite:/srv/oh/a.db"),+ "a blank environment value is unset"+ );++ assert_eq!(config.resolve_node_id(Some("node-env")), "node-env");+ let mut fresh = SaasConfig::new("/srv/oh");+ let random = fresh.resolve_node_id(None).to_owned();+ assert!(random.starts_with("node-"), "{random}");+ assert_eq!(+ fresh.resolve_node_id(Some("ignored")),+ random,+ "resolved once"+ );+ let mut configured = SaasConfig::new("/srv/oh");+ configured.node_id = Some("node-file".into());+ assert_eq!(configured.resolve_node_id(Some("node-env")), "node-file");++ config.operator_dir = Some("/srv/oh/operators/a".into());+ assert_eq!(config.operator_dir(), PathBuf::from("/srv/oh/operators/a"));+ config.advertise_url = Some("http://a:7788".into());+ assert!(config.is_clustered());+}++#[test]+fn reads_the_cluster_settings() {+ let tmp = tempfile::tempdir().unwrap();+ let path = tmp.path().join("operator.toml");+ std::fs::write(+ &path,+ r#"+root = "/srv/oh"+storage_url = "sqlite:/srv/oh/shared.db"+node_id = "node-a"+advertise_url = "http://10.0.0.1:7788"+lease_ttl_secs = 5+operator_dir = "/srv/oh/operators/node-a"+"#,+ )+ .unwrap();+ let config = SaasConfig::load(&path).unwrap();+ assert_eq!(config.node_id.as_deref(), Some("node-a"));+ assert_eq!(config.lease_ttl_secs, 5);+ assert!(config.is_clustered());+ assert_eq!(+ config.operator_config().workspace_dir,+ PathBuf::from("/srv/oh/operators/node-a/workspace")+ );+}+++ #[test]+ fn the_pre_rename_max_agents_open_key_still_sets_the_limit() {+ let tmp = tempfile::tempdir().unwrap();+ let path = tmp.path().join("operator.toml");+ std::fs::write(&path, "root = \"/srv/openhuman\"\nmax_agents_open = 7\n").unwrap();+ assert_eq!(SaasConfig::load(&path).unwrap().max_profiles_open, 7);+ }diff --cc crates/openhuman-core/src/flows/bus/owner.rsindex fc99e20694,84b6aea8fe..43cb2b2cb9--- a/crates/openhuman-core/src/flows/bus/owner.rs+++ b/crates/openhuman-core/src/flows/bus/owner.rs@@@ -57,7 -75,39 +75,40 @@@ async fn resolve(config: &Config, flow_.lock().unwrap_or_else(std::sync::PoisonError::into_inner).insert(flow_id.to_string(), owner.clone());- owner+ Ok(owner)+ }++ /// Runs `fut` as `flow_id`'s owner; logs and skips it when the owner is+ /// unknown (a failed lookup) or no context can act for it.+ pub(super) async fn as_owner<F: std::future::Future<Output = ()>>(+ config: &Config,+ flow_id: &str,+ fut: F,+ ) {+ match flow_owner(config, flow_id).await {+ Ok(owner) => {+ within_agent(owner.as_deref(), fut).await;+ }+ Err(failed) => tracing::warn!(+ target: "flows",+ %flow_id,+ "[flows] flow owner unknown ({failed}); event not handled"+ ),+ }+ }++ /// The configuration to handle a flow event under: the acting agent's own+ /// when the handler runs as one ([`as_owner`]) — its provider, access+ /// policy, memory and action directory — else `registered`, the one the+ /// subscriber was registered with.+ pub(super) fn config_for_scope(registered: &std::sync::Arc<Config>) -> std::sync::Arc<Config> {- let acting = crate::core::runtime::CoreContext::current()- .is_some_and(|context| context.session_agent().is_some());++ // A SaaS profile acts as its own tenant even with no agent inside it.++ let acting = crate::core::runtime::current_tenant()++ .is_ok_and(|tenant| tenant.agent.is_some() || tenant.profile.is_some());+ match acting.then(crate::core::runtime::CoreContext::current_embedder_config) {+ Some(Some(config)) => std::sync::Arc::new(config),+ _ => std::sync::Arc::clone(registered),+ }}/// Forgets a cached owner (a removed flow's id may be reused).diff --cc crates/openhuman-core/src/profiles/README.mdindex ce8ce51f7b,5fa79be79f..dd0a811308--- a/crates/openhuman-core/src/profiles/README.md+++ b/crates/openhuman-core/src/profiles/README.md@@@ -40,12 -34,8 +40,12 @@@ The top-level `profile_ids` setting (`p- Anything else, or every id under `"hashed"`, becomes `h-` + the first 32 hexcharacters of `sha256(user_id)`.+Provisioning also refuses a profile id equal to the file name of the node's+`operator_dir`: keyring secrets are namespaced by their store's directory name,+so such a profile would share the operator's credential slots.+Both forms fit the agent-id charset and can never contain a path separator.- Changing the mode re-maps users onto different profiles.+ Changing the mode may re-map users onto different profiles.## Filesdiff --cc crates/openhuman-core/src/profiles/gateway.rsindex 8ee05e4173,2fb5af74fb..b2cb1dfdc1--- a/crates/openhuman-core/src/profiles/gateway.rs+++ b/crates/openhuman-core/src/profiles/gateway.rs@@@ -106,31 -82,6 +106,31 @@@ impl GatewayRefusalSelf {status,message: message.into(),+ held_by: None,+ }+ }+- /// The refusal for profile `id`'s [`OpenError`] at `now_ms`.- pub fn from_open_error(id: &ProfileId, error: OpenError, now_ms: u64) -> Self {++ /// The refusal for a profile's [`OpenError`] at `now_ms`.++ pub fn from_open_error(error: OpenError, now_ms: u64) -> Self {+ match error {+ OpenError::NotProvisioned(_) => Self::new(403, error.to_string()),+ OpenError::Full { .. } | OpenError::Storage(_) => Self::new(503, error.to_string()),+ OpenError::HeldElsewhere(record) => {+ log::debug!(- "[profiles][gateway] profile={id} is held by node={} epoch={}",++ "[profiles][gateway] the profile is held by node={} epoch={}",+ record.owner,+ record.epoch+ );+ Self {+ status: 409,+ message: PROFILE_HELD.to_string(),+ held_by: Some(HeldBy {+ retry_after_ms: record.retry_after_ms(now_ms),+ owner: record.owner,+ endpoint: record.endpoint,+ }),+ }+ }}}}@@@ -167,16 -118,13 +167,15 @@@ pub async fn resolve_scopeGatewayRefusal::new(401, e)})?;}- match host.open(&profile) {+ match host.open(&profile).await {Ok(state) => {- log::debug!("[profiles][gateway] scoped request to profile={profile}");+ log::debug!("[profiles][gateway] scoped request to an open profile");Ok(GatewayScope::User(state))}- Err(e) if e.contains("not provisioned") => Err(GatewayRefusal::new(403, e)),- Err(e) => Err(GatewayRefusal::new(503, e)),+ Err(error) => Err(GatewayRefusal::from_open_error(- &profile,+ error,+ super::lease::now_ms(),+ )),}}diff --cc crates/openhuman-core/src/profiles/gateway_tests.rsindex e04b9778c1,aeb3730288..5928f63800--- a/crates/openhuman-core/src/profiles/gateway_tests.rs+++ b/crates/openhuman-core/src/profiles/gateway_tests.rs@@@ -54,41 -54,3 +54,40 @@@ async fn no_user_header_is_the_operatorOk(GatewayScope::Operator)));}++fn id(name: &str) -> ProfileId {+ ProfileId::parse(name).unwrap()+}++#[test]+fn a_profile_held_elsewhere_is_a_409_naming_the_holder() {+ let record = crate::storage::lease::LeaseRecord {+ owner: "node-a".into(),+ endpoint: Some("http://10.0.0.1:7788".into()),+ epoch: 3,+ expires_at_ms: 10_000,+ released: false,+ };- let refusal =- GatewayRefusal::from_open_error(&id("alice"), OpenError::HeldElsewhere(record), 4_000);++ let refusal = GatewayRefusal::from_open_error(OpenError::HeldElsewhere(record), 4_000);+ assert_eq!(refusal.status, 409);+ assert_eq!(refusal.message, PROFILE_HELD);+ assert_eq!(+ refusal.held_by,+ Some(HeldBy {+ owner: "node-a".into(),+ endpoint: Some("http://10.0.0.1:7788".into()),+ retry_after_ms: 6_000,+ })+ );+}++#[test]+fn other_open_errors_keep_their_statuses() {+ let alice = id("alice");- let status = |error| GatewayRefusal::from_open_error(&alice, error, 0).status;++ let status = |error| GatewayRefusal::from_open_error(error, 0).status;+ assert_eq!(status(OpenError::NotProvisioned(alice.clone())), 403);+ assert_eq!(status(OpenError::Full { max: 2 }), 503);+ assert_eq!(status(OpenError::Storage("down".into())), 503);- let refusal = GatewayRefusal::from_open_error(&alice, OpenError::Full { max: 2 }, 0);++ let refusal = GatewayRefusal::from_open_error(OpenError::Full { max: 2 }, 0);+ assert!(refusal.held_by.is_none());+}diff --cc crates/openhuman-core/src/profiles/host.rsindex 53ab2d87f8,20ea3f62e3..b200aa01e9--- a/crates/openhuman-core/src/profiles/host.rs+++ b/crates/openhuman-core/src/profiles/host.rs@@@ -229,29 -149,24 +229,34 @@@ impl ProfileHost// Credential secrets live in the process keyring under the profile id,// not only in the profile's directory, so archiving the directory alone// would let a re-provisioned profile pick the old credential back up.- if let Err(e) = super::credentials::clear(&layout::profile_config(&layout, id)) {+ let config = layout::profile_config(&layout, id);+ let cleared = CoreContext::scope(self.records_context(id), async {+ super::credentials::clear(&config)+ })+ .await;+ if let Err(e) = cleared {- log::warn!("[profiles] clearing credentials of profile={id} before archiving: {e}");+ log::warn!("[profiles] clearing credentials before archiving failed: {e}");+ // Keep the profile so cleanup can be retried; archiving now would- // leave the secret for a re-provisioned profile to inherit.++ // leave the secret for a re-provisioned profile to inherit. It is++ // closed here, so give its lease back for the retry to take.++ profile_lease::release_all(self.leases(), vec![(id.clone(), grant)]).await;+ return Err(format!("clearing credentials before archiving: {e}"));}- let archive = layout::archive_dir(&self.saas.root);- std::fs::create_dir_all(&archive)- .map_err(|e| format!("creating {}: {e}", archive.display()))?;- // Unique even when one user is deprovisioned twice in a second.- let dest = archive.join(format!(- "{id}-{}-{}",- unix_now(),- uuid::Uuid::new_v4().simple()- ));- std::fs::rename(&layout.dir, &dest)- .map_err(|e| format!("archiving {}: {e}", layout.dir.display()))?;- drop(open);+ if layout.dir.exists() {+ let archive = layout::archive_dir(&self.saas.root);+ std::fs::create_dir_all(&archive)+ .map_err(|e| format!("creating {}: {e}", archive.display()))?;+ // Unique even when one user is deprovisioned twice in a second.+ let dest = archive.join(format!(+ "{id}-{}-{}",+ unix_now(),+ uuid::Uuid::new_v4().simple()+ ));+ std::fs::rename(&layout.dir, &dest)+ .map_err(|e| format!("archiving {}: {e}", layout.dir.display()))?;+ }+ self.registry.remove(id).await?;+ profile_lease::release_all(self.leases(), vec![(id.clone(), grant)]).await;log::info!("[profiles] deprovisioned profile={id} (archived)");Ok(true)}diff --cc crates/openhuman-core/src/profiles/ops.rsindex 1af8cbaf78,374e4266c8..52fa2a373f--- a/crates/openhuman-core/src/profiles/ops.rs+++ b/crates/openhuman-core/src/profiles/ops.rs@@@ -24,20 -27,11 +27,21 @@@ pub(crate) async fn provision_onuser_id: &str,) -> Result<Outcome<ProvisionResult>, String> {let profile_id = ProfileId::for_user(user_id, host.saas().profile_ids)?;- let created = host.provision(&profile_id)?;+ if names_operator_state(&profile_id, &host.saas().operator_dir()) {+ log::warn!(+ "[profiles] refusing to provision a profile named like the operator's state dir"+ );- return Err(format!(- "profile id {profile_id} is reserved on this deployment: it is the name of the \- operator's state directory"- ));++ return Err(++ "profile id is reserved on this deployment: it is the name of the \++ operator's state directory"++ .to_string(),++ );+ }+ let created = host.provision(&profile_id).await?;let log = if created {- format!("provisioned {profile_id}")+ "profile provisioned"} else {- format!("{profile_id} was already provisioned")+ "profile already provisioned"};Ok(Outcome::single_log(ProvisionResult {@@@ -70,11 -52,11 +74,11 @@@ pub(crate) async fn deprovision_onprofile_id: &str,) -> Result<Outcome<DeprovisionResult>, String> {let profile_id = ProfileId::parse(profile_id)?;- let removed = host.deprovision(&profile_id)?;+ let removed = host.deprovision(&profile_id).await?;let log = if removed {- format!("archived {profile_id}")+ "profile archived"} else {- format!("{profile_id} was not provisioned")+ "profile was not provisioned"};Ok(Outcome::single_log(DeprovisionResult {@@@ -103,13 -85,9 +107,10 @@@ pub(crate) async fn status_on) -> Result<Outcome<ProfileSummary>, String> {let profile_id = ProfileId::parse(profile_id)?;let summary = host- .summary(&profile_id)?+ .summary(&profile_id)+ .await?- .ok_or_else(|| format!("profile {profile_id} is not provisioned"))?;- Ok(Outcome::single_log(- summary,- format!("status of {profile_id}"),- ))+ .ok_or_else(|| "profile is not provisioned".to_string())?;+ Ok(Outcome::single_log(summary, "profile status read"))}/// Install the backend credential the gateway holds for profile `profile_id`.@@@ -132,14 -110,9 +133,14 @@@ pub(crate) async fn set_credential_onlet profile_id = ProfileId::parse(profile_id)?;// From the layout, not `open`: installing or revoking a credential must// work even when every profile slot is busy.- let config = host.provisioned_config(&profile_id)?;- credentials::store(&config, kind, token, expires_at)?;+ let config = host.provisioned_config(&profile_id).await?;+ // Under the profile's own scope, so a storage-backed secret store files+ // the credential under that profile.+ crate::core::runtime::CoreContext::scope(host.records_context(&profile_id), async {+ credentials::store(&config, kind, token, expires_at)+ })+ .await?;- log::info!("[profiles] credential installed for profile={profile_id} kind={kind:?}");+ log::info!("[profiles] credential installed kind={kind:?}");Ok(Outcome::single_log(CredentialResult {profile_id: profile_id.clone(),@@@ -159,17 -132,13 +160,17 @@@ pub(crate) async fn clear_credential_onprofile_id: &str,) -> Result<Outcome<CredentialResult>, String> {let profile_id = ProfileId::parse(profile_id)?;- let config = host.provisioned_config(&profile_id)?;- let removed = credentials::clear(&config)?;+ let config = host.provisioned_config(&profile_id).await?;+ let removed =+ crate::core::runtime::CoreContext::scope(host.records_context(&profile_id), async {+ credentials::clear(&config)+ })+ .await?;- log::info!("[profiles] credential cleared for profile={profile_id} removed={removed}");+ log::info!("[profiles] credential cleared removed={removed}");let log = if removed {- format!("credential cleared for {profile_id}")+ "credential cleared"} else {- format!("{profile_id} held no credential")+ "profile held no credential"};Ok(Outcome::single_log(CredentialResult {@@@ -180,32 -149,6 +181,32 @@@))}+/// Close profile `profile_id` on this node and release its lease, so another+/// node can host it at once.+pub async fn release(profile_id: &str) -> Result<Outcome<ReleaseResult>, String> {+ release_on(&*require_host()?, profile_id).await+}++pub(crate) async fn release_on(+ host: &ProfileHost,+ profile_id: &str,+) -> Result<Outcome<ReleaseResult>, String> {+ let profile_id = ProfileId::parse(profile_id)?;+ let released = host.release(&profile_id).await?;+ let log = if released {- format!("released {profile_id}")++ "profile released"+ } else {- format!("{profile_id} was not open on this node")++ "profile was not open on this node"+ };+ Ok(Outcome::single_log(+ ReleaseResult {+ profile_id,+ released,+ },+ log,+ ))+}+#[cfg(test)]#[path = "ops_tests.rs"]mod tests;diff --cc crates/openhuman-core/src/storage/lease_local.rsindex f704bc6de8,3e44cb1726..a7ad7cba3d--- a/crates/openhuman-core/src/storage/lease_local.rs+++ b/crates/openhuman-core/src/storage/lease_local.rs@@@ -193,10 -183,22 +193,22 @@@ impl LeaseStore for LocalLeases}let previous = self.read_record(key);let unclean = previous.as_ref().is_some_and(|record| !record.released);- let epoch = previous.map_or(1, |record| record.epoch.saturating_add(1));+ let epoch = match previous {+ None => 1,+ Some(record) => match record.epoch.checked_add(1) {+ Some(next) => next,+ None => {+ let _ = FileExt::unlock(&file);+ return Err(StorageError::conflict(format!(+ "lease {key} epoch space exhausted"+ ))+ .into());+ }+ },+ };let record = LeaseRecord {owner: self.node.clone(),- endpoint: None,+ endpoint: self.endpoint.clone(),epoch,expires_at_ms: u64::MAX,released: false,diff --cc crates/openhuman-embed/src/host_internals.rsindex 4ea9a5012d,a96a31c546..736b7d2cf1--- a/crates/openhuman-embed/src/host_internals.rs+++ b/crates/openhuman-embed/src/host_internals.rs@@@ -2,16 -2,339 +2,343 @@@//! (`openhuman-tinyhumans`, `openhuman-rpc`), and nothing else.//!//! Those layers implement the backend transport, the hosted controllers and- //! the JSON-RPC server, which reach deep into the core by nature. Routing- //! them through this module keeps the dependency chain strict (they need no+ //! the JSON-RPC server, which reach into the core by nature. Routing them+ //! through this module keeps the dependency chain strict (they need no//! `openhuman-core` dependency of their own) without inventing a public API- //! for every server internal. It is an explicit list of modules, not a glob:- //! a new reach-in is added here on purpose. Hosts (app, CLI, TUI) use the- //! curated facade at the crate root instead.-- pub use openhuman_core::{- agent, backend, channels, config, core, desktop, inference, integrations, mcp, platform,- profiles, security, storage, tools, util, voice, web3, web_chat,- };+ //! for every server internal.+ //!+ //! This is an explicit list of items, not a glob of modules: every entry is a+ //! symbol one of the two consumers named in its group actually uses, and a new+ //! reach-in is added here on purpose. The nested module layout mirrors the+ //! core's paths so a consumer's `__host::a::b::item` reads like the core path.+ //! Hosts (app, CLI, TUI) never see this module: the curated facade at the+ //! crate root is theirs, and the layers above embed re-export no part of it+ //! (`scripts/ci/check-crate-chain.mjs` enforces that).pub use openhuman_core::run_core_from_args;++ /// Shared by tinyhumans (hosted controllers) and rpc (`http_host`, `/health`).+ pub mod core {+ pub use openhuman_core::core::{+ unwrap_rpc, ControllerSchema, FieldSchema, Outcome, StructuredRpcError, TypeSchema,+ };++ pub mod all {+ // tinyhumans: hosted controller extension; rpc: http_host + `/health`.+ pub use openhuman_core::core::all::{+ all_controller_schemas, all_http_method_schemas, cli_handler_for_namespace,+ namespace_description, register_controller_extension, rpc_method_from_parts,+ schema_for_rpc_method, ControllerExtension, ControllerFuture, DomainGroup,+ RegisteredController,+ };+ }++ /// Error classification shared by the hosted client (tinyhumans) and the+ /// RPC handler and classifier (rpc).+ pub mod observability {+ pub use openhuman_core::core::observability::{+ contains_transient_transport_phrase, expected_error_kind, is_api_key_rejected_message,+ is_session_expired_message, is_suppressed_usage_probe_backoff,+ is_transient_http_status_code, is_transient_message_failure, report_error_or_expected,+ report_warning_message, API_KEY_REJECTED_PREFIX, BACKEND_UNAVAILABLE_PREFIX,+ REPORT_ERROR_TRACING_TARGET,+ };+ }++ // rpc server only, below.+ pub mod auth {+ pub use openhuman_core::core::auth::{+ bearer_matches, get_rpc_token, init_rpc_token, init_rpc_token_with_value,+ verify_bearer_token, CORE_TOKEN_ENV_VAR,+ };+ }+ pub mod bus {+ pub use openhuman_core::core::bus::{init, BUS};+ }+ pub mod cli {+ pub use openhuman_core::core::cli::load_dotenv_for_cli;+ }+ pub mod dispatch {+ pub use openhuman_core::core::dispatch::{+ is_known_probe_method, unknown_method_name, UNKNOWN_METHOD_PREFIX,+ };+ }+ pub mod event_bind_tokens {+ pub use openhuman_core::core::event_bind_tokens::{consume, issue};+ }+ pub mod events {+ // `DomainEvent` is matched variant by variant by the Socket.IO bridge.+ pub use openhuman_core::core::events::DomainEvent;+ }+ pub mod invoke {+ pub use openhuman_core::core::invoke::{default_state, invoke_method};+ }+ pub mod params {+ pub use openhuman_core::core::params::{+ is_param_validation_error, missing_required_param_message, unknown_param_message,+ };+ }+ pub mod runtime {+ pub use openhuman_core::core::runtime::{+ current_tenant, is_saas, CoreContext, CoreRuntime, Mode, SaasConfig,+ };+ pub mod saas {+ pub use openhuman_core::core::runtime::saas::build;+ }+ }+ pub mod server_launcher {+ pub use openhuman_core::core::server_launcher::{install_server_launcher, ServeRequest};+ }+ pub mod session_expiry {+ pub use openhuman_core::core::session_expiry::is_session_expired_error;+ }+ pub mod shutdown {+ pub use openhuman_core::core::shutdown::{register, signal};+ }+ pub mod types {+ pub use openhuman_core::core::types::AppState;+ }+ }++ /// tinyhumans (backend transport, hosted client, team ops) and rpc (`/health`).+ pub mod backend {+ pub use openhuman_core::backend::{+ base_url, flatten_authed_error, BackendApiError, BackendClient,+ };++ pub mod transport {+ pub use openhuman_core::backend::transport::{+ clear_backend_transport, resolve_backend_transport, BackendTransport,+ BackendTransportError, TransportProfile,+ };+ }+ }++ /// tinyhumans (every hosted controller loads its config) and rpc (server).+ pub mod config {+ pub use openhuman_core::config::{+ active_workspace_dir, active_workspace_dir_cached, active_workspace_snapshot,+ load_config_with_timeout, workspace_handle, Config,+ };++ pub mod app_env {+ // tinyhumans: backend URL selection.+ pub use openhuman_core::config::app_env::{+ app_env_from_env, is_staging_app_env, APP_ENV_VAR, VITE_APP_ENV_VAR,+ };+ }+ pub mod ops {+ pub use openhuman_core::config::ops::load_config_with_timeout;+ }+ pub mod rpc {+ pub use openhuman_core::config::rpc::load_config_with_timeout;+ }+ pub mod schema {+ pub mod cloud_providers {+ pub use openhuman_core::config::schema::cloud_providers::{+ endpoint_host, host_is_builtin_cloud_provider,+ };+ }+ }+ }++ /// tinyhumans: the Jev tool ranker and the jev route.+ pub mod agent {+ pub mod tinyagents {+ pub mod discovery {+ pub use openhuman_core::agent::tinyagents::discovery::{+ embedding_provider_is_usable, embedding_tool_ranker, install_tool_ranker,+ installed_tool_ranker,+ };+ }+ // rpc: Socket.IO run-mode toggles.+ pub mod run_mode {+ pub use openhuman_core::agent::tinyagents::run_mode::{parse_mode_label, set_mode};+ }+ }+ // rpc: shutdown, plan review over Socket.IO, and the session store install.+ pub mod orchestration {+ pub use openhuman_core::agent::orchestration::release_background_completion_stores;+ }+ pub mod plan_review {+ pub mod gate {+ pub use openhuman_core::agent::plan_review::gate::global;+ }+ }+ pub mod session_store {+ pub use openhuman_core::agent::session_store::{+ context_workspace_dir, install, installed, restore,+ };+ }+ }++ /// tinyhumans: the channel-link controller schema.+ pub mod channels {+ pub mod contract_schema {+ pub use openhuman_core::channels::contract_schema::contract_controller_schema;+ }+ }++ /// tinyhumans: embeddings and provider-key lookup for the Jev ranker; rpc: the+ /// OpenAI-compatible HTTP router.+ pub mod inference {+ pub mod embedding_host {+ pub use openhuman_core::inference::embedding_host::default_embedding_provider_with_config;+ }+ pub mod provider {+ pub mod factory {+ pub use openhuman_core::inference::provider::factory::lookup_key_for_slug;+ }+ }+ pub mod http {+ #[cfg(feature = "http-server")]+ pub use openhuman_core::inference::http::router;+ pub use openhuman_core::inference::http::EXTERNAL_OPENAI_COMPAT_PROVIDER;+ }+ }++ /// tinyhumans: the team ops budget gate.+ pub mod integrations {+ pub mod client {+ pub use openhuman_core::integrations::client::budget_gate;+ }+ }++ /// tinyhumans (credentials for the hosted client) and rpc (server auth,+ /// Socket.IO approvals, bind policy).+ pub mod security {+ pub mod credentials {+ pub use openhuman_core::security::credentials::{+ AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,+ };+ pub mod ops {+ pub use openhuman_core::security::credentials::ops::{+ list_provider_credentials, store_provider_credentials,+ };+ }+ pub mod session_support {+ pub use openhuman_core::security::credentials::session_support::{+ build_session_state, current_session_is_local, resolve_backend_credential,+ BackendCredential, LOCAL_SESSION_BACKEND_UNAVAILABLE,+ };+ }+ }+ pub mod approval {+ pub use openhuman_core::security::approval::ApprovalGate;+ }+ pub mod pairing {+ pub use openhuman_core::security::pairing::is_public_bind;+ }+ }++ /// tinyhumans: TLS, URL and redaction helpers for the backend client.+ pub mod util {+ pub use openhuman_core::util::redact_url_for_log;++ pub mod redact {+ pub use openhuman_core::util::redact::redact_url_for_log;+ }+ pub mod tls {+ pub use openhuman_core::util::tls::tls_client_builder;+ }+ pub mod url {+ pub use openhuman_core::util::url::{+ host_is_local, join_url, normalize_api_base_url, normalize_backend_api_base_url,+ };+ }+ }++ // The rest is the rpc server alone.++ pub mod desktop {+ pub mod notifications {+ pub use openhuman_core::desktop::notifications::subscribe_core_notifications;+ }+ pub mod overlay {+ pub use openhuman_core::desktop::overlay::subscribe_attention_events;+ }+ }++ pub mod mcp {+ pub mod registry {+ pub mod oauth {+ pub use openhuman_core::mcp::registry::oauth::complete;+ }+ }+ }++ pub mod platform {+ pub mod connectivity {+ pub mod rpc {+ pub use openhuman_core::platform::connectivity::rpc::{+ pick_listen_port_for_host_with, OccupiedByCore,+ };+ }+ }+ pub mod health {+ pub use openhuman_core::platform::health::{snapshot, verdict};+ }+ }++ pub mod storage {+ pub use openhuman_core::storage::{+ block_on_anyhow, clear, configured_url, driver_is_shared, install, installed, open,+ url_from, StorageBackend, STORAGE_URL_VAR,+ };+ }++ pub mod profiles {+ pub mod gateway {+ pub use openhuman_core::profiles::gateway::{- resolve_scope, sign, verify, GatewayRefusal, GatewayScope, USER_HEADER, USER_SIG_HEADER,++ resolve_scope, sign, verify, GatewayRefusal, GatewayScope, HeldBy, PROFILE_HELD,++ PROFILE_OWNER_HEADER, USER_HEADER, USER_SIG_HEADER,+ };+ }++ pub mod host {++ pub use openhuman_core::profiles::host::host;++ }+ }++ pub mod voice {+ pub mod dictation_listener {+ pub use openhuman_core::voice::dictation_listener::{+ subscribe_dictation_events, subscribe_transcription_results,+ };+ }+ // The core carries the live-voice and dictation sockets only with voice and+ // the HTTP server compiled in. Where its features differ from embed's (a+ // workspace build unifies them separately), rpc still names these paths, so+ // embed supplies a socket-dropping stand-in rather than a missing item.+ pub mod live {+ pub mod ws {+ #[cfg(all(feature = "voice", feature = "http-server"))]+ pub use openhuman_core::voice::live::ws::handle_live_voice_ws;+ #[cfg(not(all(feature = "voice", feature = "http-server")))]+ pub async fn handle_live_voice_ws<S, C>(_socket: S, _config: C) {}+ }+ }+ pub mod streaming {+ #[cfg(all(feature = "voice", feature = "http-server"))]+ pub use openhuman_core::voice::streaming::handle_dictation_ws;+ #[cfg(not(all(feature = "voice", feature = "http-server")))]+ pub async fn handle_dictation_ws<S, C>(_socket: S, _config: C) {}+ }+ }++ pub mod web3 {+ pub mod wallet {+ pub use openhuman_core::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE;+ }+ }++ pub mod web_chat {+ pub use openhuman_core::web_chat::{+ approval_request_event, cancel_chat_scoped, plan_review_request_event,+ publish_web_channel_event, start_chat, subscribe_web_channel_events, unix_epoch_ms,+ ChatRequestMetadata, GuardrailPayload, StartChatError, WebChannelEvent,+ };+ }++ #[cfg(test)]+ #[path = "host_internals_tests.rs"]+ mod tests;diff --cc crates/openhuman-rpc/src/server/shims.rsindex aeb5c1b605,74fbdcfbbd..f0617762d2--- a/crates/openhuman-rpc/src/server/shims.rs+++ b/crates/openhuman-rpc/src/server/shims.rs@@@ -77,72 -69,12 +76,25 @@@ pub async fn run_server_saassaas_config: &std::path::Path,) -> anyhow::Result<()> {let config = crate::core_host::core::runtime::SaasConfig::load(saas_config)?;- crate::session_store::install();+ let storage_url = config.resolved_storage_url();+ log::info!(+ "[rpc:saas] session store: {}",+ if storage_url.is_some() {+ "storage backend"+ } else {+ "on-disk"+ }+ );+ crate::session_store::install_for_saas(storage_url).await?;let runtime =crate::core_host::core::runtime::saas::build(config, host.map(str::to_owned), port).await?;- super::serve::serve(&runtime, None, None).await+ let served = super::serve::serve(&runtime, None, None).await;+ if let Some(profiles) = crate::core_host::profiles::host::host() {+ profiles.release_idle_on_shutdown().await;+ }+ served}- /// Like [`run_server`] but marks the instance as embedded.- pub async fn run_server_embedded(- host: Option<&str>,- port: Option<u16>,- socketio_enabled: bool,- shutdown_token: CancellationToken,- ) -> anyhow::Result<()> {- run_server_inner(- host,- port,- socketio_enabled,- true,- Some(shutdown_token),- None,- None,- )- .await- }-- /// Embedded entrypoint with an explicit readiness callback.- ///- /// When the caller already holds the per-launch RPC bearer in memory (the- /// Tauri shell now that the core runs in-process — PR #1061), it should- /// pass `Some(token)` so the embedded server can seed its auth subsystem- /// via `openhuman::core::auth::init_rpc_token_with_value` without ever- /// reading `OPENHUMAN_CORE_TOKEN` from the process environment. Passing- /// `None` preserves the env-as-config fallback (CLI / docker / cloud).- pub async fn run_server_embedded_with_ready(- host: Option<&str>,- port: Option<u16>,- socketio_enabled: bool,- shutdown_token: CancellationToken,- ready_tx: tokio::sync::oneshot::Sender<EmbeddedReadySignal>,- rpc_token: Option<Arc<String>>,- ) -> anyhow::Result<()> {- run_server_inner(- host,- port,- socketio_enabled,- true,- Some(shutdown_token),- Some(ready_tx),- rpc_token,- )- .await- }-/// Internal server entrypoint.async fn run_server_inner(host: Option<&str>,diff --cc scripts/ci/saas-ambient-baseline.jsonindex e01f346184,b9553e1f00..716f00a919--- a/scripts/ci/saas-ambient-baseline.json+++ b/scripts/ci/saas-ambient-baseline.json@@@ -79,14 -72,14 +72,14 @@@{"rule": "bare-spawn","path": "crates/openhuman-core/src/agent/session_host/runtime_session.rs",-- "line": 724,++ "line": 723,"text": "tokio::spawn(async move {","occurrence": 1},{"rule": "bare-spawn","path": "crates/openhuman-core/src/agent/session_host/runtime_session.rs",-- "line": 726,++ "line": 725,"text": "let transcript = tokio::task::spawn_blocking(move || {","occurrence": 1},diff --cc scripts/ci/storage-bypass-baseline.jsonindex 0000000000,58d1cd7055..c852f8d475mode 000000,100644..100644--- a/scripts/ci/storage-bypass-baseline.json+++ b/scripts/ci/storage-bypass-baseline.json@@@ -1,0 -1,520 +1,520 @@@+ [+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/artifacts/files.rs",+ "line": 141,+ "text": "match tokio::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/artifacts/store.rs",+ "line": 122,+ "text": "tokio::fs::write(&tmp_path, json).await.map_err(|e| {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/artifacts/store.rs",+ "line": 295,+ "text": "tokio::fs::write(&args_path, json)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/attachments/legacy.rs",+ "line": 143,+ "text": "let mut file = tokio::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/attachments/mod.rs",+ "line": 288,+ "text": "let mut file = tokio::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/attachments/provider_cache.rs",+ "line": 163,+ "text": "let mut file = tokio::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/attachments/provider_open.rs",+ "line": 20,+ "text": "let filesystem_root = std::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/attachments/provider_source.rs",+ "line": 232,+ "text": "let mut file = tokio::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/debug/dump_writer.rs",+ "line": 48,+ "text": "std::fs::write(&prompt_path, &dumped.text)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/debug/dump_writer.rs",+ "line": 50,+ "text": "std::fs::write(&meta_path, render_meta(dumped))",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/debug/dump_writer.rs",+ "line": 56,+ "text": "std::fs::write(",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/debug/dump_writer.rs",+ "line": 69,+ "text": "std::fs::write(&wire_path, super::wire::render(dumped))",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/debug/dump_writer.rs",+ "line": 86,+ "text": "std::fs::write(&summary_path, &summary)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/progress_tracing/export.rs",+ "line": 33,+ "text": "let opened = std::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/prompts/agents_md.rs",+ "line": 198,+ "text": "std::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/prompts/render_helpers/workspace_files.rs",+ "line": 91,+ "text": "if let Err(e) = std::fs::write(&path, default_content) {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/prompts/render_helpers/workspace_files.rs",+ "line": 101,+ "text": "let _ = std::fs::write(&hash_path, ¤t_hash);",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/subagent_host/lifecycle.rs",+ "line": 668,+ "text": "let file = OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/subagent_host/lifecycle.rs",+ "line": 758,+ "text": "std::fs::write(&temporary, bytes)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/subagent_host/lifecycle.rs",+ "line": 774,+ "text": "std::fs::write(&temporary, bytes)",+ "occurrence": 2+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/agent/subagent_host/ops/pause_checkpoint.rs",+ "line": 82,+ "text": "if let Err(e) = std::fs::write(&checkpoint_path, json) {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/migrations/phase_out_profile_md.rs",+ "line": 192,+ "text": "match fs::write(&md_path, cleaned.as_bytes()) {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/ops/ui.rs",+ "line": 321,+ "text": "std::fs::write(&flag_path, \"\")",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/schema/load/atomic_commit.rs",+ "line": 166,+ "text": "} else if fs::write(backup_path, as_upgraded).await.is_err() {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/schema/load/impl_load.rs",+ "line": 505,+ "text": "let mut temp_file = OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/schema/load_user_state.rs",+ "line": 175,+ "text": "let mut temp_file = std::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/workspace/ops.rs",+ "line": 40,+ "text": "std::fs::write(&path, contents)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/workspace/rpc.rs",+ "line": 154,+ "text": "std::fs::write(&path, contents).map_err(|e| {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/config/workspace/rpc.rs",+ "line": 190,+ "text": "std::fs::write(&path, default_contents).map_err(|e| {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/core/auth.rs",+ "line": 231,+ "text": "let mut file = std::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/core/auth.rs",+ "line": 242,+ "text": "std::fs::write(path, token)?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/flows/tinyflows/caps/code.rs",+ "line": 111,+ "text": "tokio::fs::write(&script_path, script_body)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/flows/tinyflows/caps/code.rs",+ "line": 114,+ "text": "tokio::fs::write(&input_path, input_json)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rs",+ "line": 162,+ "text": "tokio::fs::write(&file_path, audio_bytes)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/integrations/file_storage/tools/download.rs",+ "line": 84,+ "text": "if let Err(e) = tokio::fs::write(&path, &body).await {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/memory/files.rs",+ "line": 61,+ "text": "let mut options = std::fs::OpenOptions::new();",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/memory/layout_migration/claim.rs",+ "line": 103,+ "text": "let temp = tempfile::NamedTempFile::new_in(key.marker.parent().unwrap_or(Path::new(\".\")))?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/memory/local_root.rs",+ "line": 168,+ "text": "let temp = tempfile::NamedTempFile::new_in(dir)?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/modules/browser_sites/store.rs",+ "line": 174,+ "text": "let mut options = tokio::fs::OpenOptions::new();",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/modules/browser_task_report.rs",+ "line": 304,+ "text": "let mut options = tokio::fs::OpenOptions::new();",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/doctor/core/workspace_checks.rs",+ "line": 30,+ "text": "match std::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/service/daemon_host.rs",+ "line": 43,+ "text": "tokio::fs::write(path, bytes)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/service/linux.rs",+ "line": 37,+ "text": "fs::write(&file, unit)?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/service/macos.rs",+ "line": 81,+ "text": "fs::write(&file, plist)?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/service/mock.rs",+ "line": 163,+ "text": "std::fs::write(path, bytes)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/service/windows.rs",+ "line": 40,+ "text": "fs::write(&wrapper, cmd)?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/update/core.rs",+ "line": 192,+ "text": "let mut out = std::fs::File::create(&tmp_path)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/update/core.rs",+ "line": 219,+ "text": "let mut out = std::fs::File::create(&tmp_path)",+ "occurrence": 2+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/platform/update/core.rs",+ "line": 504,+ "text": "let mut file = std::fs::File::create(&tmp_path)",+ "occurrence": 1+ },++ {++ "rule": "json-write",++ "path": "crates/openhuman-core/src/profiles/registry.rs",++ "line": 141,++ "text": "std::fs::write(&layout.meta_path, raw)",++ "occurrence": 1++ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/runtime/python_server/kompress.rs",+ "line": 150,+ "text": "tokio::fs::write(",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/audit.rs",+ "line": 284,+ "text": "let mut file = OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/credentials/http_creds.rs",+ "line": 420,+ "text": "fs::write(&tmp_path, &json)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/credentials/profiles.rs",+ "line": 284,+ "text": "let mut file = OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/credentials/profiles.rs",+ "line": 297,+ "text": "fs::write(path, bytes)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/credentials/profiles/lock.rs",+ "line": 84,+ "text": "OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/keyring/encrypted_store.rs",+ "line": 316,+ "text": "let open_result = fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/keyring/encrypted_store.rs",+ "line": 348,+ "text": "let open_result = fs::OpenOptions::new()",+ "occurrence": 2+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/keyring/file_store.rs",+ "line": 79,+ "text": "let file = OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/keyring/file_store.rs",+ "line": 168,+ "text": "match OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/pairing.rs",+ "line": 118,+ "text": "let mut file = std::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/security/pairing.rs",+ "line": 129,+ "text": "std::fs::write(path, token)?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/skills/ops_create.rs",+ "line": 247,+ "text": "std::fs::write(&workflow_toml_path, workflow_toml)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/skills/ops_discover/api.rs",+ "line": 47,+ "text": "std::fs::write(&readme_path, content)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/skills/run_log.rs",+ "line": 112,+ "text": "let mut f = tokio::fs::OpenOptions::new()",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/skills/webhooks/router.rs",+ "line": 537,+ "text": "if let Err(e) = std::fs::write(&path, json) {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/threads/welcome_migration.rs",+ "line": 298,+ "text": "fs::write(path, rewritten).map_err(|e| {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/threads/welcome_migration.rs",+ "line": 389,+ "text": "fs::write(marker, b\"done\\n\").map_err(|e| {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/tinymemes/host.rs",+ "line": 267,+ "text": "std::fs::write(&tmp, contents)?;",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/tools/impl/document/mod.rs",+ "line": 264,+ "text": "if let Err(err) = tokio::fs::write(&output_path, &bytes).await {",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/tools/impl/presentation/mod.rs",+ "line": 328,+ "text": "if let Err(err) = tokio::fs::write(&output_path, &bytes).await {",+ "occurrence": 1+ },- {- "rule": "json-write",- "path": "crates/openhuman-core/src/user_agents/host.rs",- "line": 126,- "text": "std::fs::write(&layout.meta_path, raw)",- "occurrence": 1- },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/voice/audio_toolkit/ops.rs",+ "line": 62,+ "text": "tokio::fs::write(&resolved, &bytes)",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/voice/audio_toolkit/ops.rs",+ "line": 408,+ "text": "tokio::fs::write(&resolved_path, email.formatted())",+ "occurrence": 1+ },+ {+ "rule": "json-write",+ "path": "crates/openhuman-core/src/voice/ops.rs",+ "line": 176,+ "text": "tokio::fs::write(&file_path, audio_bytes)",+ "occurrence": 1+ }+ ]