()
| 36 | * degraded mode. |
| 37 | */ |
| 38 | export function getComputerUseHostAdapter(): ComputerUseHostAdapter { |
| 39 | if (cached) return cached |
| 40 | cached = { |
| 41 | serverName: COMPUTER_USE_MCP_SERVER_NAME, |
| 42 | logger: new DebugLogger(), |
| 43 | executor: createCliExecutor({ |
| 44 | getMouseAnimationEnabled: () => getChicagoSubGates().mouseAnimation, |
| 45 | getHideBeforeActionEnabled: () => getChicagoSubGates().hideBeforeAction, |
| 46 | }), |
| 47 | ensureOsPermissions: async () => { |
| 48 | const cu = requireComputerUseSwift() |
| 49 | const accessibility = cu.tcc.checkAccessibility() |
| 50 | const screenRecording = cu.tcc.checkScreenRecording() |
| 51 | return accessibility && screenRecording |
| 52 | ? { granted: true } |
| 53 | : { granted: false, accessibility, screenRecording } |
| 54 | }, |
| 55 | isDisabled: () => !getChicagoEnabled(), |
| 56 | getSubGates: getChicagoSubGates, |
| 57 | // cleanup.ts always unhides at turn end — no user preference to disable it. |
| 58 | getAutoUnhideEnabled: () => true, |
| 59 | |
| 60 | // Pixel-validation JPEG decode+crop. MUST be synchronous (the package |
| 61 | // does `patch1.equals(patch2)` directly on the return value). Cowork uses |
| 62 | // Electron's `nativeImage` (sync); our `image-processor-napi` is |
| 63 | // sharp-compatible and async-only. Returning null → validation skipped, |
| 64 | // click proceeds — the designed fallback per `PixelCompareResult.skipped`. |
| 65 | // The sub-gate defaults to false anyway. |
| 66 | cropRawPatch: () => null, |
| 67 | } |
| 68 | return cached |
| 69 | } |
| 70 |
no test coverage detected