Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
62 lines
3.3 KiB
JavaScript
62 lines
3.3 KiB
JavaScript
/**
|
|
* Finds a browser already installed on this computer (Chrome, then Edge, then Chromium) for the assistant's browser tool, so nothing
|
|
* big has to be downloaded. Returns the program's path and the name the screen shows.
|
|
*/
|
|
import { existsSync, readdirSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { spawnSync } from 'node:child_process';
|
|
|
|
/** @returns {Array<{name: string, path: string}>} candidate programs for a platform, best first */
|
|
export function browserCandidates(platform = process.platform, env = process.env) {
|
|
if (platform === 'win32') {
|
|
const roots = [env.PROGRAMFILES, env['PROGRAMFILES(X86)'], env.LOCALAPPDATA].filter(Boolean);
|
|
const at = rel => roots.map(r => join(r, rel));
|
|
return [
|
|
...at('Google\\Chrome\\Application\\chrome.exe').map(path => ({ name: 'Google Chrome', path })),
|
|
...at('Microsoft\\Edge\\Application\\msedge.exe').map(path => ({ name: 'Microsoft Edge', path })),
|
|
...at('Chromium\\Application\\chrome.exe').map(path => ({ name: 'Chromium', path })),
|
|
];
|
|
}
|
|
if (platform === 'darwin') {
|
|
return [
|
|
{ name: 'Google Chrome', path: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' },
|
|
{ name: 'Microsoft Edge', path: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge' },
|
|
{ name: 'Chromium', path: '/Applications/Chromium.app/Contents/MacOS/Chromium' },
|
|
];
|
|
}
|
|
return [
|
|
...['/usr/bin/google-chrome', '/usr/bin/google-chrome-stable', '/opt/google/chrome/chrome'].map(path => ({ name: 'Google Chrome', path })),
|
|
...['/usr/bin/microsoft-edge', '/usr/bin/microsoft-edge-stable', '/opt/microsoft/msedge/msedge'].map(path => ({ name: 'Microsoft Edge', path })),
|
|
...['/usr/bin/chromium', '/usr/bin/chromium-browser', '/snap/bin/chromium'].map(path => ({ name: 'Chromium', path })),
|
|
];
|
|
}
|
|
|
|
/** @returns {{found: boolean, name: string|null, path: string|null}} */
|
|
export function findBrowser({ platform = process.platform, env = process.env, exists = existsSync } = {}) {
|
|
const hit = browserCandidates(platform, env).find(c => exists(c.path));
|
|
if (hit) return { found: true, name: hit.name, path: hit.path };
|
|
if (platform === 'linux') {
|
|
for (const [name, bin] of [['Google Chrome', 'google-chrome'], ['Microsoft Edge', 'microsoft-edge'], ['Chromium', 'chromium']]) {
|
|
const r = spawnSync('which', [bin], { encoding: 'utf8' });
|
|
if (r.status === 0 && r.stdout.trim()) return { found: true, name, path: r.stdout.trim() };
|
|
}
|
|
}
|
|
return { found: false, name: null, path: null };
|
|
}
|
|
|
|
/**
|
|
* The browser tool server (Playwright's MCP, MIT/Apache) inside the agent component. The installer ships it next to the Harness; a source
|
|
* checkout of the Harness keeps it under node_modules/.pnpm. Returns the file to run with Node, or null.
|
|
*/
|
|
export function findPlaywrightMcp(harnessDir, { exists = existsSync, list = readdirSync } = {}) {
|
|
if (!harnessDir) return null;
|
|
const direct = join(harnessDir, 'node_modules', '@playwright', 'mcp', 'cli.js');
|
|
if (exists(direct)) return direct;
|
|
try {
|
|
const store = join(harnessDir, 'node_modules', '.pnpm');
|
|
const hit = list(store).filter(n => /^@playwright\+mcp@/.test(n)).sort().at(-1);
|
|
const nested = hit ? join(store, hit, 'node_modules', '@playwright', 'mcp', 'cli.js') : null;
|
|
return nested && exists(nested) ? nested : null;
|
|
} catch { return null; }
|
|
}
|