mio-agent-runtime 0.3.9 → 0.3.11
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
CHANGED
|
@@ -11,6 +11,23 @@ function hermesHome() {
|
|
|
11
11
|
return process.env.HERMES_HOME || path.join(os.homedir(), 'AppData', 'Local', 'hermes')
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function hermesConfigPath() {
|
|
15
|
+
return path.join(hermesHome(), 'config.yaml')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function configNeedsRepair() {
|
|
19
|
+
const cfg = hermesConfigPath()
|
|
20
|
+
if (!fs.existsSync(cfg)) return false
|
|
21
|
+
try {
|
|
22
|
+
const src = fs.readFileSync(cfg, 'utf8')
|
|
23
|
+
// Legacy installs stored the env pairs as plain args (--env KEY=VALUE)
|
|
24
|
+
// because --env came after --args; Hermes now stores them under env:.
|
|
25
|
+
return /- MIO_DATA_DIR=/.test(src) || /- MIO_CONTEXT=/.test(src)
|
|
26
|
+
} catch (_) {
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
14
31
|
function hermesBin() {
|
|
15
32
|
if (process.env.HERMES_BIN && fs.existsSync(process.env.HERMES_BIN)) return process.env.HERMES_BIN
|
|
16
33
|
const home = hermesHome()
|
|
@@ -61,7 +78,10 @@ function install({ node, serverScript, home, workspace, project }) {
|
|
|
61
78
|
}
|
|
62
79
|
}
|
|
63
80
|
if (isInstalled()) {
|
|
64
|
-
|
|
81
|
+
if (!configNeedsRepair()) {
|
|
82
|
+
return { changed: false, message: 'Hermes Mio MCP already installed.', configPath: null }
|
|
83
|
+
}
|
|
84
|
+
runHermes(['mcp', 'remove', SERVER_NAME])
|
|
65
85
|
}
|
|
66
86
|
|
|
67
87
|
const context = JSON.stringify({
|
|
@@ -71,11 +91,12 @@ function install({ node, serverScript, home, workspace, project }) {
|
|
|
71
91
|
sessionId: 'hermes-session',
|
|
72
92
|
})
|
|
73
93
|
|
|
94
|
+
// Hermes requires --env before --args: --args swallows everything after it.
|
|
74
95
|
const args = [
|
|
75
96
|
'mcp', 'add', SERVER_NAME,
|
|
76
97
|
'--command', node,
|
|
77
|
-
'--args', serverScript,
|
|
78
98
|
'--env', 'MIO_DATA_DIR=' + home, 'MIO_CONTEXT=' + context,
|
|
99
|
+
'--args', serverScript,
|
|
79
100
|
]
|
|
80
101
|
const out = runHermes(args)
|
|
81
102
|
const installed = isInstalled()
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
const fs = require('fs')
|
|
5
5
|
const path = require('path')
|
|
6
|
+
const os = require('os')
|
|
6
7
|
const crypto = require('crypto')
|
|
7
8
|
const readline = require('readline')
|
|
8
9
|
const { execFileSync } = require('child_process')
|
|
@@ -11,7 +12,9 @@ const SERVER_INFO = { name: 'mio-intelligence-mcp', version: '0.1.0' }
|
|
|
11
12
|
const PROTOCOL_VERSION = '2024-11-05'
|
|
12
13
|
|
|
13
14
|
const dataDir = path.resolve(
|
|
14
|
-
process.env.MIO_DATA_DIR ||
|
|
15
|
+
process.env.MIO_DATA_DIR ||
|
|
16
|
+
process.env.MIO_HOME ||
|
|
17
|
+
path.join(os.homedir(), '.mio-intelligence')
|
|
15
18
|
)
|
|
16
19
|
const memoryPath = path.join(dataDir, 'memory.jsonl')
|
|
17
20
|
const tracePath = path.join(dataDir, 'traces.jsonl')
|