Fix WebSocket crash + heartbeat default 10min + docs refresh

- Wrap Baileys connection.update listeners in try-catch to prevent
  unhandled exceptions from crashing the relay process
- Add WebSocket-level error handlers in session.ts
- Add global unhandledRejection/uncaughtException handlers in index.ts
- Make listener.onClose error-safe with .catch() in auto-reply.ts
- Change default heartbeat from 30min to 10min
- Rewrite claude-config.md with personality, better explain personal
  assistant features, add recommended MCPs section
This commit is contained in:
Peter Steinberger
2025-11-27 18:21:14 +01:00
parent 549ad272fc
commit 85f53a4174
7 changed files with 297 additions and 87 deletions

View File

@@ -45,7 +45,7 @@ export type WebMonitorTuning = {
const formatDuration = (ms: number) =>
ms >= 1000 ? `${(ms / 1000).toFixed(2)}s` : `${ms}ms`;
const DEFAULT_REPLY_HEARTBEAT_MINUTES = 30;
const DEFAULT_REPLY_HEARTBEAT_MINUTES = 10;
export const HEARTBEAT_TOKEN = "HEARTBEAT_OK";
export const HEARTBEAT_PROMPT = "HEARTBEAT ultrathink";
@@ -758,7 +758,13 @@ export async function monitorWebProvider(
}
const reason = await Promise.race([
listener.onClose ?? waitForever(),
listener.onClose?.catch((err) => {
reconnectLogger.error(
{ error: String(err) },
"listener.onClose rejected",
);
return { status: 500, isLoggedOut: false, error: err };
}) ?? waitForever(),
abortPromise ?? waitForever(),
]);