appback-remoteagent 0.13.2 → 0.13.3

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.
Files changed (2) hide show
  1. package/dist/bot.js +19 -30
  2. package/package.json +1 -1
package/dist/bot.js CHANGED
@@ -1030,26 +1030,32 @@ function sanitizeLoggedTelegramText(text) {
1030
1030
  async function runWithPendingAnimation(botToken, chatId, task) {
1031
1031
  let typingStopped = false;
1032
1032
  let typingTimer;
1033
- const pulseTyping = async () => {
1033
+ let typingInFlight = false;
1034
+ const pulseTyping = () => {
1034
1035
  if (typingStopped) {
1035
1036
  return;
1036
1037
  }
1037
- await sendTelegramChatAction(botToken, chatId, "typing").catch((error) => {
1038
- if (isTelegramForbiddenError(error)) {
1039
- console.warn(`[telegram-delivery] chat=${chatId} skipped typing action: ${error instanceof Error ? error.message : String(error)}`);
1040
- typingStopped = true;
1041
- return;
1042
- }
1043
- console.warn(`[telegram-chat-action] chat=${chatId} failed: ${error instanceof Error ? error.message : String(error)}`);
1044
- });
1038
+ if (!typingInFlight) {
1039
+ typingInFlight = true;
1040
+ void sendTelegramChatAction(botToken, chatId, "typing")
1041
+ .catch((error) => {
1042
+ if (isTelegramForbiddenError(error)) {
1043
+ console.warn(`[telegram-delivery] chat=${chatId} skipped typing action: ${error instanceof Error ? error.message : String(error)}`);
1044
+ typingStopped = true;
1045
+ return;
1046
+ }
1047
+ console.warn(`[telegram-chat-action] chat=${chatId} failed: ${error instanceof Error ? error.message : String(error)}`);
1048
+ })
1049
+ .finally(() => {
1050
+ typingInFlight = false;
1051
+ });
1052
+ }
1045
1053
  typingTimer = setTimeout(() => {
1046
- void pulseTyping();
1054
+ pulseTyping();
1047
1055
  }, config.telegramTypingIntervalMs);
1048
1056
  typingTimer.unref?.();
1049
1057
  };
1050
- await withTimeout(pulseTyping(), 1500).catch((error) => {
1051
- console.warn(`[telegram-chat-action] chat=${chatId} initial typing action was not confirmed: ${error instanceof Error ? error.message : String(error)}`);
1052
- });
1058
+ pulseTyping();
1053
1059
  try {
1054
1060
  const helpers = {
1055
1061
  reportProgress: async (chunks, parseMode) => {
@@ -1471,23 +1477,6 @@ function formatProviderTimeoutFinalMessage(message) {
1471
1477
  async function sleep(ms) {
1472
1478
  await new Promise((resolve) => setTimeout(resolve, ms));
1473
1479
  }
1474
- async function withTimeout(promise, timeoutMs) {
1475
- let timer;
1476
- try {
1477
- return await Promise.race([
1478
- promise,
1479
- new Promise((_, reject) => {
1480
- timer = setTimeout(() => reject(new Error(`Timed out after ${timeoutMs}ms`)), timeoutMs);
1481
- timer.unref?.();
1482
- }),
1483
- ]);
1484
- }
1485
- finally {
1486
- if (timer) {
1487
- clearTimeout(timer);
1488
- }
1489
- }
1490
- }
1491
1480
  async function ensureOwnerControlAccess(ctx) {
1492
1481
  if (ctx.chat?.type !== "private") {
1493
1482
  throw new Error("This command is available only in private 1:1 chats.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appback-remoteagent",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "Personal installable session server for continuing local AI work across PC and Telegram",
5
5
  "license": "MIT",
6
6
  "type": "module",