- Plugin HTTP routes + web pages (plugin-page-host, plugin-catalog, plugin-detail) - Plugin access grants + per-user config (DB tables + API + frontend forms) - Capabilities-based guard (caps.rs) replacing role-id checks - Mobile connector: message routing, payload types, router refactor - Telegram bot: auth flow, event handling improvements - Honcho plugin: substantial rework - Sidebar: plugin pages integration, role-driven visibility - i18n: new strings for plugins, connectors, capabilities - Remove unused mascot asset
34 lines
1.3 KiB
Rust
34 lines
1.3 KiB
Rust
use std::sync::Arc;
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use crate::tool::Tool;
|
|
|
|
/// Pluggable long-term memory backend.
|
|
///
|
|
/// Implementations are registered with `MemoryManager` in the main crate.
|
|
/// At most one backend is active at a time (singleton rule enforced by the manager).
|
|
#[async_trait]
|
|
pub trait Memory: Send + Sync {
|
|
/// Unique identifier for this backend (e.g. `"honcho"`).
|
|
fn id(&self) -> &str;
|
|
|
|
/// Returns `true` when the backend is reachable and ready.
|
|
fn is_available(&self) -> bool;
|
|
|
|
/// Retrieves context for the upcoming turn to inject into the system prompt.
|
|
/// Returns `None` on cold start, backend down, or nothing useful available.
|
|
///
|
|
/// `user_id` is the session owner: multi-user backends scope retrieval to that
|
|
/// user's own memory (e.g. their Honcho peer), and `session_id` is local to
|
|
/// that user's pool so it must be namespaced by `user_id` to stay unique.
|
|
async fn query_context(&self, user_id: &str, session_id: i64, user_message: &str) -> Option<String>;
|
|
|
|
/// Optional LLM-callable tools exposed by this backend (e.g. `memory_query`).
|
|
/// Called per turn — added to the live tool list and dispatched before the
|
|
/// global tool registry.
|
|
fn tools(&self) -> Vec<Arc<dyn Tool>> {
|
|
vec![]
|
|
}
|
|
}
|