Skip to content

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

refactor(integrations): move recorded tools and announcement notes to integrations

Steven Enamakel53b65dfb0233
diff --git a/crates/openhuman-core/src/agent/message_convert.rs b/crates/openhuman-core/src/agent/message_convert.rs
index 3d8f12f0fb..122c0915f2 100644
--- a/crates/openhuman-core/src/agent/message_convert.rs
+++ b/crates/openhuman-core/src/agent/message_convert.rs
@@ -19,7 +19,7 @@
use tinyinference_llm::message::{ContentBlock, ImageRef, MediaRef, Message, UserMessage};
use tinyinference_llm::tool::ToolCall as TaToolCall;
use tinytools_agent::dialect::{
- DialectMessage, DialectResponse, DialectRole, ToolDialect, ToolResultEntry, TranscriptEntry,
+ DialectMessage, DialectRole, ToolDialect, ToolResultEntry, TranscriptEntry,
};
use tinyagents_runtime::transcript::reasoning_from_content;
diff --git a/crates/openhuman-core/src/agent/session_host/mod.rs b/crates/openhuman-core/src/agent/session_host/mod.rs
index 719c65e166..7a41a7d936 100644
--- a/crates/openhuman-core/src/agent/session_host/mod.rs
+++ b/crates/openhuman-core/src/agent/session_host/mod.rs
@@ -40,8 +40,6 @@ mod hooks;
// Tool surface for live voice sessions (`voice::live`).
#[cfg(feature = "voice")]
mod live_tools;
-#[path = "../../integrations/recorded_tools.rs"]
-mod recorded_tools;
#[cfg(test)]
#[path = "resume_bound_session_tests.rs"]
mod resume_bound_session_tests;
@@ -67,8 +65,6 @@ pub use types::{OpenHumanSessionHost, SessionHostBuilder, TurnOverrides};
// share one tested implementation.
pub(crate) use builder::dedup_visible_tool_specs;
-#[path = "../../integrations/announcement_notes.rs"]
-mod announcement_notes;
#[cfg(test)]
mod orphaned_head_resume_tests;
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs
index 5450f4aab1..855c078071 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs
@@ -10,7 +10,7 @@ use tinyagents_session::port::{InMemorySessionStores, SessionStoreProvider};
use tinyagents_session::transcript::TranscriptMeta;
use tinyinference_llm::message::Message;
-use super::announcement_notes::{
+use crate::integrations::announcement_notes::{
integration_announcement_note, mcp_announcement_note, skill_announcement_note,
};
use super::runtime_session::tool_surface::reconcile_synthesized_visibility;
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 214ccf3337..9c2575cae3 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -25,7 +25,7 @@ use tinyagents_runtime::{
};
use tinyinference_llm::message::Message;
-use super::announcement_notes::{
+use crate::integrations::announcement_notes::{
integration_announcement_note, mcp_announcement_note, skill_announcement_note,
skill_retraction_note,
};
diff --git a/crates/openhuman-core/src/agent/session_host/stop_summary.rs b/crates/openhuman-core/src/agent/session_host/stop_summary.rs
index d387a29e2d..5069536d40 100644
--- a/crates/openhuman-core/src/agent/session_host/stop_summary.rs
+++ b/crates/openhuman-core/src/agent/session_host/stop_summary.rs
@@ -121,38 +121,7 @@ impl StopReasonKind {
/// English copy completing "I stopped this turn early because …".
pub(crate) fn copy(self) -> &'static str {
- match self {
- Self::Transient => "a service I needed kept timing out or was temporarily unavailable",
- Self::UncertainSideEffect => {
- "an action timed out and I could not confirm whether it went through, so I did \
- not repeat it"
- }
- Self::Authentication => "a service rejected my credentials",
- Self::Permission => "I don't have permission for a step this needs",
- Self::Policy => "a step this needs is blocked by your security settings",
- Self::MissingProgram => {
- "a program or feature this needs is not available on this device"
- }
- Self::NotFound => "something this needs could not be found",
- Self::InvalidCalls => "a tool kept rejecting my requests as invalid",
- Self::Unavailable => "a tool this needs is not available right now",
- Self::SiteRefused => "a website kept refusing my requests",
- Self::RepeatedFailure => "the same step kept failing",
- Self::VariedFailures => "several different tool calls in a row failed",
- Self::RepeatingStep => "I kept repeating the same step without getting anything new",
- Self::OutOfCredits => {
- "the account is out of inference credits; add credits, then ask me to try again"
- }
- Self::ProviderConfig => {
- "the configured model or provider rejected the request; check the model and API \
- key in Connections"
- }
- Self::MissingConnection => {
- "a service this needs isn't connected; connect it in Connections, then ask me to \
- try again"
- }
- Self::Generic => "my tool calls were not getting anywhere",
- }
+ crate::inference::failure_copy::stop_summary_copy(self.key())
}
/// Read the kind from a breaker stop note. The notes come from a fixed
diff --git a/crates/openhuman-core/src/inference/failure_copy/mod.rs b/crates/openhuman-core/src/inference/failure_copy/mod.rs
index 14975ab319..be87066136 100644
--- a/crates/openhuman-core/src/inference/failure_copy/mod.rs
+++ b/crates/openhuman-core/src/inference/failure_copy/mod.rs
@@ -11,6 +11,7 @@
//! `tinyinference`; deciding *which class an error is* stays in the callers.
mod halt;
+mod stop_summary;
mod table;
#[cfg(test)]
@@ -19,4 +20,5 @@ pub(crate) use halt::{
recoverable_identical_halt_summary, recoverable_no_progress_halt_summary,
terminal_inference_failure_kind, terminal_inference_halt_summary, user_actionable_escalation,
};
+pub(crate) use stop_summary::stop_summary_copy;
pub(crate) use table::{failure_copy, FailureClass};
diff --git a/crates/openhuman-core/src/inference/failure_copy/stop_summary.rs b/crates/openhuman-core/src/inference/failure_copy/stop_summary.rs
new file mode 100644
index 0000000000..85e9aecfef
--- /dev/null
+++ b/crates/openhuman-core/src/inference/failure_copy/stop_summary.rs
@@ -0,0 +1,33 @@
+//! Stable English fallback copy for terminal turn-stop reasons.
+
+/// The user-facing text for one `turn_stop.*` localization key.
+pub(crate) fn stop_summary_copy(key: &str) -> &'static str {
+ match key {
+ "turn_stop.transient" => "a service I needed kept timing out or was temporarily unavailable",
+ "turn_stop.uncertain_side_effect" => {
+ "an action timed out and I could not confirm whether it went through, so I did not repeat it"
+ }
+ "turn_stop.authentication" => "a service rejected my credentials",
+ "turn_stop.permission" => "I don't have permission for a step this needs",
+ "turn_stop.policy" => "a step this needs is blocked by your security settings",
+ "turn_stop.missing_program" => "a program or feature this needs is not available on this device",
+ "turn_stop.not_found" => "something this needs could not be found",
+ "turn_stop.invalid_calls" => "a tool kept rejecting my requests as invalid",
+ "turn_stop.unavailable" => "a tool this needs is not available right now",
+ "turn_stop.site_refused" => "a website kept refusing my requests",
+ "turn_stop.repeated_failure" => "the same step kept failing",
+ "turn_stop.varied_failures" => "several different tool calls in a row failed",
+ "turn_stop.repeating_step" => "I kept repeating the same step without getting anything new",
+ "turn_stop.out_of_credits" => {
+ "the account is out of inference credits; add credits, then ask me to try again"
+ }
+ "turn_stop.provider_config" => {
+ "the configured model or provider rejected the request; check the model and API key in Connections"
+ }
+ "turn_stop.missing_connection" => {
+ "a service this needs isn't connected; connect it in Connections, then ask me to try again"
+ }
+ "turn_stop.generic" => "my tool calls were not getting anywhere",
+ _ => "my tool calls were not getting anywhere",
+ }
+}
diff --git a/crates/openhuman-core/src/inference/provider/model.rs b/crates/openhuman-core/src/inference/provider/model.rs
index ad5ec36236..023cb2d6ec 100644
--- a/crates/openhuman-core/src/inference/provider/model.rs
+++ b/crates/openhuman-core/src/inference/provider/model.rs
@@ -6,7 +6,7 @@ use tinyinference_llm::message::{AssistantMessage, ContentBlock};
use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};
use tinyinference_llm::tool::ToolCall as TaToolCall;
use tinyinference_llm::usage::{ProviderUsageReport, recover_usage};
-use tinytools_agent::dialect::DialectResponse;
+use tinytools_agent::dialect::{DialectResponse, ToolCall as DialectToolCall};
use crate::inference::provider::{BilledUsage, ChatResponse};
diff --git a/crates/openhuman-core/src/integrations/prelude_integrations.rs b/crates/openhuman-core/src/integrations/prelude_integrations.rs
index acbb5430ac..68d21bc229 100644
--- a/crates/openhuman-core/src/integrations/prelude_integrations.rs
+++ b/crates/openhuman-core/src/integrations/prelude_integrations.rs
@@ -46,7 +46,7 @@ impl OpenHumanTurnPrelude {
let Some(recorded) = recorded else {
return;
};
- let actions = super::super::recorded_tools::recorded_integration_actions(recorded.specs());
+ let actions = crate::integrations::recorded_tools::recorded_integration_actions(recorded.specs());
log::debug!(
"[session] adopting {} recorded integration action declaration(s) agent={}",
actions.len(),
@@ -55,7 +55,7 @@ impl OpenHumanTurnPrelude {
// Search role tools ride in the same list; each rehydration pass
// keeps only the names it owns.
let mut actions = actions;
- actions.extend(super::super::recorded_tools::recorded_search_tools(
+ actions.extend(crate::integrations::recorded_tools::recorded_search_tools(
recorded.specs(),
));
let mut mutable = self
@@ -122,7 +122,7 @@ impl OpenHumanTurnPrelude {
if wildcard.matches_all()
)
}) {
- rebuilt = super::super::recorded_tools::rehydrate_integration_actions(
+ rebuilt = crate::integrations::recorded_tools::rehydrate_integration_actions(
&recorded,
synthesized,
integrations,
@@ -137,7 +137,7 @@ impl OpenHumanTurnPrelude {
}
}
#[cfg(feature = "modules")]
- rebuilt.extend(super::super::recorded_tools::rehydrate_search_tools(
+ rebuilt.extend(crate::integrations::recorded_tools::rehydrate_search_tools(
&recorded,
&[base, synthesized],
&self.agent_definition_id,
diff --git a/crates/openhuman-core/src/integrations/recorded_tools.rs b/crates/openhuman-core/src/integrations/recorded_tools.rs
index c23aee4106..5d23902f1f 100644
--- a/crates/openhuman-core/src/integrations/recorded_tools.rs
+++ b/crates/openhuman-core/src/integrations/recorded_tools.rs
@@ -28,7 +28,7 @@ use crate::integrations::composio::action_tool::ComposioActionTool;
///
/// Composio slugs are upper-case `TOOLKIT_ACTION`; every OpenHuman-owned tool
/// name is lower-case snake case, so the shapes never overlap.
-pub(super) fn is_integration_action_name(name: &str) -> bool {
+pub(crate) fn is_integration_action_name(name: &str) -> bool {
let mut parts = name.splitn(2, '_');
let (Some(toolkit), Some(action)) = (parts.next(), parts.next()) else {
return false;
@@ -51,7 +51,7 @@ fn toolkit_of(action: &str) -> String {
}
/// The recorded integration action declarations, in recorded order.
-pub(super) fn recorded_integration_actions(recorded: &[ToolSpec]) -> Vec<ToolSpec> {
+pub(crate) fn recorded_integration_actions(recorded: &[ToolSpec]) -> Vec<ToolSpec> {
recorded
.iter()
.filter(|spec| is_integration_action_name(&spec.name))
@@ -62,7 +62,7 @@ pub(super) fn recorded_integration_actions(recorded: &[ToolSpec]) -> Vec<ToolSpe
/// Deferred executors for every recorded action the live set does not
/// already provide. `live` names win: a still-connected integration keeps
/// its freshly fetched declaration.
-pub(super) fn rehydrate_integration_actions(
+pub(crate) fn rehydrate_integration_actions(
recorded: &[ToolSpec],
live: &[Box<dyn Tool>],
integrations: &[crate::agent::prompts::ConnectedIntegration],