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 +19 -12
- package/dist/config.js +1 -0
- package/package.json +1 -1
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
|
-
|
|
1033
|
+
let typingInFlight = false;
|
|
1034
1034
|
const pulseTyping = () => {
|
|
1035
1035
|
if (typingStopped) {
|
|
1036
1036
|
return;
|
|
1037
1037
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
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,
|