use serde::{Deserialize, Serialize};
use trusty_mpm_core::circuit::CircuitBreaker;
use trusty_mpm_core::claude_config::{ClaudeConfig, ConfigRecommendation, DeploymentProfile};
use trusty_mpm_core::external_session::ExternalSession;
use trusty_mpm_core::hook::{HookEvent, HookEventRecord};
use trusty_mpm_core::session::Session;
use crate::optimizer::OptimizerConfig;
use crate::tmux::{AdoptedSession, SessionSnapshot};
#[derive(Debug, Serialize, Deserialize)]
pub struct SessionsResponse {
pub sessions: Vec<Session>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct EventsResponse {
pub events: Vec<HookEventRecord>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RegisterSessionResponse {
pub id: trusty_mpm_core::session::SessionId,
pub name: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RemoveSessionResponse {
pub removed: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ReapResponse {
pub removed: usize,
#[serde(default)]
pub stopped: usize,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct SetPidResponse {
pub session_id: String,
pub pid: u32,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DiscoverResponse {
pub discovered: usize,
pub sessions: Vec<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PairResetResponse {
pub reset: bool,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PauseResponse {
pub paused: bool,
pub session_id: String,
pub summary: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ResumeResponse {
pub resumed: bool,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CommandResponse {
pub sent: bool,
pub output: String,
pub original_bytes: usize,
pub compressed_bytes: usize,
pub compress_level: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct OutputResponse {
pub output: String,
pub lines: u32,
pub original_bytes: usize,
pub compressed_bytes: usize,
pub compress_level: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ProjectsResponse {
pub projects: Vec<trusty_mpm_core::project::ProjectInfo>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DiscoveredProjectInfo {
pub path: String,
pub session_count: usize,
pub last_session: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DiscoverProjectsResponse {
pub projects: Vec<DiscoveredProjectInfo>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct BreakerEntry {
pub agent: String,
pub breaker: CircuitBreaker,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct BreakersResponse {
pub breakers: Vec<BreakerEntry>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct HookAcceptedResponse {
pub accepted: HookEvent,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct OverseerStatus {
pub enabled: bool,
pub handler: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct OverseerResponse {
pub overseer: OverseerStatus,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct OptimizerResponse {
pub optimizer: OptimizerConfig,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TmuxSessionsResponse {
pub sessions: Vec<ExternalSession>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TmuxSnapshotResponse {
pub snapshot: SessionSnapshot,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AdoptResponse {
pub adopted: AdoptedSession,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ClaudeConfigResponse {
pub config: ClaudeConfig,
pub recommendations: Vec<ConfigRecommendation>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ApplyConfigResponse {
pub applied: bool,
pub recommendation_id: String,
pub checkpoint_id: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CheckpointsResponse {
pub checkpoints: Vec<trusty_mpm_core::claude_config::ConfigCheckpoint>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CreateCheckpointResponse {
pub id: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RestoreResponse {
pub restored: bool,
pub checkpoint_id: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DeleteCheckpointResponse {
pub deleted: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ProfilesResponse {
pub profiles: Vec<DeploymentProfile>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DeployProfileResponse {
pub deployed: String,
pub checkpoint_id: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RestartResponse {
pub restarted: String,
}
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
pub struct LlmChatRequest {
pub message: String,
#[serde(default)]
#[schema(value_type = Vec<Object>)]
pub history: Vec<crate::llm_overseer::ChatMessage>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct LlmChatResponse {
pub reply: String,
pub history: Vec<crate::llm_overseer::ChatMessage>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PairConfirmResponse {
pub success: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_id: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}