()
| 359 | // Uses the same interface so all callsites can use `getInput()` uniformly. |
| 360 | type Input = ReturnType<typeof requireComputerUseInput> |
| 361 | const getInput = (): Input => { |
| 362 | if (isDarwin) return requireComputerUseInput() |
| 363 | const p = platform!.input |
| 364 | return { |
| 365 | moveMouse: (x: number, y: number, _animated: boolean) => p.moveMouse(x, y), |
| 366 | key: (k: string, a: 'press' | 'release') => p.key(k, a), |
| 367 | keys: (parts: string[]) => p.keys(parts), |
| 368 | mouseLocation: () => p.mouseLocation(), |
| 369 | mouseButton: (btn: 'left' | 'right' | 'middle', a: 'click' | 'press' | 'release', count?: number) => |
| 370 | p.click(0, 0, btn), // simplified — real coords handled by caller via moveMouse |
| 371 | mouseScroll: (amount: number, dir: 'vertical' | 'horizontal') => p.scroll(amount, dir), |
| 372 | typeText: (text: string) => p.typeText(text), |
| 373 | getFrontmostAppInfo: () => { |
| 374 | const info = platform!.apps.getFrontmostApp() |
| 375 | return info ? { bundleId: info.id, appName: info.appName } : null |
| 376 | }, |
| 377 | isSupported: true, |
| 378 | } as any as Input |
| 379 | } |
| 380 | |
| 381 | const terminalBundleId = getTerminalBundleId() |
| 382 | const surrogateHost = terminalBundleId ?? CLI_HOST_BUNDLE_ID |
no test coverage detected