mio-agent-runtime 0.2.4 → 0.2.6
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/README.md +6 -4
- package/adapters/opencode.js +2 -0
- package/adapters/workbuddy.js +35 -13
- package/package.json +23 -23
package/README.md
CHANGED
|
@@ -31,9 +31,11 @@ mio --json agents Machine-readable agents
|
|
|
31
31
|
running, restart it once so it reloads both files.
|
|
32
32
|
- WorkBuddy uses `~/.workbuddy/mcp.json` and requires each custom MCP server to
|
|
33
33
|
be approved in `~/.workbuddy/mcp-approvals.json`. `mio install workbuddy`
|
|
34
|
-
writes both files and injects Mio usage rules into
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
writes both files and injects Mio usage rules into
|
|
35
|
+
`~/.workbuddy/WORKBUDDY.md` (user-level memory rules, auto-loaded by
|
|
36
|
+
WorkBuddy into every session) plus `<workspace>/AGENTS.md` (project-level).
|
|
37
|
+
If WorkBuddy is already running, restart it once so it reloads the approval
|
|
38
|
+
and memory rule files.
|
|
37
39
|
|
|
38
40
|
## MIO_HOME
|
|
39
41
|
|
|
@@ -51,4 +53,4 @@ packages/mio-cli
|
|
|
51
53
|
├── server/
|
|
52
54
|
│ └── mio-intelligence-mcp/index.js
|
|
53
55
|
└── package.json
|
|
54
|
-
```
|
|
56
|
+
```
|
package/adapters/opencode.js
CHANGED
|
@@ -15,6 +15,8 @@ Mio MCP tools are available. Treat these as mandatory runtime rules for every wo
|
|
|
15
15
|
- After a decision affecting architecture, deployment, dependencies, or long-term behavior, call \`mio-intelligence_mio_memory_record\` with \`kind\`: \`decision\`, \`context\`, \`problem\`, or \`note\`.
|
|
16
16
|
- When a tool call fails, retries, or returns an error, call \`mio-intelligence_mio_observer_ingest\` with a stable \`trace_id\`, relevant \`event_type\`, \`payload\`, and \`outcome\`.
|
|
17
17
|
- Before a high-risk operation such as deletion, migration, credential change, or production change, call \`mio-intelligence_mio_policy_check\` and follow its suggestion when available.
|
|
18
|
+
- At the end of every task, before producing the final answer, call \`mio-intelligence_mio_observer_ingest\` with \`event_type\` = \`task_outcome\`, a stable \`trace_id\`, \`outcome\` = \`success\` / \`failure\` / \`aborted\`, and a brief non-sensitive \`payload\`. If Mio is unavailable, do not block the final answer.
|
|
19
|
+
- When you reuse a prior decision or experience returned by \`mio-intelligence_mio_memory_query\` and it changes your approach or outcome, call \`mio-intelligence_mio_experience_reuse\` with \`sourceAgent\`, \`targetAgent\`, \`experienceId\`, \`reuse\`, \`behaviorChanged\`, and \`outcomeImproved\`.
|
|
18
20
|
- If Mio MCP is unavailable, do not block the task. Continue normally and note the missed memory or observation.
|
|
19
21
|
- Do not store secrets, credentials, or raw sensitive content in Mio memory.
|
|
20
22
|
${INSTRUCTIONS_END}`
|
package/adapters/workbuddy.js
CHANGED
|
@@ -25,8 +25,17 @@ function approvalsPath() {
|
|
|
25
25
|
return path.join(configDir(), 'mcp-approvals.json')
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// User-level memory rules file. WorkBuddy's codebuddy CLI auto-loads
|
|
29
|
+
// WORKBUDDY.md (or WORKBUDDY.mdc) from the config dir into every session
|
|
30
|
+
// (MemoryLoader user scope -> system-reminder-md / prompt context).
|
|
31
|
+
function memoryRulesPath() {
|
|
32
|
+
return path.join(configDir(), 'WORKBUDDY.md')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Project-level memory rules. WorkBuddy walks up from the workspace dir and
|
|
36
|
+
// auto-loads WORKBUDDY.md / AGENTS.md (project scope) into every session.
|
|
37
|
+
function projectInstructionsPath(workspace) {
|
|
38
|
+
return path.join(workspace || process.cwd(), 'AGENTS.md')
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
function readJson(file) {
|
|
@@ -49,12 +58,13 @@ Mio MCP tools are available. Treat these as mandatory runtime rules for every wo
|
|
|
49
58
|
- After a decision affecting architecture, deployment, dependencies, or long-term behavior, call \`mio-intelligence_mio.memory.record\` with \`kind\`: \`decision\`, \`context\`, \`problem\`, or \`note\`.
|
|
50
59
|
- When a tool call fails, retries, or returns an error, call \`mio-intelligence_mio.observer.ingest\` with a stable \`trace_id\`, relevant \`event_type\`, \`payload\`, and \`outcome\`.
|
|
51
60
|
- Before a high-risk operation such as deletion, migration, credential change, or production change, call \`mio-intelligence_mio.policy.check\` and follow its suggestion when available.
|
|
61
|
+
- At the end of every task, before producing the final answer, call \`mio-intelligence_mio.observer.ingest\` with \`event_type\` = \`task_outcome\`, a stable \`trace_id\`, \`outcome\` = \`success\` / \`failure\` / \`aborted\`, and a brief non-sensitive \`payload\`. If Mio is unavailable, do not block the final answer.
|
|
62
|
+
- When you reuse a prior decision or experience returned by \`mio-intelligence_mio.memory.query\` and it changes your approach or outcome, call \`mio-intelligence_mio.experience.reuse\` with \`sourceAgent\`, \`targetAgent\`, \`experienceId\`, \`reuse\`, \`behaviorChanged\`, and \`outcomeImproved\`.
|
|
52
63
|
- If Mio MCP is unavailable, do not block the task. Continue normally and note the missed memory or observation.
|
|
53
64
|
- Do not store secrets, credentials, or raw sensitive content in Mio memory.
|
|
54
65
|
${MEMORY_END}`
|
|
55
66
|
|
|
56
|
-
function
|
|
57
|
-
const target = memoryPath()
|
|
67
|
+
function ensureBlock(target) {
|
|
58
68
|
let content = fs.existsSync(target) ? fs.readFileSync(target, 'utf8') : ''
|
|
59
69
|
const original = content
|
|
60
70
|
const start = content.indexOf(MEMORY_BEGIN)
|
|
@@ -65,10 +75,12 @@ function ensureMemoryRules() {
|
|
|
65
75
|
}
|
|
66
76
|
if (content) content += '\n\n'
|
|
67
77
|
content += MEMORY_BLOCK + '\n'
|
|
68
|
-
if (content === original) return false
|
|
78
|
+
if (content === original) return { changed: false, target, backup: null }
|
|
79
|
+
const backup = `${target}.bak-mio-${Date.now()}`
|
|
80
|
+
if (fs.existsSync(target)) fs.copyFileSync(target, backup)
|
|
69
81
|
fs.mkdirSync(path.dirname(target), { recursive: true })
|
|
70
82
|
fs.writeFileSync(target, content, 'utf8')
|
|
71
|
-
return true
|
|
83
|
+
return { changed: true, target, backup }
|
|
72
84
|
}
|
|
73
85
|
|
|
74
86
|
function isInstalled() {
|
|
@@ -77,7 +89,7 @@ function isInstalled() {
|
|
|
77
89
|
if (!entry) return false
|
|
78
90
|
|
|
79
91
|
const approvals = readJson(approvalsPath()) || {}
|
|
80
|
-
const memory = fs.existsSync(
|
|
92
|
+
const memory = fs.existsSync(memoryRulesPath()) ? fs.readFileSync(memoryRulesPath(), 'utf8') : ''
|
|
81
93
|
return Boolean(
|
|
82
94
|
approvals[approvalKey('mio-intelligence', entry)] &&
|
|
83
95
|
memory.includes(MEMORY_BEGIN) &&
|
|
@@ -149,7 +161,6 @@ function install({ node, serverScript, home, workspace, project }) {
|
|
|
149
161
|
}
|
|
150
162
|
|
|
151
163
|
writeApproval('mio-intelligence', config.mcpServers['mio-intelligence'])
|
|
152
|
-
const memoryChanged = ensureMemoryRules()
|
|
153
164
|
|
|
154
165
|
const backup = `${target}.bak-mio-${Date.now()}`
|
|
155
166
|
if (fs.existsSync(target)) {
|
|
@@ -159,15 +170,26 @@ function install({ node, serverScript, home, workspace, project }) {
|
|
|
159
170
|
fs.mkdirSync(path.dirname(target), { recursive: true })
|
|
160
171
|
fs.writeFileSync(target, `${JSON.stringify(config, null, 2)}\n`, 'utf8')
|
|
161
172
|
|
|
173
|
+
const userRules = ensureBlock(memoryRulesPath())
|
|
174
|
+
let projectRules = null
|
|
175
|
+
const workspaceDir = workspace || process.cwd()
|
|
176
|
+
if (workspaceDir && path.isAbsolute(workspaceDir)) {
|
|
177
|
+
projectRules = ensureBlock(projectInstructionsPath(workspaceDir))
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const changed = userRules.changed || Boolean(projectRules && projectRules.changed)
|
|
181
|
+
|
|
162
182
|
return {
|
|
163
|
-
changed
|
|
183
|
+
changed,
|
|
164
184
|
configPath: target,
|
|
165
185
|
approvalsPath: approvalsPath(),
|
|
166
|
-
|
|
167
|
-
|
|
186
|
+
memoryRulesPath: userRules.target,
|
|
187
|
+
projectInstructionsPath: projectRules ? projectRules.target : null,
|
|
188
|
+
userRulesChanged: userRules.changed,
|
|
189
|
+
projectRulesChanged: projectRules ? projectRules.changed : false,
|
|
168
190
|
backup,
|
|
169
|
-
message: 'WorkBuddy Mio MCP installed, approved, and
|
|
191
|
+
message: 'WorkBuddy Mio MCP installed, approved, and Mio rules injected into WORKBUDDY.md (auto-loaded user memory) and the workspace AGENTS.md. Restart WorkBuddy to load them.',
|
|
170
192
|
}
|
|
171
193
|
}
|
|
172
194
|
|
|
173
|
-
module.exports = { configDir, configPath, approvalsPath,
|
|
195
|
+
module.exports = { configDir, configPath, approvalsPath, memoryRulesPath, projectInstructionsPath, approvalKey, isInstalled, install }
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mio-agent-runtime",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Mio Agent Runtime installer and MCP intelligence layer",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "commonjs",
|
|
7
|
-
"bin": {
|
|
8
|
-
"mio": "bin/mio.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"bin/",
|
|
12
|
-
"server/",
|
|
13
|
-
"adapters/",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"check": "node --check bin/mio.js && node --check adapters/codex.js && node --check adapters/opencode.js && node --check adapters/workbuddy.js && node --check server/mio-intelligence-mcp/index.js",
|
|
18
|
-
"prepack": "npm run check"
|
|
19
|
-
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=18"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mio-agent-runtime",
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"description": "Mio Agent Runtime installer and MCP intelligence layer",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mio": "bin/mio.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"server/",
|
|
13
|
+
"adapters/",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"check": "node --check bin/mio.js && node --check adapters/codex.js && node --check adapters/opencode.js && node --check adapters/workbuddy.js && node --check server/mio-intelligence-mcp/index.js",
|
|
18
|
+
"prepack": "npm run check"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
}
|
|
23
|
+
}
|