Skip to main content

AgentHome

Struct AgentHome 

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

One session’s agent home.

explicit = Some(path) is the library-embedding mode: every reader and writer is addressed through this value, so several harnesses can live in one process with different homes. CLI sessions use AgentHome::process, which preserves the historical RPI_CODING_AGENT_DIR / ~/.rpi/agent behavior.

Implementations§

Source§

impl AgentHome

Source

pub fn process() -> Self

The historical process home (RPI_CODING_AGENT_DIR / ~/.rpi/agent).

Source

pub fn from_option(explicit: Option<PathBuf>) -> Self

Source

pub fn explicit_path(&self) -> Option<&Path>

Source

pub fn is_explicit(&self) -> bool

Source

pub fn root(&self) -> Result<PathBuf, ConfigError>

Source

pub fn auth_path(&self) -> Result<PathBuf, ConfigError>

Source

pub fn models_path(&self) -> Result<PathBuf, ConfigError>

Source

pub fn settings_path(&self) -> Result<PathBuf, ConfigError>

Source

pub fn trust_path(&self) -> Result<PathBuf, ConfigError>

Source

pub fn read_auth(&self) -> Result<AuthStore, ConfigError>

Source

pub fn write_auth(&self, store: &AuthStore) -> Result<(), ConfigError>

Source

pub fn upsert_credential( &self, provider_id: &str, cred: Credential, ) -> Result<(), ConfigError>

Source

pub fn upsert_oauth_token( &self, provider_id: &str, access: String, refresh: String, expires: i64, ) -> Result<(), ConfigError>

Source

pub fn replace_oauth_token_if_unchanged( &self, provider_id: &str, expected: (&str, &str, i64), access: String, refresh: String, expires: i64, ) -> Result<bool, ConfigError>

Source

pub fn read_oauth_token( &self, provider_id: &str, ) -> Result<Option<Credential>, ConfigError>

Source

pub fn delete_credential(&self, provider_id: &str) -> Result<bool, ConfigError>

Source

pub fn models_config(&self) -> Result<ModelsConfig, ConfigError>

Source

pub fn save_models_config(&self, cfg: &ModelsConfig) -> Result<(), ConfigError>

Source

pub fn add_provider( &self, provider_id: &str, api: &str, base_url: &str, api_key: &str, model_id: &str, model_name: Option<&str>, context_window: Option<u64>, max_tokens: Option<u64>, supports_images: Option<bool>, ) -> Result<(), String>

Source

pub fn update_provider( &self, provider_id: &str, api: &str, base_url: &str, api_key: Option<&str>, model_id: &str, model_name: Option<&str>, context_window: Option<u64>, max_tokens: Option<u64>, supports_images: bool, ) -> Result<(), String>

Source

pub fn delete_provider(&self, provider_id: &str) -> Result<(), String>

Source

pub fn read_trust(&self) -> Result<TrustStore, ConfigError>

Source

pub fn project_trust_decision( &self, cwd: &Path, ) -> Result<Option<bool>, ConfigError>

Source

pub fn set_project_trust( &self, cwd: &Path, trusted: Option<bool>, ) -> Result<(), ConfigError>

Source§

impl AgentHome

Source

pub fn global_dir(&self, sub: &str) -> Option<PathBuf>

Global resource subdir <home>/<sub> (e.g. <home>/skills).

Source

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

Global config file under <home>/<name> (<home>/SYSTEM.md).

Source

pub fn discover_system_prompt_file( &self, cwd: &Path, project_trusted: bool, ) -> Option<PathBuf>

Source

pub fn discover_append_system_prompt_file(&self, cwd: &Path) -> Option<PathBuf>

Source

pub fn skill_dirs(&self, cwd: &Path) -> Vec<PathBuf>

Ordered skill dirs for a project: project paths, then this home’s configured + conventional global paths.

Source

pub fn global_skill_dirs(&self) -> Vec<PathBuf>

Source

pub fn prompt_template_dirs(&self, cwd: &Path) -> Vec<PathBuf>

Source

pub fn global_prompt_template_dirs(&self) -> Vec<PathBuf>

Source

pub fn extension_dirs(&self, cwd: &Path) -> Vec<PathBuf>

Source

pub fn global_extension_dirs(&self) -> Vec<PathBuf>

Source§

impl AgentHome

Source

pub fn settings(&self) -> Result<Settings, ConfigError>

Load this home’s settings.json (missing file = defaults).

Source

pub fn effective_model_settings( &self, cwd: &Path, project_trusted: bool, ) -> Result<Settings, ConfigError>

Global -> trusted-project model-selection settings for this home.

Source

pub fn save_settings(&self, settings: &Settings) -> Result<(), String>

Persist this home’s settings.json, preserving unknown fields.

Trait Implementations§

Source§

impl Clone for AgentHome

Source§

fn clone(&self) -> Self

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 AgentHome

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for AgentHome

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for AgentHome

Source§

impl PartialEq for AgentHome

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AgentHome

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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: 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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 = !

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

fn try_from(value: U) -> Result<T, !>

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