metheus-governance-mcp-cli 0.2.286 → 0.2.287
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 +9 -5
- package/cli.mjs +163 -70
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -379,7 +379,7 @@ Behavior:
|
|
|
379
379
|
- `bot room-audit` now suggests executable runner routes for the managed server+local intersection. Room visibility is still reported, but a bot no longer has to appear in the admin list before route automation can prepare it.
|
|
380
380
|
- `bot room-audit` defaults to `monitor` only unless you pass `--role` or `--roles`.
|
|
381
381
|
- `bot room-audit --apply true` writes missing suggested routes into `~/.metheus/bot-runner.json` and disables overlapping enabled routes in the same project/provider/destination/bot scope that are outside the selected role set.
|
|
382
|
-
- `runner project up` is the
|
|
382
|
+
- `runner project up` is the route preparation path for Telegram project operations: it runs the same room audit, applies the selected role routes, and starts polling only when you explicitly pass `--start true` or `--start-detached true`.
|
|
383
383
|
- `runner project up` can be narrowed with `--bot-name`, `--bot-id`, `--role`, or `--roles <csv>` when you do not want every suggested role route for that room.
|
|
384
384
|
- `bot remove` without flags starts a guided numbered flow: provider -> bot entry -> confirm removal.
|
|
385
385
|
- Telegram stores one bot file per entry under `~/.metheus/telegram-bots/<ServerBotName>.env` with generic fields:
|
|
@@ -421,7 +421,8 @@ metheus-governance-mcp-cli bot remove --provider telegram --bot-name <server_bot
|
|
|
421
421
|
metheus-governance-mcp-cli bot verify --provider telegram --bot-name <server_bot_name> --json true
|
|
422
422
|
metheus-governance-mcp-cli bot room-audit --provider telegram --project-id <project_uuid> --destination-label <room_label> --json true
|
|
423
423
|
metheus-governance-mcp-cli bot room-audit --provider telegram --project-id <project_uuid> --destination-label <room_label> --apply true --json true
|
|
424
|
-
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label>
|
|
424
|
+
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label> --start false
|
|
425
|
+
metheus-governance-mcp-cli runner start-detached --project-id <project_uuid> --provider telegram --destination-label <room_label>
|
|
425
426
|
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label> --bot-name <server_bot_name> --roles monitor,review --start false
|
|
426
427
|
```
|
|
427
428
|
|
|
@@ -540,7 +541,8 @@ Commands:
|
|
|
540
541
|
|
|
541
542
|
```bash
|
|
542
543
|
metheus-governance-mcp-cli runner list
|
|
543
|
-
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label>
|
|
544
|
+
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label> --start false
|
|
545
|
+
metheus-governance-mcp-cli runner start-detached --project-id <project_uuid> --provider telegram --destination-label <room_label>
|
|
544
546
|
metheus-governance-mcp-cli runner route add
|
|
545
547
|
metheus-governance-mcp-cli runner route edit --route-name telegram-monitor
|
|
546
548
|
metheus-governance-mcp-cli runner route remove --route-name telegram-monitor
|
|
@@ -553,7 +555,7 @@ metheus-governance-mcp-cli runner start --route-name telegram-monitor --concurre
|
|
|
553
555
|
Route management:
|
|
554
556
|
- `runner route add` creates one executable route by selecting the project, provider, role, server bot, and project chat destination in order.
|
|
555
557
|
- `runner route add` now auto-uses the suggested route name, `5000` ms poll interval, and `enabled=true` unless you pass explicit flags or edit the route later.
|
|
556
|
-
- `runner project up` is the shortest practical route bootstrap path for Telegram: it audits one project destination, writes any missing suggested routes,
|
|
558
|
+
- `runner project up` is the shortest practical route bootstrap path for Telegram: it audits one project destination, writes any missing suggested routes, and prepares that destination for later launch. It starts polling only when you explicitly pass `--start true` or `--start-detached true`.
|
|
557
559
|
- if room visibility probe fails but one or more enabled routes already exist for that project destination, `runner project up` now treats the probe failure as a warning and can still start those existing routes.
|
|
558
560
|
- `runner project up --dry-run-delivery true` lets the started runner validate route execution without sending a real provider message.
|
|
559
561
|
- In public Telegram bot conversations, the stored route role is treated as a hint only. Live room context, the current human request, and recent bot replies take priority over the stored route role hint when the local AI client decides how to answer.
|
|
@@ -566,8 +568,10 @@ Route management:
|
|
|
566
568
|
Recommended operational path:
|
|
567
569
|
|
|
568
570
|
```bash
|
|
569
|
-
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label>
|
|
571
|
+
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label> --start false
|
|
572
|
+
metheus-governance-mcp-cli runner start-detached --project-id <project_uuid> --provider telegram --destination-label <room_label>
|
|
570
573
|
metheus-governance-mcp-cli runner project up --project-id <project_uuid> --provider telegram --destination-label <room_label> --bot-name <server_bot_name> --roles monitor,review --start false
|
|
574
|
+
metheus-governance-mcp-cli runner start-detached --project-id <project_uuid> --provider telegram --destination-label <room_label> --bot-name <server_bot_name> --role monitor
|
|
571
575
|
```
|
|
572
576
|
|
|
573
577
|
If you want the older step-by-step path instead:
|
package/cli.mjs
CHANGED
|
@@ -12258,11 +12258,11 @@ async function runRunnerProjectUp(flags) {
|
|
|
12258
12258
|
if (!matchingRoutes.length) {
|
|
12259
12259
|
throw new Error("runner project up did not find any enabled routes for the selected project destination");
|
|
12260
12260
|
}
|
|
12261
|
-
if (!boolFromRaw(flags.json, false)) {
|
|
12262
|
-
process.stdout.write(
|
|
12263
|
-
`${startDetachedRequested ? "Starting detached runner" : "Starting runner"} for project ${summaryPayload.project_id} destination ${summaryPayload.destination_label || summaryPayload.destination_id} using ${matchingRoutes.length} enabled route(s).\n`,
|
|
12264
|
-
);
|
|
12265
|
-
}
|
|
12261
|
+
if (!boolFromRaw(flags.json, false)) {
|
|
12262
|
+
process.stdout.write(
|
|
12263
|
+
`${startDetachedRequested ? "Starting detached runner" : "Starting foreground runner (stops when this session ends)"} for project ${summaryPayload.project_id} destination ${summaryPayload.destination_label || summaryPayload.destination_id} using ${matchingRoutes.length} enabled route(s).\n`,
|
|
12264
|
+
);
|
|
12265
|
+
}
|
|
12266
12266
|
if (startDetachedRequested) {
|
|
12267
12267
|
await runRunnerStartDetachedResolvedRoutes(matchingRoutes, startFlags, "runner project up");
|
|
12268
12268
|
return;
|
|
@@ -12277,39 +12277,89 @@ async function runRunnerProjectUp(flags) {
|
|
|
12277
12277
|
});
|
|
12278
12278
|
}
|
|
12279
12279
|
|
|
12280
|
-
function canStartRunnerDespiteProjectUpApplyFailure({ applyRequested, applyResult, matchingRoutes }) {
|
|
12281
|
-
if (!applyRequested) return false;
|
|
12282
|
-
const normalizedApplyResult = safeObject(applyResult);
|
|
12283
|
-
if (normalizedApplyResult.ok !== false) return false;
|
|
12280
|
+
function canStartRunnerDespiteProjectUpApplyFailure({ applyRequested, applyResult, matchingRoutes }) {
|
|
12281
|
+
if (!applyRequested) return false;
|
|
12282
|
+
const normalizedApplyResult = safeObject(applyResult);
|
|
12283
|
+
if (normalizedApplyResult.ok !== false) return false;
|
|
12284
12284
|
const errorText = String(normalizedApplyResult.error || "").trim();
|
|
12285
12285
|
if (errorText !== "route apply skipped because the Telegram room visibility probe failed") {
|
|
12286
12286
|
return false;
|
|
12287
12287
|
}
|
|
12288
|
-
return ensureArray(matchingRoutes).length > 0;
|
|
12289
|
-
}
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
const
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12288
|
+
return ensureArray(matchingRoutes).length > 0;
|
|
12289
|
+
}
|
|
12290
|
+
|
|
12291
|
+
function resolveRunnerProjectUpExecutionPolicy(flags = {}) {
|
|
12292
|
+
const applyRequested = Object.prototype.hasOwnProperty.call(flags, "apply")
|
|
12293
|
+
? boolFromRaw(flags.apply, true)
|
|
12294
|
+
: true;
|
|
12295
|
+
const startDetachedRequested = Object.prototype.hasOwnProperty.call(flags, "start-detached")
|
|
12296
|
+
? boolFromRaw(flags["start-detached"], true)
|
|
12297
|
+
: boolFromRaw(flags.detached, false);
|
|
12298
|
+
const startRequested = Object.prototype.hasOwnProperty.call(flags, "start")
|
|
12299
|
+
? boolFromRaw(flags.start, true)
|
|
12300
|
+
: false;
|
|
12301
|
+
const shouldStartRunner = startRequested || startDetachedRequested;
|
|
12302
|
+
return {
|
|
12303
|
+
applyRequested,
|
|
12304
|
+
startDetachedRequested,
|
|
12305
|
+
startRequested,
|
|
12306
|
+
shouldStartRunner,
|
|
12307
|
+
foregroundStartRequested: startRequested && !startDetachedRequested,
|
|
12308
|
+
};
|
|
12309
|
+
}
|
|
12310
|
+
|
|
12311
|
+
function buildRunnerStartDetachedCommand(flags = {}) {
|
|
12312
|
+
return [CLI_NAME, "runner", "start-detached", ...serializeCLIFlags(flags, {
|
|
12313
|
+
omit: ["json", "start", "start-detached", "detached"],
|
|
12314
|
+
})].join(" ");
|
|
12315
|
+
}
|
|
12316
|
+
|
|
12317
|
+
function buildRunnerProjectUpNextSteps({
|
|
12318
|
+
applyRequested,
|
|
12319
|
+
shouldStartRunner,
|
|
12320
|
+
projectID,
|
|
12321
|
+
provider,
|
|
12322
|
+
destinationID,
|
|
12323
|
+
matchingRoutes,
|
|
12324
|
+
startFlags,
|
|
12325
|
+
}) {
|
|
12326
|
+
const nextSteps = [];
|
|
12327
|
+
const routeNames = ensureArray(matchingRoutes).map((route) => normalizeRunnerRoute(route).name).filter(Boolean);
|
|
12328
|
+
if (!applyRequested) {
|
|
12329
|
+
nextSteps.push(`${CLI_NAME} runner project up --project-id ${projectID} --provider ${provider} --destination-id ${destinationID} --apply true --start false`);
|
|
12330
|
+
}
|
|
12331
|
+
if (!shouldStartRunner) {
|
|
12332
|
+
if (routeNames.length > 0) {
|
|
12333
|
+
nextSteps.push(`${CLI_NAME} runner show --route-name ${routeNames[0]}`);
|
|
12334
|
+
nextSteps.push(buildRunnerStartDetachedCommand(startFlags));
|
|
12335
|
+
} else if (applyRequested) {
|
|
12336
|
+
nextSteps.push(`${CLI_NAME} runner project up --project-id ${projectID} --provider ${provider} --destination-id ${destinationID} --apply true --start false`);
|
|
12337
|
+
}
|
|
12338
|
+
return nextSteps;
|
|
12339
|
+
}
|
|
12340
|
+
nextSteps.push(`${CLI_NAME} runner show --route-name ${routeNames[0] || "<route_name>"}`);
|
|
12341
|
+
return nextSteps;
|
|
12342
|
+
}
|
|
12343
|
+
|
|
12344
|
+
async function buildRunnerProjectUpResult(flags = {}) {
|
|
12345
|
+
const ui = createPrompter();
|
|
12346
|
+
try {
|
|
12347
|
+
if (shouldRenderPromptChrome(flags)) {
|
|
12348
|
+
ui.setFlow("RUNNER PROJECT UP", "Audit one project destination, create missing runner routes, and optionally start polling when explicitly requested");
|
|
12349
|
+
}
|
|
12350
|
+
const provider = String(flags.provider || "").trim()
|
|
12351
|
+
? normalizeBotProvider(flags.provider)
|
|
12352
|
+
: "telegram";
|
|
12353
|
+
if (provider !== "telegram") {
|
|
12354
|
+
throw new Error("runner project up currently supports only --provider telegram");
|
|
12355
|
+
}
|
|
12356
|
+
const {
|
|
12357
|
+
applyRequested,
|
|
12358
|
+
startDetachedRequested,
|
|
12359
|
+
startRequested,
|
|
12360
|
+
shouldStartRunner,
|
|
12361
|
+
foregroundStartRequested,
|
|
12362
|
+
} = resolveRunnerProjectUpExecutionPolicy(flags);
|
|
12313
12363
|
const roleFilter = parseRunnerProjectUpRoles(flags);
|
|
12314
12364
|
const botNameFilter = String(flags["bot-name"] || "").trim();
|
|
12315
12365
|
const botIDFilter = String(flags["bot-id"] || "").trim();
|
|
@@ -12392,30 +12442,35 @@ async function buildRunnerProjectUpResult(flags = {}) {
|
|
|
12392
12442
|
route_apply_requested: applyRequested,
|
|
12393
12443
|
route_apply_changed: Boolean(applyResult.changed),
|
|
12394
12444
|
route_config_file: String(applyResult.filePath || auditPayload.routeSuggestionConfigFilePath || "-").trim() || "-",
|
|
12395
|
-
enabled_routes_for_selection: matchingRoutes.map((route) => normalizeRunnerRoute(route).name).filter(Boolean),
|
|
12396
|
-
start_requested: shouldStartRunner,
|
|
12397
|
-
start_detached_requested: startDetachedRequested,
|
|
12398
|
-
next_steps: [],
|
|
12399
|
-
applied_routes: ensureArray(applyResult.appliedRoutes).map((item) => safeObject(item)),
|
|
12400
|
-
disabled_routes: ensureArray(applyResult.disabledRoutes).map((item) => safeObject(item)),
|
|
12401
|
-
};
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
summaryPayload.
|
|
12414
|
-
}
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12445
|
+
enabled_routes_for_selection: matchingRoutes.map((route) => normalizeRunnerRoute(route).name).filter(Boolean),
|
|
12446
|
+
start_requested: shouldStartRunner,
|
|
12447
|
+
start_detached_requested: startDetachedRequested,
|
|
12448
|
+
next_steps: [],
|
|
12449
|
+
applied_routes: ensureArray(applyResult.appliedRoutes).map((item) => safeObject(item)),
|
|
12450
|
+
disabled_routes: ensureArray(applyResult.disabledRoutes).map((item) => safeObject(item)),
|
|
12451
|
+
};
|
|
12452
|
+
summaryPayload.next_steps.push(...buildRunnerProjectUpNextSteps({
|
|
12453
|
+
applyRequested,
|
|
12454
|
+
shouldStartRunner,
|
|
12455
|
+
projectID: summaryPayload.project_id,
|
|
12456
|
+
provider,
|
|
12457
|
+
destinationID: summaryPayload.destination_id,
|
|
12458
|
+
matchingRoutes,
|
|
12459
|
+
startFlags,
|
|
12460
|
+
}));
|
|
12461
|
+
if (applyRequested && applyResult.ok === false && applyResult.error) {
|
|
12462
|
+
if (applyFailureWarningOnly) {
|
|
12463
|
+
summaryPayload.warning = String(applyResult.error || "").trim();
|
|
12464
|
+
} else {
|
|
12465
|
+
summaryPayload.error = String(applyResult.error || "").trim();
|
|
12466
|
+
}
|
|
12467
|
+
}
|
|
12468
|
+
if (foregroundStartRequested && !summaryPayload.warning && !summaryPayload.error) {
|
|
12469
|
+
summaryPayload.warning = "foreground runner start was explicitly requested; the runner stops when this terminal session ends. Use runner start-detached for persistent polling.";
|
|
12470
|
+
}
|
|
12471
|
+
return {
|
|
12472
|
+
summaryPayload,
|
|
12473
|
+
applyRequested,
|
|
12419
12474
|
applyResult,
|
|
12420
12475
|
shouldStartRunner,
|
|
12421
12476
|
startDetachedRequested,
|
|
@@ -16907,12 +16962,12 @@ function buildLocalToolSpecs() {
|
|
|
16907
16962
|
"Delete one project context item permanently.",
|
|
16908
16963
|
inputSchema: buildProjectContextGetInputSchema(),
|
|
16909
16964
|
},
|
|
16910
|
-
{
|
|
16911
|
-
name: "runner.project_up",
|
|
16912
|
-
description:
|
|
16913
|
-
"Audit one project destination, create missing runner routes, and optionally start polling. Use this before runner.start_detached when the route is not ready yet.",
|
|
16914
|
-
inputSchema: buildRunnerProjectUpInputSchema(),
|
|
16915
|
-
},
|
|
16965
|
+
{
|
|
16966
|
+
name: "runner.project_up",
|
|
16967
|
+
description:
|
|
16968
|
+
"Audit one project destination, create missing runner routes, and optionally start polling only when explicitly requested. Use this before runner.start_detached when the route is not ready yet.",
|
|
16969
|
+
inputSchema: buildRunnerProjectUpInputSchema(),
|
|
16970
|
+
},
|
|
16916
16971
|
{
|
|
16917
16972
|
name: "runner.show",
|
|
16918
16973
|
description:
|
|
@@ -19267,12 +19322,50 @@ TELEGRAM_BOT_REVIEW_TOKEN=review-token
|
|
|
19267
19322
|
push("detached_runner_linux_launcher_selects_supported_terminal", false, String(err?.message || err));
|
|
19268
19323
|
}
|
|
19269
19324
|
|
|
19270
|
-
try {
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19325
|
+
try {
|
|
19326
|
+
const projectUpPolicy = resolveRunnerProjectUpExecutionPolicy({});
|
|
19327
|
+
push(
|
|
19328
|
+
"runner_project_up_default_policy_is_prepare_only",
|
|
19329
|
+
projectUpPolicy.applyRequested === true
|
|
19330
|
+
&& projectUpPolicy.startRequested === false
|
|
19331
|
+
&& projectUpPolicy.startDetachedRequested === false
|
|
19332
|
+
&& projectUpPolicy.shouldStartRunner === false,
|
|
19333
|
+
`apply=${projectUpPolicy.applyRequested} start=${projectUpPolicy.startRequested} detached=${projectUpPolicy.startDetachedRequested} shouldStart=${projectUpPolicy.shouldStartRunner}`,
|
|
19334
|
+
);
|
|
19335
|
+
} catch (err) {
|
|
19336
|
+
push("runner_project_up_default_policy_is_prepare_only", false, String(err?.message || err));
|
|
19337
|
+
}
|
|
19338
|
+
|
|
19339
|
+
try {
|
|
19340
|
+
const nextSteps = buildRunnerProjectUpNextSteps({
|
|
19341
|
+
applyRequested: true,
|
|
19342
|
+
shouldStartRunner: false,
|
|
19343
|
+
projectID: selftestProjectID,
|
|
19344
|
+
provider: "telegram",
|
|
19345
|
+
destinationID: "dest-1",
|
|
19346
|
+
matchingRoutes: [{ name: "telegram-monitor-selftest", enabled: true }],
|
|
19347
|
+
startFlags: {
|
|
19348
|
+
"project-id": selftestProjectID,
|
|
19349
|
+
provider: "telegram",
|
|
19350
|
+
"destination-id": "dest-1",
|
|
19351
|
+
},
|
|
19352
|
+
});
|
|
19353
|
+
push(
|
|
19354
|
+
"runner_project_up_next_steps_prefer_start_detached",
|
|
19355
|
+
nextSteps.includes(`${CLI_NAME} runner show --route-name telegram-monitor-selftest`)
|
|
19356
|
+
&& nextSteps.includes(`${CLI_NAME} runner start-detached --project-id ${selftestProjectID} --provider telegram --destination-id dest-1`),
|
|
19357
|
+
nextSteps.join(" | "),
|
|
19358
|
+
);
|
|
19359
|
+
} catch (err) {
|
|
19360
|
+
push("runner_project_up_next_steps_prefer_start_detached", false, String(err?.message || err));
|
|
19361
|
+
}
|
|
19362
|
+
|
|
19363
|
+
try {
|
|
19364
|
+
push(
|
|
19365
|
+
"runner_project_up_probe_failure_allows_existing_route_start",
|
|
19366
|
+
canStartRunnerDespiteProjectUpApplyFailure({
|
|
19367
|
+
applyRequested: true,
|
|
19368
|
+
applyResult: { ok: false, error: "route apply skipped because the Telegram room visibility probe failed" },
|
|
19276
19369
|
matchingRoutes: [{ name: "telegram-monitor-selftest" }],
|
|
19277
19370
|
}) === true,
|
|
19278
19371
|
"existing_routes=1 probe_failure=warning_only",
|