pub struct ProviderRegistry { /* private fields */ }Expand description
Thread-safe registry of loaded providers backing every Soma surface, holding the active snapshot and supporting hot-reload from a file source.
Implementations§
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub fn python_generation_status(&self) -> Value
pub fn python_generation_status(&self) -> Value
Returns the active generation and bounded rollback history.
Sourcepub async fn rollback_python_generation(
&self,
target_generation_id: u64,
) -> Result<Value, ProviderError>
pub async fn rollback_python_generation( &self, target_generation_id: u64, ) -> Result<Value, ProviderError>
Atomically reactivates a retained immutable provider generation.
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub fn resolve_python_provider_path(
&self,
provider_path: &Path,
) -> Result<PathBuf, ProviderValidationError>
pub fn resolve_python_provider_path( &self, provider_path: &Path, ) -> Result<PathBuf, ProviderValidationError>
Resolves one exact managed Python provider path without importing it.
Applies active-registry policy without invoking a provider.
Sourcepub fn python_worker_status(&self) -> Value
pub fn python_worker_status(&self) -> Value
Inventories persistent worker state and bounded redacted logs.
Sourcepub fn cancel_python_worker(
&self,
provider_name: &str,
) -> Result<bool, ProviderError>
pub fn cancel_python_worker( &self, provider_name: &str, ) -> Result<bool, ProviderError>
Cancels the active invocation for one persistent Python provider.
Sourcepub async fn reset_python_worker_quarantine(
&self,
provider_name: &str,
) -> Result<(), ProviderError>
pub async fn reset_python_worker_quarantine( &self, provider_name: &str, ) -> Result<(), ProviderError>
Clears one persistent worker’s crash-loop quarantine.
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub async fn read_resource(
&self,
uri: &str,
principal: &ProviderPrincipal,
auth_mode: ProviderAuthMode,
) -> Result<ResourceReadOutput, ProviderError>
pub async fn read_resource( &self, uri: &str, principal: &ProviderPrincipal, auth_mode: ProviderAuthMode, ) -> Result<ResourceReadOutput, ProviderError>
Matches uri against the active snapshot’s exact resources and
dynamic resource templates (in that precedence order), enforces
resource.scope under ProviderAuthMode::Mounted the same way
dispatch() enforces tool.scope, then delegates to the owning
provider’s read_resource.
The match and the provider clone are fetched from the same read
lock acquisition, mirroring dispatch()’s pattern for tools — a
concurrent refresh_file_providers() between two separate lock
acquisitions could otherwise return params/scope from one snapshot
but a provider instance from a newer one (e.g. a hot-swapped
resources/foo.md -> resources/foo.ts letting a request matched
against the old unscoped static resource invoke the new
soma:write-scoped dynamic reader without ever being checked
against its scope).
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub fn file_provider_root(&self) -> Option<&Path>
pub fn file_provider_root(&self) -> Option<&Path>
Returns the configured dynamic-provider root, when file providers are enabled.
Sourcepub fn new(
providers: Vec<Arc<dyn Provider>>,
) -> Result<Self, ProviderValidationError>
pub fn new( providers: Vec<Arc<dyn Provider>>, ) -> Result<Self, ProviderValidationError>
Builds a registry from the given providers with a default-deny capability broker.
Sourcepub fn with_capabilities(
providers: Vec<Arc<dyn Provider>>,
capabilities: CapabilityBroker,
) -> Result<Self, ProviderValidationError>
pub fn with_capabilities( providers: Vec<Arc<dyn Provider>>, capabilities: CapabilityBroker, ) -> Result<Self, ProviderValidationError>
Builds a registry from the given providers and capability broker.
Sourcepub fn with_file_source(
providers: Vec<Arc<dyn Provider>>,
capabilities: CapabilityBroker,
file_source: FileProviderSource,
) -> Result<Self, ProviderValidationError>
pub fn with_file_source( providers: Vec<Arc<dyn Provider>>, capabilities: CapabilityBroker, file_source: FileProviderSource, ) -> Result<Self, ProviderValidationError>
Builds a registry from the given base providers plus dynamic providers loaded from a file source, enabling later hot-reloads.
Sourcepub async fn with_file_source_async(
providers: Vec<Arc<dyn Provider>>,
capabilities: CapabilityBroker,
file_source: FileProviderSource,
) -> Result<Self, ProviderValidationError>
pub async fn with_file_source_async( providers: Vec<Arc<dyn Provider>>, capabilities: CapabilityBroker, file_source: FileProviderSource, ) -> Result<Self, ProviderValidationError>
Async constructor that preflights persistent Python workers before the first registry snapshot becomes visible.
Sourcepub fn snapshot(&self) -> Arc<RegistrySnapshot>
pub fn snapshot(&self) -> Arc<RegistrySnapshot>
Returns the currently active registry snapshot.
Sourcepub fn refresh_file_providers(
&self,
) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
pub fn refresh_file_providers( &self, ) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
Refreshes providers from the file source, if any. Per the drop-in
provider layout contract (“If a resource disappears or becomes
invalid, a reload must leave the last valid snapshot active until a
valid replacement snapshot is available”), a failure anywhere in this
pipeline (an unreadable directory, a newly-invalid or colliding
provider file) is logged and this returns the previous snapshot
rather than propagating the error — one bad drop-in file must not
take down list_tools/list_prompts/read_resource/etc. for every
other, unrelated, already-loaded provider.
Sourcepub async fn refresh_file_providers_async(
&self,
) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
pub async fn refresh_file_providers_async( &self, ) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
Refresh variant that preflights persistent Python candidates outside the registry write lock before publishing the candidate snapshot.
Sourcepub async fn activate_python_candidate(
&self,
provider_path: &Path,
candidate: PreparedPythonEnvironment,
) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
pub async fn activate_python_candidate( &self, provider_path: &Path, candidate: PreparedPythonEnvironment, ) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
Validates and atomically activates one immutable Python environment candidate.
Sourcepub fn validate_reload(
&self,
providers: Vec<Arc<dyn Provider>>,
) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
pub fn validate_reload( &self, providers: Vec<Arc<dyn Provider>>, ) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
Builds and validates a snapshot from the given providers without installing it, for pre-flight checking a candidate reload.
Sourcepub fn reload(
&self,
providers: Vec<Arc<dyn Provider>>,
) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
pub fn reload( &self, providers: Vec<Arc<dyn Provider>>, ) -> Result<Arc<RegistrySnapshot>, ProviderValidationError>
Atomically replaces the loaded providers and active snapshot, clearing any file fingerprint.
Sourcepub async fn dispatch(
&self,
call: ProviderCall,
) -> Result<ProviderOutput, ProviderError>
pub async fn dispatch( &self, call: ProviderCall, ) -> Result<ProviderOutput, ProviderError>
Routes a provider call to its owning provider, enforcing pre-input
checks, declared capabilities, and the response size limit around the
provider’s own call.
Trait Implementations§
Source§impl Clone for ProviderRegistry
impl Clone for ProviderRegistry
Source§fn clone(&self) -> ProviderRegistry
fn clone(&self) -> ProviderRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ProviderRegistry
impl !RefUnwindSafe for ProviderRegistry
impl Send for ProviderRegistry
impl Sync for ProviderRegistry
impl Unpin for ProviderRegistry
impl UnsafeUnpin for ProviderRegistry
impl !UnwindSafe for ProviderRegistry
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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