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
impl AgentHome
Sourcepub fn from_option(explicit: Option<PathBuf>) -> Result<Self, ConfigError>
pub fn from_option(explicit: Option<PathBuf>) -> Result<Self, ConfigError>
Build an agent home from an optional explicit path.
Some(path) is validated eagerly: the path must be absolute. Returning
an error here (instead of lazily on first use) keeps every later reader
infallible with respect to home shape and prevents a partially applied
home in embedders that tolerate per-call errors.
pub fn explicit_path(&self) -> Option<&Path>
pub fn is_explicit(&self) -> bool
pub fn root(&self) -> Result<PathBuf, ConfigError>
pub fn auth_path(&self) -> Result<PathBuf, ConfigError>
pub fn models_path(&self) -> Result<PathBuf, ConfigError>
pub fn settings_path(&self) -> Result<PathBuf, ConfigError>
pub fn trust_path(&self) -> Result<PathBuf, ConfigError>
pub fn read_auth(&self) -> Result<AuthStore, ConfigError>
pub fn write_auth(&self, store: &AuthStore) -> Result<(), ConfigError>
pub fn upsert_credential( &self, provider_id: &str, cred: Credential, ) -> Result<(), ConfigError>
pub fn upsert_oauth_token( &self, provider_id: &str, access: String, refresh: String, expires: i64, ) -> Result<(), ConfigError>
pub fn replace_oauth_token_if_unchanged( &self, provider_id: &str, expected: (&str, &str, i64), access: String, refresh: String, expires: i64, ) -> Result<bool, ConfigError>
pub fn read_oauth_token( &self, provider_id: &str, ) -> Result<Option<Credential>, ConfigError>
pub fn delete_credential(&self, provider_id: &str) -> Result<bool, ConfigError>
pub fn models_config(&self) -> Result<ModelsConfig, ConfigError>
pub fn save_models_config(&self, cfg: &ModelsConfig) -> Result<(), ConfigError>
pub fn add_provider( &self, provider_id: &str, api: &str, base_url: &str, api_key: &str, model: ProviderModelConfig<'_>, supports_images: Option<bool>, ) -> Result<(), String>
pub fn update_provider( &self, provider_id: &str, api: &str, base_url: &str, api_key: Option<&str>, model: ProviderModelConfig<'_>, supports_images: bool, ) -> Result<(), String>
pub fn delete_provider(&self, provider_id: &str) -> Result<(), String>
pub fn read_trust(&self) -> Result<TrustStore, ConfigError>
pub fn project_trust_decision( &self, cwd: &Path, ) -> Result<Option<bool>, ConfigError>
pub fn set_project_trust( &self, cwd: &Path, trusted: Option<bool>, ) -> Result<(), ConfigError>
Source§impl AgentHome
impl AgentHome
Sourcepub fn global_dir(&self, sub: &str) -> Option<PathBuf>
pub fn global_dir(&self, sub: &str) -> Option<PathBuf>
Global resource subdir <home>/<sub> (e.g. <home>/skills).
Sourcepub fn global_config_file(&self, name: &str) -> Option<PathBuf>
pub fn global_config_file(&self, name: &str) -> Option<PathBuf>
Global config file under <home>/<name> (<home>/SYSTEM.md).
pub fn discover_system_prompt_file( &self, cwd: &Path, project_trusted: bool, ) -> Option<PathBuf>
pub fn discover_append_system_prompt_file(&self, cwd: &Path) -> Option<PathBuf>
Sourcepub fn skill_dirs(&self, cwd: &Path) -> Vec<PathBuf>
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.
pub fn global_skill_dirs(&self) -> Vec<PathBuf>
pub fn prompt_template_dirs(&self, cwd: &Path) -> Vec<PathBuf>
pub fn global_prompt_template_dirs(&self) -> Vec<PathBuf>
pub fn extension_dirs(&self, cwd: &Path) -> Vec<PathBuf>
pub fn global_extension_dirs(&self) -> Vec<PathBuf>
Source§impl AgentHome
impl AgentHome
Sourcepub fn settings(&self) -> Result<Settings, ConfigError>
pub fn settings(&self) -> Result<Settings, ConfigError>
Load this home’s settings.json (missing file = defaults).
Sourcepub fn effective_model_settings(
&self,
cwd: &Path,
project_trusted: bool,
) -> Result<Settings, ConfigError>
pub fn effective_model_settings( &self, cwd: &Path, project_trusted: bool, ) -> Result<Settings, ConfigError>
Global -> trusted-project model-selection settings for this home.
Trait Implementations§
impl Eq for AgentHome
impl StructuralPartialEq for AgentHome
Auto Trait Implementations§
impl Forget for AgentHome
impl Freeze for AgentHome
impl Move for AgentHome
impl RefUnwindSafe for AgentHome
impl Send for AgentHomewhere
RawVecInner: Send,
impl Sync for AgentHomewhere
RawVecInner: Sync,
impl Unpin for AgentHome
impl UnsafeUnpin for AgentHome
impl UnwindSafe for AgentHomewhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
impl<T> MaybeSendSync for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().