fix(computer-use): prevent repeated screen recording prompts (#13427)

This commit is contained in:
Jinwoo Hong
2026-08-09 20:20:36 -07:00
committed by GitHub
parent bdd763188f
commit 6e63bbbb52
6 changed files with 32 additions and 213 deletions
@@ -41,33 +41,4 @@ public enum PermissionTrustSettling {
waitedMs += interval
}
}
public static func settleWithFallback(
initialTimeoutMs: Int = defaultTimeoutMs,
finalTimeoutMs: Int,
intervalMs: Int = defaultIntervalMs,
sleepMs: (Int) -> Void = { interval in
Thread.sleep(forTimeInterval: TimeInterval(interval) / 1_000)
},
probe: () -> Bool,
fallbackProbe: () -> Bool
) -> Bool {
if settle(
timeoutMs: initialTimeoutMs,
intervalMs: intervalMs,
sleepMs: sleepMs,
probe: probe
).settled {
return true
}
if fallbackProbe() {
return true
}
return settle(
timeoutMs: finalTimeoutMs,
intervalMs: intervalMs,
sleepMs: sleepMs,
probe: probe
).settled
}
}
@@ -1,22 +0,0 @@
public struct ScreenCaptureProbeWindow: Equatable {
public let layer: Int
public let ownerPid: Int32
public let windowId: UInt32
public init(layer: Int, ownerPid: Int32, windowId: UInt32) {
self.layer = layer
self.ownerPid = ownerPid
self.windowId = windowId
}
}
public enum ScreenCaptureProbeWindowSelection {
public static func firstCrossProcessNormalWindow(
ownPid: Int32,
windows: [ScreenCaptureProbeWindow]
) -> UInt32? {
windows.first { window in
window.layer == 0 && window.ownerPid != ownPid
}?.windowId
}
}