mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-21 03:39:54 +00:00
d208f2c2c0
- chat-messages: match tool rows by overlapping query/context/preview values so preview-first `tool.progress` rows reliably adopt later stable-id `tool.start` payloads instead of spawning ghost rows or mis-merging parallel same-name calls; preserve prior args/result across phases. - tui_gateway: emit full args + parsed result on `tool.start` / `tool.complete`, drop redundant `tool.started` re-emit from `tool.progress`. - electron/main: prefer SOURCE_REPO_ROOT before PATH `hermes` in dev so local backend edits actually run; split hardening helpers into `electron/hardening.cjs` with tests. - thread/tool UI: one-shot enter animation keyed by stable ids, braille spinner for running rows, Cursor-like disclosure rows, drill-down + duration/count formatting via new tool-fallback-model. - composer: extract `text-utils`, drop liquid-glass overrides. - right-rail: split preview-pane into preview-console / preview-file. - runtime: incremental external-store runtime + runtime-readiness gate; onboarding store + tests; route-resume hook test. - regression tests for live tool reconciliation (parallel tools, id-less progress, preview-first rows, structured args/results).
47 lines
2.4 KiB
JavaScript
47 lines
2.4 KiB
JavaScript
const assert = require('node:assert/strict')
|
|
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
const test = require('node:test')
|
|
|
|
const { bundledRuntimeImportCheck, isWindowsBinaryPathInWsl, isWslEnvironment } = require('./bootstrap-platform.cjs')
|
|
|
|
test('isWslEnvironment detects WSL2 env vars on linux', () => {
|
|
assert.equal(isWslEnvironment({ WSL_DISTRO_NAME: 'Ubuntu' }, 'linux'), true)
|
|
assert.equal(isWslEnvironment({ WSL_INTEROP: '/run/WSL/123_interop' }, 'linux'), true)
|
|
assert.equal(isWslEnvironment({}, 'linux'), false)
|
|
assert.equal(isWslEnvironment({ WSL_DISTRO_NAME: 'Ubuntu' }, 'darwin'), false)
|
|
})
|
|
|
|
test('isWindowsBinaryPathInWsl blocks Windows binary types on WSL', () => {
|
|
assert.equal(isWindowsBinaryPathInWsl('/mnt/c/Tools/hermes.exe', { isWsl: true }), true)
|
|
assert.equal(isWindowsBinaryPathInWsl('/mnt/c/Tools/hermes.cmd', { isWsl: true }), true)
|
|
assert.equal(isWindowsBinaryPathInWsl('/mnt/c/Tools/hermes.bat', { isWsl: true }), true)
|
|
assert.equal(isWindowsBinaryPathInWsl('/mnt/c/Tools/install.ps1', { isWsl: true }), true)
|
|
assert.equal(isWindowsBinaryPathInWsl('/usr/local/bin/hermes', { isWsl: true }), false)
|
|
assert.equal(isWindowsBinaryPathInWsl('/mnt/c/Tools/hermes.exe', { isWsl: false }), false)
|
|
})
|
|
|
|
test('bundledRuntimeImportCheck selects platform-specific import checks', () => {
|
|
assert.equal(bundledRuntimeImportCheck('win32'), 'import fastapi, uvicorn, winpty')
|
|
assert.equal(bundledRuntimeImportCheck('darwin'), 'import fastapi, uvicorn, ptyprocess')
|
|
assert.equal(bundledRuntimeImportCheck('linux'), 'import fastapi, uvicorn, ptyprocess')
|
|
})
|
|
|
|
test('packaged electron entrypoints do not require unpackaged npm modules', () => {
|
|
const electronDir = __dirname
|
|
const entrypoints = ['main.cjs', 'preload.cjs', 'bootstrap-platform.cjs']
|
|
const allowedBareRequires = new Set(['electron'])
|
|
const requirePattern = /require\(['"]([^'"]+)['"]\)/g
|
|
|
|
for (const entrypoint of entrypoints) {
|
|
const source = fs.readFileSync(path.join(electronDir, entrypoint), 'utf8')
|
|
const bareRequires = Array.from(source.matchAll(requirePattern))
|
|
.map(match => match[1])
|
|
.filter(specifier => !specifier.startsWith('node:'))
|
|
.filter(specifier => !specifier.startsWith('.'))
|
|
.filter(specifier => !allowedBareRequires.has(specifier))
|
|
|
|
assert.deepEqual(bareRequires, [], `${entrypoint} has unpackaged runtime requires`)
|
|
}
|
|
})
|