Skip to main content

Client

Struct Client 

Source
pub struct Client {
    pub commit_author_name: String,
    pub commit_author_email: String,
    /* private fields */
}

Fields§

§commit_author_name: String§commit_author_email: String

Implementations§

Source§

impl Client

Source

pub fn new( base_dir: Option<impl Into<PathBuf>>, commit_author_name: Option<impl Into<String>>, commit_author_email: Option<impl Into<String>>, ) -> Self

Source

pub fn base_dir(&self) -> &PathBuf

Source

pub fn config_path(&self) -> PathBuf

Source

pub fn db_path(&self) -> PathBuf

Source

pub fn logs_dir(&self) -> PathBuf

Source§

impl Client

Source

pub async fn read_config(&self) -> Result<Config, Error>

Source

pub async fn write_config(&self, config: &Config) -> Result<(), Error>

Source§

impl Client

Source

pub async fn list_agent_completions( &self, offset: usize, limit: usize, ) -> Result<Vec<ListItem>, Error>

Source

pub async fn list_vector_completions( &self, offset: usize, limit: usize, ) -> Result<Vec<ListItem>, Error>

Source

pub async fn list_function_executions( &self, offset: usize, limit: usize, ) -> Result<Vec<ListItem>, Error>

Source

pub async fn list_function_inventions( &self, offset: usize, limit: usize, ) -> Result<Vec<ListItem>, Error>

Source

pub async fn list_function_inventions_recursive( &self, offset: usize, limit: usize, ) -> Result<Vec<ListItem>, Error>

Source

pub async fn list_laboratory_executions( &self, offset: usize, limit: usize, ) -> Result<Vec<ListItem>, Error>

Source

pub async fn clear_agent_completions(&self) -> Result<u64, Error>

Source

pub async fn clear_agent_completion_continuations(&self) -> Result<u64, Error>

Source

pub async fn clear_agent_completion_messages(&self) -> Result<u64, Error>

Source

pub async fn clear_agent_completion_message_logprobs( &self, ) -> Result<u64, Error>

Source

pub async fn clear_agent_completion_message_images(&self) -> Result<u64, Error>

Source

pub async fn clear_agent_completion_message_audio(&self) -> Result<u64, Error>

Source

pub async fn clear_agent_completion_message_video(&self) -> Result<u64, Error>

Source

pub async fn clear_agent_completion_message_files(&self) -> Result<u64, Error>

Source

pub async fn clear_vector_completions(&self) -> Result<u64, Error>

Source

pub async fn clear_function_executions(&self) -> Result<u64, Error>

Source

pub async fn clear_function_execution_retry_tokens(&self) -> Result<u64, Error>

Source

pub async fn clear_function_inventions(&self) -> Result<u64, Error>

Source

pub async fn clear_function_inventions_recursive(&self) -> Result<u64, Error>

Source

pub async fn clear_laboratory_executions(&self) -> Result<u64, Error>

Source

pub fn write_agent_completion(&self) -> LogWriter<AgentCompletionChunk>

Source

pub fn write_vector_completion(&self) -> LogWriter<VectorCompletionChunk>

Source

pub fn write_function_execution(&self) -> LogWriter<FunctionExecutionChunk>

Source

pub fn write_function_invention(&self) -> LogWriter<FunctionInventionChunk>

Source

pub fn write_function_invention_recursive( &self, ) -> LogWriter<FunctionInventionRecursiveChunk>

Source

pub fn write_laboratory_execution(&self) -> LogWriter<LaboratoryExecutionChunk>

Source

