pub struct BrowserRuntimeClient { /* private fields */ }Expand description
Authenticated HTTP client for the Bobby Browser /v1 runtime interface.
Construct with BrowserRuntimeClient::new. base_url is the runtime
origin; a trailing slash and a trailing /v1 are stripped.
Implementations§
Source§impl BrowserRuntimeClient
impl BrowserRuntimeClient
Sourcepub fn new(
base_url: impl Into<String>,
bearer_token: impl Into<String>,
) -> Result<Self, ClientError>
pub fn new( base_url: impl Into<String>, bearer_token: impl Into<String>, ) -> Result<Self, ClientError>
Create a client.
base_url is the runtime origin (http://127.0.0.1:7777 or …/v1).
Returns ClientError::Protocol when base_url or bearer_token is empty.
Sourcepub fn with_options(
base_url: impl Into<String>,
bearer_token: impl Into<String>,
max_artifact_bytes: u64,
) -> Result<Self, ClientError>
pub fn with_options( base_url: impl Into<String>, bearer_token: impl Into<String>, max_artifact_bytes: u64, ) -> Result<Self, ClientError>
Create a client with an explicit artifact byte cap (at most
MAX_SDK_ARTIFACT_BYTES).
Sourcepub async fn runtime_info(
&self,
options: Option<RequestOptions>,
) -> Result<RuntimeInfo, ClientError>
pub async fn runtime_info( &self, options: Option<RequestOptions>, ) -> Result<RuntimeInfo, ClientError>
GET /v1/runtime — version, capabilities, and load counters.
Sourcepub async fn create_session(
&self,
input: &CreateSessionRequest,
options: Option<RequestOptions>,
) -> Result<SessionState, ClientError>
pub async fn create_session( &self, input: &CreateSessionRequest, options: Option<RequestOptions>, ) -> Result<SessionState, ClientError>
POST /v1/sessions — create a browser session.
Sourcepub async fn list_sessions(
&self,
options: Option<RequestOptions>,
) -> Result<Vec<SessionState>, ClientError>
pub async fn list_sessions( &self, options: Option<RequestOptions>, ) -> Result<Vec<SessionState>, ClientError>
GET /v1/sessions — list active sessions.
Sourcepub async fn delete_session(
&self,
session_id: &SessionId,
options: Option<RequestOptions>,
) -> Result<(), ClientError>
pub async fn delete_session( &self, session_id: &SessionId, options: Option<RequestOptions>, ) -> Result<(), ClientError>
DELETE /v1/sessions/{id} — tear down a session (204 on success).
Sourcepub async fn open_page(
&self,
input: &OpenPageRequest,
options: Option<RequestOptions>,
) -> Result<PageState, ClientError>
pub async fn open_page( &self, input: &OpenPageRequest, options: Option<RequestOptions>, ) -> Result<PageState, ClientError>
POST /v1/pages — open a page in a session.
Sourcepub async fn submit(
&self,
input: &CommandEnvelope,
options: Option<RequestOptions>,
) -> Result<CommandOutcome, ClientError>
pub async fn submit( &self, input: &CommandEnvelope, options: Option<RequestOptions>, ) -> Result<CommandOutcome, ClientError>
POST /v1/commands — submit a command envelope (primitive or intent).
Sourcepub async fn context_ask(
&self,
session_id: &SessionId,
page_id: &PageId,
description: &str,
options: Option<RequestOptions>,
) -> Result<ContextAskResponse, ClientError>
pub async fn context_ask( &self, session_id: &SessionId, page_id: &PageId, description: &str, options: Option<RequestOptions>, ) -> Result<ContextAskResponse, ClientError>
GET /v1/context/ask — resolve one described control from retained context.
Sourcepub async fn context_neighbors(
&self,
session_id: &SessionId,
page_id: &PageId,
description: &str,
options: Option<RequestOptions>,
) -> Result<ContextNeighborsResponse, ClientError>
pub async fn context_neighbors( &self, session_id: &SessionId, page_id: &PageId, description: &str, options: Option<RequestOptions>, ) -> Result<ContextNeighborsResponse, ClientError>
GET /v1/context/neighbors — return the remembered form around one control.
Sourcepub async fn context_site(
&self,
site_key: &str,
options: Option<RequestOptions>,
) -> Result<ContextSiteResponse, ClientError>
pub async fn context_site( &self, site_key: &str, options: Option<RequestOptions>, ) -> Result<ContextSiteResponse, ClientError>
GET /v1/context/site/{key} — return retained structure for one site key.
Sourcepub async fn submit_job(
&self,
input: &SubmitJobRequest,
options: Option<RequestOptions>,
) -> Result<JobSubmitResponse, ClientError>
pub async fn submit_job( &self, input: &SubmitJobRequest, options: Option<RequestOptions>, ) -> Result<JobSubmitResponse, ClientError>
POST /v1/jobs — submit a bounded runtime job.
Sourcepub async fn job_status(
&self,
job_id: &JobId,
options: Option<RequestOptions>,
) -> Result<JobStatusResponse, ClientError>
pub async fn job_status( &self, job_id: &JobId, options: Option<RequestOptions>, ) -> Result<JobStatusResponse, ClientError>
GET /v1/jobs/{job_id} — read the authenticated principal’s job.
Sourcepub async fn cancel_job(
&self,
job_id: &JobId,
options: Option<RequestOptions>,
) -> Result<(), ClientError>
pub async fn cancel_job( &self, job_id: &JobId, options: Option<RequestOptions>, ) -> Result<(), ClientError>
DELETE /v1/jobs/{job_id} — cancel the authenticated principal’s job.
Sourcepub async fn form_snapshot(
&self,
session_id: &SessionId,
page_id: &PageId,
max_controls: Option<u32>,
options: Option<RequestOptions>,
) -> Result<FormSnapshot, ClientError>
pub async fn form_snapshot( &self, session_id: &SessionId, page_id: &PageId, max_controls: Option<u32>, options: Option<RequestOptions>, ) -> Result<FormSnapshot, ClientError>
GET /v1/sessions/{session}/pages/{page}/forms — semantic form snapshot.
max_controls bounds the inventory (1..=512), mirroring the
TypeScript formSnapshot(sessionId, pageId, { maxControls }).
Sourcepub async fn checkpoint(
&self,
input: &CheckpointRequest,
options: Option<RequestOptions>,
) -> Result<WorkflowCheckpoint, ClientError>
pub async fn checkpoint( &self, input: &CheckpointRequest, options: Option<RequestOptions>, ) -> Result<WorkflowCheckpoint, ClientError>
POST /v1/checkpoints — persist a workflow checkpoint.
Sourcepub async fn recovery_status(
&self,
workflow_id: &WorkflowId,
options: Option<RequestOptions>,
) -> Result<RecoveryStatus, ClientError>
pub async fn recovery_status( &self, workflow_id: &WorkflowId, options: Option<RequestOptions>, ) -> Result<RecoveryStatus, ClientError>
GET /v1/recovery/{workflow} — current recovery status for a workflow.
Sourcepub async fn recover(
&self,
workflow_id: &WorkflowId,
options: Option<RequestOptions>,
) -> Result<RecoveryDecision, ClientError>
pub async fn recover( &self, workflow_id: &WorkflowId, options: Option<RequestOptions>, ) -> Result<RecoveryDecision, ClientError>
POST /v1/recovery/{workflow} — resume, reconcile, or restart a
workflow. A needsReconciliation decision answers HTTP 409, which
this method surfaces as ClientError::Http carrying the decision body.
Sourcepub async fn artifact(
&self,
reference: &ArtifactReference,
options: Option<RequestOptions>,
) -> Result<Vec<u8>, ClientError>
pub async fn artifact( &self, reference: &ArtifactReference, options: Option<RequestOptions>, ) -> Result<Vec<u8>, ClientError>
GET /v1/artifacts/{id} — fetch an artifact and verify it against its
reference before any bytes reach the caller.
Checks the reference bounds (artifact id shape, lowercase SHA-256
digest, byte cap), then the response Content-Type essence and
Content-Length, then the SHA-256 digest of the buffered body.