(opts: {
allowedBundleIds: string[]
preferredDisplayId?: number
autoResolve: boolean
doHide?: boolean
})
| 471 | }, |
| 472 | |
| 473 | async resolvePrepareCapture(opts: { |
| 474 | allowedBundleIds: string[] |
| 475 | preferredDisplayId?: number |
| 476 | autoResolve: boolean |
| 477 | doHide?: boolean |
| 478 | }): Promise<ResolvePrepareCaptureResult> { |
| 479 | const d = cu.display.getSize(opts.preferredDisplayId) |
| 480 | const [targetW, targetH] = computeTargetDims( |
| 481 | d.width, |
| 482 | d.height, |
| 483 | d.scaleFactor, |
| 484 | ) |
| 485 | const raw = await drainRunLoop(() => |
| 486 | cu.resolvePrepareCapture( |
| 487 | withoutTerminal(opts.allowedBundleIds), |
| 488 | surrogateHost, |
| 489 | SCREENSHOT_JPEG_QUALITY, |
| 490 | targetW, |
| 491 | targetH, |
| 492 | opts.preferredDisplayId, |
| 493 | opts.autoResolve, |
| 494 | opts.doHide, |
| 495 | ), |
| 496 | ) |
| 497 | // Ensure the result has fields expected by toolCalls.ts (hidden, displayId). |
| 498 | // macOS native returns these from Swift; our cross-platform ComputerUseAPI |
| 499 | // returns {base64, width, height} — fill in the missing fields. |
| 500 | return { |
| 501 | ...raw, |
| 502 | hidden: (raw as any).hidden ?? [], |
| 503 | displayId: (raw as any).displayId ?? opts.preferredDisplayId ?? d.displayId, |
| 504 | } |
| 505 | }, |
| 506 | |
| 507 | /** |
| 508 | * Pre-size to `targetImageSize` output so the API transcoder's early-return |
nothing calls this directly
no test coverage detected