fix: stabilize ChatGPT Web Telegram daemon - #84
Open
stavmatis wants to merge 9 commits into
Open
Conversation
…essaging - Add WhatsAppChannel implementing Channel interface via @whiskeysockets/baileys - Group-based approach: Mercury listens to a WhatsApp group named 'Mercury' - QR code pairing via qrcode-terminal (device linking) - Admin pairing via /pair command in the group - Auto-detect group after connection using groupFetchAllParticipating() - Rate limiting (3s min, 60/hr per chat, 200/hr global, 1000/day) - Reconnection with exponential backoff; immediate reconnect on 515 - Suppress Baileys internal logs (pino level: fatal) - Config tracks: registered, paired, adminPaired, groupId, groupName - CLI: mercury whatsapp status/pair/reset/unregister/list/detect-group/groups/set-group - Onboarding flow resumes from incomplete steps (doctor) - send_file tool supports 'whatsapp' channel - Notification priority: Signal > Telegram > Discord > Slack > WhatsApp > CLI - .env.example: WHATSAPP_ENABLED, WHATSAPP_PHONE_NUMBER, WHATSAPP_MODE, WHATSAPP_GROUP_NAME - tsup externals: @whiskeysockets/baileys, protobufjs, qrcode-terminal, discord.js - protobufjs pinned to 7.4.0 for directory structure stability
- Discord: if already paired (token + admins), show 'Reconfigure? (y/N)' instead of all setup instructions. Default No skips to next section. - Slack: same pattern — 'Reconfigure? (y/N)' when already paired. Full setup extracted to runSlackSetup() helper. - WhatsApp: if fully paired (device + group + admin), show 'WhatsApp linked to [phone] — group detected, admin paired. Reconfigure? (y/N)'. If partially paired, resume from incomplete step (unchanged). If not configured, show first-time setup instructions (unchanged).
…channels - Telegram: if already paired (token + admins), show 'Reconfigure? (y/N)' with status summary instead of full setup instructions. Default No skips. - Signal: if already paired (phone + admins), show 'Reconfigure? (y/N)' with phone number and group name instead of 'Keep existing? (Y/n)'. Full setup extracted to runSignalSetup() and runTelegramSetup() helpers. - completeInitialSignalSetup: removed redundant 'already paired' prompt since the reconfigure decision is now handled by the caller.
- Add ImessagesChannel with full Spectrum SDK integration (cloud mode) - Supports text, markdown, attachments, typing indicators - Auto-captures bot phone number from inbound space.phone - Caches Space objects from inbound messages for reliable reply routing - Echo suppression (sender.kind === 'agent') and LRU dedup - Static allowlist (IMESSAGES_ALLOWED_USERS) accepts phone numbers and Apple ID emails - Add IMessagesChannelConfig and IMessagesAccessUser types - Add channels.imessages config block with env defaults (IMESSAGES_*) - Register imessages in ChannelRegistry and barrel exports - Add iMessages onboarding step to configure/doctor flow - Fix send_file tool: add 'imessages' to channel enum - Fix sendFileHandler: route file sends to iMessages channel - Fix sendFile: add file existence/size checks and MIME type hints - Fix Spectrum API field mapping: sender.address (not .phone), content.markdown (not .text) - Fix timestamp: handle Date objects from Spectrum - Add spectrum-ts 5.1.0 dependency (pinned exact)
- New OpenRouterProvider using @ai-sdk/openai with attribution headers - OpenRouter appears as option 4 in doctor/onboarding provider selection - Search-based model selector with type-to-filter for 300+ models - Model validation against full OpenRouter catalog (rejects typos with suggestions) - 15 curated preferred models shown by default, search for more - Config: OPENROUTER_API_KEY, OPENROUTER_BASE_URL, OPENROUTER_MODEL, OPENROUTER_ENABLED - Web API: openrouter in valid provider names, model validation on save - Provider registry: openrouter entry with fallback chain support - Increased model limit for OpenRouter from 7 to 15 in catalog
- Add SIGPIPE handler at process entry point to prevent Node.js from terminating on closed pipe writes - Filter EPIPE errors in uncaughtException/unhandledRejection handlers instead of writing crash flags for harmless pipe closures - Add process.exit(1) to uncaughtException handler for real errors (previously continued after fatal errors) - Remove crash-flag writes from unhandledRejection (non-fatal, was over-aggressive) - Suppress spectrum-ts INFO logs by setting logLevel to 'error' in the Spectrum constructor (eliminates [spectrum.lifecycle] noise)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests