1use otherone_storage::types::{DatabaseConfig, RuntimeContext};
2use serde::{Deserialize, Serialize};
3use tokio::sync::mpsc;
4
5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6#[serde(rename_all = "lowercase")]
7pub enum ContextLoadType {
8 Database,
9 LocalFile,
10}
11
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13#[serde(rename_all = "lowercase")]
14pub enum StorageType {
15 LocalFile,
16 Database,
17}
18
19#[derive(Debug, Clone)]
20pub struct InputOptions {
21 pub session_id: String,
22 pub context_load_type: ContextLoadType,
23 pub storage_type: Option<StorageType>,
24 pub database_config: Option<DatabaseConfig>,
25 pub runtime_context: Option<RuntimeContext>,
26 pub context_window: u32,
27 pub threshold_percentage: Option<f32>,
28 pub max_iterations: Option<u32>,
29 pub enable_long_term_memory: Option<bool>,
30 pub long_term_memory_recall_max_types: Option<usize>,
31}
32
33pub struct AiOptions {
34 pub provider: otherone_ai::types::ProviderType,
35 pub api_key: String,
36 pub base_url: String,
37 pub model: String,
38 pub user_prompt: Option<String>,
39 pub system_prompt: Option<String>,
40 pub messages: Option<Vec<otherone_ai::types::Message>>,
41 pub context_length: Option<u32>,
42 pub temperature: Option<f32>,
43 pub top_p: Option<f32>,
44 pub tools: Option<Vec<otherone_ai::types::Tool>>,
45 pub tools_realize: Option<
46 std::collections::HashMap<String, Box<dyn Fn(serde_json::Value) -> String + Send + Sync>>,
47 >,
48 pub tool_choice: Option<otherone_ai::types::ToolChoice>,
49 pub parallel_tool_calls: Option<bool>,
50 pub stream: Option<bool>,
51 pub other: Option<serde_json::Value>,
52}
53
54#[derive(Debug, Clone)]
55pub struct StreamAgentEvent {
56 pub event_type: String,
57 pub content: String,
58 pub raw_chunk: Option<serde_json::Value>,
59 pub error: Option<String>,
60}
61
62#[derive(Debug, Clone)]
63pub enum AgentStreamCommand {
64 EnqueueUserPrompts(Vec<String>),
65}
66
67pub struct AgentStreamHandle {
68 pub events: mpsc::Receiver<StreamAgentEvent>,
69 pub commands: mpsc::Sender<AgentStreamCommand>,
70}