mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
- PTY output capture via tokio::process with stdout/stderr piping - Ring buffer (1000 lines) per session - Output pane wired to show selected session with auto-scroll - Broadcast channel for output events
62 lines
1.5 KiB
Rust
62 lines
1.5 KiB
Rust
pub mod daemon;
|
|
pub mod manager;
|
|
pub mod output;
|
|
pub mod runtime;
|
|
pub mod store;
|
|
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use std::fmt;
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Session {
|
|
pub id: String,
|
|
pub task: String,
|
|
pub agent_type: String,
|
|
pub state: SessionState,
|
|
pub worktree: Option<WorktreeInfo>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
pub metrics: SessionMetrics,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
pub enum SessionState {
|
|
Pending,
|
|
Running,
|
|
Idle,
|
|
Completed,
|
|
Failed,
|
|
Stopped,
|
|
}
|
|
|
|
impl fmt::Display for SessionState {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
SessionState::Pending => write!(f, "pending"),
|
|
SessionState::Running => write!(f, "running"),
|
|
SessionState::Idle => write!(f, "idle"),
|
|
SessionState::Completed => write!(f, "completed"),
|
|
SessionState::Failed => write!(f, "failed"),
|
|
SessionState::Stopped => write!(f, "stopped"),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct WorktreeInfo {
|
|
pub path: PathBuf,
|
|
pub branch: String,
|
|
pub base_branch: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
|
pub struct SessionMetrics {
|
|
pub tokens_used: u64,
|
|
pub tool_calls: u64,
|
|
pub files_changed: u32,
|
|
pub duration_secs: u64,
|
|
pub cost_usd: f64,
|
|
}
|