mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-14 14:12:44 +00:00
Main's rewritten test_tui_npm_install.py tests call _make_tui_argv expecting the Ink/npm flow unconditionally; with the dual-engine dispatch merged in, _resolve_tui_engine() auto-selects opentui whenever ui-opentui/dist is built in the repo, routing the call away from the path under test (first subprocess became 'node --version' instead of 'npm run build'). Pin the engine to ink via an autouse fixture, mirroring the existing pinning precedent in test_tui_resume_flow.py.
38 lines
748 B
JavaScript
38 lines
748 B
JavaScript
const path = require('node:path')
|
|
|
|
/** True when `dir` lives inside a packaged app bundle / install tree. */
|
|
function isPackagedInstallPath(dir, { installRoots, isPackaged }) {
|
|
if (!isPackaged || !dir) {
|
|
return false
|
|
}
|
|
|
|
let resolved
|
|
|
|
try {
|
|
resolved = path.resolve(String(dir))
|
|
} catch {
|
|
return false
|
|
}
|
|
|
|
const roots = new Set(
|
|
(installRoots ?? [])
|
|
.filter(Boolean)
|
|
.map(candidate => path.resolve(String(candidate)))
|
|
)
|
|
|
|
for (const root of roots) {
|
|
if (resolved === root) {
|
|
return true
|
|
}
|
|
|
|
const rel = path.relative(root, resolved)
|
|
|
|
if (rel && !rel.startsWith('..') && !path.isAbsolute(rel)) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
module.exports = { isPackagedInstallPath }
|