pub struct SchemaRegistry { /* private fields */ }Expand description
Central registry of all known AI chat provider schemas.
ⓘ
let registry = SchemaRegistry::new();
// List all schemas
for schema in registry.list_schemas() {
println!("{}: {} fields", schema.id(), schema.field_count());
}
// Detect schema for a workspace
let detected = registry.detect_schema("/path/to/session.jsonl")?;Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
Sourcepub fn list_schemas(&self) -> Vec<&ProviderSchema>
pub fn list_schemas(&self) -> Vec<&ProviderSchema>
List all registered schemas.
Sourcepub fn get_schema(&self, id: &str) -> Option<&ProviderSchema>
pub fn get_schema(&self, id: &str) -> Option<&ProviderSchema>
Get a schema by its version ID.
Sourcepub fn schemas_for_provider(&self, provider: &str) -> Vec<&ProviderSchema>
pub fn schemas_for_provider(&self, provider: &str) -> Vec<&ProviderSchema>
Get all schemas for a specific provider.
Sourcepub fn register_schema(&mut self, schema: ProviderSchema)
pub fn register_schema(&mut self, schema: ProviderSchema)
Register a custom schema (for plugins / new providers).
Sourcepub fn detect_schema_from_file(&self, path: &Path) -> Result<DetectedSchema>
pub fn detect_schema_from_file(&self, path: &Path) -> Result<DetectedSchema>
Detect which schema a session file uses based on its contents.
Sourcepub fn detect_schema_from_workspace(
&self,
workspace_dir: &Path,
) -> Result<DetectedSchema>
pub fn detect_schema_from_workspace( &self, workspace_dir: &Path, ) -> Result<DetectedSchema>
Detect schema from a VS Code workspace storage directory.
Sourcepub fn to_json(&self) -> Result<String>
pub fn to_json(&self) -> Result<String>
Export the full registry as JSON (for AI agent consumption).
Sourcepub fn to_json_compact(&self) -> Result<String>
pub fn to_json_compact(&self) -> Result<String>
Export the registry as a compact JSON for embedding in documents.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin for SchemaRegistry
impl UnsafeUnpin for SchemaRegistry
impl UnwindSafe for SchemaRegistry
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
Mutably borrows from an owned value. Read more
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>
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 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>
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