sync from monorepo @ ffee08f2

This commit is contained in:
2026-05-09 19:52:44 +02:00
parent e20542a40e
commit bf5a79d931
177 changed files with 242 additions and 37736 deletions
+56
View File
@@ -0,0 +1,56 @@
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<Uuid>,
}
/// 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<std::sync::Arc<dirigent_inspector::InspectorRegistry>> {
None
}
#[cfg(feature = "server")]
fn process_manager(
&self,
) -> Option<std::sync::Arc<dyn dirigent_process::ProcessGroupManager>> {
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()
}
}