use std::sync::Arc;
use async_trait::async_trait;
use everruns_provider::error::Result;
use everruns_provider::typed_id::OrgId;
use crate::vector_store::{KnowledgeIndexCitation, KnowledgeIndexSearch};
#[derive(Debug, Clone, serde::Serialize)]
pub struct KnowledgeSearchHit {
pub id: String,
pub kb_id: String,
pub title: String,
pub kind: String,
pub tags: Vec<String>,
pub snippet: String,
pub resource: Option<String>,
}
#[async_trait]
pub trait KnowledgeStore: Send + Sync {
async fn search_knowledge(
&self,
org_id: OrgId,
kb_public_ids: &[String],
query: &str,
kind: Option<&str>,
tags: &[String],
limit: usize,
) -> Result<Vec<KnowledgeSearchHit>>;
}
#[derive(Clone)]
pub struct KnowledgeStoreExt(pub Arc<dyn KnowledgeStore>);
#[derive(Clone)]
pub struct KnowledgeIndexSearchExt(pub Arc<dyn KnowledgeIndexSearch>);
pub type KnowledgeIndexSearchHit = KnowledgeIndexCitation;