Skip to content

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

feat(agent): support native message input for host agents

Steven Enamakel5a3fc9b10a2c
diff --git a/crates/openhuman-core/src/agent/host_agents.rs b/crates/openhuman-core/src/agent/host_agents.rs
index 9ce2819396..3875ea8f31 100644
--- a/crates/openhuman-core/src/agent/host_agents.rs
+++ b/crates/openhuman-core/src/agent/host_agents.rs
@@ -91,6 +91,7 @@ impl HostAgent {
event_session_id: &str,
channel: &str,
message: &str,
+ message_input: Option<tinyinference_llm::message::Message>,
origin: crate::agent::turn_origin::AgentTurnOrigin,
approval: crate::security::approval::ApprovalTurnContext,
progress: Option<tokio::sync::mpsc::Sender<tinyagents_harness::progress::AgentProgress>>,
@@ -125,7 +126,7 @@ impl HostAgent {
&mut session,
crate::agent::turn_host::AgentTurnRequest {
message: message.to_owned(),
- message_input: None,
+ message_input,
thread_id: Some(session_key.to_owned()),
origin,
approval: approval.clone(),
diff --git a/crates/openhuman-core/src/agent/message_convert.rs b/crates/openhuman-core/src/agent/message_convert.rs
index f60ea59a13..b87c6e31c6 100644
--- a/crates/openhuman-core/src/agent/message_convert.rs
+++ b/crates/openhuman-core/src/agent/message_convert.rs
@@ -260,29 +260,6 @@ pub(crate) fn user_message_from_parts(
Ok(Message::User(UserMessage { content }))
}
-/*
- tinychannels_bus::ContentPart::Audio { media, .. }
- | tinychannels_bus::ContentPart::Video { media, .. } => {
- let path = media
- .path
- .clone()
- .ok_or_else(|| "resolved media attachment has no trusted path".to_string())?;
- let media_ref = MediaRef::Path {
- path,
- media_type: media.content_type.clone(),
- };
- let block = match part {
- tinychannels_bus::ContentPart::Audio { .. } => ContentBlock::Audio(media_ref),
- tinychannels_bus::ContentPart::Video { .. } => ContentBlock::Video(media_ref),
- _ => ContentBlock::Document(media_ref),
- };
- content.push(block);
- }
- _ => return Err("resolved attachment has an unsupported kind".into()),
- }
- }
- Ok(Message::User(UserMessage { content }))
-*/
}
/// The inverse of [`user_message_from_text`]: a user message's text with each
diff --git a/crates/openhuman-core/src/agent/queued_turn.rs b/crates/openhuman-core/src/agent/queued_turn.rs
index 31c1f60c0f..a4f43babb0 100644
--- a/crates/openhuman-core/src/agent/queued_turn.rs
+++ b/crates/openhuman-core/src/agent/queued_turn.rs
@@ -52,6 +52,10 @@ pub struct QueuedPayload {
pub(crate) deferred_user_message: bool,
pub(crate) stored_attachments: Option<StoredAttachmentInput>,
pub(crate) pending_attachments: Option<PendingAttachmentInput>,
+ /// Typed native-channel input resolved from the exact module envelope for
+ /// this queued request. Synthetic queue placeholders deliberately do not
+ /// inherit it from the currently running turn.
+ pub(crate) native_message_input: Option<tinyinference_llm::message::Message>,
}
impl std::fmt::Debug for QueuedPayload {
@@ -69,6 +73,7 @@ impl std::fmt::Debug for QueuedPayload {
"has_pending_attachments",
&self.pending_attachments.is_some(),
)
+ .field("has_native_message_input", &self.native_message_input.is_some())
.finish_non_exhaustive()
}
}
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
index 92d0805b11..dc453aa6f5 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs
@@ -23,6 +23,8 @@ pub(crate) struct HostChannelTurn {
pub(crate) event_session_id: String,
/// The message the agent answers.
pub(crate) message: String,
+ /// Scoped typed media input for this exact queued channel request.
+ pub(crate) message_input: Option<tinyinference_llm::message::Message>,
/// Who asked: the channel's `ExternalChannel` origin.
pub(crate) origin: AgentTurnOrigin,
/// Live progress projected through the compiled channel module.
@@ -50,6 +52,7 @@ pub(crate) async fn run_host_agent_turn(
session_key,
event_session_id,
message,
+ message_input,
origin,
progress,
run_queue,
@@ -93,6 +96,7 @@ pub(crate) async fn run_host_agent_turn(
&event_session_id,
&channel,
&message,
+ message_input,
origin,
approval,
progress,
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
index 432cb3a3f4..1302a91dd6 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
@@ -179,6 +179,7 @@ impl TurnHost<QueuedPayload> for NativeHost {
session_key: session.session_id.clone(),
event_session_id: trusted.event_session_id.clone(),
message: request.text.clone(),
+ message_input: request.payload.native_message_input.clone(),
origin: trusted.origin.clone(),
progress: Some(agent_progress),
run_queue: Some(queue),
@@ -551,6 +552,7 @@ pub(crate) async fn run(
thread_id: String,
request_id: String,
text: String,
+ message_input: Option<tinyinference_llm::message::Message>,
trusted: Arc<crate::agent::turn_host::TrustedAgentTurn>,
) -> NativeTurnExecution {
let runtime = crate::core::runtime::slot_for::<NativeRuntime>(dispatch);
@@ -576,6 +578,7 @@ pub(crate) async fn run(
payload: QueuedPayload {
ctx: Some(dispatch.clone()),
trusted_turn: Some(trusted),
+ native_message_input: message_input,
..Default::default()
},
host_authored: false,
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
index 5c055e5106..a01180c66d 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
@@ -16,6 +16,7 @@
mod approval;
mod bus_turn;
+mod native_media;
pub(crate) mod progressive;
mod reset;
mod turn;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs
index 8a7bcfe90a..f13fba6118 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs
@@ -1,7 +1,5 @@
//! Resolve typed native-channel media through TinyChannels' scoped media port.
-use std::sync::Arc;
-
use tinyinference_llm::message::Message;
use tinychannels_bus::{
module_media::{MediaReadBegin, MediaReadChunk, MediaReadFinish}, ChannelInboundEnvelope,