pub struct DaemonClient { /* private fields */ }Expand description
Daemon client configuration
Implementations§
Source§impl DaemonClient
impl DaemonClient
Sourcepub fn new(port: u16) -> Self
pub fn new(port: u16) -> Self
Create a new daemon client, loading auth token from ~/.st/daemon.token
Sourcepub fn default_port() -> Self
pub fn default_port() -> Self
Create with default port (28428)
Sourcepub async fn check_status(&self) -> DaemonStatus
pub async fn check_status(&self) -> DaemonStatus
Check if the daemon is running
Sourcepub async fn health_check(&self) -> Result<bool>
pub async fn health_check(&self) -> Result<bool>
Health check - returns true if daemon is responsive
Sourcepub async fn get_info(&self) -> Result<DaemonInfo>
pub async fn get_info(&self) -> Result<DaemonInfo>
Get daemon info
Sourcepub async fn get_context(&self) -> Result<ContextResponse>
pub async fn get_context(&self) -> Result<ContextResponse>
Get system context summary
Sourcepub async fn get_projects(&self) -> Result<Vec<ProjectInfo>>
pub async fn get_projects(&self) -> Result<Vec<ProjectInfo>>
Get list of detected projects
Sourcepub async fn query_context(&self, query: &str) -> Result<Value>
pub async fn query_context(&self, query: &str) -> Result<Value>
Query context by keyword
Sourcepub async fn list_files(
&self,
path: Option<&str>,
pattern: Option<&str>,
depth: Option<usize>,
) -> Result<Vec<String>>
pub async fn list_files( &self, path: Option<&str>, pattern: Option<&str>, depth: Option<usize>, ) -> Result<Vec<String>>
List files in a directory via daemon
Sourcepub async fn get_credits(&self) -> Result<CreditsResponse>
pub async fn get_credits(&self) -> Result<CreditsResponse>
Get Foken credits
Sourcepub async fn record_savings(
&self,
tokens_saved: u64,
description: &str,
) -> Result<CreditsResponse>
pub async fn record_savings( &self, tokens_saved: u64, description: &str, ) -> Result<CreditsResponse>
Record token savings for credits
Sourcepub async fn call_tool(&self, name: &str, arguments: Value) -> Result<Value>
pub async fn call_tool(&self, name: &str, arguments: Value) -> Result<Value>
Call a daemon tool
Sourcepub async fn list_tools(&self) -> Result<Vec<Value>>
pub async fn list_tools(&self) -> Result<Vec<Value>>
List available daemon tools
Sourcepub async fn cli_scan(&self, request: CliScanRequest) -> Result<CliScanResponse>
pub async fn cli_scan(&self, request: CliScanRequest) -> Result<CliScanResponse>
Execute a CLI scan via the daemon
This is the main entry point for the thin-client architecture. All scanning and formatting happens in the daemon.
Sourcepub async fn start_daemon(&self) -> Result<bool>
pub async fn start_daemon(&self) -> Result<bool>
Start the daemon in the background
Returns Ok(true) if daemon was started, Ok(false) if already running
Sourcepub async fn stop_daemon(&self) -> Result<bool>
pub async fn stop_daemon(&self) -> Result<bool>
Stop the daemon
Note: This requires the daemon to have a shutdown endpoint or we use a signal
Sourcepub async fn ensure_running(&self) -> Result<DaemonInfo>
pub async fn ensure_running(&self) -> Result<DaemonInfo>
Ensure daemon is running, starting it if necessary
This is the main entry point for daemon-first architecture. Returns the daemon info if running/started successfully.
Trait Implementations§
Source§impl Clone for DaemonClient
impl Clone for DaemonClient
Source§fn clone(&self) -> DaemonClient
fn clone(&self) -> DaemonClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DaemonClient
impl !RefUnwindSafe for DaemonClient
impl Send for DaemonClient
impl Sync for DaemonClient
impl Unpin for DaemonClient
impl UnsafeUnpin for DaemonClient
impl !UnwindSafe for DaemonClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more