pub struct ClawDB { /* private fields */ }Expand description
The primary ClawDB client.
Implementations§
Source§impl ClawDB
impl ClawDB
Sourcepub fn builder() -> ClawDBBuilder
pub fn builder() -> ClawDBBuilder
Create a builder to configure and construct a ClawDB client.
Sourcepub async fn auto_provision() -> SdkResult<Self>
pub async fn auto_provision() -> SdkResult<Self>
Automatically provision a usable endpoint following the SDK fallback order.
Sourcepub async fn from_api_key(
api_key: impl Into<String>,
endpoint: impl Into<String>,
) -> SdkResult<Self>
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.
Sourcepub async fn health(&self) -> SdkResult<HealthResponse>
pub async fn health(&self) -> SdkResult<HealthResponse>
Check server health.
Sourcepub async fn create_session(
&self,
role: &str,
scopes: &[&str],
ttl_secs: u64,
) -> SdkResult<SessionInfo>
pub async fn create_session( &self, role: &str, scopes: &[&str], ttl_secs: u64, ) -> SdkResult<SessionInfo>
Create a new session token.
Sourcepub async fn validate_session(&self) -> SdkResult<SessionInfo>
pub async fn validate_session(&self) -> SdkResult<SessionInfo>
Validate the current session.
Sourcepub async fn revoke_session(&self, session_id: &str) -> SdkResult<bool>
pub async fn revoke_session(&self, session_id: &str) -> SdkResult<bool>
Revoke a session by ID.
Sourcepub async fn active_session_count(&self) -> SdkResult<u64>
pub async fn active_session_count(&self) -> SdkResult<u64>
Get the count of active sessions.
Sourcepub async fn remember(&self, content: impl Into<String>) -> SdkResult<String>
pub async fn remember(&self, content: impl Into<String>) -> SdkResult<String>
Store a plain memory and return its ID.
Sourcepub async fn remember_typed(
&self,
content: impl Into<String>,
opts: RememberOptions,
) -> SdkResult<String>
pub async fn remember_typed( &self, content: impl Into<String>, opts: RememberOptions, ) -> SdkResult<String>
Store a typed memory and return its ID.
Sourcepub async fn update_memory(
&self,
memory_id: &str,
content: impl Into<String>,
) -> SdkResult<bool>
pub async fn update_memory( &self, memory_id: &str, content: impl Into<String>, ) -> SdkResult<bool>
Update an existing memory’s content.
Sourcepub async fn search(
&self,
query: impl Into<String>,
opts: SearchOptions,
) -> SdkResult<Vec<SearchHit>>
pub async fn search( &self, query: impl Into<String>, opts: SearchOptions, ) -> SdkResult<Vec<SearchHit>>
Semantic search over memories.
Sourcepub async fn recall(&self, ids: &[&str]) -> SdkResult<Vec<MemoryRecord>>
pub async fn recall(&self, ids: &[&str]) -> SdkResult<Vec<MemoryRecord>>
Recall specific memories by ID.
Sourcepub async fn list_memories(
&self,
memory_type: Option<&str>,
limit: Option<u32>,
) -> SdkResult<Vec<MemoryRecord>>
pub async fn list_memories( &self, memory_type: Option<&str>, limit: Option<u32>, ) -> SdkResult<Vec<MemoryRecord>>
List memories with optional type filter.
Sourcepub async fn delete_memory(&self, memory_id: &str) -> SdkResult<bool>
pub async fn delete_memory(&self, memory_id: &str) -> SdkResult<bool>
Delete a memory by ID.
Sourcepub async fn branch(
&self,
name: &str,
from: Option<&str>,
) -> SdkResult<BranchInfo>
pub async fn branch( &self, name: &str, from: Option<&str>, ) -> SdkResult<BranchInfo>
Fork a new branch.
Sourcepub async fn list_branches(&self) -> SdkResult<Vec<BranchInfo>>
pub async fn list_branches(&self) -> SdkResult<Vec<BranchInfo>>
List all branches.
Sourcepub async fn get_branch(&self, branch_id: &str) -> SdkResult<BranchInfo>
pub async fn get_branch(&self, branch_id: &str) -> SdkResult<BranchInfo>
Get a branch by ID.
Sourcepub async fn get_branch_by_name(&self, name: &str) -> SdkResult<BranchInfo>
pub async fn get_branch_by_name(&self, name: &str) -> SdkResult<BranchInfo>
Get a branch by name.
Sourcepub async fn get_trunk_branch(&self) -> SdkResult<BranchInfo>
pub async fn get_trunk_branch(&self) -> SdkResult<BranchInfo>
Get the trunk (main) branch.
Sourcepub async fn diff(
&self,
source_branch_id: &str,
target_branch_id: &str,
) -> SdkResult<DiffResult>
pub async fn diff( &self, source_branch_id: &str, target_branch_id: &str, ) -> SdkResult<DiffResult>
Diff a branch against a target.
Sourcepub async fn merge(
&self,
source_branch_id: &str,
target_branch_id: &str,
strategy: &str,
) -> SdkResult<MergeResult>
pub async fn merge( &self, source_branch_id: &str, target_branch_id: &str, strategy: &str, ) -> SdkResult<MergeResult>
Merge source branch into target.
Sourcepub async fn discard_branch(&self, branch_id: &str) -> SdkResult<bool>
pub async fn discard_branch(&self, branch_id: &str) -> SdkResult<bool>
Discard (delete) a branch.
Sourcepub async fn archive_branch(&self, branch_id: &str) -> SdkResult<bool>
pub async fn archive_branch(&self, branch_id: &str) -> SdkResult<bool>
Archive a branch.
Sourcepub async fn sync(&self) -> SdkResult<SyncResult>
pub async fn sync(&self) -> SdkResult<SyncResult>
Full bidirectional sync.
Sourcepub async fn push_sync(&self) -> SdkResult<SyncActionResult>
pub async fn push_sync(&self) -> SdkResult<SyncActionResult>
Push local memories to remote.
Sourcepub async fn pull_sync(&self) -> SdkResult<SyncActionResult>
pub async fn pull_sync(&self) -> SdkResult<SyncActionResult>
Pull remote memories to local.
Sourcepub async fn reconcile_sync(&self) -> SdkResult<SyncActionResult>
pub async fn reconcile_sync(&self) -> SdkResult<SyncActionResult>
Reconcile divergent sync state.
Sourcepub async fn sync_status(&self) -> SdkResult<SyncStatusResult>
pub async fn sync_status(&self) -> SdkResult<SyncStatusResult>
Get current sync status.
Sourcepub async fn reflect(&self) -> SdkResult<ReflectJob>
pub async fn reflect(&self) -> SdkResult<ReflectJob>
Trigger a new reflection job.
Sourcepub async fn reflect_list_jobs(
&self,
agent_id: &str,
) -> SdkResult<Vec<ReflectJob>>
pub async fn reflect_list_jobs( &self, agent_id: &str, ) -> SdkResult<Vec<ReflectJob>>
List reflection jobs.
Sourcepub async fn reflect_get_job(&self, job_id: &str) -> SdkResult<ReflectJob>
pub async fn reflect_get_job(&self, job_id: &str) -> SdkResult<ReflectJob>
Get a specific reflection job.
Sourcepub async fn reflect_get_facts(&self, agent_id: &str) -> SdkResult<Value>
pub async fn reflect_get_facts(&self, agent_id: &str) -> SdkResult<Value>
Get extracted facts for an agent.
Sourcepub async fn reflect_get_preferences(&self, agent_id: &str) -> SdkResult<Value>
pub async fn reflect_get_preferences(&self, agent_id: &str) -> SdkResult<Value>
Get preferences for an agent.
Sourcepub async fn reflect_get_contradictions(
&self,
agent_id: &str,
) -> SdkResult<Value>
pub async fn reflect_get_contradictions( &self, agent_id: &str, ) -> SdkResult<Value>
Get contradictions for an agent.
Sourcepub async fn reflect_resolve_contradiction(
&self,
agent_id: &str,
contradiction_id: &str,
strategy: &str,
merged_value_json: Option<&str>,
) -> SdkResult<Value>
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.
Sourcepub async fn tx_remember(
&self,
tx_id: &str,
content: impl Into<String>,
) -> SdkResult<String>
pub async fn tx_remember( &self, tx_id: &str, content: impl Into<String>, ) -> SdkResult<String>
Add a plain memory to a transaction.
Sourcepub async fn tx_remember_typed(
&self,
tx_id: &str,
content: impl Into<String>,
opts: RememberOptions,
) -> SdkResult<String>
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.
Sourcepub async fn rollback_tx(&self, tx_id: &str) -> SdkResult<bool>
pub async fn rollback_tx(&self, tx_id: &str) -> SdkResult<bool>
Roll back a transaction.