metheus-governance-mcp-cli 0.2.58 → 0.2.60
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 +100 -6
- package/cli.mjs +1895 -160
- package/lib/local-ai-adapters.mjs +519 -0
- package/package.json +3 -2
- package/scripts/local-bot-ai-bridge.mjs +18 -240
package/README.md
CHANGED
|
@@ -56,7 +56,22 @@ Runner template:
|
|
|
56
56
|
|
|
57
57
|
```json
|
|
58
58
|
{
|
|
59
|
-
"version":
|
|
59
|
+
"version": 2,
|
|
60
|
+
"project_mappings": {
|
|
61
|
+
"<project_uuid>": {
|
|
62
|
+
"workspace_dir": "C:\\path\\to\\your\\project",
|
|
63
|
+
"source": "ctxpack_pull",
|
|
64
|
+
"updated_at": "2026-03-13T00:00:00Z"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"role_profiles": {
|
|
68
|
+
"monitor": {
|
|
69
|
+
"client": "codex",
|
|
70
|
+
"model": "",
|
|
71
|
+
"permission_mode": "read_only",
|
|
72
|
+
"reasoning_effort": "low"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
60
75
|
"routes": [
|
|
61
76
|
{
|
|
62
77
|
"name": "telegram-monitor",
|
|
@@ -64,7 +79,19 @@ Runner template:
|
|
|
64
79
|
"project_id": "<project_uuid>",
|
|
65
80
|
"provider": "telegram",
|
|
66
81
|
"role": "monitor",
|
|
67
|
-
"
|
|
82
|
+
"role_profile": "monitor",
|
|
83
|
+
"trigger_policy": {
|
|
84
|
+
"mentions_only": true,
|
|
85
|
+
"direct_messages": true,
|
|
86
|
+
"reply_to_bot_messages": true,
|
|
87
|
+
"ignore_edited_messages": false
|
|
88
|
+
},
|
|
89
|
+
"archive_policy": {
|
|
90
|
+
"mirror_replies": true,
|
|
91
|
+
"dedupe_inbound": true,
|
|
92
|
+
"dedupe_outbound": true,
|
|
93
|
+
"skip_bot_messages": true
|
|
94
|
+
}
|
|
68
95
|
}
|
|
69
96
|
]
|
|
70
97
|
}
|
|
@@ -112,9 +139,10 @@ Fill only provider bot tokens locally. Project chat destination identifiers shou
|
|
|
112
139
|
`~/.metheus/bot-runner.json` is the local automation profile for:
|
|
113
140
|
- which project to watch
|
|
114
141
|
- which provider/role bot profile to use
|
|
115
|
-
- which
|
|
142
|
+
- which `project_id -> workspace_dir` mapping to apply locally
|
|
143
|
+
- which role profile maps to which local CLI/model/permission/reasoning policy
|
|
116
144
|
|
|
117
|
-
Built-in helper command:
|
|
145
|
+
Built-in helper command for legacy fallback/testing:
|
|
118
146
|
|
|
119
147
|
```bash
|
|
120
148
|
metheus-governance-mcp-cli local-bot-bridge --client codex --no-update
|
|
@@ -159,6 +187,9 @@ metheus-governance-mcp-cli doctor --project-id <project_uuid> --base-url https:/
|
|
|
159
187
|
Checks:
|
|
160
188
|
- auth token status (+ auto refresh attempt)
|
|
161
189
|
- local provider env template presence
|
|
190
|
+
- local bot runner v2 config validity
|
|
191
|
+
- project workspace mapping presence
|
|
192
|
+
- role profile -> local CLI availability
|
|
162
193
|
- local provider token presence for active project destinations
|
|
163
194
|
- codex/claude/gemini/antigravity/cursor registration state
|
|
164
195
|
- gateway `tools/list` reachability
|
|
@@ -187,6 +218,14 @@ The local runner closes the loop:
|
|
|
187
218
|
5. CLI sends the reply back through `me.send-bot-message`
|
|
188
219
|
6. the sent reply is mirrored back into the archive
|
|
189
220
|
|
|
221
|
+
Execution model:
|
|
222
|
+
- server stores bot identity, provider, role, and project chat destination
|
|
223
|
+
- local runner stores workspace mapping and role profiles
|
|
224
|
+
- runner resolves `project_id -> workspace_dir`
|
|
225
|
+
- runner resolves server bot role to a local `role_profile`
|
|
226
|
+
- runner executes the mapped client adapter (`codex` / `claude` / `gemini`)
|
|
227
|
+
- legacy `command` remains supported only as fallback for older configs
|
|
228
|
+
|
|
190
229
|
Commands:
|
|
191
230
|
|
|
192
231
|
```bash
|
|
@@ -197,14 +236,57 @@ metheus-governance-mcp-cli runner start
|
|
|
197
236
|
Common flags:
|
|
198
237
|
|
|
199
238
|
```bash
|
|
200
|
-
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor
|
|
201
|
-
metheus-governance-mcp-cli runner start --project-id <project_uuid> --provider telegram --role monitor --
|
|
239
|
+
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor
|
|
240
|
+
metheus-governance-mcp-cli runner start --project-id <project_uuid> --provider telegram --role monitor --poll-interval-ms 5000
|
|
241
|
+
metheus-governance-mcp-cli runner start --project-id <project_uuid> --provider telegram --role monitor --mentions-only true
|
|
242
|
+
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --role-profile review
|
|
243
|
+
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --command "python C:\\path\\to\\reply.py"
|
|
202
244
|
```
|
|
203
245
|
|
|
204
246
|
Recommended production path:
|
|
205
247
|
- keep provider bot token in `~/.metheus/<provider>.env`
|
|
206
248
|
- keep project room identifier in server-side Chat Destinations
|
|
207
249
|
- keep automation route config in `~/.metheus/bot-runner.json`
|
|
250
|
+
- keep `project_mappings.<project_id>.workspace_dir` aligned to that teammate's actual local project folder
|
|
251
|
+
- let `ctxpack pull` or project connection refresh the mapping automatically
|
|
252
|
+
- keep per-role execution policy under `role_profiles`
|
|
253
|
+
|
|
254
|
+
Why `workspace_dir` matters:
|
|
255
|
+
- the server cannot know each project member's local folder path
|
|
256
|
+
- the local runner must pass the correct folder to Codex, Claude Code, or Gemini on that member's machine
|
|
257
|
+
- without a valid project mapping, bots may answer with a generic local root instead of the real project workspace
|
|
258
|
+
|
|
259
|
+
Role profile fields:
|
|
260
|
+
- `client`: `codex`, `claude`, `gemini`, or `sample`
|
|
261
|
+
- `model`: optional CLI-specific model name
|
|
262
|
+
- `permission_mode`: `read_only`, `workspace_write`, `danger_full_access`
|
|
263
|
+
- `reasoning_effort`: `low`, `medium`, `high`
|
|
264
|
+
|
|
265
|
+
Trigger policy fields:
|
|
266
|
+
- `mentions_only`: in groups, react only when the bot is mentioned or when a message replies to the bot
|
|
267
|
+
- `direct_messages`: allow or block private chat messages
|
|
268
|
+
- `reply_to_bot_messages`: treat replies to the bot as actionable even without an explicit mention
|
|
269
|
+
- `ignore_edited_messages`: skip archived edited-message events
|
|
270
|
+
|
|
271
|
+
Recommended role baselines:
|
|
272
|
+
- `monitor`: `mentions_only=true`, `direct_messages=true`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
273
|
+
- `review`: `mentions_only=true`, `direct_messages=true`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
274
|
+
- `worker`: `mentions_only=true`, `direct_messages=false`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
275
|
+
- `approval`: `mentions_only=true`, `direct_messages=false`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
276
|
+
|
|
277
|
+
These are the default runner v2 fallbacks when a route omits explicit trigger settings.
|
|
278
|
+
`doctor` warns when a route opens broader reply conditions than the recommended role baseline.
|
|
279
|
+
|
|
280
|
+
Archive policy fields:
|
|
281
|
+
- `mirror_replies`: mirror bot replies back into Governance archive
|
|
282
|
+
- `dedupe_inbound`: avoid duplicate inbound archive comments for the same provider message
|
|
283
|
+
- `dedupe_outbound`: avoid duplicate mirrored bot-reply archive comments for the same delivered provider message
|
|
284
|
+
- `skip_bot_messages`: ignore provider bot messages during inbound import to avoid self-loop behavior
|
|
285
|
+
|
|
286
|
+
Mapping behavior:
|
|
287
|
+
- `ctxpack pull --workspace-dir <path>` stores `project_id -> workspace_dir`
|
|
288
|
+
- proxy/project connection can also persist the mapping
|
|
289
|
+
- broader project roots are preferred over nested tool folders when updating the mapping
|
|
208
290
|
|
|
209
291
|
Runner command contract:
|
|
210
292
|
- stdin: JSON payload containing project, destination, trigger message, and recent context comments
|
|
@@ -217,8 +299,12 @@ Notes:
|
|
|
217
299
|
- `runner once` processes the most recent pending archived inbound message
|
|
218
300
|
- `runner start` keeps polling and stores per-route cursor state in `~/.metheus/bot-runner-state.json`
|
|
219
301
|
- first start primes the cursor to the latest inbound message and does not reply to old backlog
|
|
302
|
+
- when `trigger_policy.mentions_only=true`, unmentioned group messages are archived but skipped for reply generation
|
|
303
|
+
- mirrored bot replies are deduped by `chat_id + message_id`
|
|
304
|
+
- provider bot messages are ignored during inbound import by default
|
|
220
305
|
- `local-bot-bridge` reads stdin JSON from the runner and can call Codex/Claude/Gemini for you
|
|
221
306
|
- today this automation path is implemented for Telegram end-to-end
|
|
307
|
+
- set `METHEUS_TELEGRAM_API_BASE_URL=http://127.0.0.1:<port>` only for local mock or regression testing; normal usage should keep the default Telegram API base
|
|
222
308
|
- Slack can use direct local send, but automatic inbound runner flow is not completed yet
|
|
223
309
|
- KakaoTalk config can be stored now, but direct send/runner flow is not implemented yet
|
|
224
310
|
|
|
@@ -409,6 +495,14 @@ Local compatibility selftest (no network):
|
|
|
409
495
|
npm run test:compat
|
|
410
496
|
```
|
|
411
497
|
|
|
498
|
+
This selftest now includes a local mock Telegram runner path:
|
|
499
|
+
- mock Telegram `getUpdates` import into archive
|
|
500
|
+
- trigger-policy evaluation
|
|
501
|
+
- role-based trigger default resolution
|
|
502
|
+
- local `sample` AI execution
|
|
503
|
+
- `sendChatAction` / `sendMessage`
|
|
504
|
+
- mirrored bot-reply archive creation and state update
|
|
505
|
+
|
|
412
506
|
Proxy smoke test (initialize -> tools/list -> project summary -> ctxpack local sync):
|
|
413
507
|
|
|
414
508
|
```bash
|