Struct A2aHttpClient
pub struct A2aHttpClient { /* private fields */ }Expand description
Outbound A2A HTTP client. Holds only the reqwest client and the live config
handle — no peer list copy. Constructed once, shared by all a2a_* tools
behind an Arc.
SSRF posture: peer base_urls are operator-declared (static allowlist), and
each call is guarded against private/loopback/metadata hosts via
helpers::domain_guard (the same policy http_request uses), with no
redirects followed.
Implementations§
Source§impl A2aHttpClient
impl A2aHttpClient
Sourcepub fn new(
config: LiveConfigHandle,
request_timeout_secs: u64,
zeroclaw_dir: Option<PathBuf>,
secrets_encrypt: bool,
route_cache: RouteCache,
) -> Result<Self>
pub fn new( config: LiveConfigHandle, request_timeout_secs: u64, zeroclaw_dir: Option<PathBuf>, secrets_encrypt: bool, route_cache: RouteCache, ) -> Result<Self>
Build the client. The reqwest client is built once (timeout + no-redirect
policy); peers resolve from live config per call, so nothing about peers
is eagerly validated here. zeroclaw_dir + secrets_encrypt enable
decrypting encrypted peer tokens via the canonical SecretStore (the
same path http_request uses).
Source§impl A2aHttpClient
impl A2aHttpClient
Sourcepub async fn send_message(
&self,
peer: &str,
agent: &str,
message: &str,
context_id: Option<String>,
task_id: Option<String>,
return_immediately: bool,
) -> Result<(Task, bool)>
pub async fn send_message( &self, peer: &str, agent: &str, message: &str, context_id: Option<String>, task_id: Option<String>, return_immediately: bool, ) -> Result<(Task, bool)>
SendMessage (spec §9.4.1): delegate a task to a peer agent and block
for the returned payload. The response is a SendMessageResponse
oneof: a Task (terminal/non-terminal) or a Message reply. Returns
the task and a flag: true for a genuine Task branch, false for a
Message reply folded into a synthetic task (retains the peer-provided
messageId as the task id). Non-terminal task states are returned as-is
for the tool layer to poll.
Sourcepub async fn get_task(
&self,
peer: &str,
task_id: &str,
agent: Option<&str>,
) -> Result<Task>
pub async fn get_task( &self, peer: &str, task_id: &str, agent: Option<&str>, ) -> Result<Task>
GetTask (spec §9.4.3): retrieve the current state and artifacts of
an in-flight task. Reuses the route cached by the originating
SendMessage (same peer/rpc_url/tenant) so the poll lands on the same
endpoint that created the task; falls back to interface selection if
the route is not cached (daemon restart, evicted entry).
Sourcepub async fn cancel(
&self,
peer: &str,
task_id: &str,
agent: Option<&str>,
) -> Result<Task>
pub async fn cancel( &self, peer: &str, task_id: &str, agent: Option<&str>, ) -> Result<Task>
CancelTask (spec §9.4.5): request cancellation of an in-flight task.
Reuses the route cached by the originating SendMessage; falls back
to interface selection if not cached.
Sourcepub async fn get_card(&self, peer: &str) -> Result<AgentCard>
pub async fn get_card(&self, peer: &str) -> Result<AgentCard>
GET /.well-known/agent-card.json (spec §14.3 discovery
surface): fetch a peer’s public Agent Card from the origin root. The
well-known card is unauthenticated. Cached by base_url (derived data):
a repeat discover/send reuses the cached card; an endpoint change is
a different cache key, so the prior entry is naturally invalidated.
Auto Trait Implementations§
impl !Freeze for A2aHttpClient
impl !RefUnwindSafe for A2aHttpClient
impl !UnwindSafe for A2aHttpClient
impl Send for A2aHttpClient
impl Sync for A2aHttpClient
impl Unpin for A2aHttpClient
impl UnsafeUnpin for A2aHttpClient
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more