Intent: src/index.ts modifications
What changed
Added Feishu channel initialization alongside existing channels.
Key sections
Imports (top of file)
- Added:
FeishuChannelfrom./channels/feishu.js - Added:
readEnvFilefrom./env.js
main()
- Added: After WhatsApp connect, reads
FEISHU_APP_IDandFEISHU_APP_SECRETviareadEnvFile()(NanoClaw does NOT load.envintoprocess.env) - Added: If both are set, creates
FeishuChannelwith sharedchannelOptsplusappId/appSecret, pushes tochannels[], callsconnect()
Invariants
- All existing message processing logic is preserved
- WhatsApp channel creation is unchanged
- State management, recovery, scheduler, IPC — all unchanged
- The
channels[]array andfindChannel()routing already exist (added by multi-channel refactor)
Must-keep
- All existing exports (
escapeXml,formatMessages,_setRegisteredGroups) - The
isDirectRunguard at bottom - All error handling and cursor rollback logic
- The
readEnvFilepattern — all.envvalues must go through this function, NOTprocess.envalone