pub struct BusHandle { /* private fields */ }Expand description
A scoped handle that a single agent uses to send and receive messages.
The handle knows the agent’s id and uses it as sender_id on outgoing
envelopes. It also provides filtered receive helpers.
Implementations§
Source§impl BusHandle
impl BusHandle
Sourcepub fn send(&self, topic: impl Into<String>, message: BusMessage) -> usize
pub fn send(&self, topic: impl Into<String>, message: BusMessage) -> usize
Send a message on the given topic.
Sourcepub fn send_with_correlation(
&self,
topic: impl Into<String>,
message: BusMessage,
correlation_id: Option<String>,
) -> usize
pub fn send_with_correlation( &self, topic: impl Into<String>, message: BusMessage, correlation_id: Option<String>, ) -> usize
Send a message with a correlation id.
Sourcepub fn announce_ready(&self, capabilities: Vec<String>) -> usize
pub fn announce_ready(&self, capabilities: Vec<String>) -> usize
Announce this agent as ready.
Sourcepub fn announce_shutdown(&self) -> usize
pub fn announce_shutdown(&self) -> usize
Announce this agent is shutting down.
Sourcepub fn send_task_update(
&self,
task_id: &str,
state: TaskState,
message: Option<String>,
) -> usize
pub fn send_task_update( &self, task_id: &str, state: TaskState, message: Option<String>, ) -> usize
Announce a task status update.
Sourcepub fn send_artifact_update(&self, task_id: &str, artifact: Artifact) -> usize
pub fn send_artifact_update(&self, task_id: &str, artifact: Artifact) -> usize
Announce an artifact update.
Sourcepub fn send_to_agent(&self, to: &str, parts: Vec<Part>) -> usize
pub fn send_to_agent(&self, to: &str, parts: Vec<Part>) -> usize
Send a direct message to another agent.
Publish a shared result (visible to the entire swarm).
Sourcepub fn publish_ralph_learning(
&self,
prd_id: &str,
story_id: &str,
iteration: usize,
learnings: Vec<String>,
context: Value,
) -> usize
pub fn publish_ralph_learning( &self, prd_id: &str, story_id: &str, iteration: usize, learnings: Vec<String>, context: Value, ) -> usize
Publish learnings from a Ralph iteration so other agents / future iterations can build on them.
Sourcepub fn publish_ralph_handoff(
&self,
prd_id: &str,
from_story: &str,
to_story: &str,
context: Value,
progress_summary: &str,
) -> usize
pub fn publish_ralph_handoff( &self, prd_id: &str, from_story: &str, to_story: &str, context: Value, progress_summary: &str, ) -> usize
Publish a context handoff between sequential Ralph stories.
Sourcepub fn publish_ralph_progress(
&self,
prd_id: &str,
passed: usize,
total: usize,
iteration: usize,
status: &str,
) -> usize
pub fn publish_ralph_progress( &self, prd_id: &str, passed: usize, total: usize, iteration: usize, status: &str, ) -> usize
Publish PRD-level progress.
Sourcepub fn drain_ralph_learnings(&mut self, prd_id: &str) -> Vec<BusEnvelope>
pub fn drain_ralph_learnings(&mut self, prd_id: &str) -> Vec<BusEnvelope>
Drain all accumulated Ralph learnings for a PRD (non-blocking).
Sourcepub fn send_voice_session_started(
&self,
room_name: &str,
voice_id: &str,
) -> usize
pub fn send_voice_session_started( &self, room_name: &str, voice_id: &str, ) -> usize
Announce that a voice session has started.
Sourcepub fn send_voice_transcript(
&self,
room_name: &str,
text: &str,
role: &str,
is_final: bool,
) -> usize
pub fn send_voice_transcript( &self, room_name: &str, text: &str, role: &str, is_final: bool, ) -> usize
Publish a transcript fragment from a voice session.
Sourcepub fn send_voice_agent_state(&self, room_name: &str, state: &str) -> usize
pub fn send_voice_agent_state(&self, room_name: &str, state: &str) -> usize
Announce a voice agent state change.
Sourcepub fn send_voice_session_ended(&self, room_name: &str, reason: &str) -> usize
pub fn send_voice_session_ended(&self, room_name: &str, reason: &str) -> usize
Announce that a voice session has ended.
Sourcepub async fn recv(&mut self) -> Option<BusEnvelope>
pub async fn recv(&mut self) -> Option<BusEnvelope>
Receive the next envelope (blocks until available).
Sourcepub async fn recv_topic(&mut self, prefix: &str) -> Option<BusEnvelope>
pub async fn recv_topic(&mut self, prefix: &str) -> Option<BusEnvelope>
Receive the next envelope whose topic starts with the given prefix.
Sourcepub async fn recv_mine(&mut self) -> Option<BusEnvelope>
pub async fn recv_mine(&mut self) -> Option<BusEnvelope>
Receive the next envelope addressed to this agent.
Sourcepub fn try_recv(&mut self) -> Option<BusEnvelope>
pub fn try_recv(&mut self) -> Option<BusEnvelope>
Try to receive without blocking. Returns None if no message is
queued.
Sourcepub fn registry(&self) -> &Arc<AgentRegistry>
pub fn registry(&self) -> &Arc<AgentRegistry>
Access the agent registry.
Sourcepub fn into_receiver(self) -> Receiver<BusEnvelope>
pub fn into_receiver(self) -> Receiver<BusEnvelope>
Get mutable access to the underlying receiver. This allows consuming the receiver in stream operations.
Auto Trait Implementations§
impl Freeze for BusHandle
impl !RefUnwindSafe for BusHandle
impl Send for BusHandle
impl Sync for BusHandle
impl Unpin for BusHandle
impl UnsafeUnpin for BusHandle
impl !UnwindSafe for BusHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request