Skip to main content

ClawDB

Struct ClawDB 

Source
pub struct ClawDB { /* private fields */ }
Expand description

The primary ClawDB client.

Implementations§

Source§

impl ClawDB

Source

pub fn builder() -> ClawDBBuilder

Create a builder to configure and construct a ClawDB client.

Source

pub async fn from_env() -> SdkResult<Self>

Create a client from environment variables.

Source

pub async fn auto_provision() -> SdkResult<Self>

Automatically provision a usable endpoint following the SDK fallback order.

Source

pub async fn from_api_key( api_key: impl Into<String>, endpoint: impl Into<String>, ) -> SdkResult<Self>

Create a client from an API key and endpoint.

Source

pub async fn health(&self) -> SdkResult<HealthResponse>

Check server health.

Source

pub async fn ping(&self) -> SdkResult<()>

Ping the server (returns Ok if reachable).

Source

pub async fn create_session( &self, role: &str, scopes: &[&str], ttl_secs: u64, ) -> SdkResult<SessionInfo>

Create a new session token.

Source

pub async fn validate_session(&self) -> SdkResult<SessionInfo>

Validate the current session.

Source

pub async fn revoke_session(&self, session_id: &str) -> SdkResult<bool>

Revoke a session by ID.

Source

pub async fn active_session_count(&self) -> SdkResult<u64>

Get the count of active sessions.

Source

pub async fn remember(&self, content: impl Into<String>) -> SdkResult<String>

Store a plain memory and return its ID.

Source

pub async fn remember_typed( &self, content: impl Into<String>, opts: RememberOptions, ) -> SdkResult<String>

Store a typed memory and return its ID.

Source

pub async fn update_memory( &self, memory_id: &str, content: impl Into<String>, ) -> SdkResult<bool>

Update an existing memory’s content.

Source

pub async fn search( &self, query: impl Into<String>, opts: SearchOptions, ) -> SdkResult<Vec<SearchHit>>

Semantic search over memories.

Source

pub async fn recall(&self, ids: &[&str]) -> SdkResult<Vec<MemoryRecord>>

Recall specific memories by ID.

Source

pub async fn list_memories( &self, memory_type: Option<&str>, limit: Option<u32>, ) -> SdkResult<Vec<MemoryRecord>>

List memories with optional type filter.

Source

pub async fn delete_memory(&self, memory_id: &str) -> SdkResult<bool>

Delete a memory by ID.

Source

pub async fn branch( &self, name: &str, from: Option<&str>, ) -> SdkResult<BranchInfo>

Fork a new branch.

Source

pub async fn list_branches(&self) -> SdkResult<Vec<BranchInfo>>

List all branches.

Source

pub async fn get_branch(&self, branch_id: &str) -> SdkResult<BranchInfo>

Get a branch by ID.

Source

pub async fn get_branch_by_name(&self, name: &str) -> SdkResult<BranchInfo>

Get a branch by name.

Source

pub async fn get_trunk_branch(&self) -> SdkResult<BranchInfo>

Get the trunk (main) branch.

Source

pub async fn diff( &self, source_branch_id: &str, target_branch_id: &str, ) -> SdkResult<DiffResult>

Diff a branch against a target.

Source

pub async fn merge( &self, source_branch_id: &str, target_branch_id: &str, strategy: &str, ) -> SdkResult<MergeResult>

Merge source branch into target.

Source

pub async fn discard_branch(&self, branch_id: &str) -> SdkResult<bool>

Discard (delete) a branch.

Source

pub async fn archive_branch(&self, branch_id: &str) -> SdkResult<bool>

Archive a branch.

Source

pub async fn sync(&self) -> SdkResult<SyncResult>

Full bidirectional sync.

Source

pub async fn push_sync(&self) -> SdkResult<SyncActionResult>

Push local memories to remote.

Source

pub async fn pull_sync(&self) -> SdkResult<SyncActionResult>

Pull remote memories to local.

Source

pub async fn reconcile_sync(&self) -> SdkResult<SyncActionResult>

Reconcile divergent sync state.

Source

pub async fn sync_status(&self) -> SdkResult<SyncStatusResult>

Get current sync status.

Source

pub async fn reflect(&self) -> SdkResult<ReflectJob>

Trigger a new reflection job.

Source

pub async fn reflect_list_jobs( &self, agent_id: &str, ) -> SdkResult<Vec<ReflectJob>>

List reflection jobs.

Source

pub async fn reflect_get_job(&self, job_id: &str) -> SdkResult<ReflectJob>

Get a specific reflection job.

Source

pub async fn reflect_get_facts(&self, agent_id: &str) -> SdkResult<Value>

Get extracted facts for an agent.

Source

pub async fn reflect_get_preferences(&self, agent_id: &str) -> SdkResult<Value>

Get preferences for an agent.

Source

pub async fn reflect_get_contradictions( &self, agent_id: &str, ) -> SdkResult<Value>

Get contradictions for an agent.

Source

pub async fn reflect_resolve_contradiction( &self, agent_id: &str, contradiction_id: &str, strategy: &str, merged_value_json: Option<&str>, ) -> SdkResult<Value>

Resolve a specific contradiction.

Source

pub async fn begin_tx(&self) -> SdkResult<TxInfo>

Begin a new transaction.

Source

pub async fn tx_remember( &self, tx_id: &str, content: impl Into<String>, ) -> SdkResult<String>

Add a plain memory to a transaction.

Source

pub async fn tx_remember_typed( &self, tx_id: &str, content: impl Into<String>, opts: RememberOptions, ) -> SdkResult<String>

Add a typed memory to a transaction.

Source

pub async fn commit_tx(&self, tx_id: &str) -> SdkResult<bool>

Commit a transaction.

Source

pub async fn rollback_tx(&self, tx_id: &str) -> SdkResult<bool>

Roll back a transaction.

Source

pub fn close(&self)

Close the client (no-op for HTTP).

Source

pub fn endpoint(&self) -> &str

Return the configured endpoint.

Source

pub fn agent_id(&self) -> &str

Return the configured agent_id.

Trait Implementations§

Source§

impl Clone for ClawDB

Source§

fn clone(&self) -> ClawDB

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ClawDB

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.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> 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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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