All skills now reference Docker CLI instead of Apple Container CLI. Setup skill defaults to Docker with optional /convert-to-apple-container. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1.9 KiB
1.9 KiB
Intent: src/index.ts modifications
What changed
Added Discord as a channel option alongside WhatsApp, introducing multi-channel infrastructure.
Key sections
Imports (top of file)
- Added:
DiscordChannelfrom./channels/discord.js - Added:
DISCORD_BOT_TOKEN,DISCORD_ONLYfrom./config.js - Added:
findChannelfrom./router.js - Added:
Channelfrom./types.js
Multi-channel infrastructure
- Added:
const channels: Channel[] = []array to hold all active channels - Changed:
processGroupMessagesusesfindChannel(channels, chatJid)instead ofwhatsappdirectly - Changed:
startMessageLoopusesfindChannel(channels, chatJid)instead ofwhatsappdirectly - Changed:
channel.setTyping?.()instead ofwhatsapp.setTyping() - Changed:
channel.sendMessage()instead ofwhatsapp.sendMessage()
getAvailableGroups()
- Unchanged: uses
c.is_groupfilter from base (Discord channels passisGroup=trueviaonChatMetadata)
main()
- Added:
channelOptsshared callback object for all channels - Changed: WhatsApp conditional to
if (!DISCORD_ONLY) - Added: conditional Discord creation (
if (DISCORD_BOT_TOKEN)) - Changed: shutdown iterates
channelsarray instead of justwhatsapp - Changed: subsystems use
findChannel(channels, jid)for message routing
Invariants
- All existing message processing logic (triggers, cursors, idle timers) is preserved
- The
runAgentfunction is completely unchanged - State management (loadState/saveState) is unchanged
- Recovery logic is unchanged
- Container runtime check is unchanged (ensureContainerSystemRunning)
Must-keep
- The
escapeXmlandformatMessagesre-exports - The
_setRegisteredGroupstest helper - The
isDirectRunguard at bottom - All error handling and cursor rollback logic in processGroupMessages
- The outgoing queue flush and reconnection logic (in WhatsAppChannel, not here)