corty_core/
protocol.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Deserialize, Serialize)]
4pub struct Submission {
5    /// Unique id for this Submission to correlate with Events
6    pub id: String,
7    /// Payload
8    pub op: Op,
9}
10
11/// Submission operation
12#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
13#[serde(tag = "type", rename_all = "snake_case")]
14#[allow(clippy::large_enum_variant)]
15#[non_exhaustive]
16pub enum Op {
17    /// Configure the model session.
18    ConfigureSession {
19        /// Provider identifier ("openai", "openrouter", ...).
20        provider: (),
21
22        /// If not specified, server will use its default model.
23        model: String,
24
25        cwd: std::path::PathBuf,
26    },
27
28    Interrupt,
29
30    /// Input from the user
31    UserInput {
32        /// User input items, see `InputItem`
33        items: Vec<InputItem>,
34    },
35
36    AddToHistory {
37        /// The message text to be stored.
38        text: String,
39    },
40}
41
42/// User input
43#[non_exhaustive]
44#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
45#[serde(tag = "type", rename_all = "snake_case")]
46pub enum InputItem {
47    Text { text: String },
48}