metheus-governance-mcp-cli 0.2.77 → 0.2.78
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/lib/bot-commands.mjs +24 -14
- package/lib/selftest-bot-commands.mjs +12 -4
- package/package.json +1 -1
package/lib/bot-commands.mjs
CHANGED
|
@@ -711,22 +711,32 @@ async function editTelegramBotGuided(ui, parsed, selected, current, flags, deps)
|
|
|
711
711
|
let serverRoleAutoResolved = "";
|
|
712
712
|
let groupedServerRoles = [];
|
|
713
713
|
let groupedServerName = "";
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
714
|
+
let serverManagedIdentity = Boolean(current.serverBotID || current.__preferServerIdentity);
|
|
715
|
+
if (!serverManagedIdentity) {
|
|
716
|
+
const initialServerBot = await autoResolveTelegramServerBot(current, flags, deps);
|
|
717
|
+
if (String(initialServerBot.botID || "").trim() || initialServerBot.matchMode === "group") {
|
|
718
|
+
serverManagedIdentity = true;
|
|
719
|
+
}
|
|
717
720
|
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
defaultValue: current.username ? "keep" : "change",
|
|
722
|
-
});
|
|
723
|
-
if (usernameAction === "change") {
|
|
724
|
-
current.username = requireDependency(deps, "normalizeTelegramBotUsername")(
|
|
725
|
-
await promptRequiredLine(ui, "Telegram username (without @)", current.username),
|
|
726
|
-
"",
|
|
727
|
-
);
|
|
728
|
-
} else if (usernameAction === "clear") {
|
|
721
|
+
let usernameAction = "keep";
|
|
722
|
+
if (serverManagedIdentity) {
|
|
723
|
+
current.__preferServerIdentity = true;
|
|
729
724
|
current.username = "";
|
|
725
|
+
serverRoleAutoResolved = String(current.roleProfile || "").trim() || "__server_binding__";
|
|
726
|
+
process.stdout.write("Telegram username is managed from server bot info and cannot be edited here.\n");
|
|
727
|
+
} else {
|
|
728
|
+
usernameAction = await promptKeepChangeClear(ui, "Telegram username", {
|
|
729
|
+
allowClear: true,
|
|
730
|
+
defaultValue: current.username ? "keep" : "change",
|
|
731
|
+
});
|
|
732
|
+
if (usernameAction === "change") {
|
|
733
|
+
current.username = requireDependency(deps, "normalizeTelegramBotUsername")(
|
|
734
|
+
await promptRequiredLine(ui, "Telegram username (without @)", current.username),
|
|
735
|
+
"",
|
|
736
|
+
);
|
|
737
|
+
} else if (usernameAction === "clear") {
|
|
738
|
+
current.username = "";
|
|
739
|
+
}
|
|
730
740
|
}
|
|
731
741
|
|
|
732
742
|
const tokenAction = await promptKeepChangeClear(ui, "Telegram token", {
|
|
@@ -347,7 +347,7 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
347
347
|
`username=${String(groupedState.TELEGRAM_BOT_RYOAI_BOT_USERNAME || "")} server_bot_id=${String(groupedState.TELEGRAM_BOT_RYOAI_BOT_SERVER_BOT_ID || "")} role=${String(groupedState.TELEGRAM_BOT_RYOAI_BOT_ROLE_PROFILE || "")}`,
|
|
348
348
|
);
|
|
349
349
|
|
|
350
|
-
await runCLI({
|
|
350
|
+
const groupedEditResult = await runCLI({
|
|
351
351
|
cliPath,
|
|
352
352
|
args: [
|
|
353
353
|
"bot", "edit",
|
|
@@ -359,7 +359,6 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
359
359
|
METHEUS_SCRIPTED_PROMPT_ANSWERS: JSON.stringify([
|
|
360
360
|
"1", // provider: telegram
|
|
361
361
|
"2", // bot entry: ryoai_bot
|
|
362
|
-
"1", // keep username
|
|
363
362
|
"1", // keep token
|
|
364
363
|
"2", // grouped role settings: edit one role
|
|
365
364
|
"3", // select role to edit: worker
|
|
@@ -381,6 +380,11 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
381
380
|
]),
|
|
382
381
|
},
|
|
383
382
|
});
|
|
383
|
+
push(
|
|
384
|
+
"bot_edit_grouped_server_roles_skips_local_username_prompt",
|
|
385
|
+
!String(groupedEditResult.stdout || "").includes("Telegram username (without @)"),
|
|
386
|
+
String(groupedEditResult.stdout || "").split(/\r?\n/).filter((line) => line.includes("Telegram username")).join(" | ") || "username prompt skipped",
|
|
387
|
+
);
|
|
384
388
|
const groupedRunnerConfigPath = path.join(tempHome, ".metheus", "bot-runner.json");
|
|
385
389
|
const groupedRunnerConfig = readJSON(fs.readFileSync(groupedRunnerConfigPath, "utf8"));
|
|
386
390
|
push(
|
|
@@ -487,7 +491,7 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
487
491
|
`routes=${JSON.stringify(safeObject(showWithRoutesPayload.routeLinks))}`,
|
|
488
492
|
);
|
|
489
493
|
|
|
490
|
-
await runCLI({
|
|
494
|
+
const guidedEditResult = await runCLI({
|
|
491
495
|
cliPath,
|
|
492
496
|
args: ["bot", "edit"],
|
|
493
497
|
env: {
|
|
@@ -495,7 +499,6 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
495
499
|
METHEUS_SCRIPTED_PROMPT_ANSWERS: JSON.stringify([
|
|
496
500
|
"1", // provider: telegram
|
|
497
501
|
"1", // bot entry: @monitorselftestbot
|
|
498
|
-
"1", // keep username
|
|
499
502
|
"1", // keep token
|
|
500
503
|
"2", // change AI client
|
|
501
504
|
"4", // gemini
|
|
@@ -510,6 +513,11 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
510
513
|
]),
|
|
511
514
|
},
|
|
512
515
|
});
|
|
516
|
+
push(
|
|
517
|
+
"bot_edit_single_server_binding_skips_local_username_prompt",
|
|
518
|
+
!String(guidedEditResult.stdout || "").includes("Telegram username (without @)"),
|
|
519
|
+
String(guidedEditResult.stdout || "").split(/\r?\n/).filter((line) => line.includes("Telegram username")).join(" | ") || "username prompt skipped",
|
|
520
|
+
);
|
|
513
521
|
const guidedState = parseSimpleEnvText(fs.readFileSync(telegramEnvPath, "utf8"));
|
|
514
522
|
push(
|
|
515
523
|
"bot_edit_guided_prompts_update_ai_binding_fields",
|