CellstateClient

Struct CellstateClient 

Source
pub struct CellstateClient {
    http: Client,
    base_url: Url,
    api_key: SecretString,
    response_format: ResponseFormat,
}

Fields§

§http: Client§base_url: Url§api_key: SecretString§response_format: ResponseFormat

Implementations§

Source§

impl CellstateClient

Source

pub fn new(base_url: &str, api_key: &str) -> Result<Self>

Create a new client pointing at the given API base URL.

§Arguments
  • base_url: Full URL to the CELLSTATE API (e.g., "https://cst.batterypack.dev")
  • api_key: API key for authentication (e.g., "cst_...")
§Errors

Returns Error::InvalidUrl if base_url cannot be parsed.

Source

pub fn from_env() -> Result<Self>

Create a client from environment variables.

Reads CELLSTATE_API_URL (or CELLSTATE_BASE_URL) and CELLSTATE_API_KEY.

§Errors

Returns Error::InvalidUrl if the URL env var is missing or invalid.

Source

fn url(&self, path: &str) -> Result<Url>

Build the full URL for an API path.

Source

pub fn with_response_format(self, response_format: ResponseFormat) -> Self

Returns a cloned client configured to request the given response format.

Source

pub fn set_response_format(&mut self, response_format: ResponseFormat)

Set the preferred response format for this client.

Source

fn auth(&self, builder: RequestBuilder) -> RequestBuilder

Attach authentication and common headers to a request.

Source

fn is_msgpack_content_type(content_type: &str) -> bool

Source

async fn parse_response<T>(&self, response: Response) -> Result<T>

Source

async fn send(&self, builder: RequestBuilder) -> Result<Response>

Execute a request and handle error responses.

Source

pub async fn create_trajectory( &self, request: &CreateTrajectoryRequest, ) -> Result<TrajectoryResponse>

Create a new trajectory.

Source

pub async fn get_trajectory( &self, id: TrajectoryId, ) -> Result<TrajectoryResponse>

Get a trajectory by ID.

Source

pub async fn list_trajectories( &self, params: &ListParams, ) -> Result<ListResponse<TrajectoryResponse>>

List trajectories with optional pagination.

Source

pub async fn update_trajectory( &self, id: TrajectoryId, request: &UpdateTrajectoryRequest, ) -> Result<TrajectoryResponse>

Update a trajectory.

Source

pub async fn delete_trajectory(&self, id: TrajectoryId) -> Result<()>

Delete a trajectory.

Source

pub async fn create_scope( &self, request: &CreateScopeRequest, ) -> Result<ScopeResponse>

Create a new scope.

Source

pub async fn get_scope(&self, id: ScopeId) -> Result<ScopeResponse>

Get a scope by ID.

Source

pub async fn list_scopes( &self, params: &ListParams, ) -> Result<ListResponse<ScopeResponse>>

List scopes with optional pagination.

Source

pub async fn update_scope( &self, id: ScopeId, request: &UpdateScopeRequest, ) -> Result<ScopeResponse>

Update a scope.

Source

pub async fn delete_scope(&self, id: ScopeId) -> Result<()>

Delete a scope.

Source

pub async fn create_artifact( &self, request: &CreateArtifactRequest, ) -> Result<ArtifactResponse>

Create a new artifact.

Source

pub async fn get_artifact(&self, id: ArtifactId) -> Result<ArtifactResponse>

Get an artifact by ID.

Source

pub async fn list_artifacts( &self, params: &ListParams, ) -> Result<ListResponse<ArtifactResponse>>

List artifacts with optional pagination.

Source

pub async fn update_artifact( &self, id: ArtifactId, request: &UpdateArtifactRequest, ) -> Result<ArtifactResponse>

Update an artifact.

Source

pub async fn delete_artifact(&self, id: ArtifactId) -> Result<()>

Delete an artifact.

Source

pub async fn create_note( &self, request: &CreateNoteRequest, ) -> Result<NoteResponse>

Create a new note.

Source

pub async fn get_note(&self, id: NoteId) -> Result<NoteResponse>

Get a note by ID.

Source

pub async fn list_notes( &self, params: &ListParams, ) -> Result<ListResponse<NoteResponse>>

List notes with optional pagination.

Source

pub async fn update_note( &self, id: NoteId, request: &UpdateNoteRequest, ) -> Result<NoteResponse>

Update a note.

Source

pub async fn delete_note(&self, id: NoteId) -> Result<()>

Delete a note.

Source

pub async fn create_turn( &self, request: &CreateTurnRequest, ) -> Result<TurnResponse>

Create a new turn.

Source

pub async fn get_turn(&self, id: TurnId) -> Result<TurnResponse>

Get a turn by ID.

Source

pub async fn list_turns( &self, params: &ListParams, ) -> Result<ListResponse<TurnResponse>>

List turns with optional pagination.

Source

pub async fn create_agent( &self, request: &CreateAgentRequest, ) -> Result<AgentResponse>

Create a new agent.

Source

pub async fn get_agent(&self, id: AgentId) -> Result<AgentResponse>

Get an agent by ID.

Source

pub async fn list_agents( &self, params: &ListParams, ) -> Result<ListResponse<AgentResponse>>

List agents with optional pagination.

Source

pub async fn commit_memory( &self, request: &CommitMemoryRequest, ) -> Result<CommitMemoryResponse>

Commit a memory interaction (PCP memory commit).

Source

pub async fn recall(&self, request: &RecallRequest) -> Result<RecallResponse>

Recall previous interactions for a trajectory.

Source

pub async fn assemble_context( &self, request: &AssembleContextRequest, ) -> Result<AssembleContextResponse>

Assemble a context window for a scope.

Source

pub async fn health(&self) -> Result<bool>

Check API health.

Returns Ok(true) if the API is healthy, Ok(false) if it returns a non-success status, or Err on connection failure.

Trait Implementations§

Source§

impl Clone for CellstateClient

Source§

fn clone(&self) -> CellstateClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CellstateClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more