pub mod attention;
pub mod classify;
pub mod collector;
pub mod panes;
pub mod proc;
pub mod session_meta;
pub mod state;
pub mod ui;
use std::path::PathBuf;
use std::time::SystemTime;
#[derive(Debug, Clone)]
pub struct Agent {
pub id: String,
pub pane: Option<PaneLocator>,
pub kind: AgentKind,
pub status: Status,
pub cwd: PathBuf,
pub repo_name: String,
pub flags: Flags,
pub extra: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PaneLocator {
pub session: String,
pub window: u32,
pub pane: u32,
pub pane_pid: u32,
}
impl PaneLocator {
pub fn target(&self) -> String {
format!("{}:{}.{}", self.session, self.window, self.pane)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AgentKind {
Claude,
Codex,
Shell,
Other,
}
impl AgentKind {
pub fn from_command(cmd: &str) -> Self {
match cmd {
"claude" => Self::Claude,
"codex" => Self::Codex,
"zsh" | "bash" | "fish" | "sh" => Self::Shell,
_ => Self::Other,
}
}
pub fn label(self) -> &'static str {
match self {
Self::Claude => "claude",
Self::Codex => "codex",
Self::Shell => "shell",
Self::Other => "other",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Status {
Working,
Ready,
AwaitingDecision,
Idle,
Background,
}
impl Status {
pub fn glyph(self) -> &'static str {
match self {
Self::Working => "●",
Self::Ready => "◐",
Self::AwaitingDecision => "⚠",
Self::Idle => "○",
Self::Background => "▷",
}
}
pub fn label(self) -> &'static str {
match self {
Self::Working => "working",
Self::Ready => "ready",
Self::AwaitingDecision => "decision",
Self::Idle => "idle",
Self::Background => "bg",
}
}
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Flags {
pub has_intent: bool,
pub blocked: bool,
pub reviewed_fresh: bool,
}
#[derive(Debug, Clone)]
pub struct Snapshot {
pub agents: Vec<Agent>,
pub captured_at: SystemTime,
pub global_blocked: usize,
pub panes_error: Option<String>,
pub attention: Vec<attention::AttentionEntry>,
}
impl Snapshot {
pub fn empty() -> Self {
Self {
agents: Vec::new(),
captured_at: SystemTime::now(),
global_blocked: 0,
panes_error: None,
attention: Vec::new(),
}
}
}
pub fn run() -> anyhow::Result<()> {
ui::run()
}