pub async fn read_agent_completion( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_agent_completion_continuation( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_agent_completion_message( &self, id: &str, message_index: u64, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_agent_completion_message_logprobs( &self, id: &str, message_index: u64, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_agent_completion_message_image( &self, id: &str, message_index: u64, media_index: u64, ) -> Result<String, Error>

Source

pub async fn read_agent_completion_message_audio( &self, id: &str, message_index: u64, media_index: u64, ) -> Result<String, Error>

Source

pub async fn read_agent_completion_message_video( &self, id: &str, message_index: u64, media_index: u64, ) -> Result<String, Error>

Source

pub async fn read_agent_completion_message_file( &self, id: &str, message_index: u64, media_index: u64, ) -> Result<String, Error>

Source

pub async fn read_vector_completion( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_function_execution( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_function_execution_retry_token( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_function_invention( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_function_invention_recursive( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn read_laboratory_execution( &self, id: &str, jq: Option<&str>, ) -> Result<Value, Error>

Source

pub async fn subscribe_agent_completion( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_agent_completion_continuation( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_agent_completion_message( &self, id: &str, message_index: u64, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_agent_completion_message_logprobs( &self, id: &str, message_index: u64, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_agent_completion_message_image( &self, id: &str, message_index: u64, media_index: u64, timeout: Duration, require_modification: bool, ) -> Option<String>

Source

pub async fn subscribe_agent_completion_message_audio( &self, id: &str, message_index: u64, media_index: u64, timeout: Duration, require_modification: bool, ) -> Option<String>

Source

pub async fn subscribe_agent_completion_message_video( &self, id: &str, message_index: u64, media_index: u64, timeout: Duration, require_modification: bool, ) -> Option<String>

Source

pub async fn subscribe_agent_completion_message_file( &self, id: &str, message_index: u64, media_index: u64, timeout: Duration, require_modification: bool, ) -> Option<String>

Source

pub async fn subscribe_vector_completion( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_function_execution( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_function_execution_retry_token( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_function_invention( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_function_invention_recursive( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source

pub async fn subscribe_laboratory_execution( &self, id: &str, timeout: Duration, require_modification: bool, jq: Option<&str>, ) -> Result<Option<Value>, Error>

Source§

impl Client

Source

pub fn plugins_dir(&self) -> PathBuf

The plugins directory: <base_dir>/plugins.

Source

pub fn plugin_dir(&self, name: &str) -> PathBuf

The directory that holds a plugin’s installed artifacts: <plugins_dir>/<name>/. Contains the binary, an optional viewer/ bundle, and any runtime state the plugin writes.

Source

pub fn plugin_binary_path(&self, name: &str) -> PathBuf

Canonical path of a plugin’s binary: <plugins_dir>/<name>/plugin on Unix, …/plugin.exe on Windows. Used by both install_plugin (write target) and resolve_plugin (read target) so the two cannot drift.

Source

pub async fn resolve_plugin(&self, name: &str) -> Option<PathBuf>

Resolve a plugin name to its executable path. Returns Some(path) when Self::plugin_binary_path exists on disk as a regular file, None otherwise.

Uses tokio::fs::metadata so it doesn’t block the runtime.

Source

pub async fn get_plugin(&self, name: &str) -> Option<ManifestWithNameAndSource>

Look up a single plugin manifest by name. Reads <base_dir>/plugins/<name>.json. If the file persists name and source (as installed plugins do), they’re returned verbatim; otherwise the wrapper is synthesized with name = <name> and source = absolute_path. Returns None if the file is missing, unreadable, or malformed.

Source

pub async fn list_plugins( &self, offset: usize, limit: usize, ) -> Vec<ManifestWithNameAndSource>

Enumerate plugin manifests in the plugins directory. Reads each .json file in <base_dir>/plugins/, deserializes it as a Manifest, and pairs it with the file’s stem (name) and absolute path (source). Every failure mode — missing dir, unreadable file, malformed JSON, missing required field — is silently skipped; the return type is plain Vec rather than Result to reflect that.

Results are sorted by manifest mtime descending (most recently modified first), then skip(offset).take(limit) is applied — matching the convention of the logs list endpoints. Pass (0, usize::MAX) for an unbounded list.

The directory scan is sequential (intrinsic to read_dir) but per-file read+parse runs concurrently via futures::future::join_all.

Source§

impl Client

Source

pub async fn install_plugin( &self, owner: &str, repository: &str, commit_sha: Option<&str>, headers: Option<&IndexMap<String, String>>, upgrade: bool, ) -> Result<bool, Error>

Install a plugin from a GitHub repository.

  1. Fetches objectiveai.json from raw.githubusercontent.com at the supplied commit_sha (or the default branch via HEAD when none).
  2. Parses it as a Manifest.
  3. Looks up the current platform in manifest.binaries. If absent (or this host’s platform isn’t recognized by super::Platform::current), returns Ok(false) — the plugin simply doesn’t support this host.
  4. Downloads the matching release asset from https://github.com/<owner>/<repository>/releases/download/v<version>/<asset>.
  5. Writes it to <base_dir>/plugins/<repository>/plugin (plugin.exe on Windows). Sets mode 0o755 on Unix so the binary is executable.

headers is an optional IndexMap<String, String> that gets attached to both HTTP requests (e.g. Authorization for private repos / higher rate limits). The cli always passes None.

Failures past step 3 are returned as super::InstallError wrapped by super::super::Error::Install.

Source

pub async fn fetch_plugin_manifest( &self, owner: &str, repository: &str, commit_sha: Option<&str>, headers: Option<&IndexMap<String, String>>, ) -> Result<Manifest, Error>

Step 1 of install_plugin: fetch <owner>/<repo>/<ref>/objectiveai.json from raw.githubusercontent.com and parse it as a Manifest. Exposed publicly so callers can inspect the manifest before committing to an install (e.g. for whitelist checks).

Source

pub async fn install_plugin_from_manifest( &self, owner: &str, repository: &str, manifest: &Manifest, source: &str, headers: Option<&IndexMap<String, String>>, upgrade: bool, ) -> Result<bool, Error>

Step 2 of install_plugin: given an already-parsed manifest, pick the binary for the current platform (Ok(false) if absent), download it from the corresponding release asset, and write it to <plugins_dir>/<repository>/plugin[.exe].

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

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 Client

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

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

Source§

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

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> ToAst for T

Source§

fn ast(self, begin: usize, end: usize) -> Spanned<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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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