(opts: {
allowedBundleIds: string[]
preferredDisplayId?: number
autoResolve: boolean
doHide?: boolean
})
| 425 | }, |
| 426 | |
| 427 | async resolvePrepareCapture(opts: { |
| 428 | allowedBundleIds: string[] |
| 429 | preferredDisplayId?: number |
| 430 | autoResolve: boolean |
| 431 | doHide?: boolean |
| 432 | }): Promise<ResolvePrepareCaptureResult> { |
| 433 | const d = cu.display.getSize(opts.preferredDisplayId) |
| 434 | const [targetW, targetH] = computeTargetDims( |
| 435 | d.width, |
| 436 | d.height, |
| 437 | d.scaleFactor, |
| 438 | ) |
| 439 | const raw = await drainRunLoop(() => |
| 440 | cu.resolvePrepareCapture( |
| 441 | withoutTerminal(opts.allowedBundleIds), |
| 442 | surrogateHost, |
| 443 | SCREENSHOT_JPEG_QUALITY, |
| 444 | targetW, |
| 445 | targetH, |
| 446 | opts.preferredDisplayId, |
| 447 | ), |
| 448 | ) |
| 449 | // Ensure the result has fields expected by toolCalls.ts (hidden, displayId). |
| 450 | // macOS native returns these from Swift; our cross-platform ComputerUseAPI |
| 451 | // returns {base64, width, height} — fill in the missing fields. |
| 452 | const baseResult = raw as Partial<ResolvePrepareCaptureResult> & { |
| 453 | width?: number |
| 454 | height?: number |
| 455 | } |
| 456 | return { |
| 457 | ...raw, |
| 458 | displayWidth: baseResult.displayWidth ?? baseResult.width, |
| 459 | displayHeight: baseResult.displayHeight ?? baseResult.height, |
| 460 | originX: baseResult.originX ?? 0, |
| 461 | originY: baseResult.originY ?? 0, |
| 462 | hidden: baseResult.hidden ?? [], |
| 463 | displayId: |
| 464 | baseResult.displayId ?? opts.preferredDisplayId ?? d.displayId, |
| 465 | } as ResolvePrepareCaptureResult |
| 466 | }, |
| 467 | |
| 468 | /** |
| 469 | * Pre-size to `targetImageSize` output so the API transcoder's early-return |
nothing calls this directly
no test coverage detected