metheus-governance-mcp-cli 0.2.66 → 0.2.68
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 +8 -0
- package/cli.mjs +2 -2
- package/lib/bot-commands.mjs +55 -7
- package/lib/selftest-bot-commands.mjs +9 -7
- package/package.json +1 -1
- package/postinstall.mjs +18 -0
package/README.md
CHANGED
|
@@ -226,7 +226,9 @@ Behavior:
|
|
|
226
226
|
|
|
227
227
|
- `bot setup` asks for `Telegram / Slack / KakaoTalk` first, then prompts with numbered actions.
|
|
228
228
|
- `bot add` without flags starts a guided question flow: provider -> server bot -> local bot key -> token -> verify -> role/AI binding -> default bot choice.
|
|
229
|
+
- When you choose a server Telegram bot profile such as `RyoAI_bot [monitor]`, the CLI automatically uses that server role as the local `role_profile` and fills blank AI defaults from your local `bot-runner.json` `role_profiles` mapping.
|
|
229
230
|
- `bot edit` without flags starts a guided numbered flow: provider -> bot entry -> guided edit -> step-by-step field choices.
|
|
231
|
+
- In guided `bot edit`, changing the bound server Telegram bot profile can also auto-fill blank local AI fields from the selected server role.
|
|
230
232
|
- `bot set-default` without flags starts a guided numbered flow: provider -> bot entry -> confirm default change.
|
|
231
233
|
- `bot verify` without flags starts a guided numbered flow: provider -> bot entry -> output format.
|
|
232
234
|
- `bot remove` without flags starts a guided numbered flow: provider -> bot entry -> confirm removal.
|
|
@@ -379,6 +381,12 @@ Role profile fields:
|
|
|
379
381
|
- `permission_mode`: `read_only`, `workspace_write`, `danger_full_access`
|
|
380
382
|
- `reasoning_effort`: `low`, `medium`, `high`
|
|
381
383
|
|
|
384
|
+
Recommended role mapping:
|
|
385
|
+
- `monitor`: `read_only` + `low`
|
|
386
|
+
- `review`: `read_only` + `medium`
|
|
387
|
+
- `worker`: `danger_full_access` + `medium`
|
|
388
|
+
- `approval`: `danger_full_access` + `high`
|
|
389
|
+
|
|
382
390
|
Role profile note:
|
|
383
391
|
- Claude maps `reasoning_effort` to `--effort`.
|
|
384
392
|
- Codex maps `reasoning_effort` to `-c model_reasoning_effort="..."`.
|
package/cli.mjs
CHANGED
|
@@ -809,13 +809,13 @@ function defaultBotRunnerRoleProfiles() {
|
|
|
809
809
|
worker: {
|
|
810
810
|
client: "codex",
|
|
811
811
|
model: "",
|
|
812
|
-
permission_mode: "
|
|
812
|
+
permission_mode: "danger_full_access",
|
|
813
813
|
reasoning_effort: "medium",
|
|
814
814
|
},
|
|
815
815
|
approval: {
|
|
816
816
|
client: "gemini",
|
|
817
817
|
model: "",
|
|
818
|
-
permission_mode: "
|
|
818
|
+
permission_mode: "danger_full_access",
|
|
819
819
|
reasoning_effort: "high",
|
|
820
820
|
},
|
|
821
821
|
};
|
package/lib/bot-commands.mjs
CHANGED
|
@@ -513,6 +513,7 @@ async function editTelegramBotGuided(ui, parsed, selected, current, flags, deps)
|
|
|
513
513
|
if (!current.roleProfile && serverBot.role) {
|
|
514
514
|
current.roleProfile = serverBot.role;
|
|
515
515
|
}
|
|
516
|
+
applyRoleProfileDefaults(current, resolveRoleProfileDefaults(current.roleProfile || serverBot.role, deps));
|
|
516
517
|
} else if (bindingAction === "clear") {
|
|
517
518
|
current.serverBotID = "";
|
|
518
519
|
}
|
|
@@ -560,6 +561,7 @@ async function editTelegramBotGuided(ui, parsed, selected, current, flags, deps)
|
|
|
560
561
|
current.roleProfile = requireDependency(deps, "normalizeRunnerRoleProfileName")(
|
|
561
562
|
await promptTelegramRoleProfile(ui, deps, current.roleProfile),
|
|
562
563
|
);
|
|
564
|
+
applyRoleProfileDefaults(current, resolveRoleProfileDefaults(current.roleProfile, deps));
|
|
563
565
|
} else if (roleAction === "clear") {
|
|
564
566
|
current.roleProfile = "";
|
|
565
567
|
}
|
|
@@ -941,6 +943,49 @@ async function promptReasoningEffort(ui, defaultValue = "") {
|
|
|
941
943
|
return String(selected?.value || "").trim();
|
|
942
944
|
}
|
|
943
945
|
|
|
946
|
+
function resolveRoleProfileDefaults(roleProfileName, deps) {
|
|
947
|
+
const profileName = String(roleProfileName || "").trim();
|
|
948
|
+
if (!profileName) {
|
|
949
|
+
return {
|
|
950
|
+
client: "",
|
|
951
|
+
model: "",
|
|
952
|
+
permissionMode: "",
|
|
953
|
+
reasoningEffort: "",
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
const config = requireDependency(deps, "loadBotRunnerConfig")({ persistIfNeeded: true });
|
|
957
|
+
const profile = safeObject(safeObject(config.roleProfiles || {})[profileName]);
|
|
958
|
+
return {
|
|
959
|
+
client: requireDependency(deps, "normalizeLocalAIClientName")(profile.client || "", ""),
|
|
960
|
+
model: String(profile.model || "").trim(),
|
|
961
|
+
permissionMode: requireDependency(deps, "normalizeLocalAIPermissionMode")(
|
|
962
|
+
profile.permission_mode || profile.permissionMode || "",
|
|
963
|
+
"",
|
|
964
|
+
),
|
|
965
|
+
reasoningEffort: requireDependency(deps, "normalizeLocalAIReasoningEffort")(
|
|
966
|
+
profile.reasoning_effort || profile.reasoningEffort || "",
|
|
967
|
+
"",
|
|
968
|
+
),
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
function applyRoleProfileDefaults(entry, defaults, { overwrite = false } = {}) {
|
|
973
|
+
const current = safeObject(entry);
|
|
974
|
+
const resolved = safeObject(defaults);
|
|
975
|
+
if (overwrite || !String(current.client || "").trim()) {
|
|
976
|
+
current.client = String(resolved.client || "").trim();
|
|
977
|
+
}
|
|
978
|
+
if (overwrite || !String(current.model || "").trim()) {
|
|
979
|
+
current.model = String(resolved.model || "").trim();
|
|
980
|
+
}
|
|
981
|
+
if (overwrite || !String(current.permissionMode || "").trim()) {
|
|
982
|
+
current.permissionMode = String(resolved.permissionMode || "").trim();
|
|
983
|
+
}
|
|
984
|
+
if (overwrite || !String(current.reasoningEffort || "").trim()) {
|
|
985
|
+
current.reasoningEffort = String(resolved.reasoningEffort || "").trim();
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
944
989
|
function buildTemporaryTelegramEnvConfig({ token, apiBaseURL }) {
|
|
945
990
|
return {
|
|
946
991
|
ok: true,
|
|
@@ -1033,23 +1078,26 @@ async function addTelegramBot(ui, flags, deps) {
|
|
|
1033
1078
|
? String(flags["role-profile"] || defaultRoleProfile).trim()
|
|
1034
1079
|
: await promptTelegramRoleProfile(ui, deps, defaultRoleProfile),
|
|
1035
1080
|
);
|
|
1081
|
+
const roleProfileDefaults = resolveRoleProfileDefaults(roleProfile, deps);
|
|
1036
1082
|
const client = requireDependency(deps, "normalizeLocalAIClientName")(
|
|
1037
1083
|
nonInteractive
|
|
1038
|
-
? getAIClientFlag(flags)
|
|
1039
|
-
: await promptAIClient(ui, deps, getAIClientFlag(flags)),
|
|
1084
|
+
? firstNonEmptyString([getAIClientFlag(flags), roleProfileDefaults.client])
|
|
1085
|
+
: await promptAIClient(ui, deps, firstNonEmptyString([getAIClientFlag(flags), roleProfileDefaults.client])),
|
|
1040
1086
|
"",
|
|
1041
1087
|
);
|
|
1042
|
-
const model = nonInteractive
|
|
1088
|
+
const model = nonInteractive
|
|
1089
|
+
? firstNonEmptyString([getAIModelFlag(flags), roleProfileDefaults.model])
|
|
1090
|
+
: await promptLine(ui, "AI model", firstNonEmptyString([getAIModelFlag(flags), roleProfileDefaults.model]));
|
|
1043
1091
|
const permissionMode = requireDependency(deps, "normalizeLocalAIPermissionMode")(
|
|
1044
1092
|
nonInteractive
|
|
1045
|
-
? getAIPermissionModeFlag(flags)
|
|
1046
|
-
: await promptPermissionMode(ui, getAIPermissionModeFlag(flags)),
|
|
1093
|
+
? firstNonEmptyString([getAIPermissionModeFlag(flags), roleProfileDefaults.permissionMode])
|
|
1094
|
+
: await promptPermissionMode(ui, firstNonEmptyString([getAIPermissionModeFlag(flags), roleProfileDefaults.permissionMode])),
|
|
1047
1095
|
"",
|
|
1048
1096
|
);
|
|
1049
1097
|
const reasoningEffort = requireDependency(deps, "normalizeLocalAIReasoningEffort")(
|
|
1050
1098
|
nonInteractive
|
|
1051
|
-
? getAIReasoningEffortFlag(flags)
|
|
1052
|
-
: await promptReasoningEffort(ui, getAIReasoningEffortFlag(flags)),
|
|
1099
|
+
? firstNonEmptyString([getAIReasoningEffortFlag(flags), roleProfileDefaults.reasoningEffort])
|
|
1100
|
+
: await promptReasoningEffort(ui, firstNonEmptyString([getAIReasoningEffortFlag(flags), roleProfileDefaults.reasoningEffort])),
|
|
1053
1101
|
"",
|
|
1054
1102
|
);
|
|
1055
1103
|
|
|
@@ -276,11 +276,11 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
276
276
|
"selftest-main-token",
|
|
277
277
|
"y", // verify now
|
|
278
278
|
"", // keep verified username
|
|
279
|
-
"
|
|
280
|
-
"
|
|
281
|
-
"
|
|
282
|
-
"
|
|
283
|
-
"
|
|
279
|
+
"", // keep role profile default from selected server role
|
|
280
|
+
"", // keep AI client default from role profile
|
|
281
|
+
"", // keep AI model default from role profile
|
|
282
|
+
"", // keep permission default from role profile
|
|
283
|
+
"", // keep reasoning default from role profile
|
|
284
284
|
"y", // set as default
|
|
285
285
|
]),
|
|
286
286
|
},
|
|
@@ -290,10 +290,12 @@ export async function runSelftestBotCommands(push, deps) {
|
|
|
290
290
|
"bot_add_guided_creates_named_telegram_entry",
|
|
291
291
|
String(addState.TELEGRAM_BOT_MAIN_TEST_SERVER_BOT_ID || "") === mock.bots[0].id
|
|
292
292
|
&& String(addState.TELEGRAM_BOT_MAIN_TEST_USERNAME || "").trim().toLowerCase() === "monitorselftestbot"
|
|
293
|
+
&& String(addState.TELEGRAM_BOT_MAIN_TEST_ROLE_PROFILE || "") === "monitor"
|
|
293
294
|
&& String(addState.TELEGRAM_BOT_MAIN_TEST_AI_CLIENT || "") === "codex"
|
|
294
|
-
&& String(addState.
|
|
295
|
+
&& String(addState.TELEGRAM_BOT_MAIN_TEST_AI_PERMISSION_MODE || "") === "read_only"
|
|
296
|
+
&& String(addState.TELEGRAM_BOT_MAIN_TEST_AI_REASONING_EFFORT || "") === "low"
|
|
295
297
|
&& String(addState.TELEGRAM_DEFAULT_BOT_KEY || "") === "main_test",
|
|
296
|
-
`default=${String(addState.TELEGRAM_DEFAULT_BOT_KEY || "")}
|
|
298
|
+
`default=${String(addState.TELEGRAM_DEFAULT_BOT_KEY || "")} role=${String(addState.TELEGRAM_BOT_MAIN_TEST_ROLE_PROFILE || "")} client=${String(addState.TELEGRAM_BOT_MAIN_TEST_AI_CLIENT || "")}`,
|
|
297
299
|
);
|
|
298
300
|
|
|
299
301
|
const showResult = await runCLI({
|
package/package.json
CHANGED
package/postinstall.mjs
CHANGED
|
@@ -80,6 +80,24 @@ function botRunnerTemplate() {
|
|
|
80
80
|
permission_mode: "read_only",
|
|
81
81
|
reasoning_effort: "low",
|
|
82
82
|
},
|
|
83
|
+
review: {
|
|
84
|
+
client: "claude",
|
|
85
|
+
model: "",
|
|
86
|
+
permission_mode: "read_only",
|
|
87
|
+
reasoning_effort: "medium",
|
|
88
|
+
},
|
|
89
|
+
worker: {
|
|
90
|
+
client: "codex",
|
|
91
|
+
model: "",
|
|
92
|
+
permission_mode: "danger_full_access",
|
|
93
|
+
reasoning_effort: "medium",
|
|
94
|
+
},
|
|
95
|
+
approval: {
|
|
96
|
+
client: "gemini",
|
|
97
|
+
model: "",
|
|
98
|
+
permission_mode: "danger_full_access",
|
|
99
|
+
reasoning_effort: "high",
|
|
100
|
+
},
|
|
83
101
|
},
|
|
84
102
|
bot_bindings: {
|
|
85
103
|
"<binding_key>": {
|