metheus-governance-mcp-cli 0.2.59 → 0.2.61
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 +106 -6
- package/cli.mjs +2450 -173
- 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,10 @@ 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
|
|
193
|
+
- route dry-run / trigger-policy safety warnings
|
|
162
194
|
- local provider token presence for active project destinations
|
|
163
195
|
- codex/claude/gemini/antigravity/cursor registration state
|
|
164
196
|
- gateway `tools/list` reachability
|
|
@@ -171,6 +203,7 @@ Direct bot posting:
|
|
|
171
203
|
- it does not use a server-stored bot token
|
|
172
204
|
- the destination identifier is resolved from the current project's saved Chat Destinations on the Metheus server
|
|
173
205
|
- if multiple active destinations exist for the same provider, pass `destination_id` or `destination_label`
|
|
206
|
+
- pass `dry_run_delivery=true` to preview the resolved bot/destination locally without sending the provider message
|
|
174
207
|
- direct local delivery is implemented today for:
|
|
175
208
|
- Telegram
|
|
176
209
|
- Slack
|
|
@@ -187,6 +220,14 @@ The local runner closes the loop:
|
|
|
187
220
|
5. CLI sends the reply back through `me.send-bot-message`
|
|
188
221
|
6. the sent reply is mirrored back into the archive
|
|
189
222
|
|
|
223
|
+
Execution model:
|
|
224
|
+
- server stores bot identity, provider, role, and project chat destination
|
|
225
|
+
- local runner stores workspace mapping and role profiles
|
|
226
|
+
- runner resolves `project_id -> workspace_dir`
|
|
227
|
+
- runner resolves server bot role to a local `role_profile`
|
|
228
|
+
- runner executes the mapped client adapter (`codex` / `claude` / `gemini`)
|
|
229
|
+
- legacy `command` remains supported only as fallback for older configs
|
|
230
|
+
|
|
190
231
|
Commands:
|
|
191
232
|
|
|
192
233
|
```bash
|
|
@@ -197,14 +238,58 @@ metheus-governance-mcp-cli runner start
|
|
|
197
238
|
Common flags:
|
|
198
239
|
|
|
199
240
|
```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 --
|
|
241
|
+
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor
|
|
242
|
+
metheus-governance-mcp-cli runner start --project-id <project_uuid> --provider telegram --role monitor --poll-interval-ms 5000
|
|
243
|
+
metheus-governance-mcp-cli runner start --project-id <project_uuid> --provider telegram --role monitor --mentions-only true
|
|
244
|
+
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --dry-run-delivery true
|
|
245
|
+
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --role-profile review
|
|
246
|
+
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --command "python C:\\path\\to\\reply.py"
|
|
202
247
|
```
|
|
203
248
|
|
|
204
249
|
Recommended production path:
|
|
205
250
|
- keep provider bot token in `~/.metheus/<provider>.env`
|
|
206
251
|
- keep project room identifier in server-side Chat Destinations
|
|
207
252
|
- keep automation route config in `~/.metheus/bot-runner.json`
|
|
253
|
+
- keep `project_mappings.<project_id>.workspace_dir` aligned to that teammate's actual local project folder
|
|
254
|
+
- let `ctxpack pull` or project connection refresh the mapping automatically
|
|
255
|
+
- keep per-role execution policy under `role_profiles`
|
|
256
|
+
|
|
257
|
+
Why `workspace_dir` matters:
|
|
258
|
+
- the server cannot know each project member's local folder path
|
|
259
|
+
- the local runner must pass the correct folder to Codex, Claude Code, or Gemini on that member's machine
|
|
260
|
+
- without a valid project mapping, bots may answer with a generic local root instead of the real project workspace
|
|
261
|
+
|
|
262
|
+
Role profile fields:
|
|
263
|
+
- `client`: `codex`, `claude`, `gemini`, or `sample`
|
|
264
|
+
- `model`: optional CLI-specific model name
|
|
265
|
+
- `permission_mode`: `read_only`, `workspace_write`, `danger_full_access`
|
|
266
|
+
- `reasoning_effort`: `low`, `medium`, `high`
|
|
267
|
+
|
|
268
|
+
Trigger policy fields:
|
|
269
|
+
- `mentions_only`: in groups, react only when the bot is mentioned or when a message replies to the bot
|
|
270
|
+
- `direct_messages`: allow or block private chat messages
|
|
271
|
+
- `reply_to_bot_messages`: treat replies to the bot as actionable even without an explicit mention
|
|
272
|
+
- `ignore_edited_messages`: skip archived edited-message events
|
|
273
|
+
|
|
274
|
+
Recommended role baselines:
|
|
275
|
+
- `monitor`: `mentions_only=true`, `direct_messages=true`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
276
|
+
- `review`: `mentions_only=true`, `direct_messages=true`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
277
|
+
- `worker`: `mentions_only=true`, `direct_messages=false`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
278
|
+
- `approval`: `mentions_only=true`, `direct_messages=false`, `reply_to_bot_messages=true`, `ignore_edited_messages=true`
|
|
279
|
+
|
|
280
|
+
These are the default runner v2 fallbacks when a route omits explicit trigger settings.
|
|
281
|
+
`doctor` warns when a route opens broader reply conditions than the recommended role baseline.
|
|
282
|
+
|
|
283
|
+
Archive policy fields:
|
|
284
|
+
- `mirror_replies`: mirror bot replies back into Governance archive
|
|
285
|
+
- `dedupe_inbound`: avoid duplicate inbound archive comments for the same provider message
|
|
286
|
+
- `dedupe_outbound`: avoid duplicate mirrored bot-reply archive comments for the same delivered provider message
|
|
287
|
+
- `skip_bot_messages`: ignore provider bot messages during inbound import to avoid self-loop behavior
|
|
288
|
+
|
|
289
|
+
Mapping behavior:
|
|
290
|
+
- `ctxpack pull --workspace-dir <path>` stores `project_id -> workspace_dir`
|
|
291
|
+
- proxy/project connection can also persist the mapping
|
|
292
|
+
- broader project roots are preferred over nested tool folders when updating the mapping
|
|
208
293
|
|
|
209
294
|
Runner command contract:
|
|
210
295
|
- stdin: JSON payload containing project, destination, trigger message, and recent context comments
|
|
@@ -217,8 +302,15 @@ Notes:
|
|
|
217
302
|
- `runner once` processes the most recent pending archived inbound message
|
|
218
303
|
- `runner start` keeps polling and stores per-route cursor state in `~/.metheus/bot-runner-state.json`
|
|
219
304
|
- first start primes the cursor to the latest inbound message and does not reply to old backlog
|
|
305
|
+
- when inline filters match a configured route in `~/.metheus/bot-runner.json`, the runner reuses that route's canonical name/destination and state cursor instead of creating a new anonymous route key
|
|
306
|
+
- stale anonymous route keys in `~/.metheus/bot-runner-state.json` are auto-migrated to the matching configured route when possible; `doctor` warns if ambiguous legacy keys still remain
|
|
307
|
+
- `--dry-run-delivery true` resolves the real bot and destination but skips provider send and archive mirror writes
|
|
308
|
+
- when `trigger_policy.mentions_only=true`, unmentioned group messages are archived but skipped for reply generation
|
|
309
|
+
- mirrored bot replies are deduped by `chat_id + message_id`
|
|
310
|
+
- provider bot messages are ignored during inbound import by default
|
|
220
311
|
- `local-bot-bridge` reads stdin JSON from the runner and can call Codex/Claude/Gemini for you
|
|
221
312
|
- today this automation path is implemented for Telegram end-to-end
|
|
313
|
+
- 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
314
|
- Slack can use direct local send, but automatic inbound runner flow is not completed yet
|
|
223
315
|
- KakaoTalk config can be stored now, but direct send/runner flow is not implemented yet
|
|
224
316
|
|
|
@@ -409,6 +501,14 @@ Local compatibility selftest (no network):
|
|
|
409
501
|
npm run test:compat
|
|
410
502
|
```
|
|
411
503
|
|
|
504
|
+
This selftest now includes a local mock Telegram runner path:
|
|
505
|
+
- mock Telegram `getUpdates` import into archive
|
|
506
|
+
- trigger-policy evaluation
|
|
507
|
+
- role-based trigger default resolution
|
|
508
|
+
- local `sample` AI execution
|
|
509
|
+
- `sendChatAction` / `sendMessage`
|
|
510
|
+
- mirrored bot-reply archive creation and state update
|
|
511
|
+
|
|
412
512
|
Proxy smoke test (initialize -> tools/list -> project summary -> ctxpack local sync):
|
|
413
513
|
|
|
414
514
|
```bash
|