mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 10:27:33 +00:00
Behind the lock screen (display sleep, screen saver or a manual lock) macOS reports Accessibility as untrusted. Orca read that as a missing permission, and its recovery hint led agents to open System Settings. Check the session lock first and return screen_locked; permission setup refuses while locked.
16 lines
712 B
Swift
16 lines
712 B
Swift
import OrcaComputerUseMacOSCore
|
|
import XCTest
|
|
|
|
final class SessionLockProbeTests: XCTestCase {
|
|
func testTheSessionLockFlagDecides() {
|
|
XCTAssertTrue(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": kCFBooleanTrue as Any]))
|
|
XCTAssertTrue(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": NSNumber(value: 1)]))
|
|
XCTAssertFalse(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": kCFBooleanFalse as Any]))
|
|
}
|
|
|
|
func testAnAbsentKeyOrMissingSessionIsUnlocked() {
|
|
XCTAssertFalse(SessionLockProbe.isLocked(session: ["kCGSSessionOnConsoleKey": NSNumber(value: 1)]))
|
|
XCTAssertFalse(SessionLockProbe.isLocked(session: nil))
|
|
}
|
|
}
|