Skip to content

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

feat(core): add staged parts and preparation error handling

Steven Enamakel11c5fb9f85dc
diff --git a/crates/openhuman-core/src/agent/queued_turn.rs b/crates/openhuman-core/src/agent/queued_turn.rs
index 232fb25166..82538846eb 100644
--- a/crates/openhuman-core/src/agent/queued_turn.rs
+++ b/crates/openhuman-core/src/agent/queued_turn.rs
@@ -56,6 +56,12 @@ pub struct QueuedPayload {
/// 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>,
+ /// Host-created staged refs authorized for this exact external turn.
+ /// Requeued synthetic placeholders never inherit this grant.
+ pub(crate) native_staged_parts: Vec<tinychannels_bus::ContentPart>,
+ /// A preparation failure is sent through the shared runner's terminal
+ /// path without invoking the model.
+ pub(crate) native_preparation_error: Option<String>,
}
impl std::fmt::Debug for QueuedPayload {
@@ -77,6 +83,8 @@ impl std::fmt::Debug for QueuedPayload {
"has_native_message_input",
&self.native_message_input.is_some(),
)
+ .field("native_staged_parts", &self.native_staged_parts.len())
+ .field("has_native_preparation_error", &self.native_preparation_error.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 dc453aa6f5..433787165e 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
@@ -25,6 +25,8 @@ pub(crate) struct HostChannelTurn {
pub(crate) message: String,
/// Scoped typed media input for this exact queued channel request.
pub(crate) message_input: Option<tinyinference_llm::message::Message>,
+ /// Exact staged native refs issued by the host for this user turn.
+ pub(crate) staged_parts: Vec<tinychannels_bus::ContentPart>,
/// Who asked: the channel's `ExternalChannel` origin.
pub(crate) origin: AgentTurnOrigin,
/// Live progress projected through the compiled channel module.
@@ -53,6 +55,7 @@ pub(crate) async fn run_host_agent_turn(
event_session_id,
message,
message_input,
+ staged_parts,
origin,
progress,
run_queue,
@@ -105,6 +108,7 @@ pub(crate) async fn run_host_agent_turn(
turn_deadline,
&imported_history,
legacy_history,
+ staged_parts,
)
.await?;
Ok(AgentTurnResponse::with_resolved_route(
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 9fde422116..0d74dc3d23 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
@@ -152,6 +152,9 @@ impl TurnHost<QueuedPayload> for NativeHost {
queue: Arc<RunQueue<TurnRequest<QueuedPayload>>>,
progress: mpsc::Sender<TurnSignal>,
) -> Result<TurnResult, String> {
+ if let Some(error) = request.payload.native_preparation_error.as_ref() {
+ return Err(error.clone());
+ }
let trusted = request
.payload
.trusted_turn
@@ -180,6 +183,7 @@ impl TurnHost<QueuedPayload> for NativeHost {
event_session_id: trusted.event_session_id.clone(),
message: request.text.clone(),
message_input: request.payload.native_message_input.clone(),
+ staged_parts: request.payload.native_staged_parts.clone(),
origin: trusted.origin.clone(),
progress: Some(agent_progress),
run_queue: Some(queue),
@@ -553,6 +557,8 @@ pub(crate) async fn run(
request_id: String,
text: String,
message_input: Option<tinyinference_llm::message::Message>,
+ staged_parts: Vec<tinychannels_bus::ContentPart>,
+ preparation_error: Option<String>,
trusted: Arc<crate::agent::turn_host::TrustedAgentTurn>,
) -> NativeTurnExecution {
let runtime = crate::core::runtime::slot_for::<NativeRuntime>(dispatch);
@@ -579,6 +585,8 @@ pub(crate) async fn run(
ctx: Some(dispatch.clone()),
trusted_turn: Some(trusted),
native_message_input: message_input,
+ native_staged_parts: staged_parts,
+ native_preparation_error: preparation_error,
..Default::default()
},
host_authored: false,