Screenshots from implementers

This commit is contained in:
Ian Gulliver
2026-10-18 00:39:04 -07:00
parent bd66538383
commit 0a1f58cafa
9 changed files with 59 additions and 13 deletions
+9 -1
View File
@@ -136,5 +136,13 @@ func capture(window id: Int?, display: Int?, crop: [String: Any]?, maxEdge: Doub
func captureTool(_ args: [String: Any]) async throws -> [Content] {
let shot = try await capture(window: args.int("window"), display: args.int("display"), crop: args.dict("crop"), maxEdge: args.double("max_edge") ?? 1568)
return [.text(shot.note), .png(shot.png)]
guard args.bool("save") else {
return [.text(shot.note), .png(shot.png)]
}
guard let dir = mediaDir else {
throw ToolError("save needs byre's media folder, and this byre-hands has none")
}
let url = URL(filePath: dir).appending(path: "capture-\(UUID().uuidString.prefix(8).lowercased()).png")
try shot.png.write(to: url)
return [.text("\(shot.note); saved to \(url.path)"), .png(shot.png)]
}