feat: harden intelligence runtime and llm providers

This commit is contained in:
2026-05-16 21:18:34 +02:00
parent 7e85a54c32
commit 85f97bb2a6
22 changed files with 732 additions and 201 deletions

View File

@@ -41,6 +41,8 @@ export class TelegramAlerter {
this._commandHandlers = {}; // Registered command callbacks
this._pollingInterval = null;
this._botUsername = null;
this._pollFailureCount = 0;
this._lastPollErrorLogAt = 0;
}
get isConfigured() {
@@ -353,6 +355,7 @@ export class TelegramAlerter {
const data = await res.json();
if (!data.ok || !Array.isArray(data.result)) return;
this._pollFailureCount = 0;
for (const update of data.result) {
this._lastUpdateId = Math.max(this._lastUpdateId, update.update_id);
@@ -366,9 +369,14 @@ export class TelegramAlerter {
await this._handleMessage(msg);
}
} catch (err) {
// Silent — polling failures are non-fatal
this._pollFailureCount++;
if (!err.message?.includes('aborted')) {
console.error('[Telegram] Poll error:', err.message);
const now = Date.now();
const quietMs = Math.min(300000, 30000 * this._pollFailureCount);
if (now - this._lastPollErrorLogAt > quietMs) {
this._lastPollErrorLogAt = now;
console.error(`[Telegram] Poll degraded (${this._pollFailureCount} consecutive failures):`, err.message);
}
}
}
}