mio-agent-runtime 0.3.13 → 0.3.14
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/opencode.js +16 -2
- package/package.json +1 -1
package/adapters/opencode.js
CHANGED
|
@@ -74,6 +74,17 @@ function ensureGlobalInstructions() {
|
|
|
74
74
|
return { changed: true, target, backup }
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
function configNeedsRepair(serverScript) {
|
|
78
|
+
const config = readConfig()
|
|
79
|
+
const mcp = config && config.mcp && config.mcp['mio-intelligence']
|
|
80
|
+
if (!mcp) return false
|
|
81
|
+
const command = mcp.command
|
|
82
|
+
if (!Array.isArray(command) || command.length < 2) return true
|
|
83
|
+
const configured = String(command[1]).replace(/\\/g, '/').toLowerCase()
|
|
84
|
+
const needle = String(serverScript).replace(/\\/g, '/').toLowerCase()
|
|
85
|
+
return configured !== needle
|
|
86
|
+
}
|
|
87
|
+
|
|
77
88
|
function isInstalled() {
|
|
78
89
|
const config = readConfig()
|
|
79
90
|
if (!config || !config.mcp || !config.mcp['mio-intelligence']) return false
|
|
@@ -85,11 +96,12 @@ function install({ node, serverScript, home, workspace, project }) {
|
|
|
85
96
|
const target = configPath()
|
|
86
97
|
const config = readConfig() || {}
|
|
87
98
|
const configInstalled = Boolean(config.mcp && config.mcp['mio-intelligence'])
|
|
99
|
+
const needsRepair = configInstalled && configNeedsRepair(serverScript)
|
|
88
100
|
|
|
89
101
|
let configChanged = false
|
|
90
102
|
let backup = null
|
|
91
103
|
|
|
92
|
-
if (!configInstalled) {
|
|
104
|
+
if (!configInstalled || needsRepair) {
|
|
93
105
|
backup = `${target}.bak-mio-${Date.now()}`
|
|
94
106
|
if (fs.existsSync(target)) {
|
|
95
107
|
fs.copyFileSync(target, backup)
|
|
@@ -129,6 +141,8 @@ function install({ node, serverScript, home, workspace, project }) {
|
|
|
129
141
|
let message
|
|
130
142
|
if (configChanged && instructionsResult.changed) {
|
|
131
143
|
message = 'OpenCode Mio MCP installed and global Mio rules injected into AGENTS.md. Restart OpenCode to load them.'
|
|
144
|
+
} else if (needsRepair && !instructionsResult.changed) {
|
|
145
|
+
message = 'OpenCode Mio MCP repaired (server path updated). Restart OpenCode to load it.'
|
|
132
146
|
} else if (instructionsResult.changed) {
|
|
133
147
|
message = 'OpenCode Mio MCP already installed. Injected global Mio rules into AGENTS.md. Restart OpenCode to load them.'
|
|
134
148
|
} else {
|
|
@@ -147,4 +161,4 @@ function install({ node, serverScript, home, workspace, project }) {
|
|
|
147
161
|
}
|
|
148
162
|
}
|
|
149
163
|
|
|
150
|
-
module.exports = { configPath, globalInstructionsPath, isInstalled, install }
|
|
164
|
+
module.exports = { configPath, globalInstructionsPath, isInstalled, install, configNeedsRepair }
|