{
  "name": "forge-health",
  "language": "rust",
  "version": "0.2.0",
  "description": "ANVIL health profiles, lifecycle state machine, and monitoring for the Forge SDK",
  "manifest": "forge-rs/crates/forge-health/Cargo.toml",
  "manifestSha256": "5944690894975bec5e9a9f1cf8789026364c8168dd5e45c80e06817980e80927",
  "status": "source-reference",
  "registryPublicationVerified": false,
  "route": "/libraries/rust/forge-health",
  "features": {},
  "files": [
    {
      "path": "forge-rs/crates/forge-health/src/checkpoint.rs",
      "sha256": "4278aab15d1ba4e2d9ad52a050ddda63e433f77c2929b8c408d4e2cf8a91888c",
      "artifactSha256": "f60ad3ab009d96aaffb06fc3a8edc56876495612992dcfe6eb0efd679c608adc",
      "url": "/reference/source/forge-rs/crates/forge-health/src/checkpoint.rs.txt",
      "declarations": [
        {
          "name": "::Checkpoint",
          "line": 104,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct Checkpoint {\n/// Unique identifier for the operation being checkpointed.\n\n///\n\n/// This should be stable across restarts so that a resumed agent can\n\n/// find the checkpoint for its in-progress task.\n\npub operation_id: String,\n/// The step or phase identifier within the operation.\n\n///\n\n/// Agent-defined; examples: \"phase-2\", \"page-17\", \"batch-3-of-10\".\n\npub step: String,\n/// Arbitrary JSON state saved at this checkpoint.\n\n///\n\n/// The agent is responsible for interpreting this state on resume.\n\npub state: serde_json::Value,\n/// Monotonically increasing sequence number for this operation.\n\n///\n\n/// Each successive checkpoint for the same `operation_id` should use\n\n/// a higher sequence number.\n\npub sequence: u64,\n/// Timestamp when this checkpoint was created.\n\npub created_at: Timestamp\n}",
          "documentation": "A snapshot of in-progress work at a well-defined point.\n\nCheckpoints are the fundamental unit of resumable operations. They capture\nenough state to restart a task from the checkpointed step rather than\nfrom the beginning.\n\n# Ordering\n\nThe `sequence` field provides a monotonic ordering guarantee. Each\nsuccessive checkpoint for the same `operation_id` should have a higher\nsequence number. This allows detecting stale checkpoints during\nconcurrent operation.\n\n# Examples\n\n```\nuse forge_health::checkpoint::Checkpoint;\n\nlet cp = Checkpoint::new(\n    \"crawl-job-7\",\n    \"page-42\",\n    serde_json::json!({\"url\": \"https://example.com/42\", \"links_found\": 17}),\n);\nassert_eq!(cp.operation_id, \"crawl-job-7\");\nassert_eq!(cp.step, \"page-42\");\nassert_eq!(cp.sequence, 0);\n```"
        },
        {
          "name": "::Checkpoint::new",
          "line": 153,
          "signature": "pub fn new(operation_id: &str, step: &str, state: serde_json::Value) -> Self;",
          "documentation": "Creates a new checkpoint with sequence 0.\n\n# Arguments\n\n* `operation_id` - Unique identifier for the operation.\n* `step` - The current step or phase identifier.\n* `state` - Arbitrary JSON state to preserve.\n\n# Returns\n\nA new `Checkpoint` with `sequence` set to 0 and `created_at` set\nto the current time.\n\n# Examples\n\n```\nuse forge_health::checkpoint::Checkpoint;\n\nlet cp = Checkpoint::new(\"op-1\", \"init\", serde_json::json!({}));\nassert_eq!(cp.sequence, 0);\n```"
        },
        {
          "name": "::Checkpoint::with_sequence",
          "line": 187,
          "signature": "pub fn with_sequence(\n        operation_id: &str,\n        step: &str,\n        state: serde_json::Value,\n        sequence: u64,\n    ) -> Self;",
          "documentation": "Creates a new checkpoint with a specific sequence number.\n\nUse this when creating successive checkpoints for the same operation\nto maintain ordering.\n\n# Arguments\n\n* `operation_id` - Unique identifier for the operation.\n* `step` - The current step or phase identifier.\n* `state` - Arbitrary JSON state to preserve.\n* `sequence` - The monotonic sequence number.\n\n# Returns\n\nA new `Checkpoint` with the given sequence number.\n\n# Examples\n\n```\nuse forge_health::checkpoint::Checkpoint;\n\nlet cp = Checkpoint::with_sequence(\"op-1\", \"step-5\", serde_json::json!({}), 5);\nassert_eq!(cp.sequence, 5);\n```"
        },
        {
          "name": "::CheckpointStore",
          "line": 217,
          "signature": "pub trait CheckpointStore {\n    /// Saves a checkpoint, replacing any existing checkpoint for the same\n    /// `operation_id`.\n    ///\n    /// # Arguments\n    ///\n    /// * `checkpoint` - The [`Checkpoint`] to persist.\n    fn save(&mut self, checkpoint: &Checkpoint);\n\n    /// Loads the most recent checkpoint for the given operation.\n    ///\n    /// # Arguments\n    ///\n    /// * `operation_id` - The operation identifier to look up.\n    ///\n    /// # Returns\n    ///\n    /// `Some(Checkpoint)` if a checkpoint exists, `None` otherwise.\n    fn load(&self, operation_id: &str) -> Option<Checkpoint>;\n\n    /// Deletes all checkpoints for the given operation.\n    ///\n    /// # Arguments\n    ///\n    /// * `operation_id` - The operation identifier to delete.\n    ///\n    /// # Returns\n    ///\n    /// `true` if a checkpoint was found and deleted, `false` otherwise.\n    fn delete(&mut self, operation_id: &str) -> bool;\n\n    /// Lists all operation IDs that have stored checkpoints.\n    ///\n    /// # Returns\n    ///\n    /// A vector of operation ID strings.\n    fn list(&self) -> Vec<String>;\n}",
          "documentation": "Trait for checkpoint persistence backends.\n\nImplementations store and retrieve checkpoints for resumable operations.\nThe trait is intentionally synchronous to support both in-process\n(in-memory, file) and external (database, KV store) backends. Async\nbackends can use interior mutability and blocking wrappers.\n\n# Contract\n\n- `save()` must be idempotent for the same `operation_id` and `sequence`.\n- `load()` must return the most recent checkpoint for the given\n  `operation_id`.\n- `delete()` must remove all checkpoints for the given `operation_id`.\n- `list()` must return all currently stored operation IDs."
        },
        {
          "name": "::InMemoryCheckpointStore",
          "line": 277,
          "signature": "#[derive(Debug, Clone, Default)]\npub struct InMemoryCheckpointStore {\n\n}",
          "documentation": "In-memory checkpoint store for testing and standalone agents.\n\nStores checkpoints in a `HashMap`. Not persisted across process restarts.\nFor production use, implement [`CheckpointStore`] over a durable backend\n(file, database, Akasha KV).\n\n# Examples\n\n```\nuse forge_health::checkpoint::{Checkpoint, InMemoryCheckpointStore, CheckpointStore};\n\nlet mut store = InMemoryCheckpointStore::new();\nassert!(store.list().is_empty());\n\nlet cp = Checkpoint::new(\"op-1\", \"step-1\", serde_json::json!({\"count\": 42}));\nstore.save(&cp);\n\nassert_eq!(store.list().len(), 1);\nassert!(store.load(\"op-1\").is_some());\n```"
        },
        {
          "name": "::InMemoryCheckpointStore::new",
          "line": 287,
          "signature": "pub fn new() -> Self;",
          "documentation": "Creates a new empty in-memory checkpoint store.\n\n# Returns\n\nA new `InMemoryCheckpointStore` with no stored checkpoints."
        },
        {
          "name": "::InMemoryCheckpointStore::len",
          "line": 294,
          "signature": "pub fn len(&self) -> usize;",
          "documentation": "Returns the number of stored checkpoints."
        },
        {
          "name": "::InMemoryCheckpointStore::is_empty",
          "line": 299,
          "signature": "pub fn is_empty(&self) -> bool;",
          "documentation": "Returns `true` if no checkpoints are stored."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/degradation.rs",
      "sha256": "936b5b1c0b14e7d0e90f397b66f00c4b308426f726de8a2e8291f4c4c7df6729",
      "artifactSha256": "775cd4e8899500448123f9cb956beae9296342a0dc9eea09139d1e15252ad3cf",
      "url": "/reference/source/forge-rs/crates/forge-health/src/degradation.rs.txt",
      "declarations": [
        {
          "name": "::DegradationThresholds",
          "line": 69,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct DegradationThresholds {\n/// Maximum acceptable mean latency in microseconds.\n\n/// Exceeding this triggers a `LatencySpike` signal.\n\npub latency_spike_threshold_us: u64,\n/// Maximum acceptable P99 latency in microseconds.\n\n/// Exceeding this triggers a `TailLatencyBlowup` signal.\n\npub p99_threshold_us: u64,\n/// Minimum acceptable success rate as a fraction (0.0 to 1.0).\n\n/// Dropping below this triggers a `SuccessRateDrop` signal.\n\npub min_success_rate: f64,\n/// Maximum acceptable number of recent failures in the window.\n\n/// Exceeding this triggers an `ErrorBurst` signal.\n\npub max_recent_failures: u64\n}",
          "documentation": "Configurable thresholds for degradation detection.\n\nEach threshold corresponds to a specific degradation signal. When a\nmetric exceeds its threshold, the corresponding signal is emitted.\n\n# Defaults\n\n- `latency_spike_threshold_us`: 10,000,000 (10 seconds)\n- `p99_threshold_us`: 30,000,000 (30 seconds)\n- `min_success_rate`: 0.8 (80%)\n- `max_recent_failures`: 10\n\n# Examples\n\n```\nuse forge_health::degradation::DegradationThresholds;\n\nlet t = DegradationThresholds::default();\nassert_eq!(t.latency_spike_threshold_us, 10_000_000);\nassert!((t.min_success_rate - 0.8).abs() < f64::EPSILON);\n```"
        },
        {
          "name": "::DegradationSignal",
          "line": 115,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]\npub enum DegradationSignal {\n    /// Mean latency exceeds the configured threshold.\n    LatencySpike {\n        /// Observed mean latency in microseconds.\n        mean_latency_us: u64,\n        /// Configured threshold in microseconds.\n        threshold_us: u64,\n    },\n\n    /// P99 latency exceeds the configured threshold.\n    TailLatencyBlowup {\n        /// Observed P99 latency in microseconds.\n        p99_latency_us: u64,\n        /// Configured threshold in microseconds.\n        threshold_us: u64,\n    },\n\n    /// Success rate has dropped below the minimum threshold.\n    SuccessRateDrop {\n        /// Observed success rate (0.0 to 1.0).\n        success_rate: f64,\n        /// Configured minimum success rate.\n        min_threshold: f64,\n    },\n\n    /// Too many failures in the recent window.\n    ErrorBurst {\n        /// Number of failures in the current window.\n        failure_count: u64,\n        /// Configured maximum allowed failures.\n        max_allowed: u64,\n    },\n}",
          "documentation": "A specific degradation signal detected for an agent.\n\nEach variant describes a particular dimension of degradation, including\nthe observed value and the threshold that was exceeded.\n\n# Examples\n\n```\nuse forge_health::degradation::DegradationSignal;\n\nlet signal = DegradationSignal::LatencySpike {\n    mean_latency_us: 15_000_000,\n    threshold_us: 10_000_000,\n};\nassert!(signal.description().contains(\"latency spike\"));\n```"
        },
        {
          "name": "::DegradationSignal::description",
          "line": 169,
          "signature": "pub fn description(&self) -> String;",
          "documentation": "Returns a human-readable description of this degradation signal.\n\n# Returns\n\nA string describing the signal for logging and audit trail entries.\n\n# Examples\n\n```\nuse forge_health::degradation::DegradationSignal;\n\nlet signal = DegradationSignal::ErrorBurst {\n    failure_count: 15,\n    max_allowed: 10,\n};\nlet desc = signal.description();\nassert!(desc.contains(\"error burst\"));\nassert!(desc.contains(\"15\"));\n```"
        },
        {
          "name": "::DegradationDetector",
          "line": 229,
          "signature": "#[derive(Debug, Clone)]\npub struct DegradationDetector {\n\n}",
          "documentation": "Detects degradation signals from agent latency and success-rate metrics.\n\nThe detector is stateless -- it evaluates a [`LatencyStats`] snapshot\nagainst its configured thresholds and returns any signals found.\n\n# Examples\n\n```\nuse forge_health::degradation::{DegradationDetector, DegradationThresholds};\nuse forge_health::latency::LatencyStats;\n\nlet detector = DegradationDetector::new(DegradationThresholds::default());\nlet stats = LatencyStats::empty();\nlet signals = detector.detect(&stats);\nassert!(signals.is_empty());\n```"
        },
        {
          "name": "::DegradationDetector::new",
          "line": 243,
          "signature": "pub fn new(thresholds: DegradationThresholds) -> Self;",
          "documentation": "Creates a new `DegradationDetector` with the given thresholds.\n\n# Arguments\n\n* `thresholds` - The [`DegradationThresholds`] to evaluate against.\n\n# Returns\n\nA new `DegradationDetector`."
        },
        {
          "name": "::DegradationDetector::thresholds",
          "line": 248,
          "signature": "pub fn thresholds(&self) -> &DegradationThresholds;",
          "documentation": "Returns a reference to the configured thresholds."
        },
        {
          "name": "::DegradationDetector::detect",
          "line": 293,
          "signature": "pub fn detect(&self, stats: &LatencyStats) -> Vec<DegradationSignal>;",
          "documentation": "Evaluates the given stats against thresholds and returns any\ndegradation signals found.\n\n# Arguments\n\n* `stats` - A [`LatencyStats`] snapshot from the agent's\n  [`LatencyTracker`](crate::latency::LatencyTracker).\n\n# Returns\n\nA vector of [`DegradationSignal`] values. Empty if no degradation\nis detected.\n\n# Examples\n\n```\nuse forge_health::degradation::{DegradationDetector, DegradationThresholds, DegradationSignal};\nuse forge_health::latency::LatencyStats;\n\nlet detector = DegradationDetector::new(DegradationThresholds {\n    min_success_rate: 0.9,\n    ..DegradationThresholds::default()\n});\n\n// Simulate low success rate\nlet stats = LatencyStats {\n    total_count: 10,\n    success_count: 7,\n    failure_count: 3,\n    success_rate: 0.7,\n    mean_latency_us: 1000.0,\n    p50_latency_us: 1000,\n    p95_latency_us: 2000,\n    p99_latency_us: 3000,\n    max_latency_us: 3000,\n    min_latency_us: 500,\n};\n\nlet signals = detector.detect(&stats);\nassert!(!signals.is_empty());\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/error.rs",
      "sha256": "42e102e2cf520679ef5000973df61705d4bc60e3106698c2d751989e2d1c7eb4",
      "artifactSha256": "e8afbe04f0e4cdc2f356194a2e737c1d49703a8c533dca3bfcffeaf9ca69b704",
      "url": "/reference/source/forge-rs/crates/forge-health/src/error.rs.txt",
      "declarations": [
        {
          "name": "::ForgeHealthError",
          "line": 37,
          "signature": "#[derive(Debug, Error)]\npub enum ForgeHealthError {\n    /// An invalid lifecycle state transition was attempted.\n    ///\n    /// The ANVIL lifecycle state machine defines exactly which transitions are\n    /// valid from each state. This error is returned when a transition is\n    /// attempted that violates the state machine rules.\n    ///\n    /// See ANVIL Spec section 13.2 -- Lifecycle State Machine\n    /// for the complete transition table.\n    #[error(\"invalid lifecycle transition from {from} to {to}: {reason} (see ANVIL Spec section 5.1, Appendix B)\")]\n    InvalidTransition {\n        /// The current lifecycle state.\n        from: LifecycleState,\n        /// The target state that was attempted.\n        to: LifecycleState,\n        /// A human-readable explanation of why this transition is invalid.\n        reason: String,\n    },\n\n    /// A lifecycle operation was attempted on a state that does not support it.\n    ///\n    /// For example, attempting to resume an agent that is in the Terminated\n    /// state, or performing any operation on a terminal state.\n    #[error(\"invalid operation on lifecycle state {state}: {reason}\")]\n    InvalidState {\n        /// The current lifecycle state where the operation was attempted.\n        state: LifecycleState,\n        /// A human-readable explanation of why this operation is invalid.\n        reason: String,\n    },\n\n    /// A health monitoring operation failed.\n    ///\n    /// This covers failures in health check evaluation, threshold configuration,\n    /// or profile update operations.\n    #[error(\"health monitor error: {reason}\")]\n    MonitorError {\n        /// A human-readable explanation of what went wrong.\n        reason: String,\n    },\n}",
          "documentation": "Error type for lifecycle, health profile, and monitoring operations.\n\nEvery variant includes actionable context: what failed, why, and what the\ndeveloper should check. No generic \"something went wrong\" messages.\n\n# Examples\n\n```\nuse forge_health::error::ForgeHealthError;\nuse forge_health::lifecycle::LifecycleState;\n\nlet err = ForgeHealthError::InvalidTransition {\n    from: LifecycleState::Initializing,\n    to: LifecycleState::Running,\n    reason: \"must pass through Ready first\".to_string(),\n};\nlet msg = err.to_string();\nassert!(msg.contains(\"Initializing\"));\nassert!(msg.contains(\"Running\"));\nassert!(msg.contains(\"ANVIL Spec\"));\n```"
        },
        {
          "name": "::ForgeHealthResult",
          "line": 80,
          "signature": "pub type ForgeHealthResult<T> = Result<T, ForgeHealthError>;",
          "documentation": "A specialized `Result` type for `forge-health` operations."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/events.rs",
      "sha256": "85d7e10cdb3da329b41d50aa496e755e7434dfd3e5a8ec417b19cfb5141d1c42",
      "artifactSha256": "23b708fc35eab70512760ddccedae750c30bd6105122688e450735281fe6c197",
      "url": "/reference/source/forge-rs/crates/forge-health/src/events.rs.txt",
      "declarations": [
        {
          "name": "::LifecycleEvent",
          "line": 75,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct LifecycleEvent {\n/// The lifecycle transition that triggered this event.\n\npub transition: LifecycleTransition,\n/// The agent's DID, if identity is bound.\n\n///\n\n/// This is `None` for agents running in legacy mode (without OAS identity).\n\n/// When present, the DID is included in telemetry spans and audit trail\n\n/// entries.\n\npub agent_did: Option<String>,\n/// Optional metadata attached to this event.\n\n///\n\n/// Common uses:\n\n/// - Error details when transitioning to the Error state\n\n/// - Initialization parameters when transitioning to Initializing\n\n/// - Shutdown reason when transitioning to Terminated\n\npub metadata: Option<serde_json::Value>\n}",
          "documentation": "A lifecycle event emitted when an agent transitions between states.\n\nLifecycle events are the primary mechanism for tracking agent state changes.\nThey are:\n- Emitted via the telemetry system as structured events\n- Recorded in the agent's audit trail\n- Signed by the agent's Ed25519 key (when identity is available)\n\n# Audit Trail\n\nPer ANVIL Spec section 11.6, every lifecycle transition is recorded as an\naudit trail entry with the following data:\n- From state and to state\n- Timestamp\n- Agent DID\n- Optional metadata (e.g., error details for transitions to Error state)\n\n# Examples\n\n```\nuse forge_health::events::LifecycleEvent;\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\nlet transition = mgr.transition(LifecycleState::Ready).unwrap();\n\n// Simple event without identity\nlet event = LifecycleEvent::new(transition);\nassert!(event.agent_did.is_none());\n\n// Event with agent DID\nlet mut mgr2 = LifecycleManager::new();\nlet transition2 = mgr2.transition(LifecycleState::Ready).unwrap();\nlet transition3 = mgr2.transition(LifecycleState::Running).unwrap();\nlet event = LifecycleEvent::with_agent_did(\n    transition3,\n    \"did:oas:l1fe:agent:data-analyzer\".to_string(),\n);\nassert!(event.agent_did.is_some());\n```"
        },
        {
          "name": "::LifecycleEvent::new",
          "line": 120,
          "signature": "pub fn new(transition: LifecycleTransition) -> Self;",
          "documentation": "Creates a new lifecycle event from a transition.\n\nThe event has no agent DID and no metadata.\n\n# Arguments\n\n* `transition` - The [`LifecycleTransition`] that triggered this event.\n\n# Returns\n\nA new `LifecycleEvent` with `agent_did` and `metadata` set to `None`.\n\n# Examples\n\n```\nuse forge_health::events::LifecycleEvent;\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\nlet transition = mgr.transition(LifecycleState::Ready).unwrap();\nlet event = LifecycleEvent::new(transition);\nassert!(event.agent_did.is_none());\nassert!(event.metadata.is_none());\n```"
        },
        {
          "name": "::LifecycleEvent::with_agent_did",
          "line": 153,
          "signature": "pub fn with_agent_did(transition: LifecycleTransition, agent_did: String) -> Self;",
          "documentation": "Creates a new lifecycle event with an agent DID.\n\n# Arguments\n\n* `transition` - The [`LifecycleTransition`] that triggered this event.\n* `agent_did` - The agent's DID string.\n\n# Returns\n\nA new `LifecycleEvent` with `agent_did` set and `metadata` set to `None`.\n\n# Examples\n\n```\nuse forge_health::events::LifecycleEvent;\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\nlet transition = mgr.transition(LifecycleState::Ready).unwrap();\nlet event = LifecycleEvent::with_agent_did(\n    transition,\n    \"did:oas:l1fe:agent:bot-1\".to_string(),\n);\nassert_eq!(event.agent_did.as_deref(), Some(\"did:oas:l1fe:agent:bot-1\"));\n```"
        },
        {
          "name": "::LifecycleEvent::with_metadata",
          "line": 188,
          "signature": "pub fn with_metadata(mut self, metadata: serde_json::Value) -> Self;",
          "documentation": "Attaches metadata to this event.\n\nThis is a builder-style method that consumes and returns `self`.\n\n# Arguments\n\n* `metadata` - A JSON value containing event-specific metadata.\n\n# Returns\n\nThe modified `LifecycleEvent` with metadata attached.\n\n# Examples\n\n```\nuse forge_health::events::LifecycleEvent;\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\nlet transition = mgr.transition(LifecycleState::Ready).unwrap();\nlet event = LifecycleEvent::new(transition)\n    .with_metadata(serde_json::json!({\n        \"provider\": \"openai:gpt-4o\",\n        \"tools_loaded\": 5,\n    }));\nassert!(event.metadata.is_some());\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/latency.rs",
      "sha256": "fe1d0e2f65667dda00a76de970eb7c2688ec3a2c21bd5828a624d587008ee16a",
      "artifactSha256": "25adbb92f5949cb6aa030ae53576093d5393f1eb7ecc12c97da8d7b1dc32787b",
      "url": "/reference/source/forge-rs/crates/forge-health/src/latency.rs.txt",
      "declarations": [
        {
          "name": "::LatencyStats",
          "line": 70,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct LatencyStats {\n/// Total number of operations in the window.\n\npub total_count: u64,\n/// Number of successful operations in the window.\n\npub success_count: u64,\n/// Number of failed operations in the window.\n\npub failure_count: u64,\n/// Success rate as a fraction (0.0 to 1.0). Zero if no operations recorded.\n\npub success_rate: f64,\n/// Mean latency in microseconds across all operations in the window.\n\n/// Zero if no operations recorded.\n\npub mean_latency_us: f64,\n/// P50 (median) latency in microseconds. Zero if no operations recorded.\n\npub p50_latency_us: u64,\n/// P95 latency in microseconds. Zero if no operations recorded.\n\npub p95_latency_us: u64,\n/// P99 latency in microseconds. Zero if no operations recorded.\n\npub p99_latency_us: u64,\n/// Maximum latency observed in the window in microseconds.\n\npub max_latency_us: u64,\n/// Minimum latency observed in the window in microseconds.\n\n/// Zero if no operations recorded.\n\npub min_latency_us: u64\n}",
          "documentation": "Rolling statistics computed from the sliding window.\n\nAll latency values are in microseconds. Success rate is a fraction\nin the range `[0.0, 1.0]`.\n\n# Examples\n\n```\nuse forge_health::latency::LatencyStats;\n\nlet stats = LatencyStats::empty();\nassert_eq!(stats.total_count, 0);\nassert!((stats.success_rate - 0.0).abs() < f64::EPSILON);\n```"
        },
        {
          "name": "::LatencyStats::empty",
          "line": 111,
          "signature": "pub fn empty() -> Self;",
          "documentation": "Returns an empty stats snapshot with all values at zero.\n\n# Returns\n\nA `LatencyStats` with all counters and averages at zero.\n\n# Examples\n\n```\nuse forge_health::latency::LatencyStats;\n\nlet stats = LatencyStats::empty();\nassert_eq!(stats.total_count, 0);\nassert_eq!(stats.max_latency_us, 0);\n```"
        },
        {
          "name": "::LatencyTracker",
          "line": 153,
          "signature": "#[derive(Debug, Clone)]\npub struct LatencyTracker {\n\n}",
          "documentation": "Sliding-window latency and success-rate tracker for a single agent.\n\nRecords operation outcomes (latency + success/failure) in a fixed-size\nring buffer and computes rolling statistics on demand. Old entries are\nevicted when the window is full.\n\n# Thread Safety\n\n`LatencyTracker` is not `Sync`. For concurrent access, wrap it in a\n`Mutex` or `RwLock`.\n\n# Examples\n\n```\nuse forge_health::latency::LatencyTracker;\n\nlet mut tracker = LatencyTracker::new(64);\ntracker.record_success(1000); // 1ms\ntracker.record_success(2000); // 2ms\ntracker.record_failure(8000); // 8ms, failed\n\nlet stats = tracker.stats();\nassert_eq!(stats.total_count, 3);\nassert_eq!(stats.failure_count, 1);\n```"
        },
        {
          "name": "::LatencyTracker::new",
          "line": 180,
          "signature": "pub fn new(window_size: usize) -> Self;",
          "documentation": "Creates a new `LatencyTracker` with the specified window size.\n\n# Arguments\n\n* `window_size` - Maximum number of operation records to retain.\n  If zero, defaults to 128.\n\n# Returns\n\nA new empty `LatencyTracker`.\n\n# Examples\n\n```\nuse forge_health::latency::LatencyTracker;\n\nlet tracker = LatencyTracker::new(256);\nassert_eq!(tracker.stats().total_count, 0);\n```"
        },
        {
          "name": "::LatencyTracker::record_success",
          "line": 207,
          "signature": "pub fn record_success(&mut self, latency_us: u64);",
          "documentation": "Records a successful operation with the given latency.\n\n# Arguments\n\n* `latency_us` - Duration of the operation in microseconds.\n\n# Examples\n\n```\nuse forge_health::latency::LatencyTracker;\n\nlet mut tracker = LatencyTracker::new(64);\ntracker.record_success(1500);\nassert_eq!(tracker.stats().success_count, 1);\n```"
        },
        {
          "name": "::LatencyTracker::record_failure",
          "line": 229,
          "signature": "pub fn record_failure(&mut self, latency_us: u64);",
          "documentation": "Records a failed operation with the given latency.\n\n# Arguments\n\n* `latency_us` - Duration of the operation in microseconds.\n\n# Examples\n\n```\nuse forge_health::latency::LatencyTracker;\n\nlet mut tracker = LatencyTracker::new(64);\ntracker.record_failure(5000);\nassert_eq!(tracker.stats().failure_count, 1);\n```"
        },
        {
          "name": "::LatencyTracker::stats",
          "line": 258,
          "signature": "pub fn stats(&self) -> LatencyStats;",
          "documentation": "Computes rolling statistics from the current window contents.\n\nStatistics are computed fresh on each call; there is no cached state.\nIf the window is empty, returns [`LatencyStats::empty()`].\n\n# Returns\n\nA [`LatencyStats`] snapshot.\n\n# Examples\n\n```\nuse forge_health::latency::LatencyTracker;\n\nlet mut tracker = LatencyTracker::new(64);\ntracker.record_success(1000);\ntracker.record_success(3000);\n\nlet stats = tracker.stats();\nassert_eq!(stats.total_count, 2);\nassert!((stats.mean_latency_us - 2000.0).abs() < f64::EPSILON);\n```"
        },
        {
          "name": "::LatencyTracker::len",
          "line": 307,
          "signature": "pub fn len(&self) -> usize;",
          "documentation": "Returns the number of entries currently in the window.\n\n# Returns\n\nThe current window occupancy."
        },
        {
          "name": "::LatencyTracker::is_empty",
          "line": 312,
          "signature": "pub fn is_empty(&self) -> bool;",
          "documentation": "Returns `true` if the window contains no entries."
        },
        {
          "name": "::LatencyTracker::capacity",
          "line": 317,
          "signature": "pub fn capacity(&self) -> usize;",
          "documentation": "Returns the configured maximum window size."
        },
        {
          "name": "::LatencyTracker::clear",
          "line": 322,
          "signature": "pub fn clear(&mut self);",
          "documentation": "Clears all entries from the window."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/lib.rs",
      "sha256": "2735a8cb870af0666bfee3ca7e4c994b282c9201a540f2b56d81acf63e1ed569",
      "artifactSha256": "ed956d9750a8b8cc7d6d941abc6e5558a9e0d78c53f1821b94cd421ba4453c41",
      "url": "/reference/source/forge-rs/crates/forge-health/src/lib.rs.txt",
      "declarations": [
        {
          "name": "checkpoint",
          "line": 65,
          "signature": "pub mod checkpoint;",
          "documentation": "# forge-health\n\nANVIL health profiles, lifecycle state machine, and monitoring for the Forge SDK.\n\nThis crate provides the runtime health infrastructure for ANVIL-compliant agents.\nIt implements the immutable 6-state lifecycle state machine defined in ANVIL Spec\nsection 13.2, health profile tracking, threshold-based monitoring, and structured\nhealth reporting.\n\n# Components\n\n- **Lifecycle state machine** -- The 6 states (Initializing, Ready, Running,\n  Paused, Error, Terminated) and their valid transitions are immutable per\n  ANVIL Spec section 13.2. No states may be added, removed, or have their\n  transition table modified.\n- **Health profiles** -- Runtime metrics: uptime, error counts, tool invocations,\n  inference calls/tokens, CPU/memory usage, task tracking, success rates.\n- **Health monitoring** -- Threshold-based health checks that produce Healthy,\n  Degraded, or Critical status assessments.\n- **Health reporting** -- Structured reports combining profile, lifecycle state,\n  and status for audit trail and telemetry consumption.\n- **Lifecycle events** -- Structured event emission for every lifecycle transition,\n  consumable by telemetry emitters and audit trail writers.\n- **Latency tracking** -- Sliding-window per-agent latency and success-rate\n  metrics with P50/P95/P99 percentile computation.\n- **Degradation signals** -- Detection of agents that are struggling:\n  latency spikes, success rate drops, error bursts, tail latency blowups.\n- **Checkpointed operations** -- Save and restore in-progress work for\n  resumable workflows and failure recovery.\n- **Runtime health summaries** -- Aggregate health view across multiple\n  agents for fleet-level monitoring.\n\n# ANVIL Spec References\n\n- ANVIL Spec section 13.2 -- Lifecycle State Machine\n- ANVIL Spec section 14.1 -- Telemetry (lifecycle events)\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\nuse forge_health::monitoring::{HealthMonitor, HealthThresholds};\nuse forge_health::reporting::HealthStatus;\n\n// Create and advance lifecycle\nlet mut lifecycle = LifecycleManager::new();\nassert_eq!(lifecycle.state(), LifecycleState::Initializing);\n\nlet transition = lifecycle.transition(LifecycleState::Ready).unwrap();\nassert_eq!(transition.to, LifecycleState::Ready);\n\nlifecycle.transition(LifecycleState::Running).unwrap();\nassert_eq!(lifecycle.state(), LifecycleState::Running);\n\n// Monitor health\nlet mut monitor = HealthMonitor::new(HealthThresholds::default());\nmonitor.profile_mut().record_tool_invocation();\nmonitor.profile_mut().record_inference(512);\n\nlet status = monitor.check_health();\nassert!(matches!(status, HealthStatus::Healthy));\n```"
        },
        {
          "name": "degradation",
          "line": 66,
          "signature": "pub mod degradation;",
          "documentation": ""
        },
        {
          "name": "error",
          "line": 67,
          "signature": "pub mod error;",
          "documentation": ""
        },
        {
          "name": "events",
          "line": 68,
          "signature": "pub mod events;",
          "documentation": ""
        },
        {
          "name": "latency",
          "line": 69,
          "signature": "pub mod latency;",
          "documentation": ""
        },
        {
          "name": "lifecycle",
          "line": 70,
          "signature": "pub mod lifecycle;",
          "documentation": ""
        },
        {
          "name": "monitoring",
          "line": 71,
          "signature": "pub mod monitoring;",
          "documentation": ""
        },
        {
          "name": "profile",
          "line": 72,
          "signature": "pub mod profile;",
          "documentation": ""
        },
        {
          "name": "reporting",
          "line": 73,
          "signature": "pub mod reporting;",
          "documentation": ""
        },
        {
          "name": "summary",
          "line": 74,
          "signature": "pub mod summary;",
          "documentation": ""
        },
        {
          "name": "prelude",
          "line": 77,
          "signature": "pub mod prelude;",
          "documentation": "Re-exports of the most commonly used types."
        },
        {
          "name": "pub use crate::checkpoint::{Checkpoint, CheckpointStore, InMemoryCheckpointStore};",
          "line": 78,
          "signature": "pub use crate::checkpoint::{Checkpoint, CheckpointStore, InMemoryCheckpointStore};",
          "documentation": ""
        },
        {
          "name": "pub use crate::degradation::{DegradationDetector, DegradationSignal, DegradationThresholds};",
          "line": 79,
          "signature": "pub use crate::degradation::{DegradationDetector, DegradationSignal, DegradationThresholds};",
          "documentation": ""
        },
        {
          "name": "pub use crate::error::{ForgeHealthError, ForgeHealthResult};",
          "line": 80,
          "signature": "pub use crate::error::{ForgeHealthError, ForgeHealthResult};",
          "documentation": ""
        },
        {
          "name": "pub use crate::events::LifecycleEvent;",
          "line": 81,
          "signature": "pub use crate::events::LifecycleEvent;",
          "documentation": ""
        },
        {
          "name": "pub use crate::latency::{LatencyStats, LatencyTracker};",
          "line": 82,
          "signature": "pub use crate::latency::{LatencyStats, LatencyTracker};",
          "documentation": ""
        },
        {
          "name": "pub use crate::lifecycle::{LifecycleManager, LifecycleState, LifecycleTransition};",
          "line": 83,
          "signature": "pub use crate::lifecycle::{LifecycleManager, LifecycleState, LifecycleTransition};",
          "documentation": ""
        },
        {
          "name": "pub use crate::monitoring::{HealthMonitor, HealthThresholds};",
          "line": 84,
          "signature": "pub use crate::monitoring::{HealthMonitor, HealthThresholds};",
          "documentation": ""
        },
        {
          "name": "pub use crate::profile::HealthProfile;",
          "line": 85,
          "signature": "pub use crate::profile::HealthProfile;",
          "documentation": ""
        },
        {
          "name": "pub use crate::reporting::{HealthReport, HealthStatus};",
          "line": 86,
          "signature": "pub use crate::reporting::{HealthReport, HealthStatus};",
          "documentation": ""
        },
        {
          "name": "pub use crate::summary::{AgentHealthSnapshot, RuntimeHealthSummary};",
          "line": 87,
          "signature": "pub use crate::summary::{AgentHealthSnapshot, RuntimeHealthSummary};",
          "documentation": ""
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/lifecycle.rs",
      "sha256": "d4b432b04985d51868ce13773e9ae9c608da8dd1868c89824de0d3e2f3925039",
      "artifactSha256": "ddb03e8654c5aea5515654447fdd49c7b2eba81a6e97633cbc6831cdcbbab1c8",
      "url": "/reference/source/forge-rs/crates/forge-health/src/lifecycle.rs.txt",
      "declarations": [
        {
          "name": "::LifecycleState",
          "line": 77,
          "signature": "#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]\npub enum LifecycleState {\n    /// Agent is loading configuration, identity, and capabilities.\n    ///\n    /// This is the initial state for all agents. During initialization, the\n    /// agent loads its OAS identity, Arsenal ACT, provider configuration, and\n    /// tool definitions. Valid transitions are to Ready (on success), Error\n    /// (on failure), or Terminated (abort).\n    Initializing,\n\n    /// Agent has completed initialization and is ready to accept work.\n    ///\n    /// The agent's identity, configuration, and tools have been loaded\n    /// successfully. Valid transitions are to Running (start processing)\n    /// or Terminated (shutdown before starting).\n    Ready,\n\n    /// Agent is actively processing requests.\n    ///\n    /// This is the primary operational state. The agent can process tool loops,\n    /// generate text, and handle messages. Valid transitions are to Ready\n    /// (return to idle), Paused (pause), Error (fatal failure), or Terminated\n    /// (graceful shutdown).\n    Running,\n\n    /// Agent is temporarily paused and not processing requests.\n    ///\n    /// A paused agent retains its state and can resume. Valid transitions\n    /// are to Running (resume) or Terminated (shutdown while paused).\n    Paused,\n\n    /// Agent encountered a fatal error.\n    ///\n    /// An agent in the Error state can attempt recovery by transitioning to\n    /// Ready (after re-initialization), or give up by transitioning to\n    /// Terminated.\n    Error,\n\n    /// Agent has completed shutdown. This is a **terminal state** with no\n    /// outgoing transitions.\n    ///\n    /// Once an agent reaches Terminated, it cannot be reused. A new agent\n    /// instance must be created.\n    Terminated,\n}",
          "documentation": "ANVIL lifecycle states.\n\nThese six states and their valid transitions are **immutable** per\nANVIL Spec section 13.2. No states may be added, removed,\nor have their transition rules changed without a formal specification amendment.\n\n# Serialization\n\nStates serialize to their PascalCase names: `\"Initializing\"`,\n`\"Ready\"`, `\"Running\"`, `\"Paused\"`, `\"Error\"`, `\"Terminated\"`.\n\n# Examples\n\n```\nuse forge_health::lifecycle::LifecycleState;\n\nlet state = LifecycleState::Running;\nassert_eq!(state.to_string(), \"Running\");\n\nlet json = serde_json::to_string(&state).unwrap();\nassert_eq!(json, \"\\\"Running\\\"\");\n```"
        },
        {
          "name": "::LifecycleState::valid_transitions",
          "line": 146,
          "signature": "pub fn valid_transitions(&self) -> &'static [LifecycleState];",
          "documentation": "Returns the set of valid target states from this state.\n\nThe transition table is defined by ANVIL Spec section 13.2\nand is immutable.\n\n# Returns\n\nA slice of `LifecycleState` values that are valid targets from the\ncurrent state. Returns an empty slice for the terminal state (Terminated).\n\n# Examples\n\n```\nuse forge_health::lifecycle::LifecycleState;\n\nlet targets = LifecycleState::Running.valid_transitions();\nassert!(targets.contains(&LifecycleState::Ready));\nassert!(targets.contains(&LifecycleState::Paused));\nassert!(targets.contains(&LifecycleState::Error));\nassert!(targets.contains(&LifecycleState::Terminated));\nassert!(!targets.contains(&LifecycleState::Initializing));\n```"
        },
        {
          "name": "::LifecycleState::is_terminal",
          "line": 179,
          "signature": "pub fn is_terminal(&self) -> bool;",
          "documentation": "Returns `true` if this is a terminal state (no outgoing transitions).\n\nCurrently, only `Terminated` is a terminal state.\n\n# Examples\n\n```\nuse forge_health::lifecycle::LifecycleState;\n\nassert!(LifecycleState::Terminated.is_terminal());\nassert!(!LifecycleState::Running.is_terminal());\nassert!(!LifecycleState::Error.is_terminal());\n```"
        },
        {
          "name": "::LifecycleState::is_operational",
          "line": 198,
          "signature": "pub fn is_operational(&self) -> bool;",
          "documentation": "Returns `true` if the agent can perform work in this state.\n\nBoth `Ready` and `Running` are operational states. `Ready` means the\nagent can accept new work; `Running` means it is actively processing.\n\n# Examples\n\n```\nuse forge_health::lifecycle::LifecycleState;\n\nassert!(LifecycleState::Ready.is_operational());\nassert!(LifecycleState::Running.is_operational());\nassert!(!LifecycleState::Paused.is_operational());\nassert!(!LifecycleState::Error.is_operational());\n```"
        },
        {
          "name": "::LifecycleTransition",
          "line": 233,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct LifecycleTransition {\n/// The state before the transition.\n\npub from: LifecycleState,\n/// The state after the transition.\n\npub to: LifecycleState,\n/// The UTC timestamp when the transition occurred.\n\npub timestamp: Timestamp\n}",
          "documentation": "A record of a single lifecycle state transition.\n\nEvery transition is timestamped and stored in the [`LifecycleManager`]'s\nhistory. Transitions are emitted as telemetry events and recorded in the\nagent's audit trail.\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\nlet transition = mgr.transition(LifecycleState::Ready).unwrap();\nassert_eq!(transition.from, LifecycleState::Initializing);\nassert_eq!(transition.to, LifecycleState::Ready);\n```"
        },
        {
          "name": "::LifecycleManager",
          "line": 289,
          "signature": "#[derive(Debug, Clone)]\npub struct LifecycleManager {\n\n}",
          "documentation": "Manages the ANVIL lifecycle state machine for a single agent.\n\nThe `LifecycleManager` enforces the immutable transition table from ANVIL Spec\nsection 13.2. It tracks the current state, validates all\ntransitions, and maintains a complete transition history.\n\n# Thread Safety\n\n`LifecycleManager` is not `Sync`. For concurrent access, wrap it in a\n`Mutex` or `RwLock`.\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\n\n// Happy path: Initializing -> Ready -> Running\nmgr.transition(LifecycleState::Ready).unwrap();\nmgr.transition(LifecycleState::Running).unwrap();\n\n// Pause and resume\nmgr.transition(LifecycleState::Paused).unwrap();\nmgr.transition(LifecycleState::Running).unwrap();\n\n// Graceful shutdown\nmgr.transition(LifecycleState::Terminated).unwrap();\nassert!(mgr.state().is_terminal());\n```\n\nError recovery:\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\n\n// Initialization fails\nmgr.transition(LifecycleState::Error).unwrap();\n\n// Recover to Ready\nmgr.transition(LifecycleState::Ready).unwrap();\nmgr.transition(LifecycleState::Running).unwrap();\nassert_eq!(mgr.state(), LifecycleState::Running);\n```"
        },
        {
          "name": "::LifecycleManager::new",
          "line": 315,
          "signature": "pub fn new() -> Self;",
          "documentation": "Creates a new `LifecycleManager` in the `Initializing` state.\n\nEvery agent starts in the `Initializing` state per ANVIL Spec section 13.2.\n\n# Returns\n\nA new `LifecycleManager` with an empty transition history and state\nset to `Initializing`.\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mgr = LifecycleManager::new();\nassert_eq!(mgr.state(), LifecycleState::Initializing);\nassert!(mgr.history().is_empty());\n```"
        },
        {
          "name": "::LifecycleManager::state",
          "line": 336,
          "signature": "pub fn state(&self) -> LifecycleState;",
          "documentation": "Returns the current lifecycle state.\n\n# Returns\n\nThe current [`LifecycleState`].\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mgr = LifecycleManager::new();\nassert_eq!(mgr.state(), LifecycleState::Initializing);\n```"
        },
        {
          "name": "::LifecycleManager::transition",
          "line": 380,
          "signature": "pub fn transition(\n        &mut self,\n        target: LifecycleState,\n    ) -> Result<LifecycleTransition, ForgeHealthError>;",
          "documentation": "Attempts to transition to the given target state.\n\nValidates the transition against the ANVIL Spec section 13.2\ntransition table. If valid, the state is updated, a [`LifecycleTransition`]\nis recorded in the history, and a copy is returned. If invalid, an error\nis returned and the state is unchanged.\n\n# Arguments\n\n* `target` - The desired target [`LifecycleState`].\n\n# Returns\n\nA [`LifecycleTransition`] record on success.\n\n# Errors\n\nReturns [`ForgeHealthError::InvalidTransition`] if the transition from\nthe current state to `target` is not in the ANVIL transition table.\n\nReturns [`ForgeHealthError::InvalidTransition`] if `target` equals the\ncurrent state (self-transitions are not permitted).\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\n\n// Valid transition\nlet t = mgr.transition(LifecycleState::Ready).unwrap();\nassert_eq!(t.from, LifecycleState::Initializing);\nassert_eq!(t.to, LifecycleState::Ready);\n\n// Invalid transition returns error\nlet err = mgr.transition(LifecycleState::Error);\nassert!(err.is_err());\n```"
        },
        {
          "name": "::LifecycleManager::can_transition_to",
          "line": 456,
          "signature": "pub fn can_transition_to(&self, target: LifecycleState) -> bool;",
          "documentation": "Returns `true` if the transition from the current state to `target` is valid.\n\n# Arguments\n\n* `target` - The candidate target [`LifecycleState`].\n\n# Returns\n\n`true` if the transition is permitted by the ANVIL transition table.\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mgr = LifecycleManager::new();\nassert!(mgr.can_transition_to(LifecycleState::Ready));\nassert!(!mgr.can_transition_to(LifecycleState::Running));\nassert!(!mgr.can_transition_to(LifecycleState::Paused));\n```"
        },
        {
          "name": "::LifecycleManager::valid_transitions",
          "line": 480,
          "signature": "pub fn valid_transitions(&self) -> Vec<LifecycleState>;",
          "documentation": "Returns the set of valid target states from the current state.\n\nThis is a convenience method that delegates to\n[`LifecycleState::valid_transitions`].\n\n# Returns\n\nA `Vec` of valid target states. Empty if the current state is terminal.\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mgr = LifecycleManager::new();\nlet valid = mgr.valid_transitions();\nassert!(valid.contains(&LifecycleState::Ready));\nassert!(valid.contains(&LifecycleState::Error));\nassert!(valid.contains(&LifecycleState::Terminated));\n```"
        },
        {
          "name": "::LifecycleManager::history",
          "line": 505,
          "signature": "pub fn history(&self) -> &[LifecycleTransition];",
          "documentation": "Returns the complete transition history.\n\nThe history is ordered chronologically -- the first entry is the first\ntransition that occurred.\n\n# Returns\n\nA slice of all [`LifecycleTransition`] records.\n\n# Examples\n\n```\nuse forge_health::lifecycle::{LifecycleManager, LifecycleState};\n\nlet mut mgr = LifecycleManager::new();\nassert!(mgr.history().is_empty());\n\nmgr.transition(LifecycleState::Ready).unwrap();\nassert_eq!(mgr.history().len(), 1);\nassert_eq!(mgr.history()[0].from, LifecycleState::Initializing);\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/monitoring.rs",
      "sha256": "a26b0e13aa8ba93e40eee45b6da4ebcfc38765c7e21b8a7bc3358e9c1e083318",
      "artifactSha256": "7d65a5efa5b3c7124e23a8b8a820aa2f1c3984f9b37a7cdb66f9d001f238f42d",
      "url": "/reference/source/forge-rs/crates/forge-health/src/monitoring.rs.txt",
      "declarations": [
        {
          "name": "::HealthThresholds",
          "line": 81,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct HealthThresholds {\n/// Maximum acceptable error rate in errors per minute.\n\n///\n\n/// When the computed error rate exceeds this threshold, the agent's\n\n/// health status becomes `Degraded` or `Critical`.\n\npub max_error_rate: f64,\n/// Maximum acceptable CPU usage percentage (0.0 to 100.0).\n\n///\n\n/// When CPU usage exceeds this threshold, the agent's health status\n\n/// becomes `Degraded`.\n\npub max_cpu_percent: f64,\n/// Maximum acceptable memory usage in bytes.\n\n///\n\n/// When memory usage exceeds this threshold, the agent's health status\n\n/// becomes `Critical`.\n\npub max_memory_bytes: u64,\n/// Maximum acceptable inference latency in milliseconds.\n\n///\n\n/// This threshold is informational \u2014 it is reported in the health status\n\n/// reasons but does not directly cause status changes since latency is\n\n/// not tracked in the profile (it would require per-call timing).\n\npub max_inference_latency_ms: u64\n}",
          "documentation": "Configurable thresholds for health status evaluation.\n\nWhen a metric exceeds its threshold, the health status is degraded or\ncritical depending on the severity. All thresholds use the same units\nas their corresponding [`HealthProfile`] fields.\n\n# Defaults\n\nThe default thresholds are:\n- `max_error_rate`: 10.0 errors per minute\n- `max_cpu_percent`: 90.0%\n- `max_memory_bytes`: 4 GB (4,294,967,296 bytes)\n- `max_inference_latency_ms`: 5000 ms\n\n# Examples\n\n```\nuse forge_health::monitoring::HealthThresholds;\n\n// Use defaults\nlet thresholds = HealthThresholds::default();\nassert!((thresholds.max_error_rate - 10.0).abs() < f64::EPSILON);\n\n// Custom thresholds\nlet custom = HealthThresholds {\n    max_error_rate: 5.0,\n    max_cpu_percent: 80.0,\n    max_memory_bytes: 2 * 1024 * 1024 * 1024,\n    max_inference_latency_ms: 3000,\n};\n```"
        },
        {
          "name": "::HealthMonitor",
          "line": 147,
          "signature": "#[derive(Debug, Clone)]\npub struct HealthMonitor {\n\n}",
          "documentation": "Health monitor that evaluates an agent's profile against thresholds.\n\nThe `HealthMonitor` owns both the [`HealthProfile`] and the\n[`HealthThresholds`], providing a unified interface for recording metrics\nand evaluating health status.\n\n# Examples\n\n```\nuse forge_health::monitoring::{HealthMonitor, HealthThresholds};\nuse forge_health::reporting::HealthStatus;\n\nlet mut monitor = HealthMonitor::new(HealthThresholds::default());\n\n// Record some activity\nmonitor.profile_mut().record_tool_invocation();\nmonitor.profile_mut().record_inference(512);\n\n// Check health\nlet status = monitor.check_health();\nassert!(matches!(status, HealthStatus::Healthy));\n\n// Simulate high CPU\nmonitor.profile_mut().update_resources(95.0, 1024);\nlet status = monitor.check_health();\nassert!(!matches!(status, HealthStatus::Healthy));\n```"
        },
        {
          "name": "::HealthMonitor::new",
          "line": 175,
          "signature": "pub fn new(thresholds: HealthThresholds) -> Self;",
          "documentation": "Creates a new `HealthMonitor` with the given thresholds.\n\nThe profile is initialized with all counters at zero.\n\n# Arguments\n\n* `thresholds` - The [`HealthThresholds`] to evaluate against.\n\n# Returns\n\nA new `HealthMonitor` with a fresh `HealthProfile`.\n\n# Examples\n\n```\nuse forge_health::monitoring::{HealthMonitor, HealthThresholds};\n\nlet monitor = HealthMonitor::new(HealthThresholds::default());\nassert_eq!(monitor.profile().tool_invocations, 0);\n```"
        },
        {
          "name": "::HealthMonitor::profile",
          "line": 196,
          "signature": "pub fn profile(&self) -> &HealthProfile;",
          "documentation": "Returns a reference to the current health profile.\n\n# Returns\n\nA reference to the [`HealthProfile`].\n\n# Examples\n\n```\nuse forge_health::monitoring::{HealthMonitor, HealthThresholds};\n\nlet monitor = HealthMonitor::new(HealthThresholds::default());\nassert_eq!(monitor.profile().error_count, 0);\n```"
        },
        {
          "name": "::HealthMonitor::profile_mut",
          "line": 218,
          "signature": "pub fn profile_mut(&mut self) -> &mut HealthProfile;",
          "documentation": "Returns a mutable reference to the health profile.\n\nUse this to record tool invocations, inference calls, errors, and\nresource usage updates.\n\n# Returns\n\nA mutable reference to the [`HealthProfile`].\n\n# Examples\n\n```\nuse forge_health::monitoring::{HealthMonitor, HealthThresholds};\n\nlet mut monitor = HealthMonitor::new(HealthThresholds::default());\nmonitor.profile_mut().record_tool_invocation();\nassert_eq!(monitor.profile().tool_invocations, 1);\n```"
        },
        {
          "name": "::HealthMonitor::thresholds",
          "line": 236,
          "signature": "pub fn thresholds(&self) -> &HealthThresholds;",
          "documentation": "Returns a reference to the configured thresholds.\n\n# Returns\n\nA reference to the [`HealthThresholds`].\n\n# Examples\n\n```\nuse forge_health::monitoring::{HealthMonitor, HealthThresholds};\n\nlet monitor = HealthMonitor::new(HealthThresholds::default());\nassert!((monitor.thresholds().max_cpu_percent - 90.0).abs() < f64::EPSILON);\n```"
        },
        {
          "name": "::HealthMonitor::check_health",
          "line": 278,
          "signature": "pub fn check_health(&self) -> HealthStatus;",
          "documentation": "Evaluates the current health profile against the configured thresholds.\n\nThe evaluation checks (in priority order):\n\n1. **Memory** \u2014 If `memory_usage_bytes > max_memory_bytes`, adds a\n   critical reason.\n2. **CPU** \u2014 If `cpu_usage_percent > max_cpu_percent`, adds a degraded\n   reason.\n3. **Error rate** \u2014 If the computed error rate (errors per minute,\n   approximated from uptime) exceeds `max_error_rate`, adds a reason.\n   If the error rate exceeds 2x the threshold, it is critical.\n\nIf any critical reasons exist, the status is `Critical`. If only\ndegraded reasons exist, the status is `Degraded`. Otherwise, `Healthy`.\n\n# Returns\n\nA [`HealthStatus`] assessment.\n\n# Examples\n\n```\nuse forge_health::monitoring::{HealthMonitor, HealthThresholds};\nuse forge_health::reporting::HealthStatus;\n\nlet mut monitor = HealthMonitor::new(HealthThresholds::default());\n\n// Healthy by default\nassert!(matches!(monitor.check_health(), HealthStatus::Healthy));\n\n// High memory -> Critical\nmonitor.profile_mut().update_resources(\n    50.0,\n    5 * 1024 * 1024 * 1024, // 5 GB, exceeds 4 GB default\n);\nlet status = monitor.check_health();\nassert!(matches!(status, HealthStatus::Critical { .. }));\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/profile.rs",
      "sha256": "449021c7907ed853d737e559b89ba9f95472b87c156b6864ad484d07fed3fd03",
      "artifactSha256": "134be529e3e50eef5448f14259ef168e59105a4f02d055c72e31fbf4b2151645",
      "url": "/reference/source/forge-rs/crates/forge-health/src/profile.rs.txt",
      "declarations": [
        {
          "name": "::HealthProfile",
          "line": 64,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct HealthProfile {\n/// Total uptime of the agent in seconds.\n\n///\n\n/// This is updated externally by the monitoring system based on the\n\n/// elapsed time since the agent entered the Active state.\n\npub uptime_seconds: u64,\n/// Total number of errors recorded during the agent's lifetime.\n\n///\n\n/// This counter is monotonically increasing.\n\npub error_count: u64,\n/// Total number of tool invocations executed by the agent.\n\n///\n\n/// Includes both successful and failed invocations.\n\npub tool_invocations: u64,\n/// Total number of inference calls (LLM generation requests) made.\n\npub inference_calls: u64,\n/// Total number of tokens consumed across all inference calls.\n\npub inference_tokens: u64,\n/// Current CPU usage as a percentage (0.0 to 100.0).\n\n///\n\n/// This is a point-in-time measurement updated by `update_resources`.\n\npub cpu_usage_percent: f64,\n/// Current memory usage in bytes.\n\n///\n\n/// This is a point-in-time measurement updated by `update_resources`.\n\npub memory_usage_bytes: u64,\n/// Number of currently active (in-flight) tasks.\n\n///\n\n/// Incremented by `record_task_started`, decremented by `record_task_completed`.\n\n/// This gauge can reach zero and will not go below zero (saturating subtraction).\n\npub active_tasks: u32,\n/// Total number of tasks completed during the agent's lifetime.\n\n///\n\n/// This counter is monotonically increasing.\n\npub completed_tasks: u64,\n/// Current error rate as a fraction (0.0 to 1.0).\n\n///\n\n/// Computed as `errors / (errors + successes)` across all generation calls.\n\n/// Updated by `record_generation_success` and `record_generation_failure`.\n\npub error_rate: f64,\n/// Average latency of completed operations in milliseconds.\n\n///\n\n/// Updated externally by the monitoring system.\n\npub avg_latency_ms: f64,\n/// Tool invocation success rate as a fraction (0.0 to 1.0).\n\n///\n\n/// Computed as `successes / total` across all tool invocations.\n\npub tool_success_rate: f64,\n/// Generation success rate as a fraction (0.0 to 1.0).\n\n///\n\n/// Computed as `successes / total` across all generation calls.\n\n/// Updated by `record_generation_success` and `record_generation_failure`.\n\npub generation_success_rate: f64,\n/// Timestamp of the last profile update.\n\npub last_updated: Timestamp\n}",
          "documentation": "Runtime health metrics for an ANVIL-compliant agent.\n\nThe health profile tracks operational statistics that enable health\nmonitoring, capacity planning, and audit trail generation. All counters\nare monotonically increasing \u2014 they are never reset during an agent's\nlifetime.\n\n# Thread Safety\n\n`HealthProfile` is not `Sync`. For concurrent access, wrap it in a\n`Mutex` or `RwLock`.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_tool_invocation();\nprofile.record_inference(100);\nprofile.update_resources(45.0, 1024 * 1024 * 512);\n\nassert_eq!(profile.tool_invocations, 1);\nassert_eq!(profile.inference_tokens, 100);\n```"
        },
        {
          "name": "::HealthProfile::new",
          "line": 164,
          "signature": "pub fn new() -> Self;",
          "documentation": "Creates a new `HealthProfile` with all counters at zero.\n\n# Returns\n\nA fresh `HealthProfile` with `last_updated` set to the current time\nand all counters initialized to zero.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet profile = HealthProfile::new();\nassert_eq!(profile.error_count, 0);\nassert_eq!(profile.tool_invocations, 0);\nassert_eq!(profile.inference_calls, 0);\nassert_eq!(profile.inference_tokens, 0);\nassert_eq!(profile.active_tasks, 0);\nassert_eq!(profile.completed_tasks, 0);\nassert!((profile.error_rate - 0.0).abs() < f64::EPSILON);\n```"
        },
        {
          "name": "::HealthProfile::record_tool_invocation",
          "line": 200,
          "signature": "pub fn record_tool_invocation(&mut self);",
          "documentation": "Records a tool invocation.\n\nIncrements the `tool_invocations` counter by one and updates the\n`last_updated` timestamp.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_tool_invocation();\nprofile.record_tool_invocation();\nassert_eq!(profile.tool_invocations, 2);\n```"
        },
        {
          "name": "::HealthProfile::record_inference",
          "line": 225,
          "signature": "pub fn record_inference(&mut self, tokens: u64);",
          "documentation": "Records an inference call with the given token count.\n\nIncrements the `inference_calls` counter by one, adds `tokens` to\nthe `inference_tokens` total, and updates the `last_updated` timestamp.\n\n# Arguments\n\n* `tokens` - The number of tokens consumed by this inference call.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_inference(256);\nprofile.record_inference(512);\nassert_eq!(profile.inference_calls, 2);\nassert_eq!(profile.inference_tokens, 768);\n```"
        },
        {
          "name": "::HealthProfile::record_error",
          "line": 245,
          "signature": "pub fn record_error(&mut self);",
          "documentation": "Records an error occurrence.\n\nIncrements the `error_count` counter by one and updates the\n`last_updated` timestamp.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_error();\nassert_eq!(profile.error_count, 1);\n```"
        },
        {
          "name": "::HealthProfile::update_resources",
          "line": 270,
          "signature": "pub fn update_resources(&mut self, cpu: f64, memory: u64);",
          "documentation": "Updates the point-in-time resource usage metrics.\n\nCPU percentage is clamped to the range `[0.0, 100.0]`. Values outside\nthis range are clamped silently.\n\n# Arguments\n\n* `cpu` - Current CPU usage as a percentage (0.0 to 100.0).\n* `memory` - Current memory usage in bytes.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.update_resources(55.3, 1024 * 1024 * 256);\nassert!((profile.cpu_usage_percent - 55.3).abs() < f64::EPSILON);\nassert_eq!(profile.memory_usage_bytes, 1024 * 1024 * 256);\n```"
        },
        {
          "name": "::HealthProfile::update_uptime",
          "line": 291,
          "signature": "pub fn update_uptime(&mut self, seconds: u64);",
          "documentation": "Updates the uptime counter.\n\n# Arguments\n\n* `seconds` - The total uptime in seconds since the agent became Running.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.update_uptime(3600);\nassert_eq!(profile.uptime_seconds, 3600);\n```"
        },
        {
          "name": "::HealthProfile::record_task_started",
          "line": 312,
          "signature": "pub fn record_task_started(&mut self);",
          "documentation": "Records the start of a new task.\n\nIncrements the `active_tasks` gauge by one and updates the\n`last_updated` timestamp.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_task_started();\nassert_eq!(profile.active_tasks, 1);\nprofile.record_task_started();\nassert_eq!(profile.active_tasks, 2);\n```"
        },
        {
          "name": "::HealthProfile::record_task_completed",
          "line": 335,
          "signature": "pub fn record_task_completed(&mut self);",
          "documentation": "Records the completion of a task.\n\nDecrements the `active_tasks` gauge by one (saturating at zero) and\nincrements the `completed_tasks` counter by one. Updates the\n`last_updated` timestamp.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_task_started();\nprofile.record_task_started();\nprofile.record_task_completed();\nassert_eq!(profile.active_tasks, 1);\nassert_eq!(profile.completed_tasks, 1);\n```"
        },
        {
          "name": "::HealthProfile::record_generation_success",
          "line": 357,
          "signature": "pub fn record_generation_success(&mut self);",
          "documentation": "Records a successful generation call.\n\nUpdates `generation_success_rate` and `error_rate` based on the\nrunning totals of successes and failures. Updates the\n`last_updated` timestamp.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_generation_success();\nassert!((profile.generation_success_rate - 1.0).abs() < f64::EPSILON);\nassert!((profile.error_rate - 0.0).abs() < f64::EPSILON);\n```"
        },
        {
          "name": "::HealthProfile::record_generation_failure",
          "line": 379,
          "signature": "pub fn record_generation_failure(&mut self);",
          "documentation": "Records a failed generation call.\n\nUpdates `generation_success_rate` and `error_rate` based on the\nrunning totals of successes and failures. Also increments `error_count`.\nUpdates the `last_updated` timestamp.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\n\nlet mut profile = HealthProfile::new();\nprofile.record_generation_failure();\nassert!((profile.generation_success_rate - 0.0).abs() < f64::EPSILON);\nassert!((profile.error_rate - 1.0).abs() < f64::EPSILON);\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/reporting.rs",
      "sha256": "276e226f17937aaf4371b91a8521761444372d7a7a6df4eaaea8531724489b8a",
      "artifactSha256": "79899e3af53b166b35bb37e368e4a60bebbe56c3f2d50741d39a0505681b8fd1",
      "url": "/reference/source/forge-rs/crates/forge-health/src/reporting.rs.txt",
      "declarations": [
        {
          "name": "::HealthStatus",
          "line": 68,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\n#[serde(tag = \"status\", rename_all = \"snake_case\")]\npub enum HealthStatus {\n    /// All metrics are within acceptable thresholds.\n    Healthy,\n\n    /// One or more metrics are approaching thresholds.\n    ///\n    /// The agent is functional but may need attention. Each reason describes\n    /// a specific metric that is outside the normal range.\n    Degraded {\n        /// Human-readable descriptions of the metrics causing degradation.\n        reasons: Vec<String>,\n    },\n\n    /// One or more metrics have exceeded critical thresholds.\n    ///\n    /// The agent may be unable to perform work reliably. Each reason describes\n    /// a specific metric that has exceeded its critical threshold.\n    Critical {\n        /// Human-readable descriptions of the metrics causing critical status.\n        reasons: Vec<String>,\n    },\n}",
          "documentation": "The assessed health status of an agent.\n\nHealth status is determined by the [`crate::monitoring::HealthMonitor`]\nbased on configurable thresholds. The three levels are:\n\n- **Healthy** \u2014 All metrics within acceptable thresholds.\n- **Degraded** \u2014 One or more metrics approaching thresholds; the agent is\n  functional but may need attention.\n- **Critical** \u2014 One or more metrics exceeded critical thresholds; the agent\n  may be unable to perform work reliably.\n\n# Serialization\n\nSerializes as a tagged enum with a `\"status\"` discriminator:\n```json\n{ \"status\": \"healthy\" }\n{ \"status\": \"degraded\", \"reasons\": [\"CPU usage at 89.5%\"] }\n{ \"status\": \"critical\", \"reasons\": [\"memory usage 4.2GB exceeds 4.0GB limit\"] }\n```\n\n# Examples\n\n```\nuse forge_health::reporting::HealthStatus;\n\nlet status = HealthStatus::Degraded {\n    reasons: vec![\"CPU usage at 89.5%\".to_string()],\n};\nassert!(matches!(status, HealthStatus::Degraded { .. }));\n```"
        },
        {
          "name": "::HealthStatus::is_healthy",
          "line": 102,
          "signature": "pub fn is_healthy(&self) -> bool;",
          "documentation": "Returns `true` if the status is `Healthy`.\n\n# Examples\n\n```\nuse forge_health::reporting::HealthStatus;\n\nassert!(HealthStatus::Healthy.is_healthy());\nassert!(!HealthStatus::Degraded { reasons: vec![] }.is_healthy());\n```"
        },
        {
          "name": "::HealthStatus::is_critical",
          "line": 119,
          "signature": "pub fn is_critical(&self) -> bool;",
          "documentation": "Returns `true` if the status is `Critical`.\n\n# Examples\n\n```\nuse forge_health::reporting::HealthStatus;\n\nlet critical = HealthStatus::Critical {\n    reasons: vec![\"out of memory\".to_string()],\n};\nassert!(critical.is_critical());\nassert!(!HealthStatus::Healthy.is_critical());\n```"
        },
        {
          "name": "::HealthStatus::reasons",
          "line": 140,
          "signature": "pub fn reasons(&self) -> &[String];",
          "documentation": "Returns the list of reasons, or an empty slice if healthy.\n\n# Returns\n\nA slice of reason strings. Empty for `Healthy` status.\n\n# Examples\n\n```\nuse forge_health::reporting::HealthStatus;\n\nlet status = HealthStatus::Degraded {\n    reasons: vec![\"high latency\".to_string()],\n};\nassert_eq!(status.reasons().len(), 1);\nassert_eq!(HealthStatus::Healthy.reasons().len(), 0);\n```"
        },
        {
          "name": "::HealthReport",
          "line": 177,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct HealthReport {\n/// The assessed health status.\n\npub status: HealthStatus,\n/// The current health profile metrics.\n\npub profile: HealthProfile,\n/// The current lifecycle state of the agent.\n\npub lifecycle_state: LifecycleState,\n/// Timestamp when this report was generated.\n\npub generated_at: Timestamp\n}",
          "documentation": "A structured health report combining status, profile, and lifecycle state.\n\nHealth reports are the primary output of the health monitoring system.\nThey are used for:\n- Audit trail entries (signed by the agent's Ed25519 key)\n- Telemetry emission (health check spans)\n- External health check endpoints (e.g., HTTP `/health`)\n- Lifecycle decision-making (auto-suspend on critical status)\n\n# Examples\n\n```\nuse forge_health::lifecycle::LifecycleState;\nuse forge_health::profile::HealthProfile;\nuse forge_health::reporting::{HealthReport, HealthStatus};\n\nlet mut profile = HealthProfile::new();\nprofile.record_tool_invocation();\n\nlet report = HealthReport::new(\n    HealthStatus::Healthy,\n    profile,\n    LifecycleState::Running,\n);\n\nlet json = serde_json::to_string_pretty(&report).unwrap();\nassert!(json.contains(\"healthy\"));\n```"
        },
        {
          "name": "::HealthReport::new",
          "line": 218,
          "signature": "pub fn new(\n        status: HealthStatus,\n        profile: HealthProfile,\n        lifecycle_state: LifecycleState,\n    ) -> Self;",
          "documentation": "Creates a new health report.\n\n# Arguments\n\n* `status` - The assessed [`HealthStatus`].\n* `profile` - A snapshot of the current [`HealthProfile`].\n* `lifecycle_state` - The current [`LifecycleState`].\n\n# Returns\n\nA new `HealthReport` with `generated_at` set to the current time.\n\n# Examples\n\n```\nuse forge_health::lifecycle::LifecycleState;\nuse forge_health::profile::HealthProfile;\nuse forge_health::reporting::{HealthReport, HealthStatus};\n\nlet report = HealthReport::new(\n    HealthStatus::Healthy,\n    HealthProfile::new(),\n    LifecycleState::Running,\n);\nassert!(report.status.is_healthy());\n```"
        },
        {
          "name": "::derive_health_status",
          "line": 264,
          "signature": "pub fn derive_health_status(profile: &HealthProfile) -> HealthStatus;",
          "documentation": "Derives a [`HealthStatus`] from a health profile per ANVIL Spec section 12.2.\n\nThis function evaluates the profile's `error_rate` and `cpu_usage_percent` against\nthe thresholds defined in the ANVIL specification:\n\n- **Critical** if `error_rate > 0.5` OR `cpu_usage_percent > 95.0`\n- **Degraded** if `error_rate > 0.1` OR `cpu_usage_percent > 80.0`\n- **Healthy** otherwise\n\n# Arguments\n\n* `profile` - A reference to the [`HealthProfile`] to evaluate.\n\n# Returns\n\nA [`HealthStatus`] assessment based on the profile metrics.\n\n# Examples\n\n```\nuse forge_health::profile::HealthProfile;\nuse forge_health::reporting::{derive_health_status, HealthStatus};\n\nlet profile = HealthProfile::new();\nlet status = derive_health_status(&profile);\nassert!(matches!(status, HealthStatus::Healthy));\n\nlet mut high_error = HealthProfile::new();\nhigh_error.error_rate = 0.6;\nlet status = derive_health_status(&high_error);\nassert!(matches!(status, HealthStatus::Critical { .. }));\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-health/src/summary.rs",
      "sha256": "2489e536c5bc7e4cdbe188f5dd8978cec8d3121f2829ccd749a0d21fb3ad0ffc",
      "artifactSha256": "da2f6a6cf8ccb03395fec0bb696e5579ca1eb7404259da2140b6115e8961e57c",
      "url": "/reference/source/forge-rs/crates/forge-health/src/summary.rs.txt",
      "declarations": [
        {
          "name": "::AgentHealthSnapshot",
          "line": 82,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct AgentHealthSnapshot {\n/// The agent's identifier (OAS DID or human-readable name).\n\npub agent_id: String,\n/// The agent's current lifecycle state.\n\npub lifecycle_state: LifecycleState,\n/// The agent's current health status.\n\npub health_status: HealthStatus,\n/// Number of currently active tasks.\n\npub active_tasks: u32,\n/// Current success rate (0.0 to 1.0) from the agent's latency tracker.\n\npub success_rate: f64\n}",
          "documentation": "A point-in-time health snapshot for a single agent.\n\nThis is the input to [`RuntimeHealthSummary::from_snapshots`]. Each\nsnapshot captures the essential health dimensions of one agent at\nthe moment of collection.\n\n# Examples\n\n```\nuse forge_health::summary::AgentHealthSnapshot;\nuse forge_health::reporting::HealthStatus;\nuse forge_health::lifecycle::LifecycleState;\n\nlet snapshot = AgentHealthSnapshot {\n    agent_id: \"coder-1\".to_string(),\n    lifecycle_state: LifecycleState::Running,\n    health_status: HealthStatus::Healthy,\n    active_tasks: 3,\n    success_rate: 0.97,\n};\nassert_eq!(snapshot.agent_id, \"coder-1\");\n```"
        },
        {
          "name": "::RuntimeHealthSummary",
          "line": 111,
          "signature": "#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct RuntimeHealthSummary {\n/// Total number of agents included in this summary.\n\npub total_agents: u32,\n/// Number of agents with `HealthStatus::Healthy`.\n\npub healthy_count: u32,\n/// Number of agents with `HealthStatus::Degraded`.\n\npub degraded_count: u32,\n/// Number of agents with `HealthStatus::Critical`.\n\npub critical_count: u32,\n/// Count of agents per lifecycle state.\n\npub lifecycle_counts: LifecycleStateCounts,\n/// Total active tasks across all agents.\n\npub total_active_tasks: u64,\n/// Mean success rate across all agents (0.0 to 1.0).\n\n/// NaN-safe: returns 0.0 if no agents are included.\n\npub mean_success_rate: f64,\n/// Agent IDs currently in degraded state.\n\npub degraded_agents: Vec<String>,\n/// Agent IDs currently in critical state.\n\npub critical_agents: Vec<String>,\n/// Timestamp when this summary was generated.\n\npub generated_at: Timestamp\n}",
          "documentation": "Aggregate health view across multiple agents.\n\nProvides fleet-level statistics computed from individual agent snapshots.\nThis is the primary output consumed by dashboards, monitoring systems,\nand organizational health checks.\n\n# Examples\n\n```\nuse forge_health::summary::RuntimeHealthSummary;\n\nlet summary = RuntimeHealthSummary::empty();\nassert_eq!(summary.total_agents, 0);\nassert_eq!(summary.healthy_count, 0);\n```"
        },
        {
          "name": "::LifecycleStateCounts",
          "line": 156,
          "signature": "#[derive(Debug, Clone, Default, Serialize, Deserialize)]\npub struct LifecycleStateCounts {\n/// Agents in `Initializing` state.\n\npub initializing: u32,\n/// Agents in `Ready` state.\n\npub ready: u32,\n/// Agents in `Running` state.\n\npub running: u32,\n/// Agents in `Paused` state.\n\npub paused: u32,\n/// Agents in `Error` state.\n\npub error: u32,\n/// Agents in `Terminated` state.\n\npub terminated: u32\n}",
          "documentation": "Counts of agents per lifecycle state.\n\n# Examples\n\n```\nuse forge_health::summary::LifecycleStateCounts;\n\nlet counts = LifecycleStateCounts::empty();\nassert_eq!(counts.running, 0);\nassert_eq!(counts.paused, 0);\n```"
        },
        {
          "name": "::LifecycleStateCounts::empty",
          "line": 173,
          "signature": "pub fn empty() -> Self;",
          "documentation": "Returns counts with all values at zero."
        },
        {
          "name": "::RuntimeHealthSummary::empty",
          "line": 206,
          "signature": "pub fn empty() -> Self;",
          "documentation": "Returns an empty summary with all counters at zero.\n\n# Returns\n\nA `RuntimeHealthSummary` with zero agents and zero counters.\n\n# Examples\n\n```\nuse forge_health::summary::RuntimeHealthSummary;\n\nlet summary = RuntimeHealthSummary::empty();\nassert_eq!(summary.total_agents, 0);\nassert!(summary.degraded_agents.is_empty());\n```"
        },
        {
          "name": "::RuntimeHealthSummary::from_snapshots",
          "line": 253,
          "signature": "pub fn from_snapshots(snapshots: &[AgentHealthSnapshot]) -> Self;",
          "documentation": "Builds a summary from a slice of agent health snapshots.\n\nComputes aggregate statistics across all agents in the input.\n\n# Arguments\n\n* `snapshots` - A slice of [`AgentHealthSnapshot`] values, one per agent.\n\n# Returns\n\nA `RuntimeHealthSummary` aggregating all snapshot data.\n\n# Examples\n\n```\nuse forge_health::summary::{AgentHealthSnapshot, RuntimeHealthSummary};\nuse forge_health::reporting::HealthStatus;\nuse forge_health::lifecycle::LifecycleState;\n\nlet snapshots = vec![\n    AgentHealthSnapshot {\n        agent_id: \"a1\".to_string(),\n        lifecycle_state: LifecycleState::Running,\n        health_status: HealthStatus::Healthy,\n        active_tasks: 1,\n        success_rate: 0.95,\n    },\n];\nlet summary = RuntimeHealthSummary::from_snapshots(&snapshots);\nassert_eq!(summary.total_agents, 1);\nassert_eq!(summary.healthy_count, 1);\n```"
        },
        {
          "name": "::RuntimeHealthSummary::all_healthy",
          "line": 323,
          "signature": "pub fn all_healthy(&self) -> bool;",
          "documentation": "Returns `true` if all agents are healthy.\n\n# Examples\n\n```\nuse forge_health::summary::RuntimeHealthSummary;\n\nlet summary = RuntimeHealthSummary::empty();\nassert!(summary.all_healthy());\n```"
        },
        {
          "name": "::RuntimeHealthSummary::has_critical",
          "line": 337,
          "signature": "pub fn has_critical(&self) -> bool;",
          "documentation": "Returns `true` if any agent is in critical state.\n\n# Examples\n\n```\nuse forge_health::summary::RuntimeHealthSummary;\n\nlet summary = RuntimeHealthSummary::empty();\nassert!(!summary.has_critical());\n```"
        }
      ]
    }
  ]
}
