open-agents-ai 0.50.0 → 0.51.0
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/dist/index.js +38 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20941,27 +20941,36 @@ async function handleSlashCommand(input, ctx) {
|
|
|
20941
20941
|
ctx.telegramStatus?.();
|
|
20942
20942
|
return "handled";
|
|
20943
20943
|
}
|
|
20944
|
+
const isLocal = parts.includes("--local");
|
|
20944
20945
|
const keyIdx = parts.indexOf("--key");
|
|
20945
|
-
if (keyIdx !== -1) {
|
|
20946
|
-
const token = parts[keyIdx + 1];
|
|
20947
|
-
if (!token) {
|
|
20948
|
-
renderWarning("Usage: /telegram --key <bot-token>");
|
|
20949
|
-
renderInfo("Get a bot token from @BotFather on Telegram.");
|
|
20950
|
-
return "handled";
|
|
20951
|
-
}
|
|
20952
|
-
ctx.saveTelegramSettings?.({ key: token });
|
|
20953
|
-
renderInfo(`Telegram bot token saved (${token.slice(0, 6)}...). Use /telegram to start.`);
|
|
20954
|
-
return "handled";
|
|
20955
|
-
}
|
|
20956
20946
|
const adminIdx = parts.indexOf("--admin");
|
|
20957
|
-
if (adminIdx !== -1) {
|
|
20958
|
-
const
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
20947
|
+
if (keyIdx !== -1 || adminIdx !== -1) {
|
|
20948
|
+
const settings = { local: isLocal };
|
|
20949
|
+
const scope = isLocal ? "project" : "global";
|
|
20950
|
+
if (keyIdx !== -1) {
|
|
20951
|
+
const token = parts[keyIdx + 1];
|
|
20952
|
+
if (!token || token.startsWith("--")) {
|
|
20953
|
+
renderWarning("Usage: /telegram --key <bot-token> [--admin <id>] [--local]");
|
|
20954
|
+
renderInfo("Get a bot token from @BotFather on Telegram.");
|
|
20955
|
+
return "handled";
|
|
20956
|
+
}
|
|
20957
|
+
settings.key = token;
|
|
20958
|
+
}
|
|
20959
|
+
if (adminIdx !== -1) {
|
|
20960
|
+
const userId = parts[adminIdx + 1];
|
|
20961
|
+
if (!userId || userId.startsWith("--")) {
|
|
20962
|
+
renderWarning("Usage: /telegram --admin <user-id-or-username> [--key <token>] [--local]");
|
|
20963
|
+
return "handled";
|
|
20964
|
+
}
|
|
20965
|
+
settings.admin = userId;
|
|
20966
|
+
}
|
|
20967
|
+
ctx.saveTelegramSettings?.(settings);
|
|
20968
|
+
if (settings.key)
|
|
20969
|
+
renderInfo(`Telegram bot token saved to ${scope} settings (${settings.key.slice(0, 6)}...).`);
|
|
20970
|
+
if (settings.admin)
|
|
20971
|
+
renderInfo(`Telegram admin set to ${c2.bold(settings.admin)} (${scope}).`);
|
|
20972
|
+
if (!ctx.isTelegramActive?.() && settings.key)
|
|
20973
|
+
renderInfo("Use /telegram to start.");
|
|
20965
20974
|
return "handled";
|
|
20966
20975
|
}
|
|
20967
20976
|
if (!arg) {
|
|
@@ -20985,11 +20994,12 @@ async function handleSlashCommand(input, ctx) {
|
|
|
20985
20994
|
}
|
|
20986
20995
|
renderWarning(`Unknown argument: "${arg}"`);
|
|
20987
20996
|
renderInfo("Usage:");
|
|
20988
|
-
renderInfo(" /telegram --key <token> Save bot token");
|
|
20989
|
-
renderInfo(" /telegram --admin <id> Set admin
|
|
20997
|
+
renderInfo(" /telegram --key <token> Save bot token (global)");
|
|
20998
|
+
renderInfo(" /telegram --admin <id> Set admin filter (global)");
|
|
20990
20999
|
renderInfo(" /telegram Toggle on/off");
|
|
20991
21000
|
renderInfo(" /telegram stop Stop bridge");
|
|
20992
21001
|
renderInfo(" /telegram status Show status");
|
|
21002
|
+
renderInfo(" Add --local to scope settings to this project only");
|
|
20993
21003
|
return "handled";
|
|
20994
21004
|
}
|
|
20995
21005
|
default: {
|
|
@@ -30753,10 +30763,15 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
30753
30763
|
if (settings.admin !== void 0) {
|
|
30754
30764
|
savedSettings.telegramAdmin = settings.admin;
|
|
30755
30765
|
}
|
|
30756
|
-
|
|
30766
|
+
const payload = {
|
|
30757
30767
|
...settings.key !== void 0 ? { telegramKey: settings.key } : {},
|
|
30758
30768
|
...settings.admin !== void 0 ? { telegramAdmin: settings.admin } : {}
|
|
30759
|
-
}
|
|
30769
|
+
};
|
|
30770
|
+
if (settings.local) {
|
|
30771
|
+
saveProjectSettings(repoRoot, payload);
|
|
30772
|
+
} else {
|
|
30773
|
+
saveGlobalSettings(payload);
|
|
30774
|
+
}
|
|
30760
30775
|
},
|
|
30761
30776
|
telegramStatus() {
|
|
30762
30777
|
const active = telegramBridge?.isActive ?? false;
|
package/package.json
CHANGED