appback-remoteagent 0.13.1 → 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.
package/dist/bot.js CHANGED
@@ -1030,22 +1030,29 @@ function sanitizeLoggedTelegramText(text) {
1030
1030
  async function runWithPendingAnimation(botToken, chatId, task) {
1031
1031
  let typingStopped = false;
1032
1032
  let typingTimer;
1033
- const typingStartedAt = Date.now();
1033
+ let typingInFlight = false;
1034
1034
  const pulseTyping = () => {
1035
1035
  if (typingStopped) {
1036
1036
  return;
1037
1037
  }
1038
- void sendTelegramChatAction(botToken, chatId, "typing").catch((error) => {
1039
- if (isTelegramForbiddenError(error)) {
1040
- console.warn(`[telegram-delivery] chat=${chatId} skipped typing action: ${error instanceof Error ? error.message : String(error)}`);
1041
- typingStopped = true;
1042
- return;
1043
- }
1044
- console.warn(`[telegram-chat-action] chat=${chatId} failed: ${error instanceof Error ? error.message : String(error)}`);
1045
- });
1046
- const elapsedMs = Date.now() - typingStartedAt;
1047
- const nextDelayMs = elapsedMs < 60_000 ? 4_000 : 30_000;
1048
- typingTimer = setTimeout(pulseTyping, nextDelayMs);
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
+ }
1053
+ typingTimer = setTimeout(() => {
1054
+ pulseTyping();
1055
+ }, config.telegramTypingIntervalMs);
1049
1056
  typingTimer.unref?.();
1050
1057
  };
1051
1058
  pulseTyping();
package/dist/config.js CHANGED
@@ -136,6 +136,7 @@ export const config = {
136
136
  telegramPollingMaxConcurrency: readTimeout("TELEGRAM_POLLING_MAX_CONCURRENCY", 3),
137
137
  telegramOwnerId: readOptional("TELEGRAM_OWNER_ID"),
138
138
  telegramMessageBatchMs: readNonNegativeTimeout("TELEGRAM_MESSAGE_BATCH_MS", 1500),
139
+ telegramTypingIntervalMs: readTimeout("TELEGRAM_TYPING_INTERVAL_MS", 4_000),
139
140
  telegramAutoProgressMaxTurns: readOptionalNonNegativeInteger("TELEGRAM_AUTO_PROGRESS_MAX_TURNS") ?? 6,
140
141
  telegramEmptyResponseRetries: readOptionalNonNegativeInteger("TELEGRAM_EMPTY_RESPONSE_RETRIES") ?? 1,
141
142
  telegramRetryableErrorRetries: readOptionalNonNegativeInteger("TELEGRAM_RETRYABLE_ERROR_RETRIES") ?? 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appback-remoteagent",
3
- "version": "0.13.1",
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",