import CoreGraphics /// Which macOS TCC permissions the current process holds. /// /// `listen` is Input Monitoring (needed to observe key events), `post` is /// Accessibility (needed to inject events and to run a swallowing tap). public struct PermissionState: Equatable, Sendable { /// Input Monitoring granted. public let listen: Bool /// Accessibility granted. public let post: Bool /// True when both permissions are granted. public var isComplete: Bool { listen && post } } /// The one wrapper around the `CGPreflight*EventAccess` C API (CLAUDE.md, /// Swift standards: C APIs are wrapped once). Only *preflight* lives here; /// requesting is the `event-tap` lane's job, and never happens on an agent's /// own initiative (CLAUDE.md, Workflow). public enum Permissions { /// Reads the current grants without prompting the user. public static func preflight() -> PermissionState { PermissionState( listen: CGPreflightListenEventAccess(), post: CGPreflightPostEventAccess()) } }