Let agents show and drive Page view tabs on the iPhone

This commit is contained in:
Ian Gulliver
2026-10-21 22:31:48 -07:00
parent 0efdc8651f
commit caf0a830a9
11 changed files with 48 additions and 23 deletions
+11
View File
@@ -278,6 +278,17 @@ final class Pages {
}
return png
}
#else
func capture(_ view: WKWebView) async throws -> Data {
guard view.window != nil, !view.isHidden else {
throw ApiError(status: 0, message: "the tab isn't on screen: the human has the page view closed or another tab showing")
}
let image = try await view.takeSnapshot(configuration: nil)
guard let png = image.pngData() else {
throw ApiError(status: 0, message: "couldn't encode the capture as PNG")
}
return png
}
#endif
func close() {