pub use merry_core::{
SessionId, SubagentActivityPhase, SubagentActivitySnapshot, ToolCallId, ToolOutputPreview,
TrajectoryEvent, TrajectorySnapshot,
};
pub use merry_runtime::{RuntimeError, SubagentActivityReceiver};
use tokio::sync::broadcast;
#[derive(Clone)]
pub struct TrajectoryHandle {
runtime: merry_runtime::Runtime,
}
impl TrajectoryHandle {
#[doc(hidden)]
#[must_use]
pub fn from_runtime(runtime: merry_runtime::Runtime) -> Self {
Self { runtime }
}
#[must_use]
pub fn session_id(&self) -> &SessionId {
self.runtime.session_id()
}
pub async fn trajectory_snapshot(&self) -> Result<TrajectorySnapshot, RuntimeError> {
self.runtime.trajectory_snapshot().await
}
pub async fn trajectory_subscription(
&self,
) -> Result<(TrajectorySnapshot, broadcast::Receiver<TrajectoryEvent>), RuntimeError> {
self.runtime.trajectory_subscription().await
}
pub async fn read_tool_output_preview(
&self,
call_id: &ToolCallId,
max_bytes: usize,
) -> Result<Option<ToolOutputPreview>, RuntimeError> {
self.runtime
.read_tool_output_preview(call_id, max_bytes)
.await
}
}