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
refactor(session_host): move begin_turn_resume into turn module
Steven Enamakel5c99975b8931
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex bfbfd7f3eb..bbf23e4222 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -12,6 +12,7 @@ mod permanent;mod tool_rules;#[path = "runtime_session_turn.rs"]mod turn;+pub(super) use turn::begin_turn_resume;use std::sync::Arc;@@ -103,14 +104,6 @@ struct OpenHumanTurnPrelude {mutable: Arc<std::sync::Mutex<OpenHumanTurnPreludeMutable>>,}-pub(super) fn begin_turn_resume(state: &mut OpenHumanSessionState, resume: &mut ResumeMode) {- let overrides = std::mem::take(&mut state.pending_turn_overrides);- if overrides.suppress_transcript_autoload {- *resume = ResumeMode::Never;- }- state.active_turn_overrides = overrides;-}-/// Host-owned tool composition from which one runtime request is prepared./// All three views are rebuilt together so a prompt schema, execution source,/// and fail-closed policy cannot describe different authority.diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/tool_rules_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/tool_rules_tests.rsnew file mode 100644index 0000000000..d4b1d6ad56--- /dev/null+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/tool_rules_tests.rs@@ -0,0 +1,46 @@+use super::*;++fn config_with_rules(tmp: &tempfile::TempDir) -> crate::config::Config {+ let config = crate::config::Config {+ workspace_dir: tmp.path().join("workspace"),+ action_dir: tmp.path().join("workspace"),+ config_path: tmp.path().join("config.toml"),+ tool_rules: tinytools::ToolRules::from_allow_deny(Vec::<String>::new(), ["shell"]),+ ..crate::config::Config::default()+ };+ std::fs::create_dir_all(&config.workspace_dir).unwrap();+ config+}++#[test]+fn a_session_composes_the_operator_and_definition_layers() {+ let tmp = tempfile::TempDir::new().unwrap();+ let config = config_with_rules(&tmp);+ let mut definition = crate::agent::registry::agents::load_builtins()+ .unwrap()+ .into_iter()+ .find(|def| def.id == "orchestrator")+ .expect("orchestrator");+ definition.disallowed_tools = vec!["web_*".to_string()];+ let host = OpenHumanSessionHost::from_config_with_definition(&config, &definition)+ .expect("session builds");++ let rules = host.session_tool_rules();+ let names: Vec<_> = rules+ .layers+ .iter()+ .map(|layer| layer.name.clone().unwrap_or_default())+ .collect();+ assert_eq!(names, ["config", "agent:orchestrator"]);+ let context = tinytools::RuleContext::new();+ let visible = |name: &str| {+ rules.visible(+ &tinytools::ToolSubject::named(name),+ &context,+ tinytools::Surface::Catalog,+ )+ };+ assert!(!visible("shell"));+ assert!(!visible("web_fetch"));+ assert!(visible("file_read"));+}diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex e10160b71b..b1ebb44a52 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -80,3 +80,15 @@ impl OpenHumanSessionHost {Ok(outcome.output.unwrap_or_default())}}++/// Applies the pending one-turn overrides to this turn's resume mode.+pub(in crate::agent::session_host) fn begin_turn_resume(+ state: &mut OpenHumanSessionState,+ resume: &mut ResumeMode,+) {+ let overrides = std::mem::take(&mut state.pending_turn_overrides);+ if overrides.suppress_transcript_autoload {+ *resume = ResumeMode::Never;+ }+ state.active_turn_overrides = overrides;+}