use crate::types::ConnectorKind; use uuid::Uuid; /// Result of registering a connector with external services. #[derive(Debug, Default)] pub struct ConnectorRegistration { /// An external UID assigned by a service (e.g., inspector or archivist). pub external_uid: Option, } /// Lifecycle hooks invoked by the core runtime when connectors are created or removed. /// /// Implementations wire up external services (archivist, inspector, etc.) /// without the core needing to know about them directly. #[async_trait::async_trait] pub trait ConnectorLifecycleHooks: Send + Sync { async fn on_connector_created( &self, connector_id: &str, kind: ConnectorKind, title: &str, owner: &str, params: &serde_json::Value, ) -> ConnectorRegistration; async fn on_connector_removed(&self, _connector_id: &str) {} #[cfg(feature = "server")] fn inspector(&self) -> Option> { None } #[cfg(feature = "server")] fn process_manager( &self, ) -> Option> { None } } /// No-op implementation for environments that don't need lifecycle hooks. pub struct NoOpHooks; #[async_trait::async_trait] impl ConnectorLifecycleHooks for NoOpHooks { async fn on_connector_created( &self, _connector_id: &str, _kind: ConnectorKind, _title: &str, _owner: &str, _params: &serde_json::Value, ) -> ConnectorRegistration { ConnectorRegistration::default() } }