Lines 45-82javascript
45const api = val('--api') || process.env.AEGIS_API;
46if (api) process.env.AEGIS_API = api;
47// Credentials for authed scans come ONLY from the environment (never argv, to
48// avoid leaking via the process list). AEGIS_USERNAME / AEGIS_PASSWORD are read
49// by the executor directly.
51// Make sure the browser is actually present before we launch it. We do NOT rely
52// on Playwright's transitive postinstall — it can be silently skipped (npx cache
53// reuse, `--ignore-scripts`, some CI) and then the runner crashes on first scan
54// with "Executable doesn't exist … chrome-headless-shell". `playwright install`
55// is idempotent and fast when the browser is already there, so running it on
56// every start is safe. Opt out with AEGIS_SKIP_BROWSER_INSTALL=1.
59// Running the bundle starts the outbound-only claim+drive loop. Playwright
60// resolves from this package's node_modules.
61await import('./runnerExecutor.mjs');
63function ensureBrowser() {
64 if (process.env.AEGIS_SKIP_BROWSER_INSTALL || process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD) return;
66 // Use THIS package's bundled Playwright (not a global/npx one) so the browser
67 // revision matches the executor exactly.
68 const pkgPath = require.resolve('playwright/package.json');
69 const bin = require(pkgPath).bin;
70 const cliRel = typeof bin === 'string' ? bin : (bin && (bin.playwright || bin['playwright-core']));
71 if (!cliRel) throw new Error('Playwright CLI not found in the bundled install');
72 const cli = path.join(path.dirname(pkgPath), cliRel);
73 console.log('Checking the local browser (first run downloads Chromium ~150MB, then cached)…');
74 const r = spawnSync(process.execPath, [cli, 'install', 'chromium'], { stdio: 'inherit' });
75 if (r.status !== 0) {
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
bin.mjsView on unpkg · L65 76 console.error('[aegis] browser install did not finish cleanly. If a scan fails to launch, run once: npx playwright install chromium');
79 console.error(`[aegis] could not auto-install the browser (${e.message}). Install it once with: npx playwright install chromium`);