MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / findBrowser

Function findBrowser

packages/cli/src/browser/manager.ts:273–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271 * Resolution: env var -> cached download -> system Chrome.
272 */
273export async function findBrowser(): Promise<BrowserResult | undefined> {
274 const fromEnv = findFromEnv();
275 if (fromEnv) return fromEnv;
276
277 const fromCache = await findFromCache();
278 if (fromCache.result) return fromCache.result;
279 if (fromCache.staleHyperframesCachePath) {
280 console.warn(
281 `[browser] Cached binary missing at ${fromCache.staleHyperframesCachePath} — re-downloading...`,
282 );
283 try {
284 return await downloadBrowser();
285 } catch (err) {
286 const cause = normalizeErrorMessage(err);
287 throw new Error(
288 `Cached Chrome binary was missing at ${fromCache.staleHyperframesCachePath}, and re-download failed: ${cause}\n` +
289 `Run \`hyperframes browser ensure --force\` to re-download.`,
290 );
291 }
292 }
293
294 const fromSystem = findFromSystem();
295 if (fromSystem) {
296 warnSystemFallbackOnce(fromSystem.executablePath);
297 }
298 return fromSystem;
299}
300
301/**
302 * On Linux ARM64, attempt to auto-install system Chromium if not found.

Callers 5

ensureLinuxArmBrowserFunction · 0.85
checkChromeFunction · 0.85
manager.test.tsFile · 0.85
runEnsureFunction · 0.85
runPathFunction · 0.85

Calls 7

findFromCacheFunction · 0.85
downloadBrowserFunction · 0.85
warnSystemFallbackOnceFunction · 0.85
warnMethod · 0.80
findFromEnvFunction · 0.70
findFromSystemFunction · 0.70
normalizeErrorMessageFunction · 0.50

Tested by

no test coverage detected