metheus-governance-mcp-cli 0.2.99 → 0.2.100
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 +29 -17
- package/package.json +1 -1
package/lib/bot-commands.mjs
CHANGED
|
@@ -1475,6 +1475,18 @@ async function resolveServerBotForNonInteractive(provider, flags, deps, options
|
|
|
1475
1475
|
if (!match) {
|
|
1476
1476
|
throw new Error(`server bot ${requestedBotID} not found`);
|
|
1477
1477
|
}
|
|
1478
|
+
const sameNameMatches = bots.filter(
|
|
1479
|
+
(bot) => normalizeServerBotIdentityText(bot.name) === normalizeServerBotIdentityText(match.name),
|
|
1480
|
+
);
|
|
1481
|
+
if (sameNameMatches.length > 1) {
|
|
1482
|
+
return {
|
|
1483
|
+
botID: match.id,
|
|
1484
|
+
role: "",
|
|
1485
|
+
name: match.name,
|
|
1486
|
+
roles: summarizeServerBotRoles(sameNameMatches),
|
|
1487
|
+
matchMode: "group",
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1478
1490
|
return {
|
|
1479
1491
|
botID: match.id,
|
|
1480
1492
|
role: match.role,
|
|
@@ -2189,16 +2201,6 @@ async function addTelegramBot(ui, flags, deps) {
|
|
|
2189
2201
|
`Matched server Telegram bot "${serverBot.name || username || botKey}" with roles: ${ensureArray(serverBot.roles).join(", ")}. Runtime will use the server role, so local role/AI fields can stay empty.\n`,
|
|
2190
2202
|
);
|
|
2191
2203
|
}
|
|
2192
|
-
const defaultRoleProfile = firstNonEmptyString([flags["role-profile"], serverBot.role, ""]);
|
|
2193
|
-
const roleProfileAutoResolved = !nonInteractive && !String(flags["role-profile"] || "").trim() && Boolean(defaultRoleProfile);
|
|
2194
|
-
const roleProfile = requireDependency(deps, "normalizeRunnerRoleProfileName")(
|
|
2195
|
-
nonInteractive
|
|
2196
|
-
? String(flags["role-profile"] || defaultRoleProfile).trim()
|
|
2197
|
-
: (serverGroupMatched && !String(flags["role-profile"] || "").trim()
|
|
2198
|
-
? ""
|
|
2199
|
-
: (roleProfileAutoResolved ? defaultRoleProfile : await promptTelegramRoleProfile(ui, deps, defaultRoleProfile))),
|
|
2200
|
-
);
|
|
2201
|
-
const roleProfileDefaults = resolveRoleProfileDefaults(roleProfile, deps);
|
|
2202
2204
|
const aiFlagOverrides = hasOwnFlag(flags, "client")
|
|
2203
2205
|
|| hasOwnFlag(flags, "ai-client")
|
|
2204
2206
|
|| hasOwnFlag(flags, "model")
|
|
@@ -2207,13 +2209,23 @@ async function addTelegramBot(ui, flags, deps) {
|
|
|
2207
2209
|
|| hasOwnFlag(flags, "ai-permission-mode")
|
|
2208
2210
|
|| hasOwnFlag(flags, "reasoning-effort")
|
|
2209
2211
|
|| hasOwnFlag(flags, "ai-reasoning-effort");
|
|
2210
|
-
const
|
|
2212
|
+
const defaultRoleProfile = firstNonEmptyString([flags["role-profile"], serverBot.role, ""]);
|
|
2213
|
+
const roleProfileAutoResolved = !nonInteractive && !String(flags["role-profile"] || "").trim() && Boolean(defaultRoleProfile);
|
|
2211
2214
|
const autoUseServerRoleRouting = serverGroupMatched
|
|
2212
2215
|
&& !String(flags["role-profile"] || "").trim()
|
|
2213
2216
|
&& !aiFlagOverrides;
|
|
2217
|
+
const roleProfile = requireDependency(deps, "normalizeRunnerRoleProfileName")(
|
|
2218
|
+
nonInteractive
|
|
2219
|
+
? (autoUseServerRoleRouting ? "" : String(flags["role-profile"] || defaultRoleProfile).trim())
|
|
2220
|
+
: (serverGroupMatched && !String(flags["role-profile"] || "").trim()
|
|
2221
|
+
? ""
|
|
2222
|
+
: (roleProfileAutoResolved ? defaultRoleProfile : await promptTelegramRoleProfile(ui, deps, defaultRoleProfile))),
|
|
2223
|
+
);
|
|
2224
|
+
const roleProfileDefaults = resolveRoleProfileDefaults(roleProfile, deps);
|
|
2225
|
+
const autoApplyRoleDefaults = !nonInteractive && roleProfileAutoResolved && !aiFlagOverrides;
|
|
2214
2226
|
const client = requireDependency(deps, "normalizeLocalAIClientName")(
|
|
2215
2227
|
nonInteractive
|
|
2216
|
-
? firstNonEmptyString([getAIClientFlag(flags), roleProfileDefaults.client])
|
|
2228
|
+
? (autoUseServerRoleRouting ? getAIClientFlag(flags) : firstNonEmptyString([getAIClientFlag(flags), roleProfileDefaults.client]))
|
|
2217
2229
|
: (autoUseServerRoleRouting
|
|
2218
2230
|
? getAIClientFlag(flags)
|
|
2219
2231
|
: (autoApplyRoleDefaults
|
|
@@ -2222,15 +2234,15 @@ async function addTelegramBot(ui, flags, deps) {
|
|
|
2222
2234
|
"",
|
|
2223
2235
|
);
|
|
2224
2236
|
const model = nonInteractive
|
|
2225
|
-
? firstNonEmptyString([getAIModelFlag(flags), roleProfileDefaults.model])
|
|
2237
|
+
? (autoUseServerRoleRouting ? getAIModelFlag(flags) : firstNonEmptyString([getAIModelFlag(flags), roleProfileDefaults.model]))
|
|
2226
2238
|
: (autoUseServerRoleRouting
|
|
2227
2239
|
? getAIModelFlag(flags)
|
|
2228
2240
|
: (autoApplyRoleDefaults
|
|
2229
|
-
|
|
2230
|
-
|
|
2241
|
+
? await promptAIModel(ui, deps, client, firstNonEmptyString([getAIModelFlag(flags), roleProfileDefaults.model]))
|
|
2242
|
+
: await promptAIModel(ui, deps, client, firstNonEmptyString([getAIModelFlag(flags), roleProfileDefaults.model]))));
|
|
2231
2243
|
const permissionMode = requireDependency(deps, "normalizeLocalAIPermissionMode")(
|
|
2232
2244
|
nonInteractive
|
|
2233
|
-
? firstNonEmptyString([getAIPermissionModeFlag(flags), roleProfileDefaults.permissionMode])
|
|
2245
|
+
? (autoUseServerRoleRouting ? getAIPermissionModeFlag(flags) : firstNonEmptyString([getAIPermissionModeFlag(flags), roleProfileDefaults.permissionMode]))
|
|
2234
2246
|
: (autoUseServerRoleRouting
|
|
2235
2247
|
? getAIPermissionModeFlag(flags)
|
|
2236
2248
|
: (autoApplyRoleDefaults
|
|
@@ -2240,7 +2252,7 @@ async function addTelegramBot(ui, flags, deps) {
|
|
|
2240
2252
|
);
|
|
2241
2253
|
const reasoningEffort = requireDependency(deps, "normalizeLocalAIReasoningEffort")(
|
|
2242
2254
|
nonInteractive
|
|
2243
|
-
? firstNonEmptyString([getAIReasoningEffortFlag(flags), roleProfileDefaults.reasoningEffort])
|
|
2255
|
+
? (autoUseServerRoleRouting ? getAIReasoningEffortFlag(flags) : firstNonEmptyString([getAIReasoningEffortFlag(flags), roleProfileDefaults.reasoningEffort]))
|
|
2244
2256
|
: (autoUseServerRoleRouting
|
|
2245
2257
|
? getAIReasoningEffortFlag(flags)
|
|
2246
2258
|
: (autoApplyRoleDefaults
|