mio-agent-runtime 0.3.7 → 0.3.9
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/observe/observer.js +4 -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 }
|
package/observe/observer.js
CHANGED
|
@@ -614,7 +614,7 @@ function runOpencodeQuery(sql) {
|
|
|
614
614
|
try {
|
|
615
615
|
res = bin
|
|
616
616
|
? spawnSync(bin, args, { encoding: 'utf8', timeout: 90000, windowsHide: true, maxBuffer: 256 * 1024 * 1024 })
|
|
617
|
-
: spawnSync('opencode', args, { encoding: 'utf8', timeout: 90000, shell: true, maxBuffer: 256 * 1024 * 1024 })
|
|
617
|
+
: spawnSync('opencode', args, { encoding: 'utf8', timeout: 90000, shell: true, windowsHide: true, maxBuffer: 256 * 1024 * 1024 })
|
|
618
618
|
} catch (_) {
|
|
619
619
|
return null
|
|
620
620
|
}
|
|
@@ -1111,7 +1111,7 @@ function runHermesCycle(home, state, sinks, opts) {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
return out
|
|
1113
1113
|
}
|
|
1114
|
-
|
|
1114
|
+
|
|
1115
1115
|
|
|
1116
1116
|
// ---------------------------------------------------------------------------
|
|
1117
1117
|
// cycle
|
|
@@ -1264,6 +1264,7 @@ function startBackground(home) {
|
|
|
1264
1264
|
detached: true,
|
|
1265
1265
|
stdio: 'ignore',
|
|
1266
1266
|
windowsHide: true,
|
|
1267
|
+
cwd: home,
|
|
1267
1268
|
})
|
|
1268
1269
|
child.unref()
|
|
1269
1270
|
fs.mkdirSync(home, { recursive: true })
|
|
@@ -1302,4 +1303,4 @@ module.exports = {
|
|
|
1302
1303
|
stopBackground,
|
|
1303
1304
|
isRunning,
|
|
1304
1305
|
readPid,
|
|
1305
|
-
}
|
|
1306
|
+
}
|