appback-remoteagent 0.13.18 → 0.13.20

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/bot.js CHANGED
@@ -726,12 +726,12 @@ ${bridge.formatStatus(mapping)}`);
726
726
  return;
727
727
  }
728
728
  if (action === "main") {
729
- const result = await botManagement.setMainBot(rest?.trim() ?? args[1]?.trim() ?? "");
729
+ const result = await botManagement.setMainBot(commandTarget(args, rest));
730
730
  await reply(ctx, result.message);
731
731
  return;
732
732
  }
733
733
  if (action === "remove") {
734
- const result = await botManagement.removeBot(rest?.trim() ?? "", sourceBotId, sourceBotToken, ctx.chat.id);
734
+ const result = await botManagement.removeBot(commandTarget(args, rest), sourceBotId, sourceBotToken, ctx.chat.id);
735
735
  await reply(ctx, result.message);
736
736
  return;
737
737
  }
@@ -741,14 +741,14 @@ ${bridge.formatStatus(mapping)}`);
741
741
  bot.command("sleep", async (ctx) => {
742
742
  await ensureOwnerControlAccess(ctx);
743
743
  const sourceBotId = getBotId();
744
- const { rest } = parseCommand(ctx.message?.text, 2);
745
- const result = await botManagement.sleepBot(rest?.trim() ?? "", sourceBotId);
744
+ const { args, rest } = parseCommand(ctx.message?.text, 1);
745
+ const result = await botManagement.sleepBot(commandTarget(args, rest), sourceBotId);
746
746
  await reply(ctx, result.message);
747
747
  });
748
748
  bot.command("wake", async (ctx) => {
749
749
  await ensureOwnerControlAccess(ctx);
750
- const { rest } = parseCommand(ctx.message?.text, 2);
751
- const result = await botManagement.wakeBot(rest?.trim() ?? "");
750
+ const { args, rest } = parseCommand(ctx.message?.text, 1);
751
+ const result = await botManagement.wakeBot(commandTarget(args, rest));
752
752
  await reply(ctx, result.message);
753
753
  });
754
754
  bot.command("install", async (ctx) => {
@@ -1657,6 +1657,9 @@ function parseCommand(text, headCount) {
1657
1657
  rest: remaining || undefined,
1658
1658
  };
1659
1659
  }
1660
+ function commandTarget(args, rest) {
1661
+ return (rest?.trim() || args.slice(1).join(" ").trim() || args[0]?.trim() || "");
1662
+ }
1660
1663
  function formatSecretHelp() {
1661
1664
  return [
1662
1665
  "Secret command guide",
package/dist/index.js CHANGED
@@ -161,7 +161,11 @@ async function startManualPollingScheduler(bots) {
161
161
  }
162
162
  while (true) {
163
163
  const now = Date.now();
164
+ let activePolls = [...runtimeStates.values()].filter((state) => state.inFlight).length;
164
165
  for (const bot of pollingBots) {
166
+ if (activePolls >= config.telegramPollingMaxConcurrency) {
167
+ break;
168
+ }
165
169
  const botId = String(bot.botInfo.id);
166
170
  const runtime = runtimeStates.get(botId);
167
171
  if (!runtime || runtime.inFlight) {
@@ -177,6 +181,7 @@ async function startManualPollingScheduler(bots) {
177
181
  continue;
178
182
  }
179
183
  runtime.inFlight = true;
184
+ activePolls += 1;
180
185
  void pollTelegramBot(bot, runtime, {
181
186
  isMain,
182
187
  totalBots: pollingBots.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appback-remoteagent",
3
- "version": "0.13.18",
3
+ "version": "0.13.20",
4
4
  "description": "Personal installable session server for continuing local AI work across PC and Telegram",
5
5
  "license": "MIT",
6
6
  "type": "module",