Public declaration syntax from forge-swift/Sources/ForgeHealth/Profile.swift Original source SHA-256: 0a4fc28566ba54e6c81a8ff1ab88fb8e48668b8d5bf1f74894e87d7c5d7443b5 Function bodies and constant values are omitted. This is not the complete implementation. Source line 26 public struct HealthProfile: Codable, Sendable, Equatable Source line 28 public var createdAt: Timestamp /// Total uptime of the agent in seconds. public var uptimeSeconds: UInt64 /// Total number of tool invocations. public var toolInvocations: UInt64 /// Total number of successful tool invocations. public var toolSuccesses: UInt64 /// Total number of failed tool invocations. public var toolFailures: UInt64 /// Total number of inference calls. public var inferenceCalls: UInt64 /// Total tokens consumed across all inference calls. public var totalTokens: UInt64 /// Total number of errors encountered. public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 Source line 30 public var uptimeSeconds: UInt64 /// Total number of tool invocations. public var toolInvocations: UInt64 /// Total number of successful tool invocations. public var toolSuccesses: UInt64 /// Total number of failed tool invocations. public var toolFailures: UInt64 /// Total number of inference calls. public var inferenceCalls: UInt64 /// Total tokens consumed across all inference calls. public var totalTokens: UInt64 /// Total number of errors encountered. public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// Source line 32 public var toolInvocations: UInt64 /// Total number of successful tool invocations. public var toolSuccesses: UInt64 /// Total number of failed tool invocations. public var toolFailures: UInt64 /// Total number of inference calls. public var inferenceCalls: UInt64 /// Total tokens consumed across all inference calls. public var totalTokens: UInt64 /// Total number of errors encountered. public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 Source line 34 public var toolSuccesses: UInt64 /// Total number of failed tool invocations. public var toolFailures: UInt64 /// Total number of inference calls. public var inferenceCalls: UInt64 /// Total tokens consumed across all inference calls. public var totalTokens: UInt64 /// Total number of errors encountered. public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// Source line 36 public var toolFailures: UInt64 /// Total number of inference calls. public var inferenceCalls: UInt64 /// Total tokens consumed across all inference calls. public var totalTokens: UInt64 /// Total number of errors encountered. public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double Source line 38 public var inferenceCalls: UInt64 /// Total tokens consumed across all inference calls. public var totalTokens: UInt64 /// Total number of errors encountered. public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double Source line 40 public var totalTokens: UInt64 /// Total number of errors encountered. public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// Source line 42 public var errorCount: UInt64 /// Total number of lifecycle transitions. public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double Source line 44 public var lifecycleTransitions: UInt64 /// Current CPU usage as a percentage (0.0 to 100.0). public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// Source line 46 public var cpuUsagePercent: Double /// Current memory usage in bytes. public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. public var generationSuccessRate: Double Source line 48 public var memoryUsageBytes: UInt64 /// Number of currently active (in-flight) tasks. /// /// Incremented by `recordTaskStarted`, decremented by `recordTaskCompleted`. /// This gauge can reach zero and will not go below zero (saturating subtraction). public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. public var generationSuccessRate: Double /// Timestamp of the last profile update. public var lastUpdated: Timestamp Source line 53 public var activeTasks: UInt32 /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. public var generationSuccessRate: Double /// Timestamp of the last profile update. public var lastUpdated: Timestamp /// Internal counter for generation successes (used to compute rates). private var generationSuccesses: UInt64 /// Internal counter for generation failures (used to compute rates). private var generationFailures: UInt64 Source line 57 public var completedTasks: UInt64 /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. public var generationSuccessRate: Double /// Timestamp of the last profile update. public var lastUpdated: Timestamp /// Internal counter for generation successes (used to compute rates). private var generationSuccesses: UInt64 /// Internal counter for generation failures (used to compute rates). private var generationFailures: UInt64 /// Creates a new health profile with zeroed counters and the given creation time. public init() Source line 61 public var errorRate: Double /// Average latency of completed operations in milliseconds. public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. public var generationSuccessRate: Double /// Timestamp of the last profile update. public var lastUpdated: Timestamp /// Internal counter for generation successes (used to compute rates). private var generationSuccesses: UInt64 /// Internal counter for generation failures (used to compute rates). private var generationFailures: UInt64 /// Creates a new health profile with zeroed counters and the given creation time. public init() Source line 63 public var avgLatencyMs: Double /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. public var generationSuccessRate: Double /// Timestamp of the last profile update. public var lastUpdated: Timestamp /// Internal counter for generation successes (used to compute rates). private var generationSuccesses: UInt64 /// Internal counter for generation failures (used to compute rates). private var generationFailures: UInt64 /// Creates a new health profile with zeroed counters and the given creation time. public init() Source line 67 public var toolSuccessRate: Double /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. public var generationSuccessRate: Double /// Timestamp of the last profile update. public var lastUpdated: Timestamp /// Internal counter for generation successes (used to compute rates). private var generationSuccesses: UInt64 /// Internal counter for generation failures (used to compute rates). private var generationFailures: UInt64 /// Creates a new health profile with zeroed counters and the given creation time. public init() Source line 71 public var generationSuccessRate: Double /// Timestamp of the last profile update. public var lastUpdated: Timestamp /// Internal counter for generation successes (used to compute rates). private var generationSuccesses: UInt64 /// Internal counter for generation failures (used to compute rates). private var generationFailures: UInt64 /// Creates a new health profile with zeroed counters and the given creation time. public init() Source line 73 public var lastUpdated: Timestamp /// Internal counter for generation successes (used to compute rates). private var generationSuccesses: UInt64 /// Internal counter for generation failures (used to compute rates). private var generationFailures: UInt64 /// Creates a new health profile with zeroed counters and the given creation time. public init() Source line 81 public init() Source line 108 public mutating func recordToolInvocation(success: Bool; Source line 122 public mutating func recordInference(tokens: UInt64) Source line 129 public mutating func recordError() Source line 135 public mutating func recordLifecycleTransition() Source line 147 public mutating func updateResources(cpu: Double, memory: UInt64) Source line 156 public mutating func updateUptime(_ seconds: UInt64) Source line 164 public mutating func recordTaskStarted() Source line 175 public mutating func recordTaskCompleted() Source line 187 public mutating func recordGenerationSuccess() Source line 197 public mutating func recordGenerationFailure() Source line 207 public var averageTokensPerCall: Double?