* Enumerate installed apps, timed. Fails soft — if Spotlight is slow or * claude-swift throws, the tool description just omits the list. Resolution * happens at call time regardless; the model just doesn't get hints.
()
| 23 | * happens at call time regardless; the model just doesn't get hints. |
| 24 | */ |
| 25 | async function tryGetInstalledAppNames(): Promise<string[] | undefined> { |
| 26 | const adapter = getComputerUseHostAdapter() |
| 27 | const enumP = adapter.executor.listInstalledApps() |
| 28 | let timer: ReturnType<typeof setTimeout> | undefined |
| 29 | const timeoutP = new Promise<undefined>(resolve => { |
| 30 | timer = setTimeout(resolve, APP_ENUM_TIMEOUT_MS, undefined) |
| 31 | }) |
| 32 | const installed = await Promise.race([enumP, timeoutP]) |
| 33 | .catch(() => undefined) |
| 34 | .finally(() => clearTimeout(timer)) |
| 35 | if (!installed) { |
| 36 | // The enumeration continues in the background — swallow late rejections. |
| 37 | void enumP.catch(() => {}) |
| 38 | logForDebugging( |
| 39 | `[Computer Use MCP] app enumeration exceeded ${APP_ENUM_TIMEOUT_MS}ms or failed; tool description omits list`, |
| 40 | ) |
| 41 | return undefined |
| 42 | } |
| 43 | return filterAppsForDescription(installed, homedir()) |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Construct the in-process server. Delegates to the package's |
no test coverage detected