mio-agent-runtime 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/hermes.js +14 -3
- package/package.json +1 -1
package/adapters/hermes.js
CHANGED
|
@@ -7,10 +7,20 @@ const { spawnSync } = require('child_process')
|
|
|
7
7
|
|
|
8
8
|
const SERVER_NAME = 'mio-intelligence'
|
|
9
9
|
|
|
10
|
+
function hermesHome() {
|
|
11
|
+
return process.env.HERMES_HOME || path.join(os.homedir(), 'AppData', 'Local', 'hermes')
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
function hermesBin() {
|
|
11
15
|
if (process.env.HERMES_BIN && fs.existsSync(process.env.HERMES_BIN)) return process.env.HERMES_BIN
|
|
16
|
+
const home = hermesHome()
|
|
12
17
|
const candidates = [
|
|
13
|
-
|
|
18
|
+
// Official Windows native install: venv script registered on User PATH
|
|
19
|
+
path.join(home, 'hermes-agent', 'venv', 'Scripts', 'hermes.exe'),
|
|
20
|
+
// Newer installer shim under <LocalAppData>/hermes/bin
|
|
21
|
+
path.join(home, 'bin', 'hermes.cmd'),
|
|
22
|
+
// Legacy layout
|
|
23
|
+
path.join(home, 'hermes-agent', 'bin', 'hermes.exe'),
|
|
14
24
|
path.join(os.homedir(), '.hermes', 'bin', 'hermes.exe'),
|
|
15
25
|
]
|
|
16
26
|
for (const c of candidates) {
|
|
@@ -26,8 +36,9 @@ function runHermes(args) {
|
|
|
26
36
|
const input = args[0] === 'mcp' && args[1] === 'add' ? 'Y\n' : undefined
|
|
27
37
|
let res
|
|
28
38
|
try {
|
|
39
|
+
const isCmdShim = Boolean(bin && /\.(cmd|bat)$/i.test(bin))
|
|
29
40
|
res = bin
|
|
30
|
-
? spawnSync(bin, args, { encoding: 'utf8', timeout: 60000, windowsHide: true, input: input })
|
|
41
|
+
? spawnSync(bin, args, { encoding: 'utf8', timeout: 60000, windowsHide: true, input: input, shell: isCmdShim })
|
|
31
42
|
: spawnSync('hermes', args, { encoding: 'utf8', timeout: 60000, shell: true, windowsHide: true, input: input })
|
|
32
43
|
} catch (_) {
|
|
33
44
|
return null
|
|
@@ -87,4 +98,4 @@ function isHermesOnPath() {
|
|
|
87
98
|
}
|
|
88
99
|
}
|
|
89
100
|
|
|
90
|
-
module.exports = { hermesBin, isInstalled, install }
|
|
101
|
+
module.exports = { hermesBin, isInstalled, install }
|