pub struct RawClient { /* private fields */ }async-client only.Expand description
A harness session with no interpretation layered on top.
RawClient owns the process and the socket and does exactly three things:
the handshake, the initialize exchange, and frame codec. Answering the
harness’s tool calls, hooks, and policy checks is the caller’s job — see
crate::Client for a version that does that for you.
use antigravity_codes::{HarnessOptions, ModelBuilder, RawClient};
use antigravity_codes::protocol::{InputEvent, OutputEventEvent};
let mut client = RawClient::launch(
HarnessOptions::new()
.workspace("/tmp/project")
.model(ModelBuilder::gemini("gemini-flash-latest", "…")),
)
.await?;
client.send(&InputEvent::user("hello")).await?;
while let Some(event) = client.next_event().await? {
if let Some(OutputEventEvent::StepUpdate(step)) = event.into_event() {
println!("{:?}", step.text_or_delta());
}
}Implementations§
Source§impl RawClient
impl RawClient
Sourcepub async fn launch(options: HarnessOptions) -> Result<Self>
pub async fn launch(options: HarnessOptions) -> Result<Self>
Launches a harness, connects, and completes the initialize exchange.
Sourcepub fn initialize_response(&self) -> &InitializeConversationResponse
pub fn initialize_response(&self) -> &InitializeConversationResponse
The harness’s reply to initialize: the conversation id, any replayed history, and cumulative usage for a resumed session.
Sourcepub fn cascade_id(&self) -> Option<&str>
pub fn cascade_id(&self) -> Option<&str>
The conversation id, which the harness calls a “cascade id”.
Sourcepub async fn send(&mut self, event: &InputEvent) -> Result<()>
pub async fn send(&mut self, event: &InputEvent) -> Result<()>
Sends one frame.
Sourcepub async fn next_event(&mut self) -> Result<Option<OutputEvent>>
pub async fn next_event(&mut self) -> Result<Option<OutputEvent>>
Reads the next frame, or None once the harness has closed the socket.
Non-text frames (pings, pongs, the close frame itself) are handled and skipped rather than surfaced.
Sourcepub async fn shutdown(self) -> Result<()>
pub async fn shutdown(self) -> Result<()>
Asks the harness to end the session, waits for it to acknowledge, then stops the process.
The acknowledgement matters: the harness flushes conversation state to
its storage directory on the way out, so killing it early loses the
transcript a later cascade_id resume would have replayed.