arisa 2.3.22 → 2.3.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arisa",
3
- "version": "2.3.22",
3
+ "version": "2.3.23",
4
4
  "description": "Arisa - dynamic agent runtime with daemon/core architecture that evolves through user interaction",
5
5
  "keywords": [
6
6
  "tinyclaw",
@@ -262,11 +262,25 @@ void autoInstallMissingClis();
262
262
  // --- Start Core process ---
263
263
  startCore();
264
264
 
265
- // --- Connect Telegram ---
266
- telegram.connect().catch((error) => {
267
- log.error(`Telegram connection failed: ${error}`);
268
- process.exit(1);
269
- });
265
+ // --- Connect Telegram (with retry for 409 conflict from stale polling sessions) ---
266
+ (async function connectTelegram(maxRetries = 5) {
267
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
268
+ try {
269
+ await telegram.connect();
270
+ return; // connected — polling continues in background
271
+ } catch (error) {
272
+ const is409 = String(error).includes("409");
273
+ if (is409 && attempt < maxRetries) {
274
+ const wait = attempt * 5;
275
+ log.warn(`Telegram 409 conflict (attempt ${attempt}/${maxRetries}), retrying in ${wait}s...`);
276
+ await new Promise((r) => setTimeout(r, wait * 1000));
277
+ continue;
278
+ }
279
+ log.error(`Telegram connection failed: ${error}`);
280
+ process.exit(1);
281
+ }
282
+ }
283
+ })();
270
284
 
271
285
  // --- Graceful shutdown ---
272
286
  function shutdown() {