Download src/utils/computerUse/swiftLoader.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 925 Bytes
-
https://huggingface.co/chenbhao/codev/resolve/714ab7d15ffd78992a4c3d4e2bf153c2f62f4841/src/utils/computerUse/swiftLoader.ts
- Command line
-
hf download hf://chenbhao/codev@714ab7d15ffd78992a4c3d4e2bf153c2f62f4841/src/utils/computerUse/swiftLoader.ts
-
curl -L -o swiftLoader.ts https://huggingface.co/chenbhao/codev/resolve/714ab7d15ffd78992a4c3d4e2bf153c2f62f4841/src/utils/computerUse/swiftLoader.ts
925 Bytes
| import type { ComputerUseAPI } from '@ant/computer-use-swift' | |
| let cached: ComputerUseAPI | undefined | |
| /** | |
| * Package's js/index.js reads COMPUTER_USE_SWIFT_NODE_PATH (baked by | |
| * build-with-plugins.ts on darwin targets, unset otherwise — falls through to | |
| * the node_modules prebuilds/ path). We cache the loaded native module. | |
| * | |
| * The four @MainActor methods (captureExcluding, captureRegion, | |
| * apps.listInstalled, resolvePrepareCapture) dispatch to DispatchQueue.main | |
| * and will hang under libuv unless CFRunLoop is pumped — call sites wrap | |
| * these in drainRunLoop(). | |
| */ | |
| export function requireComputerUseSwift(): ComputerUseAPI { | |
| if (process.platform !== 'darwin') { | |
| throw new Error('@ant/computer-use-swift is macOS-only') | |
| } | |
| // eslint-disable-next-line @typescript-eslint/no-require-imports | |
| return (cached ??= require('@ant/computer-use-swift') as ComputerUseAPI) | |
| } | |
| export type { ComputerUseAPI } | |