Channel vs tool-only is now a code-level decision at skill apply time. If the user chose channel mode, GmailChannel is wired unconditionally. If tool-only, no channel code is added. No runtime flag needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.1 KiB
1.1 KiB
Intent: src/index.ts modifications
What changed
Added Gmail as a channel.
Key sections
Imports (top of file)
- Added:
GmailChannelfrom./channels/gmail.js
main()
- Added Gmail channel creation:
const gmail = new GmailChannel(channelOpts); channels.push(gmail); await gmail.connect(); - Gmail uses the same
channelOptscallbacks as other channels - Incoming emails are delivered to the main group (agent decides how to respond, user can configure)
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
- Any other channel creation is untouched
- Shutdown iterates
channelsarray (Gmail is included automatically)
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