//! Core types for the PTY runner: result container and process lifecycle helpers.
use crate::agents::TokenUsage;

/// Result from a PTY agent session, containing the session ID and token usage.
pub(in crate::agents) struct PtyResult {
    pub session_id: Option<String>,
    pub token_usage: Option<TokenUsage>,
    /// `true` if the child process exited with a zero exit code (normal completion).
    /// `false` if the process was killed by a signal or exited with a non-zero code.
    pub exit_ok: bool,
    /// `true` when a rate-limit hard block event was received during this session.
    ///
    /// Detected by seeing a `rate_limit_event` with a non-`allowed_warning` status in
    /// the PTY output.  The completion handler uses this flag to distinguish a
    /// rate-limit-forced exit from a genuine no-progress exit (bug 1053).
    pub rate_limit_exit: bool,
    /// When the API rate limit is scheduled to reset; `None` when no hard-block
    /// event was seen or when the `reset_at` field was absent from the event.
    pub rate_limit_reset_at: Option<chrono::DateTime<chrono::Utc>>,
}
