mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
feat: drop CodexExtension (#22140)
Drop `CodexExtension` as not needed for now
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::ApprovalInterceptorContributor;
|
||||
use crate::CodexExtension;
|
||||
use crate::ContextContributor;
|
||||
use crate::ThreadStartContributor;
|
||||
use crate::ToolContributor;
|
||||
use crate::TurnItemContributor;
|
||||
|
||||
/// Mutable registry used while extensions install their typed contributions.
|
||||
/// Mutable registry used while hosts register typed runtime contributions.
|
||||
pub struct ExtensionRegistryBuilder<C> {
|
||||
thread_start_contributors: Vec<Arc<dyn ThreadStartContributor<C>>>,
|
||||
context_contributors: Vec<Arc<dyn ContextContributor>>,
|
||||
@@ -34,24 +33,6 @@ impl<C> ExtensionRegistryBuilder<C> {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Installs one extension and returns the builder.
|
||||
#[must_use]
|
||||
pub fn with_extension<E>(mut self, extension: Arc<E>) -> Self
|
||||
where
|
||||
E: CodexExtension<C> + 'static,
|
||||
{
|
||||
self.install_extension(extension);
|
||||
self
|
||||
}
|
||||
|
||||
/// Installs one extension into the registry under construction.
|
||||
pub fn install_extension<E>(&mut self, extension: Arc<E>)
|
||||
where
|
||||
E: CodexExtension<C> + 'static,
|
||||
{
|
||||
extension.install(self);
|
||||
}
|
||||
|
||||
/// Registers one approval interceptor contributor.
|
||||
pub fn approval_interceptor_contributor(
|
||||
&mut self,
|
||||
@@ -128,7 +109,7 @@ impl<C> ExtensionRegistry<C> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates an empty shared registry for hosts that do not install extensions.
|
||||
/// Creates an empty shared registry for hosts that do not register contributions.
|
||||
pub fn empty_extension_registry<C>() -> Arc<ExtensionRegistry<C>> {
|
||||
Arc::new(ExtensionRegistryBuilder::new().build())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user